[pve-devel] r4903 - pve-manager/pve2/www/manager
svn-commits at proxmox.com
svn-commits at proxmox.com
Thu Jul 15 15:29:58 CEST 2010
Author: dietmar
Date: 2010-07-15 13:29:58 +0000 (Thu, 15 Jul 2010)
New Revision: 4903
Modified:
pve-manager/pve2/www/manager/StorageBrowser.js
Log:
implement storage browser
Modified: pve-manager/pve2/www/manager/StorageBrowser.js
===================================================================
--- pve-manager/pve2/www/manager/StorageBrowser.js 2010-07-15 12:01:58 UTC (rev 4902)
+++ pve-manager/pve2/www/manager/StorageBrowser.js 2010-07-15 13:29:58 UTC (rev 4903)
@@ -1,19 +1,75 @@
Ext.ns("PVE");
+PVE.StorageContent = Ext.extend(Ext.grid.GridPanel, {
+
+ initComponent : function() {
+ var self = this;
+
+ var storeid = self.confdata.storage;
+ var node = self.confdata.node || 'localhost';
+
+ if (!storeid)
+ throw "no storage id specified";
+
+ var ct = self.content_type;
+ var params = ct ? { content: ct } : null;
+
+ var store = new Ext.data.JsonStore({
+ url: "/api2/json/storage/content/" + node + "/" + storeid,
+ autoDestory: true,
+ autoLoad: true,
+ root: 'data',
+ restful: true, // use GET, not POST
+ baseParams: params,
+ fields: [ 'format', 'size', 'volname' ]
+ });
+
+ Ext.apply(self, {
+ stateful: false,
+ store: store,
+ //enableHdMenu: false,
+ colModel: new Ext.grid.ColumnModel({
+ columns: [
+ {
+ header: 'Name',
+ width: 300,
+ dataIndex: 'volname'
+ },
+ {
+ header: 'Format',
+ width: 100,
+ dataIndex: 'format'
+ },
+ {
+ header: 'Size',
+ width: 100,
+ dataIndex: 'size'
+ }
+ ]
+ }),
+ viewConfig: { forceFit: true },
+
+ sm: new Ext.grid.RowSelectionModel({singleSelect:true})
+
+ });
+
+ PVE.StorageContent.superclass.initComponent.call(self);
+ }
+});
+
+Ext.reg('pveStorageContent', PVE.StorageContent);
+
PVE.StorageStatus = Ext.extend(PVE.grid.ObjectView, {
initComponent : function() {
var self = this;
var storeid = self.confdata.storage;
- var node = self.confdata.node;
+ var node = self.confdata.node || 'localhost';
if (!storeid)
throw "no storage id specified";
- if (!node)
- throw "no node specified";
-
var smid = Ext.util.base64.encode("storage.status." + node + '.' + storeid);
var store = Ext.StoreMgr.lookup(smid);
@@ -120,10 +176,7 @@
//flex: 1,
},
new PVE.StorageStatus ({
- confdata: {
- storage: self.confdata.storage,
- node: self.confdata.node || 'localhost'
- },
+ confdata: self.confdata,
width: 300
})
]
@@ -226,24 +279,32 @@
id: 'status'
},
{
+ xtype: 'pveStorageContent',
+ confdata: self.confdata,
+ content_type: 'images',
title: 'Images',
- id: 'images',
- html: 'images'
+ id: 'images'
},
{
+ xtype: 'pveStorageContent',
+ confdata: self.confdata,
+ content_type: 'iso',
title: 'ISO',
- id: 'iso',
- html: 'iso'
+ id: 'iso'
},
{
+ xtype: 'pveStorageContent',
+ confdata: self.confdata,
+ content_type: 'vztmpl',
title: 'Templates',
- id: 'vztmpl',
- html: 'vztmpl'
+ id: 'vztmpl'
},
{
+ xtype: 'pveStorageContent',
+ confdata: self.confdata,
+ content_type: 'backup',
title: 'Backups',
- id: 'backup',
- html: 'backup'
+ id: 'backup'
},
{
title: 'Permissions',
More information about the pve-devel
mailing list