]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/panel/AuthView.js
1 Ext
.define('Proxmox.panel.AuthView', {
2 extend
: 'Ext.grid.GridPanel',
4 alias
: 'widget.pmxAuthView',
7 stateId
: 'grid-authrealms',
13 baseUrl
: '/access/domains',
18 header
: gettext('Realm'),
24 header
: gettext('Type'),
30 header
: gettext('Comment'),
33 renderer
: Ext
.String
.htmlEncode
,
46 openEditWindow: function(authType
, realm
) {
48 Ext
.create('Proxmox.window.AuthEditBase', {
50 useTypeInUrl
: me
.useTypeInUrl
,
54 destroy
: () => me
.reload(),
64 run_editor: function() {
66 let rec
= me
.getSelection()[0];
71 if (!Proxmox
.Schema
.authDomains
[rec
.data
.type
].edit
) {
75 me
.openEditWindow(rec
.data
.type
, rec
.data
.realm
);
78 initComponent: function() {
82 for (const [authType
, config
] of Object
.entries(Proxmox
.Schema
.authDomains
).sort()) {
83 if (!config
.add
) { continue; }
86 iconCls
: 'fa fa-fw ' + (config
.iconCls
|| 'fa-address-book-o'),
87 handler
: () => me
.openEditWindow(authType
),
99 xtype
: 'proxmoxButton',
100 text
: gettext('Edit'),
102 enableFn
: (rec
) => Proxmox
.Schema
.authDomains
[rec
.data
.type
].edit
,
103 handler
: () => me
.run_editor(),
106 xtype
: 'proxmoxStdRemoveButton',
108 let url
= me
.baseUrl
;
109 if (me
.useTypeInUrl
) {
110 url
+= `/${rec.get('type')}`;
112 url
+= `/${rec.getId()}`;
115 enableFn
: (rec
) => Proxmox
.Schema
.authDomains
[rec
.data
.type
].add
,
116 callback
: () => me
.reload(),
120 if (me
.extraButtons
) {
122 for (const button
of me
.extraButtons
) {
130 activate
: () => me
.reload(),
131 itemdblclick
: () => me
.run_editor(),