mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-16 10:57:37 +00:00
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:
parent
d1efcadf38
commit
2892e74479
@ -17,7 +17,6 @@ JSSRC= \
|
|||||||
VNCConsole.js \
|
VNCConsole.js \
|
||||||
data/PermPathStore.js \
|
data/PermPathStore.js \
|
||||||
data/ResourceStore.js \
|
data/ResourceStore.js \
|
||||||
data/model/Realm.js \
|
|
||||||
data/model/RRDModels.js \
|
data/model/RRDModels.js \
|
||||||
form/VLanField.js \
|
form/VLanField.js \
|
||||||
form/Boolean.js \
|
form/Boolean.js \
|
||||||
@ -36,7 +35,6 @@ JSSRC= \
|
|||||||
form/BusTypeSelector.js \
|
form/BusTypeSelector.js \
|
||||||
form/ControllerSelector.js \
|
form/ControllerSelector.js \
|
||||||
form/EmailNotificationSelector.js \
|
form/EmailNotificationSelector.js \
|
||||||
form/RealmComboBox.js \
|
|
||||||
form/ViewSelector.js \
|
form/ViewSelector.js \
|
||||||
form/NodeSelector.js \
|
form/NodeSelector.js \
|
||||||
form/FileSelector.js \
|
form/FileSelector.js \
|
||||||
|
@ -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"
|
|
||||||
}
|
|
||||||
});
|
|
@ -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
|
|
||||||
}
|
|
||||||
});
|
|
@ -227,7 +227,7 @@ Ext.define('PVE.window.LoginWindow', {
|
|||||||
reference: 'passwordField'
|
reference: 'passwordField'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'pveRealmComboBox',
|
xtype: 'pmxRealmComboBox',
|
||||||
name: 'realm'
|
name: 'realm'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user