[pve-devel] r4899 - in pve-manager/pve2/www/manager: . form window
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Jul 14 14:07:56 CEST 2010
Author: dietmar
Date: 2010-07-14 12:07:56 +0000 (Wed, 14 Jul 2010)
New Revision: 4899
Added:
pve-manager/pve2/www/manager/form/
pve-manager/pve2/www/manager/form/ModifyDirStorage.js
pve-manager/pve2/www/manager/form/StdForm.js
pve-manager/pve2/www/manager/window/ModalDialog.js
Removed:
pve-manager/pve2/www/manager/StorageConfig.js
Modified:
pve-manager/pve2/www/manager/ClusterConfig.js
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/StorageBrowser.js
Log:
namespace cleanups
Modified: pve-manager/pve2/www/manager/ClusterConfig.js
===================================================================
--- pve-manager/pve2/www/manager/ClusterConfig.js 2010-07-14 10:33:35 UTC (rev 4898)
+++ pve-manager/pve2/www/manager/ClusterConfig.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -22,11 +22,6 @@
html: 'status ' + clusterid
},
{
- xtype: 'pveStorageConfig',
- title: 'Storage',
- id: 'storage'
- },
- {
title: 'Users',
id: 'users',
html: 'users ' + clusterid
Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am 2010-07-14 10:33:35 UTC (rev 4898)
+++ pve-manager/pve2/www/manager/Makefile.am 2010-07-14 12:07:56 UTC (rev 4899)
@@ -11,14 +11,16 @@
grid/ObjectView.js \
PVECache.js \
Workspace.js \
+ window/ModalDialog.js \
window/LoginWindow.js \
+ form/StdForm.js \
+ form/ModifyDirStorage.js \
PVEFilter.js \
ResourceTree.js \
ConfigPanel.js \
PVEConsole.js \
KVMConfig.js \
NodeConfig.js \
- StorageConfig.js \
StorageBrowser.js \
ClusterConfig.js \
PVESearch.js
Modified: pve-manager/pve2/www/manager/StorageBrowser.js
===================================================================
--- pve-manager/pve2/www/manager/StorageBrowser.js 2010-07-14 10:33:35 UTC (rev 4898)
+++ pve-manager/pve2/www/manager/StorageBrowser.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -1,6 +1,6 @@
Ext.ns("PVE");
-PVE.StorageStatus = Ext.extend(Ext.Panel, {
+PVE.StorageSummary = Ext.extend(Ext.Panel, {
initComponent : function() {
var self = this;
@@ -32,17 +32,13 @@
text: "Edit",
handler: function() {
- var form = new PVE.StorageConfigPanel();
- var win = new Ext.Window({
+ var form = new PVE.form.ModifyDirStorage({
+ confdata: self.confdata
+ });
+ var win = new PVE.window.ModalDialog({
title: "Modify Directory Storage",
- modal: true,
- border:false,
- layout: 'fit',
- maximizable: true,
items: form,
- width: 800,
- height: 400,
-
+ height: 300,
buttons: [
{
text: 'OK',
@@ -87,11 +83,11 @@
]
});
- PVE.StorageStatus.superclass.initComponent.call(self);
+ PVE.StorageSummary.superclass.initComponent.call(self);
}
});
-Ext.reg('pveStorageStatus', PVE.StorageStatus);
+Ext.reg('pveStorageSummary', PVE.StorageSummary);
PVE.StorageBrowser = Ext.extend(PVE.ConfigPanel, {
@@ -182,7 +178,7 @@
items: [
{
title: 'Summary',
- xtype: 'pveStorageStatus',
+ xtype: 'pveStorageSummary',
confdata: self.confdata,
store: store,
id: 'status'
Deleted: pve-manager/pve2/www/manager/StorageConfig.js
===================================================================
--- pve-manager/pve2/www/manager/StorageConfig.js 2010-07-14 10:33:35 UTC (rev 4898)
+++ pve-manager/pve2/www/manager/StorageConfig.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -1,264 +0,0 @@
-Ext.ns("PVE");
-
-PVE.StorageConfigPanel = Ext.extend(Ext.FormPanel, {
-
- initComponent : function() {
- var self = this;
-
- var items_col1 = [
- {
- xtype: 'textfield',
- fieldLabel: 'Storage name',
- name: 'storage'
- //disabled: true,
- //allowBlank: false
- },
- {
- xtype: 'textfield',
- fieldLabel: 'Directory',
- name: 'path',
- allowBlank: false
- }
- ];
-
- var items_col2 = [
- {
- xtype: 'checkbox',
- fieldLabel: 'Disabled',
- name: 'disabled',
- value: 'test1'
- },
- {
- xtype: 'checkbox',
- fieldLabel: 'Shared',
- name: 'shared'
- },
- {
- xtype: 'multiselect',
- //xtype: 'combo',
- forceSelection: true,
- triggerAction: 'all',
- fieldLabel: 'Content',
- name: 'content',
- style : 'margin-bottom:10px',// avoid scrolbars with Firefox
- width: 150,
- height: 'auto',
- store: [['images', 'Images'], ['backup', 'Backup'],
- ['vztmpl', 'OpenVZ Templates'], ['iso', 'ISO']]
- }
- ];
-
- var items_col3 = [
- {
- xtype: 'multiselect',
- fieldLabel: 'Nodes',
- name: 'nodelist',
- style : 'margin-bottom:10px',// avoid scrolbars with Firefox
- width: 150,
- height: 'auto',
- store: ['Node0', 'Node1', 'Node2', 'Node3', 'Node4', 'Node5']
- }
- ];
-
- // NOTE: If subclassing FormPanel, any configuration options for
- // the BasicForm must be applied to initialConfig
-
- Ext.apply(self, Ext.apply(self.initialConfig, {
- url: "/api2/extjs/test",
- bodyStyle: 'padding:5px',
- autoScroll: true,
-
- submitHandler: function(options) {
-
- var form = self.getForm();
-
- if(form.isValid()){
- self.el.mask('Please wait...', 'x-mask-loading');
-
- form.submit({
- failure: function(f, resp){
- self.el.unmask();
- Ext.MessageBox.alert('Failure', "Please try again");
- if (Ext.isFunction(options.failure)) {
- options.failure();
- }
- },
- success: function(f, resp){
- self.el.unmask();
- Ext.MessageBox.alert('Success', "Submit successful");
- if (Ext.isFunction(options.success)) {
- options.success();
- }
- }
- });
- } else {
- Ext.MessageBox.alert('Failure', "Verify failed");
- if (Ext.isFunction(options.failure)) {
- options.failure();
- }
- }
- },
-
- items: [
- {
- xtype:'fieldset',
- title: 'Settings',
- defaults: { border: false },
- items: [
- {
- layout:'column',
- defaults: {
- columnWidth: '.5',
- border: false
- },
- items: [
- {
- layout: 'form',
- defaults: { anchor: '-20' },
- items: items_col1
- },
- {
- layout: 'form',
- defaults: { anchor: '100%' },
- items: items_col2
- }
- ]
- }
- ]
- },
- {
- xtype:'fieldset',
- checkboxToggle:true,
- collapsed: true,
- title: 'Restrict access to specific nodes',
- items: {
- layout: 'form',
- border:false,
- defaults: { border:false, anchor: '-10' },
- items: items_col3
- }
- }
- ]
- }));
-
- PVE.StorageConfigPanel.superclass.initComponent.call(self);
- }
-
-});
-
-Ext.reg('pveStorageConfigPanel', PVE.StorageConfigPanel);
-
-PVE.StorageConfig = Ext.extend(Ext.grid.GridPanel, {
-
- initComponent : function() {
- var self = this;
-
- var store = new Ext.data.JsonStore({
- autoLoad: true,
- autoDestroy: true,
- url: '/api2/json/storage/config',
- root: 'data',
- idProperty: 'storage',
- fields: ['storage', 'type', 'path',
- { name: 'shared', type: 'boolean' },
- { name: 'disable', type: 'boolean' },
- 'content']
- });
-
- Ext.apply(self, {
- store: store,
-
- tbar: [
- {
- text: 'Add',
- handler: function() {
- alert("ADD new storage");
- }
- },
- {
- text: 'Delete',
- handler: function() {
- var sm = self.getSelectionModel();
- var sel = sm.getSelected();
- if (!sel) {
- alert("no selection");
- return;
- }
- alert("Delete " + sel.data.storage);
- }
- }
- ],
-
- colModel: new Ext.grid.ColumnModel({
- defaults: {
- width: 200,
- sortable: true
- },
- columns: [
- { header: 'Storage ID', dataIndex: 'storage' },
- { header: 'Type', dataIndex: 'type', width: 60, renderer: PVE.Utils.format_storage_type },
- { header: 'Shared', dataIndex: 'shared', width: 60, renderer: PVE.Utils.format_boolean },
- { header: 'Enabled', dataIndex: 'disable', width: 60, renderer: PVE.Utils.format_neg_boolean },
- { header: 'Content', dataIndex: 'content', renderer: PVE.Utils.format_content_types,
- sortable: false }
-
- ]
- }),
-
- sm: new Ext.grid.RowSelectionModel({
- singleSelect: true
- }),
-
- listeners: {
- rowdblclick: function() {
- var sm = self.getSelectionModel();
- var sel = sm.getSelected();
- if (!sel) {
- alert("no selection");
- return;
- }
-
- var form = new PVE.StorageConfigPanel();
- var win = new Ext.Window({
- title: "Add/Modify Directory Storage",
- modal: true,
- border:false,
- layout: 'fit',
- maximizable: true,
- items: form,
- width: 800,
- height: 400,
-
- buttons: [
- {
- text: 'OK',
- handler: function(){
- form.submitHandler({
- success: function() {
- win.close();
- }
- });
- }
- },{
- text: 'Cancel',
- handler: function(){
- win.close();
- }
- }
- ]
- });
-
- win.show();
- }
- },
-
- stateful: false,
- border: false
- });
-
- PVE.StorageConfig.superclass.initComponent.call(self);
- }
-
-});
-
-Ext.reg('pveStorageConfig', PVE.StorageConfig);
Added: pve-manager/pve2/www/manager/form/ModifyDirStorage.js
===================================================================
--- pve-manager/pve2/www/manager/form/ModifyDirStorage.js (rev 0)
+++ pve-manager/pve2/www/manager/form/ModifyDirStorage.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -0,0 +1,82 @@
+Ext.ns("PVE.form");
+
+PVE.form.ModifyDirStorage = Ext.extend(PVE.form.StdForm, {
+
+ initComponent : function() {
+ var self = this;
+
+ var storeid = self.confdata.storage;
+
+ var items_col1 = [
+ {
+ xtype: 'textfield',
+ fieldLabel: 'Storage name',
+ name: 'storage'
+ //disabled: true,
+ //allowBlank: false
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: 'Directory',
+ name: 'path',
+ allowBlank: false
+ }
+ ];
+
+ var items_col2 = [
+ {
+ xtype: 'checkbox',
+ fieldLabel: 'Disabled',
+ name: 'disabled',
+ value: 'test1'
+ },
+ {
+ xtype: 'checkbox',
+ fieldLabel: 'Shared',
+ name: 'shared'
+ },
+ {
+ xtype: storeid === 'local' ? 'multiselect' : 'combo',
+ forceSelection: true,
+ editable: false,
+ triggerAction: 'all',
+ fieldLabel: 'Content',
+ name: 'content',
+ style : 'margin-bottom:10px',// avoid scrolbars with Firefox
+ width: 150,
+ height: 'auto',
+ store: [['images', 'Images'], ['backup', 'Backup'],
+ ['vztmpl', 'OpenVZ Templates'], ['iso', 'ISO']]
+ }
+ ];
+
+ // NOTE: If subclassing FormPanel, any configuration options for
+ // the BasicForm must be applied to initialConfig
+ Ext.apply(self, Ext.apply(self.initialConfig, {
+ url: "/api2/extjs/test",
+
+ items: {
+ layout:'column',
+ border: false,
+ defaults: {
+ columnWidth: '.5',
+ border: false
+ },
+ items: [
+ {
+ layout: 'form',
+ defaults: { anchor: '-20' },
+ items: items_col1
+ },
+ {
+ layout: 'form',
+ defaults: { anchor: '100%' },
+ items: items_col2
+ }
+ ]
+ }
+ }));
+
+ PVE.form.ModifyDirStorage.superclass.initComponent.call(self);
+ }
+});
Added: pve-manager/pve2/www/manager/form/StdForm.js
===================================================================
--- pve-manager/pve2/www/manager/form/StdForm.js (rev 0)
+++ pve-manager/pve2/www/manager/form/StdForm.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -0,0 +1,52 @@
+Ext.ns("PVE.form");
+
+PVE.form.StdForm = Ext.extend(Ext.FormPanel, {
+
+ initComponent : function() {
+ var self = this;
+
+ // NOTE: If subclassing FormPanel, any configuration options for
+ // the BasicForm must be applied to initialConfig
+ Ext.apply(self, Ext.apply(self.initialConfig, {
+ bodyStyle: 'padding:5px',
+ autoScroll: true,
+
+ submitHandler: function(options) {
+
+ var form = self.getForm();
+
+ if(form.isValid()){
+ self.el.mask('Please wait...', 'x-mask-loading');
+
+ form.submit({
+ failure: function(f, resp){
+ self.el.unmask();
+ if (Ext.isFunction(options.failure)) {
+ options.failure();
+ } else {
+ Ext.MessageBox.alert('Failure', "Please try again");
+ }
+ },
+ success: function(f, resp){
+ self.el.unmask();
+ if (Ext.isFunction(options.success)) {
+ options.success();
+ } else {
+ Ext.MessageBox.alert('Success', "Submit successful");
+ }
+ }
+ });
+ } else {
+ if (Ext.isFunction(options.failure)) {
+ options.failure();
+ } else {
+ Ext.MessageBox.alert('Failure', "Verify failed");
+ }
+ }
+ }
+ }));
+
+ PVE.form.StdForm.superclass.initComponent.call(self);
+ }
+});
+
Added: pve-manager/pve2/www/manager/window/ModalDialog.js
===================================================================
--- pve-manager/pve2/www/manager/window/ModalDialog.js (rev 0)
+++ pve-manager/pve2/www/manager/window/ModalDialog.js 2010-07-14 12:07:56 UTC (rev 4899)
@@ -0,0 +1,20 @@
+Ext.ns("PVE.window");
+
+PVE.window.ModalDialog = Ext.extend(Ext.Window, {
+
+ initComponent: function() {
+ var self = this;
+
+ self.width = self.width || 800;
+ self.height = self.height || 400;
+
+ Ext.apply(self, {
+ modal: true,
+ border:false,
+ layout: 'fit',
+ maximizable: true
+ });
+
+ PVE.window.ModalDialog.superclass.initComponent.call(self);
+ }
+});
\ No newline at end of file
More information about the pve-devel
mailing list