Admin - add filter for periodic runs

- Store & display exec results for periodic runs
This commit is contained in:
nathangray
2018-09-25 13:17:52 -06:00
parent b7c359a6f1
commit d7c5dc71cf
3 changed files with 48 additions and 5 deletions

View File

@ -38,6 +38,7 @@ class admin_cmds
if (!$rows) return array();
$async = new Api\Asyncservice();
foreach($rows as &$row)
{
try {
@ -47,10 +48,31 @@ class admin_cmds
catch (Exception $e) {
$row['title'] = $e->getMessage();
}
$row['data'] = !($data = json_php_unserialize($row['data'])) ? '' :
json_encode($data+(empty($row['rrule'])?array():array('rrule' => $row['rrule'])),
JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
if(method_exists($cmd, 'summary'))
{
$row['data'] = $cmd->summary();
}
else
{
$row['data'] = !($data = json_php_unserialize($row['data'])) ? '' :
json_encode($data+(empty($row['rrule'])?array():array('rrule' => $row['rrule'])),
JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
}
if($row['rrule'])
{
$rrule = calendar_rrule::event2rrule(calendar_rrule::parseRrule($row['rrule'],true)+array(
'start' => time(),
'tzid'=> Api\DateTime::$server_timezone->getName()
));
$row['rrule'] = ''.$rrule;
}
if(!$row['scheduled'] && $cmd && $cmd->async_job_id)
{
$job = $async->read($cmd->async_job_id);
$row['scheduled'] = $job ? $job[$cmd->async_job_id]['next'] : null;
}
if ($row['status'] == admin_cmd::scheduled)
{
$row['class'] = 'AllowDelete';
@ -98,7 +120,12 @@ class admin_cmds
}
unset($cmd);
}
$periodic = array(
0 => 'no',
1 => 'yes'
);
$tpl->exec('admin.admin_cmds.index',$content,array(
'periodic' => $periodic,
'status' => admin_cmd::$stati,
'remote_id' => admin_cmd::remote_sites(),
),array(),$content);