Delete Schedules in ScheduleHistory
This commit is contained in:
		
							parent
							
								
									4b6a90b085
								
							
						
					
					
						commit
						f5607f8023
					
				@ -23,3 +23,8 @@
 | 
				
			|||||||
table {
 | 
					table {
 | 
				
			||||||
  width: 100%;
 | 
					  width: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.mat-column-delete {
 | 
				
			||||||
 | 
					  width: 32px;
 | 
				
			||||||
 | 
					  text-align: center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,10 @@
 | 
				
			|||||||
      <th mat-header-cell *matHeaderCellDef> Duration </th>
 | 
					      <th mat-header-cell *matHeaderCellDef> Duration </th>
 | 
				
			||||||
      <td mat-cell *matCellDef="let element"> {{calcDuration(element.startTime, element.finishedTime)}} </td>
 | 
					      <td mat-cell *matCellDef="let element"> {{calcDuration(element.startTime, element.finishedTime)}} </td>
 | 
				
			||||||
    </ng-container>
 | 
					    </ng-container>
 | 
				
			||||||
 | 
					    <ng-container matColumnDef="delete">
 | 
				
			||||||
 | 
					      <th mat-header-cell *matHeaderCellDef>  </th>
 | 
				
			||||||
 | 
					      <td mat-cell *matCellDef="let element"> <button mat-icon-button color="warn" (click)="deleteSchedule(element)"><mat-icon>delete</mat-icon></button> </td>
 | 
				
			||||||
 | 
					    </ng-container>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import {Component, OnInit} from '@angular/core';
 | 
					import {Component, OnInit} from '@angular/core';
 | 
				
			||||||
import {HistoryService, ScheduleInfo, TaskgroupEntityInfo} from "../../../api";
 | 
					import {HistoryService, ScheduleInfo, ScheduleService, TaskgroupEntityInfo} from "../../../api";
 | 
				
			||||||
import * as moment from "moment";
 | 
					import * as moment from "moment";
 | 
				
			||||||
import {NavigationLink} from "../../navigation-link-list/navigation-link-list.component";
 | 
					import {NavigationLink} from "../../navigation-link-list/navigation-link-list.component";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -27,7 +27,7 @@ export class ScheduleHistoryComponent implements OnInit{
 | 
				
			|||||||
  selectedDate: Date = new Date();
 | 
					  selectedDate: Date = new Date();
 | 
				
			||||||
  schedules: ScheduleInfo[] = []
 | 
					  schedules: ScheduleInfo[] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  displayedColumns: string[] = ['taskgroup', 'task', 'start', 'end', 'duration'];
 | 
					  displayedColumns: string[] = ['taskgroup', 'task', 'start', 'end', 'duration', 'delete'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
    this.historyService.historySchedulesDateGet(moment(this.selectedDate).format("YYYY-MM-DD")).subscribe({
 | 
					    this.historyService.historySchedulesDateGet(moment(this.selectedDate).format("YYYY-MM-DD")).subscribe({
 | 
				
			||||||
@ -37,7 +37,8 @@ export class ScheduleHistoryComponent implements OnInit{
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(private historyService: HistoryService) {
 | 
					  constructor(private historyService: HistoryService,
 | 
				
			||||||
 | 
					              private scheduleService: ScheduleService) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  computeTaskgroupPath(taskgroupPath: TaskgroupEntityInfo[]) {
 | 
					  computeTaskgroupPath(taskgroupPath: TaskgroupEntityInfo[]) {
 | 
				
			||||||
@ -67,4 +68,12 @@ export class ScheduleHistoryComponent implements OnInit{
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  deleteSchedule(deletedSchedule: ScheduleInfo) {
 | 
				
			||||||
 | 
					    this.scheduleService.schedulesScheduleIDDelete(deletedSchedule.scheduleID).subscribe({
 | 
				
			||||||
 | 
					      next: resp => {
 | 
				
			||||||
 | 
					        this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user