issue-25 #27

Merged
sebastian merged 32 commits from issue-25 into issue-18 2023-10-28 19:33:06 +02:00
4 changed files with 14 additions and 3 deletions
Showing only changes of commit d3257b8748 - Show all commits

View File

@ -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
}
}

View File

@ -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">

View File

@ -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)
}
}

View File

@ -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) {