Skip to content

Commit b103677

Browse files
#13 ability to add modal confirmation or nothing instead of launch from of process run ui. Rework options names
1 parent dd2e099 commit b103677

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

docs/index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ Now you can access UI Process via http://your-domain.com/process
3535

3636
### Launch process via UI
3737
From UI "Process List" menu entry you can run a process by clicking on "Rocket" action.
38-
You can manage this behaviour by setting some ui options on process configuration ui option.
38+
You can manage this behaviour by setting some ui option `ui_launch_mode`
3939

40-
| Options | Values | UI behaviour |
41-
|----------------------------------|----------------|:---------:|
42-
| input_context_launcher_form<br>run_confirmation_modal | false<br>false | Run process without any confirmation
43-
| input_context_launcher_form<br>run_confirmation_modal | true<br>false | On click, open a form to set input and context execution
44-
| input_context_launcher_form<br>run_confirmation_modal | false<br>true | On click, open confirmation model to confirm process execution
40+
| Value | UI behaviour |
41+
|:---------------:|:--------------------------------------------------------------:|
42+
| modal (default) | On click, open confirmation modal to confirm process execution |
43+
| form | On click, open a form to set input and context execution |
44+
| null | Run process without any confirmation |
4545

4646
### Launch process via http request
4747
You can launch a process via http post request

src/Controller/Admin/Process/LaunchAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __invoke(
5858
if (null === $uiOptions) {
5959
throw new \InvalidArgumentException('Missing UI Options');
6060
}
61-
if (false === $uiOptions['input_context_launcher_form']) {
61+
if (null === $uiOptions['ui_launch_mode'] || 'modal' === $uiOptions['ui_launch_mode']) {
6262
$this->dispatch($processCode);
6363
$this->addFlash(
6464
'success',

src/Manager/ProcessConfigurationsManager.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @phpstan-type UiOptions array{
2525
* 'source': ?string,
2626
* 'target': ?string,
27-
* 'input_context_launcher_form': bool,
27+
* 'ui_launch_mode': ?string,
2828
* 'run_confirmation_modal': bool,
2929
* 'entrypoint_type': string,
3030
* 'constraints': Constraint[],
@@ -78,8 +78,7 @@ private function resolveUiOptions(array $options): array
7878
'source' => null,
7979
'target' => null,
8080
'entrypoint_type' => 'text',
81-
'input_context_launcher_form' => false,
82-
'run_confirmation_modal' => false,
81+
'ui_launch_mode' => 'modal',
8382
'constraints' => [],
8483
'run' => null,
8584
'default' => function (OptionsResolver $defaultResolver) {
@@ -99,8 +98,7 @@ private function resolveUiOptions(array $options): array
9998
);
10099
$uiResolver->setAllowedValues('entrypoint_type', ['text', 'file']);
101100
$uiResolver->setNormalizer('constraints', fn (Options $options, array $values): array => (new ConstraintLoader())->buildConstraints($values));
102-
$uiResolver->setAllowedTypes('input_context_launcher_form', ['bool']);
103-
$uiResolver->setAllowedTypes('run_confirmation_modal', ['bool']);
101+
$uiResolver->setAllowedValues('ui_launch_mode', ['modal', null, 'form']);
104102
});
105103
/**
106104
* @var array{'ui': UiOptions} $options

templates/admin/field/report.html.twig

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
33
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
44
<ul>
5-
{% for key, item in field.value %}
6-
<li class="list-group-item"><span class="badge badge-{{ log_css_class(key) }}">{{ key }}</span> : {{ item }}</li>
7-
{% endfor %}
5+
{{ field.value }}
86
</ul>

templates/admin/process/list.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<td>{% if process.options.ui.source is defined %}{{ process.options.ui.source }}{% endif %}</td>
3434
<td>{% if process.options.ui.target is defined %}{{ process.options.ui.target }}{% endif %}</td>
3535
<td class="text-center">
36-
{% if (false == uiOptions.input_context_launcher_form and true == uiOptions.run_confirmation_modal) %}
36+
{% if ("modal" == uiOptions.ui_launch_mode) %}
3737
<a class="px-1" data-toggle="tooltip" data-placement="top" title="{{ 'Launch'|trans }}" data-bs-toggle="modal" data-bs-target="#{{ process.code }}">
3838
<i class="fas fa-rocket"></i>
3939
</a>

0 commit comments

Comments
 (0)