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

Merge branch 'add-running-jobs' into 'master'

Add running jobs

See merge request !16
parents 923c342d 3cf0409e
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='';
if (count($aErrors)){
foreach($aErrors as $aErr){
$sColStatus.='<li><abbr title="'.$aErr[1].'">'.$this->t('status-error').': '.$aErr[0].'</abbr></li>';
$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.=$this->t('status-ok');
}
$sColStatus='<ul>'.$sColStatus.'</ul>';
} else {
$sColStatus.=($aEntry['SCRIPTRC'] ? $this->t('status-ok') : '');
$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,29 +254,32 @@ class cronlogrenderer extends cronlog{
. '<p class="hint">'
. $this->t('logs-hint')
. '</p>'
. '<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>' : '')
. ($iErrors && $iOK ? ' ... '.$this->t('total').': <a href="#" class="btn bg-gray" onclick="'.$this->_filterDatatable($sIdTable, "").'"><i class="fas fa-th-large"></i> &nbsp; ' . count($aData).'</a>' : '' )
. '</div><br>'
. '<table id="'.$sIdTable.'" class="table-striped">'
. '<thead><tr>'.$sTblHead.'</tr></thead>'
. '<tbody>'
.$sHtml
.'</tbody>'
. '</table>'
. (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>' : '')
. ($iErrors && $iOK ? ' ... '.$this->t('total').': <a href="#" class="btn bg-gray" onclick="'.$this->_filterDatatable($sIdTable, "").'"><i class="fas fa-th-large"></i> &nbsp; ' . count($aData).'</a>' : '' )
. '</div><br>'
. '<table id="'.$sIdTable.'" class="table-striped">'
. '<thead><tr>'.$sTblHead.'</tr></thead>'
. '<tbody>'
.$sHtml
.'</tbody>'
. '</table>'
. '<script>'
. '$(document).ready( function () { $(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
"bPaginate":false,
"aaSorting":[[0,"desc"]]
'.$this->_getDatatableLanguage().'
});
});'
. '</script>'
: ''
)
// init datatable
. '<script>'
. '$(document).ready( function () { $(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
"bPaginate":false,
"aaSorting":[[0,"desc"]]
'.$this->_getDatatableLanguage().'
});
});'
. '</script>'
. '
<!-- 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,14 +417,17 @@ class cronlogrenderer extends cronlog{
. '</table>'
// init datatable
. '<script>'
. '$(document).ready( function () {$(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
"aaSorting":[[0,"desc"]],
"aLengthMenu":[[25,100,-1],[25,100,"---"]]
'.$this->_getDatatableLanguage().'
});} );'
. '</script>'
. (count($aData)
? '<script>'
. '$(document).ready( function () {$(\'#'.$sIdTable.'\').DataTable({
"retrieve": true,
"aaSorting":[[0,"desc"]],
"aLengthMenu":[[25,100,-1],[25,100,"---"]]
'.$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",
......
<?php
define("APP_VERSION", '2.1.2');
define("APP_VERSION", '2.1.3');
require_once('classes/render-adminlte.class.php');
require_once('classes/cronlog-renderer.class.php');
......
......@@ -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.
Finish editing this message first!
Please register or to comment