From 1d8ef0dcf7152bcfe665439d87ac8003b29a873e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 18 May 2020 14:18:37 +0200 Subject: [PATCH] ui: use Logo/RealmComboBox from widget-toolkit Signed-off-by: Dominik Csapak --- www/LoginView.js | 11 ++++---- www/Logo.js | 14 --------- www/MainView.js | 3 +- www/Makefile | 2 -- www/RealmComboBox.js | 67 -------------------------------------------- 5 files changed, 8 insertions(+), 89 deletions(-) delete mode 100644 www/Logo.js delete mode 100644 www/RealmComboBox.js diff --git a/www/LoginView.js b/www/LoginView.js index 6a03ab3a..98c81d34 100644 --- a/www/LoginView.js +++ b/www/LoginView.js @@ -114,7 +114,8 @@ Ext.define('PBS.LoginView', { height: 38, items: [ { - xtype: 'proxmoxlogo' + xtype: 'proxmoxlogo', + prefix: '', }, { xtype: 'versioninfo', @@ -158,10 +159,6 @@ Ext.define('PBS.LoginView', { }, items: [ - { - xtype: 'pbsRealmComboBox', - name: 'realm' - }, { xtype: 'textfield', fieldLabel: gettext('User name'), @@ -178,6 +175,10 @@ Ext.define('PBS.LoginView', { itemId: 'passwordField', reference: 'passwordField', }, + { + xtype: 'pmxRealmComboBox', + name: 'realm' + }, { xtype: 'proxmoxLanguageSelector', fieldLabel: gettext('Language'), diff --git a/www/Logo.js b/www/Logo.js deleted file mode 100644 index b0dcfa26..00000000 --- a/www/Logo.js +++ /dev/null @@ -1,14 +0,0 @@ -Ext.define('PBS.image.Logo', { - extend: 'Ext.Img', - xtype: 'proxmoxlogo', - - height: 30, - width: 172, - src: '/images/proxmox_logo.png', - alt: 'Proxmox', - autoEl: { - tag: 'a', - href: 'https://www.proxmox.com', - target: '_blank' - } -}); diff --git a/www/MainView.js b/www/MainView.js index 5e2094ab..e81df2bc 100644 --- a/www/MainView.js +++ b/www/MainView.js @@ -177,7 +177,8 @@ Ext.define('PBS.MainView', { height: 38, items: [ { - xtype: 'proxmoxlogo' + xtype: 'proxmoxlogo', + prefix: '', }, { xtype: 'versioninfo' diff --git a/www/Makefile b/www/Makefile index 429da3f8..fc515a34 100644 --- a/www/Makefile +++ b/www/Makefile @@ -6,8 +6,6 @@ IMAGES := \ JSSRC= \ Utils.js \ - Logo.js \ - RealmComboBox.js \ LoginView.js \ VersionInfo.js \ SystemConfiguration.js \ diff --git a/www/RealmComboBox.js b/www/RealmComboBox.js deleted file mode 100644 index 001b1d74..00000000 --- a/www/RealmComboBox.js +++ /dev/null @@ -1,67 +0,0 @@ -Ext.define('pbs-domains', { - extend: "Ext.data.Model", - fields: [ 'realm', 'comment', 'default' ], - idProperty: 'realm', - proxy: { - type: 'proxmox', - url: "/api2/json/access/domains" - } -}); - -Ext.define('PBS.form.RealmComboBox', { - extend: 'Ext.form.field.ComboBox', - alias: ['widget.pbsRealmComboBox'], - - 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: 'comment', - 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: 'pbsloginrealm', // We need stable ids when using stateful, not autogenerated - stateID: 'pbsloginrealm', - - store: { - model: 'pbs-domains', - autoLoad: true - } -});