issue-32 #34
@ -4,10 +4,8 @@
|
||||
<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/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component.ts" afterDir="false" />
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Forget single schedule">
|
||||
<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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -18,15 +16,15 @@
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Interface" />
|
||||
<option value="Class" />
|
||||
<option value="Enum" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$/.." value="issue-29" />
|
||||
<entry key="$PROJECT_DIR$/.." value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
@ -236,7 +234,31 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698512069065</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="17" />
|
||||
<task id="LOCAL-00017" summary="Work also with start schedule based on last minute">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698569793571</created>
|
||||
<option name="number" value="00017" />
|
||||
<option name="presentableId" value="LOCAL-00017" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698569793571</updated>
|
||||
</task>
|
||||
<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>
|
||||
<task id="LOCAL-00019" summary="Forget single schedule">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698573369764</created>
|
||||
<option name="number" value="00019" />
|
||||
<option name="presentableId" value="LOCAL-00019" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698573369764</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="20" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -261,7 +283,9 @@
|
||||
<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" />
|
||||
<MESSAGE value="Forget single schedule" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Forget single schedule" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -220,4 +220,36 @@ public class ScheduleController {
|
||||
return ResponseEntity.ok(new TaskScheduleStopResponse(serviceResult.getResult()));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/schedules/missed")
|
||||
public ResponseEntity<?> loadMissedSchedules() {
|
||||
Optional<User> user = userRepository.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(user.isEmpty()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
List<BasicTaskSchedule> schedules = taskScheduleService.loadMissedSchedules(user.get());
|
||||
return ResponseEntity.ok(schedules.stream().map(ScheduleInfo::new).toList());
|
||||
}
|
||||
|
||||
@DeleteMapping("/schedules/{scheduleIDs}/all")
|
||||
public ResponseEntity<?> deleteSchedules(@PathVariable long[] scheduleIDs) {
|
||||
List<BasicTaskSchedule> schedulesToDelete = new LinkedList<>();
|
||||
for(long scheduleID: scheduleIDs) {
|
||||
PermissionResult<BasicTaskSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
schedulesToDelete.add(permissionResult.getResult());
|
||||
}
|
||||
|
||||
for(BasicTaskSchedule schedule : schedulesToDelete) {
|
||||
this.taskScheduleService.deleteBasicSchedule(schedule);
|
||||
}
|
||||
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
}
|
||||
}
|
||||
|
@ -39,4 +39,7 @@ public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSch
|
||||
|
||||
@Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.scheduleDate = ?2 AND bts.finishedTime IS NOT NULL")
|
||||
List<BasicTaskSchedule> findAllFinishedByUserAndDate(User user, LocalDate now);
|
||||
|
||||
@Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.startTime IS NULL AND bts.finishedTime IS NULL")
|
||||
List<BasicTaskSchedule> findAllUnstartedSchedulesOfUser(User user);
|
||||
}
|
||||
|
@ -213,4 +213,16 @@ public class TaskScheduleService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<BasicTaskSchedule> loadMissedSchedules(User user) {
|
||||
List<BasicTaskSchedule> unstartedSchedules = basicTaskScheduleRepository.findAllUnstartedSchedulesOfUser(user);
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
List<BasicTaskSchedule> missedSchedules = new LinkedList<>();
|
||||
for(BasicTaskSchedule schedule : unstartedSchedules) {
|
||||
if(schedule.getScheduleDate().isBefore(currentDate)) {
|
||||
missedSchedules.add(schedule);
|
||||
}
|
||||
}
|
||||
return missedSchedules;
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,61 @@ export class ScheduleService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* registers forgotten schedule
|
||||
* Registers forgotten schedule
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public schedulesMissedGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
|
||||
public schedulesMissedGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
|
||||
public schedulesMissedGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
|
||||
public schedulesMissedGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' = 'json';
|
||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules/missed`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* activates schedule
|
||||
* activates schedule
|
||||
@ -457,6 +512,65 @@ export class ScheduleService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes multiple schedules
|
||||
* deletes multiple schedules at once
|
||||
* @param scheduleIDs internal ids of schedules to delete
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public schedulesScheduleIDsAllDelete(scheduleIDs: Array<number>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<SimpleStatusResponse>>;
|
||||
public schedulesScheduleIDsAllDelete(scheduleIDs: Array<number>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<SimpleStatusResponse>>>;
|
||||
public schedulesScheduleIDsAllDelete(scheduleIDs: Array<number>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<SimpleStatusResponse>>>;
|
||||
public schedulesScheduleIDsAllDelete(scheduleIDs: Array<number>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
if (scheduleIDs === null || scheduleIDs === undefined) {
|
||||
throw new Error('Required parameter scheduleIDs was null or undefined when calling schedulesScheduleIDsAllDelete.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' = 'json';
|
||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<Array<SimpleStatusResponse>>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleIDs))}/all`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get number of active minutes
|
||||
* get number of worked minutes today
|
||||
|
@ -7,6 +7,7 @@ import {UserSettingsComponent} from "./user-settings/user-settings.component";
|
||||
import {TaskgroupDashboardComponent} from "./taskgroups/taskgroup-dashboard/taskgroup-dashboard.component";
|
||||
import {TaskDetailOverviewComponent} from "./tasks/task-detail-overview/task-detail-overview.component";
|
||||
import {SchedulerComponent} from "./schedules/scheduler/scheduler.component";
|
||||
import {MissedSchedulesComponent} from "./missed-schedules/missed-schedules.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{path: '', component: MainComponent},
|
||||
@ -16,7 +17,8 @@ const routes: Routes = [
|
||||
{path: 'taskgroups/:taskgroupID', component: TaskgroupDashboardComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID', component: TaskDetailOverviewComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule', component: SchedulerComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule/:scheduleID', component: SchedulerComponent}
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule/:scheduleID', component: SchedulerComponent},
|
||||
{path: 'reschedule', component: MissedSchedulesComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -4,6 +4,7 @@
|
||||
<button mat-button aria-label="Organize" *ngIf="authService.hasKey" [matMenuTriggerFor]="organizeMenu">Organize ▾</button>
|
||||
<mat-menu #organizeMenu=matMenu>
|
||||
<button mat-menu-item routerLink="taskgroups/" aria-label="Task groups">Taskgroups</button>
|
||||
<button mat-menu-item routerLink="reschedule/" aria-label="Missed Schedules">Missed Schedules</button>
|
||||
</mat-menu>
|
||||
<span class="example-spacer"></span>
|
||||
|
||||
|
@ -69,6 +69,8 @@ import { TaskgroupOverviewComponent } from './dashboard/taskgroup-overview/taskg
|
||||
import { TaskOverviewComponent } from './dashboard/task-overview/task-overview.component';
|
||||
import { ForgottenTaskStartDialogComponent } from './dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component';
|
||||
import {MatAutocompleteModule} from "@angular/material/autocomplete";
|
||||
import { MissedSchedulesComponent } from './missed-schedules/missed-schedules.component';
|
||||
import { MissedScheduleForgetConfirmationDialogComponent } from './missed-schedules/missed-schedule-forget-confirmation-dialog/missed-schedule-forget-confirmation-dialog.component';
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
@ -100,7 +102,9 @@ import {MatAutocompleteModule} from "@angular/material/autocomplete";
|
||||
ActiveScheduleComponent,
|
||||
TaskgroupOverviewComponent,
|
||||
TaskOverviewComponent,
|
||||
ForgottenTaskStartDialogComponent
|
||||
ForgottenTaskStartDialogComponent,
|
||||
MissedSchedulesComponent,
|
||||
MissedScheduleForgetConfirmationDialogComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -3,7 +3,7 @@
|
||||
<mat-card *ngIf="missedSchedules" class="red-card">
|
||||
<mat-card-content>
|
||||
<p>There are missed schedules. Please reschedule them.</p>
|
||||
<a class="btn-link" routerLink="/">Reschedule</a>
|
||||
<a class="btn-link" routerLink="/reschedule">Reschedule</a>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<h1 class="dashboard-heading">Now<b class="today-worked-info">Today: {{workedMinutesToday}} min</b></h1>
|
||||
|
@ -0,0 +1,9 @@
|
||||
<h1 mat-dialog-title>Forget All Missed Schedules </h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to forget all missed schedules? This would delete <b>{{this.missedSchedules.length}}</b> schedules.</p>
|
||||
<p>This <b>cannot</b> be undone!</p>
|
||||
</div>
|
||||
<div mat-dialog-actions align="end">
|
||||
<button mat-raised-button (click)="cancel()">Cancel</button>
|
||||
<button mat-raised-button color="warn" (click)="confirm()">Confirm</button>
|
||||
</div>
|
@ -0,0 +1,21 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MissedScheduleForgetConfirmationDialogComponent } from './missed-schedule-forget-confirmation-dialog.component';
|
||||
|
||||
describe('MissedScheduleForgetConfirmationDialogComponent', () => {
|
||||
let component: MissedScheduleForgetConfirmationDialogComponent;
|
||||
let fixture: ComponentFixture<MissedScheduleForgetConfirmationDialogComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MissedScheduleForgetConfirmationDialogComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(MissedScheduleForgetConfirmationDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,40 @@
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ScheduleInfo, ScheduleService} from "../../../api";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
|
||||
@Component({
|
||||
selector: 'app-missed-schedule-forget-confirmation-dialog',
|
||||
templateUrl: './missed-schedule-forget-confirmation-dialog.component.html',
|
||||
styleUrls: ['./missed-schedule-forget-confirmation-dialog.component.css']
|
||||
})
|
||||
export class MissedScheduleForgetConfirmationDialogComponent {
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public missedSchedules: ScheduleInfo[],
|
||||
private dialogRef: MatDialogRef<MissedScheduleForgetConfirmationDialogComponent>,
|
||||
private scheduleService: ScheduleService,
|
||||
private snackbar: MatSnackBar) {
|
||||
}
|
||||
|
||||
|
||||
cancel() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
confirm() {
|
||||
this.scheduleService.schedulesScheduleIDsAllDelete(this.missedSchedules.map(schedule => schedule.scheduleID)).subscribe({
|
||||
next: resp => {
|
||||
this.dialogRef.close(resp);
|
||||
},
|
||||
error: err => {
|
||||
if(err.status == 403) {
|
||||
this.snackbar.open("No permission", "", {duration: 2000});
|
||||
} else if(err.status == 404) {
|
||||
this.snackbar.open("Not found", "", {duration: 2000});
|
||||
} else {
|
||||
this.snackbar.open("Unexpected error", "", {duration: 2000});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
.container {
|
||||
margin: 20px auto;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
margin-bottom: 2.5%;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.container {
|
||||
width: 100%;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.originally-planned-container {
|
||||
border-style: solid;
|
||||
border-color: #e1e1e1;
|
||||
border-width: 1px;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
.reschedule-actions-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forget-all-btn {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.undecorated-link {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.undecorated-link:hover {
|
||||
color: #3498db;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<div class="container">
|
||||
<app-navigation-link-list [navigationLinks]="defaultNavigationLinkPath"></app-navigation-link-list>
|
||||
<mat-card *ngFor="let schedule of missedSchedules">
|
||||
<mat-card-content>
|
||||
<h3>
|
||||
<span *ngFor="let taskgroup of schedule.taskgroupPath">
|
||||
<a class="undecorated-link" [routerLink]="['/taskgroups', taskgroup.taskgroupID]">{{taskgroup.taskgroupName}}</a>
|
||||
/
|
||||
</span>
|
||||
|
||||
<a class="undecorated-link" [routerLink]="['/taskgroups', schedule.taskgroupPath[schedule.taskgroupPath.length-1].taskgroupID, 'tasks', schedule.task.taskID]">{{schedule.task.taskName}}</a>
|
||||
</h3>
|
||||
<mat-progress-bar mode="determinate" [value]="schedule.activeMinutes"></mat-progress-bar>
|
||||
<div class="originally-planned-container">
|
||||
<div style="width: 100%">
|
||||
<p style="display: inline-block"><i>Originally planned:</i> {{schedule.schedule.scheduleDate}}</p>
|
||||
</div>
|
||||
<div style="width: 100%" class="reschedule-actions-container">
|
||||
<button mat-raised-button color="primary" class="rescheduleBtn"
|
||||
[routerLink]="['/taskgroups', schedule.taskgroupPath[schedule.taskgroupPath.length-1].taskgroupID, 'tasks', schedule.task.taskID, 'schedule', schedule.scheduleID]">Reschedule</button>
|
||||
<button mat-raised-button color="warn" class="deleteBtn" (click)="forgetSchedule(schedule)">Forget</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<button mat-raised-button color="warn" class="forget-all-btn" *ngIf="missedSchedules.length > 0" (click)="forgetAllSchedules()"><mat-icon>delete</mat-icon>Forget All</button>
|
||||
</div>
|
@ -0,0 +1,21 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MissedSchedulesComponent } from './missed-schedules.component';
|
||||
|
||||
describe('MissedSchedulesComponent', () => {
|
||||
let component: MissedSchedulesComponent;
|
||||
let fixture: ComponentFixture<MissedSchedulesComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MissedSchedulesComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(MissedSchedulesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,66 @@
|
||||
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";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {
|
||||
MissedScheduleForgetConfirmationDialogComponent
|
||||
} from "./missed-schedule-forget-confirmation-dialog/missed-schedule-forget-confirmation-dialog.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-missed-schedules',
|
||||
templateUrl: './missed-schedules.component.html',
|
||||
styleUrls: ['./missed-schedules.component.css']
|
||||
})
|
||||
export class MissedSchedulesComponent implements OnInit{
|
||||
|
||||
missedSchedules: ScheduleInfo[] = []
|
||||
defaultNavigationLinkPath: NavigationLink[] = [
|
||||
{
|
||||
linkText: "Dashboard",
|
||||
routerLink: ['/']
|
||||
},
|
||||
{
|
||||
linkText: "Missed Schedules",
|
||||
routerLink: ["/reschedule"]
|
||||
}
|
||||
]
|
||||
constructor(private scheduleService: ScheduleService,
|
||||
private snackbar: MatSnackBar,
|
||||
private dialog: MatDialog) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.scheduleService.schedulesMissedGet().subscribe({
|
||||
next: resp => {
|
||||
this.missedSchedules = resp;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
forgetAllSchedules() {
|
||||
const dialogRef = this.dialog.open(MissedScheduleForgetConfirmationDialogComponent, {data: this.missedSchedules, width: "400px"});
|
||||
dialogRef.afterClosed().subscribe(res => {
|
||||
if(res != undefined) {
|
||||
this.missedSchedules = [];
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
65
openapi.yaml
65
openapi.yaml
@ -1694,9 +1694,67 @@ paths:
|
||||
schema:
|
||||
type: object
|
||||
$ref: "#/components/schemas/SimpleStatusResponse"
|
||||
|
||||
|
||||
|
||||
/schedules/missed:
|
||||
get:
|
||||
security:
|
||||
- API_TOKEN: []
|
||||
tags:
|
||||
- schedule
|
||||
description: Registers forgotten schedule
|
||||
summary: registers forgotten schedule
|
||||
responses:
|
||||
200:
|
||||
description: Operation successfull
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ScheduleInfo'
|
||||
403:
|
||||
description: User not found/No permission
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
/schedules/{scheduleIDs}/all:
|
||||
delete:
|
||||
security:
|
||||
- API_TOKEN: []
|
||||
tags:
|
||||
- schedule
|
||||
description: deletes multiple schedules at once
|
||||
summary: deletes multiple schedules
|
||||
parameters:
|
||||
- name: scheduleIDs
|
||||
in: path
|
||||
description: internal ids of schedules to delete
|
||||
required: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
responses:
|
||||
200:
|
||||
description: Operation successfull
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
403:
|
||||
description: No permission
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
404:
|
||||
description: Schedule not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||
components:
|
||||
securitySchemes:
|
||||
API_TOKEN:
|
||||
@ -2232,3 +2290,4 @@ components:
|
||||
type: number
|
||||
description: number of minutes spent on task
|
||||
example: 10
|
||||
|
Loading…
Reference in New Issue
Block a user