issue-25 #27
@ -1,6 +1,7 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {ScheduleInfo, ScheduleService} from "../../../api";
|
||||
import {ScheduleInfo, ScheduleService, TaskOverviewInfo} from "../../../api";
|
||||
import {StopActiveScheduleInfo} from "./StopActiveScheduleInfo";
|
||||
import {TaskOverviewComponent} from "../task-overview/task-overview.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-active-schedule',
|
||||
@ -69,5 +70,8 @@ export class ActiveScheduleComponent implements OnInit{
|
||||
this.updateTime();
|
||||
}
|
||||
|
||||
finishTaskByOverview(task: TaskOverviewInfo) {
|
||||
this.activeSchedule = undefined
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
</div>
|
||||
<div class="taskgroup-overview">
|
||||
<app-task-overview [tasks]="tasks" (onStartNow)="onStartTaskNow($event)"></app-task-overview>
|
||||
<app-task-overview [tasks]="tasks" (onStartNow)="onStartTaskNow($event)" (onFinished)="onFinishTask($event)"></app-task-overview>
|
||||
</div>
|
||||
|
||||
<div class="taskgroup-overview">
|
||||
|
@ -56,4 +56,10 @@ export class DashboardComponent implements OnInit{
|
||||
onStartTaskNow(schedule: ScheduleInfo) {
|
||||
this.activeScheduleComponent?.activateSchedule(schedule)
|
||||
}
|
||||
|
||||
onFinishTask(task: TaskOverviewInfo) {
|
||||
this.activeScheduleComponent?.finishTaskByOverview(task);
|
||||
|
||||
this.schedules = this.schedules.filter(schedule => schedule.task.taskID !== task.taskID)
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ export class TaskOverviewComponent {
|
||||
|
||||
@Input() tasks: TaskOverviewInfo[] = []
|
||||
@Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>();
|
||||
@Output('onFinished') finishedEmitter: EventEmitter<TaskOverviewInfo> = new EventEmitter<TaskOverviewInfo>();
|
||||
|
||||
constructor(private scheduleService: ScheduleService,
|
||||
private snackbar: MatSnackBar,
|
||||
@ -39,7 +40,7 @@ export class TaskOverviewComponent {
|
||||
finishTask(task: TaskOverviewInfo) {
|
||||
this.taskService.tasksTaskIDFinishPost(task.taskID).subscribe({
|
||||
next: resp => {
|
||||
|
||||
this.finishedEmitter.emit(task);
|
||||
},
|
||||
error: err => {
|
||||
if(err.status == 403) {
|
||||
|
Loading…
Reference in New Issue
Block a user