issue-20 #46

Merged
sebastian merged 15 commits from issue-20 into master 2023-11-12 13:18:53 +01:00
8 changed files with 166 additions and 11 deletions
Showing only changes of commit f271b59b8e - Show all commits

View File

@ -6,10 +6,13 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="ScheduleNow test with running advanced Schedule"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="ScheduleNow test with running advanced Schedule">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <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/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleInfo.java" 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/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleInfo.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$/src/main/java/core/entities/timemanager/BasicTaskSchedule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/BasicTaskSchedule.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -220,7 +223,7 @@
<workItem from="1699473376129" duration="1423000" /> <workItem from="1699473376129" duration="1423000" />
<workItem from="1699639316405" duration="9267000" /> <workItem from="1699639316405" duration="9267000" />
<workItem from="1699684493731" duration="1121000" /> <workItem from="1699684493731" duration="1121000" />
<workItem from="1699769541677" duration="2562000" /> <workItem from="1699769541677" duration="4039000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies"> <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" /> <option name="closed" value="true" />

View File

@ -249,4 +249,18 @@ public class ScheduleController {
} }
return ResponseEntity.ok(new SimpleStatusResponse("success")); return ResponseEntity.ok(new SimpleStatusResponse("success"));
} }
@GetMapping("/schedules/{scheduleID}/details")
public ResponseEntity<?> loadScheduleDetails(@PathVariable long scheduleID) {
PermissionResult<AbstractSchedule> 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"));
}
return ResponseEntity.ok(permissionResult.getResult().toScheduleInfo());
}
} }

View File

@ -578,6 +578,65 @@ export class ScheduleService {
); );
} }
/**
* load schedule
* gets details of schedule
* @param scheduleID internal id of 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 schedulesScheduleIDDetailsGet(scheduleID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesScheduleIDDetailsGet(scheduleID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesScheduleIDDetailsGet(scheduleID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesScheduleIDDetailsGet(scheduleID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (scheduleID === null || scheduleID === undefined) {
throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDDetailsGet.');
}
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<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/details`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/** /**
* @param scheduleID internal id of schedule * @param scheduleID internal id of schedule
* @param finish internal id of schedule * @param finish internal id of schedule

View File

@ -3,8 +3,8 @@
<ngx-material-timepicker #picker ></ngx-material-timepicker>--> <ngx-material-timepicker #picker ></ngx-material-timepicker>-->
<!----> <!---->
<div> <div>
<app-date-time-picker #startTimePicker (onTimeSet)="onStartTimeSet($event)"></app-date-time-picker> <app-date-time-picker #startTimePicker (onTimeSet)="onStartTimeSet($event)" [date]="selectedStartTime"></app-date-time-picker>
<app-date-time-picker #stopTimePicker (onTimeSet)="onStopTimeSet($event)"></app-date-time-picker> <app-date-time-picker #stopTimePicker (onTimeSet)="onStopTimeSet($event)" [date]="selectedStopTime"></app-date-time-picker>
</div> </div>
<div style="width: 100%; display: flex; align-items: center; justify-content: space-between" > <div style="width: 100%; display: flex; align-items: center; justify-content: space-between" >

View File

@ -1,4 +1,15 @@
import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; import {
AfterContentInit,
AfterViewInit,
Component,
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
ViewChild
} from '@angular/core';
import { import {
AdvancedScheduleFieldInfo, AdvancedScheduleInfo, AdvancedScheduleFieldInfo, AdvancedScheduleInfo,
ScheduleInfo, ScheduleInfo,
@ -13,7 +24,7 @@ import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.c
templateUrl: './advanced-scheduler.component.html', templateUrl: './advanced-scheduler.component.html',
styleUrls: ['./advanced-scheduler.component.css'] styleUrls: ['./advanced-scheduler.component.css']
}) })
export class AdvancedSchedulerComponent implements OnInit{ export class AdvancedSchedulerComponent implements OnInit, OnChanges{
@Input() task: TaskEntityInfo | undefined; @Input() task: TaskEntityInfo | undefined;
@Input() taskgroup: TaskgroupEntityInfo | undefined @Input() taskgroup: TaskgroupEntityInfo | undefined
@Input() scheduleInfo: ScheduleInfo | undefined @Input() scheduleInfo: ScheduleInfo | undefined
@ -37,6 +48,18 @@ export class AdvancedSchedulerComponent implements OnInit{
ngOnInit() { ngOnInit() {
this.calcFutureProgress(); this.calcFutureProgress();
this.calcCurrentProgress(); this.calcCurrentProgress();
if(this.scheduleInfo != undefined) {
const schedule = this.scheduleInfo as AdvancedScheduleInfo
this.selectedStartTime = new Date(schedule.scheduleStartTime);
this.selectedStopTime = new Date(schedule.scheduleStopTime);
this.calcFutureProgress();
this.calcCurrentProgress();
}
}
ngOnChanges() {
} }
setDate(clickedDate: Date) { setDate(clickedDate: Date) {
@ -114,6 +137,15 @@ export class AdvancedSchedulerComponent implements OnInit{
this.onSchedule.emit(resp as AdvancedScheduleInfo); this.onSchedule.emit(resp as AdvancedScheduleInfo);
} }
}) })
} else {
this.scheduleService.schedulesScheduleIDAdvancedPost(this.scheduleInfo.scheduleID!, {
scheduleStartTime: this.selectedStartTime!.toISOString(),
scheduleStopTime: this.selectedStopTime!.toISOString()
}).subscribe({
next: resp => {
this.onSchedule.emit(resp as AdvancedScheduleInfo);
}
})
} }
} }

View File

@ -20,9 +20,11 @@
> >
</mwl-calendar-week-view> </mwl-calendar-week-view>
<app-basic-scheduler *ngIf="scheduleStrategy === 1" #basicScheduler [task]="task" [taskgroup]="taskgroup" (onSchedule)="onBasicSchedule($event)"></app-basic-scheduler> <app-basic-scheduler *ngIf="scheduleStrategy === 1" #basicScheduler [task]="task" [taskgroup]="taskgroup" (onSchedule)="onBasicSchedule($event)"
[scheduleInfo]="editedSchedule"
></app-basic-scheduler>
<app-advanced-scheduler *ngIf="scheduleStrategy === 3" #advancedScheduler [task]="task" [taskgroup]="taskgroup" <app-advanced-scheduler *ngIf="scheduleStrategy === 3" #advancedScheduler [task]="task" [taskgroup]="taskgroup"
(onStartTimeSet)="eventTimesExternalChange($event, true)" (onEndTimeSet)="eventTimesExternalChange($event, false)" (onStartTimeSet)="eventTimesExternalChange($event, true)" (onEndTimeSet)="eventTimesExternalChange($event, false)"
(onSchedule)="onAdvancedSchedule($event)" (onSchedule)="onAdvancedSchedule($event)" [scheduleInfo]="editedSchedule"
></app-advanced-scheduler> ></app-advanced-scheduler>
</div> </div>

View File

@ -53,6 +53,7 @@ export class SchedulerComponent implements OnInit{
taskgroupPath: TaskgroupEntityInfo[] = [] taskgroupPath: TaskgroupEntityInfo[] = []
taskgroupID: number = -1; taskgroupID: number = -1;
scheduleID: number = -1; scheduleID: number = -1;
editedSchedule: ScheduleInfo | undefined
@ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined @ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
task: TaskEntityInfo | undefined task: TaskEntityInfo | undefined
@ -103,7 +104,15 @@ export class SchedulerComponent implements OnInit{
} }
if(params.has('scheduleID')) { if(params.has('scheduleID')) {
this.scheduleID = Number(params.get('scheduleID')); this.scheduleService.schedulesScheduleIDDetailsGet(parseInt(params.get('scheduleID')!)).subscribe({
next: resp => {
this.editedSchedule = resp;
this.scheduleID = resp.scheduleID;
if(resp.scheduleType == 'ADVANCED') {
this.scheduleStrategy = 3;
}
}
})
} }
}); });
} }

View File

@ -1830,6 +1830,42 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/SimpleStatusResponse' $ref: '#/components/schemas/SimpleStatusResponse'
/schedules/{scheduleID}/details:
get:
security:
- API_TOKEN: []
tags:
- schedule
description: gets details of schedule
summary: load schedule
parameters:
- name: scheduleID
in: path
description: internal id of schedule
required: true
schema:
type: number
example: 1
responses:
200:
description: Operation successfull
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduleInfo'
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'
/history/workingStatus: /history/workingStatus:
get: get:
security: security: