2014-01-24 Sergio Martin <sergio.martin@artica.es>
* godmode/alerts/alert_list.list.php godmode/alerts/alert_view.php include/styles/pandora.css include/functions_alerts.php: Fix some bugs when doesnt exist an action with min-infinite situation. Some visual fixes git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9366 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f34f68dc4a
commit
65f80f18b2
|
@ -1,3 +1,12 @@
|
|||
2014-01-24 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/alerts/alert_list.list.php
|
||||
godmode/alerts/alert_view.php
|
||||
include/styles/pandora.css
|
||||
include/functions_alerts.php: Fix some bugs when
|
||||
doesnt exist an action with min-infinite situation.
|
||||
Some visual fixes
|
||||
|
||||
2014-01-23 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/alerts/alert_view.php
|
||||
|
|
|
@ -448,6 +448,7 @@ foreach ($simple_alerts as $alert) {
|
|||
if ($default_action != "") {
|
||||
$data[2] .= "<tr><td><ul class='action_list'><li>";
|
||||
$data[2] .= db_get_sql ("SELECT name FROM talert_actions WHERE id = $default_action") . ' <em>(' . __('Default') . ')</em>';
|
||||
$data[2] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
|
||||
$data[2] .= "</li></ul></td>";
|
||||
$data[2] .= "<td></td>";
|
||||
$data[2] .= "</tr>";
|
||||
|
|
|
@ -355,7 +355,12 @@ else {
|
|||
|
||||
if (count($table->head) <= count($action['escalation'])) {
|
||||
if ($k == count($action['escalation'])) {
|
||||
$table->head[$k] = '>#' . ($k-1);
|
||||
if($k == 1) {
|
||||
$table->head[$k] = __('Every time that the alert is fired');
|
||||
}
|
||||
else {
|
||||
$table->head[$k] = '>#' . ($k-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$table->head[$k] = '#' . $k;
|
||||
|
@ -372,7 +377,7 @@ else {
|
|||
$table->data[$kaction][$k+1] = human_time_description_raw ($action_threshold, true, 'tiny');
|
||||
}
|
||||
|
||||
$table->head[$k+1] = __('Threshold') . '<span style="float: right;">' . ui_print_help_icon ('action_threshold', true) . '</span>';
|
||||
$table->head[$k+1] = __('Threshold') . '<span style="float: right;">' . ui_print_help_icon ('action_threshold', true, '', 'images/header_help.png') . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1873,9 +1873,9 @@ function alerts_get_actions_escalation($actions, $default_action = 0) {
|
|||
|
||||
$default_escalation = alerts_get_default_action_escalation($default_action, $escalation);
|
||||
$escalation = array(0 => $default_escalation) + $escalation;
|
||||
|
||||
$escalation = alerts_normalize_actions_escalation($escalation);
|
||||
|
||||
$escalation = alerts_normalize_actions_escalation($escalation);
|
||||
|
||||
// Join the actions with the default action
|
||||
$actions = array(0 => $default_action) + $actions;
|
||||
|
||||
|
@ -1926,17 +1926,19 @@ function alerts_get_default_action_escalation($default_action, $escalation) {
|
|||
// Set to 1 the busy executions
|
||||
// Set to 2 the min - infinite situations
|
||||
foreach($busy_times as $k => $v) {
|
||||
if ($k == ($busy_greater_than + 1)) {
|
||||
$busy_times[$k] = 2;
|
||||
}
|
||||
else if ($k > ($busy_greater_than + 1)) {
|
||||
unset($busy_times[$k]);
|
||||
if ($busy_greater_than != -1) {
|
||||
if ($k == ($busy_greater_than + 1)) {
|
||||
$busy_times[$k] = 2;
|
||||
}
|
||||
else if ($k > ($busy_greater_than + 1)) {
|
||||
unset($busy_times[$k]);
|
||||
}
|
||||
}
|
||||
else if ($v > 1) {
|
||||
$busy_times[$k] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set as default execution the not busy times
|
||||
$default_escalation = array();
|
||||
foreach($busy_times as $k => $v) {
|
||||
|
@ -1949,7 +1951,7 @@ function alerts_get_default_action_escalation($default_action, $escalation) {
|
|||
break;
|
||||
case 1:
|
||||
$default_escalation[$k] = 0;
|
||||
$default_escalation[$k+1] = 2;
|
||||
$default_escalation[$k] = 2;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
|
@ -1967,6 +1969,17 @@ function alerts_get_default_action_escalation($default_action, $escalation) {
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($busy_times)) {
|
||||
if ($busy_greater_than == -1) {
|
||||
$default_escalation = 'everytime';
|
||||
}
|
||||
else {
|
||||
for($i=1;$i<=$busy_greater_than;$i++) {
|
||||
$default_escalation[$i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $default_escalation;
|
||||
}
|
||||
|
||||
|
@ -1982,12 +1995,12 @@ function alerts_normalize_actions_escalation($escalation) {
|
|||
$max_elements = 0;
|
||||
|
||||
foreach($escalation as $k => $v) {
|
||||
if (isset($v['greater_than'])) {
|
||||
if (is_array($v) && isset($v['greater_than'])) {
|
||||
$escalation[$k] = array();
|
||||
for($i=1;$i<=$v['greater_than'];$i++) {
|
||||
for($i=1;$i<$v['greater_than'];$i++) {
|
||||
$escalation[$k][$i] = 0;
|
||||
}
|
||||
$escalation[$k][$v['greater_than']+1] = 2;
|
||||
$escalation[$k][$v['greater_than']] = 2;
|
||||
}
|
||||
|
||||
$n = count($escalation[$k]);
|
||||
|
@ -1995,24 +2008,31 @@ function alerts_normalize_actions_escalation($escalation) {
|
|||
$max_elements = $n;
|
||||
}
|
||||
}
|
||||
|
||||
if ($max_elements == 1) {
|
||||
$nelements = $max_elements;
|
||||
}
|
||||
else {
|
||||
$nelements = $max_elements+1;
|
||||
}
|
||||
|
||||
foreach($escalation as $k => $v) {
|
||||
if ($v == 'always') {
|
||||
$escalation[$k] = array_fill(1, $max_elements, 1);
|
||||
$escalation[$k][$max_elements+1] = 1;
|
||||
if ($v == 'everytime') {
|
||||
$escalation[$k] = array_fill(1, $nelements, 1);
|
||||
$escalation[$k][$max_elements] = 2;
|
||||
}
|
||||
else if ($v == 'never') {
|
||||
$escalation[$k] = array_fill(1, ($max_elements), 0);
|
||||
$escalation[$k] = array_fill(1, $nelements, 0);
|
||||
}
|
||||
else {
|
||||
$fill_value = 0;
|
||||
for($i=1;$i<=($max_elements+1);$i++) {
|
||||
for($i=1;$i<=$nelements;$i++) {
|
||||
if (!isset($escalation[$k][$i])) {
|
||||
$escalation[$k][$i] = $fill_value;
|
||||
}
|
||||
else if ($escalation[$k][$i] == 2) {
|
||||
$fill_value = 1;
|
||||
$escalation[$k][$i] = $fill_value;
|
||||
$escalation[$k][$i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2834,7 +2834,7 @@ div#agent_wizard_subtabs {
|
|||
|
||||
/* Alert view */
|
||||
|
||||
table.alert_days th, table.alert_time th, table.alert_escalation th{
|
||||
table.alert_days th, table.alert_time th{
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue