diff --git a/module/Media/src/Media/Model/MediaModel.php b/module/Media/src/Media/Model/MediaModel.php index 9b25a6e5..c3ff332c 100644 --- a/module/Media/src/Media/Model/MediaModel.php +++ b/module/Media/src/Media/Model/MediaModel.php @@ -5,7 +5,7 @@ * bareos-webui - Bareos Web-Frontend * * @link https://github.com/bareos/bareos-webui for the canonical source repository - * @copyright Copyright (c) 2013-2016 Bareos GmbH & Co. KG (http://www.bareos.org/) + * @copyright Copyright (c) 2013-2017 Bareos GmbH & Co. KG (http://www.bareos.org/) * @license GNU Affero General Public License (http://www.gnu.org/licenses/) * * This program is free software: you can redistribute it and/or modify @@ -33,8 +33,14 @@ public function getVolumes(&$bsock=null) if(isset($bsock)) { $cmd = 'llist volumes all'; $result = $bsock->send_command($cmd, 2, null); - $volumes = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); - return $volumes['result']['volumes']; + if(preg_match('/Failed to send result as json. Maybe result message to long?/', $result)) { + $error = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); + return $error['result']['error']; + } + else { + $volumes = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); + return $volumes['result']['volumes']; + } } else { throw new \Exception('Missing argument.'); @@ -59,8 +65,14 @@ public function getVolumeJobs(&$bsock=null, $volume=null) if(isset($bsock, $volume)) { $cmd = 'llist jobs volume="'.$volume.'"'; $result = $bsock->send_command($cmd, 2, null); - $volume = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); - return $volume['result']['jobs']; + if(preg_match('/Failed to send result as json. Maybe result message to long?/', $result)) { + $error = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); + return $error['result']['error']; + } + else { + $volume = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); + return $volume['result']['jobs']; + } } else { throw new \Exception('Missing argument.'); diff --git a/module/Media/view/media/media/details.phtml b/module/Media/view/media/media/details.phtml index d49d056d..de76d290 100644 --- a/module/Media/view/media/media/details.phtml +++ b/module/Media/view/media/media/details.phtml @@ -111,6 +111,26 @@ $this->headTitle($title); echo $this->headLink()->prependStylesheet($this->basePath() . '/css/datatables.min.css'); ?> + + + +