schedule-refactor #45

Merged
sebastian merged 18 commits from schedule-refactor into master 2023-11-11 18:56:16 +01:00
13 changed files with 224 additions and 133 deletions
Showing only changes of commit dadb1204e8 - Show all commits

View File

@ -16,6 +16,8 @@ index.ts
model/accountDeleteRequest.ts model/accountDeleteRequest.ts
model/basicScheduleEntityInfo.ts model/basicScheduleEntityInfo.ts
model/basicScheduleFieldInfo.ts model/basicScheduleFieldInfo.ts
model/basicScheduleInfo.ts
model/basicScheduleInfoAllOf.ts
model/eMailChangeRequest.ts model/eMailChangeRequest.ts
model/forgottenActivityRequest.ts model/forgottenActivityRequest.ts
model/inlineResponse200.ts model/inlineResponse200.ts

View File

@ -18,7 +18,6 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder'; import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { BasicScheduleEntityInfo } from '../model/models';
import { BasicScheduleFieldInfo } from '../model/models'; import { BasicScheduleFieldInfo } from '../model/models';
import { ForgottenActivityRequest } from '../model/models'; import { ForgottenActivityRequest } from '../model/models';
import { ScheduleActivateInfo } from '../model/models'; import { ScheduleActivateInfo } from '../model/models';
@ -626,76 +625,6 @@ export class ScheduleService {
); );
} }
/**
* 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<BasicScheduleEntityInfo>;
public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<BasicScheduleEntityInfo>>;
public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<BasicScheduleEntityInfo>>;
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<BasicScheduleEntityInfo>(`${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
* Registers forgotten schedule * Registers forgotten schedule
@ -766,6 +695,65 @@ export class ScheduleService {
); );
} }
/**
* gets schedules of task
* gets schedules of task
* @param taskID internal id of task
* @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 schedulesTaskIDGet(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
public schedulesTaskIDGet(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
public schedulesTaskIDGet(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
public schedulesTaskIDGet(taskID: number, 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 schedulesTaskIDGet.');
}
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<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
}
/** /**
* schedule task now * schedule task now
* schedule task now * schedule task now
@ -827,22 +815,19 @@ export class ScheduleService {
} }
/** /**
* gets schedules of task * creates basic schedule for task
* gets schedules of task * creates a basic schedule for a task
* @param taskID internal id of task * @param taskID internal id of task
* @param scheduleType 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 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. * @param reportProgress flag to report request and response progress.
*/ */
public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<BasicScheduleEntityInfo>>; public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<BasicScheduleEntityInfo>>>; public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<BasicScheduleEntityInfo>>>; public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskID === null || taskID === undefined) { if (taskID === null || taskID === undefined) {
throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDScheduleTypeGet.'); throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDPut.');
}
if (scheduleType === null || scheduleType === undefined) {
throw new Error('Required parameter scheduleType was null or undefined when calling schedulesTaskIDScheduleTypeGet.');
} }
let localVarHeaders = this.defaultHeaders; let localVarHeaders = this.defaultHeaders;
@ -872,12 +857,22 @@ export class ScheduleService {
} }
// 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'; let responseType_: 'text' | 'json' = 'json';
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) { if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text'; responseType_ = 'text';
} }
return this.httpClient.get<Array<BasicScheduleEntityInfo>>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/${encodeURIComponent(String(scheduleType))}`, return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}`,
basicScheduleFieldInfo,
{ {
context: localVarHttpContext, context: localVarHttpContext,
responseType: <any>responseType_, responseType: <any>responseType_,

View File

@ -0,0 +1,52 @@
/**
* 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 { BasicScheduleInfoAllOf } from './basicScheduleInfoAllOf';
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
import { TaskShortInfo } from './taskShortInfo';
import { ScheduleInfo } from './scheduleInfo';
export interface BasicScheduleInfo {
/**
* internal id of schedule
*/
scheduleID: number;
/**
* type of schedule
*/
scheduleType: BasicScheduleInfo.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>;
scheduleDate: string;
}
export namespace BasicScheduleInfo {
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,17 @@
/**
* 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 BasicScheduleInfoAllOf {
scheduleDate: string;
}

View File

@ -1,6 +1,8 @@
export * from './accountDeleteRequest'; export * from './accountDeleteRequest';
export * from './basicScheduleEntityInfo'; export * from './basicScheduleEntityInfo';
export * from './basicScheduleFieldInfo'; export * from './basicScheduleFieldInfo';
export * from './basicScheduleInfo';
export * from './basicScheduleInfoAllOf';
export * from './eMailChangeRequest'; export * from './eMailChangeRequest';
export * from './forgottenActivityRequest'; export * from './forgottenActivityRequest';
export * from './inlineResponse200'; export * from './inlineResponse200';

View File

@ -9,7 +9,6 @@
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import { BasicScheduleFieldInfo } from './basicScheduleFieldInfo';
import { TaskgroupEntityInfo } from './taskgroupEntityInfo'; import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
import { TaskShortInfo } from './taskShortInfo'; import { TaskShortInfo } from './taskShortInfo';
@ -35,7 +34,6 @@ export interface ScheduleInfo {
* number in minutes that the schedule was active * number in minutes that the schedule was active
*/ */
activeMinutes: number; activeMinutes: number;
schedule: BasicScheduleFieldInfo;
task: TaskShortInfo; task: TaskShortInfo;
taskgroupPath: Array<TaskgroupEntityInfo>; taskgroupPath: Array<TaskgroupEntityInfo>;
} }

View File

@ -13,7 +13,7 @@
<mat-progress-bar mode="determinate" [value]="schedule.activeMinutes"></mat-progress-bar> <mat-progress-bar mode="determinate" [value]="schedule.activeMinutes"></mat-progress-bar>
<div class="originally-planned-container"> <div class="originally-planned-container">
<div style="width: 100%"> <div style="width: 100%">
<p style="display: inline-block"><i>Originally planned:</i> {{schedule.schedule.scheduleDate}}</p> <p style="display: inline-block"><i>Originally planned:</i> {{toBasicSchedule(schedule).scheduleDate}}</p>
</div> </div>
<div style="width: 100%" class="reschedule-actions-container"> <div style="width: 100%" class="reschedule-actions-container">
<button mat-raised-button color="primary" class="rescheduleBtn" <button mat-raised-button color="primary" class="rescheduleBtn"

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ScheduleInfo, ScheduleService} from "../../api"; import {BasicScheduleInfo, ScheduleInfo, ScheduleService} from "../../api";
import {NavigationLink} from "../navigation-link-list/navigation-link-list.component"; import {NavigationLink} from "../navigation-link-list/navigation-link-list.component";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
import {MatDialog} from "@angular/material/dialog"; import {MatDialog} from "@angular/material/dialog";
@ -63,4 +63,8 @@ export class MissedSchedulesComponent implements OnInit{
} }
}) })
} }
toBasicSchedule(schedule: ScheduleInfo) {
return schedule as BasicScheduleInfo
}
} }

View File

@ -1,6 +1,12 @@
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
import {FormControl, Validators} from "@angular/forms"; import {FormControl, Validators} from "@angular/forms";
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api"; import {
BasicScheduleEntityInfo,
BasicScheduleInfo,
ScheduleService,
TaskEntityInfo,
TaskgroupEntityInfo
} from "../../../api";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
import {Router} from "@angular/router"; import {Router} from "@angular/router";
@ -29,11 +35,11 @@ export class BasicSchedulerComponent implements OnChanges{
schedule() { schedule() {
if(this.task != undefined) { if(this.task != undefined) {
if(this.scheduleEntityInfo == undefined) { if(this.scheduleEntityInfo == undefined) {
this.scheduleService.schedulesTaskIDBasicPut(this.task.taskID, { this.scheduleService.schedulesTaskIDPut(this.task.taskID, {
scheduleDate: this.dateCtrl.value scheduleDate: this.dateCtrl.value
}).subscribe({ }).subscribe({
next: resp => { next: resp => {
this.scheduleEmitter.emit(resp); this.scheduleEmitter.emit(resp as BasicScheduleInfo);
} }
}) })
} else { } else {

View File

@ -1,12 +1,16 @@
<mat-card *ngFor="let schedule of schedules" class="scheduleContainer"> <mat-card *ngFor="let schedule of schedules" class="scheduleContainer">
<mat-card-content> <mat-card-content>
<div class="basicScheduleContainer"> <ng-container *ngIf="schedule.scheduleType == 'BASIC'">
<p class="basicScheduleContent">{{schedule.scheduleDate | date:'EEEE, d MMM. y'}}</p> <div class="basicScheduleContainer">
<div class="basicScheduleContent"> <p class="basicScheduleContent">{{ toBasicSchedule(schedule).scheduleDate | date:'EEEE, d MMM. y'}}</p>
<button mat-icon-button color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule', schedule.scheduleID]"><mat-icon>edit</mat-icon></button> <div class="basicScheduleContent">
<button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button> <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>
</div>
</ng-container>

View File

@ -1,5 +1,11 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api"; import {
BasicScheduleEntityInfo, BasicScheduleInfo,
ScheduleInfo,
ScheduleService,
TaskEntityInfo,
TaskgroupEntityInfo
} from "../../../api";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
@Component({ @Component({
@ -12,7 +18,7 @@ export class ScheduleDashboardComponent implements OnInit{
@Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined @Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined
@Input('task') task: TaskEntityInfo | undefined @Input('task') task: TaskEntityInfo | undefined
schedules: BasicScheduleEntityInfo[] = [] schedules: ScheduleInfo[] = []
constructor(private scheduleService: ScheduleService, constructor(private scheduleService: ScheduleService,
private snackbar: MatSnackBar) { private snackbar: MatSnackBar) {
@ -20,7 +26,7 @@ export class ScheduleDashboardComponent implements OnInit{
} }
ngOnInit() { ngOnInit() {
this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({ this.scheduleService.schedulesTaskIDGet(this.task!.taskID).subscribe({
next: resp => { next: resp => {
this.schedules = resp; this.schedules = resp;
} }
@ -31,7 +37,7 @@ export class ScheduleDashboardComponent implements OnInit{
//todo //todo
} }
deleteSchedule(deletedSchedule: BasicScheduleEntityInfo) { deleteSchedule(deletedSchedule: ScheduleInfo) {
this.scheduleService.schedulesScheduleIDScheduleTypeDelete(deletedSchedule.scheduleID, 'BASIC').subscribe({ this.scheduleService.schedulesScheduleIDScheduleTypeDelete(deletedSchedule.scheduleID, 'BASIC').subscribe({
next: resp => { next: resp => {
this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID); this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
@ -47,4 +53,8 @@ export class ScheduleDashboardComponent implements OnInit{
} }
}) })
} }
toBasicSchedule(schedule: ScheduleInfo) {
return schedule as BasicScheduleInfo
}
} }

View File

@ -1,7 +1,7 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component"; import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
import { import {
BasicScheduleEntityInfo, ScheduleService, BasicScheduleEntityInfo, BasicScheduleInfo, ScheduleService,
TaskEntityInfo, TaskEntityInfo,
TaskgroupEntityInfo, TaskgroupEntityInfo,
TaskgroupService, TaskgroupService,
@ -136,26 +136,33 @@ export class SchedulerComponent implements OnInit{
fetschSchedules() { fetschSchedules() {
this.scheduleService.schedulesGet().subscribe({ this.scheduleService.schedulesGet().subscribe({
next: resp => { next: resp => {
resp.forEach(schedule => { resp.forEach(abstractSchedule => {
let color: EventColor = colors['red'] if(abstractSchedule.scheduleType == 'BASIC') {
if(schedule.scheduleID === this.scheduleID) { this.handleFetchedBasicSchedule(abstractSchedule as BasicScheduleInfo)
color = colors['yellow']
} }
if(schedule.scheduleType === 'BASIC') {
this.events.push({
start: new Date(schedule.schedule.scheduleDate),
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color,
allDay: true,
})
}
}) })
this.refresh.next(); this.refresh.next();
} }
}) })
} }
handleFetchedBasicSchedule(schedule: BasicScheduleInfo) {
let color: EventColor = colors['red']
if(schedule.scheduleID === this.scheduleID) {
color = colors['yellow']
}
if(schedule.scheduleType === 'BASIC') {
this.events.push({
start: new Date(schedule.scheduleDate),
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: color,
allDay: true,
})
}
}
eventClicked({ event }: { event: CalendarEvent }): void { eventClicked({ event }: { event: CalendarEvent }): void {
this.router.navigateByUrl("/taskgroups/" + this.taskgroupID.toString() + "/tasks/" + this.task!.taskID ) this.router.navigateByUrl("/taskgroups/" + this.taskgroupID.toString() + "/tasks/" + this.task!.taskID )
} }

View File

@ -1270,7 +1270,7 @@ paths:
items: items:
$ref: '#/components/schemas/ScheduleInfo' $ref: '#/components/schemas/ScheduleInfo'
/schedules/{taskID}/{scheduleType}: /schedules/{taskID}:
get: get:
security: security:
- API_TOKEN: [] - API_TOKEN: []
@ -1286,16 +1286,6 @@ paths:
schema: schema:
type: number type: number
example: 1 example: 1
- name: scheduleType
in: path
description: internal id of task
required: true
schema:
type: string
enum:
- BASIC
- MODERATE
- ADVANCED
responses: responses:
200: 200:
description: operation successfull description: operation successfull
@ -1304,7 +1294,7 @@ paths:
schema: schema:
type: array type: array
items: items:
$ref: '#/components/schemas/BasicScheduleEntityInfo' $ref: '#/components/schemas/ScheduleInfo'
403: 403:
description: No permission description: No permission
content: content:
@ -1319,7 +1309,6 @@ paths:
schema: schema:
type: object type: object
$ref: "#/components/schemas/SimpleStatusResponse" $ref: "#/components/schemas/SimpleStatusResponse"
/schedules/{taskID}/basic:
put: put:
security: security:
- API_TOKEN: [] - API_TOKEN: []
@ -1347,7 +1336,7 @@ paths:
application/json: application/json:
schema: schema:
type: object type: object
$ref: '#/components/schemas/BasicScheduleEntityInfo' $ref: '#/components/schemas/ScheduleInfo'
403: 403:
description: No permission description: No permission
content: content:
@ -2182,7 +2171,6 @@ components:
- startTime - startTime
- finishTime - finishTime
- activeMinutes - activeMinutes
- schedule
- task - task
- taskgroupPath - taskgroupPath
additionalProperties: false additionalProperties: false
@ -2211,10 +2199,6 @@ components:
type: number type: number
description: number in minutes that the schedule was active description: number in minutes that the schedule was active
example: 10 example: 10
schedule:
type: object
oneOf:
- $ref: '#/components/schemas/BasicScheduleFieldInfo'
task: task:
type: object type: object
$ref: '#/components/schemas/TaskShortInfo' $ref: '#/components/schemas/TaskShortInfo'
@ -2222,7 +2206,17 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/TaskgroupEntityInfo' $ref: '#/components/schemas/TaskgroupEntityInfo'
BasicScheduleInfo:
allOf:
- $ref: '#/components/schemas/ScheduleInfo'
- type: object
required:
- scheduleDate
additionalProperties: false
properties:
scheduleDate:
type: string
format: date
TaskShortInfo: TaskShortInfo:
required: required:
- taskID - taskID