Skip to content

Commit

Permalink
Merge pull request #66 from jorisros/fix/65
Browse files Browse the repository at this point in the history
chore: Make graph visible in GUI, and show a proper error message
  • Loading branch information
jorisros authored Jan 12, 2022
2 parents 993a67e + f57d416 commit dd74727
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 0 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 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: 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 dd74727

Please sign in to comment.