]>
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 open_sync_window: function() {
79 let rec
= this.getSelection()[0];
83 if (!Proxmox
.Schema
.authDomains
[rec
.data
.type
].sync
) {
86 Ext
.create('Proxmox.window.SyncWindow', {
88 realm
: rec
.data
.realm
,
90 destroy
: () => this.reload(),
95 initComponent: function() {
99 for (const [authType
, config
] of Object
.entries(Proxmox
.Schema
.authDomains
).sort()) {
100 if (!config
.add
) { continue; }
103 iconCls
: 'fa fa-fw ' + (config
.iconCls
|| 'fa-address-book-o'),
104 handler
: () => me
.openEditWindow(authType
),
110 text
: gettext('Add'),
116 xtype
: 'proxmoxButton',
117 text
: gettext('Edit'),
119 enableFn
: (rec
) => Proxmox
.Schema
.authDomains
[rec
.data
.type
].edit
,
120 handler
: () => me
.run_editor(),
123 xtype
: 'proxmoxStdRemoveButton',
125 let url
= me
.baseUrl
;
126 if (me
.useTypeInUrl
) {
127 url
+= `/${rec.get('type')}`;
129 url
+= `/${rec.getId()}`;
132 enableFn
: (rec
) => Proxmox
.Schema
.authDomains
[rec
.data
.type
].add
,
133 callback
: () => me
.reload(),
136 xtype
: 'proxmoxButton',
137 text
: gettext('Sync'),
139 enableFn
: (rec
) => Proxmox
.Schema
.authDomains
[rec
.data
.type
].sync
,
140 handler
: () => me
.open_sync_window(),
144 if (me
.extraButtons
) {
146 for (const button
of me
.extraButtons
) {
154 activate
: () => me
.reload(),
155 itemdblclick
: () => me
.run_editor(),