diff --git a/README.md b/README.md index 8a4f441..e14506e 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 @@ -13,6 +11,53 @@ Workflow GUI adds a User Interface for configuring Pimcore Workflows. * Install via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:install WorkflowGuiBundle``` * Make sure that the Bundles generated config is loaded (config/config.yaml): ```../var/bundles/workflow-gui/workflow.yml``` +## Example workflow +Put the workflow below in the following location ``var/bundles/workflow-gui/workflow.yml`` and change the class ``Pimcore\Model\DataObject\Test`` to the dataobject you want to apply it to. +```yaml +pimcore: + workflows: + exampleWorkflow: + enabled: true + priority: 1 + label: 'Example workflow' + initial_markings: placeA + type: workflow + audit_trail: + enabled: true + marking_store: + type: state_table + support_strategy: + type: expression + arguments: + - Pimcore\Model\DataObject\Test + - is_fully_authenticated() + places: + placeA: + visibleInHeader: true + title: 'Place A' + label: 'Place A' + color: '#eb0058' + placeB: + title: 'Place B' + visibleInHeader: true + label: 'Place B' + color: '#00800f' + transitions: + placeAtoB: + from: + - placeA + to: + - placeB + options: + label: 'Place A to B' + changePublishedState: no_change + notes: + commentEnabled: false + additionalFields: { } + globalActions: { } + +``` + ## Configuration * Inside your project, go to settings -> Workflows diff --git a/src/WorkflowGui/Controller/WorkflowController.php b/src/WorkflowGui/Controller/WorkflowController.php index b418994..f6bddf9 100644 --- a/src/WorkflowGui/Controller/WorkflowController.php +++ b/src/WorkflowGui/Controller/WorkflowController.php @@ -339,9 +339,18 @@ private function getVisualization($workflow, $format): string throw new \InvalidArgumentException($this->trans('workflow_cmd_not_found', ['dot'])); } + $workflowRepository = $this->repository->find($workflow); + + if ($workflowRepository === null) { + throw new \InvalidArgumentException($this->trans('workflow_gui_not_found')); + } + + if (!$workflowRepository['enabled'] ?? false) { + 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/public/js/pimcore/startup.js b/src/WorkflowGui/Resources/public/js/pimcore/startup.js index 03f9e25..38df141 100644 --- a/src/WorkflowGui/Resources/public/js/pimcore/startup.js +++ b/src/WorkflowGui/Resources/public/js/pimcore/startup.js @@ -29,7 +29,7 @@ pimcore.plugin.WorkflowGuiBundle = Class.create(pimcore.plugin.admin, { if(user.isAllowed('workflow_gui') && perspectiveCfg.inToolbar('settings.workflow_gui')) { var settingsMenu = new Ext.Action({ text: t('workflows'), - iconCls: 'worklfow_gui_nav_icon_workflow', + icon: '/bundles/pimcoreadmin/img/flat-white-icons/workflow.svg', handler : this.showWorkflows }); diff --git a/src/WorkflowGui/Resources/translations/admin.en.yml b/src/WorkflowGui/Resources/translations/admin.en.yml index 627b93a..1bea5c9 100644 --- a/src/WorkflowGui/Resources/translations/admin.en.yml +++ b/src/WorkflowGui/Resources/translations/admin.en.yml @@ -114,3 +114,5 @@ 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.' +workflow_gui_not_found: 'Workflow can not be found.'