initial Load with Presets implemented
parent
39182ef484
commit
3673460903
|
|
@ -118,6 +118,62 @@ export class DataService {
|
||||||
return this.contracts.find((contract)=> {return contract.id == contractId;}).name;
|
return this.contracts.find((contract)=> {return contract.id == contractId;}).name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function initPresets fetches an array of all presets
|
||||||
|
* @returns promise for the fetched presets array
|
||||||
|
*/
|
||||||
|
public async initPresets(){
|
||||||
|
const promise = new Promise(resolve=>{
|
||||||
|
let res = {presets: [], selectedPreset: '', userPreferences: {}};
|
||||||
|
this.http.get('http://localhost:8080/api/initPresets')
|
||||||
|
.subscribe((response: any)=>{
|
||||||
|
res.selectedPreset = response.selectedPreset;
|
||||||
|
let userPreferences = {language: 'DE', showDetails: true, view: 2};
|
||||||
|
if(response.userPreferences.language == "EN"){
|
||||||
|
userPreferences.language = "EN";
|
||||||
|
}
|
||||||
|
if(response.userPreferences.showDetails == 0){
|
||||||
|
userPreferences.showDetails = false;
|
||||||
|
}
|
||||||
|
if(response.userPreferences.view == 1){
|
||||||
|
userPreferences.view = 1;
|
||||||
|
}
|
||||||
|
if(response.userPreferences.view == 2){
|
||||||
|
userPreferences.view = 2;
|
||||||
|
}
|
||||||
|
if(response.userPreferences.view == 3){
|
||||||
|
userPreferences.view = 3;
|
||||||
|
}
|
||||||
|
res.userPreferences = userPreferences;
|
||||||
|
response.presets.forEach(preset => {
|
||||||
|
res.presets.push(preset);
|
||||||
|
});
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
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 savePreset(preset: any){
|
||||||
|
const promise = new Promise(resolve=>{
|
||||||
|
let serializableResource = {name: preset.name, definition: preset.definition};
|
||||||
|
let strigifiedResource = JSON.stringify(serializableResource);
|
||||||
|
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||||
|
console.log(resJson);
|
||||||
|
this.http.post('http://localhost:8080/api/savePreset', resJson).subscribe((response:any)=>{
|
||||||
|
resolve(response);
|
||||||
|
console.log(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
|
||||||
|
|
@ -154,6 +210,8 @@ export class DataService {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function fetchContracts fetches an array of all contracts
|
* The function fetchContracts fetches an array of all contracts
|
||||||
* @returns promise for the fetched contracts array
|
* @returns promise for the fetched contracts array
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ export class FilterDialogComponent implements OnInit {
|
||||||
* The function ngOnInit initialized the component by fetching all relevant data via the dataService
|
* The function ngOnInit initialized the component by fetching all relevant data via the dataService
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log(this.prevFilters);
|
//console.log(this.prevFilters);
|
||||||
if(this.prevFilters.length > 0){
|
if(this.prevFilters.length > 0){
|
||||||
for (const filter of this.prevFilters) {
|
for (const filter of this.prevFilters) {
|
||||||
//console.log(filter);
|
//console.log(filter);
|
||||||
|
|
@ -120,13 +120,21 @@ export class FilterDialogComponent implements OnInit {
|
||||||
//console.log("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
|
//console.log("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
|
||||||
//console.log(this.dataService.getPaketTypes());
|
//console.log(this.dataService.getPaketTypes());
|
||||||
for (const crit of filter.criteria) {
|
for (const crit of filter.criteria) {
|
||||||
console.log(crit);
|
//console.log(crit);
|
||||||
this.prevFiltersPaketType.push(this.dataService.getPaketTypeNameByID(crit));
|
this.prevFiltersPaketType.push(this.dataService.getPaketTypeNameByID(crit));
|
||||||
}
|
}
|
||||||
console.log(this.prevFiltersPaketType);
|
//console.log(this.prevFiltersPaketType);
|
||||||
//this.prevFiltersPaketType = filter.criteria;
|
//this.prevFiltersPaketType = filter.criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(filter.column == "D2"){
|
||||||
|
this.filterStartDate = filter.criteria[0];
|
||||||
|
this.filterEndDate = filter.criteria[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(filter.column == "ResourceName"){
|
||||||
|
this.criteria = filter.criteria[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -284,7 +292,7 @@ export class FilterDialogComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
let filter = {filterElement: filterElement};
|
let filter = {filterElement: filterElement};
|
||||||
console.log(filter);
|
//console.log(filter);
|
||||||
this.dialogRef.close(filter);
|
this.dialogRef.close(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,21 +65,21 @@ export class MultiselectAutocompleteComponent implements OnInit {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(this.appliedFilters);
|
//console.log(this.appliedFilters);
|
||||||
console.log(this.rawData);
|
//console.log(this.rawData);
|
||||||
|
|
||||||
if(this.appliedFilters.length > 0){
|
if(this.appliedFilters.length > 0){
|
||||||
for (const filter of this.appliedFilters) {
|
for (const filter of this.appliedFilters) {
|
||||||
for (const item of this.rawData) {
|
for (const item of this.rawData) {
|
||||||
if(item.item == filter){
|
if(item.item == filter){
|
||||||
console.log("MATCH"+item.item);
|
//console.log("MATCH"+item.item);
|
||||||
item.selected = true;
|
item.selected = true;
|
||||||
this.toggleSelection({'item': filter, selected: false});
|
this.toggleSelection({'item': filter, selected: false});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.selectData);
|
//console.log(this.selectData);
|
||||||
this.evaluateIndeterminate();
|
this.evaluateIndeterminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ export class MultiselectAutocompleteComponent implements OnInit {
|
||||||
* it builds the base for many filter select option
|
* it builds the base for many filter select option
|
||||||
*/
|
*/
|
||||||
toggleSelection = (data: ItemData): void => {
|
toggleSelection = (data: ItemData): void => {
|
||||||
//console.log(data);
|
////console.log(data);
|
||||||
//console.log(this.selectData);
|
//console.log(this.selectData);
|
||||||
data.selected = !data.selected;
|
data.selected = !data.selected;
|
||||||
if (data.selected === true) {
|
if (data.selected === true) {
|
||||||
|
|
|
||||||
|
|
@ -139,20 +139,37 @@ 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.filters = JSON.parse(currentPreset.definition);
|
||||||
|
this.filterEnabled = true;
|
||||||
|
|
||||||
this.dataService.fetchUserSupportGroup().then((res: any)=>{
|
this.showDetails = res.userPreferences.showDetails;
|
||||||
this.userSupportGroup = res.name;
|
this.selectedScalar = this.scalars[res.userPreferences.view];
|
||||||
this.refreshData();
|
|
||||||
this.states = this.dataService.getStates();
|
|
||||||
this.dataService.fetchStates().then((res: any [])=>{
|
this.dataService.fetchUserSupportGroup().then((res: any)=>{
|
||||||
this.states = res;
|
this.userSupportGroup = res.name;
|
||||||
this.stateList = res;
|
this.refreshData();
|
||||||
this.spin = false;
|
this.states = this.dataService.getStates();
|
||||||
console.log(this.states);
|
this.dataService.fetchStates().then((res: any [])=>{
|
||||||
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
|
this.states = res;
|
||||||
|
this.stateList = res;
|
||||||
|
this.spin = false;
|
||||||
|
console.log(this.states);
|
||||||
|
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.taskSettings = {
|
this.taskSettings = {
|
||||||
id: 'TaskID',
|
id: 'TaskID',
|
||||||
name: 'TaskName',
|
name: 'TaskName',
|
||||||
|
|
@ -313,6 +330,9 @@ export class NttGanttComponent implements OnInit {
|
||||||
if(res){
|
if(res){
|
||||||
this.filters = res;
|
this.filters = res;
|
||||||
this.filterEnabled = true;
|
this.filterEnabled = true;
|
||||||
|
// this.dataService.savePreset({name: "FRONTEND TEST PRESET", definition: JSON.stringify(this.filters)}).then((res)=>{
|
||||||
|
// console.log(res);
|
||||||
|
// });
|
||||||
this.refreshData();
|
this.refreshData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue