Remove Finished Tasks from Dashboard (Schedules)
This commit is contained in:
parent
1dd01d0249
commit
d3257b8748
@ -1,6 +1,7 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
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 {StopActiveScheduleInfo} from "./StopActiveScheduleInfo";
|
||||||
|
import {TaskOverviewComponent} from "../task-overview/task-overview.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-active-schedule',
|
selector: 'app-active-schedule',
|
||||||
@ -69,5 +70,8 @@ export class ActiveScheduleComponent implements OnInit{
|
|||||||
this.updateTime();
|
this.updateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishTaskByOverview(task: TaskOverviewInfo) {
|
||||||
|
this.activeSchedule = undefined
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="taskgroup-overview">
|
<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>
|
||||||
|
|
||||||
<div class="taskgroup-overview">
|
<div class="taskgroup-overview">
|
||||||
|
@ -56,4 +56,10 @@ export class DashboardComponent implements OnInit{
|
|||||||
onStartTaskNow(schedule: ScheduleInfo) {
|
onStartTaskNow(schedule: ScheduleInfo) {
|
||||||
this.activeScheduleComponent?.activateSchedule(schedule)
|
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[] = []
|
@Input() tasks: TaskOverviewInfo[] = []
|
||||||
@Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>();
|
@Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>();
|
||||||
|
@Output('onFinished') finishedEmitter: EventEmitter<TaskOverviewInfo> = new EventEmitter<TaskOverviewInfo>();
|
||||||
|
|
||||||
constructor(private scheduleService: ScheduleService,
|
constructor(private scheduleService: ScheduleService,
|
||||||
private snackbar: MatSnackBar,
|
private snackbar: MatSnackBar,
|
||||||
@ -39,7 +40,7 @@ export class TaskOverviewComponent {
|
|||||||
finishTask(task: TaskOverviewInfo) {
|
finishTask(task: TaskOverviewInfo) {
|
||||||
this.taskService.tasksTaskIDFinishPost(task.taskID).subscribe({
|
this.taskService.tasksTaskIDFinishPost(task.taskID).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
|
this.finishedEmitter.emit(task);
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
if(err.status == 403) {
|
if(err.status == 403) {
|
||||||
|
Loading…
Reference in New Issue
Block a user