[pve-devel] r6053 - in pve-manager/pve2: . www www/manager www/manager/data www/manager/dc www/manager/form
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue May 31 08:08:07 CEST 2011
Author: dietmar
Date: 2011-05-31 08:08:07 +0200 (Tue, 31 May 2011)
New Revision: 6053
Added:
pve-manager/pve2/www/manager/
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/data/PVEProxy.js
pve-manager/pve2/www/manager/dc/ACLView.js
pve-manager/pve2/www/manager/dc/AuthView.js
pve-manager/pve2/www/manager/dc/Config.js
pve-manager/pve2/www/manager/dc/GroupView.js
pve-manager/pve2/www/manager/dc/RoleView.js
pve-manager/pve2/www/manager/form/RealmComboBox.js
Removed:
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/cluster/
pve-manager/pve2/www/manager/data/PVEProxy.js
pve-manager/pve2/www/manager/dc/Config.js
pve-manager/pve2/www/manager/form/RealmComboBox.js
Modified:
pve-manager/pve2/configure.in
pve-manager/pve2/www/Makefile.am
Log:
Modified: pve-manager/pve2/configure.in
===================================================================
--- pve-manager/pve2/configure.in 2011-05-31 05:59:29 UTC (rev 6052)
+++ pve-manager/pve2/configure.in 2011-05-31 06:08:07 UTC (rev 6053)
@@ -57,7 +57,7 @@
www/templates/Makefile
www/css/Makefile
www/ext4/Makefile
-www/new/Makefile
+www/manager/Makefile
www/images/Makefile
www/templates/pve.conf
])
Modified: pve-manager/pve2/www/Makefile.am
===================================================================
--- pve-manager/pve2/www/Makefile.am 2011-05-31 05:59:29 UTC (rev 6052)
+++ pve-manager/pve2/www/Makefile.am 2011-05-31 06:08:07 UTC (rev 6053)
@@ -1,6 +1,6 @@
include $(top_builddir)/common.mk
-SUBDIRS = templates images ext4 css new
+SUBDIRS = templates images ext4 css manager
install-data-hook:
chown -R www-data:www-data ${DESTDIR}${WWW_BASEDIR}
Deleted: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am 2011-05-30 11:54:31 UTC (rev 6046)
+++ pve-manager/pve2/www/manager/Makefile.am 2011-05-31 06:08:07 UTC (rev 6053)
@@ -1,85 +0,0 @@
-include $(top_builddir)/common.mk
-
-JSSRC= \
- PVEUtils.js \
- StateProvider.js \
- VNCConsole.js \
- data/TimezoneStore.js \
- data/reader/JsonObject.js \
- data/PVEProxy.js \
- data/UpdateQueue.js \
- data/UpdateStore.js \
- data/DiffStore.js \
- data/ObjectStore.js \
- data/ResourceStore.js \
- form/Checkbox.js \
- form/TextField.js \
- form/RRDTypeSelector.js \
- form/ComboGrid.js \
- form/NetworkCardSelector.js \
- form/DiskFormatSelector.js \
- form/BusTypeSelector.js \
- form/RealmComboBox.js \
- form/BondModeSelector.js \
- form/ViewSelector.js \
- form/NodeSelector.js \
- form/FileSelector.js \
- form/StorageSelector.js \
- dc/Tasks.js \
- dc/Log.js \
- panel/StatusPanel.js \
- panel/RRDView.js \
- window/LoginWindow.js \
- window/TaskViewer.js \
- window/Wizard.js \
- grid/SelectFeature.js \
- grid/ObjectGrid.js \
- grid/ResourceGrid.js \
- tree/ResourceTree.js \
- panel/ConfigPanel.js \
- node/DNSEdit.js \
- node/DNSView.js \
- node/TimeView.js \
- node/TimeEdit.js \
- node/StatusView.js \
- node/Summary.js \
- node/ServiceView.js \
- node/NetworkEdit.js \
- node/NetworkView.js \
- node/Syslog.js \
- node/Tasks.js \
- node/Config.js \
- qemu/StatusView.js \
- qemu/Summary.js \
- qemu/Config.js \
- qemu/HardwareView.js \
- qemu/CreateWizard.js \
- openvz/CreateWizard.js \
- storage/Browser.js \
- dc/UserView.js \
- dc/Config.js \
- Workspace.js
-
-pvemanagerlib.js: ${JSSRC}
- cat ${JSSRC} >$@
-
-pvelib_DATA = pvemanagerlib.js
-pvelibdir = ${WWW_EXTDIR}
-
-privatedir = ${WWW_BASEDIR}
-private_SCRIPTS = \
- startup.pl
-
-managerdir = ${WWW_ROOTDIR}
-manager_SCRIPTS = \
- index.pl
-
-install-data-hook:
- chown -R www-data:www-data ${DESTDIR}/${privatedir}
- chown -R www-data:www-data ${DESTDIR}/${managerdir}
- chown -R www-data:www-data ${DESTDIR}/${pvelibdir}
-
-clean-local:
- -rm -rf *~ store/*~ pvemanagerlib.js
-
-
Copied: pve-manager/pve2/www/manager/Makefile.am (from rev 6050, pve-manager/pve2/www/new/Makefile.am)
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am (rev 0)
+++ pve-manager/pve2/www/manager/Makefile.am 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,89 @@
+include $(top_builddir)/common.mk
+
+JSSRC= \
+ PVEUtils.js \
+ StateProvider.js \
+ VNCConsole.js \
+ data/TimezoneStore.js \
+ data/reader/JsonObject.js \
+ data/PVEProxy.js \
+ data/UpdateQueue.js \
+ data/UpdateStore.js \
+ data/DiffStore.js \
+ data/ObjectStore.js \
+ data/ResourceStore.js \
+ form/Checkbox.js \
+ form/TextField.js \
+ form/RRDTypeSelector.js \
+ form/ComboGrid.js \
+ form/NetworkCardSelector.js \
+ form/DiskFormatSelector.js \
+ form/BusTypeSelector.js \
+ form/RealmComboBox.js \
+ form/BondModeSelector.js \
+ form/ViewSelector.js \
+ form/NodeSelector.js \
+ form/FileSelector.js \
+ form/StorageSelector.js \
+ dc/Tasks.js \
+ dc/Log.js \
+ panel/StatusPanel.js \
+ panel/RRDView.js \
+ window/LoginWindow.js \
+ window/TaskViewer.js \
+ window/Wizard.js \
+ grid/SelectFeature.js \
+ grid/ObjectGrid.js \
+ grid/ResourceGrid.js \
+ tree/ResourceTree.js \
+ panel/ConfigPanel.js \
+ node/DNSEdit.js \
+ node/DNSView.js \
+ node/TimeView.js \
+ node/TimeEdit.js \
+ node/StatusView.js \
+ node/Summary.js \
+ node/ServiceView.js \
+ node/NetworkEdit.js \
+ node/NetworkView.js \
+ node/Syslog.js \
+ node/Tasks.js \
+ node/Config.js \
+ qemu/StatusView.js \
+ qemu/Summary.js \
+ qemu/Config.js \
+ qemu/HardwareView.js \
+ qemu/CreateWizard.js \
+ openvz/CreateWizard.js \
+ storage/Browser.js \
+ dc/UserView.js \
+ dc/GroupView.js \
+ dc/RoleView.js \
+ dc/ACLView.js \
+ dc/AuthView.js \
+ dc/Config.js \
+ Workspace.js
+
+pvemanagerlib.js: ${JSSRC}
+ cat ${JSSRC} >$@
+
+pvelib_DATA = pvemanagerlib.js
+pvelibdir = ${WWW_EXTDIR}
+
+privatedir = ${WWW_BASEDIR}
+private_SCRIPTS = \
+ startup.pl
+
+managerdir = ${WWW_ROOTDIR}
+manager_SCRIPTS = \
+ index.pl
+
+install-data-hook:
+ chown -R www-data:www-data ${DESTDIR}/${privatedir}
+ chown -R www-data:www-data ${DESTDIR}/${managerdir}
+ chown -R www-data:www-data ${DESTDIR}/${pvelibdir}
+
+clean-local:
+ -rm -rf *~ store/*~ pvemanagerlib.js
+
+
Deleted: pve-manager/pve2/www/manager/data/PVEProxy.js
===================================================================
--- pve-manager/pve2/www/new/data/PVEProxy.js 2011-05-30 11:54:31 UTC (rev 6046)
+++ pve-manager/pve2/www/manager/data/PVEProxy.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -1,84 +0,0 @@
-Ext.define('PVE.RestProxy', {
- extend: 'Ext.data.RestProxy',
- alias : 'proxy.pve',
-
- constructor: function(config) {
- var me = this;
-
- config = config || {};
-
- Ext.applyIf(config, {
- pageParam : null,
- startParam: null,
- limitParam: null,
- groupParam: null,
- sortParam: null,
- filterParam: null,
- noCache : false,
- reader: {
- type: 'json',
- root: 'data'
- }
- });
-
- me.callParent([config]);
- }
-
-}, function() {
-
- Ext.define('PVERealm', {
- extend: "Ext.data.Model",
- fields: [ 'realm', 'comment', 'default' ],
- proxy: {
- type: 'pve',
- url: "/api2/json/access/domains"
- }
- });
-
- Ext.define('KeyValue', {
- extend: "Ext.data.Model",
- fields: [ 'key', 'value' ],
- idProperty: 'key'
- });
-
- Ext.define('pve-string-list', {
- extend: 'Ext.data.Model',
- fields: [ 'n', 't' ],
- idProperty: 'n'
- });
-
- Ext.define('pve-tasks', {
- extend: 'Ext.data.Model',
- fields: [
- { name: 'starttime', type : 'date', dateFormat: 'timestamp' },
- { name: 'endtime', type : 'date', dateFormat: 'timestamp' },
- { name: 'pid', type: 'int' },
- 'node', 'upid', 'user', 'status', 'type', 'id'
- ],
- idProperty: 'upid'
- });
-
- Ext.define('pve-cluster-log', {
- extend: 'Ext.data.Model',
- fields: [
- { name: 'uid' , type: 'int' },
- { name: 'time', type : 'date', dateFormat: 'timestamp' },
- { name: 'pri', type: 'int' },
- { name: 'pid', type: 'int' },
- 'node', 'user', 'tag', 'msg',
- {
- name: 'id',
- convert: function(value, record) {
- var info = record.data;
- var text;
-
- if (value)
- return value;
- // compute unique ID
- return info.uid + ':' + info.node;
- }
- }
- ],
- idProperty: 'id'
- });
-});
Copied: pve-manager/pve2/www/manager/data/PVEProxy.js (from rev 6050, pve-manager/pve2/www/new/data/PVEProxy.js)
===================================================================
--- pve-manager/pve2/www/manager/data/PVEProxy.js (rev 0)
+++ pve-manager/pve2/www/manager/data/PVEProxy.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,84 @@
+Ext.define('PVE.RestProxy', {
+ extend: 'Ext.data.RestProxy',
+ alias : 'proxy.pve',
+
+ constructor: function(config) {
+ var me = this;
+
+ config = config || {};
+
+ Ext.applyIf(config, {
+ pageParam : null,
+ startParam: null,
+ limitParam: null,
+ groupParam: null,
+ sortParam: null,
+ filterParam: null,
+ noCache : false,
+ reader: {
+ type: 'json',
+ root: 'data'
+ }
+ });
+
+ me.callParent([config]);
+ }
+
+}, function() {
+
+ Ext.define('pve-domains', {
+ extend: "Ext.data.Model",
+ fields: [ 'realm', 'type', 'comment', 'default' ],
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/access/domains"
+ }
+ });
+
+ Ext.define('KeyValue', {
+ extend: "Ext.data.Model",
+ fields: [ 'key', 'value' ],
+ idProperty: 'key'
+ });
+
+ Ext.define('pve-string-list', {
+ extend: 'Ext.data.Model',
+ fields: [ 'n', 't' ],
+ idProperty: 'n'
+ });
+
+ Ext.define('pve-tasks', {
+ extend: 'Ext.data.Model',
+ fields: [
+ { name: 'starttime', type : 'date', dateFormat: 'timestamp' },
+ { name: 'endtime', type : 'date', dateFormat: 'timestamp' },
+ { name: 'pid', type: 'int' },
+ 'node', 'upid', 'user', 'status', 'type', 'id'
+ ],
+ idProperty: 'upid'
+ });
+
+ Ext.define('pve-cluster-log', {
+ extend: 'Ext.data.Model',
+ fields: [
+ { name: 'uid' , type: 'int' },
+ { name: 'time', type : 'date', dateFormat: 'timestamp' },
+ { name: 'pri', type: 'int' },
+ { name: 'pid', type: 'int' },
+ 'node', 'user', 'tag', 'msg',
+ {
+ name: 'id',
+ convert: function(value, record) {
+ var info = record.data;
+ var text;
+
+ if (value)
+ return value;
+ // compute unique ID
+ return info.uid + ':' + info.node;
+ }
+ }
+ ],
+ idProperty: 'id'
+ });
+});
Added: pve-manager/pve2/www/manager/dc/ACLView.js
===================================================================
--- pve-manager/pve2/www/manager/dc/ACLView.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/ACLView.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,74 @@
+Ext.define('PVE.dc.ACLView', {
+ extend: 'Ext.grid.GridPanel',
+
+ alias: ['widget.pveACLView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var store = new Ext.data.Store({
+ model: Ext.define('pve-acl', {
+ extend: 'Ext.data.Model',
+ fields: [ 'path', 'type', 'ugid', 'roleid',
+ { name: 'propagate', type: 'boolean'} ],
+ }),
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/access/acl"
+ },
+ sorters: {
+ property: 'path',
+ order: 'DESC'
+ }
+ });
+
+ var render_ugid = function(ugid, metaData, record) {
+ if (record.data.type == 'group')
+ return '@' + ugid;
+
+ return ugid;
+ };
+
+ Ext.apply(me, {
+ store: store,
+ stateful: false,
+ viewConfig: {
+ trackOver: false
+ },
+ columns: [
+ {
+ header: 'Path',
+ width: 200,
+ sortable: true,
+ dataIndex: 'path'
+ },
+ {
+ header: 'User/Group',
+ width: 200,
+ sortable: true,
+ renderer: render_ugid,
+ dataIndex: 'ugid'
+ },
+ {
+ header: 'Role',
+ width: 150,
+ sortable: true,
+ dataIndex: 'roleid'
+ },
+ {
+ header: 'Propagate',
+ width: 80,
+ sortable: true,
+ dataIndex: 'propagate'
+ }
+ ],
+ listeners: {
+ show: function() {
+ store.load();
+ }
+ }
+ });
+
+ me.callParent();
+ }
+});
\ No newline at end of file
Added: pve-manager/pve2/www/manager/dc/AuthView.js
===================================================================
--- pve-manager/pve2/www/manager/dc/AuthView.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/AuthView.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,53 @@
+Ext.define('PVE.dc.AuthView', {
+ extend: 'Ext.grid.GridPanel',
+
+ alias: ['widget.pveAuthView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var store = new Ext.data.Store({
+ model: 'pve-domains',
+ sorters: {
+ property: 'realm',
+ order: 'DESC'
+ }
+ });
+
+ Ext.apply(me, {
+ store: store,
+ stateful: false,
+ viewConfig: {
+ trackOver: false
+ },
+ columns: [
+ {
+ header: 'Realm',
+ width: 100,
+ sortable: true,
+ dataIndex: 'realm'
+ },
+ {
+ header: 'Type',
+ width: 100,
+ sortable: true,
+ dataIndex: 'type'
+ },
+ {
+ id: 'comment',
+ header: 'Comment',
+ sortable: false,
+ dataIndex: 'comment',
+ flex: 1
+ }
+ ],
+ listeners: {
+ show: function() {
+ store.load();
+ }
+ }
+ });
+
+ me.callParent();
+ }
+});
\ No newline at end of file
Deleted: pve-manager/pve2/www/manager/dc/Config.js
===================================================================
--- pve-manager/pve2/www/new/dc/Config.js 2011-05-30 11:54:31 UTC (rev 6046)
+++ pve-manager/pve2/www/manager/dc/Config.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -1,52 +0,0 @@
-Ext.define('PVE.dc.Config', {
- extend: 'PVE.panel.Config',
- alias: 'widget.PVE.dc.Config',
-
- initComponent: function() {
- var me = this;
-
- Ext.apply(me, {
- title: "Datacenter",
- hstateid: 'dctab',
- items: [
- {
- title: 'Summary',
- itemId: 'summary',
- html: 'summary '
- },
- {
- title: 'Storage',
- itemId: 'storage',
- html: 'storage '
- },
- {
- xtype: 'pveUserView',
- title: 'Users',
- itemId: 'users'
- },
- {
- //xtype: 'pveGroupView',
- title: 'Groups',
- itemId: 'groups'
- },
- {
- //xtype: 'pveACLView',
- title: 'Permissions',
- itemId: 'permissions'
- },
- {
- //xtype: 'pveRoleView',
- title: 'Roles',
- itemId: 'roles'
- },
- {
- //xtype: 'pveAuthView',
- title: 'Authentication',
- itemId: 'domains'
- }
- ]
- });
-
- me.callParent();
- }
-});
Copied: pve-manager/pve2/www/manager/dc/Config.js (from rev 6050, pve-manager/pve2/www/new/dc/Config.js)
===================================================================
--- pve-manager/pve2/www/manager/dc/Config.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/Config.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,52 @@
+Ext.define('PVE.dc.Config', {
+ extend: 'PVE.panel.Config',
+ alias: 'widget.PVE.dc.Config',
+
+ initComponent: function() {
+ var me = this;
+
+ Ext.apply(me, {
+ title: "Datacenter",
+ hstateid: 'dctab',
+ items: [
+ {
+ title: 'Summary',
+ itemId: 'summary',
+ html: 'summary '
+ },
+ {
+ title: 'Storage',
+ itemId: 'storage',
+ html: 'storage '
+ },
+ {
+ xtype: 'pveUserView',
+ title: 'Users',
+ itemId: 'users'
+ },
+ {
+ xtype: 'pveGroupView',
+ title: 'Groups',
+ itemId: 'groups'
+ },
+ {
+ xtype: 'pveACLView',
+ title: 'Permissions',
+ itemId: 'permissions'
+ },
+ {
+ xtype: 'pveRoleView',
+ title: 'Roles',
+ itemId: 'roles'
+ },
+ {
+ xtype: 'pveAuthView',
+ title: 'Authentication',
+ itemId: 'domains'
+ }
+ ]
+ });
+
+ me.callParent();
+ }
+});
Copied: pve-manager/pve2/www/manager/dc/GroupView.js (from rev 6050, pve-manager/pve2/www/new/dc/GroupView.js)
===================================================================
--- pve-manager/pve2/www/manager/dc/GroupView.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/GroupView.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,56 @@
+Ext.define('PVE.dc.GroupView', {
+ extend: 'Ext.grid.GridPanel',
+
+ alias: ['widget.pveGroupView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var store = new Ext.data.Store({
+ model: Ext.define('pve-groups', {
+ extend: 'Ext.data.Model',
+ fields: [ 'groupid', 'comment' ],
+ idProperty: 'groupid'
+ }),
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/access/groups"
+ },
+ sorters: {
+ property: 'groupid',
+ order: 'DESC'
+ }
+ });
+
+
+ Ext.apply(me, {
+ store: store,
+ stateful: false,
+
+ viewConfig: {
+ trackOver: false
+ },
+ columns: [
+ {
+ header: 'Group name',
+ width: 200,
+ sortable: true,
+ dataIndex: 'groupid'
+ },
+ {
+ header: 'Comment',
+ sortable: false,
+ dataIndex: 'comment',
+ flex: 1
+ }
+ ],
+ listeners: {
+ show: function() {
+ store.load();
+ }
+ }
+ });
+
+ me.callParent();
+ }
+});
\ No newline at end of file
Copied: pve-manager/pve2/www/manager/dc/RoleView.js (from rev 6048, pve-manager/pve2/www/new/dc/RoleView.js)
===================================================================
--- pve-manager/pve2/www/manager/dc/RoleView.js (rev 0)
+++ pve-manager/pve2/www/manager/dc/RoleView.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,68 @@
+Ext.define('PVE.dc.RoleView', {
+ extend: 'Ext.grid.GridPanel',
+
+ alias: ['widget.pveRoleView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var store = new Ext.data.Store({
+ model: Ext.define('pve-roles', {
+ extend: 'Ext.data.Model',
+ fields: [ 'roleid', 'privs' ],
+ idProperty: 'roleid'
+ }),
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/access/roles"
+ },
+ sorters: {
+ property: 'roleid',
+ order: 'DESC'
+ }
+ });
+
+ var render_privs = function(value, metaData) {
+
+ if (!value)
+ return '-';
+
+ // allow word wrap
+ metaData.style = 'white-space:normal;'
+
+ return value.replace(/\,/g, ' ');
+ };
+
+ Ext.apply(me, {
+ store: store,
+ stateful: false,
+
+ viewConfig: {
+ trackOver: false
+ },
+ columns: [
+ {
+ header: 'Role name',
+ width: 150,
+ sortable: true,
+ dataIndex: 'roleid'
+ },
+ {
+ id: 'privs',
+ header: 'Privileges',
+ sortable: false,
+ renderer: render_privs,
+ dataIndex: 'privs',
+ flex: 1
+ }
+ ],
+ listeners: {
+ show: function() {
+ store.load();
+ }
+ }
+ });
+
+ me.callParent();
+ }
+});
\ No newline at end of file
Deleted: pve-manager/pve2/www/manager/form/RealmComboBox.js
===================================================================
--- pve-manager/pve2/www/new/form/RealmComboBox.js 2011-05-30 11:54:31 UTC (rev 6046)
+++ pve-manager/pve2/www/manager/form/RealmComboBox.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -1,61 +0,0 @@
-Ext.define('PVE.form.RealmComboBox', {
- extend: 'Ext.form.ComboBox',
- requires: ['Ext.data.Store', 'PVE.RestProxy'],
- alias: ['widget.pveRealmComboBox'],
-
- initComponent: function() {
- var me = this;
-
- var stateid = 'pveloginrealm';
-
- var realmstore = Ext.create('Ext.data.Store', {
- model: 'PVERealm',
- autoDestory: true
- });
-
- Ext.apply(me, {
- fieldLabel: 'Realm',
- name: 'realm',
- store: realmstore,
- queryMode: 'local',
- allowBlank: 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,
- id: stateid, // fixme: remove (Stateful does not work without)
- stateID: stateid
- });
-
- me.callParent();
-
- realmstore.load({
- callback: function(r, o, success) {
- if (success) {
- var def = me.getValue();
- if (!def || !realmstore.findRecord('realm', def)) {
- if (r[0] && r[0].data)
- def = r[0].data.realm;
- Ext.each(r, function(record) {
- if (record.data && record.data["default"])
- def = record.data.realm;
- });
- }
- if (def)
- me.setValue(def)
- }
- }
- });
- }
-});
\ No newline at end of file
Copied: pve-manager/pve2/www/manager/form/RealmComboBox.js (from rev 6050, pve-manager/pve2/www/new/form/RealmComboBox.js)
===================================================================
--- pve-manager/pve2/www/manager/form/RealmComboBox.js (rev 0)
+++ pve-manager/pve2/www/manager/form/RealmComboBox.js 2011-05-31 06:08:07 UTC (rev 6053)
@@ -0,0 +1,61 @@
+Ext.define('PVE.form.RealmComboBox', {
+ extend: 'Ext.form.ComboBox',
+ requires: ['Ext.data.Store', 'PVE.RestProxy'],
+ alias: ['widget.pveRealmComboBox'],
+
+ initComponent: function() {
+ var me = this;
+
+ var stateid = 'pveloginrealm';
+
+ var realmstore = Ext.create('Ext.data.Store', {
+ model: 'pve-domains',
+ autoDestory: true
+ });
+
+ Ext.apply(me, {
+ fieldLabel: 'Realm',
+ name: 'realm',
+ store: realmstore,
+ queryMode: 'local',
+ allowBlank: 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,
+ id: stateid, // fixme: remove (Stateful does not work without)
+ stateID: stateid
+ });
+
+ me.callParent();
+
+ realmstore.load({
+ callback: function(r, o, success) {
+ if (success) {
+ var def = me.getValue();
+ if (!def || !realmstore.findRecord('realm', def)) {
+ if (r[0] && r[0].data)
+ def = r[0].data.realm;
+ Ext.each(r, function(record) {
+ if (record.data && record.data["default"])
+ def = record.data.realm;
+ });
+ }
+ if (def)
+ me.setValue(def)
+ }
+ }
+ });
+ }
+});
\ No newline at end of file
More information about the pve-devel
mailing list