ui: remove Realm model and RealmComboBox

and use it from widget-toolkit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-05-15 10:19:28 +02:00 committed by Thomas Lamprecht
parent d1efcadf38
commit 2892e74479
4 changed files with 1 additions and 98 deletions

View File

@ -17,7 +17,6 @@ JSSRC= \
VNCConsole.js \
data/PermPathStore.js \
data/ResourceStore.js \
data/model/Realm.js \
data/model/RRDModels.js \
form/VLanField.js \
form/Boolean.js \
@ -36,7 +35,6 @@ JSSRC= \
form/BusTypeSelector.js \
form/ControllerSelector.js \
form/EmailNotificationSelector.js \
form/RealmComboBox.js \
form/ViewSelector.js \
form/NodeSelector.js \
form/FileSelector.js \

View File

@ -1,30 +0,0 @@
Ext.define('pve-domains', {
extend: "Ext.data.Model",
fields: [
'realm', 'type', 'comment', 'default', 'tfa',
{
name: 'descr',
// Note: We use this in the RealmComboBox.js (see Bug #125)
convert: function(value, record) {
if (value) {
return value;
}
var info = record.data;
// return realm if there is no comment
var text = info.comment || info.realm;
if (info.tfa) {
text += " (+ " + info.tfa + ")";
}
return Ext.String.htmlEncode(text);
}
}
],
idProperty: 'realm',
proxy: {
type: 'proxmox',
url: "/api2/json/access/domains"
}
});

View File

@ -1,65 +0,0 @@
/*global Proxmox*/
Ext.define('PVE.form.RealmComboBox', {
extend: 'Ext.form.field.ComboBox',
alias: ['widget.pveRealmComboBox'],
controller: {
xclass: 'Ext.app.ViewController',
init: function(view) {
view.store.on('load', this.onLoad, view);
},
onLoad: function(store, records, success) {
if (!success) {
return;
}
var me = this;
var val = me.getValue();
if (!val || !me.store.findRecord('realm', val)) {
var def = 'pam';
Ext.each(records, function(rec) {
if (rec.data && rec.data['default']) {
def = rec.data.realm;
}
});
me.setValue(def);
}
}
},
fieldLabel: gettext('Realm'),
name: 'realm',
queryMode: 'local',
allowBlank: false,
editable: false,
forceSelection: true,
autoSelect: false,
triggerAction: 'all',
valueField: 'realm',
displayField: 'descr',
getState: function() {
return { value: this.getValue() };
},
applyState : function(state) {
if (state && state.value) {
this.setValue(state.value);
}
},
stateEvents: [ 'select' ],
stateful: true, // last chosen auth realm is saved between page reloads
id: 'pveloginrealm', // We need stable ids when using stateful, not autogenerated
stateID: 'pveloginrealm',
needOTP: function(realm) {
var me = this;
// use exact match
var rec = me.store.findRecord('realm', realm, 0, false, false, true);
return rec && rec.data && rec.data.tfa ? rec.data.tfa : undefined;
},
store: {
model: 'pve-domains',
autoLoad: true
}
});

View File

@ -227,7 +227,7 @@ Ext.define('PVE.window.LoginWindow', {
reference: 'passwordField'
},
{
xtype: 'pveRealmComboBox',
xtype: 'pmxRealmComboBox',
name: 'realm'
},
{