[pve-devel] [PATCH manager] ui: use pmxInfoWidget instead of pveInfoWidget

Dominik Csapak d.csapak at proxmox.com
Fri Apr 23 10:27:48 CEST 2021


to prevent that they further diverge than they alread have
(pmxInfoWidget got an additional function that is compatible)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Makefile                    |  1 -
 www/manager6/node/StatusView.js          |  2 +-
 www/manager6/panel/GuestStatusView.js    |  4 +-
 www/manager6/panel/InfoWidget.js         | 96 ------------------------
 www/manager6/panel/TemplateStatusView.js |  2 +-
 www/manager6/storage/StatusView.js       |  2 +-
 6 files changed, 4 insertions(+), 103 deletions(-)
 delete mode 100644 www/manager6/panel/InfoWidget.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index cd930cfd..eedf5aad 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -77,7 +77,6 @@ JSSRC= 							\
 	panel/ConfigPanel.js				\
 	panel/HealthWidget.js				\
 	panel/IPSet.js					\
-	panel/InfoWidget.js				\
 	panel/NotesView.js				\
 	panel/RunningChart.js				\
 	panel/StatusPanel.js				\
diff --git a/www/manager6/node/StatusView.js b/www/manager6/node/StatusView.js
index afbc57e8..564658c4 100644
--- a/www/manager6/node/StatusView.js
+++ b/www/manager6/node/StatusView.js
@@ -16,7 +16,7 @@ Ext.define('PVE.node.StatusView', {
     },
 
     defaults: {
-	xtype: 'pveInfoWidget',
+	xtype: 'pmxInfoWidget',
 	padding: '0 15 5 15',
     },
 
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index 8d16827e..5929d9bf 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -19,7 +19,7 @@ Ext.define('PVE.panel.GuestStatusView', {
     },
 
     defaults: {
-	xtype: 'pveInfoWidget',
+	xtype: 'pmxInfoWidget',
 	padding: '2 25',
     },
     items: [
@@ -52,7 +52,6 @@ Ext.define('PVE.panel.GuestStatusView', {
 	    renderer: PVE.Utils.format_ha,
 	},
 	{
-	    xtype: 'pveInfoWidget',
 	    itemId: 'node',
 	    iconCls: 'fa fa-building fa-fw',
 	    title: gettext('Node'),
@@ -85,7 +84,6 @@ Ext.define('PVE.panel.GuestStatusView', {
 	},
 	{
 	    itemId: 'swap',
-	    xtype: 'pveInfoWidget',
 	    iconCls: 'fa fa-refresh fa-fw',
 	    title: gettext('SWAP usage'),
 	    valueField: 'swap',
diff --git a/www/manager6/panel/InfoWidget.js b/www/manager6/panel/InfoWidget.js
deleted file mode 100644
index f3b07038..00000000
--- a/www/manager6/panel/InfoWidget.js
+++ /dev/null
@@ -1,96 +0,0 @@
-Ext.define('PVE.widget.Info', {
-    extend: 'Ext.container.Container',
-    alias: 'widget.pveInfoWidget',
-
-    layout: {
-	type: 'vbox',
-	align: 'stretch',
-    },
-
-    value: 0,
-    maximum: 1,
-    printBar: true,
-    items: [
-	{
-	    xtype: 'component',
-	    itemId: 'label',
-	    data: {
-		title: '',
-		usage: '',
-		iconCls: undefined,
-	    },
-	    tpl: [
-		'<div class="left-aligned">',
-		'<tpl if="iconCls">',
-		'<i class="{iconCls}"></i> ',
-		'</tpl>',
-		'{title}</div> <div class="right-aligned">{usage}</div>',
-	    ],
-	},
-	{
-	    height: 2,
-	    border: 0,
-	},
-	{
-	    xtype: 'progressbar',
-	    itemId: 'progress',
-	    height: 5,
-	    value: 0,
-	    animate: true,
-	},
-    ],
-
-    warningThreshold: 0.6,
-    criticalThreshold: 0.9,
-
-    setPrintBar: function(enable) {
-	var me = this;
-	me.printBar = enable;
-	me.getComponent('progress').setVisible(enable);
-    },
-
-    setIconCls: function(iconCls) {
-	var me = this;
-	me.getComponent('label').data.iconCls = iconCls;
-    },
-
-    updateValue: function(text, usage) {
-	var me = this;
-	var label = me.getComponent('label');
-	label.update(Ext.apply(label.data, { title: me.title, usage: text }));
-
-	if (usage !== undefined &&
-	    me.printBar &&
-	    Ext.isNumeric(usage) &&
-	    usage >= 0) {
-	    var progressBar = me.getComponent('progress');
-	    progressBar.updateProgress(usage, '');
-	    if (usage > me.criticalThreshold) {
-		progressBar.removeCls('warning');
-		progressBar.addCls('critical');
-	    } else if (usage > me.warningThreshold) {
-		progressBar.removeCls('critical');
-		progressBar.addCls('warning');
-	    } else {
-		progressBar.removeCls('warning');
-		progressBar.removeCls('critical');
-	    }
-	}
-    },
-
-    initComponent: function() {
-	var me = this;
-
-	if (!me.title) {
-	    throw "no title defined";
-	}
-
-	me.callParent();
-
-	me.getComponent('progress').setVisible(me.printBar);
-
-	me.updateValue(me.text, me.value);
-	me.setIconCls(me.iconCls);
-    },
-
-});
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index 44d983b3..4e17a41c 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -8,7 +8,7 @@ Ext.define('PVE.panel.TemplateStatusView', {
     },
 
     defaults: {
-	xtype: 'pveInfoWidget',
+	xtype: 'pmxInfoWidget',
 	printBar: false,
 	padding: '2 25',
     },
diff --git a/www/manager6/storage/StatusView.js b/www/manager6/storage/StatusView.js
index 923d73f2..f3450218 100644
--- a/www/manager6/storage/StatusView.js
+++ b/www/manager6/storage/StatusView.js
@@ -11,7 +11,7 @@ Ext.define('PVE.storage.StatusView', {
     },
 
     defaults: {
-	xtype: 'pveInfoWidget',
+	xtype: 'pmxInfoWidget',
 	padding: '0 30 5 30',
     },
     items: [
-- 
2.20.1






More information about the pve-devel mailing list