diff --git a/module/Dashboard/view/dashboard/dashboard/index.phtml b/module/Dashboard/view/dashboard/dashboard/index.phtml index 55c0468c..bf30e75a 100644 --- a/module/Dashboard/view/dashboard/dashboard/index.phtml +++ b/module/Dashboard/view/dashboard/dashboard/index.phtml @@ -56,23 +56,7 @@ $this->headTitle($title); var lastlogid = 0; var table_jobs_last_status = null; - - function getDirectorMessages() { - $.ajax({ - url : 'url('dashboard', array('action' => 'getData'), null) . '?data=dirdmsg'; ?>', - dataType: 'json', - timeout: 10000, - success: function(data) { - for(var i in data) { - if(data[i].logid > lastlogid) { - var msg = $('
'+data[i].time+' '+data[i].logtext+'
'); - msg.insertBefore('#'+lastlogid).fadeIn('slow'); - lastlogid = data[i].logid; - } - } - } - }); - } + var table_job_totals = null; $(document).ajaxStart(function() { $('.waiting-jobs-field').empty(); @@ -112,30 +96,25 @@ $this->headTitle($title); } function getJobTotals() { - $.ajax({ - url : 'url('dashboard', array('action' => 'getData'), null) . '?data=jobtotals'; ?>', + table_job_totals = $('#job-totals').bootstrapTable({ + locale: '', + url: 'url('dashboard', array('action' => 'getData'), null) . '?data=jobtotals'; ?>', + method: 'get', dataType: 'json', - timeout: 10000, - success: function(data) { - $('.job-totals-container').empty(); - $('.job-totals-container').append( - '
translate("Jobs"); ?>
'+data.jobs+'
' + - '
translate("Files"); ?>
'+data.files+'
' + - '
translate("Bytes"); ?>
'+formatBytes(data.bytes)+'
' - ); - }, - error: function() { - $('.job-totals-container').empty(); - $('.job-totals-container').append('Error fetching data.'); - }, - timeout: function() { - $('.job-totals-container').empty(); - $('.job-totals-container').append('Timeout fetching data.'); - }, - parsererror: function() { - $('.job-totals-container').empty(); - $('.job-totals-container').append('Parsererror'); - } + columns: [ + { + field: 'jobs', + }, + { + field: 'files', + }, + { + field: 'bytes', + formatter: function(value) { + return formatBytes(value); + } + } + ] }); } @@ -266,7 +245,7 @@ $this->headTitle($title); function refreshPartials() { getRunningJobs(); getJobsPast24h(); - getJobTotals(); + $('#job-totals').bootstrapTable('refresh'); $('#jobs-last-status').bootstrapTable('refresh'); } @@ -282,7 +261,7 @@ $this->headTitle($title); setInterval('getJobsPast24h()', ); getJobTotals(); - setInterval('getJobTotals()', ); + setInterval("$('#job-totals').bootstrapTable('refresh')", ); getJobsLastStatus(); setInterval( "$('#jobs-last-status').bootstrapTable('refresh')", ); diff --git a/module/Dashboard/view/partial/JobTotals.phtml b/module/Dashboard/view/partial/JobTotals.phtml index 0d4817f7..1a9d30db 100644 --- a/module/Dashboard/view/partial/JobTotals.phtml +++ b/module/Dashboard/view/partial/JobTotals.phtml @@ -34,7 +34,15 @@
-
+ + + + + + + +
translate("Jobs"); ?>translate("Files"); ?>translate("Bytes"); ?>
+
diff --git a/module/Job/src/Job/Model/JobModel.php b/module/Job/src/Job/Model/JobModel.php index 7a7fe61c..f1a5b8cb 100644 --- a/module/Job/src/Job/Model/JobModel.php +++ b/module/Job/src/Job/Model/JobModel.php @@ -248,7 +248,7 @@ public function getJobTotals(&$bsock=null) $cmd = 'list jobtotals'; $result = $bsock->send_command($cmd, 2, null); $jobtotals = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); - return $jobtotals['result']['jobtotals']; + return array(0 => $jobtotals['result']['jobtotals']); } else { throw new \Exception('Missing argument.');