From aa980cab7dde9df98466519b6d978fa0f11a4c78 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 9 Feb 2011 21:13:02 +0000
Subject: [PATCH] we have the sview node colors working as desired with
 topology/tree plugin

---
 src/sview/common.c    | 35 +++++++++++++-------------------
 src/sview/grid.c      |  7 ++-----
 src/sview/node_info.c | 47 +++----------------------------------------
 3 files changed, 19 insertions(+), 70 deletions(-)

diff --git a/src/sview/common.c b/src/sview/common.c
index e8edf8acd68..e405b5a5024 100644
--- a/src/sview/common.c
+++ b/src/sview/common.c
@@ -766,6 +766,7 @@ extern int get_topo_conf(void)
 	int i;
 	switch_record_bitmaps_t sw_nodes_bitmaps;
 	switch_record_bitmaps_t *sw_nodes_bitmaps_ptr;
+
 	if (TOPO_DEBUG)
 		g_print("get_topo_conf\n");
 
@@ -792,28 +793,20 @@ extern int get_topo_conf(void)
 	if (TOPO_DEBUG)
 		g_print("_display_topology,  record_count = %d\n",
 			g_topo_info_msg_ptr->record_count);
-	for (i=0; i < g_topo_info_msg_ptr->record_count;
+	for (i = 0; i < g_topo_info_msg_ptr->record_count;
 	     i++, sw_nodes_bitmaps_ptr++) {
-		if (g_topo_info_msg_ptr->topo_array[i].nodes) {
-			if (TOPO_DEBUG)
-				g_print("ptr->nodes =  %s \n",
-					g_topo_info_msg_ptr->
-					topo_array[i].nodes);
-			if (build_nodes_bitmap(
-				    g_topo_info_msg_ptr->topo_array[i].nodes,
-				    &sw_nodes_bitmaps_ptr->node_bitmap)) {
-				fatal("Invalid node name (%s) in switch "
-				      "config (%s)",
-				      g_topo_info_msg_ptr->topo_array[i].nodes,
-				      g_topo_info_msg_ptr->topo_array[i].name);
-				if (TOPO_DEBUG)
-					g_print("Invalid node name (%s) "
-						"in switch  %s \n",
-						g_topo_info_msg_ptr->
-						topo_array[i].nodes,
-						g_topo_info_msg_ptr->
-						topo_array[i].name);
-			}
+		if (!g_topo_info_msg_ptr->topo_array[i].nodes)
+			continue;
+		if (TOPO_DEBUG)  {
+			g_print("ptr->nodes =  %s \n",
+				g_topo_info_msg_ptr->topo_array[i].nodes);
+		}
+		if (build_nodes_bitmap(
+			    g_topo_info_msg_ptr->topo_array[i].nodes,
+			    &sw_nodes_bitmaps_ptr->node_bitmap)) {
+			g_print("Invalid node name (%s) in switch %s\n",
+				g_topo_info_msg_ptr->topo_array[i].nodes,
+				g_topo_info_msg_ptr->topo_array[i].name);
 		}
 	}
 
diff --git a/src/sview/grid.c b/src/sview/grid.c
index 9c52a54d3fe..953d5dcb4bd 100644
--- a/src/sview/grid.c
+++ b/src/sview/grid.c
@@ -447,8 +447,6 @@ static void _each_highlightd(GtkTreeModel *model,
 	return;
 }
 
-
-
 static void _each_highlight_selected(GtkTreeModel *model,
 				     GtkTreePath *path,
 				     GtkTreeIter *iter,
@@ -472,9 +470,8 @@ static void _each_highlight_selected(GtkTreeModel *model,
 		return;
 	itr = list_iterator_create(grid_foreach->button_list);
 	while ((grid_button = list_next(itr))) {
-		/*For multiple selections, need to retain all selected.
-		 *(previously this assumed only one selected).
-		 */
+		/* For multiple selections, need to retain all selected.
+		 * (previously this assumed only one selected). */
 		if (grid_button->inx != node_inx)
 			continue;
 		else if (GTK_WIDGET_STATE(grid_button->button)
diff --git a/src/sview/node_info.c b/src/sview/node_info.c
index ed279b04c69..56ad74a0b2b 100644
--- a/src/sview/node_info.c
+++ b/src/sview/node_info.c
@@ -395,34 +395,6 @@ static void _append_node_record(sview_node_info_t *sview_node_info,
 	_update_node_record(sview_node_info, treestore, iter);
 }
 
-static int _get_topo_color_ndx(int node_ndx)
-{
-	int i = 0;
-	int rdx = MAKE_TOPO_2;
-	switch_record_bitmaps_t *sw_nodes_bitmaps_ptr = g_switch_nodes_maps;
-
-	for (i=0; i<g_topo_info_msg_ptr->record_count;
-	     i++, sw_nodes_bitmaps_ptr++) {
-		if (g_topo_info_msg_ptr->topo_array[i].level)
-			continue;
-		if (bit_test(sw_nodes_bitmaps_ptr->node_bitmap, node_ndx)) {
-			rdx = i;
-			break;
-		}
-	}
-	if (rdx == MAKE_TOPO_2)
-		return rdx;
-//	if (rdx != _l_sw_color_ndx) {
-//		_l_sw_color_ndx = rdx;
-//		if (_l_topo_color_ndx == MAKE_TOPO_1)
-//			_l_topo_color_ndx = MAKE_TOPO_2;
-//		else
-//			_l_topo_color_ndx = MAKE_TOPO_1;
-//	}
-//	return _l_topo_color_ndx;
-	return MAKE_TOPO_1;
-}
-
 static void _update_info_node(List info_list, GtkTreeView *tree_view)
 {
 	GtkTreePath *path = gtk_tree_path_new_first();
@@ -803,7 +775,7 @@ extern int get_new_info_node(node_info_msg_t **info_ptr, int force)
 
 	if (!g_topo_info_msg_ptr &&
 	    default_sview_config.grid_topological) {
-		get_topo_conf(); /*pull in topology NOW*/
+		get_topo_conf(); /* pull in topology NOW */
 	}
 end_it:
 	return error_code;
@@ -1188,7 +1160,6 @@ extern void get_info_node(GtkTable *table, display_data_t *display_data)
 	List info_list = NULL;
 	int changed = 1;
 	int i = 0, sort_key;
-	int b_color_ndx;
 	sview_node_info_t *sview_node_info_ptr = NULL;
 	ListIterator itr = NULL;
 	GtkTreePath *path = NULL;
@@ -1254,26 +1225,14 @@ display_it:
 		gtk_tree_view_get_cursor(GTK_TREE_VIEW(display_widget),
 					 &path, &focus_column);
 	}
-	if (!path || working_sview_config.grid_topological) {
+	if (!path) {
 		int array_size = node_info_ptr->record_count;
 		int  *color_inx = xmalloc(sizeof(int) * array_size);
 		bool *color_set_flag = xmalloc(sizeof(bool) * array_size);
 		itr = list_iterator_create(info_list);
 		while ((sview_node_info_ptr = list_next(itr))) {
-			if (g_topo_info_msg_ptr) {
-				//derive topo_color
-				b_color_ndx = _get_topo_color_ndx(i);
-
-				if (b_color_ndx != MAKE_TOPO_2) {
-					/* node belongs to a switch */
-					if (sview_node_info_ptr->node_ptr->
-					    node_state != NODE_STATE_IDLE )
-						b_color_ndx = i;
-				}
-			} else
-				b_color_ndx = i;
 			color_set_flag[i] = true;
-			color_inx[i] = b_color_ndx;
+			color_inx[i] = i;
 			i++;
 		}
 		list_iterator_destroy(itr);
-- 
GitLab