Create Advanced Scheduler and adapt Scheduler
All checks were successful
Java CI with Maven / build (push) Successful in 47s

This commit is contained in:
Sebastian Böckelmann 2023-11-11 20:54:06 +01:00
parent 234eacca0c
commit 821c703e29
15 changed files with 273 additions and 74 deletions

View File

@ -4,13 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Basic Reschedule">
<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$/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/repositories/timemanager/ScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/ScheduleRepository.java" 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$/src/test/java/core/schedules/ScheduleServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/schedules/ScheduleServiceTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/resources/basicScheduleEntries.sql" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/resources/basicScheduleEntries.sql" 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$/../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$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -90,22 +88,6 @@
</key>
</component>
<component name="RunManager" selected="Spring Boot.DemoApplication">
<configuration name="ScheduleServiceTest.deleteSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="core.schedules.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="core.schedules" />
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
<option name="METHOD_NAME" value="deleteSchedule" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ScheduleServiceTest.editBasicSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
@ -122,7 +104,7 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ScheduleServiceTest.getAllSchedulesOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<configuration name="ScheduleServiceTest.editscheduleAdvanced" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
@ -132,13 +114,13 @@
</extension>
<option name="PACKAGE_NAME" value="core.schedules" />
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
<option name="METHOD_NAME" value="getAllSchedulesOfUser" />
<option name="METHOD_NAME" value="editscheduleAdvanced" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ScheduleServiceTest.getFilteredScheduledOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<configuration name="ScheduleServiceTest.scheduleAdvanced" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
@ -148,13 +130,13 @@
</extension>
<option name="PACKAGE_NAME" value="core.schedules" />
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
<option name="METHOD_NAME" value="getFilteredScheduledOfUser" />
<option name="METHOD_NAME" value="scheduleAdvanced" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ScheduleServiceTest.scheduleBasic" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<configuration name="ScheduleServiceTest.scheduleNow" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
@ -164,12 +146,27 @@
</extension>
<option name="PACKAGE_NAME" value="core.schedules" />
<option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
<option name="METHOD_NAME" value="scheduleBasic" />
<option name="METHOD_NAME" value="scheduleNow" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="core.tasks.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="core.tasks" />
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="DemoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<module name="demo" />
<option name="SPRING_BOOT_MAIN_CLASS" value="core.DemoApplication" />
@ -179,11 +176,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="JUnit.ScheduleServiceTest.getFilteredScheduledOfUser" />
<item itemvalue="JUnit.ScheduleServiceTest.deleteSchedule" />
<item itemvalue="JUnit.ScheduleServiceTest.scheduleNow" />
<item itemvalue="JUnit.ScheduleServiceTest.editBasicSchedule" />
<item itemvalue="JUnit.ScheduleServiceTest.scheduleBasic" />
<item itemvalue="JUnit.ScheduleServiceTest.getAllSchedulesOfUser" />
<item itemvalue="JUnit.ScheduleServiceTest.editscheduleAdvanced" />
<item itemvalue="JUnit.ScheduleServiceTest.scheduleAdvanced" />
<item itemvalue="JUnit.TaskServiceTest" />
</list>
</recent_temporary>
</component>
@ -487,46 +484,53 @@
<option name="project" value="LOCAL" />
<updated>1699695051881</updated>
</task>
<task id="LOCAL-00034" summary="Update gitignore and add Clear ScheduleCode">
<task id="LOCAL-00034" summary="Get Working Status of Today Endpoint">
<option name="closed" value="true" />
<created>1699705458914</created>
<created>1699726166056</created>
<option name="number" value="00034" />
<option name="presentableId" value="LOCAL-00034" />
<option name="project" value="LOCAL" />
<updated>1699705458914</updated>
<updated>1699726166056</updated>
</task>
<task id="LOCAL-00035" summary="Get All Schedules of User">
<task id="LOCAL-00035" summary="Include Working Status in Frontend Dashboard">
<option name="closed" value="true" />
<created>1699708881009</created>
<created>1699726328681</created>
<option name="number" value="00035" />
<option name="presentableId" value="LOCAL-00035" />
<option name="project" value="LOCAL" />
<updated>1699708881009</updated>
<updated>1699726328681</updated>
</task>
<task id="LOCAL-00036" summary="Get All Schedules of Task + create Basic Schedule">
<task id="LOCAL-00036" summary="Create Datastructures for AdvancedSchedules and create schedules for them">
<option name="closed" value="true" />
<created>1699711238266</created>
<created>1699730041496</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1699711238266</updated>
<updated>1699730041496</updated>
</task>
<task id="LOCAL-00037" summary="Basic Reschedule">
<task id="LOCAL-00037" summary="Reschedule Advanced Schedules">
<option name="closed" value="true" />
<created>1699714216432</created>
<created>1699730644743</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1699714216432</updated>
<updated>1699730644743</updated>
</task>
<option name="localTasksCounter" value="38" />
<task id="LOCAL-00038" summary="ScheduleNow test with running advanced Schedule">
<option name="closed" value="true" />
<created>1699730764558</created>
<option name="number" value="00038" />
<option name="presentableId" value="LOCAL-00038" />
<option name="project" value="LOCAL" />
<updated>1699730764558</updated>
</task>
<option name="localTasksCounter" value="39" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Remove update spamming in console" />
<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" />
@ -547,11 +551,12 @@
<MESSAGE value="Deleting Task test" />
<MESSAGE value="Consider increased number of tasks" />
<MESSAGE value="Remove entityManager from TaskService" />
<MESSAGE value="Update gitignore and add Clear ScheduleCode" />
<MESSAGE value="Get All Schedules of User" />
<MESSAGE value="Get All Schedules of Task + create Basic Schedule" />
<MESSAGE value="Basic Reschedule" />
<option name="LAST_COMMIT_MESSAGE" value="Basic Reschedule" />
<MESSAGE value="Get Working Status of Today Endpoint" />
<MESSAGE value="Include Working Status in Frontend Dashboard" />
<MESSAGE value="Create Datastructures for AdvancedSchedules and create schedules for them" />
<MESSAGE value="Reschedule Advanced Schedules" />
<MESSAGE value="ScheduleNow test with running advanced Schedule" />
<option name="LAST_COMMIT_MESSAGE" value="ScheduleNow test with running advanced Schedule" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
@ -561,11 +566,6 @@
<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/services/TaskScheduleService.java</url>
<line>52</line>
<option name="timeStamp" value="32" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

View File

@ -15,6 +15,9 @@ encoder.ts
git_push.sh
index.ts
model/accountDeleteRequest.ts
model/advancedScheduleFieldInfo.ts
model/advancedScheduleInfo.ts
model/advancedScheduleInfoAllOf.ts
model/basicScheduleEntityInfo.ts
model/basicScheduleFieldInfo.ts
model/basicScheduleInfo.ts

View File

@ -18,6 +18,7 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
import { AdvancedScheduleInfo } from '../model/models';
import { BasicScheduleFieldInfo } from '../model/models';
import { ForgottenActivityRequest } from '../model/models';
import { ScheduleActivateInfo } from '../model/models';
@ -441,14 +442,14 @@ export class ScheduleService {
* reschedules task
* reschedules a task
* @param scheduleID internal id of schedule
* @param basicScheduleFieldInfo
* @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, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
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.');
}
@ -495,7 +496,7 @@ export class ScheduleService {
}
return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}`,
basicScheduleFieldInfo,
basicScheduleFieldInfoAdvancedScheduleInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,
@ -821,14 +822,14 @@ export class ScheduleService {
* creates basic schedule for task
* creates a basic schedule for a task
* @param taskID internal id of task
* @param basicScheduleFieldInfo
* @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, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
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.');
}
@ -875,7 +876,7 @@ export class ScheduleService {
}
return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}`,
basicScheduleFieldInfo,
basicScheduleFieldInfoAdvancedScheduleInfo,
{
context: localVarHttpContext,
responseType: <any>responseType_,

View File

@ -0,0 +1,18 @@
/**
* API Title
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface AdvancedScheduleFieldInfo {
scheduleStartTime: string;
scheduleStopTime: string;
}

View File

@ -0,0 +1,53 @@
/**
* API Title
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AdvancedScheduleInfoAllOf } from './advancedScheduleInfoAllOf';
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
import { TaskShortInfo } from './taskShortInfo';
import { ScheduleInfo } from './scheduleInfo';
export interface AdvancedScheduleInfo {
/**
* internal id of schedule
*/
scheduleID: number;
/**
* type of schedule
*/
scheduleType: AdvancedScheduleInfo.ScheduleTypeEnum;
/**
* date on which the task schedule was started
*/
startTime: string;
/**
* date on which the tasks schedule was finished
*/
finishedTime?: string;
/**
* number in minutes that the schedule was active
*/
activeMinutes: number;
task: TaskShortInfo;
taskgroupPath: Array<TaskgroupEntityInfo>;
scheduleStartTime: string;
scheduleStopTime: string;
}
export namespace AdvancedScheduleInfo {
export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
export const ScheduleTypeEnum = {
Basic: 'BASIC' as ScheduleTypeEnum,
Moderate: 'MODERATE' as ScheduleTypeEnum,
Advanced: 'ADVANCED' as ScheduleTypeEnum
};
}

View File

@ -0,0 +1,18 @@
/**
* API Title
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface AdvancedScheduleInfoAllOf {
scheduleStartTime: string;
scheduleStopTime: string;
}

View File

@ -1,4 +1,7 @@
export * from './accountDeleteRequest';
export * from './advancedScheduleFieldInfo';
export * from './advancedScheduleInfo';
export * from './advancedScheduleInfoAllOf';
export * from './basicScheduleEntityInfo';
export * from './basicScheduleFieldInfo';
export * from './basicScheduleInfo';

View File

@ -74,6 +74,7 @@ import { MissedScheduleForgetConfirmationDialogComponent } from './missed-schedu
import { OverdueTaskOverviewComponent } from './overdue-task-overview/overdue-task-overview.component';
import { UpcomingTaskOverviewComponent } from './upcoming-task-overview/upcoming-task-overview.component';
import { ActiveTaskOverviewComponent } from './active-task-overview/active-task-overview.component';
import { AdvancedSchedulerComponent } from './schedules/advanced-scheduler/advanced-scheduler.component';
@NgModule({
declarations: [
AppComponent,
@ -110,7 +111,8 @@ import { ActiveTaskOverviewComponent } from './active-task-overview/active-task-
MissedScheduleForgetConfirmationDialogComponent,
OverdueTaskOverviewComponent,
UpcomingTaskOverviewComponent,
ActiveTaskOverviewComponent
ActiveTaskOverviewComponent,
AdvancedSchedulerComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1,17 @@
<div class="scheduler-container">
<mat-form-field>
<input matInput [matDatepicker]="picker" [formControl]="startCtrl">
<mat-hint>MM/DD/YYYY</mat-hint>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field>
<input matInput [matDatepicker]="endPicker" [formControl]="endCtrl">
<mat-hint>MM/DD/YYYY</mat-hint>
<mat-datepicker-toggle matIconSuffix [for]="endPicker"></mat-datepicker-toggle>
<mat-datepicker #endPicker></mat-datepicker>
</mat-form-field>
<button class="scheduleBtn" mat-raised-button color="primary" >Schedule</button>
</div>

View File

@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AdvancedSchedulerComponent } from './advanced-scheduler.component';
describe('AdvancedSchedulerComponent', () => {
let component: AdvancedSchedulerComponent;
let fixture: ComponentFixture<AdvancedSchedulerComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [AdvancedSchedulerComponent]
});
fixture = TestBed.createComponent(AdvancedSchedulerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,26 @@
import {Component, Input} from '@angular/core';
import {TaskgroupEntityInfo, TaskShortInfo} from "../../../api";
import {FormControl, Validators} from "@angular/forms";
@Component({
selector: 'app-advanced-scheduler',
templateUrl: './advanced-scheduler.component.html',
styleUrls: ['./advanced-scheduler.component.css']
})
export class AdvancedSchedulerComponent {
@Input() task: TaskShortInfo | undefined;
@Input() taskgroup: TaskgroupEntityInfo | undefined
startCtrl = new FormControl('', [Validators.required])
endCtrl = new FormControl('', [Validators.required])
setDate(clickedDate: Date) {
if(this.startCtrl.value == undefined) {
this.startCtrl.setValue(clickedDate.toISOString());
} else if(new Date(Date.parse(this.startCtrl.value)) < clickedDate) {
this.endCtrl.setValue(clickedDate.toISOString());
}
}
}

View File

@ -20,5 +20,5 @@
</mwl-calendar-week-view>
<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"></app-advanced-scheduler>
</div>

View File

@ -14,6 +14,7 @@ import {CalendarDatePipe} from "angular-calendar/modules/common/calendar-date/ca
import {BasicSchedulerComponent} from "../basic-scheduler/basic-scheduler.component";
import * as events from "events";
import { EventColor } from 'calendar-utils';
import {AdvancedSchedulerComponent} from "../advanced-scheduler/advanced-scheduler.component";
const colors: Record<string, EventColor> = {
red: {
@ -66,6 +67,7 @@ export class SchedulerComponent implements OnInit{
events: CalendarEvent[] = []
@ViewChild('basicScheduler') basicScheduler: BasicSchedulerComponent | undefined
@ViewChild('advancedScheduler') advancedScheduler: AdvancedSchedulerComponent | undefined
constructor(private activatedRoute: ActivatedRoute,
private taskgroupService: TaskgroupService,
@ -118,8 +120,12 @@ export class SchedulerComponent implements OnInit{
protected readonly CalendarView = CalendarView;
timeClick(clickedDate: Date) {
if(this.basicScheduler != undefined) {
console.log(clickedDate)
if(this.basicScheduler != undefined && this.scheduleStrategy === 1) {
this.basicScheduler.setDate(clickedDate)
} else if(this.advancedScheduler != undefined && this.scheduleStrategy === 3) {
this.advancedScheduler.setDate(clickedDate)
}
}

View File

@ -1328,7 +1328,9 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/BasicScheduleFieldInfo'
oneOf:
- $ref: '#/components/schemas/BasicScheduleFieldInfo'
- $ref: '#/components/schemas/AdvancedScheduleInfo'
responses:
200:
description: operation successfull
@ -1371,7 +1373,10 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/BasicScheduleFieldInfo'
oneOf:
- $ref: '#/components/schemas/BasicScheduleFieldInfo'
- $ref: '#/components/schemas/AdvancedScheduleInfo'
responses:
200:
description: operation successfull
@ -2347,4 +2352,30 @@ components:
type: string
format: date
description: time the schedule was stopped
AdvancedScheduleInfo:
allOf:
- $ref: '#/components/schemas/ScheduleInfo'
- type: object
required:
- scheduleStartTime
- scheduleStopTime
additionalProperties: false
properties:
scheduleStartTime:
type: string
format: date
scheduleStopTime:
type: string
format: date
AdvancedScheduleFieldInfo:
required:
- scheduleStartTime
- scheduleStopTime
additionalProperties: false
properties:
scheduleStartTime:
type: string
format: date
scheduleStopTime:
type: string
format: date