Schedule Advanced Schedules
All checks were successful
Java CI with Maven / build (push) Successful in 44s

This commit is contained in:
Sebastian Böckelmann 2023-11-12 10:09:51 +01:00
parent fd4012ec90
commit 6d50e30475
14 changed files with 508 additions and 163 deletions

View File

@ -6,8 +6,17 @@
<component name="ChangeListManager">
<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$/../frontend/src/api/.openapi-generator/FILES" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/.openapi-generator/FILES" 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/AdvancedScheduleFieldInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleFieldInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleFieldInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/BasicScheduleFieldInfo.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/schedules/advanced-scheduler/advanced-scheduler.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.css" 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.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.css" 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$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -219,6 +228,7 @@
<workItem from="1699473376129" duration="1423000" />
<workItem from="1699639316405" duration="9267000" />
<workItem from="1699684493731" duration="1121000" />
<workItem from="1699769541677" duration="1606000" />
</task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" />
@ -566,6 +576,11 @@
<line>57</line>
<option name="timeStamp" value="12" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
<line>68</line>
<option name="timeStamp" value="14" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

View File

@ -53,10 +53,19 @@ public class ScheduleController {
return ResponseEntity.ok(taskSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
}
@PutMapping("/schedules/{taskID}")
public ResponseEntity<?> createSchedule(@PathVariable long taskID, @RequestBody @Valid ScheduleFieldInfo scheduleFieldInfo) {
@PutMapping("/schedules/{taskID}/basic")
public ResponseEntity<?> createBasicSchedule(@PathVariable long taskID, @RequestBody @Valid BasicScheduleFieldInfo scheduleFieldInfo) {
return createAbstractSchedule(taskID, scheduleFieldInfo);
}
@PutMapping("/schedules/{taskID}/advanced")
public ResponseEntity<?> createAdsvancedSchedule(@PathVariable long taskID, @RequestBody @Valid AdvancedScheduleFieldInfo scheduleFieldInfo) {
return createAbstractSchedule(taskID, scheduleFieldInfo);
}
private ResponseEntity<?> createAbstractSchedule(long taskID, ScheduleFieldInfo scheduleFieldInfo) {
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
if(permissionResult.isHasPermissions()) {
if(!permissionResult.isHasPermissions()) {
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
}
@ -75,10 +84,19 @@ public class ScheduleController {
}
}
@PostMapping("/schedules/{scheduleID}")
public ResponseEntity<?> editSchedule(@PathVariable long scheduleID, @RequestBody @Valid ScheduleFieldInfo scheduleFieldInfo) {
@PostMapping("/schedules/{scheduleID}/basic")
public ResponseEntity<?> editBasicSchedule(@PathVariable long scheduleID, @RequestBody @Valid BasicScheduleFieldInfo scheduleFieldInfo) {
return editAbstractSchedule(scheduleID, scheduleFieldInfo);
}
@PostMapping("/schedules/{scheduleID}/advanced")
public ResponseEntity<?> editAdvancedSchedule(@PathVariable long scheduleID, @RequestBody @Valid AdvancedScheduleFieldInfo scheduleFieldInfo) {
return editAbstractSchedule(scheduleID, scheduleFieldInfo);
}
private ResponseEntity<?> editAbstractSchedule(long scheduleID, ScheduleFieldInfo scheduleFieldInfo) {
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
if(permissionResult.isHasPermissions()) {
if(!permissionResult.isHasPermissions()) {
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
}

View File

@ -1,13 +1,18 @@
package core.api.models.timemanager.taskSchedule.scheduleInfos;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
public class AdvancedScheduleFieldInfo extends ScheduleFieldInfo {
@NotNull
@JsonProperty
private LocalDateTime scheduleStartTime;
@NotNull
@JsonProperty
private LocalDateTime scheduleStopTime;
public AdvancedScheduleFieldInfo(LocalDateTime scheduleStartTime, LocalDateTime scheduleStopTime) {

View File

@ -1,5 +1,7 @@
package core.api.models.timemanager.taskSchedule.scheduleInfos;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;

View File

@ -18,7 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
import { AdvancedScheduleInfo } from '../model/models';
import { AdvancedScheduleFieldInfo } from '../model/models';
import { BasicScheduleFieldInfo } from '../model/models';
import { ForgottenActivityRequest } from '../model/models';
import { ScheduleActivateInfo } from '../model/models';
@ -379,6 +379,146 @@ export class ScheduleService {
);
}
/**
* reschedules task
* reschedules a task
* @param scheduleID internal id of schedule
* @param advancedScheduleFieldInfo
* @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 schedulesScheduleIDAdvancedPost(scheduleID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesScheduleIDAdvancedPost(scheduleID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesScheduleIDAdvancedPost(scheduleID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesScheduleIDAdvancedPost(scheduleID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, 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 schedulesScheduleIDAdvancedPost.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/advanced`,
advancedScheduleFieldInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* reschedules task
* reschedules a task
* @param scheduleID internal id of schedule
* @param basicScheduleFieldInfo
* @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 schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, 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 schedulesScheduleIDBasicPost.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/basic`,
basicScheduleFieldInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* deletes schedule
* deletes a schedule
@ -438,76 +578,6 @@ export class ScheduleService {
);
}
/**
* reschedules task
* reschedules a task
* @param scheduleID internal id of schedule
* @param basicScheduleFieldInfoAdvancedScheduleInfo
* @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 schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, 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 schedulesScheduleIDPost.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}`,
basicScheduleFieldInfoAdvancedScheduleInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* @param scheduleID internal id of schedule
* @param finish internal id of schedule
@ -629,6 +699,146 @@ export class ScheduleService {
);
}
/**
* creates advanced schedule for task
* creates a advanced schedule for a task
* @param taskID internal id of task
* @param advancedScheduleFieldInfo
* @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 schedulesTaskIDAdvancedPut(taskID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDAdvancedPut(taskID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDAdvancedPut(taskID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDAdvancedPut(taskID: number, advancedScheduleFieldInfo?: AdvancedScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskID === null || taskID === undefined) {
throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDAdvancedPut.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/advanced`,
advancedScheduleFieldInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* creates basic schedule for task
* creates a basic schedule for a task
* @param taskID internal id of task
* @param basicScheduleFieldInfo
* @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 schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskID === null || taskID === undefined) {
throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDBasicPut.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/basic`,
basicScheduleFieldInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* registers forgotten schedule
* Registers forgotten schedule
@ -818,74 +1028,4 @@ export class ScheduleService {
);
}
/**
* creates basic schedule for task
* creates a basic schedule for a task
* @param taskID internal id of task
* @param basicScheduleFieldInfoAdvancedScheduleInfo
* @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 schedulesTaskIDPut(taskID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfoAdvancedScheduleInfo?: BasicScheduleFieldInfo | AdvancedScheduleInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskID === null || taskID === undefined) {
throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDPut.');
}
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();
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
}
let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
}
return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}`,
basicScheduleFieldInfoAdvancedScheduleInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@ -77,6 +77,8 @@ import { ActiveTaskOverviewComponent } from './active-task-overview/active-task-
import { AdvancedSchedulerComponent } from './schedules/advanced-scheduler/advanced-scheduler.component';
import {NgxMaterialTimepickerModule} from "ngx-material-timepicker";
import { DateTimePickerComponent } from './date-time-picker/date-time-picker.component';
import {MatSliderModule} from "@angular/material/slider";
import {MatLegacySliderModule} from "@angular/material/legacy-slider";
@NgModule({
declarations: [
AppComponent,
@ -153,7 +155,8 @@ import { DateTimePickerComponent } from './date-time-picker/date-time-picker.com
MatSelectModule,
MatTreeModule,
MatAutocompleteModule,
NgxMaterialTimepickerModule
NgxMaterialTimepickerModule,
MatSliderModule
],
providers: [
HttpClientModule,

View File

@ -1,3 +1,14 @@
app-date-time-picker {
margin-right: 20px;
}
.example-label-container {
display: flex;
justify-content: space-between;
margin: 0;
}
.scheduleBtn {
margin-top: 20px;
}

View File

@ -7,6 +7,19 @@
<app-date-time-picker #stopTimePicker (onTimeSet)="onStopTimeSet($event)"></app-date-time-picker>
</div>
<div style="width: 100%; display: flex; align-items: center; justify-content: space-between" >
<div style="width: 90%;">
<div class="example-label-container">
<label id="example-name-label" class="example-name-label">0</label>
<label class="example-value-label">{{task!.eta}}</label>
</div>
<mat-slider min="0" [max]="task!.eta" step="15" style="width: 100%;" [discrete]="true" [showTickMarks]="true" #slider>
<input matSliderThumb>
</mat-slider>
</div>
<button style="margin-left: 20px" mat-raised-button color="primary">Add</button>
</div>
<div class="progress-stacked" >
<div class="progress" role="progressbar" aria-label="Segment one" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" [style.width]=currentProgress>
<div class="progress-bar">{{currentProgress}}</div>
@ -17,6 +30,6 @@
</div>
<button class="scheduleBtn" mat-raised-button color="primary" >Schedule</button>
<button class="scheduleBtn" mat-raised-button color="primary" (click)="schedule()">Schedule</button>
</div>

View File

@ -1,5 +1,11 @@
import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
import {
AdvancedScheduleFieldInfo, AdvancedScheduleInfo,
ScheduleInfo,
ScheduleService,
TaskEntityInfo,
TaskgroupEntityInfo
} from "../../../api";
import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.component";
@Component({
@ -10,18 +16,24 @@ import {DateTimePickerComponent} from "../../date-time-picker/date-time-picker.c
export class AdvancedSchedulerComponent implements OnInit{
@Input() task: TaskEntityInfo | undefined;
@Input() taskgroup: TaskgroupEntityInfo | undefined
@Input() scheduleInfo: ScheduleInfo | undefined
@ViewChild('startTimePicker') startTimePicker?: DateTimePickerComponent;
@ViewChild('stopTimePicker') stopTimePicker?: DateTimePickerComponent;
@Output('onStartTimeSet') startTimeEmitter : EventEmitter<Date> = new EventEmitter<Date>();
@Output('onEndTimeSet') endTimeEmitter : EventEmitter<Date> = new EventEmitter<Date>();
@Output('onSchedule') onSchedule: EventEmitter<AdvancedScheduleInfo> = new EventEmitter<AdvancedScheduleInfo>();
selectedStartTime: Date | undefined
selectedStopTime: Date | undefined
currentProgress: string = "30%";
futureProgress: string = "60%"
constructor(private scheduleService: ScheduleService) {
}
ngOnInit() {
this.calcFutureProgress();
this.calcCurrentProgress();
@ -92,7 +104,17 @@ export class AdvancedSchedulerComponent implements OnInit{
return Math.floor((diffMs / 1000) / 60);
}
schedule() {
if(this.scheduleInfo == undefined) {
this.scheduleService.schedulesTaskIDAdvancedPut(this.task!.taskID, {
scheduleStartTime: this.selectedStartTime!.toISOString(),
scheduleStopTime: this.selectedStopTime!.toISOString()
}).subscribe({
next: resp => {
this.onSchedule.emit(resp as AdvancedScheduleInfo);
}
})
}
}
}

View File

@ -35,7 +35,7 @@ export class BasicSchedulerComponent implements OnChanges{
schedule() {
if(this.task != undefined) {
if(this.scheduleEntityInfo == undefined) {
this.scheduleService.schedulesTaskIDPut(this.task.taskID, {
this.scheduleService.schedulesTaskIDBasicPut(this.task.taskID, {
scheduleDate: this.dateCtrl.value
}).subscribe({
next: resp => {
@ -43,7 +43,7 @@ export class BasicSchedulerComponent implements OnChanges{
}
})
} else {
this.scheduleService.schedulesScheduleIDPost(this.scheduleEntityInfo!.scheduleID, {
this.scheduleService.schedulesScheduleIDBasicPost(this.scheduleEntityInfo!.scheduleID, {
scheduleDate: this.dateCtrl.value
}).subscribe({
next: resp => {

View File

@ -25,3 +25,4 @@
.long-form {
width: 100%;
}

View File

@ -23,5 +23,6 @@
<app-basic-scheduler *ngIf="scheduleStrategy === 1" #basicScheduler [task]="task" [taskgroup]="taskgroup" (onSchedule)="onBasicSchedule($event)"></app-basic-scheduler>
<app-advanced-scheduler *ngIf="scheduleStrategy === 3" #advancedScheduler [task]="task" [taskgroup]="taskgroup"
(onStartTimeSet)="eventTimesExternalChange($event, true)" (onEndTimeSet)="eventTimesExternalChange($event, false)"
(onSchedule)="onAdvancedSchedule($event)"
></app-advanced-scheduler>
</div>

View File

@ -1,7 +1,8 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
import {
BasicScheduleEntityInfo, BasicScheduleInfo, ScheduleService,
AdvancedScheduleInfo,
BasicScheduleEntityInfo, BasicScheduleInfo, ScheduleInfo, ScheduleService,
TaskEntityInfo,
TaskgroupEntityInfo,
TaskgroupService,
@ -255,4 +256,29 @@ export class SchedulerComponent implements OnInit{
this.refresh.next();
}
onAdvancedSchedule(schedule: AdvancedScheduleInfo) {
const event: CalendarEvent<any>| undefined = this.findEventByTaskPath(this.computeTaskPath(schedule.taskgroupPath, schedule.task));
if(event == undefined) {
this.events.push({
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
start: new Date(schedule.scheduleStartTime),
end: new Date(schedule.scheduleStopTime),
color: colors['red'],
resizable: {
beforeStart: false,
afterEnd: false
}
})
this.refresh.next();
} else {
event.color = colors['red'];
event.resizable = {
beforeStart: false,
afterEnd: false
}
}
}
}

View File

@ -1309,6 +1309,7 @@ paths:
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{taskID}/basic:
put:
security:
- API_TOKEN: []
@ -1328,54 +1329,7 @@ paths:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/BasicScheduleFieldInfo'
- $ref: '#/components/schemas/AdvancedScheduleInfo'
responses:
200:
description: operation successfull
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/ScheduleInfo'
403:
description: No permission
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
404:
description: Taskgroup does not exist
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{scheduleID}:
post:
security:
- API_TOKEN: []
tags:
- schedule
description: reschedules a task
summary: reschedules task
parameters:
- name: scheduleID
in: path
description: internal id of schedule
required: true
schema:
type: number
example: 1
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/BasicScheduleFieldInfo'
- $ref: '#/components/schemas/AdvancedScheduleInfo'
$ref: '#/components/schemas/BasicScheduleFieldInfo'
responses:
200:
@ -1399,6 +1353,140 @@ paths:
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{taskID}/advanced:
put:
security:
- API_TOKEN: []
tags:
- schedule
description: creates a advanced schedule for a task
summary: creates advanced schedule for task
parameters:
- name: taskID
in: path
description: internal id of task
required: true
schema:
type: number
example: 1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdvancedScheduleFieldInfo'
responses:
200:
description: operation successfull
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/ScheduleInfo'
403:
description: No permission
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
404:
description: Taskgroup does not exist
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{scheduleID}/basic:
post:
security:
- API_TOKEN: []
tags:
- schedule
description: reschedules a task
summary: reschedules task
parameters:
- name: scheduleID
in: path
description: internal id of schedule
required: true
schema:
type: number
example: 1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BasicScheduleFieldInfo'
responses:
200:
description: operation successfull
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/ScheduleInfo'
403:
description: No permission
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
404:
description: Taskgroup does not exist
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{scheduleID}/advanced:
post:
security:
- API_TOKEN: []
tags:
- schedule
description: reschedules a task
summary: reschedules task
parameters:
- name: scheduleID
in: path
description: internal id of schedule
required: true
schema:
type: number
example: 1
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdvancedScheduleFieldInfo'
responses:
200:
description: operation successfull
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/ScheduleInfo'
403:
description: No permission
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
404:
description: Taskgroup does not exist
content:
'application/json':
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{scheduleID}:
delete:
security:
- API_TOKEN: []