diff --git a/backend/src/main/java/core/api/controller/ScheduleController.java b/backend/src/main/java/core/api/controller/ScheduleController.java index f5fe890..2eae5f8 100644 --- a/backend/src/main/java/core/api/controller/ScheduleController.java +++ b/backend/src/main/java/core/api/controller/ScheduleController.java @@ -41,7 +41,7 @@ public class ScheduleController { @GetMapping("/schedules/{taskID}") public ResponseEntity loadAllSchedulesOfTask(@PathVariable long taskID) { PermissionResult permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -126,7 +126,7 @@ public class ScheduleController { @DeleteMapping("/schedules/{scheduleID}") public ResponseEntity deleteSchedule(@PathVariable long scheduleID) { PermissionResult permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -148,7 +148,7 @@ public class ScheduleController { @PostMapping("/schedules/{taskID}/now") public ResponseEntity scheduleNow(@PathVariable long taskID) { PermissionResult permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -177,7 +177,7 @@ public class ScheduleController { @PostMapping("/schedules/{scheduleID}/activate") public ResponseEntity activateSchedule(@PathVariable long scheduleID) { PermissionResult permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -192,7 +192,7 @@ public class ScheduleController { @PostMapping("/schedules/{scheduleID}/stop/{finish}") public ResponseEntity stopSchedule(@PathVariable long scheduleID, @PathVariable boolean finish) { PermissionResult permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -207,7 +207,7 @@ public class ScheduleController { @PostMapping("/schedules/{taskID}/forgotten") public ResponseEntity registerForgottenSchedule(@PathVariable long taskID, @RequestBody @Valid ForgottenScheduleInfo forgottenScheduleInfo) { PermissionResult permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } @@ -234,7 +234,7 @@ public class ScheduleController { List> permissionResults = new ArrayList<>(); for(long scheduleID: scheduleIDs) { PermissionResult permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName()); - if(permissionResult.isHasPermissions()) { + if(!permissionResult.isHasPermissions()) { return ResponseEntity.status(403).body(new SimpleStatusResponse("failed")); } diff --git a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.css b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.css index aead524..d3e8a2c 100644 --- a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.css +++ b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.css @@ -12,3 +12,7 @@ .scheduleContainer { margin-bottom: 5px; } + +.advanced-info { + color: #6e6e6e; +} diff --git a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html index 9a913cf..b6371a3 100644 --- a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html +++ b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html @@ -1,6 +1,6 @@ - +

{{ toBasicSchedule(schedule).scheduleDate | date:'EEEE, d MMM. y'}}

@@ -8,8 +8,23 @@
- - +
+
+
+
+

+ {{ toAdvancedSchedule(schedule).scheduleStartTime | date:'EEEE, d MMM. y'}} + to + {{ toAdvancedSchedule(schedule).scheduleStopTime | date:'EEEE, d MMM. y'}} +

+

Minutes: {{calcDurationOfAdvancedSchedule(schedule)}}

+
+
+ + +
+
+
diff --git a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.ts b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.ts index 67583f9..1e825f0 100644 --- a/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.ts +++ b/frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.ts @@ -1,5 +1,6 @@ import {Component, Input, OnInit} from '@angular/core'; import { + AdvancedScheduleInfo, BasicScheduleEntityInfo, BasicScheduleInfo, ScheduleInfo, ScheduleService, @@ -7,6 +8,7 @@ import { TaskgroupEntityInfo } from "../../../api"; import {MatSnackBar} from "@angular/material/snack-bar"; +import {AdvancedSchedulerComponent} from "../advanced-scheduler/advanced-scheduler.component"; @Component({ selector: 'app-schedule-dashboard', @@ -57,4 +59,14 @@ export class ScheduleDashboardComponent implements OnInit{ toBasicSchedule(schedule: ScheduleInfo) { return schedule as BasicScheduleInfo } + + toAdvancedSchedule(schedule: ScheduleInfo) { + return schedule as AdvancedScheduleInfo + } + + calcDurationOfAdvancedSchedule(schedule: ScheduleInfo) { + const advancedSchedule = schedule as AdvancedScheduleInfo + const diffMs = new Date(advancedSchedule.scheduleStopTime).getTime() - new Date(advancedSchedule.scheduleStartTime).getTime(); + return Math.floor((diffMs / 1000) / 60); + } }