]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: replace isinstance call with active_screen variable
authorJos Collin <jcollin@redhat.com>
Thu, 17 Nov 2022 09:09:05 +0000 (14:39 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 29 Mar 2023 08:52:43 +0000 (14:22 +0530)
Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit 7453fee020f8386aefa9bc59d88dcd009104cc69)

src/tools/cephfs/top/cephfs-top

index aabb228b6a8cae74f6400b23b76ce91d5e48e26e..f6bab537e3b5645255922c2e6ab6ce8be0a20594 100755 (executable)
@@ -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)