diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-27 09:57:23 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-03-27 09:57:23 +0000 |
commit | fcc7e000961eadea77f27b2b5a7adbfd483ee81c (patch) | |
tree | 3c2e3882b613485dd590bed09606c0401fb3c3bf /frontends | |
parent | e121a9da67616bab13ba7b7f38d86b3e02391d71 (diff) | |
download | zabbix-fcc7e000961eadea77f27b2b5a7adbfd483ee81c.tar.gz zabbix-fcc7e000961eadea77f27b2b5a7adbfd483ee81c.tar.xz zabbix-fcc7e000961eadea77f27b2b5a7adbfd483ee81c.zip |
- [ZBX-255] added fullscreen mode to overview screen (Artem)
- applied patch: triggers with less priority do not overwrite previous (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5541 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/php/include/items.inc.php | 38 | ||||
-rw-r--r-- | frontends/php/include/triggers.inc.php | 34 | ||||
-rw-r--r-- | frontends/php/overview.php | 16 |
3 files changed, 62 insertions, 26 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index b78e3e9e..934e4cd9 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -910,21 +910,35 @@ COpt::profiling_start('prepare data'); unset($items); unset($hosts); - while($row = DBfetch($result)) - { + // get rid of warnings about $triggers undefined + $items = array(); + while($row = DBfetch($result)){ + $descr = item_description($row["description"],$row["key_"]); $row['host'] = get_node_name_by_elid($row['hostid']).$row['host']; $hosts[strtolower($row['host'])] = $row['host']; - $items[item_description($row["description"],$row["key_"])][$row['host']] = array( - 'itemid' => $row['itemid'], - 'value_type' => $row['value_type'], - 'lastvalue' => $row['lastvalue'], - 'units' => $row['units'], - 'description' => $row['description'], - 'valuemapid' => $row['valuemapid'], - 'severity' => $row['priority'], - 'tr_value' => $row['tr_value'], - 'triggerid' => $row['triggerid'] + + // A little tricky check for attempt to overwrite active trigger (value=1) with + // inactive or active trigger with lower priority. + $val = 0; + + if (array_key_exists($descr, $items) && array_key_exists($row['host'], $items[$descr])){ + $prio = $items[$descr][$row['host']]['severity']; + $val = $items[$descr][$row['host']]['tr_value']; + } + + if((TRIGGER_VALUE_FALSE == $val) || ((TRIGGER_VALUE_TRUE == $row['tr_value']) && ($prio<$row['priority']))){ + $items[$descr][$row['host']] = array( + 'itemid' => $row['itemid'], + 'value_type'=> $row['value_type'], + 'lastvalue' => $row['lastvalue'], + 'units' => $row['units'], + 'description'=> $row['description'], + 'valuemapid' => $row['valuemapid'], + 'severity' => $row['priority'], + 'tr_value' => $row['tr_value'], + 'triggerid' => $row['triggerid'] ); + } } if(!isset($hosts)) { diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php index e448e0f7..678f84dc 100644 --- a/frontends/php/include/triggers.inc.php +++ b/frontends/php/include/triggers.inc.php @@ -1785,21 +1785,35 @@ ' order by t.description'); unset($triggers); unset($hosts); - while($row = DBfetch($result)) - { + + $triggers = array(); + + while($row = DBfetch($result)){ $row['host'] = get_node_name_by_elid($row['hostid']).$row['host']; $row['description'] = expand_trigger_description_constants($row['description'], $row); $hosts[strtolower($row['host'])] = $row['host']; - $triggers[$row['description']][$row['host']] = array( - 'hostid' => $row['hostid'], - 'triggerid' => $row['triggerid'], - 'value' => $row['value'], - 'lastchange' => $row['lastchange'], - 'priority' => $row['priority']); + + // A little tricky check for attempt to overwrite active trigger (value=1) with + // inactive or active trigger with lower priority. + $val = TRIGGER_VALUE_FALSE; + + if (array_key_exists($row['description'], $triggers) && array_key_exists($row['host'], $triggers[$row['description']])){ + $prio = $triggers[$row['description']][$row['host']]['priority']; + $val = $triggers[$row['description']][$row['host']]['value']; + } + + if((TRIGGER_VALUE_FALSE == $val) || ((TRIGGER_VALUE_TRUE == $row['value']) && ($prio<$row['priority']))){ + $triggers[$row['description']][$row['host']] = array( + 'hostid' => $row['hostid'], + 'triggerid' => $row['triggerid'], + 'value' => $row['value'], + 'lastchange' => $row['lastchange'], + 'priority' => $row['priority']); + } } - if(!isset($hosts)) - { + + if(!isset($hosts)){ return $table; } ksort($hosts); diff --git a/frontends/php/overview.php b/frontends/php/overview.php index b31aa981..95774be9 100644 --- a/frontends/php/overview.php +++ b/frontends/php/overview.php @@ -28,6 +28,12 @@ $page["file"] = "overview.php"; $page['hist_arg'] = array('groupid','type'); define('ZBX_PAGE_DO_REFRESH', 1); + +$_REQUEST["fullscreen"] = get_request("fullscreen", 0); + +if($_REQUEST["fullscreen"]){ + define('ZBX_PAGE_NO_MENU', 1); +} include_once "include/page_header.php"; @@ -41,9 +47,10 @@ if(isset($_REQUEST["select"])&&($_REQUEST["select"]!="")) } // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields=array( - 'groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), - 'view_style'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL), - 'type'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL) + 'groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), + 'view_style'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL), + 'type'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL), + 'fullscreen'=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), NULL) ); check_fields($fields); @@ -121,7 +128,8 @@ if(isset($_REQUEST["select"])&&($_REQUEST["select"]!="")) } $help->SetHint($help_table); - show_table_header(array($help, S_OVERVIEW_BIG), $form); + + show_table_header(array($help, new Clink(S_OVERVIEW_BIG,'overview.php?fullscreen='.($_REQUEST['fullscreen']?'0':'1'))), $form); unset($help, $help_table, $form, $col); $form = new CForm(); |