[pve-devel] [PATCH manager 06/14] turn nodename, storage, sm into object variables
Fabian Ebner
f.ebner at proxmox.com
Wed Sep 2 13:03:29 CEST 2020
so they can be used and specified in derived classes.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
www/manager6/storage/ContentView.js | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index 45e40074..e7c3bc70 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -360,15 +360,21 @@ Ext.define('PVE.storage.ContentView', {
initComponent : function() {
var me = this;
- var nodename = me.pveSelNode.data.node;
- if (!nodename) {
- throw "no node name specified";
+ if (!me.nodename) {
+ me.nodename = me.pveSelNode.data.node;
+ if (!me.nodename) {
+ throw "no node name specified";
+ }
}
+ var nodename = me.nodename;
- var storage = me.pveSelNode.data.storage;
- if (!storage) {
- throw "no storage ID specified";
+ if (!me.storage) {
+ me.storage = me.pveSelNode.data.storage;
+ if (!me.storage) {
+ throw "no storage ID specified";
+ }
}
+ var storage = me.storage;
var content = me.content;
if (!content) {
@@ -376,7 +382,7 @@ Ext.define('PVE.storage.ContentView', {
}
var baseurl = "/nodes/" + nodename + "/storage/" + storage + "/content";
- var store = Ext.create('Ext.data.Store',{
+ var store = me.store = Ext.create('Ext.data.Store', {
model: 'pve-storage-content',
groupField: 'content',
proxy: {
@@ -389,7 +395,10 @@ Ext.define('PVE.storage.ContentView', {
}
});
- var sm = Ext.create('Ext.selection.RowModel', {});
+ if (!me.sm) {
+ me.sm = Ext.create('Ext.selection.RowModel', {});
+ }
+ var sm = me.sm;
var reload = function() {
store.load();
--
2.20.1
More information about the pve-devel
mailing list