From: Jos Collin Date: Thu, 17 Nov 2022 09:09:05 +0000 (+0530) Subject: cephfs-top: replace isinstance call with active_screen variable X-Git-Tag: v18.1.0~785^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7453fee020f8386aefa9bc59d88dcd009104cc69;p=ceph.git cephfs-top: replace isinstance call with active_screen variable Signed-off-by: Jos Collin --- diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 0920f12b0de9..70001d1e9cb9 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() @@ -818,7 +817,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" @@ -943,10 +942,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)