Skip to content

Commit

Permalink
chore: Make graph visible in GUI, and show a proper error message
Browse files Browse the repository at this point in the history
Related to issue #65
  • Loading branch information
Joris Ros committed Jan 12, 2022
1 parent 7ed82ee commit f57d416
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 4 deletions.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/WorkflowGui/Controller/WorkflowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/WorkflowGui/Resources/public/js/pimcore/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down
2 changes: 2 additions & 0 deletions src/WorkflowGui/Resources/translations/admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'

0 comments on commit f57d416

Please sign in to comment.