Can update rule name and chain_mode through UI.

This commit is contained in:
root
2024-02-18 22:42:41 -05:00
parent 1b1c8543b3
commit 503dd532f6

View File

@@ -22,16 +22,31 @@ const areNotificationUpdateTest = {
* updateFn: callback function to update this rule.
*/
AutoRunRuleForm = function(rule, deleteFn, updateFn, addFn) {
const self = this;
const ruleTextFieldId = `rule-name-${rule.id}`;
const chainModeComboId = `rule-chain-mode-${rule.id}`;
function handleUpdateRule() {
// TODO: Get data from form inputs.
updateFn(areNotificationUpdateTest);
// TODO: Check if inputs are valid.
const form = self.getForm();
const formValues = form.getValues();
const updatedRule = {
...rule,
modules: JSON.parse(rule['modules']),
execution_delay: JSON.parse(rule['execution_delay']),
execution_order: JSON.parse(rule['execution_order']),
name: formValues[ruleTextFieldId],
chain_mode: formValues[chainModeComboId]
};
console.log(updatedRule);
updateFn(updatedRule);
}
AutoRunRuleForm.superclass.constructor.call(this, {
padding:'10 10 10 10',
items: [{
xtype: 'textfield',
id: ruleTextFieldId,
value: rule.name ? rule.name : '',
fieldLabel: 'Name',
},
@@ -41,6 +56,7 @@ AutoRunRuleForm = function(rule, deleteFn, updateFn, addFn) {
value: rule.author ? rule.author : 'anonymous',
},{
xtype: 'combo',
id: chainModeComboId,
fieldLabel: 'Chain Mode',
store: ['sequential', 'nested-forward'],
queryMode: 'local', // Use local data.