Skip to content
Snippets Groups Projects

Add running jobs

6 files
+ 62
39
Compare changes
  • Side-by-side
  • Inline

Files

+ 57
37
@@ -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__.' -->
Loading