From 6de5c9e7fa435f4ec6d16b2a1fb69e54a913d8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 12 Aug 2022 10:30:27 -0700 Subject: [PATCH] Web: add worker removal Add "remove worker" button to the worker details panel. It will show a little warning when the worker is still running, and also has an explanation of what removing a worker actually means. --- web/app/src/assets/base.css | 2 ++ .../src/components/workers/WorkerDetails.vue | 28 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/web/app/src/assets/base.css b/web/app/src/assets/base.css index 14d37ce4..ba143c45 100644 --- a/web/app/src/assets/base.css +++ b/web/app/src/assets/base.css @@ -371,6 +371,8 @@ input[type="text"].is-invalid { .input-help-text { display: inline-block; +} +.input-help-text, .hint { color: var(--color-text-muted); font-size: var(--font-size-sm); margin: var(--spacer-xs); diff --git a/web/app/src/components/workers/WorkerDetails.vue b/web/app/src/components/workers/WorkerDetails.vue index ec692887..c9f9d240 100644 --- a/web/app/src/components/workers/WorkerDetails.vue +++ b/web/app/src/components/workers/WorkerDetails.vue @@ -34,7 +34,7 @@ -
+

@@ -95,6 +95,22 @@

+ +
+

Maintenance

+

{{ workerData.name }} is {{ workerData.status }}, which means + + +

+

+

+ When a Worker is removed from the system, any active task still assigned + to it will be requeued. Restarting the Worker after removing it from the + system will simply register it anew. +

+
@@ -204,6 +220,16 @@ export default { defaultWorkerSleepSchedule() { return new WorkerSleepSchedule(false, '', '', '') // Default values in OpenAPI }, + deleteWorker() { + let msg = `Are you sure you want to remove ${this.workerData.name}?`; + if (this.workerData.status != "offline") { + msg += "\nRemoving it without first shutting it down will cause it to log errors."; + } + if (!confirm(msg)) { + return; + } + this.api.deleteWorker(this.workerData.id); + }, } };