ui: remote target ns selector: fix clearing value on edit

never makes sense to clear the value due to remote or remoteStore
change as we weren't enabled then in the first place.

This fixes clearing the currently set namespace on editing an
existing job, which always made it seem like the Root namespace was
selected, even if the originalValue was correct (thus the dirty-form
reset/ok behaviour still worked, making it even more confusing)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-14 18:29:09 +02:00
parent 1f71e44172
commit dc193e8197
1 changed files with 9 additions and 5 deletions

View File

@ -121,20 +121,24 @@ Ext.define('PBS.form.RemoteNamespaceSelector', {
setRemote: function(remote) {
let me = this;
if (me.remote === remote) {
let previousRemote = me.remote;
if (previousRemote === remote) {
return;
}
me.remote = remote;
me.store.removeAll();
me.setDisabled(true);
me.clearValue();
if (previousRemote) {
me.setDisabled(true);
me.clearValue();
}
},
setRemoteStore: function(remoteStore) {
let me = this;
if (me.remoteStore === remoteStore) {
let previousStore = me.remoteStore;
if (previousStore === remoteStore) {
return;
}
me.remoteStore = remoteStore;
@ -153,7 +157,7 @@ Ext.define('PBS.form.RemoteNamespaceSelector', {
me.store.load();
me.firstLoad = false;
} else {
} else if (previousStore) {
me.setDisabled(true);
me.clearValue();
}