Visualize Advanced Schedules in ScheduleDashboard
All checks were successful
Java CI with Maven / build (push) Successful in 49s
All checks were successful
Java CI with Maven / build (push) Successful in 49s
This commit is contained in:
parent
5b62986029
commit
6485a42a6a
@ -41,7 +41,7 @@ public class ScheduleController {
|
||||
@GetMapping("/schedules/{taskID}")
|
||||
public ResponseEntity<?> loadAllSchedulesOfTask(@PathVariable long taskID) {
|
||||
PermissionResult<Task> 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<AbstractSchedule> 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<Task> 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<AbstractSchedule> 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<AbstractSchedule> 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<Task> 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<PermissionResult<AbstractSchedule>> permissionResults = new ArrayList<>();
|
||||
for(long scheduleID: scheduleIDs) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(permissionResult.isHasPermissions()) {
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
|
@ -12,3 +12,7 @@
|
||||
.scheduleContainer {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.advanced-info {
|
||||
color: #6e6e6e;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<mat-card *ngFor="let schedule of schedules" class="scheduleContainer">
|
||||
<mat-card-content>
|
||||
<ng-container *ngIf="schedule.scheduleType == 'BASIC'">
|
||||
<div *ngIf="schedule.scheduleType == 'BASIC'">
|
||||
<div class="basicScheduleContainer">
|
||||
<p class="basicScheduleContent">{{ toBasicSchedule(schedule).scheduleDate | date:'EEEE, d MMM. y'}}</p>
|
||||
<div class="basicScheduleContent">
|
||||
@ -8,8 +8,23 @@
|
||||
<button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
</div>
|
||||
<div *ngIf="schedule.scheduleType == 'ADVANCED'">
|
||||
<div class="basicScheduleContainer">
|
||||
<div class="basicScheduleContent">
|
||||
<p>
|
||||
<span>{{ toAdvancedSchedule(schedule).scheduleStartTime | date:'EEEE, d MMM. y'}}</span>
|
||||
<span> to </span>
|
||||
<span>{{ toAdvancedSchedule(schedule).scheduleStopTime | date:'EEEE, d MMM. y'}}</span>
|
||||
</p>
|
||||
<p class="advanced-info">Minutes: {{calcDurationOfAdvancedSchedule(schedule)}}</p>
|
||||
</div>
|
||||
<div class="basicScheduleContent">
|
||||
<button mat-icon-button color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule', schedule.scheduleID]"><mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user