Skip to content
Snippets Groups Projects
Commit 6c8e78c9 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Update show running jobs

parent e03ce0ae
No related branches found
No related tags found
1 merge request!16Add running jobs
......@@ -99,7 +99,7 @@ class cronlogrenderer extends cronlog{
/**
* get html code for a table with events of executed cronjobs
*
* @param array $aData result of $oCL->getServerLogs()
* @param array $aData result of $this->getServerLogs()
* @return string
*/
public function renderCronlogs($aData=false){
......@@ -195,16 +195,24 @@ class cronlogrenderer extends cronlog{
$sTtlHr=$sTtlHr ? '('.$sTtlHr.')' : '';
$sColStatus='';
$bIsRunning=false;
if($aEntry['SCRIPTRC']){
if (count($aErrors)){
foreach($aErrors as $aErr){
$sColStatus.='<li><abbr title="'.$aErr[1].'">'.$this->t('status-error').': '.$aErr[0].'</abbr></li>';
}
$sColStatus='<ul>'.$sColStatus.'</ul>';
} else {
$sColStatus.=($aEntry['SCRIPTRC'] ? $this->t('status-ok') : '');
$sColStatus.=$this->t('status-ok');
}
} else {
$bIsRunning=true;
$sColStatus.=$this->t('status-running');
}
// render table of last logfile per cron job
$sHtml.='<tr onclick="showFile(\''.$aEntry['logfile'].'\');" title="'.sprintf($this->t('row-click-show-logfile'), $aEntry['logfile']).'">'
$sHtml.='<tr onclick="showFile(\''.$aEntry['logfile'].'\');" title="'.sprintf($this->t('row-click-show-logfile'), $aEntry['logfile']).'"'
.($bIsRunning ? ' class="message-running"' : '')
.'>'
. '<td>'.date("Y-m-d H:i:s", $aEntry['SCRIPTSTARTTIME']).'</td>'
// . '<td>'.$aEntry['SCRIPTNAME'].'</td>'
. '<td>'.$aEntry['SCRIPTLABEL'].'</td>'
......@@ -246,7 +254,8 @@ class cronlogrenderer extends cronlog{
. '<p class="hint">'
. $this->t('logs-hint')
. '</p>'
. '<div>'
. (count($aData)
? '<div>'
. $this->_renderAccessAndAge($iLast)
. ($iErrors ? '<a href="#" class="btn bg-danger" onclick="'.$this->_filterDatatable($sIdTable, $this->t('status-error')).'"><i class="fas fa-exclamation-circle"></i> &nbsp; ' . $iErrors.'</a> ' : '')
. ( $iOK ? '<a href="#" class="btn bg-success" onclick="'.$this->_filterDatatable($sIdTable, $this->t('status-ok')).'"><i class="fas fa-check"></i> &nbsp; ' . $iOK.'</a>' : '')
......@@ -258,8 +267,6 @@ class cronlogrenderer extends cronlog{
.$sHtml
.'</tbody>'
. '</table>'
// init datatable
. '<script>'
. '$(document).ready( function () { $(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
......@@ -269,6 +276,10 @@ class cronlogrenderer extends cronlog{
});
});'
. '</script>'
: ''
)
// init datatable
. '
<!-- ENDE '.__METHOD__.' -->
......@@ -278,11 +289,17 @@ class cronlogrenderer extends cronlog{
return $sHtml;
}
/**
* get html code for a table with events of executed cronjobs for ALL servers
*
* @param array $aData result of $this->getServerLogs()
* @return string
*/
public function renderCronlogsOfAllServers(){
$aData=array();
foreach (array_keys($this->getServers()) as $sServer){
$this->setServer($sServer);
$aData=array_merge($aData, $this->getServersLastLog());
$aData=array_merge($aData, $this->getRunningJobs(),$this->getServersLastLog());
}
$this->setServer('ALL');
return $this->renderCronlogs($aData);
......@@ -400,7 +417,8 @@ class cronlogrenderer extends cronlog{
. '</table>'
// init datatable
. '<script>'
. (count($aData)
? '<script>'
. '$(document).ready( function () {$(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
"aaSorting":[[0,"desc"]],
......@@ -408,6 +426,8 @@ class cronlogrenderer extends cronlog{
'.$this->_getDatatableLanguage().'
});} );'
. '</script>'
: ''
)
. '
<!-- ENDE '.__METHOD__.' -->
......
......@@ -54,7 +54,7 @@ class cronlog {
protected $_sFileFilter_serverjoblog = '*joblog*.done';
protected $_sFileFilter_joblog = '*.log';
protected $_sFileFilter_jobrunning = '*.log.running';
protected $_sFileFilter_jobrunning = '*.log.running*';
protected $_sLang = ''; // language ... read from config file
protected $_aLang = []; // language data
......
......@@ -44,6 +44,7 @@ return [
"col-rc" => "$?",
"col-expired" => "veraltet?",
"col-status" => "Status",
"status-running" => "AKTIV",
"status-ok" => "OK",
"status-error" => "FEHLER",
......
......@@ -44,6 +44,7 @@ return [
"col-rc" => "$?",
"col-expired" => "Expired?",
"col-status" => "Status",
"status-running" => "RUNNING",
"status-ok" => "OK",
"status-error" => "ERROR",
......
......@@ -41,6 +41,7 @@ table.dataTable tbody td{padding: 3px;}
.message{border: 1px solid rgba(0,0,0,0.1); padding: 1em; float: right;}
table.dataTable tbody tr.message-ok, .message-ok{background:#cfc; color:#080 !important;}
table.dataTable tbody tr.message-error, .message-error{background:#fdd; color:#800 !important;}
table.dataTable tbody tr.message-running, .message-running{background:#f4e0f4; color:#808 !important;}
table.dataTable tbody tr.message-warning, .message-warning{background:#fec; color:#876 !important;}
table.dataTable tbody tr:hover{background:rgba(0,0,0,0.1);}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment