Skip to content

Commit

Permalink
ui: allow to clear stats
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-iniguez-goya committed Oct 27, 2020
1 parent 9aa100f commit 832f4fd
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 5 deletions.
6 changes: 6 additions & 0 deletions ui/opensnitch/dialogs/stats.py
Expand Up @@ -251,6 +251,11 @@ def __init__(self, parent=None, address=None, db=None, dbname="db"):
self.comboAction.currentIndexChanged.connect(self._cb_combo_action_changed)
self.limitCombo.currentIndexChanged.connect(self._cb_limit_combo_changed)
self.cmdCleanSql.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanHosts.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanProcs.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanAddrs.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanPorts.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanUsers.clicked.connect(self._cb_clean_sql_clicked)
self.tabWidget.currentChanged.connect(self._cb_tab_changed)
self.delRuleButton.clicked.connect(self._cb_del_rule_clicked)
self.enableRuleCheck.clicked.connect(self._cb_enable_rule_toggled)
Expand Down Expand Up @@ -549,6 +554,7 @@ def _cb_combo_action_changed(self, idx):

def _cb_clean_sql_clicked(self):
self._db.clean(self.TABLES[self.tabWidget.currentIndex()]['name'])
self._refresh_active_table()

def _cb_cmd_back_clicked(self, idx):
cur_idx = self.tabWidget.currentIndex()
Expand Down
77 changes: 72 additions & 5 deletions ui/opensnitch/res/stats.ui
Expand Up @@ -425,6 +425,16 @@
<item>
<widget class="QLineEdit" name="hostsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanHosts">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -503,6 +513,16 @@
<item>
<widget class="QLineEdit" name="procsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanProcs">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -575,6 +595,16 @@
<item>
<widget class="QLineEdit" name="addrsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanAddrs">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -647,6 +677,16 @@
<item>
<widget class="QLineEdit" name="portsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanPorts">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -708,11 +748,38 @@
</layout>
</item>
<item>
<widget class="QLabel" name="tipUsersLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt;&quot;&gt;(double click to view details of an item)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="tipUsersLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt;&quot;&gt;(double click to view details of an item)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdCleanUsers">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableView" name="usersTable">
Expand Down

0 comments on commit 832f4fd

Please sign in to comment.