spdk_top: fix display issues

Current issues:
-tab buttons do not show on app startup,
-interface not refreshing properly after closing help
 window

Fix for the first bullet point is to change color pair ID
from 2 to 10 (the colors WHITE and BLACK were swapped).

The new helper function has been added to remedy the problems
with refreshing interface after the pop-ups close. It is being
called after details windows and help window are closed.

Fixes: #2793

Change-Id: Ic91fc1ea8f858869c658b7803f6116fc4738aa63
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15655
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Krzysztof Karas 2022-11-25 11:31:14 +01:00 committed by Tomasz Zawadzki
parent 6cc23f29d7
commit 4b0b72c1a6

View File

@ -1172,7 +1172,7 @@ draw_tab_win(enum tabs tab)
uint16_t col; uint16_t col;
uint8_t white_spaces = TABS_SPACING * NUMBER_OF_TABS; uint8_t white_spaces = TABS_SPACING * NUMBER_OF_TABS;
wbkgd(g_tab_win[tab], COLOR_PAIR(2)); wbkgd(g_tab_win[tab], COLOR_PAIR(10));
box(g_tab_win[tab], 0, 0); box(g_tab_win[tab], 0, 0);
col = ((g_max_col - white_spaces) / NUMBER_OF_TABS / 2) - (strlen(g_tab_title[tab]) / 2) - col = ((g_max_col - white_spaces) / NUMBER_OF_TABS / 2) - (strlen(g_tab_title[tab]) / 2) -
@ -2972,6 +2972,31 @@ help_window_display(void)
} }
static void
refresh_after_popup(uint8_t active_tab, uint8_t *max_pages, uint8_t current_page)
{
int i;
/* After closing pop-up there would be unrefreshed parts
* of the tab, so this is to refresh them */
draw_tabs(active_tab, g_current_sort_col[active_tab], g_current_sort_col2[active_tab]);
pthread_mutex_lock(&g_thread_lock);
*max_pages = refresh_tab(active_tab, current_page);
pthread_mutex_unlock(&g_thread_lock);
top_panel(g_panels[active_tab]);
for (i = 0; i < NUMBER_OF_TABS; i++) {
wclear(g_tab_win[i]);
wresize(g_tab_win[i], TAB_WIN_HEIGHT,
(g_max_col - (TABS_SPACING * NUMBER_OF_TABS)) / NUMBER_OF_TABS);
mvwin(g_tab_win[i], TAB_WIN_LOCATION_ROW, 1 + (g_max_col / NUMBER_OF_TABS) * i);
draw_tab_win(i);
}
update_panels();
refresh();
}
static void static void
show_stats(pthread_t *data_thread) show_stats(pthread_t *data_thread)
{ {
@ -3088,20 +3113,13 @@ show_stats(pthread_t *data_thread)
} else if (active_tab == POLLERS_TAB) { } else if (active_tab == POLLERS_TAB) {
show_poller(current_page, active_tab); show_poller(current_page, active_tab);
} }
/* After closing pop-up there would be unrefreshed parts
* of the tab, so this is to refresh them */
draw_tabs(active_tab, g_current_sort_col[active_tab], g_current_sort_col2[active_tab]);
pthread_mutex_lock(&g_thread_lock);
max_pages = refresh_tab(active_tab, current_page);
pthread_mutex_unlock(&g_thread_lock);
snprintf(current_page_str, CURRENT_PAGE_STR_LEN - 1, "Page: %d/%d", current_page + 1, max_pages); snprintf(current_page_str, CURRENT_PAGE_STR_LEN - 1, "Page: %d/%d", current_page + 1, max_pages);
mvprintw(g_max_row - 1, 1, "%s", current_page_str); mvprintw(g_max_row - 1, 1, "%s", current_page_str);
top_panel(g_panels[active_tab]); refresh_after_popup(active_tab, &max_pages, current_page);
update_panels();
refresh();
break; break;
case 'h': case 'h':
help_window_display(); help_window_display();
refresh_after_popup(active_tab, &max_pages, current_page);
break; break;
default: default:
force_refresh = false; force_refresh = false;