Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit d76792a

Browse files
author
Jamie Snape
committed
Revise scheduler module configuration form
1 parent aa8b8be commit d76792a

File tree

5 files changed

+114
-136
lines changed

5 files changed

+114
-136
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
; MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
13
[global]
2-
version = 1.1.0
34
fullname = "Task Scheduler"
4-
description = "Schedules periodic background tasks"
5-
category = Core
5+
description = "Schedule periodic background tasks"
6+
category = "Core"
7+
uuid = "6ab62486-28b7-4673-bc93-e409b73a2eab"
8+
version = "1.1.0"

modules/scheduler/controllers/ConfigController.php renamed to modules/scheduler/controllers/AdminController.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21-
/** Config controller for the scheduler module */
22-
class Scheduler_ConfigController extends Scheduler_AppController
21+
/**
22+
* Admin controller for the scheduler module.
23+
*
24+
* @property Scheduler_JobModel $Scheduler_Job
25+
*/
26+
class Scheduler_AdminController extends Scheduler_AppController
2327
{
24-
public $_moduleModels = array('Job', 'JobLog');
28+
/** @var array */
29+
public $_moduleModels = array('Job');
2530

2631
/** Index action */
2732
public function indexAction()
2833
{
2934
$this->requireAdminPrivileges();
35+
36+
$this->view->pageTitle = 'Scheduler Module Configuration';
3037
$this->view->jobs = $this->Scheduler_Job->getJobsToRun();
3138
$this->view->jobsErrors = $this->Scheduler_Job->getLastErrors();
3239
}

modules/scheduler/controllers/RunController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function indexAction()
4040
}
4141
ignore_user_abort(true);
4242

43-
$this->Setting->setConfig('lastrun', ''.$startTime, $this->moduleName);
43+
$this->Setting->setConfig('lastrun', $startTime, $this->moduleName);
4444

4545
$id = $this->getParam('id');
4646
if (isset($id)) {
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
/*=========================================================================
3+
MIDAS Server
4+
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
5+
All rights reserved.
6+
More information http://www.kitware.com
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0.txt
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
=========================================================================*/
20+
21+
$this->declareVars('jobs', 'jobsErrors', 'pageTitle');
22+
$this->headTitle($this->escape($this->pageTitle));
23+
?>
24+
25+
<div class="viewMain">
26+
<h1><?php echo $this->escape($this->pageTitle); ?></h1>
27+
<p>Visit the Midas Platform
28+
<a href="http://www.kitware.com/midaswiki/index.php/Documentation/Latest/User/Administration/ConfigurePlugins#Task_Scheduler">wiki
29+
pages</a> for instructions on completing the installation of the task scheduler.</a></p>
30+
<?php
31+
if (!empty($this->jobs)) {
32+
?>
33+
<h2>Scheduled Tasks</h2>
34+
<table>
35+
<tr>
36+
<th>Name</th>
37+
<th>Date</th>
38+
<th>Parameters (JSON)</th>
39+
<th>Actions</th>
40+
</tr>
41+
<?php
42+
foreach ($this->jobs as $job) {
43+
?>
44+
<tr>
45+
<td>
46+
<?php echo $this->escape($job->getTask()); ?>
47+
</td>
48+
<td>
49+
<?php echo $this->escape($job->getFireTime()); ?>
50+
</td>
51+
<td qtip='<?php echo $this->escape(str_replace("'", '"', $job->getParams())); ?>'>
52+
<?php echo $this->escape(substr($job->getParams(), 0, 30)); ?>
53+
</td>
54+
<td>
55+
<a href="<?php echo $this->url(array('module' => 'scheduler', 'controller' => 'run', 'action' => 'index')); ?>?id=<?php echo $this->escape($job->getKey()); ?>">Run
56+
Now</a>
57+
</td>
58+
</tr>
59+
<?php
60+
}
61+
?>
62+
</table>
63+
<?php
64+
}
65+
if (!empty($this->jobsErrors)) {
66+
?>
67+
<h2>Last Failed Tasks</h2>
68+
<table>
69+
<tr>
70+
<th>Name</th>
71+
<th>Date</th>
72+
<th>Parameters (JSON)</th>
73+
</tr>
74+
<?php
75+
foreach ($this->jobsErrors as $job) {
76+
?>
77+
<tr>
78+
<td>
79+
<?php echo $this->escape($job->getTask()); ?>
80+
</td>
81+
<td>
82+
<?php echo $this->escape($job->getFireTime()); ?>
83+
</td>
84+
<td qtip="<?php echo $this->escape($job->getParams()); ?>">
85+
<?php echo $this->escape(substr($job->getParams(), 0, 30)); ?>
86+
</td>
87+
</tr>
88+
<?php
89+
}
90+
?>
91+
</table>
92+
<?php
93+
}
94+
?>
95+
<p><a href="<?php echo $this->url(array('controller' => 'admin', 'action' => 'index'), 'default'); ?>#tabs-modules">&laquo; Back to Modules Administration</a></p>
96+
</div>
97+

modules/scheduler/views/config/index.phtml

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)