preset Functions
parent
638e228aa4
commit
56e77f1660
|
|
@ -146,7 +146,18 @@ export class DataService {
|
||||||
}
|
}
|
||||||
res.userPreferences = userPreferences;
|
res.userPreferences = userPreferences;
|
||||||
response.presets.forEach(preset => {
|
response.presets.forEach(preset => {
|
||||||
res.presets.push(preset);
|
console.log(preset);
|
||||||
|
res.presets.push({
|
||||||
|
id: preset.id,
|
||||||
|
name: preset.name,
|
||||||
|
presetType: preset.presetType,
|
||||||
|
definition: JSON.parse(preset.definition)
|
||||||
|
});
|
||||||
|
for (const preset of res.presets) {
|
||||||
|
if(preset.id == 'AGGAA5V0G2LS6ASCSVD9SBS7MO40RV'){
|
||||||
|
res.selectedPreset = preset;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
|
|
@ -174,6 +185,24 @@ export class DataService {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function updateDatePerChange sends the new date to the backend if the date was moved
|
||||||
|
* @param change the Change (the Resource) from which the date should be changed
|
||||||
|
*/
|
||||||
|
public async updatePreset(preset: any){
|
||||||
|
const promise = new Promise(resolve=>{
|
||||||
|
let serializableResource = {id: preset.id, definition: preset.definition};
|
||||||
|
let strigifiedResource = JSON.stringify(serializableResource);
|
||||||
|
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||||
|
this.http.post('http://localhost:8080/api/updatePreset', resJson).subscribe((response:any)=>{
|
||||||
|
resolve(response);
|
||||||
|
},(error:any)=>{
|
||||||
|
resolve(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function fetchStates fetches an array from the possible statuses per state
|
* The function fetchStates fetches an array from the possible statuses per state
|
||||||
* @returns promise for the fetched Status Array
|
* @returns promise for the fetched Status Array
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
||||||
</div>
|
</div>
|
||||||
<mat-form-field appearance="fill">
|
<mat-form-field appearance="fill">
|
||||||
<mat-label>{{selectedPreset}}</mat-label>
|
<mat-label>Preset</mat-label>
|
||||||
<mat-select>
|
<mat-select>
|
||||||
<mat-option *ngFor="let preset of presets" [value]="preset.id">
|
<mat-option *ngFor="let preset of presets" [value]="preset.id" >
|
||||||
{{preset.name}}
|
{{preset.name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ export class NttGanttComponent implements OnInit {
|
||||||
public sortSelectorName: any;
|
public sortSelectorName: any;
|
||||||
|
|
||||||
public presets : any[] = [];
|
public presets : any[] = [];
|
||||||
public selectedPreset : {} = {};
|
public selectedPreset: any;
|
||||||
|
|
||||||
/**###################################################################### Initial Loading functions ######################################################################*/
|
/**###################################################################### Initial Loading functions ######################################################################*/
|
||||||
|
|
||||||
|
|
@ -142,20 +142,12 @@ export class NttGanttComponent implements OnInit {
|
||||||
this.firstLoad = true;
|
this.firstLoad = true;
|
||||||
this.sliceStart = 0;
|
this.sliceStart = 0;
|
||||||
this.sliceEnd = 20;
|
this.sliceEnd = 20;
|
||||||
this.dataService.initPresets().then((res: any)=>{
|
|
||||||
let currentPreset;
|
|
||||||
console.log(res);
|
|
||||||
for (const preset of res.presets) {
|
|
||||||
if(preset.id == 'AGGAA5V0G2LS6ASCSVD9SBS7MO40RV'){
|
|
||||||
currentPreset = preset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(currentPreset);
|
|
||||||
this.presets = res.presets;
|
|
||||||
this.selectedPreset = currentPreset;
|
|
||||||
this.filters = JSON.parse(currentPreset.definition);
|
|
||||||
this.filterEnabled = true;
|
|
||||||
|
|
||||||
|
this.dataService.initPresets().then((res: any)=>{
|
||||||
|
this.presets = res.presets;
|
||||||
|
this.selectedPreset = res.selectedPreset;
|
||||||
|
this.filters = this.selectedPreset.definition;
|
||||||
|
this.filterEnabled = true;
|
||||||
this.showDetails = res.userPreferences.showDetails;
|
this.showDetails = res.userPreferences.showDetails;
|
||||||
this.selectedScalar = this.scalars[res.userPreferences.view];
|
this.selectedScalar = this.scalars[res.userPreferences.view];
|
||||||
|
|
||||||
|
|
@ -230,6 +222,29 @@ export class NttGanttComponent implements OnInit {
|
||||||
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
|
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public selectPreset(preset: any){
|
||||||
|
|
||||||
|
}
|
||||||
|
public savePreset(preset: any){
|
||||||
|
this.dataService.savePreset(preset).then((res)=>{{
|
||||||
|
console.log(res);
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
public updatePreset(preset: any){
|
||||||
|
|
||||||
|
}
|
||||||
|
public renamePreset(preset: any){
|
||||||
|
|
||||||
|
}
|
||||||
|
public deletePreset(preset: any){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public editUserPreferences(language: any, showDetails: any, view: any){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**###################################################################### Data Mapping, Filter and Sorting Functions ######################################################################*/
|
/**###################################################################### Data Mapping, Filter and Sorting Functions ######################################################################*/
|
||||||
|
|
||||||
|
|
@ -338,6 +353,9 @@ export class NttGanttComponent implements OnInit {
|
||||||
// this.dataService.savePreset({name: "FRONTEND TEST PRESET", definition: JSON.stringify(this.filters)}).then((res)=>{
|
// this.dataService.savePreset({name: "FRONTEND TEST PRESET", definition: JSON.stringify(this.filters)}).then((res)=>{
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
// });
|
// });
|
||||||
|
// this.dataService.updatePreset({id: 'AGGAA5V0G2LS6ASCSUZZSBS79E40O5', definition: JSON.stringify(this.filters)}).then((res)=>{
|
||||||
|
// console.log(res);
|
||||||
|
// });
|
||||||
this.refreshData();
|
this.refreshData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue