{{ value|json_encode(constant('JSON_PRETTY_PRINT')) }}
diff --git a/src/batch-symfony-framework/src/Resources/views/bootstrap4/_status.html.twig b/src/batch-symfony-framework/src/Resources/views/bootstrap4/_status.html.twig
new file mode 100644
index 00000000..f9b17122
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/bootstrap4/_status.html.twig
@@ -0,0 +1,14 @@
+{% trans_default_domain 'YokaiBatchBundle' %}
+
+{# @var execution \Yokai\Batch\JobExecution #}
+{% set classMap = {
+ (constant('PENDING', execution.status)): 'light',
+ (constant('RUNNING', execution.status)): 'warning',
+ (constant('STOPPED', execution.status)): 'info',
+ (constant('COMPLETED', execution.status)): 'success',
+ (constant('ABANDONED', execution.status)): 'info',
+ (constant('FAILED', execution.status)): 'danger',
+} %}
+
+ {{ ('job.status.'~execution.status|lower)|trans }}
+
diff --git a/src/batch-symfony-framework/src/Resources/views/bootstrap4/_traces.html.twig b/src/batch-symfony-framework/src/Resources/views/bootstrap4/_traces.html.twig
new file mode 100644
index 00000000..961cb1d6
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/bootstrap4/_traces.html.twig
@@ -0,0 +1 @@
+{{ value }}
diff --git a/src/batch-symfony-framework/src/Resources/views/bootstrap4/list.html.twig b/src/batch-symfony-framework/src/Resources/views/bootstrap4/list.html.twig
new file mode 100644
index 00000000..4bff1752
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/bootstrap4/list.html.twig
@@ -0,0 +1,154 @@
+{% extends base_template %}{# configured at yokai_batch.ui.templating.base_template #}
+
+{% trans_default_domain 'YokaiBatchBundle' %}
+
+{# @var execution \Yokai\Batch\JobExecution #}
+
+{% set parameters = app.request.query.all('filter') %}
+
+{% block title %}
+ {{ 'job.title.list'|trans }}
+{% endblock %}
+
+{% block breadcrumbs %}
+
+{% endblock %}
+
+{% block filter %}
+ {% if form is not null %}
+ {{ form_start(form) }}
+ {{ form_widget(form) }}
+
+ {{ form_end(form) }}
+ {% endif %}
+{% endblock %}
+
+{% block table %}
+ + {{ 'job.field.execution_id'|trans }} + | ++ {{ 'job.field.job_name'|trans }} + | ++ {{ 'job.field.status'|trans }} + | ++ + {{ 'job.field.start_time'|trans }} + + | ++ + {{ 'job.field.end_time'|trans }} + + | ++ |
---|---|---|---|---|---|
+ {% if yokai_batch_grant_view(execution) %} + + {{ execution.id }} + + {% else %} + {{ execution.id }} + {% endif %} + | ++ {% include '@YokaiBatch/bootstrap4/_job-name.html.twig' with { execution: execution } only %} + | ++ {% include '@YokaiBatch/bootstrap4/_status.html.twig' with { execution: execution } only %} + | ++ {% include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: execution.startTime} only %} + | ++ {% include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: execution.endTime} only %} + | +
+
+ {% if yokai_batch_grant_view(execution) %}
+
+
+ {{ 'job.action.view'|trans }}
+
+ {% endif %}
+ {% if yokai_batch_grant_logs(execution) %}
+
+
+ {{ 'job.action.download_logs'|trans }}
+
+ {% endif %}
+
+ |
+
{{ 'job.field.job_name'|trans }} | +{{ 'job.field.status'|trans }} | +{{ 'job.field.failures'|trans }} | +{{ 'job.field.warnings'|trans }} | +{{ 'job.field.start_time'|trans }} | +{{ 'job.field.end_time'|trans }} | ++ |
---|---|---|---|---|---|---|
+ {% include '@YokaiBatch/bootstrap4/_job-name.html.twig' with {execution: childExecution} only %} + | ++ {% include '@YokaiBatch/bootstrap4/_status.html.twig' with {execution: childExecution} only %} + | ++ {% if childExecution.failures|length > 0 %} + {{ childExecution.failures|length }} + {% else %} + 0 + {% endif %} + | ++ {% if childExecution.warnings|length > 0 %} + {{ childExecution.warnings|length }} + {% else %} + 0 + {% endif %} + | ++ {% include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: childExecution.startTime} only %} + | ++ {% include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: childExecution.endTime} only %} + | ++ + | +
{{ 'job.field.failure.message'|trans }} | +{{ 'job.field.failure.class'|trans }} | + {% if canSeeTraces %} +{{ 'job.field.failure.trace'|trans }} | + {% endif %} +
---|---|---|
{{ failure }} | +{{ failure.class }} | + {% if canSeeTraces %} ++ {% if failure.trace %} + {% include '@YokaiBatch/bootstrap4/_traces.html.twig' with {value: failure.trace} only %} + {% endif %} + | + {% endif %} +
{{ 'job.field.execution_id'|trans }} | +{{ execution.id }} | +
---|---|
{{ 'job.field.job_name'|trans }} | ++ {% include '@YokaiBatch/bootstrap4/_job-name.html.twig' with {execution: execution} only %} + | +
{{ 'job.field.status'|trans }} | ++ {% include '@YokaiBatch/bootstrap4/_status.html.twig' with {execution: execution} only %} + | +
{{ 'job.field.start_time'|trans }} | ++ {%- include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: execution.startTime} only -%} + | +
{{ 'job.field.end_time'|trans }} | ++ {%- include '@YokaiBatch/bootstrap4/_datetime.html.twig' with {value: execution.endTime} only -%} + | +
{{ 'job.field.warning.message'|trans }} | +{{ 'job.field.warning.context'|trans }} | +
---|---|
{{ warning }} | ++ {% if warning.context %} + {% include '@YokaiBatch/bootstrap4/_json.html.twig' with {value: warning.context} only %} + {% endif %} + | +
{{ value|json_encode(constant('JSON_PRETTY_PRINT')) }}
diff --git a/src/batch-symfony-framework/src/Resources/views/sonata/_status.html.twig b/src/batch-symfony-framework/src/Resources/views/sonata/_status.html.twig
new file mode 100644
index 00000000..91efa65d
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/sonata/_status.html.twig
@@ -0,0 +1,14 @@
+{% trans_default_domain 'YokaiBatchBundle' %}
+
+{# @var execution \Yokai\Batch\JobExecution #}
+{% set classMap = {
+ (constant('PENDING', execution.status)): 'default',
+ (constant('RUNNING', execution.status)): 'warning',
+ (constant('STOPPED', execution.status)): 'info',
+ (constant('COMPLETED', execution.status)): 'success',
+ (constant('ABANDONED', execution.status)): 'info',
+ (constant('FAILED', execution.status)): 'danger',
+} %}
+
+ {{ ('job.status.'~execution.status|lower)|trans }}
+
diff --git a/src/batch-symfony-framework/src/Resources/views/sonata/_traces.html.twig b/src/batch-symfony-framework/src/Resources/views/sonata/_traces.html.twig
new file mode 100644
index 00000000..961cb1d6
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/sonata/_traces.html.twig
@@ -0,0 +1 @@
+{{ value }}
diff --git a/src/batch-symfony-framework/src/Resources/views/sonata/list.html.twig b/src/batch-symfony-framework/src/Resources/views/sonata/list.html.twig
new file mode 100644
index 00000000..5d4e34a9
--- /dev/null
+++ b/src/batch-symfony-framework/src/Resources/views/sonata/list.html.twig
@@ -0,0 +1,223 @@
+{% extends base_template %}
+
+{% trans_default_domain 'YokaiBatchBundle' %}
+
+{# @var execution \Yokai\Batch\JobExecution #}
+
+{% set parameters = app.request.query.all('filter') %}
+
+{% block title %}
+ - {{ 'job.name'|trans }}
+{% endblock %}
+
+{% block navbar_title %}
+{% endblock %}
+
+{%- block actions -%}
+{%- endblock -%}
+
+{%- block tab_menu -%}
+{%- endblock -%}
+
+{% block breadcrumb %}
+
+{% endblock %}
+
+{% block list_table %}
+ + {{ 'job.field.execution_id'|trans }} + | ++ {{ 'job.field.job_name'|trans }} + | ++ {{ 'job.field.status'|trans }} + | ++ + {{ 'job.field.start_time'|trans }} + + | ++ + {{ 'job.field.end_time'|trans }} + + | ++ |
---|---|---|---|---|---|
+ {% if yokai_batch_grant_view(execution) %} + + {{ execution.id }} + + {% else %} + {{ execution.id }} + {% endif %} + | ++ {% include '@YokaiBatch/sonata/_job-name.html.twig' with { execution: execution } only %} + | ++ {% include '@YokaiBatch/sonata/_status.html.twig' with { execution: execution } only %} + | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with { value: execution.startTime } only -%} + | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with { value: execution.endTime } only -%} + | +
+
+ {% if yokai_batch_grant_view(execution) %}
+
+
+ {{ 'action_show'|trans({}, 'SonataAdminBundle') }}
+
+ {% endif %}
+ {% if yokai_batch_grant_logs(execution) %}
+
+ {{ 'job.action.download_logs'|trans }}
+
+ {% endif %}
+
+ |
+
{{ 'job.field.job_name'|trans }} | +{{ 'job.field.status'|trans }} | +{{ 'job.field.failures'|trans }} | +{{ 'job.field.warnings'|trans }} | +{{ 'job.field.start_time'|trans }} | +{{ 'job.field.end_time'|trans }} | ++ |
---|---|---|---|---|---|---|
+ {% include '@YokaiBatch/sonata/_job-name.html.twig' with {execution: childExecution} only %} + | ++ {% include '@YokaiBatch/sonata/_status.html.twig' with {execution: childExecution} only %} + | ++ {% if childExecution.failures|length > 0 %} + {{ childExecution.failures|length }} + {% else %} + 0 + {% endif %} + | ++ {% if childExecution.warnings|length > 0 %} + {{ childExecution.warnings|length }} + {% else %} + 0 + {% endif %} + | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with {value: childExecution.startTime} only -%} + | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with {value: childExecution.endTime} only -%} + | ++ + | +
{{ 'job.field.failure.message'|trans }} | +{{ 'job.field.failure.class'|trans }} | + {% if canSeeTraces %} +{{ 'job.field.failure.trace'|trans }} | + {% endif %} +
---|---|---|
{{ failure }} | +{{ failure.class }} | + {% if canSeeTraces %} ++ {% if failure.trace %} + {% include '@YokaiBatch/sonata/_traces.html.twig' with {value: failure.trace} only %} + {% endif %} + | + {% endif %} +
{{ 'job.field.execution_id'|trans }} | +{{ execution.id }} | +
---|---|
{{ 'job.field.job_name'|trans }} | ++ {% include '@YokaiBatch/sonata/_job-name.html.twig' with {execution: execution} only %} + | +
{{ 'job.field.status'|trans }} | ++ {% include '@YokaiBatch/sonata/_status.html.twig' with {execution: execution} only %} + | +
{{ 'job.field.start_time'|trans }} | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with {value: execution.startTime} only -%} + | +
{{ 'job.field.end_time'|trans }} | ++ {%- include '@SonataAdmin/CRUD/display_datetime.html.twig' with {value: execution.endTime} only -%} + | +
{{ 'job.field.warning.message'|trans }} | +{{ 'job.field.warning.context'|trans }} | +
---|---|
{{ warning }} | ++ {% if warning.context %} + {% include '@YokaiBatch/sonata/_json.html.twig' with {value: warning.context} only %} + {% endif %} + | +
Count: {{ execution.summary.get('countries')|length }}
+ {% for country in execution.summary.get('countries') %} + + {% endfor %} +{% endblock %} diff --git a/tests/symfony/tests/JobTest.php b/tests/symfony/tests/JobTest.php index 0938ff03..3e27e0cb 100644 --- a/tests/symfony/tests/JobTest.php +++ b/tests/symfony/tests/JobTest.php @@ -73,7 +73,7 @@ public function testUsingLauncher(string $job, callable $assert, callable $setup $assert($execution, $container); } - public function configs(): Generator + public static function configs(): Generator { yield from CountryJobSet::sets(); yield from StarWarsJobSet::sets(); diff --git a/tests/symfony/tests/UserInterfaceTest.php b/tests/symfony/tests/UserInterfaceTest.php new file mode 100644 index 00000000..5fde99a5 --- /dev/null +++ b/tests/symfony/tests/UserInterfaceTest.php @@ -0,0 +1,174 @@ + 'Country import', + 'star-wars.import' => 'Star Wars import', + ]; + + /** + * @var array