diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 04bd0d8..9912137 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -36,6 +36,8 @@ import {FilterDialogComponent} from './filter-dialog/filter-dialog.component';
import {ScrollingModule} from '@angular/cdk/scrolling';
import {MomentDateModule} from '@angular/material-moment-adapter';
import {PlanTimeBarComponent} from './plan-time-bar/plan-time-bar.component';
+import { RenamePresetDialogComponent } from './rename-preset-dialog/rename-preset-dialog.component';
+import { DeletePresetDialogComponent } from './delete-preset-dialog/delete-preset-dialog.component';
@NgModule({
@@ -46,7 +48,9 @@ import {PlanTimeBarComponent} from './plan-time-bar/plan-time-bar.component';
ImplementerDialogComponent,
MultiselectAutocompleteComponent,
FilterDialogComponent,
- PlanTimeBarComponent
+ PlanTimeBarComponent,
+ RenamePresetDialogComponent,
+ DeletePresetDialogComponent
],
imports: [
BrowserModule,
diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts
index 808ff23..10c83e8 100644
--- a/frontend/src/app/data.service.ts
+++ b/frontend/src/app/data.service.ts
@@ -266,6 +266,42 @@ export class DataService {
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 renamePreset(preset: any){
+ const promise = new Promise(resolve=>{
+ let serializableResource = {id: preset.id, newName: preset.name};
+ let strigifiedResource = JSON.stringify(serializableResource);
+ let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
+ this.http.post('http://localhost:8080/api/renamePreset', resJson).subscribe((response:any)=>{
+ resolve(response);
+ },(error:any)=>{
+ resolve(error);
+ });
+ });
+ 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 deletePreset(preset: any){
+ const promise = new Promise(resolve=>{
+ let serializableResource = {id: preset.id};
+ let strigifiedResource = JSON.stringify(serializableResource);
+ let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
+ this.http.post('http://localhost:8080/api/deletePreset', resJson).subscribe((response:any)=>{
+ resolve(response);
+ },(error:any)=>{
+ resolve(error);
+ });
+ });
+ 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
diff --git a/frontend/src/app/delete-preset-dialog/delete-preset-dialog.component.css b/frontend/src/app/delete-preset-dialog/delete-preset-dialog.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/src/app/delete-preset-dialog/delete-preset-dialog.component.html b/frontend/src/app/delete-preset-dialog/delete-preset-dialog.component.html
new file mode 100644
index 0000000..571b31f
--- /dev/null
+++ b/frontend/src/app/delete-preset-dialog/delete-preset-dialog.component.html
@@ -0,0 +1,5 @@
+
Möchten Sie das Preset {{preset.name}} wirklich löschen?
diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
index 5204446..097179b 100644
--- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
+++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
@@ -15,6 +15,8 @@ import * as $ from 'jquery';
import { StateDialogComponent } from 'src/app/state-dialog/state-dialog.component';
import { MatSnackBar, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition } from '@angular/material/snack-bar';
import { MAT_DATE_FORMATS } from '@angular/material/core';
+import { RenamePresetDialogComponent } from '../rename-preset-dialog/rename-preset-dialog.component';
+import { DeletePresetDialogComponent } from '../delete-preset-dialog/delete-preset-dialog.component';
export const MY_DATE_FORMATS = {
parse: {
@@ -316,6 +318,33 @@ 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.
+ */
+ public openRenameDialog(){
+ console.log(this.filters);
+ let dialogRef = RenamePresetDialogComponent;
+ this.matDialog.open(dialogRef,
+ {data : [{preset: this.selectedPreset}], width: '20%', maxWidth: '800px'}).afterClosed().subscribe((res)=>{
+ this.refreshGanttwithPresets();
+ });
+ }
+
+ /**
+ * 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.
+ */
+ public openDeleteDialog(){
+ console.log(this.filters);
+ let dialogRef = DeletePresetDialogComponent;
+ console.log(this.selectedPreset);
+ this.matDialog.open(dialogRef,
+ {data : [{preset: this.selectedPreset}], width: '20%', maxWidth: '800px'}).afterClosed().subscribe((res)=>{
+ this.refreshGanttwithPresets();
+ });
+ }
+
public refreshGanttwithPresets(){
this.showSaveButton = false;
this.showSaveUnderButton = false;
diff --git a/frontend/src/app/rename-preset-dialog/rename-preset-dialog.component.css b/frontend/src/app/rename-preset-dialog/rename-preset-dialog.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/src/app/rename-preset-dialog/rename-preset-dialog.component.html b/frontend/src/app/rename-preset-dialog/rename-preset-dialog.component.html
new file mode 100644
index 0000000..149dc62
--- /dev/null
+++ b/frontend/src/app/rename-preset-dialog/rename-preset-dialog.component.html
@@ -0,0 +1,9 @@
+