From f75079ab4704724e85fe7d0ea189ea4f2adbd24f Mon Sep 17 00:00:00 2001 From: crcro Date: Mon, 25 Dec 2017 00:46:12 +0200 Subject: [PATCH] fix alignment, removed redunant css classes, align layout with the rest (#7954) --- html/css/styles.css | 32 ---- html/pages/services.inc.php | 313 +++++++++++++++++++----------------- 2 files changed, 168 insertions(+), 177 deletions(-) diff --git a/html/css/styles.css b/html/css/styles.css index 7bddef7087..35acdd76d7 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -2157,40 +2157,8 @@ label { margin-right: 15px; } -.severity-ok { - color: green; -} - -.severity-info { - color: royalblue; -} - -.severity-notice { - color: gold; -} - -.severity-warning { - color: darkorange; -} - -.severity-critical { - color: red; -} - -.severity-unknown { - color: darkgrey; -} - .alert-status { display: inline-block; width: 7px; min-height: 27px; } - -.service-status { - width:10px; - height:50px; - display: block; - margin: 0; - border-radius: 0; -} diff --git a/html/pages/services.inc.php b/html/pages/services.inc.php index c266fbf613..07547e5ab5 100644 --- a/html/pages/services.inc.php +++ b/html/pages/services.inc.php @@ -1,185 +1,208 @@
-
- +
+
+ Services » -require_once 'includes/modal/delete_service.inc.php'; + 'Basic', + ); -echo "Services » "; -$menu_options = array( - 'basic' => 'Basic', -); + if (!$vars['view']) { + $vars['view'] = 'basic'; + } -if (!$vars['view']) { - $vars['view'] = 'basic'; -} + $status_options = array( + 'all' => 'All', + 'ok' => 'Ok', + 'warning' => 'Warning', + 'critical' => 'Critical', + ); -$status_options = array( - 'all' => 'All', - 'ok' => 'Ok', - 'warning' => 'Warning', - 'critical' => 'Critical', -); + if (!$vars['state']) { + $vars['state'] = 'all'; + } -if (!$vars['state']) { - $vars['state'] = 'all'; -} + // The menu option - on the left -// The menu option - on the left + $sep = ''; -$sep = ''; + foreach ($menu_options as $option => $text) { + if (empty($vars['view'])) { + $vars['view'] = $option; + } -foreach ($menu_options as $option => $text) { - if (empty($vars['view'])) { - $vars['view'] = $option; - } + echo $sep; + if ($vars['view'] == $option) { + echo ""; + } - echo $sep; - if ($vars['view'] == $option) { - echo ""; - } + echo generate_link($text, $vars, array( + 'view' => $option + )); + if ($vars['view'] == $option) { + echo ''; + } - echo generate_link($text, $vars, array( - 'view' => $option - )); - if ($vars['view'] == $option) { - echo ''; - } + $sep = ' | '; + } - $sep = ' | '; -} + unset($sep); -unset($sep); + // The status option - on the right -// The status option - on the right + echo '
'; + $sep = ''; -echo '
'; -$sep = ''; + foreach ($status_options as $option => $text) { + if (empty($vars['state'])) { + $vars['state'] = $option; + } -foreach ($status_options as $option => $text) { - if (empty($vars['state'])) { - $vars['state'] = $option; - } + echo $sep; + if ($vars['state'] == $option) { + echo ""; + } - echo $sep; - if ($vars['state'] == $option) { - echo ""; - } + echo generate_link($text, $vars, array( + 'state' => $option + )); + if ($vars['state'] == $option) { + echo ''; + } - echo generate_link($text, $vars, array( - 'state' => $option - )); - if ($vars['state'] == $option) { - echo ''; - } + $sep = ' | '; + } - $sep = ' | '; -} + unset($sep); + echo '
'; + echo '
'; + echo '
'; -unset($sep); -echo '
'; -print_optionbar_end(); -$sql_param = array(); + $sql_param = array(); -if (isset($vars['state'])) { - if ($vars['state'] == 'ok') { - $state = '0'; - } elseif ($vars['state'] == 'critical') { - $state = '2'; - } elseif ($vars['state'] == 'warning') { - $state = '1'; - } -} + if (isset($vars['state'])) { + if ($vars['state'] == 'ok') { + $state = '0'; + } elseif ($vars['state'] == 'critical') { + $state = '2'; + } elseif ($vars['state'] == 'warning') { + $state = '1'; + } + } -if (isset($state)) { - $where.= " AND service_status= ? AND service_disabled='0' AND `service_ignore`='0'"; - $sql_param[] = $state; -} -?> -
-= '5') { - $host_sql = 'SELECT `D`.`device_id`,`D`.`hostname`,`D`.`sysName` FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY `D`.`hostname`, `D`.`device_id` ORDER BY D.hostname'; - $host_par = array(); -} else { - $host_sql = 'SELECT `D`.`device_id`,`D`.`hostname`,`D`.`sysName` FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.device_id AND D.device_id = P.device_id AND P.user_id = ? GROUP BY `D`.`hostname`, `D`.`device_id` ORDER BY D.hostname'; - $host_par = array($_SESSION['user_id']); -} + if (isset($state)) { + $where .= " AND service_status= ? AND service_disabled='0' AND `service_ignore`='0'"; + $sql_param[] = $state; + } + ?> +
+ = '5') { + $host_sql = 'SELECT `D`.`device_id`,`D`.`hostname`,`D`.`sysName` FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY `D`.`hostname`, `D`.`device_id` ORDER BY D.hostname'; + $host_par = array(); + } else { + $host_sql = 'SELECT `D`.`device_id`,`D`.`hostname`,`D`.`sysName` FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.device_id AND D.device_id = P.device_id AND P.user_id = ? GROUP BY `D`.`hostname`, `D`.`device_id` ORDER BY D.hostname'; + $host_par = array($_SESSION['user_id']); + } -$shift = 1; -foreach (dbFetchRows($host_sql, $host_par) as $device) { - $device_id = $device['device_id']; - $device_hostname = $device['hostname']; - $device_sysName = $device['sysName']; - $devlink = generate_device_link($device, null, array('tab' => 'services')); - if ($shift == 1) { - array_unshift($sql_param, $device_id); - $shift = 0; - } else { - $sql_param[0] = $device_id; - } - $head=true; + $shift = 1; + foreach (dbFetchRows($host_sql, $host_par) as $device) { + $device_id = $device['device_id']; + $device_hostname = $device['hostname']; + $device_sysName = $device['sysName']; + $devlink = generate_device_link($device, null, array('tab' => 'services')); + if ($shift == 1) { + array_unshift($sql_param, $device_id); + $shift = 0; + } else { + $sql_param[0] = $device_id; + } + $head = true; - foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? $where ORDER BY service_type", $sql_param) as $service) { - if ($service['service_status'] == '2') { - $label = 'danger'; - $title = 'CRITICAL'; - } elseif ($service['service_status'] == '1') { - $label = 'warning'; - $title = 'WARNING'; - } elseif ($service['service_status'] == '0') { - $label = 'success'; - $title = 'OK'; - } else { - $label = 'info'; - $title = 'UNKNOWN'; - } - if ($head) { - echo ' + foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? $where ORDER BY service_type", $sql_param) as $service) { + if ($service['service_status'] == '2') { + $label = 'label-danger'; + $title = 'CRITICAL'; + } elseif ($service['service_status'] == '1') { + $label = 'label-warning'; + $title = 'WARNING'; + } elseif ($service['service_status'] == '0') { + $label = 'label-success'; + $title = 'OK'; + } else { + $label = 'label-info'; + $title = 'UNKNOWN'; + } + if ($head) { + echo '
-

'.$devlink.'

- '.$device_sysName.' +

' . $devlink . '

+ ' . $device_sysName . '
- - - - + + + + + + '; - } - $head=false; -?> - - - - - - - - "; -} -?> - - + + + + + + + + + + "; + } + ?> + + "; - unset($samehost); -}//end foreach -?> - - + echo "
ServiceLast ChangedMessageServiceLast ChangedDescriptionMessage
"; + unset($samehost); + }//end foreach + ?> +
+
+