[pve-devel] [PATCH manager 2/3] add loadMask to Disk and SMART grid
Dominik Csapak
d.csapak at proxmox.com
Tue Oct 4 13:39:36 CEST 2016
also use the hasMany reference of the model
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
little extjs rant:
if you define a model with a hasMany relation
it autogenerates a method for it, so that you
can get the data out easily
so a record is a model, and you call the method
of the submodel and you get .... a store?
why, extjs?
www/manager6/node/Disks.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/www/manager6/node/Disks.js b/www/manager6/node/Disks.js
index e19f741..2db95d3 100644
--- a/www/manager6/node/Disks.js
+++ b/www/manager6/node/Disks.js
@@ -187,6 +187,9 @@ Ext.define('PVE.node.DiskList', {
}
});
+ me.loadCount = 1; // avoid duplicate loadmask
+ PVE.Utils.monStoreErrors(me, store);
+
Ext.apply(me, {
emptyText: gettext('No Disk found'),
store: store,
@@ -295,16 +298,24 @@ Ext.define('PVE.DiskSmartWindow', {
}
me.store = Ext.create('Ext.data.Store', {
- model: 'smart-attribute',
+ model: 'disk-smart',
proxy: {
type: 'pve',
- root: 'data.attributes',
url: "/api2/json/nodes/" + nodename + "/disks/smart?disk=" + dev
}
});
me.callParent();
- me.down('#smarts').setStore(me.store);
+ var grid = me.down('#smarts');
+
+ PVE.Utils.monStoreErrors(grid, me.store);
+ me.mon(me.store, 'load', function(s, records, success) {
+ if (success && records.length > 0) {
+ var rec = records[0];
+ grid.setStore(rec.attributes());
+ }
+ });
+
me.store.load();
}
}, function() {
--
2.1.4
More information about the pve-devel
mailing list