mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-13 23:15:11 +00:00
ui: user edit: rework interaction of realm and view model
avoid accessing private members directly but rather try to use the public API, this then allows us do drop declaring a reference on the realm combobox, which was not directly used and thus a bit subtle. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
cc45a16322
commit
15b5e60568
@ -1,6 +1,5 @@
|
|||||||
Ext.define('PBS.window.UserEditViewModel', {
|
Ext.define('PBS.window.UserEditViewModel', {
|
||||||
extend: 'Ext.app.ViewModel',
|
extend: 'Ext.app.ViewModel',
|
||||||
|
|
||||||
alias: 'viewmodel.pbsUserEdit',
|
alias: 'viewmodel.pbsUserEdit',
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
@ -9,15 +8,16 @@ Ext.define('PBS.window.UserEditViewModel', {
|
|||||||
|
|
||||||
formulas: {
|
formulas: {
|
||||||
maySetPassword: function(get) {
|
maySetPassword: function(get) {
|
||||||
// Dummy read, so that ExtJS will update the formula when
|
let realm = get('realm');
|
||||||
// the combobox changes
|
|
||||||
let _dummy = get('realm');
|
|
||||||
|
|
||||||
// All in all a bit hacky, is there a nicer way to do this?
|
let view = this.getView();
|
||||||
let realm_type = this.data.realmComboBox.selection?.data.type
|
let realmStore = view.down('pmxRealmComboBox').getStore();
|
||||||
? this.data.realmComboBox.selection?.data.type : 'pbs';
|
if (realmStore.isLoaded()) {
|
||||||
|
let rec = realmStore.findRecord('realm', realm, 0, false, true, true);
|
||||||
return Proxmox.Schema.authDomains[realm_type].pwchange && this.config.view.isCreate;
|
return Proxmox.Schema.authDomains[rec.data.type]?.pwchange && view.isCreate;
|
||||||
|
} else {
|
||||||
|
return view.isCreate;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -78,8 +78,9 @@ Ext.define('PBS.window.UserEdit', {
|
|||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
matchFieldWidth: false,
|
matchFieldWidth: false,
|
||||||
listConfig: { width: 300 },
|
listConfig: { width: 300 },
|
||||||
reference: 'realmComboBox',
|
bind: {
|
||||||
bind: '{realm}',
|
value: '{realm}',
|
||||||
|
},
|
||||||
cbind: {
|
cbind: {
|
||||||
hidden: '{!isCreate}',
|
hidden: '{!isCreate}',
|
||||||
disabled: '{!isCreate}',
|
disabled: '{!isCreate}',
|
||||||
|
Loading…
Reference in New Issue
Block a user