diff --git a/config/application.config.php b/config/application.config.php index e2ca9ad2..c808b89e 100644 --- a/config/application.config.php +++ b/config/application.config.php @@ -6,8 +6,9 @@ 'Application', 'Dashboard', 'Director', + 'Fileset', 'Pool', - 'Volume', + 'Media', 'Storage', 'Client', 'Job', diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php index 4ef23ea4..f0cb5414 100644 --- a/module/Application/config/module.config.php +++ b/module/Application/config/module.config.php @@ -130,13 +130,17 @@ 'label' => 'Director', 'route' => 'director', ), + array( + 'label' => 'Fileset', + 'route' => 'fileset', + ), array( 'label' => 'Pool', 'route' => 'pool', ), array( 'label' => 'Volume', - 'route' => 'volume', + 'route' => 'media', ), array( 'label' => 'Storage', diff --git a/module/Application/view/layout/layout.phtml b/module/Application/view/layout/layout.phtml index fabf8247..97701cd2 100644 --- a/module/Application/view/layout/layout.phtml +++ b/module/Application/view/layout/layout.phtml @@ -70,7 +70,7 @@
- + + Breadcrumbs end --> content; ?> diff --git a/module/Client/view/client/client/details.phtml b/module/Client/view/client/client/details.phtml index e69de29b..605cb158 100644 --- a/module/Client/view/client/client/details.phtml +++ b/module/Client/view/client/client/details.phtml @@ -0,0 +1,9 @@ +headTitle($title); + +?> + +

+
\ No newline at end of file diff --git a/module/Client/view/client/client/index.phtml b/module/Client/view/client/client/index.phtml index 086edf19..ccaf3f6d 100644 --- a/module/Client/view/client/client/index.phtml +++ b/module/Client/view/client/client/index.phtml @@ -5,7 +5,10 @@ $this->headTitle($title); ?> - +

+
+ +
@@ -24,8 +27,8 @@ $this->headTitle($title); - - + + diff --git a/module/Dashboard/src/Dashboard/Controller/DashboardController.php b/module/Dashboard/src/Dashboard/Controller/DashboardController.php index d3164354..bd153afa 100644 --- a/module/Dashboard/src/Dashboard/Controller/DashboardController.php +++ b/module/Dashboard/src/Dashboard/Controller/DashboardController.php @@ -11,14 +11,19 @@ class DashboardController extends AbstractActionController protected $jobTable; protected $clientTable; protected $poolTable; - protected $volumeTable; + protected $mediaTable; protected $fileTable; + protected $logTable; + protected $filesetTable; public function indexAction() { return new ViewModel( array( + 'lastSuccessfulJobs' => $this->getJobTable()->getLast24HoursSuccessfulJobs(), + 'lastUnsuccessfulJobs' => $this->getJobTable()->getLast24HoursUnsuccessfulJobs(), + 'jobsCreatedNotRunning' => $this->getJobTable()->getJobCountLast24HoursByStatus("C"), 'jobsBlocked' => $this->getJobTable()->getJobCountLast24HoursByStatus("B"), 'jobsRunning' => $this->getJobTable()->getJobCountLast24HoursByStatus("R"), @@ -43,8 +48,11 @@ public function indexAction() 'clientNum' => $this->getClientTable()->getClientNum(), 'poolNum' => $this->getPoolTable()->getPoolNum(), - 'volumeNum' => $this->getVolumeTable()->getVolumeNum(), + 'volumeNum' => $this->getMediaTable()->getMediaNum(), 'fileNum' => $this->getFileTable()->getFileNum(), + 'jobNum' => $this->getJobTable()->getJobNum(), + 'logNum' => $this->getLogTable()->getLogNum(), + 'filesetNum' => $this->getFilesetTable()->getFilesetNum(), ) ); @@ -80,14 +88,14 @@ public function getPoolTable() return $this->poolTable; } - public function getVolumeTable() + public function getMediaTable() { - if(!$this->volumeTable) + if(!$this->mediaTable) { $sm = $this->getServiceLocator(); - $this->volumeTable = $sm->get('Volume\Model\VolumeTable'); + $this->mediaTable = $sm->get('Media\Model\MediaTable'); } - return $this->volumeTable; + return $this->mediaTable; } public function getFileTable() @@ -100,5 +108,25 @@ public function getFileTable() return $this->fileTable; } + public function getLogTable() + { + if(!$this->logTable) + { + $sm = $this->getServiceLocator(); + $this->logTable = $sm->get('Log\Model\LogTable'); + } + return $this->logTable; + } + + public function getFilesetTable() + { + if(!$this->filesetTable) + { + $sm = $this->getServiceLocator(); + $this->filesetTable = $sm->get('Fileset\Model\FilesetTable'); + } + return $this->filesetTable; + } + } diff --git a/module/Dashboard/view/dashboard/dashboard/details.phtml b/module/Dashboard/view/dashboard/dashboard/details.phtml deleted file mode 100644 index e69de29b..00000000 diff --git a/module/Dashboard/view/dashboard/dashboard/index.phtml b/module/Dashboard/view/dashboard/dashboard/index.phtml index e61ffa9f..99ba60e7 100644 --- a/module/Dashboard/view/dashboard/dashboard/index.phtml +++ b/module/Dashboard/view/dashboard/dashboard/index.phtml @@ -5,6 +5,9 @@ $this->headTitle($title); ?> +

+
+ + +lastUnsuccessfulJobs) > 0) : ?> + +
+ +
+ +
+ +
+

translate('Unsuccessful jobs (last 24 hours)') ?>

+
+ +
+ +
ClientescapeHtml($client->name); ?> escapeHtml($client->uname); ?> escapeHtml($client->autoprune); ?>escapeHtml($client->fileretention); ?>escapeHtml($client->jobretention); ?>printRetention($client->fileretention) . " days"; ?>printRetention($client->jobretention) . " days"; ?>
+ + + + + + + + + + + + + + + lastUnsuccessfulJobs as $jobUnsuccess) : ?> + + + + + + + + + + + + + + + + + +
JobNameClientTypeLevelStartEndDurationStatusLog
escapeHtml($jobUnsuccess->jobid); ?>escapeHtml($jobSuccess->jobname); ?>escapeHtml($jobUnsuccess->clientname); ?>printJobType($jobUnsuccess->type); ?>printJobLevel($jobUnsuccess->level); ?>escapeHtml($jobUnsuccess->starttime); ?>escapeHtml($jobUnsuccess->endtime); ?>printJobDuration($jobUnsuccess->starttime, $jobUnsuccess->endtime); ?>printJobStatus($jobUnsuccess->jobstatus); ?>View
+ +
+ + + + + + + + + + + +lastSuccessfulJobs) > 0) : ?> + +
+ +
+ +
+ +
+

translate('Successful jobs (last 24 hours)') ?>

+
+ +
+ + + + + + + + + + + + + + + + + lastSuccessfulJobs as $jobSuccess) : ?> + + + + + + + + + + + + + + + + + +
JobNameClientTypeLevelStartEndDurationStatusLog
escapeHtml($jobSuccess->jobid); ?>escapeHtml($jobSuccess->jobname); ?>escapeHtml($jobSuccess->clientname); ?>printJobType($jobSuccess->type); ?>printJobLevel($jobSuccess->level); ?>escapeHtml($jobSuccess->starttime); ?>escapeHtml($jobSuccess->endtime); ?>printJobDuration($jobSuccess->starttime, $jobSuccess->endtime); ?>printJobStatus($jobSuccess->jobstatus); ?>View
+ +
+ +
+ +
+ +
+ + + +
-

translate('Last 24 hours job statistic') ?>

+

translate('Job statistic (last 24 hours)') ?>

- +
@@ -120,12 +245,12 @@ $this->headTitle($title);
-
RunningjobsRunning; ?>
Completed successfuljobsTerminated; ?>
Terminated with errorsjobsTerminatedWithErrors; ?>
- - - - - +
ClientsclientNum; ?>
FilesetsfilesetNum; ?>
PoolspoolNum; ?>
VolumesvolumeNum; ?>
Total JobsjobNum; ?>
+ + + + +
Total clientsclientNum; ?>
Total filesetsfilesetNum; ?>
Total poolspoolNum; ?>
Total volumesvolumeNum; ?>
Total jobsjobNum; ?>
Total filesfileNum; ?>
Total logslogNum; ?>
diff --git a/module/Director/src/Director/Controller/DirectorController.php b/module/Director/src/Director/Controller/DirectorController.php index 00b58ef6..d4a96a02 100644 --- a/module/Director/src/Director/Controller/DirectorController.php +++ b/module/Director/src/Director/Controller/DirectorController.php @@ -7,44 +7,167 @@ class DirectorController extends AbstractActionController { - protected $directorStatus = array(); + protected $directorOutput = array(); public function indexAction() { return new ViewModel(array( - 'directorStatus' => $this->getDirectorStatus(), + 'directorOutput' => $this->getDirectorStatus(), )); } + public function messagesAction() + { + return new ViewModel(array( + 'directorOutput' => $this->getDirectorMessages(), + )); + } + + public function schedulerAction() + { + return new ViewModel(array( + 'directorOutput' => $this->getDirectorSchedulerStatus(), + )); + } + + public function versionAction() + { + return new ViewModel(array( + 'directorOutput' => $this->getDirectorVersion(), + )); + } + public function getDirectorStatus() { - if(!$this->directorStatus) + + $descriptorspec = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "r") + ); + + $cwd = '/usr/sbin'; + $env = NULL; + + $process = proc_open('bconsole', $descriptorspec, $pipes, $cwd, $env); + + if(!is_resource($process)) + throw new \Exception("proc_open error"); + + if(is_resource($process)) + { + fwrite($pipes[0], 'status director'); + fclose($pipes[0]); + while(!feof($pipes[1])) { + array_push($this->directorOutput, fread($pipes[1],8192)); + } + fclose($pipes[1]); + } + + $return_value = proc_close($process); + + return $this->directorOutput; + + } + + public function getDirectorMessages() + { + + $descriptorspec = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "r") + ); + + $cwd = '/usr/sbin'; + $env = NULL; + + $process = proc_open('bconsole', $descriptorspec, $pipes, $cwd, $env); + + if(!is_resource($process)) + throw new \Exception("proc_open error"); + + if(is_resource($process)) + { + fwrite($pipes[0], 'messages'); + fclose($pipes[0]); + while(!feof($pipes[1])) { + array_push($this->directorOutput, fread($pipes[1],8192)); + } + fclose($pipes[1]); + } + + $return_value = proc_close($process); + + return $this->directorOutput; + + } + + public function getDirectorSchedulerStatus() + { + + $descriptorspec = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "r") + ); + + $cwd = '/usr/sbin'; + $env = NULL; + + $process = proc_open('bconsole', $descriptorspec, $pipes, $cwd, $env); + + if(!is_resource($process)) + throw new \Exception("proc_open error"); + + if(is_resource($process)) + { + fwrite($pipes[0], 'status scheduler'); + fclose($pipes[0]); + while(!feof($pipes[1])) { + array_push($this->directorOutput, fread($pipes[1],8192)); + } + fclose($pipes[1]); + } + + $return_value = proc_close($process); + + return $this->directorOutput; + + } + + public function getDirectorVersion() + { + + $descriptorspec = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "r") + ); + + $cwd = '/usr/sbin'; + $env = NULL; + + $process = proc_open('bconsole', $descriptorspec, $pipes, $cwd, $env); + + if(!is_resource($process)) + throw new \Exception("proc_open error"); + + if(is_resource($process)) { - $descriptorspec = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "r") - ); - $cwd = '/usr/sbin'; - $env = NULL; - - $process = proc_open('bconsole', $descriptorspec, $pipes, $cwd, $env); - - if(!is_resource($process)) - throw new \Exception("proc_open error"); - - if(is_resource($process)) - { - fwrite($pipes[0], 'status director'); - fclose($pipes[0]); - while(!feof($pipes[1])) { - array_push($this->directorStatus, fread($pipes[1],8192)); - } - fclose($pipes[1]); + fwrite($pipes[0], 'version'); + fclose($pipes[0]); + while(!feof($pipes[1])) { + array_push($this->directorOutput, fread($pipes[1],8192)); } - $return_value = proc_close($process); + fclose($pipes[1]); } - return $this->directorStatus; + + $return_value = proc_close($process); + + return $this->directorOutput; + } + } diff --git a/module/Director/view/director/director/index.phtml b/module/Director/view/director/director/index.phtml index e066fbea..10741f47 100644 --- a/module/Director/view/director/director/index.phtml +++ b/module/Director/view/director/director/index.phtml @@ -1,14 +1,48 @@ headTitle($title); ?> -
-
-directorStatus as $row) {
-    echo $row ."
"; - } -?> -
-
\ No newline at end of file +

+
+ +
+ + + +
+ +
+    
+    directorOutput as $row) {
+	echo $row ."
"; + } + ?> +
+
+ +
+ +
diff --git a/module/Director/view/director/director/messages.phtml b/module/Director/view/director/director/messages.phtml new file mode 100644 index 00000000..852dfdce --- /dev/null +++ b/module/Director/view/director/director/messages.phtml @@ -0,0 +1,48 @@ +headTitle($title); +?> + +

+
+ +
+ + + +
+ +
+    
+    directorOutput as $row) {
+	echo $row ."
"; + } + ?> +
+
+ +
+ +
diff --git a/module/Director/view/director/director/scheduler.phtml b/module/Director/view/director/director/scheduler.phtml new file mode 100644 index 00000000..36b405f6 --- /dev/null +++ b/module/Director/view/director/director/scheduler.phtml @@ -0,0 +1,48 @@ +headTitle($title); +?> + +

+
+ +
+ + + +
+ +
+    
+    directorOutput as $row) {
+	echo $row ."
"; + } + ?> +
+
+ +
+ +
diff --git a/module/Director/view/director/director/version.phtml b/module/Director/view/director/director/version.phtml new file mode 100644 index 00000000..9692971f --- /dev/null +++ b/module/Director/view/director/director/version.phtml @@ -0,0 +1,48 @@ +headTitle($title); +?> + +

+
+ +
+ + + +
+ +
+    
+    directorOutput as $row) {
+	echo $row ."
"; + } + ?> +
+
+ +
+ +
diff --git a/module/File/view/file/file/index.phtml b/module/File/view/file/file/index.phtml index 25bced37..d8a9e495 100644 --- a/module/File/view/file/file/index.phtml +++ b/module/File/view/file/file/index.phtml @@ -5,7 +5,10 @@ $this->headTitle($title); ?> - +

+
+ +
diff --git a/module/File/view/file/file/jobid.phtml b/module/File/view/file/file/jobid.phtml index 33d8fcfc..09c64576 100644 --- a/module/File/view/file/file/jobid.phtml +++ b/module/File/view/file/file/jobid.phtml @@ -1,11 +1,14 @@ headTitle($title); ?> -
File ID
+

+
+ +
diff --git a/module/File/view/file/file/revisions.phtml b/module/File/view/file/file/revisions.phtml index a8143662..ff3a8c7a 100644 --- a/module/File/view/file/file/revisions.phtml +++ b/module/File/view/file/file/revisions.phtml @@ -1 +1,9 @@ -headTitle($title); + +?> + +

+
\ No newline at end of file diff --git a/module/Fileset/Module.php b/module/Fileset/Module.php new file mode 100644 index 00000000..e0a8c3ef --- /dev/null +++ b/module/Fileset/Module.php @@ -0,0 +1,52 @@ + array( + __DIR__ . '/autoload_classmap.php', + ), + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, + ), + ), + ); + } + + public function getConfig() + { + return include __DIR__ . '/config/module.config.php'; + } + + public function getServiceConfig() + { + return array( + 'factories' => array( + 'Fileset\Model\FilesetTable' => function($sm) { + $tableGateway = $sm->get('FilesetTableGateway'); + $table = new FilesetTable($tableGateway); + return $table; + }, + 'FilesetTableGateway' => function($sm) { + $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); + $resultSetPrototype = new ResultSet(); + $resultSetPrototype->setArrayObjectPrototype(new Fileset()); + return new TableGateway('fileset', $dbAdapter, null, $resultSetPrototype); + }, + ), + ); + } + +} + diff --git a/module/Volume/autoload_classmap.php b/module/Fileset/autoload_classmap.php similarity index 100% rename from module/Volume/autoload_classmap.php rename to module/Fileset/autoload_classmap.php diff --git a/module/Fileset/config/module.config.php b/module/Fileset/config/module.config.php new file mode 100644 index 00000000..0a736166 --- /dev/null +++ b/module/Fileset/config/module.config.php @@ -0,0 +1,37 @@ + array( + 'invokables' => array( + 'Fileset\Controller\Fileset' => 'Fileset\Controller\FilesetController', + ), + ), + + 'router' => array( + 'routes' => array( + 'fileset' => array( + 'type' => 'segment', + 'options' => array( + 'route' => '/fileset[/][:action][/:id]', + 'constraints' => array( + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'id' => '[0-9]+', + ), + 'defaults' => array( + 'controller' => 'Fileset\Controller\Fileset', + 'action' => 'index', + ), + ), + + ), + ), + ), + + 'view_manager' => array( + 'template_path_stack' => array( + 'fileset' => __DIR__ . '/../view', + ), + ), + +); diff --git a/module/Fileset/src/Fileset/Controller/FilesetController.php b/module/Fileset/src/Fileset/Controller/FilesetController.php new file mode 100644 index 00000000..dcd60984 --- /dev/null +++ b/module/Fileset/src/Fileset/Controller/FilesetController.php @@ -0,0 +1,37 @@ + $this->getFilesetTable()->fetchAll(), + ) + ); + } + + public function detailsAction() + { + + } + + public function getFilesetTable() + { + if(!$this->filesetTable) { + $sm = $this->getServiceLocator(); + $this->filesetTable = $sm->get('Fileset\Model\FilesetTable'); + } + return $this->filesetTable; + } + +} + diff --git a/module/Fileset/src/Fileset/Model/Fileset.php b/module/Fileset/src/Fileset/Model/Fileset.php new file mode 100644 index 00000000..15bd630e --- /dev/null +++ b/module/Fileset/src/Fileset/Model/Fileset.php @@ -0,0 +1,22 @@ +filesetid = (!empty($data['filesetid'])) ? $data['filesetid'] : null; + $this->fileset = (!empty($data['fileset'])) ? $data['fileset'] : null; + $this->md5 = (!empty($data['md5'])) ? $data['md5'] : null; + $this->createtime = (!empty($data['createtime'])) ? $data['createtime'] : null; + } + +} + diff --git a/module/Fileset/src/Fileset/Model/FilesetTable.php b/module/Fileset/src/Fileset/Model/FilesetTable.php new file mode 100644 index 00000000..2250af46 --- /dev/null +++ b/module/Fileset/src/Fileset/Model/FilesetTable.php @@ -0,0 +1,53 @@ +tableGateway = $tableGateway; + } + + public function fetchAll() + { + $resultSet = $this->tableGateway->select(); + return $resultSet; + } + + public function getFileset($id) + { + $id = (int) $id; + $rowset = $this->tableGateway->select(array('id' => $id)); + $row = $rowset->current(); + if(!$row) { + throw new \Exception("Could not find row $id"); + } + return $row; + } + + public function getFilesetNum() + { + $select = new Select(); + $select->from('fileset'); + $resultSetPrototype = new ResultSet(); + $resultSetPrototype->setArrayObjectPrototype(new Fileset()); + $rowset = new DbSelect( + $select, + $this->tableGateway->getAdapter(), + $resultSetPrototype + ); + $num = $rowset->count(); + return $num; + } + +} + diff --git a/module/Fileset/view/fileset/fileset/index.phtml b/module/Fileset/view/fileset/fileset/index.phtml new file mode 100644 index 00000000..16bfb23a --- /dev/null +++ b/module/Fileset/view/fileset/fileset/index.phtml @@ -0,0 +1,33 @@ +headTitle($title); + +?> + +

+
+ +
File ID
+ + + + + + + + + + + + + + + + + + + + + +
Fileset IDFileset NameMD5Createtime
escapeHtml($fileset->filesetid); ?>escapeHtml($fileset->fileset); ?>escapeHtml($fileset->md5); ?>escapeHtml($fileset->createtime); ?>
diff --git a/module/Job/src/Job/Model/JobTable.php b/module/Job/src/Job/Model/JobTable.php index cd828fe6..784ee923 100644 --- a/module/Job/src/Job/Model/JobTable.php +++ b/module/Job/src/Job/Model/JobTable.php @@ -42,7 +42,13 @@ public function fetchAll($paginated=false) public function getJob($jobid) { $jobid = (int) $jobid; - $rowset = $this->tableGateway->select(array('jobid' => $jobid)); + + $select = new Select(); + $select->from('job'); + $select->join('client', 'job.clientid = client.clientid', array('clientname' => 'name')); + $select->where('jobid =' . $jobid); + + $rowset = $this->tableGateway->selectWith($select); $row = $rowset->current(); if(!$row) { throw new \Exception("Could not find row $jobid"); @@ -50,6 +56,38 @@ public function getJob($jobid) return $row; } + public function getLast24HoursSuccessfulJobs() + { + $current_time = date("Y-m-d H:i:s",time()); + $back24h_time = date("Y-m-d H:i:s",time() - (60*60*23)); + + $select = new Select(); + $select->from('job'); + $select->join('client', 'job.clientid = client.clientid', array('clientname' => 'name')); + $select->order('job.jobid DESC'); + $select->where("jobstatus = 'T' AND starttime >= '" . $back24h_time . "' AND endtime >= '" . $back24h_time . "'"); + + $resultSet = $this->tableGateway->selectWith($select); + + return $resultSet; + } + + public function getLast24HoursUnsuccessfulJobs() + { + $current_time = date("Y-m-d H:i:s",time()); + $back24h_time = date("Y-m-d H:i:s",time() - (60*60*23)); + + $select = new Select(); + $select->from('job'); + $select->join('client', 'job.clientid = client.clientid', array('clientname' => 'name')); + $select->order('job.jobid DESC'); + $select->where("jobstatus != 'T' AND starttime >= '" . $back24h_time . "' AND endtime >= '" . $back24h_time . "'"); + + $resultSet = $this->tableGateway->selectWith($select); + + return $resultSet; + } + public function getJobCountLast24HoursByStatus($status) { $current_time = date("Y-m-d H:i:s",time()); @@ -155,4 +193,19 @@ public function getJobCountLast24HoursByStatus($status) return $num; } + public function getJobNum() + { + $select = new Select(); + $select->from('job'); + $resultSetPrototype = new ResultSet(); + $resultSetPrototype->setArrayObjectPrototype(new Job()); + $rowset = new DbSelect( + $select, + $this->tableGateway->getAdapter(), + $resultSetPrototype + ); + $num = $rowset->count(); + return $num; + } + } diff --git a/module/Job/view/job/job/details.phtml b/module/Job/view/job/job/details.phtml index 4f8f5e70..7b5d2bf1 100644 --- a/module/Job/view/job/job/details.phtml +++ b/module/Job/view/job/job/details.phtml @@ -1,11 +1,12 @@ headTitle($title); ?> -

Job escapeHtml($job->jobid); ?> details

+

+
diff --git a/module/Job/view/job/job/index.phtml b/module/Job/view/job/job/index.phtml index be6713cf..005df91d 100644 --- a/module/Job/view/job/job/index.phtml +++ b/module/Job/view/job/job/index.phtml @@ -5,6 +5,9 @@ $this->headTitle($title); ?> +

+
+ diff --git a/module/Log/src/Log/Controller/LogController.php b/module/Log/src/Log/Controller/LogController.php index b66ca93a..22aa26a0 100644 --- a/module/Log/src/Log/Controller/LogController.php +++ b/module/Log/src/Log/Controller/LogController.php @@ -15,7 +15,7 @@ public function indexAction() $paginator = $this->getLogTable()->fetchAll(true); $paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) ); - $paginator->setItemCountPerPage(5); + $paginator->setItemCountPerPage(10); return new ViewModel(array('paginator' => $paginator)); diff --git a/module/Log/src/Log/Model/LogTable.php b/module/Log/src/Log/Model/LogTable.php index 75b28927..95700d81 100644 --- a/module/Log/src/Log/Model/LogTable.php +++ b/module/Log/src/Log/Model/LogTable.php @@ -48,4 +48,19 @@ public function getLog($logid) return $row; } + public function getLogNum() + { + $select = new Select(); + $select->from('log'); + $resultSetPrototype = new ResultSet(); + $resultSetPrototype->setArrayObjectPrototype(new Log()); + $rowset = new DbSelect( + $select, + $this->tableGateway->getAdapter(), + $resultSetPrototype + ); + $num = $rowset->count(); + return $num; + } + } diff --git a/module/Log/view/log/log/details.phtml b/module/Log/view/log/log/details.phtml index 3f796133..1bc40cba 100644 --- a/module/Log/view/log/log/details.phtml +++ b/module/Log/view/log/log/details.phtml @@ -1,10 +1,13 @@ headTitle($title); ?> +

+
+
diff --git a/module/Log/view/log/log/index.phtml b/module/Log/view/log/log/index.phtml index 32bcf30c..a9aa64bd 100644 --- a/module/Log/view/log/log/index.phtml +++ b/module/Log/view/log/log/index.phtml @@ -5,24 +5,27 @@ $this->headTitle($title); ?> -
+

+
+ +
- - - - + + + + paginator as $log) : ?> - - - + + - + + diff --git a/module/Volume/Module.php b/module/Media/Module.php similarity index 63% rename from module/Volume/Module.php rename to module/Media/Module.php index 4cac3165..ad5b6c48 100644 --- a/module/Volume/Module.php +++ b/module/Media/Module.php @@ -1,9 +1,9 @@ array( - 'Volume\Model\VolumeTable' => function($sm) { - $tableGateway = $sm->get('VolumeTableGateway'); - $table = new VolumeTable($tableGateway); + 'Media\Model\MediaTable' => function($sm) { + $tableGateway = $sm->get('MediaTableGateway'); + $table = new MediaTable($tableGateway); return $table; }, - 'VolumeTableGateway' => function($sm) { + 'MediaTableGateway' => function($sm) { $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new ResultSet(); - $resultSetPrototype->setArrayObjectPrototype(new Volume()); - return new TableGateway('volume', $dbAdapter, null, $resultSetPrototype); + $resultSetPrototype->setArrayObjectPrototype(new Media()); + return new TableGateway('media', $dbAdapter, null, $resultSetPrototype); }, ), ); diff --git a/module/Media/autoload_classmap.php b/module/Media/autoload_classmap.php new file mode 100644 index 00000000..d5be5de2 --- /dev/null +++ b/module/Media/autoload_classmap.php @@ -0,0 +1,3 @@ + array( 'invokables' => array( - 'Volume\Controller\Volume' => 'Volume\Controller\VolumeController', + 'Media\Controller\Media' => 'Media\Controller\MediaController', ), ), 'router' => array( 'routes' => array( - 'volume' => array( + 'media' => array( 'type' => 'segment', 'options' => array( - 'route' => '/volume[/][:action][/:id]', + 'route' => '/media[/][:action][/:id]', 'constraints' => array( 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 'id' => '[0-9]+', ), 'defaults' => array( - 'controller' => 'Volume\Controller\Volume', + 'controller' => 'Media\Controller\Media', 'action' => 'index', ), ), @@ -30,7 +30,7 @@ 'view_manager' => array( 'template_path_stack' => array( - 'volume' => __DIR__ . '/../view', + 'media' => __DIR__ . '/../view', ), ), diff --git a/module/Media/src/Media/Controller/MediaController.php b/module/Media/src/Media/Controller/MediaController.php new file mode 100644 index 00000000..0e5e3e2b --- /dev/null +++ b/module/Media/src/Media/Controller/MediaController.php @@ -0,0 +1,44 @@ +getMediaTable()->fetchAll(true); + $paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) ); + $paginator->setItemCountPerPage(20); + + return new ViewModel(array('paginator' => $paginator)); + } + + public function detailsAction() + { + $id = (int) $this->params()->fromRoute('id', 0); + if (!$id) { + return $this->redirect()->toRoute('media'); + } + + return new ViewModel(array( + 'media' => $this->getMediaTable()->getMedia($id), + )); + } + + public function getMediaTable() + { + if(!$this->mediaTable) { + $sm = $this->getServiceLocator(); + $this->mediaTable = $sm->get('Media\Model\MediaTable'); + } + return $this->mediaTable; + } + +} + diff --git a/module/Media/src/Media/Model/Media.php b/module/Media/src/Media/Model/Media.php new file mode 100644 index 00000000..b9ee728a --- /dev/null +++ b/module/Media/src/Media/Model/Media.php @@ -0,0 +1,98 @@ +mediaid = (!empty($data['mediaid'])) ? $data['mediaid'] : null; + $this->volumename = (!empty($data['volumename'])) ? $data['volumename'] : null; + $this->slot = (!empty($data['slot'])) ? $data['slot'] : null; + $this->poolid = (!empty($data['poolid'])) ? $data['poolid'] : null; + $this->mediatype = (!empty($data['mediatype'])) ? $data['mediatype'] : null; + $this->mediatypeid = (!empty($data['mediatypeid'])) ? $data['mediatypeid'] : null; + $this->labeltype = (!empty($data['labeltype'])) ? $data['labeltype'] : null; + $this->firstwritten = (!empty($data['firstwritten'])) ? $data['firstwritten'] : null; + $this->lastwritten = (!empty($data['lastwritten'])) ? $data['lastwritten'] : null; + $this->labeldate = (!empty($data['labeldate'])) ? $data['labeldate'] : null; + $this->voljobs = (!empty($data['voljobs'])) ? $data['voljobs'] : null; + $this->volfiles = (!empty($data['volfiles'])) ? $data['volfiles'] : null; + $this->volblocks = (!empty($data['volblocks'])) ? $data['volblocks'] : null; + $this->volmounts = (!empty($data['volmounts'])) ? $data['volmounts'] : null; + $this->volbytes = (!empty($data['volbytes'])) ? $data['volbytes'] : null; + $this->volerrors = (!empty($data['volerrors'])) ? $data['volerrors'] : null; + $this->volwrites = (!empty($data['volwrites'])) ? $data['volwrites'] : null; + $this->volcapacitybytes = (!empty($data['volcapacitybytes'])) ? $data['volcapacitybytes'] : null; + $this->volstatus = (!empty($data['volstatus'])) ? $data['volstatus'] : null; + $this->enabled = (!empty($data['enabled'])) ? $data['enabled'] : null; + $this->recycle = (!empty($data['recycle'])) ? $data['recycle'] : null; + $this->actiononpurge = (!empty($data['actiononpurge'])) ? $data['actiononpurge'] : null; + $this->volretention = (!empty($data['volretention'])) ? $data['volretention'] : null; + $this->voluseduration = (!empty($data['voluseduration'])) ? $data['voluseduration'] : null; + $this->maxvoljobs = (!empty($data['maxvoljobs'])) ? $data['maxvoljobs'] : null; + $this->maxvolfiles = (!empty($data['maxvolfiles'])) ? $data['maxvolfiles'] : null; + $this->maxvolbytes = (!empty($data['maxvolbytes'])) ? $data['maxvolbytes'] : null; + $this->inchanger = (!empty($data['inchanger'])) ? $data['inchanger'] : null; + $this->storageid = (!empty($data['storageid'])) ? $data['storageid'] : null; + $this->deviceid = (!empty($data['deviceid'])) ? $data['deviceid'] : null; + $this->mediaaddressing = (!empty($data['mediaaddressing'])) ? $data['mediaaddressing'] : null; + $this->volreadtime = (!empty($data['volreadtime'])) ? $data['volreadtime'] : null; + $this->volwritetime = (!empty($data['volwritetime'])) ? $data['volwritetime'] : null; + $this->endfile = (!empty($data['endfile'])) ? $data['endfile'] : null; + $this->endblock = (!empty($data['endblock'])) ? $data['endblock'] : null; + $this->locationid = (!empty($data['locationid'])) ? $data['locationid'] : null; + $this->recyclecount = (!empty($data['recyclecount'])) ? $data['recyclecount'] : null; + $this->initialwrite = (!empty($data['initialwrite'])) ? $data['initialwrite'] : null; + $this->scratchpoolid = (!empty($data['scratchpoolid'])) ? $data['scratchpoolid'] : null; + $this->recyclepoolid = (!empty($data['recyclepoolid'])) ? $data['recyclepoolid'] : null; + $this->encryptionkey = (!empty($data['encryptionkey'])) ? $data['encryptionkey'] : null; + $this->comment = (!empty($data['comment'])) ? $data['comment'] : null; + } + +} + diff --git a/module/Volume/src/Volume/Model/VolumeTable.php b/module/Media/src/Media/Model/MediaTable.php similarity index 69% rename from module/Volume/src/Volume/Model/VolumeTable.php rename to module/Media/src/Media/Model/MediaTable.php index 18bc63d9..40d124ce 100644 --- a/module/Volume/src/Volume/Model/VolumeTable.php +++ b/module/Media/src/Media/Model/MediaTable.php @@ -1,6 +1,6 @@ order('mediaid ASC'); $resultSetPrototype = new ResultSet(); - $resultSetPrototype->setArrayObjectPrototype(new Volume()); + $resultSetPrototype->setArrayObjectPrototype(new Media()); $paginatorAdapter = new DbSelect( $select, $this->tableGateway->getAdapter(), @@ -38,17 +38,26 @@ public function fetchAll($paginated=false) return $resultSet; } - public function getVolume($id) + public function getMedia($id) { - + $mediaid = (int) $id; + + $select = new Select(); + $select->from('media'); + $select->where('mediaid = ' . $mediaid); + + $resultSet = $this->tableGateway->selectWith($select); + $row = $resultSet->current(); + + return $row; } - public function getVolumeNum() + public function getMediaNum() { $select = new Select(); $select->from('media'); $resultSetPrototype = new ResultSet(); - $resultSetPrototype->setArrayObjectPrototype(new Volume()); + $resultSetPrototype->setArrayObjectPrototype(new Media()); $rowset = new DbSelect( $select, $this->tableGateway->getAdapter(), diff --git a/module/Media/view/media/media/details.phtml b/module/Media/view/media/media/details.phtml new file mode 100644 index 00000000..3bac3642 --- /dev/null +++ b/module/Media/view/media/media/details.phtml @@ -0,0 +1,126 @@ +headTitle($title); + +?> + +

+
+ + + +
+ +
+ +
+ +
+

translate('Volume details') ?>

+
+ +
+ +
Log IDJob IDTimeTextLogTimestampMessageJob
escapeHtml($log->logid); ?>escapeHtml($log->jobid); ?>escapeHtml($log->time); ?>escapeHtml($log->logid); ?>escapeHtml($log->time); ?> escapeHtml($log->logtext); ?>escapeHtml($log->jobid); ?>
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Volume IDescapeHtml($media->mediaid); ?>
VolumenameescapeHtml($media->volumename); ?>
MediatypeescapeHtml($media->mediatype); ?>
Mediatype IDescapeHtml($media->mediatypeid); ?>
LabeltypeescapeHtml($media->labeltype); ?>
First writtenescapeHtml($media->firstwritten); ?>
Last writtenescapeHtml($media->lastwritten); ?>
Label dateescapeHtml($media->labeldate); ?>
Volume jobsescapeHtml($media->voljobs); ?>
Volume filesescapeHtml($media->volfiles); ?>
Volume blocksescapeHtml($media->volblocks); ?>
Volume mountsescapeHtml($media->volmounts); ?>
Volume used bytesprintBytes($media->volbytes); ?>
Volume errorsescapeHtml($media->volerrors); ?>
Volume writesescapeHtml($media->volwrites); ?>
Volume capacity bytesescapeHtml($media->volcapacitybytes); ?>
Volume StatusescapeHtml($media->volstatus); ?>
EnabledescapeHtml($media->enabled); ?>
RecycleescapeHtml($media->recycle); ?>
Action on purgeescapeHtml($media->actiononpurge); ?>
Volume retentionprintRetention($media->volretention) . " days"; ?>
Volume use durationescapeHtml($media->voluseduration); ?>
Volume maximum jobsescapeHtml($media->maxvoljobs); ?>
Volume maximum filesescapeHtml($media->maxvolfiles); ?>
Volume maximum bytesprintBytes($media->maxvolbytes); ?>
In changerescapeHtml($media->inchanger); ?>
Storage IDescapeHtml($media->storageid); ?>
Device IDescapeHtml($media->deviceid); ?>
Media addressingescapeHtml($media->mediaaddressing); ?>
Volume readtimeescapeHtml($media->volreadtime); ?>
Volume writetimeescapeHtml($media->volwritetime); ?>
EndfileescapeHtml($media->endfile); ?>
EndblockescapeHtml($media->endblock); ?>
Location IDescapeHtml($media->locationid); ?>
Recycle countescapeHtml($media->recyclecount); ?>
Initial writeescapeHtml($media->initialwrite); ?>
Scratchpool IDescapeHtml($media->scratchpoolid); ?>
Recyclepool IDescapeHtml($media->recyclepoolid); ?>
EncryptionkeyescapeHtml($media->encryptionkey); ?>
CommentescapeHtml($media->comment); ?>
+ +
+ +
+ +
+ +
+ +
+ +
+

translate('Volume usage') ?>

+
+ +
+ +
+ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/module/Volume/view/volume/volume/index.phtml b/module/Media/view/media/media/index.phtml similarity index 80% rename from module/Volume/view/volume/volume/index.phtml rename to module/Media/view/media/media/index.phtml index fc569f49..5a56e6b6 100644 --- a/module/Volume/view/volume/volume/index.phtml +++ b/module/Media/view/media/media/index.phtml @@ -5,7 +5,10 @@ $this->headTitle($title); ?> - +

+
+ +
@@ -25,7 +28,7 @@ $this->headTitle($title); - + @@ -48,7 +51,7 @@ echo $this->paginationControl( $this->paginator, 'Elastic', array('partial/paginator.phtml', 'Volume'), - array('route' => 'volume') + array('route' => 'media') ); ?> \ No newline at end of file diff --git a/module/Pool/src/Pool/Model/Pool.php b/module/Pool/src/Pool/Model/Pool.php index 7719560d..bd187c5d 100644 --- a/module/Pool/src/Pool/Model/Pool.php +++ b/module/Pool/src/Pool/Model/Pool.php @@ -7,13 +7,57 @@ class Pool public $poolid; public $name; + public $numvols; + public $maxvols; + public $useonce; + public $usecatalog; + public $acceptanyvolume; + public $volretention; + public $voluseduration; + public $maxvoljobs; + public $maxvolfiles; + public $maxvolbytes; + public $autoprune; + public $recycle; + public $actiononpurge; public $pooltype; + public $labeltype; + public $labelformat; + public $enabled; + public $scratchpoolid; + public $recyclepoolid; + public $nextpoolid; + public $migrationhighbytes; + public $migrationlowbytes; + public $migrationtime; public function exchangeArray($data) { $this->poolid = (!empty($data['poolid'])) ? $data['poolid'] : null; $this->name = (!empty($data['name'])) ? $data['name'] : null; + $this->numvols = (!empty($data['numvols'])) ? $data['numvols'] : null; + $this->maxvols = (!empty($data['maxvols'])) ? $data['maxvols'] : null; + $this->useonce = (!empty($data['useonce'])) ? $data['useonce'] : null; + $this->usecatalog = (!empty($data['usecatalog'])) ? $data['usecatalog'] : null; + $this->acceptanyvolume = (!empty($data['acceptanyvolume'])) ? $data['acceptanyvolume'] : null; + $this->volretention = (!empty($data['volretention'])) ? $data['volretention'] : null; + $this->voluseduration = (!empty($data['voluseduration'])) ? $data['voluseduration'] : null; + $this->maxvoljobs = (!empty($data['maxvoljobs'])) ? $data['maxvoljobs'] : null; + $this->maxvolfiles = (!empty($data['maxvolfiles'])) ? $data['maxvolfiles'] : null; + $this->maxvolbytes = (!empty($data['maxvolbytes'])) ? $data['maxvolbytes'] : null; + $this->autoprune = (!empty($data['autoprune'])) ? $data['autoprune'] : null; + $this->recycle = (!empty($data['recycle'])) ? $data['recycle'] : null; + $this->actiononpurge = (!empty($data['actiononpurge'])) ? $data['actiononpurge'] : null; $this->pooltype = (!empty($data['pooltype'])) ? $data['pooltype'] : null; + $this->labeltype = (!empty($data['labeltype'])) ? $data['labeltype'] : null; + $this->labelformat = (!empty($data['labelformat'])) ? $data['labelformat'] : null; + $this->enabled = (!empty($data['enabled'])) ? $data['enabled'] : null; + $this->scratchpoolid = (!empty($data['scratchpoolid'])) ? $data['scratchpoolid'] : null; + $this->recyclepoolid = (!empty($data['recyclepoolid'])) ? $data['recyclepoolid'] : null; + $this->nextpoolid = (!empty($data['nextpoolid'])) ? $data['nextpoolid'] : null; + $this->migrationhighbytes = (!empty($data['migrationhighbytes'])) ? $data['migrationhighbytes'] : null; + $this->migrationlowbytes = (!empty($data['migrationlowbytes'])) ? $data['migrationlowbytes'] : null; + $this->migrationtime = (!empty($data['migrationtime'])) ? $data['migrationtime'] : null; } } diff --git a/module/Pool/view/pool/pool/details.phtml b/module/Pool/view/pool/pool/details.phtml index e69de29b..0ae9bd0d 100644 --- a/module/Pool/view/pool/pool/details.phtml +++ b/module/Pool/view/pool/pool/details.phtml @@ -0,0 +1,9 @@ +headTitle($title); + +?> + +

+
\ No newline at end of file diff --git a/module/Pool/view/pool/pool/index.phtml b/module/Pool/view/pool/pool/index.phtml index 30266c64..eb9b7d0f 100644 --- a/module/Pool/view/pool/pool/index.phtml +++ b/module/Pool/view/pool/pool/index.phtml @@ -5,12 +5,23 @@ $this->headTitle($title); ?> -
Volume
escapeHtml($volume->mediaid); ?>escapeHtml($volume->mediaid); ?> escapeHtml($volume->volumename); ?> escapeHtml($volume->storageid); ?> escapeHtml($volume->mediatype); ?>
+

+
+ +
- - - + + + + + + + + + + + @@ -20,6 +31,12 @@ $this->headTitle($title); + + + + + + diff --git a/module/Storage/view/storage/storage/details.phtml b/module/Storage/view/storage/storage/details.phtml index e69de29b..0ac214d7 100644 --- a/module/Storage/view/storage/storage/details.phtml +++ b/module/Storage/view/storage/storage/details.phtml @@ -0,0 +1,9 @@ +headTitle($title); + +?> + +

+
\ No newline at end of file diff --git a/module/Storage/view/storage/storage/index.phtml b/module/Storage/view/storage/storage/index.phtml index 63ecfc7d..f755aa41 100644 --- a/module/Storage/view/storage/storage/index.phtml +++ b/module/Storage/view/storage/storage/index.phtml @@ -5,7 +5,10 @@ $this->headTitle($title); ?> -
IDNameTypePool IDPool namePool typeCurrent volume numberMaximum volume numberVolume retentionMaximum volume jobsMaximum volume filesMaximum volume bytes
escapeHtml($pool->poolid); ?> escapeHtml($pool->name); ?> escapeHtml($pool->pooltype); ?>escapeHtml($pool->numvols); ?>escapeHtml($pool->maxvols); ?>printRetention($pool->volretention) . " days"; ?>escapeHtml($pool->maxvoljobs); ?>escapeHtml($pool->maxvolfiles); ?>printBytes($pool->maxvolbytes); ?>
+

+
+ +
diff --git a/module/Volume/src/Volume/Controller/VolumeController.php b/module/Volume/src/Volume/Controller/VolumeController.php deleted file mode 100644 index bdc0eb79..00000000 --- a/module/Volume/src/Volume/Controller/VolumeController.php +++ /dev/null @@ -1,37 +0,0 @@ -getVolumeTable()->fetchAll(true); - $paginator->setCurrentPageNumber( (int) $this->params()->fromQuery('page', 1) ); - $paginator->setItemCountPerPage(20); - - return new ViewModel(array('paginator' => $paginator)); - } - - public function detailsAction() - { - - } - - public function getVolumeTable() - { - if(!$this->volumeTable) { - $sm = $this->getServiceLocator(); - $this->volumeTable = $sm->get('Volume\Model\VolumeTable'); - } - return $this->volumeTable; - } - -} - diff --git a/module/Volume/src/Volume/Model/Volume.php b/module/Volume/src/Volume/Model/Volume.php deleted file mode 100644 index 170e9aa9..00000000 --- a/module/Volume/src/Volume/Model/Volume.php +++ /dev/null @@ -1,32 +0,0 @@ -mediaid = (!empty($data['mediaid'])) ? $data['mediaid'] : null; - $this->volumename = (!empty($data['volumename'])) ? $data['volumename'] : null; - $this->mediatype = (!empty($data['mediatype'])) ? $data['mediatype'] : null; - $this->lastwritten = (!empty($data['lastwritten'])) ? $data['lastwritten'] : null; - $this->volstatus = (!empty($data['volstatus'])) ? $data['volstatus'] : null; - $this->volretention = (!empty($data['volretention'])) ? $data['volretention'] : null; - $this->volbytes = (!empty($data['volbytes'])) ? $data['volbytes'] : null; - $this->maxvolbytes = (!empty($data['maxvolbytes'])) ? $data['maxvolbytes'] : null; - $this->storageid = (!empty($data['storageid'])) ? $data['storageid'] : null; - } - -} - diff --git a/module/Volume/view/volume/volume/details.phtml b/module/Volume/view/volume/volume/details.phtml deleted file mode 100644 index 36c44ae4..00000000 --- a/module/Volume/view/volume/volume/details.phtml +++ /dev/null @@ -1,6 +0,0 @@ -headTitle($title); - -?>
ID