Skip to content

Commit

Permalink
Add mass action count to confirmation message (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmenozzi committed Sep 21, 2020
1 parent 35c2c2e commit 0f2a89a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Console/Controller/FlowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __invoke(Request $request, string $flowCode): Promise
$query = $queryParams['query'] ?? '';
$page = (int)($queryParams['page'] ?? '1');
$massActionSuccess = $queryParams['massActionSuccess'] ?? false;
$massActionCount = $queryParams['massActionCount'] ?? 0;
$adapter = new AmpElasticsearchUriSearchAdapter(
$this->getElasticsearch()->getClient(),
$flowCode,
Expand All @@ -45,7 +46,8 @@ public function __invoke(Request $request, string $flowCode): Promise
'flowCode' => $flowCode,
'pager' => $pager,
'query' => $query,
'massActionSuccess' => $massActionSuccess
'massActionSuccess' => $massActionSuccess,
'massActionCount' => $massActionCount
]
)
);
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Controller/MassActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public function __invoke(Request $request, string $flow): Promise
if ($action === self::ACTION_REQUEUE) {
yield from $this->requeue($jobs, $flow);
}
$jobsCount = count($jobs);

return new Response(302, ['Location' => ["/flow/$flow?massActionSuccess=$action"]]);
return new Response(302, ['Location' => ["/flow/$flow?massActionSuccess=$action&massActionCount=$jobsCount"]]);
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/Console/Resources/views/flow.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

{% if massActionSuccess == 'requeue' %}
<div class="alert alert-success" role="alert">
Selected jobs has been successfully re-queued!
{% if massActionCount is not defined %}
Selected jobs has been successfully re-queued!
{% else %}
{{ massActionCount }} selected job(s) has been successfully re-queued!
{% endif %}
</div>
{% endif %}

Expand Down

0 comments on commit 0f2a89a

Please sign in to comment.