From 3a0b6f634cdb1bf76ec4fdef8c57a6849ca55961 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 21 Oct 2022 12:55:02 -0400 Subject: [PATCH] Squashed 'spiffworkflow-frontend/' changes from b0000877..647a428c 647a428c Merge pull request #93 from sartography/test_arena_push 9d119258 Pause/resume process instances (#2) 0c4b7541 Merge commit '5adbec7e67d36fd582fc01da083e531ff0925b9e' 73a17f29 Merge commit '2a5690772af8fcd121b257dd0b0ba606c57be47a' 3ecfc4f3 Merge commit 'f930f96d1b389e239d05e865afe4db339cb49cbf' 0c9e869f Merge commit '75729ba3df3a8e1eccbae237d96efa7f17f72b26' 93891c60 Merge commit '8d86fe710d083e1d5b2f031ddcf3443b044785e3' e63af290 Merge commit 'a087961fab0d73cc54f9cae658e9eb50ab060f96' 1b737265 Merge commit '3cfc1bd3834a5ed8ec9d1aa91886ebf0a0c69053' 12b8b32f CI fixes e8451a3e Merge main, resolve conflicts 716bb3cb Updaging the jinja processing so it doesn't leave a bunch of blank lines in the markdown that has strong feelings about white space. Updating the front end to render markdown formatted instructions. And adding a little css love to tables that are generated in Markdown. git-subtree-dir: spiffworkflow-frontend git-subtree-split: 647a428c7eb93b2a0c501b64903e5fbfc59b87cc --- src/routes/HomePage.tsx | 8 +++++- src/routes/ProcessInstanceShow.tsx | 44 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/routes/HomePage.tsx b/src/routes/HomePage.tsx index 38393f2c..4d348ed2 100644 --- a/src/routes/HomePage.tsx +++ b/src/routes/HomePage.tsx @@ -62,8 +62,13 @@ export default function HomePage() { {rowToUse.title} {rowToUse.state} + {rowToUse.process_instance_status} - @@ -78,6 +83,7 @@ export default function HomePage() { Process Instance Task Name Status + Process Instance Status Actions diff --git a/src/routes/ProcessInstanceShow.tsx b/src/routes/ProcessInstanceShow.tsx index 32daf05c..72a43899 100644 --- a/src/routes/ProcessInstanceShow.tsx +++ b/src/routes/ProcessInstanceShow.tsx @@ -53,6 +53,22 @@ export default function ProcessInstanceShow() { }); }; + const suspendProcessInstance = () => { + HttpService.makeCallToBackend({ + path: `/process-models/${params.process_group_id}/${params.process_model_id}/process-instances/${params.process_instance_id}/suspend`, + successCallback: refreshPage, + httpMethod: 'POST', + }); + }; + + const resumeProcessInstance = () => { + HttpService.makeCallToBackend({ + path: `/process-models/${params.process_group_id}/${params.process_model_id}/process-instances/${params.process_instance_id}/resume`, + successCallback: refreshPage, + httpMethod: 'POST', + }); + }; + const getTaskIds = () => { const taskIds = { completed: [], readyOrWaiting: [] }; if (tasks) { @@ -126,6 +142,32 @@ export default function ProcessInstanceShow() { return
; }; + const suspendButton = (processInstanceToUse: any) => { + if ( + ['complete', 'terminated', 'faulted', 'suspended'].indexOf( + processInstanceToUse.status + ) === -1 + ) { + return ( + + ); + } + return
; + }; + + const resumeButton = (processInstanceToUse: any) => { + if (processInstanceToUse.status === 'suspended') { + return ( + + ); + } + return
; + }; + const handleClickedDiagramTask = (shapeElement: any) => { if (tasks) { const matchingTask = tasks.find( @@ -217,6 +259,8 @@ export default function ProcessInstanceShow() { buttonLabel="Delete" /> {terminateButton(processInstanceToUse)} + {suspendButton(processInstanceToUse)} + {resumeButton(processInstanceToUse)} {getInfoTag(processInstanceToUse)} {taskDataDisplayArea()}