issue-25 #27

Merged
sebastian merged 32 commits from issue-25 into issue-18 2023-10-28 19:33:06 +02:00
8 changed files with 47 additions and 15 deletions
Showing only changes of commit 2fb3555c04 - Show all commits

View File

@ -5,9 +5,7 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove update spamming in console"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove update spamming in console">
<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/api/models/timemanager/taskgroup/RecursiveTaskgroupInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/RecursiveTaskgroupInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" 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" />
@ -104,6 +102,7 @@
<workItem from="1698298897364" duration="4242000" /> <workItem from="1698298897364" duration="4242000" />
<workItem from="1698426430946" duration="665000" /> <workItem from="1698426430946" duration="665000" />
<workItem from="1698474363766" duration="3686000" /> <workItem from="1698474363766" duration="3686000" />
<workItem from="1698499063683" duration="646000" />
</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

@ -134,7 +134,7 @@ public class ScheduleController {
if(scheduleResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) { if(scheduleResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
return ResponseEntity.status(409).body(new SimpleStatusResponse("failed")); return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
} else { } else {
return ResponseEntity.ok(new BasicTaskScheduleEntityInfo(scheduleResult.getResult())); return ResponseEntity.ok(new ScheduleInfo(scheduleResult.getResult()));
} }
} }

View File

@ -532,9 +532,9 @@ export class ScheduleService {
* @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 schedulesTaskIDNowPost(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<BasicScheduleEntityInfo>; public schedulesTaskIDNowPost(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
public schedulesTaskIDNowPost(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<BasicScheduleEntityInfo>>; public schedulesTaskIDNowPost(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
public schedulesTaskIDNowPost(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<BasicScheduleEntityInfo>>; public schedulesTaskIDNowPost(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
public schedulesTaskIDNowPost(taskID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { public schedulesTaskIDNowPost(taskID: number, 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 schedulesTaskIDNowPost.'); throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDNowPost.');
@ -572,7 +572,7 @@ export class ScheduleService {
responseType_ = 'text'; responseType_ = 'text';
} }
return this.httpClient.post<BasicScheduleEntityInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/now`, return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/now`,
null, null,
{ {
context: localVarHttpContext, context: localVarHttpContext,

View File

@ -39,7 +39,7 @@
</div> </div>
<div class="taskgroup-overview"> <div class="taskgroup-overview">
<app-task-overview [tasks]="tasks"></app-task-overview> <app-task-overview [tasks]="tasks" (onStartNow)="onStartTaskNow($event)"></app-task-overview>
</div> </div>
<div class="taskgroup-overview"> <div class="taskgroup-overview">

View File

@ -1,5 +1,5 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {ScheduleInfo, ScheduleService, TaskOverviewInfo} from "../../api"; import {BasicScheduleEntityInfo, ScheduleInfo, ScheduleService, TaskOverviewInfo} from "../../api";
import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component"; import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component";
import {StopActiveScheduleInfo} from "./active-schedule/StopActiveScheduleInfo"; import {StopActiveScheduleInfo} from "./active-schedule/StopActiveScheduleInfo";
import {TaskOverviewComponent} from "./task-overview/task-overview.component"; import {TaskOverviewComponent} from "./task-overview/task-overview.component";
@ -52,4 +52,8 @@ export class DashboardComponent implements OnInit{
onSelectTaskgroup(tasks: TaskOverviewInfo[]) { onSelectTaskgroup(tasks: TaskOverviewInfo[]) {
this.tasks = tasks; this.tasks = tasks;
} }
onStartTaskNow(schedule: ScheduleInfo) {
this.activeScheduleComponent?.activateSchedule(schedule)
}
} }

View File

@ -7,7 +7,7 @@
<p class="task-info"><i>Limit: </i>{{task.limit}}</p> <p class="task-info"><i>Limit: </i>{{task.limit}}</p>
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button mat-raised-button color="primary" class="btn-without-radius">Start now</button> <button mat-raised-button color="primary" class="btn-without-radius" (click)="startTaskNow(task)">Start now</button>
<button mat-raised-button class="yellowBtn btn-without-radius">Schedule</button> <button mat-raised-button class="yellowBtn btn-without-radius">Schedule</button>
<button mat-raised-button class="greenBtn btn-without-radius">Finish</button> <button mat-raised-button class="greenBtn btn-without-radius">Finish</button>
</mat-card-actions> </mat-card-actions>

View File

@ -1,5 +1,6 @@
import {Component, Input} from '@angular/core'; import {Component, EventEmitter, Input, Output} from '@angular/core';
import {TaskOverviewInfo} from "../../../api"; import {BasicScheduleEntityInfo, ScheduleInfo, ScheduleService, TaskOverviewInfo} from "../../../api";
import {MatSnackBar} from "@angular/material/snack-bar";
@Component({ @Component({
selector: 'app-task-overview', selector: 'app-task-overview',
@ -9,4 +10,32 @@ import {TaskOverviewInfo} from "../../../api";
export class TaskOverviewComponent { export class TaskOverviewComponent {
@Input() tasks: TaskOverviewInfo[] = [] @Input() tasks: TaskOverviewInfo[] = []
@Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>();
constructor(private scheduleService: ScheduleService,
private snackbar: MatSnackBar) {
} }
startTaskNow(task: TaskOverviewInfo) {
this.scheduleService.schedulesTaskIDNowPost(task.taskID).subscribe({
next: resp => {
this.startNowEmitter.emit(resp);
},
error: err => {
if(err.status == 403) {
this.snackbar.open("No permission", "", {duration: 2000});
} else if(err.status == 404) {
this.snackbar.open("Task not found", "", {duration: 2000});
} else if(err.status == 409) {
this.snackbar.open("Task is already running", "", {duration: 2000});
} else {
this.snackbar.open("Unexpected error", "", {duration: 2000});
}
}
})
}
finishTask(task: TaskOverviewInfo) {
}
}

View File

@ -1421,7 +1421,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: