-
-
-
-
-
-
+
+
+
+ Sleep Schedule
+
+
-
+
+
Time of the day (and on which days) this worker should go to sleep.
-
-
- Adjust at which time of the day (and on which days) this worker should go to sleep.
-
-
@@ -86,13 +69,18 @@
Use 24-hour format.
+
+
+
+
+
+
- Status
-
- enabled
- disabled
+ {{ workerSleepScheduleStatusLabel }}
- Days of Week
-
@@ -123,6 +111,7 @@ import { WorkerMgtApi, WorkerSleepSchedule } from '@/manager-api';
import { apiClient } from '@/stores/api-query-count';
import { workerStatus } from "../../statusindicator";
import LinkWorkerTask from '@/components/LinkWorkerTask.vue';
+import SwitchCheckbox from '@/components/SwitchCheckbox.vue';
export default {
props: [
@@ -130,6 +119,7 @@ export default {
],
components: {
LinkWorkerTask,
+ SwitchCheckbox,
},
data() {
return {
@@ -172,6 +162,9 @@ export default {
'end_time': this.workerSleepSchedule.end_time === '' ? '24:00' : this.workerSleepSchedule.end_time,
}
},
+ workerSleepScheduleStatusLabel() {
+ return this.workerSleepSchedule.is_active ? 'Enabled' : 'Disabled';
+ },
},
methods: {
fetchWorkerSleepSchedule() {
@@ -195,7 +188,8 @@ export default {
this.notifs.add(notifMessage));
},
toggleWorkerSleepSchedule() {
- let verb = this.workerSleepSchedule.is_active ? 'Enabled' : 'Disabled';
+ this.workerSleepSchedule.is_active = !this.workerSleepSchedule.is_active;
+ let verb = this.workerSleepScheduleStatusLabel;
this.setWorkerSleepSchedule(`${verb} schedule for worker ${this.workerData.name}`);
},
saveWorkerSleepSchedule() {
@@ -214,6 +208,21 @@ export default {