From 191e1d95f1bd0466fde56a814ae067e3e891d7e8 Mon Sep 17 00:00:00 2001 From: Joris Ros Date: Wed, 12 Jan 2022 11:03:25 +0100 Subject: [PATCH] chore: Make graph visible in GUI, and show a proper error message Related to issue #65 --- README.md | 2 -- src/WorkflowGui/Controller/WorkflowController.php | 7 ++++++- src/WorkflowGui/Resources/translations/admin.en.yml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8a4f441..f4cd6b4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Pimcore - Workflow GUI -> I, Dominik ([@pfaffenbauer](https://github.com/dpfaffenbauer)), will stop maintaining this form now on and will continue to work on this fork [https://github.com/cors-gmbh/pimcore-workflow-gui](https://github.com/cors-gmbh/pimcore-workflow-gui) - ## Requirements - Pimcore 10.0.x diff --git a/src/WorkflowGui/Controller/WorkflowController.php b/src/WorkflowGui/Controller/WorkflowController.php index b418994..4993267 100644 --- a/src/WorkflowGui/Controller/WorkflowController.php +++ b/src/WorkflowGui/Controller/WorkflowController.php @@ -339,9 +339,14 @@ private function getVisualization($workflow, $format): string throw new \InvalidArgumentException($this->trans('workflow_cmd_not_found', ['dot'])); } + $workflowRepository = $this->repository->find($workflow); + + if ($workflowRepository && !$workflowRepository['enabled']) { + throw new \InvalidArgumentException($this->trans('workflow_gui_enable_message')); + } + $cmd = $php.' '.PIMCORE_PROJECT_ROOT.'/bin/console --env="${:arg_environment}" pimcore:workflow:dump "${:arg_workflow}" | '.$dot.' -T"${:arg_format}"'; - $cmd = Console::addLowProcessPriority($cmd); $process = Process::fromShellCommandline($cmd); $process->run(null, [ 'arg_environment' => $this->kernel->getEnvironment(), diff --git a/src/WorkflowGui/Resources/translations/admin.en.yml b/src/WorkflowGui/Resources/translations/admin.en.yml index 627b93a..e9c65be 100644 --- a/src/WorkflowGui/Resources/translations/admin.en.yml +++ b/src/WorkflowGui/Resources/translations/admin.en.yml @@ -114,3 +114,4 @@ workflow_gui: 'Workflow GUI' workflow_problem_creating_workflow_invalid_characters: 'Please use only these characters: "a-z", "A-Z" and "_"' workflow_gui_workflow_with_name_already_exists: 'Workflow with bane already exists' workflow_gui_clone: 'Clone' +workflow_gui_enable_message: 'Please enable and save the workflow to display graph visualization.'