Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Volumes: Display volume jobs
Browse files Browse the repository at this point in the history
Displays a listing about which jobs are on a volume
in our volume details view.

Also, volume details are now presented via a datatable
with expandable detailed volume information.
  • Loading branch information
fbergkemper committed Mar 23, 2016
1 parent 8fb9b1b commit cf11d58
Show file tree
Hide file tree
Showing 3 changed files with 402 additions and 46 deletions.
11 changes: 9 additions & 2 deletions module/Media/src/Media/Controller/MediaController.php
Expand Up @@ -56,10 +56,9 @@ public function detailsAction()
if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()) {

$volumename = $this->params()->fromRoute('id');
$volume = $this->getMediaModel()->getVolume($volumename);

return new ViewModel(array(
'media' => $volume,
'volume' => $volumename,
));

}
Expand All @@ -73,10 +72,18 @@ public function getDataAction()
if($_SESSION['bareos']['authenticated'] == true && $this->SessionTimeoutPlugin()->timeout()){

$data = $this->params()->fromQuery('data');
$volume = $this->params()->fromQuery('volume');

if($data == "all") {
$result = $this->getMediaModel()->getVolumes();
}
elseif($data == "details") {
// workaround until llist volume returns array instead of object
$result[0] = $this->getMediaModel()->getVolume($volume);
}
elseif($data == "jobs") {
$result = $this->getMediaModel()->getVolumeJobs($volume);
}
else {
$result = null;
}
Expand Down
15 changes: 15 additions & 0 deletions module/Media/src/Media/Model/MediaModel.php
Expand Up @@ -69,4 +69,19 @@ public function getVolume($volume=null)
return false;
}
}

public function getVolumeJobs($volume=null)
{
if(isset($volume)) {
$cmd = 'llist jobs volume="'.$volume.'"';
$this->director = $this->getServiceLocator()->get('director');
$result = $this->director->send_command($cmd, 2, null);
$volume = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
return $volume['result']['jobs'];
}
else {
return false;
}
}

}

0 comments on commit cf11d58

Please sign in to comment.