Skip to content

Commit

Permalink
Merge pull request #26060 from aydun/adminui_sched_job
Browse files Browse the repository at this point in the history
AdminUI - add Scheduled Jobs page
  • Loading branch information
colemanw authored May 24, 2023
2 parents 41ca0f4 + f9df078 commit 9ccad58
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CRM/Core/DAO/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Job.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:ea541d77d51255a389c90948e57ce2f0)
* (GenCodeChecksum:ef4ea1e4947c94ccf363364f32416912)
*/

/**
Expand Down Expand Up @@ -38,7 +38,7 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO {
protected static $_paths = [
'add' => 'civicrm/admin/job/add?reset=1&action=add',
'delete' => 'civicrm/admin/job/edit?reset=1&action=delete&id=[id]',
'update' => 'civicrm/admin/job/edit?reset=1&action=edit&id=[id]',
'update' => 'civicrm/admin/job/edit?reset=1&action=update&id=[id]',
];

/**
Expand Down
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',
],
],
],
];
2 changes: 1 addition & 1 deletion xml/schema/Core/Job.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<paths>
<add>civicrm/admin/job/add?reset=1&amp;action=add</add>
<delete>civicrm/admin/job/edit?reset=1&amp;action=delete&amp;id=[id]</delete>
<update>civicrm/admin/job/edit?reset=1&amp;action=edit&amp;id=[id]</update>
<update>civicrm/admin/job/edit?reset=1&amp;action=update&amp;id=[id]</update>
</paths>
<field>
<name>id</name>
Expand Down

0 comments on commit 9ccad58

Please sign in to comment.