diff --git a/module/Dashboard/config/module.config.php b/module/Dashboard/config/module.config.php
index 686643e3367..b2526b3c8ef 100644
--- a/module/Dashboard/config/module.config.php
+++ b/module/Dashboard/config/module.config.php
@@ -62,6 +62,7 @@
'JobsLastStatus' => __DIR__ . '/../view/partial/JobsLastStatus.phtml',
'LastDirectorMessages' => __DIR__ . '/../view/partial/LastDirectorMessages.phtml',
'RunningJobs' => __DIR__ . '/../view/partial/RunningJobs.phtml',
+ 'JobTotals' => __DIR__ . '/../view/partial/JobTotals.phtml',
),
),
'translator' => array(
diff --git a/module/Dashboard/src/Dashboard/Controller/DashboardController.php b/module/Dashboard/src/Dashboard/Controller/DashboardController.php
index c7923c8659d..4246ccbbdac 100644
--- a/module/Dashboard/src/Dashboard/Controller/DashboardController.php
+++ b/module/Dashboard/src/Dashboard/Controller/DashboardController.php
@@ -31,6 +31,9 @@
class DashboardController extends AbstractActionController
{
+ /**
+ * Variables
+ */
protected $directorModel = null;
protected $jobModel = null;
protected $dashboardModel = null;
@@ -42,6 +45,11 @@ class DashboardController extends AbstractActionController
"llist"
);
+ /**
+ * Index Action
+ *
+ * @return object
+ */
public function indexAction()
{
$this->RequestURIPlugin()->setRequestURI();
@@ -63,6 +71,11 @@ public function indexAction()
return new ViewModel();
}
+ /**
+ * Get Data Action
+ *
+ * @return object
+ */
public function getDataAction()
{
$this->RequestURIPlugin()->setRequestURI();
@@ -155,6 +168,16 @@ public function getDataAction()
echo $e->getMessage();
}
}
+ elseif($data == "jobtotals") {
+ try {
+ $this->bsock = $this->getServiceLocator()->get('director');
+ $result = $this->getJobModel()->getJobTotals($this->bsock);
+ $this->bsock->disconnect();
+ }
+ catch(Exception $e) {
+ echo $e->getMessage();
+ }
+ }
elseif($data == "dirdmsg") {
try {
$this->bsock = $this->getServiceLocator()->get('director');
@@ -177,6 +200,11 @@ public function getDataAction()
}
+ /**
+ * Get Director Model
+ *
+ * @return object
+ */
public function getDirectorModel()
{
if(!$this->directorModel) {
@@ -186,6 +214,11 @@ public function getDirectorModel()
return $this->directorModel;
}
+ /**
+ * Get Job Model
+ *
+ * @return object
+ */
public function getJobModel()
{
if(!$this->jobModel) {
@@ -195,6 +228,11 @@ public function getJobModel()
return $this->jobModel;
}
+ /**
+ * Get Dashboard Model
+ *
+ * @return object
+ */
public function getDashboardModel()
{
if(!$this->dashboardModel) {
diff --git a/module/Dashboard/view/dashboard/dashboard/index.phtml b/module/Dashboard/view/dashboard/dashboard/index.phtml
index 4a326be356b..c91bd8b9af3 100644
--- a/module/Dashboard/view/dashboard/dashboard/index.phtml
+++ b/module/Dashboard/view/dashboard/dashboard/index.phtml
@@ -38,6 +38,7 @@ $this->headTitle($title);
+ partial('JobTotals'); ?>
partial('RunningJobs'); ?>
@@ -109,6 +110,34 @@ $this->headTitle($title);
});
}
+ function getJobTotals() {
+ $.ajax({
+ url : 'url('dashboard', array('action' => 'getData'), null) . '?data=jobtotals'; ?>',
+ 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');
+ }
+ });
+ }
+
function getJobsLastStatus() {
table_jobs_last_status = $('#jobs-last-status').DataTable({
"ajax": {
@@ -230,6 +259,7 @@ $this->headTitle($title);
function refreshPartials() {
getRunningJobs();
getJobsPast24h();
+ getJobTotals();
table_jobs_last_status.ajax.reload( null, false );
}
@@ -244,6 +274,9 @@ $this->headTitle($title);
getJobsPast24h();
setInterval('getJobsPast24h()', );
+ getJobTotals();
+ setInterval('getJobTotals()', );
+
getJobsLastStatus();
setInterval( function () { table_jobs_last_status.ajax.reload( null, false ); }, );
}
diff --git a/module/Dashboard/view/partial/JobTotals.phtml b/module/Dashboard/view/partial/JobTotals.phtml
new file mode 100644
index 00000000000..0d4817f786b
--- /dev/null
+++ b/module/Dashboard/view/partial/JobTotals.phtml
@@ -0,0 +1,40 @@
+.
+ *
+ */
+
+?>
+
+
+
+
+
translate('Job Totals'); ?>
+
+
+
+
+
+
+
diff --git a/module/Job/src/Job/Model/JobModel.php b/module/Job/src/Job/Model/JobModel.php
index 0c5fba10537..7a7fe61cd36 100644
--- a/module/Job/src/Job/Model/JobModel.php
+++ b/module/Job/src/Job/Model/JobModel.php
@@ -27,6 +27,15 @@
class JobModel
{
+ /**
+ * Get mulitple Jobs
+ *
+ * @param $bsock
+ * @param $jobname
+ * @param $days
+ *
+ * @return array
+ */
public function getJobs(&$bsock=null, $jobname=null, $days=null)
{
if(isset($bsock)) {
@@ -62,6 +71,17 @@ public function getJobs(&$bsock=null, $jobname=null, $days=null)
}
}
+ /**
+ * Get Job by Status
+ *
+ * @param $bsock
+ * @param $jobname
+ * @param $status
+ * @param $days
+ * @param $hours
+ *
+ * @return array
+ */
public function getJobsByStatus(&$bsock=null, $jobname=null, $status=null, $days=null, $hours=null)
{
if(isset($bsock, $status)) {
@@ -96,6 +116,14 @@ public function getJobsByStatus(&$bsock=null, $jobname=null, $status=null, $days
}
}
+ /**
+ * Get a single Job
+ *
+ * @param $bsock
+ * @param $id
+ *
+ * @return array
+ */
public function getJob(&$bsock=null, $id=null)
{
if(isset($bsock, $id)) {
@@ -109,6 +137,14 @@ public function getJob(&$bsock=null, $id=null)
}
}
+ /**
+ * Get Job Log
+ *
+ * @param $bsock
+ * @param $id
+ *
+ * @return array
+ */
public function getJobLog(&$bsock=null, $id=null)
{
if(isset($bsock, $id)) {
@@ -130,6 +166,14 @@ public function getJobLog(&$bsock=null, $id=null)
}
}
+ /**
+ * Get Job Media
+ *
+ * @param $bsock
+ * @param $jobid
+ *
+ * @return array
+ */
public function getJobMedia(&$bsock=null, $jobid=null)
{
$cmd = 'llist jobmedia jobid='.$jobid;
@@ -145,6 +189,14 @@ public function getJobMedia(&$bsock=null, $jobid=null)
}
}
+ /**
+ * Get Jobs by type
+ *
+ * @param $bsock
+ * @param $type
+ *
+ * @return array
+ */
public function getJobsByType(&$bsock=null, $type=null)
{
if(isset($bsock)) {
@@ -163,6 +215,13 @@ public function getJobsByType(&$bsock=null, $type=null)
}
}
+ /**
+ * Get JobsLastStatus
+ *
+ * @param $bsock
+ *
+ * @return array
+ */
public function getJobsLastStatus(&$bsock=null)
{
if(isset($bsock)) {
@@ -176,6 +235,33 @@ public function getJobsLastStatus(&$bsock=null)
}
}
+ /**
+ * Get JobTotals
+ *
+ * @param $bsock
+ *
+ * @return array
+ */
+ public function getJobTotals(&$bsock=null)
+ {
+ if(isset($bsock)) {
+ $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'];
+ }
+ else {
+ throw new \Exception('Missing argument.');
+ }
+ }
+
+ /**
+ * Get Running Jobs Statistics
+ *
+ * @param $bsock
+ *
+ * @return array
+ */
public function getRunningJobsStatistics(&$bsock = null) {
if(isset($bsock)) {
@@ -271,6 +357,13 @@ public function getRunningJobsStatistics(&$bsock = null) {
}
}
+ /**
+ * Get the available Restore Jobs
+ *
+ * @param $bsock
+ *
+ * @return array
+ */
public function getRestoreJobs(&$bsock=null)
{
if(isset($bsock)) {
@@ -284,6 +377,14 @@ public function getRestoreJobs(&$bsock=null)
}
}
+ /**
+ * Run a job as scheduled
+ *
+ * @param $bsock
+ * @param $name
+ *
+ * @return string
+ */
public function runJob(&$bsock=null, $name=null)
{
if(isset($bsock, $name)) {
@@ -296,6 +397,22 @@ public function runJob(&$bsock=null, $name=null)
}
}
+ /**
+ * Run a custom job
+ *
+ * @param $bsock
+ * @param $jobname
+ * @param $client
+ * @param $fileset
+ * @param $storage
+ * @param $pool
+ * @param $level
+ * @param $priority
+ * @param $backupformat
+ * @param $when
+ *
+ * @return string
+ */
public function runCustomJob(&$bsock=null, $jobname=null, $client=null, $fileset=null, $storage=null, $pool=null, $level=null, $priority=null, $backupformat=null, $when=null)
{
if(isset($bsock, $jobname)) {
@@ -333,6 +450,14 @@ public function runCustomJob(&$bsock=null, $jobname=null, $client=null, $fileset
}
}
+ /**
+ * Re-Run a job
+ *
+ * @param $bsock
+ * @param $id
+ *
+ * @return string
+ */
public function rerunJob(&$bsock=null, $id=null)
{
if(isset($bsock, $id)) {
@@ -345,6 +470,14 @@ public function rerunJob(&$bsock=null, $id=null)
}
}
+ /**
+ * Cancel a job
+ *
+ * @param $bsock
+ * @param $id
+ *
+ * @return string
+ */
public function cancelJob(&$bsock=null, $id=null)
{
if(isset($bsock, $id)) {
@@ -357,6 +490,14 @@ public function cancelJob(&$bsock=null, $id=null)
}
}
+ /**
+ * Enable a job
+ *
+ * @param $bsock
+ * @param $name
+ *
+ * @return string
+ */
public function enableJob(&$bsock=null, $name=null)
{
if(isset($bsock, $name)) {
@@ -369,6 +510,14 @@ public function enableJob(&$bsock=null, $name=null)
}
}
+ /**
+ * Disable a job
+ *
+ * @param $bsock
+ * @param $name
+ *
+ * @return string
+ */
public function disableJob(&$bsock=null, $name=null)
{
if(isset($bsock, $name)) {