static void _display_info_resv(List info_list, popup_info_t *popup_win) { specific_info_t *spec_info = popup_win->spec_info; char *name = (char *)spec_info->search_info->gchar_data; int found = 0; reserve_info_t *resv_ptr = NULL; GtkTreeView *treeview = NULL; ListIterator itr = NULL; sview_resv_info_t *sview_resv_info = NULL; int update = 0; int j = 0; if (!spec_info->search_info->gchar_data) { //info = xstrdup("No pointer given!"); goto finished; } need_refresh: if (!spec_info->display_widget) { treeview = create_treeview_2cols_attach_to_table( popup_win->table); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(treeview)); } else { treeview = GTK_TREE_VIEW(spec_info->display_widget); update = 1; } itr = list_iterator_create(info_list); while ((sview_resv_info = (sview_resv_info_t*) list_next(itr))) { resv_ptr = sview_resv_info->resv_ptr; if (!xstrcmp(resv_ptr->name, name)) { j=0; while (resv_ptr->node_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, resv_ptr->node_inx[j], resv_ptr->node_inx[j+1], sview_resv_info->color_inx, true, 0); j += 2; } _layout_resv_record(treeview, sview_resv_info, update); found = 1; break; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); if (!found) { if (!popup_win->not_found) { char *temp = "RESERVATION DOESN'T EXSIST\n"; GtkTreeIter iter; GtkTreeModel *model = NULL; /* only time this will be run so no update */ model = gtk_tree_view_get_model(treeview); add_display_treestore_line(0, GTK_TREE_STORE(model), &iter, temp, ""); } popup_win->not_found = true; } else { if (popup_win->not_found) { popup_win->not_found = false; gtk_widget_destroy(spec_info->display_widget); goto need_refresh; } } gtk_widget_show(spec_info->display_widget); finished: return; }
extern void get_info_resv(GtkTable *table, display_data_t *display_data) { int error_code = SLURM_SUCCESS; List info_list = NULL; static int view = -1; static reserve_info_msg_t *resv_info_ptr = NULL; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; static GtkWidget *display_widget = NULL; int j=0; ListIterator itr = NULL; sview_resv_info_t *sview_resv_info_ptr = NULL; reserve_info_t *resv_ptr = NULL; time_t now = time(NULL); GtkTreePath *path = NULL; static bool set_opts = false; if (!set_opts) set_page_opts(RESV_PAGE, display_data_resv, SORTID_CNT, _initial_page_opts); set_opts = true; /* reset */ if (!table && !display_data) { if (display_widget) gtk_widget_destroy(display_widget); display_widget = NULL; resv_info_ptr = NULL; goto reset_curs; } if (display_data) local_display_data = display_data; if (!table) { display_data_resv->set_menu = local_display_data->set_menu; goto reset_curs; } if (display_widget && toggled) { gtk_widget_destroy(display_widget); display_widget = NULL; goto display_it; } error_code = get_new_info_resv(&resv_info_ptr, force_refresh); if (error_code == SLURM_NO_CHANGE_IN_DATA) { } else if (error_code != SLURM_SUCCESS) { if (view == ERROR_VIEW) goto end_it; if (display_widget) gtk_widget_destroy(display_widget); view = ERROR_VIEW; sprintf(error_char, "slurm_load_reservations: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(table, label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(GTK_WIDGET(label)); goto end_it; } display_it: info_list = _create_resv_info_list(resv_info_ptr); if (!info_list) goto reset_curs; /* set up the grid */ if (display_widget && GTK_IS_TREE_VIEW(display_widget) && gtk_tree_selection_count_selected_rows( gtk_tree_view_get_selection( GTK_TREE_VIEW(display_widget)))) { GtkTreeViewColumn *focus_column = NULL; /* highlight the correct nodes from the last selection */ gtk_tree_view_get_cursor(GTK_TREE_VIEW(display_widget), &path, &focus_column); } if (!path) { itr = list_iterator_create(info_list); while ((sview_resv_info_ptr = list_next(itr))) { resv_ptr = sview_resv_info_ptr->resv_ptr; if ((resv_ptr->start_time > now) || (resv_ptr->end_time < now)) continue;/* only map current reservations */ j=0; while (resv_ptr->node_inx[j] >= 0) { change_grid_color(grid_button_list, resv_ptr->node_inx[j], resv_ptr->node_inx[j+1], sview_resv_info_ptr-> color_inx, true, 0); j += 2; } } list_iterator_destroy(itr); change_grid_color(grid_button_list, -1, -1, MAKE_WHITE, true, 0); } else { highlight_grid(GTK_TREE_VIEW(display_widget), SORTID_NODE_INX, SORTID_COLOR_INX, grid_button_list); gtk_tree_path_free(path); } if (view == ERROR_VIEW && display_widget) { gtk_widget_destroy(display_widget); display_widget = NULL; } if (!display_widget) { tree_view = create_treeview(local_display_data, &grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, display_data_resv, SORTID_CNT, SORTID_TIME_START, SORTID_COLOR); } view = INFO_VIEW; _update_info_resv(info_list, GTK_TREE_VIEW(display_widget)); end_it: toggled = false; force_refresh = false; reset_curs: if (main_window && main_window->window) gdk_window_set_cursor(main_window->window, NULL); return; }
extern void specific_info_resv(popup_info_t *popup_win) { int resv_error_code = SLURM_SUCCESS; static reserve_info_msg_t *resv_info_ptr = NULL; static reserve_info_t *resv_ptr = NULL; specific_info_t *spec_info = popup_win->spec_info; sview_search_info_t *search_info = spec_info->search_info; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; List resv_list = NULL; List send_resv_list = NULL; sview_resv_info_t *sview_resv_info_ptr = NULL; int j=0, i=-1; hostset_t hostset = NULL; ListIterator itr = NULL; if (!spec_info->display_widget) { setup_popup_info(popup_win, display_data_resv, SORTID_CNT); } if (spec_info->display_widget && popup_win->toggled) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; goto display_it; } if ((resv_error_code = get_new_info_resv(&resv_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if (!spec_info->display_widget || spec_info->view == ERROR_VIEW) goto display_it; } else if (resv_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "get_new_info_resv: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } display_it: resv_list = _create_resv_info_list(resv_info_ptr); if (!resv_list) return; if (spec_info->view == ERROR_VIEW && spec_info->display_widget) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; } if (spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, &popup_win->grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(popup_win->table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, popup_win->display_data, SORTID_CNT, SORTID_TIME_START, SORTID_COLOR); } setup_popup_grid_list(popup_win); spec_info->view = INFO_VIEW; if (spec_info->type == INFO_PAGE) { _display_info_resv(resv_list, popup_win); goto end_it; } /* just linking to another list, don't free the inside, just the list */ send_resv_list = list_create(NULL); itr = list_iterator_create(resv_list); i = -1; while ((sview_resv_info_ptr = list_next(itr))) { i++; resv_ptr = sview_resv_info_ptr->resv_ptr; switch(spec_info->type) { case PART_PAGE: case BLOCK_PAGE: case NODE_PAGE: if (!resv_ptr->node_list) continue; if (!(hostset = hostset_create( search_info->gchar_data))) continue; if (!hostset_intersects(hostset, resv_ptr->node_list)) { hostset_destroy(hostset); continue; } hostset_destroy(hostset); break; case JOB_PAGE: if (xstrcmp(resv_ptr->name, search_info->gchar_data)) continue; break; case RESV_PAGE: switch(search_info->search_type) { case SEARCH_RESERVATION_NAME: if (!search_info->gchar_data) continue; if (xstrcmp(resv_ptr->name, search_info->gchar_data)) continue; break; default: continue; } break; default: g_print("Unknown type %d\n", spec_info->type); continue; } list_push(send_resv_list, sview_resv_info_ptr); j=0; while (resv_ptr->node_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, resv_ptr->node_inx[j], resv_ptr->node_inx[j+1], sview_resv_info_ptr->color_inx, true, 0); j += 2; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); _update_info_resv(send_resv_list, GTK_TREE_VIEW(spec_info->display_widget)); FREE_NULL_LIST(send_resv_list); end_it: popup_win->toggled = 0; popup_win->force_refresh = 0; return; }
extern void get_info_bb(GtkTable *table, display_data_t *display_data) { int error_code = SLURM_SUCCESS; List info_list = NULL; static int view = -1; static burst_buffer_info_msg_t *bb_info_ptr = NULL; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; static GtkWidget *display_widget = NULL; GtkTreePath *path = NULL; static bool set_opts = FALSE; if (!set_opts) { set_page_opts(BB_PAGE, display_data_bb, SORTID_CNT, _initial_page_opts); } set_opts = TRUE; /* reset */ if (!table && !display_data) { if (display_widget) gtk_widget_destroy(display_widget); display_widget = NULL; bb_info_ptr = NULL; goto reset_curs; } if (display_data) local_display_data = display_data; if (!table) { display_data_bb->set_menu = local_display_data->set_menu; goto reset_curs; } if (display_widget && toggled) { gtk_widget_destroy(display_widget); display_widget = NULL; goto display_it; } error_code = get_new_info_bb(&bb_info_ptr, force_refresh); if (error_code == SLURM_NO_CHANGE_IN_DATA) { } else if (error_code != SLURM_SUCCESS) { if (view == ERROR_VIEW) goto end_it; if (display_widget) gtk_widget_destroy(display_widget); view = ERROR_VIEW; sprintf(error_char, "slurm_load_reservations: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(table, label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(GTK_WIDGET(label)); goto end_it; } display_it: info_list = _create_bb_info_list(bb_info_ptr); if (!info_list) { goto reset_curs; } /* set up the grid */ if (display_widget && GTK_IS_TREE_VIEW(display_widget) && gtk_tree_selection_count_selected_rows( gtk_tree_view_get_selection( GTK_TREE_VIEW(display_widget)))) { GtkTreeViewColumn *focus_column = NULL; /* highlight the correct nodes from the last selection */ gtk_tree_view_get_cursor(GTK_TREE_VIEW(display_widget), &path, &focus_column); } change_grid_color(grid_button_list, -1, -1, MAKE_WHITE, true, 0); if (view == ERROR_VIEW && display_widget) { gtk_widget_destroy(display_widget); display_widget = NULL; } if (!display_widget) { tree_view = create_treeview(local_display_data, &grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, display_data_bb, SORTID_CNT, SORTID_NAME, SORTID_COLOR); } view = INFO_VIEW; _update_info_bb(info_list, GTK_TREE_VIEW(display_widget)); end_it: toggled = FALSE; force_refresh = FALSE; reset_curs: if (main_window && main_window->window) gdk_window_set_cursor(main_window->window, NULL); return; }
extern void get_info_front_end(GtkTable *table, display_data_t *display_data) { int error_code = SLURM_SUCCESS; List info_list = NULL; static int view = -1; static front_end_info_msg_t *front_end_info_ptr = NULL; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; static GtkWidget *display_widget = NULL; int changed = 1, j; ListIterator itr = NULL; GtkTreePath *path = NULL; static bool set_opts = false; if (!set_opts) set_page_opts(FRONT_END_PAGE, display_data_front_end, SORTID_CNT, _initial_page_opts); set_opts = true; /* reset */ if (!table && !display_data) { if (display_widget) gtk_widget_destroy(display_widget); display_widget = NULL; front_end_info_ptr = NULL; goto reset_curs; } if (display_data) local_display_data = display_data; if (!table) { display_data_front_end->set_menu = local_display_data->set_menu; goto reset_curs; } if (cluster_flags & CLUSTER_FLAG_FED) { view = ERROR_VIEW; if (display_widget) gtk_widget_destroy(display_widget); label = gtk_label_new("Not available in a federated view"); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(label); goto end_it; } if (display_widget && toggled) { gtk_widget_destroy(display_widget); display_widget = NULL; goto display_it; } error_code = get_new_info_front_end(&front_end_info_ptr, force_refresh); if (error_code == SLURM_NO_CHANGE_IN_DATA) { changed = 0; } else if (error_code != SLURM_SUCCESS) { if (view == ERROR_VIEW) goto end_it; if (display_widget) gtk_widget_destroy(display_widget); view = ERROR_VIEW; sprintf(error_char, "slurm_load_front_end: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(table, label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(GTK_WIDGET(label)); goto end_it; } display_it: info_list = _create_front_end_info_list(front_end_info_ptr, changed); if (!info_list) goto reset_curs; /* set up the grid */ if (display_widget && GTK_IS_TREE_VIEW(display_widget) && gtk_tree_selection_count_selected_rows( gtk_tree_view_get_selection( GTK_TREE_VIEW(display_widget)))) { GtkTreeViewColumn *focus_column = NULL; /* highlight the correct nodes from the last selection */ gtk_tree_view_get_cursor(GTK_TREE_VIEW(display_widget), &path, &focus_column); } if (!path) { sview_front_end_info_t *fe_ptr; itr = list_iterator_create(info_list); while ((fe_ptr = list_next(itr))) { j = 0; while (fe_ptr->node_inx[j] >= 0) { change_grid_color(grid_button_list, fe_ptr->node_inx[j], fe_ptr->node_inx[j+1], fe_ptr->color_inx, true, 0); j += 2; } } list_iterator_destroy(itr); change_grid_color(grid_button_list, -1, -1, MAKE_WHITE, true, 0); } else { highlight_grid(GTK_TREE_VIEW(display_widget), SORTID_NODE_INX, SORTID_COLOR_INX, grid_button_list); gtk_tree_path_free(path); } if (view == ERROR_VIEW && display_widget) { gtk_widget_destroy(display_widget); display_widget = NULL; } if (!display_widget) { tree_view = create_treeview(local_display_data, &grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, display_data_front_end, SORTID_CNT, SORTID_NAME, SORTID_COLOR); } view = INFO_VIEW; _update_info_front_end(info_list, GTK_TREE_VIEW(display_widget)); end_it: toggled = false; force_refresh = false; reset_curs: if (main_window && main_window->window) gdk_window_set_cursor(main_window->window, NULL); return; }
void _display_info_block(List block_list, popup_info_t *popup_win) { specific_info_t *spec_info = popup_win->spec_info; char *name = (char *)spec_info->search_info->gchar_data; int j = 0, found = 0; sview_block_info_t *block_ptr = NULL; int update = 0; GtkTreeView *treeview = NULL; ListIterator itr = NULL; if (!spec_info->search_info->gchar_data) goto finished; need_refresh: if (!spec_info->display_widget) { treeview = create_treeview_2cols_attach_to_table( popup_win->table); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(treeview)); } else { treeview = GTK_TREE_VIEW(spec_info->display_widget); update = 1; } itr = list_iterator_create(block_list); while ((block_ptr = (sview_block_info_t*) list_next(itr))) { if (!xstrcmp(block_ptr->bg_block_name, name) || !xstrcmp(block_ptr->mp_str, name)) { /* we want to over ride any subgrp in error state */ enum node_states state = NODE_STATE_UNKNOWN; if (block_ptr->state & BG_BLOCK_ERROR_FLAG) state = NODE_STATE_ERROR; else if (list_count(block_ptr->job_list)) state = NODE_STATE_ALLOCATED; else state = NODE_STATE_IDLE; j = 0; while (block_ptr->mp_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, block_ptr->mp_inx[j], block_ptr->mp_inx[j+1], block_ptr->color_inx, true, state); j += 2; } _layout_block_record(treeview, block_ptr, update); found = 1; break; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); if (!found) { if (!popup_win->not_found) { char *temp = "BLOCK DOESN'T EXSIST\n"; GtkTreeIter iter; GtkTreeModel *model = NULL; /* only time this will be run so no update */ model = gtk_tree_view_get_model(treeview); add_display_treestore_line(0, GTK_TREE_STORE(model), &iter, temp, ""); } popup_win->not_found = true; } else { if (popup_win->not_found) { popup_win->not_found = false; gtk_widget_destroy(spec_info->display_widget); goto need_refresh; } } gtk_widget_show(spec_info->display_widget); finished: return; }
extern void specific_info_block(popup_info_t *popup_win) { int part_error_code = SLURM_SUCCESS; int block_error_code = SLURM_SUCCESS; static partition_info_msg_t *part_info_ptr = NULL; static block_info_msg_t *block_info_ptr = NULL; specific_info_t *spec_info = popup_win->spec_info; sview_search_info_t *search_info = spec_info->search_info; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; List block_list = NULL; List send_block_list = NULL; sview_block_info_t *block_ptr = NULL; int j=0, i=-1; hostset_t hostset = NULL; ListIterator itr = NULL; if (!spec_info->display_widget) { setup_popup_info(popup_win, display_data_block, SORTID_CNT); } if (spec_info->display_widget && popup_win->toggled) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; goto display_it; } if ((part_error_code = get_new_info_part(&part_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { } else if (part_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } if ((block_error_code = get_new_info_block(&block_info_ptr, popup_win->force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if ((!spec_info->display_widget || spec_info->view == ERROR_VIEW) || (part_error_code != SLURM_NO_CHANGE_IN_DATA)) { goto display_it; } } else if (block_error_code != SLURM_SUCCESS) { if (spec_info->view == ERROR_VIEW) goto end_it; spec_info->view = ERROR_VIEW; if (spec_info->display_widget) gtk_widget_destroy(spec_info->display_widget); sprintf(error_char, "slurm_load_block: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(popup_win->table, label, 0, 1, 0, 1); gtk_widget_show(label); spec_info->display_widget = gtk_widget_ref(label); goto end_it; } display_it: block_list = _create_block_list(part_info_ptr, block_info_ptr); if (!block_list) return; if (spec_info->view == ERROR_VIEW && spec_info->display_widget) { gtk_widget_destroy(spec_info->display_widget); spec_info->display_widget = NULL; } if (spec_info->type != INFO_PAGE && !spec_info->display_widget) { tree_view = create_treeview(local_display_data, &popup_win->grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); spec_info->display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(popup_win->table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, popup_win->display_data, SORTID_CNT, SORTID_BLOCK, SORTID_COLOR); } setup_popup_grid_list(popup_win); spec_info->view = INFO_VIEW; if (spec_info->type == INFO_PAGE) { _display_info_block(block_list, popup_win); goto end_it; } /* just linking to another list, don't free the inside, just the list */ send_block_list = list_create(NULL); itr = list_iterator_create(block_list); i = -1; while ((block_ptr = list_next(itr))) { /* we want to over ride any subgrp in error state */ enum node_states state = NODE_STATE_UNKNOWN; char *name = NULL; i++; switch(spec_info->type) { case PART_PAGE: if (xstrcmp(block_ptr->slurm_part_name, search_info->gchar_data)) continue; break; case RESV_PAGE: case NODE_PAGE: if (!block_ptr->mp_str) continue; if (!(hostset = hostset_create( search_info->gchar_data))) continue; name = block_ptr->mp_str; if (block_ptr->small_block) { int j=0; /* strip off the ionodes part */ while (name[j]) { if (name[j] == '[') { name[j] = '\0'; break; } j++; } } if (!hostset_intersects(hostset, name)) { hostset_destroy(hostset); continue; } hostset_destroy(hostset); break; case BLOCK_PAGE: switch(search_info->search_type) { case SEARCH_BLOCK_NAME: if (!search_info->gchar_data) continue; if (xstrcmp(block_ptr->bg_block_name, search_info->gchar_data)) continue; break; case SEARCH_BLOCK_SIZE: if (search_info->int_data == NO_VAL) continue; if (block_ptr->cnode_cnt != search_info->int_data) continue; break; case SEARCH_BLOCK_STATE: if (search_info->int_data == NO_VAL) continue; if (block_ptr->state != search_info->int_data) continue; break; default: continue; break; } break; case JOB_PAGE: if (xstrcmp(block_ptr->bg_block_name, search_info->gchar_data)) continue; break; default: g_print("Unknown type %d\n", spec_info->type); continue; } list_push(send_block_list, block_ptr); if (block_ptr->state & BG_BLOCK_ERROR_FLAG) state = NODE_STATE_ERROR; else if (list_count(block_ptr->job_list)) state = NODE_STATE_ALLOCATED; else state = NODE_STATE_IDLE; j=0; while (block_ptr->mp_inx[j] >= 0) { change_grid_color( popup_win->grid_button_list, block_ptr->mp_inx[j], block_ptr->mp_inx[j+1], block_ptr->color_inx, true, state); j += 2; } } list_iterator_destroy(itr); post_setup_popup_grid_list(popup_win); _update_info_block(send_block_list, GTK_TREE_VIEW(spec_info->display_widget)); FREE_NULL_LIST(send_block_list); end_it: popup_win->toggled = 0; popup_win->force_refresh = 0; return; }
extern void get_info_block(GtkTable *table, display_data_t *display_data) { int part_error_code = SLURM_SUCCESS; int block_error_code = SLURM_SUCCESS; static int view = -1; static partition_info_msg_t *part_info_ptr = NULL; static block_info_msg_t *block_ptr = NULL; char error_char[100]; GtkWidget *label = NULL; GtkTreeView *tree_view = NULL; static GtkWidget *display_widget = NULL; List block_list = NULL; int j=0; ListIterator itr = NULL; sview_block_info_t *sview_block_info_ptr = NULL; GtkTreePath *path = NULL; static bool set_opts = FALSE; if (!set_opts) set_page_opts(BLOCK_PAGE, display_data_block, SORTID_CNT, _initial_page_opts); set_opts = TRUE; /* reset */ if (!table && !display_data) { if (display_widget) gtk_widget_destroy(display_widget); display_widget = NULL; part_info_ptr = NULL; block_ptr = NULL; goto reset_curs; } if (display_data) local_display_data = display_data; if (!table) { display_data_block->set_menu = local_display_data->set_menu; goto reset_curs; } if (display_widget && toggled) { gtk_widget_destroy(display_widget); display_widget = NULL; goto display_it; } if ((part_error_code = get_new_info_part(&part_info_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { } else if (part_error_code != SLURM_SUCCESS) { if (view == ERROR_VIEW) goto end_it; view = ERROR_VIEW; if (display_widget) gtk_widget_destroy(display_widget); sprintf(error_char, "slurm_load_partitions: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(label); goto end_it; } if ((block_error_code = get_new_info_block(&block_ptr, force_refresh)) == SLURM_NO_CHANGE_IN_DATA) { if ((!display_widget || view == ERROR_VIEW) || (part_error_code != SLURM_NO_CHANGE_IN_DATA)) { goto display_it; } } else if (block_error_code != SLURM_SUCCESS) { if (view == ERROR_VIEW) goto end_it; view = ERROR_VIEW; if (display_widget) gtk_widget_destroy(display_widget); sprintf(error_char, "slurm_load_block: %s", slurm_strerror(slurm_get_errno())); label = gtk_label_new(error_char); gtk_table_attach_defaults(table, label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(label); goto end_it; } display_it: if (!block_ptr) { view = ERROR_VIEW; if (display_widget) gtk_widget_destroy(display_widget); label = gtk_label_new("No blocks on non-Bluegene systems"); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); gtk_widget_show(label); display_widget = gtk_widget_ref(label); goto end_it; } if (!part_info_ptr) goto reset_curs; block_list = _create_block_list(part_info_ptr, block_ptr); if (!block_list) goto reset_curs; /* set up the grid */ if (display_widget && GTK_IS_TREE_VIEW(display_widget) && gtk_tree_selection_count_selected_rows( gtk_tree_view_get_selection( GTK_TREE_VIEW(display_widget)))) { GtkTreeViewColumn *focus_column = NULL; /* highlight the correct mp_str from the last selection */ gtk_tree_view_get_cursor(GTK_TREE_VIEW(display_widget), &path, &focus_column); } if (!path) { itr = list_iterator_create(block_list); while ((sview_block_info_ptr = list_next(itr))) { j=0; while (sview_block_info_ptr->mp_inx[j] >= 0) { change_grid_color( grid_button_list, sview_block_info_ptr->mp_inx[j], sview_block_info_ptr->mp_inx[j+1], sview_block_info_ptr->color_inx, true, 0); j += 2; } } list_iterator_destroy(itr); change_grid_color(grid_button_list, -1, -1, MAKE_WHITE, true, 0); } else { highlight_grid(GTK_TREE_VIEW(display_widget), SORTID_NODE_INX, SORTID_COLOR_INX, grid_button_list); gtk_tree_path_free(path); } if (view == ERROR_VIEW && display_widget) { gtk_widget_destroy(display_widget); display_widget = NULL; } if (!display_widget) { tree_view = create_treeview(local_display_data, &grid_button_list); gtk_tree_selection_set_mode( gtk_tree_view_get_selection(tree_view), GTK_SELECTION_MULTIPLE); display_widget = gtk_widget_ref(GTK_WIDGET(tree_view)); gtk_table_attach_defaults(table, GTK_WIDGET(tree_view), 0, 1, 0, 1); /* since this function sets the model of the tree_view to the treestore we don't really care about the return value */ create_treestore(tree_view, display_data_block, SORTID_CNT, SORTID_NODELIST, SORTID_COLOR); } view = INFO_VIEW; _update_info_block(block_list, GTK_TREE_VIEW(display_widget)); end_it: toggled = FALSE; force_refresh = FALSE; reset_curs: if (main_window && main_window->window) gdk_window_set_cursor(main_window->window, NULL); return; }