Documentation nttganttComponent

main
manueltauber 2023-06-28 12:25:38 +02:00
parent 8913bebd32
commit 5f38657a9e
5 changed files with 70 additions and 58 deletions

View File

@ -27,7 +27,6 @@ export class ImplementerDialogComponent implements OnInit {
public horizontalPosition: MatSnackBarHorizontalPosition = 'end';
public verticalPosition: MatSnackBarVerticalPosition = 'bottom';
public labels: string[] = [];
private implementers : any[];

View File

@ -57,6 +57,32 @@ export class LanguageService {
this.deMap.set('stateChange', 'Statusübergang');
this.enMap.set('stateChange', 'State Transition');
this.deMap.set('stateDialogSnackBarMessageFailiure', 'Statusübergang fehlgeschlagen');
this.enMap.set('stateDialogSnackBarMessageFailiure', 'State Transition failed');
this.deMap.set('stateDialogSnackBarActionFailiure', 'Schließen');
this.enMap.set('stateDialogSnackBarActionFailiure', 'close');
this.deMap.set('stateDialogSnackBarMsg1Success', 'Statusübergang');
this.enMap.set('stateDialogSnackBarMsg1Success', 'State Transition');
this.deMap.set('stateDialogSnackBarMsg2Success', 'erfolgreich');
this.enMap.set('stateDialogSnackBarMsgsSuccess', 'successful');
this.deMap.set('stateDialogSnackBarActionSuccess', 'Schließen');
this.enMap.set('stateDialogSnackBarActionSuccess', 'close');
this.deMap.set('stateDialogStateTransition', 'Statusübergang');
this.enMap.set('stateDialogStateTransition', 'State Transition');
this.deMap.set('stateDialogSelectState', 'Status auswählen');
this.enMap.set('stateDialogSelectState', 'Select State');
this.deMap.set('stateDialogCancel', 'Abbrechen');
this.enMap.set('stateDialogCancel', 'Cancel');
this.deMap.set('stateDialogConfirm', 'Bestätigen');
this.enMap.set('stateDialogConfirm', 'Confirm');
this.deColumns = [
{ field: 'TaskName', headerText: 'Kurzbeschreibung', width: 250 },
{ field: 'stateName', headerText: 'Status', width: 250},

View File

@ -1,6 +1,6 @@
<p style="font-family:arial; margin-top: -3%;">{{this.labels[0]}} ({{data.changes.length}}. Changes)</p>
<p style="font-family:arial; margin-top: -3%;">{{this.languageService.lMap.get('stateDialogStateTransition')}} ({{data.changes.length}}. Changes)</p>
<mat-form-field appearance="fill" >
<mat-label>{{this.labels[1]}}</mat-label>
<mat-label>{{this.languageService.lMap.get('stateDialogSelectState')}}</mat-label>
<mat-select [disabled]="diasbled" (selectionChange)="enableButton()" [(ngModel)]="selectedValue" name="state">
<mat-option *ngFor="let state of possibleStates" [value]="state.value">
{{state.viewValue}}
@ -11,6 +11,6 @@
<mat-dialog-actions align="end">
<button [disabled]="diasbled" mat-raised-button color="warn" matDialogClose>{{this.labels[2]}}</button>
<button [disabled]="bdiasbled" mat-raised-button color="primary" (click)="updateState()">{{this.labels[3]}}</button>
<button [disabled]="diasbled" mat-raised-button color="warn" matDialogClose>{{this.languageService.lMap.get('stateDialogCancel')}}</button>
<button [disabled]="bdiasbled" mat-raised-button color="primary" (click)="updateState()">{{this.languageService.lMap.get('stateDialogConfirm')}}</button>
</mat-dialog-actions>

View File

@ -1,11 +1,7 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { DataService } from '../data.service';
import {
MatSnackBar,
MatSnackBarHorizontalPosition,
MatSnackBarVerticalPosition,
} from '@angular/material/snack-bar';
import { MatSnackBar, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition} from '@angular/material/snack-bar';
import { LanguageService } from '../language.service';
@Component({
@ -29,7 +25,6 @@ export class StateDialogComponent implements OnInit {
public horizontalPosition: MatSnackBarHorizontalPosition = 'end';
public verticalPosition: MatSnackBarVerticalPosition = 'bottom';
public labels: string[] = [];
private states : any[];
@ -46,19 +41,6 @@ export class StateDialogComponent implements OnInit {
this.diasbled = false;
this.selectedValue = -1;
this.possibleStates = [];
this.labels = [];
if(this.languageService.language == 'DE'){
this.labels.push("Statusübergang");
this.labels.push("Status auswählen");
this.labels.push("Abbrechen");
this.labels.push("Bestätigen");
}else{
this.labels.push("State Transition");
this.labels.push("Select State");
this.labels.push("Cancel");
this.labels.push("Confirm");
}
}
/**
@ -77,10 +59,14 @@ export class StateDialogComponent implements OnInit {
for (const state of this.states) {
for (const iterator of cState.possibleStates) {
if(state.actualState == iterator){
if(this.languageService.language == 'DE'){
this.possibleStates.push({value: state.actualState, viewValue: state.stateNameDE});
}else{
this.possibleStates.push({value: state.actualState, viewValue: state.stateNameEN})
}
}
}
}
if(this.possibleStates.length == 0){
this.dialogRef.close();
}
@ -111,43 +97,20 @@ export class StateDialogComponent implements OnInit {
this.progress = (counter/this.data.changes.length)*100;
}
if(res.status == 500){
let msg;
let action;
if(this.languageService.language == 'DE'){
msg = 'Statusübergang fehlgeschlagen:';
action = 'Schließen';
}else{
msg = 'State Transition failed';
action ='close';
}
this._snackBar.open(msg + res.error.message, action, {
this._snackBar.open(this.languageService.lMap.get('stateDialogSnackBarMessageFailiure') + res.error.message, this.languageService.lMap.get('stateDialogSnackBarActionFailiure'), {
horizontalPosition: this.horizontalPosition,
verticalPosition: this.verticalPosition,
panelClass: ['mat-primary']
});
this.dialogRef.close("Failiure");
//this.dialogRef.close();
//counter++;
//this.progress = (counter/this.data.changes.length)*100;
}
if(this.progress == 100){
this.diasbled = false;
this.bdiasbled = true;
let msg1;
let msg2;
let action;
if(this.languageService.language == 'DE'){
msg1 = 'Statusübergang';
msg2 = 'erfolgreich';
action ='Schließen';
}else{
msg1 = 'State Transition';
msg2 = 'successful';
action ='close';
}
this._snackBar.open(msg1 + this.findStateName(change.currentState) +' -> '+this.findStateName(change.nextState) + msg2, action, {
this._snackBar.open(this.languageService.lMap.get('stateDialogSnackBarMsg1Success') + this.findStateName(change.currentState) +' -> '+this.findStateName(change.nextState) + this.languageService.lMap.get('stateDialogSnackBarMsg2Success') ,
this.languageService.lMap.get('stateDialogSnackBarActionSuccess'),
{
horizontalPosition: this.horizontalPosition,
verticalPosition: this.verticalPosition,
duration: 5000,
@ -161,9 +124,13 @@ export class StateDialogComponent implements OnInit {
findStateName(stateNr): String {
for (let state of this.states) {
if(stateNr == state.actualState){
if(this.languageService.language == 'DE'){
return state.stateNameDE;
}else{
return state.stateNameEN;
}
}
}
return "";
}
}

View File

@ -116,7 +116,7 @@ export class NttGanttComponent implements OnInit {
}
/**
* The function ngOnInit sets values which are required for rendering the gantt Chart. Furthermore it trims the resources (Changes Array) and sets the paginator to the first page.
* The function ngOnInit sets values which are required for rendering the gantt Chart. Furthermore it triggers the Dataservice to fetch Changes from the backend and trims the resources (Changes Array) and sets the paginator to the first page.
*/
public ngOnInit(): void {
var WebFont = require('webfontloader');
@ -211,7 +211,11 @@ export class NttGanttComponent implements OnInit {
}
}
}
/**
* The function refreshData fetches a new changes Array from the backend, therefore the mapRequestJSON function is called to map the requestJSON with all filter and sort parameters.
* Furthermore it evaluates the result if the applied filters delivered any Results.
* This function is the most called Funktion in the whole project, it is triggered by a pageEvent, when a filter gets applied and much more...
*/
refreshData(){
this.showNoResultsError = false;
this.renderGantt = false;
@ -231,7 +235,10 @@ export class NttGanttComponent implements OnInit {
}
});
}
/**
* The function clearFilter clears allFilter parameters and set them to inital values, then it triggers the refreshData function to fetch the changes without any filters except the supportGroup filter.
* This function is triggered if the user disables the apply filter switch
*/
clearFilter(){
this.filters = null;
this.filterEnabled = false;
@ -239,6 +246,11 @@ export class NttGanttComponent implements OnInit {
this.sortEnabled = false;
this.refreshData();
}
/**
* The function mapRequestJSON maps the requestObject for the refreshData function, it evaluates if filters or sort parameters are set.
* Furtheremore it adds the sliceStart and sliceEnd values of the paginator to the requestObject, because the frontend only delivers the changes that can be displayed on one selected page of the paginator.
* If no filter is applied the function sets a default supportGroup filter, so that the user gets only changes displayed, which are in his supportGroup.
*/
mapRequestJSON(){
let request =
{
@ -252,7 +264,11 @@ export class NttGanttComponent implements OnInit {
}
return request;
}
/**
* The function applyFilter applies the selected filters and refrehses the gantt chart with the new filters.
* Furthermore it stores the old filters in a help variable to restore it when to user turns the apply filter switch back on.
* This function is triggered by the a filter action of the filterdialog, or if the user switches the apply filter switch.
*/
applyFilter(){
if(this.filterEnabled){
this.oldFilters = this.filters
@ -266,6 +282,10 @@ export class NttGanttComponent implements OnInit {
}
}
/**
* The function openFilterDialog triggers the opening of the filterDialog, recieves the results of the filterDialog and refrehses the gantt chart.
* This function is triggered by the filter button.
*/
openFilterDialog(){
let dialogRef = FilterDialogComponent;
this.matDialog.open(dialogRef,