ui: auth-id selector: validity, code-style and layout fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-06 19:46:08 +01:00
parent 0953044cfb
commit 009a04f8d0
1 changed files with 22 additions and 21 deletions

View File

@ -39,31 +39,32 @@ Ext.define('PBS.form.AuthidSelector', {
}, },
onLoad: function(store, data, success) { onLoad: function(store, data, success) {
let me = this;
if (!success) return; if (!success) return;
let authidStore = this.store;
let records = []; let records = [];
Ext.Array.each(data, function(user) { for (const rec of data) {
let u = {}; records.push({
u.authid = user.data.userid; authid: rec.data.userid,
u.comment = user.data.comment; comment: rec.data.comment,
u.type = 'u'; type: 'u',
records.push(u); });
let tokens = user.data.tokens || []; let tokens = rec.data.tokens || [];
Ext.Array.each(tokens, function(token) { for (const token of tokens) {
let r = {}; records.push({
r.authid = token.tokenid; authid: token.tokenid,
r.comment = token.comment; comment: token.comment,
r.type = 't'; type: 't',
records.push(r); });
}); }
}); }
authidStore.loadData(records); me.store.loadData(records);
me.validate();
}, },
listConfig: { listConfig: {
width: 500,
columns: [ columns: [
{ {
header: gettext('Type'), header: gettext('Type'),
@ -76,21 +77,21 @@ Ext.define('PBS.form.AuthidSelector', {
default: return Proxmox.Utils.unknownText; default: return Proxmox.Utils.unknownText;
} }
}, },
flex: 1, width: 80,
}, },
{ {
header: gettext('Auth ID'), header: gettext('Auth ID'),
sortable: true, sortable: true,
dataIndex: 'authid', dataIndex: 'authid',
renderer: Ext.String.htmlEncode, renderer: Ext.String.htmlEncode,
flex: 1, flex: 2,
}, },
{ {
header: gettext('Comment'), header: gettext('Comment'),
sortable: false, sortable: false,
dataIndex: 'comment', dataIndex: 'comment',
renderer: Ext.String.htmlEncode, renderer: Ext.String.htmlEncode,
flex: 1, flex: 3,
}, },
], ],
}, },