Add Storage Pool Info

This commit is contained in:
Deon George
2011-06-23 17:03:41 +10:00
parent 35426141e5
commit 529d70d2bb
12 changed files with 314 additions and 33 deletions

View File

@@ -33,14 +33,6 @@ class Controller_DOMAIN extends Controller_TemplateDefault {
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Script::add(array(
'type'=>'stdin',
'data'=>'
$(document).ready(function () {$("#domain_name").change(function () {
$("#domain_name").trigger("submit");
});});'
));
Block::add(array(
'title'=>_('TSM Domains'),
'body'=>$output,

View File

@@ -33,14 +33,6 @@ class Controller_NODE extends Controller_TemplateDefault {
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Script::add(array(
'type'=>'stdin',
'data'=>'
$(document).ready(function () {$("#node_name").change(function () {
$("#node_detail").trigger("submit");
});});'
));
Block::add(array(
'title'=>_('TSM Nodes'),
'body'=>$output,
@@ -71,22 +63,22 @@ $(document).ready(function () {$("#node_name").change(function () {
Block::add(array(
'title'=>sprintf('%s %s',_('Detailed Node Information for'),$no->NODE_NAME),
'body'=>View::factory('nodes/detail')->set('node',$no),
'body'=>View::factory('node/detail')->set('node',$no),
));
Block::add(array(
'title'=>_('Protected File System Information'),
'body'=>View::factory('nodes/detail_filesystem')->set('node',$no),
'body'=>View::factory('node/detail_filesystem')->set('node',$no),
));
Block::add(array(
'title'=>_('Sequential Volume Usage Information'),
'body'=>View::factory('nodes/detail_volumes')->set('node',$no),
'body'=>View::factory('node/detail_volumes')->set('node',$no),
));
Block::add(array(
'title'=>_('Schedule Information'),
'body'=>View::factory('nodes/detail_schedule')->set('node',$no),
'body'=>View::factory('node/detail_schedule')->set('node',$no),
));
}
}

View File

@@ -0,0 +1,70 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides information on TSM Storage Pools.
*
* @package PTA
* @subpackage Storage Pools
* @category Controllers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_STGPOOL extends Controller_TemplateDefault {
/**
* Default Index for Controller
*/
public function action_index() {
$so = ORM::factory('stgpool');
$output = '';
$output .= sprintf(_('This server has <b>%s</b> stgpool pools.'),$so->count_all());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($so->find_all() as $stgpool)
$select[$stgpool->STGPOOL_NAME] = $stgpool->STGPOOL_NAME;
$output .= Form::open('/stgpool/detail',array('id'=>'stgpool_detail'));
$output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('stgpool_name',$select,NULL,array('id'=>'stgpool_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>_('TSM Storage Pools'),
'body'=>$output,
));
}
public function action_detail($stgpool=NULL) {
if (is_null($stgpool) AND (empty($_POST['stgpool_name']) OR ! $stgpool = $_POST['stgpool_name'])) {
SystemMessage::add(array(
'title'=>_('STGPOOL_NAME is required'),
'type'=>'error',
'body'=>_('The stgpool pool name is required.'),
));
Request::current()->redirect('stgpool');
}
$so = ORM::factory('stgpool',$stgpool);
if (! $so->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown STGPOOL_NAME'),
'type'=>'error',
'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool),
));
Request::current()->redirect('stgpool');
}
Block::add(array(
'title'=>sprintf(_('Storage Pool Information for %s'),$so->STGPOOL_NAME),
'body'=>View::factory('stgpool/detail')->set('so',$so)
));
}
}
?>

View File

@@ -47,6 +47,14 @@ class Controller_Tree extends Controller_lnApp_Tree {
'attr_href'=>URL::Site('server/gantt'),
));
array_push($data,array(
'id'=>'stgpool',
'name'=>'Storage Pool Info',
'state'=>'none',
'attr_id'=>'1',
'attr_href'=>URL::Site('stgpool'),
));
return parent::action_json($id,$data);
}
}

View File

@@ -19,5 +19,8 @@ class Model_STGPOOL extends ORMTSM {
protected $_has_one = array(
'DEVCLASSES'=>array('foreign_key'=>'DEVCLASS_NAME','far_key'=>'DEVCLASS'),
);
protected $_has_many = array(
'VOLUME'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
}
?>