Forget single schedule

This commit is contained in:
Sebastian 2023-10-29 10:56:08 +01:00
parent 966c896ae0
commit 38d27c3dac
3 changed files with 35 additions and 13 deletions

View File

@ -4,15 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Load worked minutes when reloading dashboard">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="List missed Schedules">
<change beforePath="$PROJECT_DIR$/../frontend/src/app/missed-schedules/missed-schedules.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/missed-schedules/missed-schedules.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/missed-schedules/missed-schedules.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/missed-schedules/missed-schedules.component.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -249,7 +243,15 @@
<option name="project" value="LOCAL" />
<updated>1698569793571</updated>
</task>
<option name="localTasksCounter" value="18" />
<task id="LOCAL-00018" summary="List missed Schedules">
<option name="closed" value="true" />
<created>1698570969924</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1698570969924</updated>
</task>
<option name="localTasksCounter" value="19" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -274,7 +276,8 @@
<MESSAGE value="Start task now from Taskoverview in Dashboard" />
<MESSAGE value="Load worked minutes when reloading dashboard" />
<MESSAGE value="Check if there is another active schedule when starting task now" />
<option name="LAST_COMMIT_MESSAGE" value="Check if there is another active schedule when starting task now" />
<MESSAGE value="List missed Schedules" />
<option name="LAST_COMMIT_MESSAGE" value="List missed Schedules" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

View File

@ -10,7 +10,7 @@
</div>
<div style="width: 100%" class="reschedule-actions-container">
<button mat-raised-button color="primary" class="rescheduleBtn">Reschedule</button>
<button mat-raised-button color="warn" class="deleteBtn">Forget</button>
<button mat-raised-button color="warn" class="deleteBtn" (click)="forgetSchedule(schedule)">Forget</button>
</div>
</div>
</mat-card-content>

View File

@ -1,6 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {ScheduleInfo, ScheduleService} from "../../api";
import {NavigationLink} from "../navigation-link-list/navigation-link-list.component";
import {MatSnackBar} from "@angular/material/snack-bar";
@Component({
selector: 'app-missed-schedules',
@ -20,7 +21,8 @@ export class MissedSchedulesComponent implements OnInit{
routerLink: ["/reschedule"]
}
]
constructor(private scheduleService: ScheduleService) {
constructor(private scheduleService: ScheduleService,
private snackbar: MatSnackBar) {
}
ngOnInit() {
@ -30,4 +32,21 @@ export class MissedSchedulesComponent implements OnInit{
}
})
}
forgetSchedule(scheduleInfo: ScheduleInfo) {
this.scheduleService.schedulesScheduleIDScheduleTypeDelete(scheduleInfo.scheduleID, "BASIC").subscribe({
next: resp => {
this.missedSchedules = this.missedSchedules.filter(schedule => schedule.scheduleID !== scheduleInfo.scheduleID)
},
error: err => {
if(err.status == 403) {
this.snackbar.open("No permission", "", {duration: 2000})
} else if(err.status == 404) {
this.snackbar.open("Schedule not found", "", {duration: 2000});
} else {
this.snackbar.open("Unexpected error", "", {duration: 2000});
}
}
})
}
}