Skip to content

Commit

Permalink
AdminUI: Scheduled Jobs page
Browse files Browse the repository at this point in the history
  • Loading branch information
aydun committed May 24, 2023
1 parent 8a65f9b commit f9df078
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ext/civicrm_admin_ui/ang/afsearchManageScheduledJobs.aff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="af-markup">
<div class="help">{{:: ts('You can configure scheduled jobs (cron tasks) for your CiviCRM installation. For most sites, your system administrator should set up one or more "cron" tasks to run the enabled jobs. However, you can also run all scheduled jobs manually using the button below, or specific jobs from this screen using the "Execute Now" buttons.')}} <a class="crm-doc-link no-popup" href="https://docs.civicrm.org/sysadmin/en/latest/setup/jobs" target="_blank" title="Opens documentation in a new window.">(Job parameters and command line syntax documentation...)</a></div>
</div>
<div af-fieldset="">
<div class="af-container af-layout-inline">
<af-field name="name" />
<af-field name="description" defn="{input_type: 'Text', input_attrs: {}}" />
<af-field name="is_active" defn="{input_type: 'Radio', input_attrs: {}}" />
</div>
<div class="btn-group pull-right">
<a class="btn btn-primary" ng-href="{{:: crmUrl('civicrm/admin/runjobs', {reset: 1}) }}">
<i class="crm-i fa-forward"/>
{{:: ts('Execute All Scheduled Jobs Now') }}
</a>
<a class="btn btn-primary" ng-href="{{:: crmUrl('civicrm/admin/joblog', {reset: 1}) }}">
<i class="crm-i fa-list-alt"/>
{{:: ts('View Log (all jobs)') }}
</a>
</div>
<crm-search-display-table search-name="Scheduled_Jobs" display-name="Scheduled_Jobs_Table_2"></crm-search-display-table>
</div>
7 changes: 7 additions & 0 deletions ext/civicrm_admin_ui/ang/afsearchManageScheduledJobs.aff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "search",
"title": "Manage Scheduled Jobs",
"icon": "fa-list-alt",
"server_route": "civicrm/admin/job",
"permission": "access CiviCRM"
}
231 changes: 231 additions & 0 deletions ext/civicrm_admin_ui/managed/SavedSearch_Manage_Scheduled_Jobs.mgd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
<?php
use CRM_CivicrmAdminUi_ExtensionUtil as E;

return [
[
'name' => 'SavedSearch_Scheduled_Jobs',
'entity' => 'SavedSearch',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Scheduled_Jobs',
'label' => E::ts('Scheduled Jobs'),
'form_values' => NULL,
'mapping_id' => NULL,
'search_custom_id' => NULL,
'api_entity' => 'Job',
'api_params' => [
'version' => 4,
'select' => [
'id',
'name',
'description',
'run_frequency:label',
'parameters',
'last_run',
'is_active',
'api_entity',
'api_action',
],
'orderBy' => [],
'where' => [],
'groupBy' => [],
'join' => [],
'having' => [],
],
'expires_date' => NULL,
'description' => NULL,
],
'match' => [
'name',
],
],
],
[
'name' => 'SavedSearch_Scheduled_Jobs_SearchDisplay_Scheduled_Jobs_Table_2',
'entity' => 'SearchDisplay',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Scheduled_Jobs_Table_2',
'label' => E::ts('Scheduled Jobs Table 2'),
'saved_search_id.name' => 'Scheduled_Jobs',
'type' => 'table',
'settings' => [
'description' => NULL,
'sort' => [
[
'is_active',
'DESC',
],
[
'name',
'ASC',
],
],
'limit' => 50,
'pager' => [],
'placeholder' => 5,
'columns' => [
[
'type' => 'html',
'key' => 'name',
'dataType' => 'String',
'label' => E::ts('Job'),
'sortable' => TRUE,
'cssRules' => [
[
'disabled',
'is_active',
'=',
FALSE,
],
],
'rewrite' => '<b>[name]</b><br>[description]',
],
[
'type' => 'field',
'key' => 'run_frequency:label',
'dataType' => 'String',
'label' => E::ts('Frequency'),
'sortable' => TRUE,
'cssRules' => [
[
'disabled',
'is_active',
'=',
FALSE,
],
],
],
[
'type' => 'field',
'key' => 'last_run',
'dataType' => 'Timestamp',
'label' => E::ts('Last Run'),
'sortable' => TRUE,
'cssRules' => [
[
'disabled',
'is_active',
'=',
FALSE,
],
],
],
[
'type' => 'field',
'key' => 'is_active',
'dataType' => 'Boolean',
'label' => E::ts('Enabled'),
'sortable' => TRUE,
'editable' => TRUE,
'cssRules' => [
[
'disabled',
'is_active',
'=',
FALSE,
],
],
],
[
'type' => 'field',
'key' => 'api_entity',
'dataType' => 'String',
'label' => E::ts('API'),
'sortable' => TRUE,
'cssRules' => [
[
'disabled',
'is_active',
'=',
FALSE,
],
],
'rewrite' => '[api_entity].[api_action]',
],
[
'text' => E::ts(''),
'style' => 'default',
'size' => 'btn-sm',
'icon' => 'fa-bars',
'links' => [
[
'entity' => '',
'action' => '',
'join' => '',
'target' => '',
'icon' => 'fa-file-o',
'text' => E::ts('View joblog'),
'style' => 'default',
'path' => 'civicrm/admin/joblog?jid=[id]&reset=1',
'condition' => [],
],
[
'entity' => '',
'action' => '',
'join' => '',
'target' => '',
'icon' => 'fa-play',
'text' => E::ts('Execute now'),
'style' => 'default',
'path' => 'civicrm/admin/job/edit?action=view&id=[id]&reset=1',
'condition' => [],
],
[
'entity' => 'Job',
'action' => 'update',
'join' => '',
'target' => 'crm-popup',
'icon' => 'fa-pencil',
'text' => E::ts('Edit Job'),
'style' => 'default',
'path' => '',
'condition' => [],
],
[
'entity' => '',
'action' => '',
'join' => '',
'target' => '',
'icon' => 'fa-clone',
'text' => E::ts('Clone'),
'style' => 'secondary',
'path' => 'civicrm/admin/job/edit?action=copy&id=[id]',
'condition' => [],
],
[
'entity' => 'Job',
'action' => 'delete',
'join' => '',
'target' => 'crm-popup',
'icon' => 'fa-trash',
'text' => E::ts('Delete Job'),
'style' => 'danger',
'path' => '',
'condition' => [],
],
],
'type' => 'menu',
'alignment' => 'text-right',
],
],
'actions' => FALSE,
'classes' => [
'table',
'table-striped',
],
],
'acl_bypass' => FALSE,
],
'match' => [
'name',
],
],
],
];

0 comments on commit f9df078

Please sign in to comment.