@@ -34,7 +31,7 @@
To be done sometime today
-
+
diff --git a/frontend/src/app/dashboard/dashboard.component.ts b/frontend/src/app/dashboard/dashboard.component.ts
index 3442273..c0ffd44 100644
--- a/frontend/src/app/dashboard/dashboard.component.ts
+++ b/frontend/src/app/dashboard/dashboard.component.ts
@@ -1,5 +1,6 @@
-import {Component, OnInit} from '@angular/core';
+import {Component, OnInit, ViewChild} from '@angular/core';
import {ScheduleInfo, ScheduleService} from "../../api";
+import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component";
@Component({
selector: 'app-dashboard',
@@ -9,9 +10,9 @@ import {ScheduleInfo, ScheduleService} from "../../api";
export class DashboardComponent implements OnInit{
missedSchedules: boolean = true
- taskRunning: boolean = false
schedules: ScheduleInfo[] = []
+ @ViewChild('activeSchedule') activeScheduleComponent: ActiveScheduleComponent | undefined
constructor(private scheduleService: ScheduleService) {
}
@@ -21,5 +22,20 @@ export class DashboardComponent implements OnInit{
this.schedules = resp;
}
})
+
+
}
+
+ startSchedule(schedule: ScheduleInfo) {
+ this.scheduleService.schedulesScheduleIDActivatePost(schedule.scheduleID).subscribe({
+ next: resp => {
+ schedule.startTime = resp.startTime;
+ if(this.activeScheduleComponent != undefined) {
+ this.activeScheduleComponent.activeSchedule = schedule;
+ }
+ }
+ })
+ }
+
+
}
diff --git a/openapi.yaml b/openapi.yaml
index b72835b..00fd525 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -1417,6 +1417,73 @@ paths:
schema:
type: object
$ref: "#/components/schemas/SimpleStatusResponse"
+ /schedules/active:
+ get:
+ security:
+ - API_TOKEN: []
+ tags:
+ - schedule
+ description: get active schedule
+ summary: get active schedule
+ responses:
+ 200:
+ description: operation successfull
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ScheduleInfo'
+ 404:
+ description: there is no active schedule
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SimpleStatusResponse'
+ /schedules/{scheduleID}/activate:
+ post:
+ security:
+ - API_TOKEN: []
+ tags:
+ - schedule
+ description: activates schedule
+ summary: activates schedule
+ parameters:
+ - name: scheduleID
+ in: path
+ description: internal id of schedule
+ required: true
+ schema:
+ type: number
+ example: 1
+ responses:
+ 200:
+ description: Operation successfull
+ content:
+ application/json:
+ schema:
+ type: object
+ $ref: '#/components/schemas/ScheduleActivateInfo'
+ 403:
+ description: No permission
+ content:
+ 'application/json':
+ schema:
+ type: object
+ $ref: "#/components/schemas/SimpleStatusResponse"
+ 404:
+ description: Schedule does not exist
+ content:
+ 'application/json':
+ schema:
+ type: object
+ $ref: "#/components/schemas/SimpleStatusResponse"
+ 409:
+ description: Task is already running
+ content:
+ 'application/json':
+ schema:
+ type: object
+ $ref: "#/components/schemas/SimpleStatusResponse"
+
components:
@@ -1833,4 +1900,13 @@ components:
taskName:
type: string
description: name of task
- example: "Vorlesung zusammenfassen"
\ No newline at end of file
+ example: "Vorlesung zusammenfassen"
+ ScheduleActivateInfo:
+ required:
+ - startTime
+ additionalProperties: false
+ properties:
+ startTime:
+ type: string
+ format: date-time
+ description: point in time at which the schedule was started
\ No newline at end of file