Added volume reporting, improved overall configuration view

This commit is contained in:
Deon George 2012-11-30 13:03:26 +11:00
parent 4b51fc2727
commit d0095bb159
12 changed files with 217 additions and 248 deletions

View File

@ -10,63 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_Domain extends Controller_TemplateDefault {
/**
* Default Index for Controller
*/
public function action_index() {
$do = ORM::factory('DOMAIN');
$output = '';
$output .= sprintf(_('This server has <b>%s</b> domains.'),$do->count_all());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($do->find_all() as $domain)
$select[$domain->DOMAIN_NAME] = $domain->DOMAIN_NAME;
$output .= Form::open('/domain/detail',array('id'=>'domain_detail'));
$output .= sprintf('%s: %s',_('Choose a domain to view'),Form::select('domain_name',$select,NULL,array('id'=>'domain_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>_('TSM Domains'),
'body'=>$output,
));
}
public function action_detail() {
$domain_name = $this->request->param('id');
if (is_null($domain_name) AND (empty($_POST['domain_name']) OR ! $domain_name = $_POST['domain_name'])) {
SystemMessage::add(array(
'title'=>_('DOMAIN_NAME is required'),
'type'=>'error',
'body'=>_('The domain name is required.'),
));
HTTP::redirect('domain');
}
$do = ORM::factory('DOMAIN',$domain_name);
if (! $do->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown DOMAIN_NAME'),
'type'=>'error',
'body'=>sprintf(_('The domain [%s] does not exist?.'),$domain_name),
));
HTTP::redirect('domain');
}
Block::add(array(
'title'=>sprintf(_('Node Information for Domain %s'),$do->DOMAIN_NAME),
'body'=>View::factory('domain/detail')->set('o',$do)
));
}
class Controller_Domain extends Controller_TemplateDefault_View {
protected $index_title = 'TSM Domains';
protected $detail_title = 'Information on Domain';
protected $orm = 'DOMAIN';
}
?>

View File

@ -10,63 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_Library extends Controller_TemplateDefault {
/**
* Default Index for Controller
*/
public function action_index() {
$lo = ORM::factory('LIBRARY');
$output = '';
$output .= sprintf(_('This server has <b>%s</b> libraries.'),$lo->count_all());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($lo->find_all() as $library)
$select[$library->LIBRARY_NAME] = $library->LIBRARY_NAME;
$output .= Form::open('/library/detail',array('id'=>'library_detail'));
$output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('library_name',$select,NULL,array('id'=>'library_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>_('TSM Libraries'),
'body'=>$output,
));
}
public function action_detail() {
$library = $this->request->param('id');
if (is_null($library) AND (empty($_POST['library_name']) OR ! $library = $_POST['library_name'])) {
SystemMessage::add(array(
'title'=>_('LIBRARY_NAME is required'),
'type'=>'error',
'body'=>_('The library pool name is required.'),
));
HTTP::redirect('library');
}
$lo = ORM::factory('LIBRARY',$library);
if (! $lo->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown LIBRARY_NAME'),
'type'=>'error',
'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library),
));
HTTP::redirect('library');
}
Block::add(array(
'title'=>sprintf(_('Library Information for %s'),$lo->LIBRARY_NAME),
'body'=>View::factory('library/detail')->set('o',$lo)
));
}
class Controller_Library extends Controller_TemplateDefault_View {
protected $index_title = 'TSM Libraries';
protected $detail_title = 'Information on Library';
protected $orm = 'LIBRARY';
}
?>

View File

@ -10,78 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_Node extends Controller_TemplateDefault {
/**
* Default Index for Controller
*/
public function action_index() {
$no = ORM::factory('NODE');
$output = '';
$output .= sprintf(_('This server has <b>%s</b> defined nodes.'),$no->count_all());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($no->find_all() as $node)
$select[$node->NODE_NAME] = $node->NODE_NAME;
$output .= Form::open('/node/detail',array('id'=>'node_detail'));
$output .= sprintf('%s: %s',_('Choose a node to view'),Form::select('node_name',$select,NULL,array('id'=>'node_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>_('TSM Nodes'),
'body'=>$output,
));
}
public function action_detail() {
$node_name = $this->request->param('id');
if (is_null($node_name) AND (empty($_POST['node_name']) OR ! $node_name = $_POST['node_name'])) {
SystemMessage::add(array(
'title'=>_('NODE_NAME is required'),
'type'=>'error',
'body'=>_('The node name is required.'),
));
HTTP::redirect('node');
}
$no = ORM::factory('NODE',$node_name);
if (! $no->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown NODE_NAME'),
'type'=>'error',
'body'=>sprintf(_('The node [%s] does not exist?.'),$node_name),
));
HTTP::redirect('node');
}
Block::add(array(
'title'=>sprintf('%s %s',_('Detailed Node Information for'),$no->NODE_NAME),
'body'=>View::factory('node/detail')->set('o',$no),
));
Block::add(array(
'title'=>_('Protected File System Information'),
'body'=>View::factory('node/filesystems')->set('o',$no),
));
Block::add(array(
'title'=>_('Sequential Volume Usage Information'),
'body'=>View::factory('node/volumes')->set('o',$no),
));
Block::add(array(
'title'=>_('Schedule Information'),
'body'=>View::factory('node/schedule')->set('o',$no),
));
}
class Controller_Node extends Controller_TemplateDefault_View {
protected $index_title = 'TSM Nodes';
protected $detail_title = 'Information on Node';
protected $orm = 'NODE';
}
?>

View File

@ -10,63 +10,9 @@
* @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 = $this->request->param('id');
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.'),
));
HTTP::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),
));
HTTP::redirect('stgpool');
}
Block::add(array(
'title'=>sprintf(_('Storage Pool Information for %s'),$so->STGPOOL_NAME),
'body'=>View::factory('stgpool/detail')->set('o',$so)
));
}
class Controller_Stgpool extends Controller_TemplateDefault_View {
protected $index_title = 'TSM Storage Pools';
protected $detail_title = 'Information on Storage Pool';
protected $orm = 'STGPOOL';
}
?>

View File

@ -10,7 +10,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
abstract class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
protected $auth_required = TRUE;
}
?>

View File

@ -0,0 +1,77 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides some default methods for viewing TSM objects
*
* @package PTA
* @category Controllers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
abstract class Controller_TemplateDefault_View extends Controller_TemplateDefault {
protected $index_title = '';
protected $detail_title = '';
protected $orm = '';
/**
* Default Index for Controller
*/
public function action_index() {
$o = ORM::factory($this->orm);
$output = '';
$output .= sprintf(_('This server has <b>%s</b> %s.'),$o->count_all(),$o->table_name());
$output .= '<br/>';
$output .= '<br/>';
$select = array();
$select[NULL] = '';
foreach ($o->find_all() as $oo)
$select[$oo->pk()] = $oo->pk();
$output .= Form::open(sprintf('%s/detail',strtolower($this->request->controller())),array('id'=>'object_detail'));
$output .= sprintf('%s: %s',_('Choose to view'),Form::select('object_name',$select,NULL,array('id'=>'object_name')));
$output .= Form::submit('form_submit',_('Go'));
$output .= Form::close();
Block::add(array(
'title'=>$this->index_title,
'body'=>$output,
));
}
public function action_detail() {
$object_name = $this->request->param('id');
if (is_null($object_name) AND (empty($_POST['object_name']) OR ! $object_name = $_POST['object_name'])) {
SystemMessage::add(array(
'title'=>_('Missing required data'),
'type'=>'error',
'body'=>sprintf(_('The %s is required.'),$o->primary_key()),
));
HTTP::redirect(strtolower($this->request->controller()));
}
$o = ORM::factory($this->orm,$object_name);
if (! $o->loaded()) {
SystemMessage::add(array(
'title'=>_('Unknown Entry'),
'type'=>'error',
'body'=>sprintf(_('The %s [%s] does not exist?.'),$o->table_name(),$object_name),
));
HTTP::redirect(strtolower($this->request->controller()));
}
Block::add(array(
'title'=>$this->detail_title,
'body'=>View::factory(sprintf('%s/detail',strtolower($this->request->controller())))->set('o',$o),
));
}
}
?>

View File

@ -63,6 +63,14 @@ class Controller_Tree extends lnApp_Controller_Tree {
'attr_href'=>URL::Site('stgpool'),
));
array_push($data,array(
'id'=>'volume',
'name'=>'Volume Info',
'state'=>'none',
'attr_id'=>'1',
'attr_href'=>URL::Site('volume'),
));
return parent::action_json($data);
}
}

View File

@ -0,0 +1,18 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides information on TSM Volumes.
*
* @package PTA
* @subpackage Volume
* @category Controllers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Controller_Volume extends Controller_TemplateDefault_View {
protected $index_title = 'TSM Volumes';
protected $detail_title = 'Information on Volume';
protected $orm = 'VOLUME';
}
?>

View File

@ -12,3 +12,6 @@
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/cloptset')->set('o',$o); ?></td>
</tr>
</table>
<?php echo View::factory('node/filesystems')->set('o',$o); ?>
<?php echo View::factory('node/volumes')->set('o',$o); ?>
<?php echo View::factory('node/schedule')->set('o',$o); ?>

View File

@ -0,0 +1,8 @@
<table width="100%">
<tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('volume/info')->set('o',$o); ?></td>
</tr>
<tr>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('volume/nodes')->set('o',$o); ?></td>
</tr>
</table>

View File

@ -0,0 +1,65 @@
<!-- $o = ORM::factory('VOLUME') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Volume Information</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td style="width: 40%;">Volume Name</td>
<td style="width: 60%;" class="data"><?php echo $o->display('VOLUME_NAME'); ?></td>
</tr>
<tr>
<td>Storage Pool</td>
<td class="data"><?php echo HTML::anchor('stgpool/detail'.$o->STGPOOL_NAME,$o->display('STGPOOL_NAME')); ?></td>
</tr>
<tr>
<td>Estimated Capacity</td>
<td class="data"><?php echo $o->display('EST_CAPACITY_MB'); ?></td>
</tr>
<tr>
<td>Utilisation</td>
<td class="data"><?php echo $o->display('PCT_UTILIZED'); ?></td>
</tr>
<tr>
<td>Status</td>
<td class="data"><?php echo $o->display('STATUS'); ?></td>
</tr>
<tr>
<td>Access</td>
<td class="data"><?php echo $o->display('ACCESS'); ?></td>
</tr>
<tr>
<td>Reclaimable</td>
<td class="data"><?php echo $o->display('PCT_RECLAIM'); ?></td>
</tr>
<tr>
<td>Scratch Volume</td>
<td class="data"><?php echo $o->display('SCRATCH'); ?></td>
</tr>
<tr>
<td>Times Mounted</td>
<td class="data"><?php echo $o->display('TIMES_MOUNTED'); ?></td>
</tr>
<tr>
<td>Write/Read Errors</td>
<td class="data"><?php printf('%s/%s',$o->display('WRITE_ERRORS'),$o->display('READ_ERRORS')); ?></td>
</tr>
<tr>
<td>Last Write</td>
<td class="data"><?php echo $o->display('LAST_WRITE_DATE'); ?></td>
</tr>
<tr>
<td>Last Read</td>
<td class="data"><?php echo $o->display('LAST_READ_DATE'); ?></td>
</tr>
<tr>
<td>Pending</td>
<td class="data"><?php echo $o->display('PENDING_DATE'); ?></td>
</tr>
<tr>
<td>Location</td>
<td class="data"><?php echo $o->display('LOCATION'); ?></td>
</tr>
</table>

View File

@ -0,0 +1,21 @@
<!-- $o = ORM::factory('VOLUME') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Nodes with Data on this Volume</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td>Node</td>
<td>Type</td>
<td>File Space</td>
</tr>
<?php $i=0; foreach ($o->VOLUMEUSAGE->find_all() as $oo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo HTML::anchor('node/detail/'.$oo->NODE_NAME,$oo->NODE_NAME); ?></td>
<td class="data"><?php echo $oo->display('COPY_TYPE'); ?></td>
<td class="data"><?php echo $oo->display('FILESPACE_NAME'); ?></td>
</tr>
<?php } ?>
</table>