From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: use pmxInfoWidget instead of pveInfoWidget
Date: Fri, 23 Apr 2021 10:27:48 +0200 [thread overview]
Message-ID: <20210423082748.18119-1-d.csapak@proxmox.com> (raw)
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@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
next reply other threads:[~2021-04-23 8:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 8:27 Dominik Csapak [this message]
2021-04-23 9:06 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210423082748.18119-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox