Added Node activity
This commit is contained in:
parent
7a3539cb95
commit
c9a1d39912
@ -15,5 +15,20 @@ class Model_ACTLOG extends ORM_TSM {
|
||||
protected $_sorting = array(
|
||||
'DATE_TIME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'DATE_TIME'=>array(
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
),
|
||||
);
|
||||
|
||||
private $_msgno_ba_objects = array(4952,4953,4954,4958,4960,4957,4970,4959,4982);
|
||||
private $_msgno_ba_bytes = array(4977,4975,4984,4198,4961);
|
||||
private $_msgno_ba_transfer = array(4963,4966,4967,4964);
|
||||
private $_msgno_ba_reduction = array(4968,4981,4976);
|
||||
|
||||
public function exclude_ba() {
|
||||
return $this->where('MSGNO','NOT IN',array_merge($this->_msgno_ba_objects,$this->_msgno_ba_bytes,$this->_msgno_ba_transfer,$this->_msgno_ba_reduction));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -20,6 +20,7 @@ class Model_NODE extends ORM_TSM {
|
||||
'DOMAIN'=>array('foreign_key'=>'DOMAIN_NAME','far_key'=>'DOMAIN_NAME'),
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'ACTLOG'=>array('foreign_key'=>'NODENAME','far_key'=>'NODE_NAME'),
|
||||
'FILESPACE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
|
||||
'ASSOCIATION'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
|
||||
@ -267,6 +268,25 @@ class Model_NODE extends ORM_TSM {
|
||||
return $this->vols_byctype($type) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
public function activity() {
|
||||
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||
|
||||
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
if (is_null($result = Cache::instance($c)->get($k))) {
|
||||
$result = array();
|
||||
|
||||
$result = $this->ACTLOG->exclude_ba()->find_all();
|
||||
|
||||
// @todo Cache time should be configurble
|
||||
Cache::instance($c)->set($k,$result,300);
|
||||
}
|
||||
|
||||
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BACKUP TYPES used by this NODE
|
||||
* ie: Bkup/Arch/SpMg
|
||||
@ -278,7 +298,7 @@ class Model_NODE extends ORM_TSM {
|
||||
$c = Kohana::$config->load('config')->cache;
|
||||
|
||||
if (is_null($result = Cache::instance($c)->get($k))) {
|
||||
$x = $result = array();
|
||||
$result = array();
|
||||
|
||||
foreach ($this->_occupancy() as $oo)
|
||||
if (! in_array($oo->TYPE,$result))
|
||||
|
@ -111,7 +111,6 @@ abstract class ORM_TSM extends ORM {
|
||||
private function isCacheable() {
|
||||
$config = Kohana::$config->load('database')->{Kohana::$config->load('config')->client_type};
|
||||
|
||||
//echo Debug::vars(array('m'=>__METHOD__,'cpl'=>$config['cachepreload'],'tn'=>$this->_table_name,'db'=>count($this->_db_pending),'pend'=>$this->_db_pending,'pk'=>$this->_primary_key));
|
||||
if ($config['caching'] AND isset($config['cachepreload'][$this->_table_name]) AND count($this->_db_pending) == 1 AND $this->_db_pending[0]['name'] == 'where' AND $this->_db_pending[0]['args'][0] == $this->_primary_key AND $this->_db_pending[0]['args'][1] == '=')
|
||||
return $config['cachepreload'][$this->_table_name];
|
||||
else
|
||||
|
23
application/views/node/activity.php
Normal file
23
application/views/node/activity.php
Normal file
@ -0,0 +1,23 @@
|
||||
<!-- $o = ORM::factory('NODE') -->
|
||||
<table class="box-full">
|
||||
<tr>
|
||||
<td class="head" colspan="2">Node Activity</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Schedule</td>
|
||||
<td>Session</td>
|
||||
<td>Message</td>
|
||||
</tr>
|
||||
<?php $i=0; foreach ($o->activity() as $ao) { ?>
|
||||
<tr>
|
||||
<td class="data"><?php echo $ao->DISPLAY('DATE_TIME'); ?>
|
||||
<td class="data"><?php echo $ao->DISPLAY('SCHEDNAME'); ?>
|
||||
<td class="data"><?php echo $ao->DISPLAY('SESSION'); ?>
|
||||
<td class="data"><?php echo $ao->DISPLAY('MESSAGE'); ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
@ -15,3 +15,4 @@
|
||||
<?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); ?>
|
||||
<?php echo View::factory('node/activity')->set('o',$o); ?>
|
||||
|
Reference in New Issue
Block a user