Skip to content

Commit

Permalink
ui,stats: fixed adding rules to the db from context menu
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 4499a5a)
  • Loading branch information
gustavo-iniguez-goya committed Jan 8, 2024
1 parent c3dc1fc commit ec3f515
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/opensnitch/dialogs/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ def _table_menu_duplicate(self, cur_idx, model, selection):
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:
Expand All @@ -1140,7 +1140,7 @@ def _table_menu_apply_to_node(self, cur_idx, model, selection, node_addr):
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):
Expand Down

0 comments on commit ec3f515

Please sign in to comment.