proxmox-backup/www/window/ACLEdit.js
Thomas Lamprecht cf1b029b3f ui: ACL edit: set default focus on a non-combobox element
to avoid making it "jump" in the users face by immediately opening
the picker on window open.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-14 14:50:40 +02:00

80 lines
1.6 KiB
JavaScript

Ext.define('PBS.window.ACLEdit', {
extend: 'Proxmox.window.Edit',
alias: 'widget.pbsACLAdd',
mixins: ['Proxmox.Mixin.CBind'],
onlineHelp: 'user_acl',
url: '/access/acl',
method: 'PUT',
isAdd: true,
isCreate: true,
width: 450,
// caller can give a static path
path: undefined,
defaultFocus: 'proxmoxcheckbox',
initComponent: function() {
let me = this;
me.items = [];
me.items.push({
xtype: 'pmxDisplayEditField',
name: 'path',
fieldLabel: gettext('Path'),
editConfig: {
xtype: 'pbsPermissionPathSelector',
allowBlank: false,
},
editable: !me.path,
value: me.path,
});
if (me.aclType === 'user') {
me.subject = gettext('User Permission');
me.items.push({
xtype: 'pmxUserSelector',
name: 'auth-id',
fieldLabel: gettext('User'),
allowBlank: false,
});
} else if (me.aclType === 'token') {
me.subject = gettext('API Token Permission');
me.items.push({
xtype: 'pbsTokenSelector',
name: 'auth-id',
fieldLabel: gettext('API Token'),
allowBlank: false,
});
}
me.items.push({
xtype: 'pmxRoleSelector',
name: 'role',
fieldLabel: gettext('Role'),
value: 'NoAccess',
});
me.items.push({
xtype: 'proxmoxcheckbox',
name: 'propagate',
fieldLabel: gettext('Propagate'),
checked: true,
uncheckedValue: 0,
});
me.callParent();
},
getValues: function(dirtyOnly) {
let me = this;
let values = me.callParent(arguments);
if (me.path) {
values.path = me.path;
}
return values;
},
});