[icinga-checkins] icinga.org: icinga-core/test/ido: classic-ui: fixed Double-listed host dependencies in host extinfo.cgi #3295

git at icinga.org git at icinga.org
Wed Nov 28 15:58:20 CET 2012


Module: icinga-core
Branch: test/ido
Commit: bebee1a597210abdb72ee277364a1138afb618c1
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=bebee1a597210abdb72ee277364a1138afb618c1

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Fri Nov  9 15:30:41 2012 +0100

classic-ui: fixed Double-listed host dependencies in host extinfo.cgi #3295

refs: #3295
also added "+" to expand dependencies only if needed to.

---

 Changelog     |    1 +
 cgi/extinfo.c |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index 58a90ce..e940332 100644
--- a/Changelog
+++ b/Changelog
@@ -27,6 +27,7 @@ FIXES
 * install: drop unused daemon-init-readhat script (spec uses daemon-init) #3402 - MF
 
 * classic ui: fix cmd.cgi does not honor commandpipe location; overwrites from empty environment variable #3418 - MF
+* classic ui: fixed Double-listed host dependencies in host extinfo.cgi #3295 - RB
 
 CHANGES
 
diff --git a/cgi/extinfo.c b/cgi/extinfo.c
index fac3f7c..624a073 100644
--- a/cgi/extinfo.c
+++ b/cgi/extinfo.c
@@ -183,6 +183,7 @@ int main(void) {
 	service *temp_service = NULL;
 	servicegroup *temp_servicegroup = NULL;
 	servicedependency *temp_sd = NULL;
+	char *last_hd_hostname = "";
 	char *last_sd_svc_desc = "";
 	char *last_sd_hostname = "";
 	hostdependency *temp_hd = NULL;
@@ -464,17 +465,20 @@ int main(void) {
 				/* Host Dependencies */
 				found = FALSE;
 
-				printf("<DIV CLASS='data'>Host Dependencies</DIV><DIV CLASS='dataTitle'>");
+				printf("<DIV CLASS='data'>Host Dependencies ");
+				printf("<img id='expand_image_hd' src='%s%s' border=0 onClick=\"if (document.getElementById('host_dependencies').style.display == 'none') { document.getElementById('host_dependencies').style.display = ''; document.getElementById('host_dependencies_gap').style.display = 'none'; document.getElementById('expand_image_hd').src = '%s%s'; } else { document.getElementById('host_dependencies').style.display = 'none'; document.getElementById('host_dependencies_gap').style.display = ''; document.getElementById('expand_image_hd').src = '%s%s'; }\">", url_images_path, EXPAND_ICON, url_images_path, COLLAPSE_ICON, url_images_path, EXPAND_ICON);
+				printf("</DIV><DIV CLASS='dataTitle' id='host_dependencies_gap' style='display:;'> </DIV><DIV CLASS='dataTitle' id='host_dependencies' style='display:none;'>");
 
 				for (temp_hd = hostdependency_list; temp_hd != NULL; temp_hd = temp_hd->next) {
 
-					if (!strcmp(temp_hd->dependent_host_name, temp_host->name)) {
+					if (!strcmp(temp_hd->dependent_host_name, temp_host->name) && !strcmp(temp_hd->host_name, last_hd_hostname)) {
 						if (found == TRUE)
 							printf(", ");
 
 						printf("<A HREF='%s?type=%d&host=%s'>%s</A>\n", EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_hd->host_name), html_encode(temp_hd->host_name, FALSE));
 						found = TRUE;
 					}
+					last_hd_hostname = temp_hd->host_name;
 				}
 
 				if (found == FALSE)
@@ -516,7 +520,9 @@ int main(void) {
 				/* Service Dependencies */
 				found = FALSE;
 
-				printf("<DIV CLASS='data'>Service Dependencies</DIV><DIV CLASS='dataTitle'>");
+				printf("<DIV CLASS='data'>Service Dependencies ");
+				printf("<img id='expand_image_sd' src='%s%s' border=0 onClick=\"if (document.getElementById('service_dependencies').style.display == 'none') { document.getElementById('service_dependencies').style.display = ''; document.getElementById('service_dependencies_gap').style.display = 'none'; document.getElementById('expand_image_sd').src = '%s%s'; } else { document.getElementById('service_dependencies').style.display = 'none'; document.getElementById('service_dependencies_gap').style.display = ''; document.getElementById('expand_image_sd').src = '%s%s'; }\">", url_images_path, EXPAND_ICON, url_images_path, COLLAPSE_ICON, url_images_path, EXPAND_ICON);
+				printf("</DIV><DIV CLASS='dataTitle' id='service_dependencies_gap' style='display:;'> </DIV><DIV CLASS='dataTitle' id='service_dependencies' style='display:none;'>");
 
 				for (temp_sd = servicedependency_list; temp_sd != NULL; temp_sd = temp_sd->next) {
 





More information about the icinga-checkins mailing list