[pve-devel] [PATCH manager 35/49] use PendingObjectGrid from widget toolkit
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Jan 23 11:05:52 CET 2018
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 -
www/manager6/grid/PendingObjectGrid.js | 95 ----------------------------------
www/manager6/qemu/HardwareView.js | 2 +-
www/manager6/qemu/Options.js | 2 +-
4 files changed, 2 insertions(+), 98 deletions(-)
delete mode 100644 www/manager6/grid/PendingObjectGrid.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index c94a23f1..6fdb7341 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -86,7 +86,6 @@ JSSRC= \
window/Settings.js \
window/StartupEdit.js \
panel/NotesView.js \
- grid/PendingObjectGrid.js \
grid/ResourceGrid.js \
grid/PoolMembers.js \
grid/FirewallRules.js \
diff --git a/www/manager6/grid/PendingObjectGrid.js b/www/manager6/grid/PendingObjectGrid.js
deleted file mode 100644
index 102b9b0d..00000000
--- a/www/manager6/grid/PendingObjectGrid.js
+++ /dev/null
@@ -1,95 +0,0 @@
-Ext.define('PVE.grid.PendingObjectGrid', {
- extend: 'Proxmox.grid.ObjectGrid',
- alias: ['widget.pvePendingObjectGrid'],
-
- getObjectValue: function(key, defaultValue, pending) {
- var me = this;
- var rec = me.store.getById(key);
- if (rec) {
- var value = (pending && Ext.isDefined(rec.data.pending) && (rec.data.pending !== '')) ?
- rec.data.pending : rec.data.value;
-
- if (Ext.isDefined(value) && (value !== '')) {
- return value;
- } else {
- return defaultValue;
- }
- }
- return defaultValue;
- },
-
- hasPendingChanges: function(key) {
- var me = this;
- var rows = me.rows;
- var rowdef = (rows && rows[key]) ? rows[key] : {};
- var keys = rowdef.multiKey || [ key ];
- var pending = false;
-
- Ext.Array.each(keys, function(k) {
- var rec = me.store.getById(k);
- if (rec && rec.data && Ext.isDefined(rec.data.pending) && (rec.data.pending !== '')) {
- pending = true;
- return false; // break
- }
- });
-
- return pending;
- },
-
- renderValue: function(value, metaData, record, rowIndex, colIndex, store) {
- var me = this;
- var rows = me.rows;
- var key = record.data.key;
- var rowdef = (rows && rows[key]) ? rows[key] : {};
- var renderer = rowdef.renderer;
- var current = '';
- var pendingdelete = '';
- var pending = '';
-
- if (renderer) {
- current = renderer(value, metaData, record, rowIndex, colIndex, store, false);
- if (me.hasPendingChanges(key)) {
- pending = renderer(record.data.pending, metaData, record, rowIndex, colIndex, store, true);
- }
- if (pending == current) {
- pending = undefined;
- }
- } else {
- current = value || '';
- pending = record.data.pending;
- }
-
- if (record.data['delete']) {
- pendingdelete = '<div style="text-decoration: line-through;">'+ current +'</div>';
- }
-
- if (pending || pendingdelete) {
- return current + '<div style="color:red">' + (pending || '') + pendingdelete + '</div>';
- } else {
- return current;
- }
- },
-
- initComponent : function() {
- var me = this;
-
- var rows = me.rows;
-
- if (!me.rstore) {
- if (!me.url) {
- throw "no url specified";
- }
-
- me.rstore = Ext.create('PVE.data.ObjectStore', {
- model: 'KeyValuePendingDelete',
- readArray: true,
- url: me.url,
- interval: me.interval,
- extraParams: me.extraParams,
- rows: me.rows
- });
- }
-
- me.callParent();
- }
-});
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 3e7283bc..989b4887 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -1,5 +1,5 @@
Ext.define('PVE.qemu.HardwareView', {
- extend: 'PVE.grid.PendingObjectGrid',
+ extend: 'Proxmox.grid.PendingObjectGrid',
alias: ['widget.PVE.qemu.HardwareView'],
onlineHelp: 'qm_virtual_machines_settings',
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 04d1ce11..8e70d301 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -1,6 +1,6 @@
/*jslint confusion: true */
Ext.define('PVE.qemu.Options', {
- extend: 'PVE.grid.PendingObjectGrid',
+ extend: 'Proxmox.grid.PendingObjectGrid',
alias: ['widget.PVE.qemu.Options'],
onlineHelp: 'qm_options',
--
2.14.2
More information about the pve-devel
mailing list