@@ -798,7 +798,7 @@ def __init__(self, parent=None, address=None, db=None, dbname="db", appicon=None
798798 self .TABLES [idx ]['label' ].setStyleSheet ('font-weight:600;' )
799799 self .TABLES [idx ]['label' ].setVisible (False )
800800 self .TABLES [idx ]['view' ].doubleClicked .connect (self ._cb_table_double_clicked )
801- self .TABLES [idx ]['view' ].selectionModel (). selectionChanged . connect (self ._cb_table_selection_changed )
801+ self .TABLES [idx ]['view' ].clicked . connect (self ._cb_table_clicked )
802802 self .TABLES [idx ]['view' ].installEventFilter (self )
803803
804804 self .TABLES [self .TAB_FIREWALL ]['view' ].rowsReordered .connect (self ._cb_fw_table_rows_reordered )
@@ -2013,27 +2013,42 @@ def _cb_main_table_double_clicked(self, row):
20132013 "{0}{1}" .format (Config .STATS_VIEW_DETAILS_COL_STATE , cur_idx )
20142014 )
20152015
2016- def _cb_table_selection_changed (self , selected , deselected ):
2016+ def _cb_table_clicked (self , idx ):
20172017 cur_idx = self .tabWidget .currentIndex ()
2018- if cur_idx == self .TAB_NODES :
2019- if not deselected .isEmpty ():
2020- self .LAST_SELECTED_ITEM = ""
2021- last_addr = deselected .indexes ()[self .COL_NODE ].data ()
2022- self ._unmonitor_deselected_node (last_addr )
2018+ if cur_idx != self .TAB_NODES :
2019+ return
20232020
2024- if not selected .isEmpty ():
2025- node_addr = selected .indexes ()[self .COL_NODE ].data ()
2026- if node_addr == self .LAST_SELECTED_ITEM :
2027- return
2028- self .LAST_SELECTED_ITEM = node_addr
2021+ try :
2022+ row = idx .row ()
2023+ model = idx .model ()
2024+ addr = model .index (row , self .COL_NODE ).data ()
2025+ uptime = model .index (row , self .COL_N_UPTIME ).data ()
2026+ host = model .index (row , self .COL_N_HOSTNAME ).data ()
2027+ node_version = model .index (row , self .COL_N_VERSION ).data ()
2028+ kernel = model .index (row , self .COL_N_KERNEL ).data ()
2029+
2030+ unmonitor = self .LAST_SELECTED_ITEM == addr or (self .LAST_SELECTED_ITEM != addr and self .LAST_SELECTED_ITEM != "" )
2031+ monitor = self .LAST_SELECTED_ITEM == "" or self .LAST_SELECTED_ITEM != addr
2032+ if unmonitor :
2033+ self ._unmonitor_deselected_node (self .LAST_SELECTED_ITEM )
2034+
2035+ if monitor :
20292036 self ._monitor_selected_node (
2030- node_addr ,
2031- selected . indexes ()[ self . COL_N_UPTIME ]. data () ,
2032- selected . indexes ()[ self . COL_N_HOSTNAME ]. data () ,
2033- selected . indexes ()[ self . COL_N_VERSION ]. data () ,
2034- selected . indexes ()[ self . COL_N_KERNEL ]. data ()
2037+ addr ,
2038+ uptime ,
2039+ host ,
2040+ node_version ,
2041+ kernel
20352042 )
20362043
2044+ if monitor :
2045+ self .LAST_SELECTED_ITEM = addr
2046+ else :
2047+ self .LAST_SELECTED_ITEM = ""
2048+
2049+ except Exception as e :
2050+ print ("[stats] exception monitoring node:" , e )
2051+
20372052 def _cb_table_double_clicked (self , row ):
20382053 cur_idx = self .tabWidget .currentIndex ()
20392054 if self .IN_DETAIL_VIEW [cur_idx ]:
@@ -2748,9 +2763,6 @@ def _set_events_query(self):
27482763 self .setQuery (model , qstr )
27492764
27502765 def _set_nodes_query (self , data ):
2751- if data != self .LAST_SELECTED_ITEM :
2752- self ._monitor_selected_node (data , "" , "" , "" , "" )
2753-
27542766 model = self ._get_active_table ().model ()
27552767 self .setQuery (model , "SELECT " \
27562768 "MAX(c.time) as {0}, " \
0 commit comments