From 59dc33e6bdfbce57de8f3f6c69ae6ca1f0f199dc Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Thu, 17 Nov 2022 14:39:05 +0530 Subject: [PATCH] cephfs-top: replace isinstance call with active_screen variable Signed-off-by: Jos Collin (cherry picked from commit 7453fee020f8386aefa9bc59d88dcd009104cc69) --- src/tools/cephfs/top/cephfs-top | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index aabb228b6a8ca..f6bab537e3b56 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -160,7 +160,7 @@ class FSTop(object): def __init__(self, args): self.rados = None self.stdscr = None # curses instance - self.current_screen = "" + self.active_screen = "" self.client_name = args.id self.cluster_name = args.cluster self.conffile = args.conffile @@ -306,7 +306,7 @@ class FSTop(object): endmenu = True elif key == ord('q'): self.stdscr.erase() - if isinstance(current_states['last_fs'], list): + if self.active_screen == FS_TOP_ALL_FS_APP: self.run_all_display() else: self.run_display() @@ -346,20 +346,19 @@ class FSTop(object): curr_row1 += 1 elif key == curses.KEY_ENTER or key in [10, 13]: self.stdscr.erase() - last_fs = current_states["last_fs"] if curr_row1 != len(field_menu) - 1: current_states["last_field"] = (field_menu[curr_row1].split('='))[0] else: current_states["last_field"] = 'chit' self.header.erase() # erase the previous text - if isinstance(last_fs, list): + if self.active_screen == FS_TOP_ALL_FS_APP: self.run_all_display() else: self.run_display() endwhile = True elif key == ord('q'): self.stdscr.erase() - if isinstance(current_states['last_fs'], list): + if self.active_screen == FS_TOP_ALL_FS_APP: self.run_all_display() else: self.run_display() @@ -454,7 +453,7 @@ class FSTop(object): current_states["limit"] = key[:-1] self.stdscr.erase() self.header.erase() # erase the previous text - if isinstance(current_states['last_fs'], list): + if self.active_screen == FS_TOP_ALL_FS_APP: self.run_all_display() else: self.run_display() @@ -832,7 +831,7 @@ class FSTop(object): self.header.erase() self.fsstats.erase() - self.current_screen = FS_TOP_FS_SELECTED_APP + self.active_screen = FS_TOP_FS_SELECTED_APP screen_title = "Selected Filesystem Info" help_commands = "m - select a filesystem | s - sort menu | l - limit number of clients"\ " | r - reset to default | q - home (All Filesystem Info) screen" @@ -955,10 +954,10 @@ class FSTop(object): def run_all_display(self): # clear text from the previous screen - if self.current_screen == FS_TOP_FS_SELECTED_APP: + if self.active_screen == FS_TOP_FS_SELECTED_APP: self.header.erase() - self.current_screen = FS_TOP_ALL_FS_APP + self.active_screen = FS_TOP_ALL_FS_APP screen_title = "All Filesystem Info" curses.init_pair(2, curses.COLOR_CYAN, -1) -- 2.39.5