From 09cba67c90cd30da7d4bf53359b7b8c90da2b021 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 21 Feb 2024 22:16:24 -0500 Subject: [PATCH] Add module to a rule now via a button in the UI. --- .../javascript/ui/panel/AutoRunRuleForm.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js b/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js index 0e7eed38e..c5182ee61 100644 --- a/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js +++ b/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js @@ -51,6 +51,18 @@ AutoRunRuleForm = function(rule, deleteFn, updateFn) { // Remove element from execution_order and execution_delay arrays. newRule.modules.splice(index, 1); newRule.execution_delay.splice(index, 1); + + // Update DOM. + setupModuleForms(); + moduleContainer.doLayout(); + } + + function addModule() { + // New module is a copy of the last module. + newRule.modules.push(newRule.modules[newRule.modules.length - 1]); + newRule.execution_delay.push(newRule.execution_delay[newRule.execution_delay.length - 1]); + + // Update DOM. setupModuleForms(); moduleContainer.doLayout(); } @@ -92,6 +104,7 @@ AutoRunRuleForm = function(rule, deleteFn, updateFn) { updateFn(updatedRule); } + AutoRunRuleForm.superclass.constructor.call(this, { padding:'10 10 10 10', title: `Rule ${rule.id}`, @@ -123,6 +136,11 @@ AutoRunRuleForm = function(rule, deleteFn, updateFn) { value: rule.os_version ? rule.os_version : 'All', }, moduleContainer, + { + xtype: 'button', + text: 'Add Module', + handler: addModule + }, { xtype: 'combo', id: chainModeComboId,