From e0f27db88c2126a44e966bc17849c9c829a82665 Mon Sep 17 00:00:00 2001 From: Casey Stone Date: Wed, 21 Aug 2024 17:16:34 -0500 Subject: [PATCH] pause resume workcell button, not tested on modules with no pause admin action --- src/ui/components.d.ts | 1 + src/ui/src/components/Dashboard.vue | 8 +- src/ui/src/components/ModuleModal.vue | 4 +- .../components/PauseResumeWorkcellButton.vue | 89 +++++++++++++++++++ src/wei/modules/rest_module.py | 4 +- 5 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 src/ui/src/components/PauseResumeWorkcellButton.vue diff --git a/src/ui/components.d.ts b/src/ui/components.d.ts index 46d2a76c..146f83aa 100644 --- a/src/ui/components.d.ts +++ b/src/ui/components.d.ts @@ -14,6 +14,7 @@ declare module 'vue' { ModulesPanel: typeof import('./src/components/ModulesPanel.vue')['default'] ModuleModal: typeof import('./src/components/ModuleModal.vue')['default'] PauseResumeModuleButton: typeof import('./src/components/PauseResumeModuleButton.vue')['default'] + PauseResumeWorkcellButton: typeof import('./src/components/PauseResumeWorkcellButton.vue')['default'] Workflow: typeof import('./src/components/Workflow.vue')['default'] WorkflowModal: typeof import('./src/components/WorkflowModal.vue')['default'] WorkflowsPanel: typeof import('./src/components/WorkflowsPanel.vue')['default'] diff --git a/src/ui/src/components/Dashboard.vue b/src/ui/src/components/Dashboard.vue index da0e1377..e6a547ac 100644 --- a/src/ui/src/components/Dashboard.vue +++ b/src/ui/src/components/Dashboard.vue @@ -18,9 +18,10 @@ - -

{{ wc_info.name }}

-
+ +

{{ wc_info.name }}

+ +
@@ -92,6 +93,7 @@ import { ref, watchEffect } from 'vue'; import VueJsonPretty from 'vue-json-pretty'; import 'vue-json-pretty/lib/styles.css'; +import PauseResumeWorkcellButton from './PauseResumeWorkcellButton.vue'; const main_url = ref() const state_url = ref() const workcell_info_url = ref() diff --git a/src/ui/src/components/ModuleModal.vue b/src/ui/src/components/ModuleModal.vue index e921211f..7dd44749 100644 --- a/src/ui/src/components/ModuleModal.vue +++ b/src/ui/src/components/ModuleModal.vue @@ -10,7 +10,7 @@ - + @@ -96,7 +96,7 @@ + + \ No newline at end of file diff --git a/src/wei/modules/rest_module.py b/src/wei/modules/rest_module.py index 8c920f28..7670e9ea 100644 --- a/src/wei/modules/rest_module.py +++ b/src/wei/modules/rest_module.py @@ -502,7 +502,9 @@ async def safety_stop(request: Request): @self.router.post("/admin/pause") async def pause(request: Request): + state = request.app.state + state.pre_paused_status = state.status state.status = ModuleStatus.PAUSED if self._pause: return self._pause(state) @@ -512,7 +514,7 @@ async def pause(request: Request): @self.router.post("/admin/resume") async def resume(request: Request): state = request.app.state - state.status = ModuleStatus.BUSY # TODO: Is there a better way to do this? NOTE: If I don't put this there, it resumes with status PAUSED + state.status = state.pre_paused_status if self._resume: return self._resume(state) else: