Though unlikely, the node in a HA node affinity rule could not exist in the store anymore. Therefore handle non-existent nodes by adding them to the store.
Signed-off-by: Daniel Kral <[email protected]> --- changes since v1: - new www/manager6/ha/rules/NodeAffinityRuleEdit.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/www/manager6/ha/rules/NodeAffinityRuleEdit.js b/www/manager6/ha/rules/NodeAffinityRuleEdit.js index 4574d9ef..1223efc8 100644 --- a/www/manager6/ha/rules/NodeAffinityRuleEdit.js +++ b/www/manager6/ha/rules/NodeAffinityRuleEdit.js @@ -99,13 +99,17 @@ Ext.define('PVE.ha.rules.NodeAffinityInputPanel', { string.split(',').forEach(function (e, idx, array) { let [node, priority] = e.split(':'); - store.each(function (record) { - if (record.get('node') === node) { - sm.select(record, true); - record.set('priority', priority); - record.commit(); - } - }); + + let record = store.findRecord('node', node, 0, false, true, true); + if (record) { + record.set('priority', priority); + record.commit(); + } else { + let addedRecords = store.add({ node, priority }); + record = addedRecords[0]; + } + + sm.select(record, true); }); nodegrid.reconfigure(store); }; -- 2.47.3
