From 4499a5aaf050c30e445cd4fd363cb5bf10c2ad7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Wed, 15 Nov 2023 00:59:01 +0100 Subject: [PATCH] ui,stats: fixed adding rules to the db from context menu When cloning a rule, or applying a rule to a node, if the rule was of type List (had multiple operators), the operators were not saved to the DB. Closes: #1027 --- ui/opensnitch/dialogs/stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/opensnitch/dialogs/stats.py b/ui/opensnitch/dialogs/stats.py index f7e2b1ba..83e04e2c 100644 --- a/ui/opensnitch/dialogs/stats.py +++ b/ui/opensnitch/dialogs/stats.py @@ -1121,7 +1121,7 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): if records == None or records.size() == -1: rule = Rule.new_from_records(records) rule.name = "cloned-{0}-{1}".format(idx, rule.name) - self._db.insert_rule(rule, node_addr) + self._rules.add_rules(node_addr, [rule]) break if records != None and records.size() == -1: @@ -1140,7 +1140,7 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): noti = ui_pb2.Notification(type=ui_pb2.CHANGE_RULE, rules=[rule]) nid = self._nodes.send_notification(node_addr, noti, self._notification_callback) if nid != None: - self._db.insert_rule(rule, node_addr) + self._rules.add_rules(node_addr, [rule]) self._notifications_sent[nid] = noti def _table_menu_change_rule_field(self, cur_idx, model, selection, field, value):