mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 00:24:40 +01:00
ui: display alert details by double-clicking on it
This commit is contained in:
parent
159494d1e2
commit
d9287bf601
1 changed files with 32 additions and 24 deletions
|
@ -1141,33 +1141,10 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
if action == _menu_delete:
|
||||
self._table_menu_delete(cur_idx, model, selection)
|
||||
elif action == _menu_view:
|
||||
text = ""
|
||||
for idx in selection:
|
||||
atime = model.index(idx.row(), self.COL_TIME).data()
|
||||
anode = model.index(idx.row(), self.COL_NODE).data()
|
||||
records = self._db.get_alert(atime, anode)
|
||||
if records != None and records.next() == False:
|
||||
return
|
||||
|
||||
inf = InfoWindow(self)
|
||||
text += text + """
|
||||
<b>{0}</b><br>
|
||||
<b>Node:</b> {1}<br>
|
||||
<b>Type:</b> {2} – <b>Severity:</b> {3}<br><br>
|
||||
<b>{4}</b><br><br>
|
||||
{5}
|
||||
|
||||
---
|
||||
""".format(
|
||||
records.value(AlertFields.Time),
|
||||
records.value(AlertFields.Node),
|
||||
records.value(AlertFields.Type),
|
||||
records.value(AlertFields.Priority),
|
||||
records.value(AlertFields.What),
|
||||
records.value(AlertFields.Body)
|
||||
)
|
||||
|
||||
inf.showHtml(text)
|
||||
self._display_alert_info(atime, anode)
|
||||
|
||||
elif action == _toClipboard:
|
||||
self._table_menu_export_clipboard(cur_idx, model, selection)
|
||||
|
@ -1709,6 +1686,11 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self._fw_dialog.load_rule(addr, uuid)
|
||||
return
|
||||
|
||||
elif cur_idx == self.TAB_RULES and self.alertsTable.isVisible():
|
||||
atime = row.model().index(row.row(), self.COL_TIME).data()
|
||||
anode = row.model().index(row.row(), self.COL_NODE).data()
|
||||
self._display_alert_info(atime, anode)
|
||||
return
|
||||
|
||||
self.IN_DETAIL_VIEW[cur_idx] = True
|
||||
self.LAST_SELECTED_ITEM = row.model().index(row.row(), self.COL_TIME).data()
|
||||
|
@ -1964,6 +1946,32 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
)
|
||||
)
|
||||
|
||||
def _display_alert_info(self, time, node):
|
||||
text = ""
|
||||
records = self._db.get_alert(time, node)
|
||||
if records != None and records.next() == False:
|
||||
return
|
||||
|
||||
inf = InfoWindow(self)
|
||||
text += text + """
|
||||
<b>{0}</b><br>
|
||||
<b>Node:</b> {1}<br>
|
||||
<b>Type:</b> {2} – <b>Severity:</b> {3}<br><br>
|
||||
<b>{4}</b><br><br>
|
||||
{5}
|
||||
|
||||
---
|
||||
""".format(
|
||||
records.value(AlertFields.Time),
|
||||
records.value(AlertFields.Node),
|
||||
records.value(AlertFields.Type),
|
||||
records.value(AlertFields.Priority),
|
||||
records.value(AlertFields.What),
|
||||
records.value(AlertFields.Body)
|
||||
)
|
||||
|
||||
inf.showHtml(text)
|
||||
|
||||
# must be called after setModel() or setQuery()
|
||||
def _show_columns(self):
|
||||
cols = self._cfg.getSettings(Config.STATS_SHOW_COLUMNS)
|
||||
|
|
Loading…
Add table
Reference in a new issue