Added a page & table for viewing a list of installed tasks

This commit is contained in:
2023-05-31 16:00:22 +01:00
parent 2bed04cd18
commit e4db24ee8d
11 changed files with 440 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
{% extends "@admin/navigation/sidebar-menu.html.twig" %}
{% block navigation %}
{{ parent() }}
{% if checkAccess('uri_tasks') %}
<li>
<a href="{{site.uri.public}}/tasks"><i class="fas fa-tasks fa-fw"></i> <span>{{ translate("TASK", 2) }}</span></a>
</li>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,41 @@
{% extends "pages/abstract/dashboard.html.twig" %}
{% block stylesheets_page %}
<!-- Page-specific CSS asset bundle -->
{{ assets.css('css/form-widgets') | raw }}
{% endblock %}
{# Overrides blocks in head of base template #}
{% block page_title %}{{ translate("TASK", 2)}}{% endblock %}
{% block page_description %}{{ translate("TASK.PAGE_DESCRIPTION")}}{% endblock %}
{% block body_matter %}
<div class="row">
<div class="col-md-12">
<div id="widget-tasks" class="box box-primary">
<div class="box-header">
<h3 class="box-title pull-left"><i class="fas fa-tasks fa-fw"></i> {{translate('TASK', 2)}}</h3>
</div>
<div class="box-body">
{% include "tables/tasks.html.twig" with {
"table" : {
"id" : "table-tasks"
}
}
%}
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts_page %}
<!-- Include validation rules -->
<script>
{% include "pages/partials/page.js.twig" %}
</script>
<!-- Include form widgets JS -->
{{ assets.js('js/form-widgets') | raw }}
{% endblock %}

View File

@@ -0,0 +1,49 @@
{# This partial template renders a table of permissions, to be populated with rows via an AJAX request.
# This extends a generic template for paginated tables.
#
# Note that this template contains a "skeleton" table with an empty table body, and then a block of Handlebars templates which are used
# to render the table cells with the data from the AJAX request.
#}
{% extends "tables/table-paginated.html.twig" %}
{% block table %}
<table id="{{table.id}}" class="tablesorter table table-bordered table-hover table-striped">
<thead>
<tr>
<th data-column-name="name" data-priority="1">{{translate('NAME')}}</th>
<th data-column-name="sprinkle" data-priority="1">{{translate('SPRINKLE')}}</th>
<th data-column-name="schedule" data-priority="1">{{translate('SCHEDULE')}}</th>
<th data-column-name="next_run" data-priority="1">{{translate('NEXT_RUN_TIME')}}</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td data-text="{{task.sprinkle}}/{{task.name}}">
<div>
<strong>
<!--<a href="{{site.uri.public}}/tasks/t/{{task.sprinkle}}/{{task.name}}">{{task.name}}</a>-->
{{task.name}}
</strong>
</div>
</td>
<td data-text="{{task.sprinkle}}">
{{task.sprinkle}}
</td>
<td data-text="{{task.schedule}}">
<i class="text-muted" style="min-width: 70px; display: inline-block">({{task.schedule}})</i> {{task.schedule | formatCron()}}
</td>
<td data-text="{{task.next_run}}">
{{ task.next_run | format_datetime(pattern='HH:mm:ss dd/MM/yyyy') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block table_pager_controls %}{% endblock %}