* [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit
@ 2021-04-19 11:00 Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE Dominik Csapak
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
manager needs a depends on a bumped widget-toolkit ofc
proxmox-widget-toolkit:
Dominik Csapak (4):
Utils: add several render functions from PVE
bring over some icons from PVE
Utils: refactor updateColumns from pve-manager
panel: add StatusView from PVE
src/Makefile | 1 +
src/Utils.js | 90 +++++++++++++++++++++++++++++
src/css/ext6-pmx.css | 25 ++++++++
src/images/Makefile | 8 ++-
src/images/icon-cpu.png | Bin 0 -> 205 bytes
src/images/icon-cpu.xcf | Bin 0 -> 816 bytes
src/images/icon-ram.png | Bin 0 -> 193 bytes
src/images/icon-ram.xcf | Bin 0 -> 747 bytes
src/panel/StatusView.js | 125 ++++++++++++++++++++++++++++++++++++++++
9 files changed, 248 insertions(+), 1 deletion(-)
create mode 100644 src/images/icon-cpu.png
create mode 100644 src/images/icon-cpu.xcf
create mode 100644 src/images/icon-ram.png
create mode 100644 src/images/icon-ram.xcf
create mode 100644 src/panel/StatusView.js
pve-manger:
Dominik Csapak (4):
ui: Utils: use render functions from widget-toolkit
ui: use some icons from widget-toolkit
ui: Utils: use updateColumns from widget-toolkit
ui: panel/StatusView: use from widget-toolkit instead
www/css/ext6-pve.css | 12 ---
www/images/Makefile | 4 +-
www/images/icon-cpu.png | Bin 205 -> 0 bytes
www/images/icon-cpu.xcf | Bin 816 -> 0 bytes
www/images/icon-ram.png | Bin 193 -> 0 bytes
www/images/icon-ram.xcf | Bin 747 -> 0 bytes
www/manager6/Makefile | 1 -
www/manager6/Utils.js | 88 +---------------
www/manager6/ceph/OSD.js | 2 +-
www/manager6/ceph/Pool.js | 4 +-
www/manager6/ceph/Status.js | 4 +-
www/manager6/data/ResourceStore.js | 6 +-
www/manager6/dc/Summary.js | 8 +-
www/manager6/form/NodeSelector.js | 2 +-
www/manager6/ha/GroupEdit.js | 2 +-
www/manager6/lxc/Resources.js | 4 +-
www/manager6/node/StatusView.js | 25 ++---
www/manager6/node/Summary.js | 4 +-
www/manager6/node/ZFS.js | 2 +-
www/manager6/panel/GuestStatusView.js | 12 +--
www/manager6/panel/GuestSummary.js | 4 +-
www/manager6/panel/StatusView.js | 126 -----------------------
www/manager6/panel/TemplateStatusView.js | 12 +--
www/manager6/qemu/HardwareView.js | 4 +-
www/manager6/storage/StatusView.js | 2 +-
www/manager6/window/Migrate.js | 2 +-
26 files changed, 49 insertions(+), 281 deletions(-)
delete mode 100644 www/images/icon-cpu.png
delete mode 100644 www/images/icon-cpu.xcf
delete mode 100644 www/images/icon-ram.png
delete mode 100644 www/images/icon-ram.xcf
delete mode 100644 www/manager6/panel/StatusView.js
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 2/4] bring over some icons " Dominik Csapak
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
we need the 'render_cpu_model' and '*_usage' methods in PBS,
the rest are the dependencies
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/Utils.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/src/Utils.js b/src/Utils.js
index 3fd8f91..9d785a8 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -841,6 +841,66 @@ utilities: {
return value;
},
+ render_usage: function(val) {
+ return (val*100).toFixed(2) + '%';
+ },
+
+ render_cpu_usage: function(val, max) {
+ return Ext.String.format(gettext('{0}% of {1}') +
+ ' ' + gettext('CPU(s)'), (val*100).toFixed(2), max);
+ },
+
+ render_size_usage: function(val, max) {
+ if (max === 0) {
+ return gettext('N/A');
+ }
+ return (val*100/max).toFixed(2) + '% (' +
+ Ext.String.format(gettext('{0} of {1}'),
+ Proxmox.Utils.render_size(val), Proxmox.Utils.render_size(max)) + ')';
+ },
+
+ render_cpu: function(value, metaData, record, rowIndex, colIndex, store) {
+ if (!(record.data.uptime && Ext.isNumeric(value))) {
+ return '';
+ }
+
+ var maxcpu = record.data.maxcpu || 1;
+
+ if (!Ext.isNumeric(maxcpu) && maxcpu >= 1) {
+ return '';
+ }
+
+ var per = value * 100;
+
+ return per.toFixed(1) + '% of ' + maxcpu.toString() + (maxcpu > 1 ? 'CPUs' : 'CPU');
+ },
+
+ render_size: function(value, metaData, record, rowIndex, colIndex, store) {
+ if (!Ext.isNumeric(value)) {
+ return '';
+ }
+
+ return Proxmox.Utils.format_size(value);
+ },
+
+ render_cpu_model: function(cpuinfo) {
+ return cpuinfo.cpus + " x " + cpuinfo.model + " (" +
+ cpuinfo.sockets.toString() + " " +
+ (cpuinfo.sockets > 1
+ ? gettext('Sockets')
+ : gettext('Socket')
+ ) + ")";
+ },
+
+ /* this is different for nodes */
+ render_node_cpu_usage: function(value, record) {
+ return Proxmox.Utils.render_cpu_usage(value, record.cpus);
+ },
+
+ render_node_size_usage: function(record) {
+ return Proxmox.Utils.render_size_usage(record.used, record.total);
+ },
+
loadTextFromFile: function(file, callback, maxBytes) {
let maxSize = maxBytes || 8192;
if (file.size > maxSize) {
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH widget-toolkit 2/4] bring over some icons from PVE
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 3/4] Utils: refactor updateColumns from pve-manager Dominik Csapak
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
we want to reuse them in PBS
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/css/ext6-pmx.css | 25 +++++++++++++++++++++++++
src/images/Makefile | 8 +++++++-
src/images/icon-cpu.png | Bin 0 -> 205 bytes
src/images/icon-cpu.xcf | Bin 0 -> 816 bytes
src/images/icon-ram.png | Bin 0 -> 193 bytes
src/images/icon-ram.xcf | Bin 0 -> 747 bytes
6 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 src/images/icon-cpu.png
create mode 100644 src/images/icon-cpu.xcf
create mode 100644 src/images/icon-ram.png
create mode 100644 src/images/icon-ram.xcf
diff --git a/src/css/ext6-pmx.css b/src/css/ext6-pmx.css
index 5328a23..97e5018 100644
--- a/src/css/ext6-pmx.css
+++ b/src/css/ext6-pmx.css
@@ -87,3 +87,28 @@ div.right-aligned {
font-size: 14px;
margin-top: 2px;
}
+
+.pmx-icon {
+ height: 16px;
+ background-position: bottom;
+ vertical-align: bottom;
+ padding: 0;
+}
+
+.pmx-itype-icon-memory,
+.pmx-itype-icon-processor
+{
+ background-repeat: no-repeat;
+ background-position:3px center;
+ padding-left: 20px;
+}
+
+.pmx-itype-icon-memory
+{
+ background-image:url(../images/icon-ram.png);
+}
+
+.pmx-itype-icon-processor
+{
+ background-image:url(../images/icon-cpu.png);
+}
diff --git a/src/images/Makefile b/src/images/Makefile
index 45bc50a..5b1d6e9 100644
--- a/src/images/Makefile
+++ b/src/images/Makefile
@@ -1,6 +1,12 @@
+# icon-cpu, icon-ram
+# are self made (sources as .xcf)
+
include ../defines.mk
-IMAGES=pmx-clear-trigger.png
+IMAGES=pmx-clear-trigger.png \
+ icon-cpu.png \
+ icon-ram.png \
+
all:
diff --git a/src/images/icon-cpu.png b/src/images/icon-cpu.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1cc6c2b1eaa188e52ee2f7661911874d56e132d
GIT binary patch
literal 205
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b
z3=G`DAk4@xYmNj^kiEpy*OmPNvlth@M);3UAfq@+Tq8=H^K)}k^GX=Lotd^DDCXwr
z;uvCaIyu3C^?&D*hYg*LP6s-UmQDI%xF|D4#mTs<N=(J~e`f)w@-9~$6)V}hq7ktU
rK@vT?8n|9IJeqRC;K9t!BnAe%cxjpJUyk#DCNg-s`njxgN@xNAPL)7X
literal 0
HcmV?d00001
diff --git a/src/images/icon-cpu.xcf b/src/images/icon-cpu.xcf
new file mode 100644
index 0000000000000000000000000000000000000000..be5e6034fa4398d08a6d31a27dcd07a864f054d7
GIT binary patch
literal 816
zcmb_aOHRWu5VcJUC8eT#S1i0t7eVcY1N0PZ(=;&_`BX_NwGt9n-~wEeT?uaz8xj$A
zO!Pc&-pphiJ4z=TxeFp0={RJtsR8i|fO9NYz-al#7y)(-41gox)^Mu3LHz^#MB%kw
zkR?f&mWUZ832a(tbmFVfQ@LJ~h6HDBQSReV7Fn#<Gslfoki}Up-P(D%TKRH*Kd-Ha
zEKF*K)>Tid&C9<DweE_IALvxcg`EX)-zOT)+ormdIt`w}g8H*4D#G%6gVg<7YLsp(
zor5v{ZW+A24m!N?(hr_ho^8|m*n}xNhNsJ@fRW);erh-zyK8Z$#m6mv*5Z>EKL@Ax
zS~~%ud1UrSuzP_d9_!4{)=?|st|ne6e#I^=1pBD)1<f;T2Lt9*f{AJb2zEflusWcS
VBmSfS3;&l)Gr_4k<2%76`vM+NtEK<|
literal 0
HcmV?d00001
diff --git a/src/images/icon-ram.png b/src/images/icon-ram.png
new file mode 100644
index 0000000000000000000000000000000000000000..cf9c8121777844a6f3f74ea15a585055be5a6cc9
GIT binary patch
literal 193
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b
z3=G`DAk4@xYmNj^kiEpy*OmPNvlthr{`_MH%7H>0C9V-A&iT2ysd*&~-_A_i4-~WV
zba4!^IQ{m5As2%JkMqUl75}xb$Cg|uGx5$)P_5Y~rF65tPQc*WgAF<5&GS+(Xgf?Z
g=vXDX{a-6*o2&rSws$7VKvNhzUHx3vIVCg!06ddBl>h($
literal 0
HcmV?d00001
diff --git a/src/images/icon-ram.xcf b/src/images/icon-ram.xcf
new file mode 100644
index 0000000000000000000000000000000000000000..1507a041f1f0e51d2991c501280ce38ed5179b1f
GIT binary patch
literal 747
zcmZ`%%TB{E5Og90r6Ewn<HW(o^bpiuxPtl>T+`Gs7I{=jDzy?4zrYXhlN_l^n04(a
z6=9|Ej%R0+jUB17C11x0PgE)xVq`%45^x+WSHNKQ!59H?4IBYO;MQ>R-N65V>`Od0
zjEgK2d5t}zB7u!`MP-o`p)A#cG!z^bRP`nmyed+)7!QL)#zk6`JkTjD<vik(`-zSo
zGBu?!TIW5jw$A@2)Vi*gQLJ*wr}kYCH+`bf!d0$nuJZUrRMcN2NhRubK<fT0?Uln;
zItLTZr)9|YI_U7cSros@vRLK%*j!^fMyAVXfPvv;KQ$bQ-E}x!8u=+a!1A*W_dEOo
zoStjr1jP2(AHmLolKX6oc64~%^iXr(X#b8WEgso<v%@ENY}+6;PV>_)-z2m<t@lV<
T?ef?TR=;uBmu}j(Vtr!2fCZER
literal 0
HcmV?d00001
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH widget-toolkit 3/4] Utils: refactor updateColumns from pve-manager
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 2/4] bring over some icons " Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE Dominik Csapak
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
we want to reuse this in pbs
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/Utils.js | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/Utils.js b/src/Utils.js
index 9d785a8..adff5f4 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -1060,6 +1060,36 @@ utilities: {
}
return acme;
},
+
+ updateColumns: function(container) {
+ let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
+ let factor;
+ if (mode !== 'auto') {
+ factor = parseInt(mode, 10);
+ if (Number.isNaN(factor)) {
+ factor = 1;
+ }
+ } else {
+ factor = container.getSize().width < 1400 ? 1 : 2;
+ }
+
+ if (container.oldFactor === factor) {
+ return;
+ }
+
+ let items = container.query('>'); // direct childs
+ factor = Math.min(factor, items.length);
+ container.oldFactor = factor;
+
+ items.forEach((item) => {
+ item.columnWidth = 1 / factor;
+ });
+
+ // we have to update the layout twice, since the first layout change
+ // can trigger the scrollbar which reduces the amount of space left
+ container.updateLayout();
+ container.updateLayout();
+ },
},
singleton: true,
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (2 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 3/4] Utils: refactor updateColumns from pve-manager Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-22 18:38 ` [pve-devel] applied: " Thomas Lamprecht
2021-04-19 11:00 ` [pve-devel] [PATCH manager 1/4] ui: Utils: use render functions from widget-toolkit Dominik Csapak
` (4 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
with 2 minor fixups:
* one lint error
* binding of the 'updateValues' function in the event
(we want to avoid breaking this when used in a context where
a controller exists, in that case using a string will only look in
the controller and not in the component itself anymore, so use
the function directly)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/Makefile | 1 +
src/panel/StatusView.js | 125 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 126 insertions(+)
create mode 100644 src/panel/StatusView.js
diff --git a/src/Makefile b/src/Makefile
index f97c74a..9e3ad4e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -53,6 +53,7 @@ JSSRC= \
panel/ACMEAccount.js \
panel/ACMEPlugin.js \
panel/ACMEDomains.js \
+ panel/StatusView.js \
window/Edit.js \
window/PasswordEdit.js \
window/SafeDestroy.js \
diff --git a/src/panel/StatusView.js b/src/panel/StatusView.js
new file mode 100644
index 0000000..059508a
--- /dev/null
+++ b/src/panel/StatusView.js
@@ -0,0 +1,125 @@
+Ext.define('Proxmox.panel.StatusView', {
+ extend: 'Ext.panel.Panel',
+ alias: 'widget.pmxStatusView',
+
+ layout: {
+ type: 'column',
+ },
+
+ title: gettext('Status'),
+
+ getRecordValue: function(key, store) {
+ if (!key) {
+ throw "no key given";
+ }
+ var me = this;
+
+ if (store === undefined) {
+ store = me.getStore();
+ }
+
+ var rec = store.getById(key);
+ if (rec) {
+ return rec.data.value;
+ }
+
+ return '';
+ },
+
+ fieldRenderer: function(val, max) {
+ if (max === undefined) {
+ return val;
+ }
+
+ if (!Ext.isNumeric(max) || max === 1) {
+ return Proxmox.Utils.render_usage(val);
+ }
+ return Proxmox.Utils.render_size_usage(val, max);
+ },
+
+ fieldCalculator: function(used, max) {
+ if (!Ext.isNumeric(max) && Ext.isNumeric(used)) {
+ return used;
+ } else if (!Ext.isNumeric(used)) {
+ /* we come here if the field is from a node
+ * where the records are not mem and maxmem
+ * but mem.used and mem.total
+ */
+ if (used.used !== undefined &&
+ used.total !== undefined) {
+ return used.used/used.total;
+ }
+ }
+
+ return used/max;
+ },
+
+ updateField: function(field) {
+ var me = this;
+ var renderer = me.fieldRenderer;
+ if (Ext.isFunction(field.renderer)) {
+ renderer = field.renderer;
+ }
+ if (field.multiField === true) {
+ field.updateValue(renderer.call(field, me.getStore().getRecord()));
+ } else if (field.textField !== undefined) {
+ field.updateValue(renderer.call(field, me.getRecordValue(field.textField)));
+ } else if (field.valueField !== undefined) {
+ var used = me.getRecordValue(field.valueField);
+ /* string and int */
+ var max = field.maxField !== undefined ? me.getRecordValue(field.maxField) : 1;
+
+ var calculate = me.fieldCalculator;
+
+ if (Ext.isFunction(field.calculate)) {
+ calculate = field.calculate;
+ }
+ field.updateValue(renderer.call(field, used, max), calculate(used, max));
+ }
+ },
+
+ getStore: function() {
+ var me = this;
+ if (!me.rstore) {
+ throw "there is no rstore";
+ }
+
+ return me.rstore;
+ },
+
+ updateTitle: function() {
+ var me = this;
+ me.setTitle(me.getRecordValue('name'));
+ },
+
+ updateValues: function(store, records, success) {
+ if (!success) {
+ return; // do not update if store load was not successful
+ }
+ var me = this;
+ var itemsToUpdate = me.query('pmxInfoWidget');
+
+ itemsToUpdate.forEach(me.updateField, me);
+
+ me.updateTitle(store);
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ if (!me.rstore) {
+ throw "no rstore given";
+ }
+
+ if (!me.title) {
+ throw "no title given";
+ }
+
+ Proxmox.Utils.monStoreErrors(me, me.rstore);
+
+ me.callParent();
+
+ me.mon(me.rstore, 'load', me.updateValues, me);
+ },
+
+});
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH manager 1/4] ui: Utils: use render functions from widget-toolkit
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (3 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 2/4] ui: use some icons " Dominik Csapak
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
they live there now, so we can delete them here and use the ones from
widget-toolkit instead
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/manager6/Utils.js | 58 +-----------------------
www/manager6/ceph/OSD.js | 2 +-
www/manager6/ceph/Pool.js | 4 +-
www/manager6/ceph/Status.js | 4 +-
www/manager6/data/ResourceStore.js | 6 +--
www/manager6/dc/Summary.js | 4 +-
www/manager6/form/NodeSelector.js | 2 +-
www/manager6/ha/GroupEdit.js | 2 +-
www/manager6/node/StatusView.js | 19 +++-----
www/manager6/node/ZFS.js | 2 +-
www/manager6/panel/GuestStatusView.js | 6 +--
www/manager6/panel/StatusView.js | 4 +-
www/manager6/panel/TemplateStatusView.js | 6 +--
www/manager6/window/Migrate.js | 2 +-
14 files changed, 30 insertions(+), 91 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index f502950f..48d94a64 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -935,22 +935,6 @@ Ext.define('PVE.Utils', {
return PVE.Utils.log_severity_hash[value] || value;
},
- render_cpu: function(value, metaData, record, rowIndex, colIndex, store) {
- if (!(record.data.uptime && Ext.isNumeric(value))) {
- return '';
- }
-
- var maxcpu = record.data.maxcpu || 1;
-
- if (!Ext.isNumeric(maxcpu) && maxcpu >= 1) {
- return '';
- }
-
- var per = value * 100;
-
- return per.toFixed(1) + '% of ' + maxcpu.toString() + (maxcpu > 1 ? 'CPUs' : 'CPU');
- },
-
calculate_hostcpu: function(data) {
if (!(data.uptime && Ext.isNumeric(data.cpu))) {
@@ -1001,14 +985,6 @@ Ext.define('PVE.Utils', {
return per.toFixed(1) + '% of ' + maxcpu.toString() + (maxcpu > 1 ? 'CPUs' : 'CPU');
},
- render_size: function(value, metaData, record, rowIndex, colIndex, store) {
- if (!Ext.isNumeric(value)) {
- return '';
- }
-
- return Proxmox.Utils.format_size(value);
- },
-
render_bandwidth: function(value) {
if (!Ext.isNumeric(value)) {
return '';
@@ -1113,7 +1089,7 @@ Ext.define('PVE.Utils', {
return '';
}
- return PVE.Utils.render_size(value);
+ return Proxmox.Utils.render_size(value);
},
calculate_disk_usage: function(data) {
@@ -1147,7 +1123,7 @@ Ext.define('PVE.Utils', {
return '';
}
- return PVE.Utils.render_size(value);
+ return Proxmox.Utils.render_size(value);
},
get_object_icon_class: function(type, record) {
@@ -1197,36 +1173,6 @@ Ext.define('PVE.Utils', {
return Proxmox.Utils.format_task_description(type, id);
},
- /* render functions for new status panel */
-
- render_usage: function(val) {
- return (val*100).toFixed(2) + '%';
- },
-
- render_cpu_usage: function(val, max) {
- return Ext.String.format(gettext('{0}% of {1}') +
- ' ' + gettext('CPU(s)'), (val*100).toFixed(2), max);
- },
-
- render_size_usage: function(val, max) {
- if (max === 0) {
- return gettext('N/A');
- }
- return (val*100/max).toFixed(2) + '% '+ '(' +
- Ext.String.format(gettext('{0} of {1}'),
- PVE.Utils.render_size(val), PVE.Utils.render_size(max)) + ')';
- },
-
- /* this is different for nodes */
- render_node_cpu_usage: function(value, record) {
- return PVE.Utils.render_cpu_usage(value, record.cpus);
- },
-
- /* this is different for nodes */
- render_node_size_usage: function(record) {
- return PVE.Utils.render_size_usage(record.used, record.total);
- },
-
render_optional_url: function(value) {
var match;
if (value && (match = value.match(/^https?:\/\//)) !== null) {
diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index 51409163..13cd2fc5 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -536,7 +536,7 @@ Ext.define('PVE.node.CephOsdTree', {
},
render_osd_size: function(value, metaData, rec) {
- return this.render_osd_val(PVE.Utils.render_size(value), metaData, rec);
+ return this.render_osd_val(Proxmox.Utils.render_size(value), metaData, rec);
},
control: {
diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index 5dabd4e6..e1c73e87 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -169,11 +169,11 @@ Ext.define('PVE.node.CephPoolList', {
text: gettext('Total'),
width: 100,
sortable: true,
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
align: 'right',
dataIndex: 'bytes_used',
summaryType: 'sum',
- summaryRenderer: PVE.Utils.render_size,
+ summaryRenderer: Proxmox.Utils.render_size,
},
],
},
diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index 96b190c0..c3545d37 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -309,8 +309,8 @@ Ext.define('PVE.node.CephStatus', {
let total = pgmap.bytes_total;
var text = Ext.String.format(gettext('{0} of {1}'),
- PVE.Utils.render_size(used),
- PVE.Utils.render_size(total),
+ Proxmox.Utils.render_size(used),
+ Proxmox.Utils.render_size(total),
);
// update the usage widget
diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js
index 4854b8fe..948ee410 100644
--- a/www/manager6/data/ResourceStore.js
+++ b/www/manager6/data/ResourceStore.js
@@ -145,7 +145,7 @@ Ext.define('PVE.data.ResourceStore', {
maxdisk: {
header: gettext('Disk size'),
type: 'integer',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
sortable: true,
hidden: true,
width: 100,
@@ -170,7 +170,7 @@ Ext.define('PVE.data.ResourceStore', {
maxmem: {
header: gettext('Memory size'),
type: 'integer',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
hidden: true,
sortable: true,
width: 100,
@@ -178,7 +178,7 @@ Ext.define('PVE.data.ResourceStore', {
cpu: {
header: gettext('CPU usage'),
type: 'float',
- renderer: PVE.Utils.render_cpu,
+ renderer: Proxmox.Utils.render_cpu,
sortable: true,
width: 100,
},
diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index 5b09116b..67d5e95b 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -209,10 +209,10 @@ Ext.define('PVE.dc.Summary', {
var text = Ext.String.format(gettext('of {0} CPU(s)'), maxcpu);
cpustat.updateValue(cpu/maxcpu, text);
- text = Ext.String.format(gettext('{0} of {1}'), PVE.Utils.render_size(memory), PVE.Utils.render_size(maxmem));
+ text = Ext.String.format(gettext('{0} of {1}'), Proxmox.Utils.render_size(memory), Proxmox.Utils.render_size(maxmem));
memorystat.updateValue(memory/maxmem, text);
- text = Ext.String.format(gettext('{0} of {1}'), PVE.Utils.render_size(used), PVE.Utils.render_size(total));
+ text = Ext.String.format(gettext('{0} of {1}'), Proxmox.Utils.render_size(used), Proxmox.Utils.render_size(total));
storagestat.updateValue(used/total, text);
gueststatus.updateValues(qemu, lxc, error);
diff --git a/www/manager6/form/NodeSelector.js b/www/manager6/form/NodeSelector.js
index 4a0f7da7..1a0b5915 100644
--- a/www/manager6/form/NodeSelector.js
+++ b/www/manager6/form/NodeSelector.js
@@ -54,7 +54,7 @@ Ext.define('PVE.form.NodeSelector', {
},
{
header: gettext('CPU usage'),
- renderer: PVE.Utils.render_cpu,
+ renderer: Proxmox.Utils.render_cpu,
sortable: true,
width: 100,
dataIndex: 'cpu',
diff --git a/www/manager6/ha/GroupEdit.js b/www/manager6/ha/GroupEdit.js
index b061cfa0..d3b34953 100644
--- a/www/manager6/ha/GroupEdit.js
+++ b/www/manager6/ha/GroupEdit.js
@@ -66,7 +66,7 @@ Ext.define('PVE.ha.GroupInputPanel', {
},
{
header: gettext('CPU usage'),
- renderer: PVE.Utils.render_cpu,
+ renderer: Proxmox.Utils.render_cpu,
sortable: true,
width: 150,
dataIndex: 'cpu',
diff --git a/www/manager6/node/StatusView.js b/www/manager6/node/StatusView.js
index 2af7fb04..bc16da6a 100644
--- a/www/manager6/node/StatusView.js
+++ b/www/manager6/node/StatusView.js
@@ -27,7 +27,7 @@ Ext.define('PVE.node.StatusView', {
title: gettext('CPU usage'),
valueField: 'cpu',
maxField: 'cpuinfo',
- renderer: PVE.Utils.render_node_cpu_usage,
+ renderer: Proxmox.Utils.render_node_cpu_usage,
},
{
itemId: 'wait',
@@ -54,7 +54,7 @@ Ext.define('PVE.node.StatusView', {
title: gettext('RAM usage'),
valueField: 'memory',
maxField: 'memory',
- renderer: PVE.Utils.render_node_size_usage,
+ renderer: Proxmox.Utils.render_node_size_usage,
},
{
itemId: 'ksm',
@@ -62,7 +62,7 @@ Ext.define('PVE.node.StatusView', {
title: gettext('KSM sharing'),
textField: 'ksm',
renderer: function(record) {
- return PVE.Utils.render_size(record.shared);
+ return Proxmox.Utils.render_size(record.shared);
},
padding: '0 15 10 15',
},
@@ -72,7 +72,7 @@ Ext.define('PVE.node.StatusView', {
title: gettext('HD space') + '(root)',
valueField: 'rootfs',
maxField: 'rootfs',
- renderer: PVE.Utils.render_node_size_usage,
+ renderer: Proxmox.Utils.render_node_size_usage,
},
{
iconCls: 'fa fa-fw fa-refresh',
@@ -81,7 +81,7 @@ Ext.define('PVE.node.StatusView', {
title: gettext('SWAP usage'),
valueField: 'swap',
maxField: 'swap',
- renderer: PVE.Utils.render_node_size_usage,
+ renderer: Proxmox.Utils.render_node_size_usage,
},
{
xtype: 'box',
@@ -94,14 +94,7 @@ Ext.define('PVE.node.StatusView', {
printBar: false,
title: gettext('CPU(s)'),
textField: 'cpuinfo',
- renderer: function(cpuinfo) {
- return cpuinfo.cpus + " x " + cpuinfo.model + " (" +
- cpuinfo.sockets.toString() + " " +
- (cpuinfo.sockets > 1
- ? gettext('Sockets')
- : gettext('Socket')
- ) + ")";
- },
+ renderer: Proxmox.Utils.render_cpu_model,
value: '',
},
{
diff --git a/www/manager6/node/ZFS.js b/www/manager6/node/ZFS.js
index 06d48c8f..e7b58c3c 100644
--- a/www/manager6/node/ZFS.js
+++ b/www/manager6/node/ZFS.js
@@ -139,7 +139,7 @@ Ext.define('PVE.node.CreateZFS', {
{
text: gettext('Size'),
dataIndex: 'size',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
flex: 1,
},
{
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index 8dab4c19..83a3ce9d 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -71,7 +71,7 @@ Ext.define('PVE.panel.GuestStatusView', {
title: gettext('CPU usage'),
valueField: 'cpu',
maxField: 'cpus',
- renderer: PVE.Utils.render_cpu_usage,
+ renderer: Proxmox.Utils.render_cpu_usage,
// in this specific api call
// we already have the correct value for the usage
calculate: Ext.identityFn,
@@ -106,9 +106,9 @@ Ext.define('PVE.panel.GuestStatusView', {
var me = this;
me.setPrintBar(used > 0);
if (used === 0) {
- return PVE.Utils.render_size(max);
+ return Proxmox.Utils.render_size(max);
} else {
- return PVE.Utils.render_size_usage(used, max);
+ return Proxmox.Utils.render_size_usage(used, max);
}
},
},
diff --git a/www/manager6/panel/StatusView.js b/www/manager6/panel/StatusView.js
index 757cd164..a8f01ce8 100644
--- a/www/manager6/panel/StatusView.js
+++ b/www/manager6/panel/StatusView.js
@@ -32,9 +32,9 @@ Ext.define('PVE.panel.StatusView', {
}
if (!Ext.isNumeric(max) || max === 1) {
- return PVE.Utils.render_usage(val);
+ return Proxmox.Utils.render_usage(val);
}
- return PVE.Utils.render_size_usage(val, max);
+ return Proxmox.Utils.render_size_usage(val, max);
},
fieldCalculator: function(used, max) {
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index 7b60a8b8..f7080043 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -45,21 +45,21 @@ Ext.define('PVE.panel.TemplateStatusView', {
iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
title: gettext('Memory'),
textField: 'maxmem',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
},
{
itemId: 'swap',
iconCls: 'fa fa-refresh fa-fw',
title: gettext('Swap'),
textField: 'maxswap',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
},
{
itemId: 'disk',
iconCls: 'fa fa-hdd-o fa-fw',
title: gettext('Bootdisk size'),
textField: 'maxdisk',
- renderer: PVE.Utils.render_size,
+ renderer: Proxmox.Utils.render_size,
},
{
xtype: 'box',
diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 817d99ed..8b30c820 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -263,7 +263,7 @@ Ext.define('PVE.window.Migrate', {
});
}
} else {
- var size_string = disk.size ? '(' + PVE.Utils.render_size(disk.size) + ')' : '';
+ var size_string = disk.size ? '(' + Proxmox.Utils.render_size(disk.size) + ')' : '';
migration['with-local-disks'] = 1;
migration.preconditions.push({
text: Ext.String.format('Migration with local disk might take long: {0} {1}',
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH manager 2/4] ui: use some icons from widget-toolkit
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (4 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH manager 1/4] ui: Utils: use render functions from widget-toolkit Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 3/4] ui: Utils: use updateColumns " Dominik Csapak
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
we moved them there
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/css/ext6-pve.css | 12 ------------
www/images/Makefile | 4 +---
www/images/icon-cpu.png | Bin 205 -> 0 bytes
www/images/icon-cpu.xcf | Bin 816 -> 0 bytes
www/images/icon-ram.png | Bin 193 -> 0 bytes
www/images/icon-ram.xcf | Bin 747 -> 0 bytes
www/manager6/lxc/Resources.js | 4 ++--
www/manager6/node/StatusView.js | 4 ++--
www/manager6/panel/GuestStatusView.js | 4 ++--
www/manager6/panel/TemplateStatusView.js | 4 ++--
www/manager6/qemu/HardwareView.js | 4 ++--
11 files changed, 11 insertions(+), 25 deletions(-)
delete mode 100644 www/images/icon-cpu.png
delete mode 100644 www/images/icon-cpu.xcf
delete mode 100644 www/images/icon-ram.png
delete mode 100644 www/images/icon-ram.xcf
diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index 3b7a896b..80b726f9 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -281,8 +281,6 @@
.pve-itype-icon-novnc,
.pve-itype-icon-xtermjs,
.pve-itype-icon-display,
-.pve-itype-icon-memory,
-.pve-itype-icon-processor,
.pve-itype-icon-network,
.pve-itype-icon-network-server,
.pve-itype-icon-keyboard,
@@ -389,16 +387,6 @@
background-image:url(../images/icon-cd.png);
}
-.pve-itype-icon-memory
-{
- background-image:url(../images/icon-ram.png);
-}
-
-.pve-itype-icon-processor
-{
- background-image:url(../images/icon-cpu.png);
-}
-
.pve-itype-icon-display
{
background-image:url(../images/icon-display.png);
diff --git a/www/images/Makefile b/www/images/Makefile
index 7e58901c..8b2d1796 100644
--- a/www/images/Makefile
+++ b/www/images/Makefile
@@ -14,7 +14,7 @@ all:
# unchecked.png converted from extjs examples/ux/css/images/unchecked.gif
# swap.png downloaded from https://www.iconfinder.com/icons/17009/arrows_exchange_interact_refresh_reload_swap_sync_update_icon#size=16
-# icon-ram, icon-cpu, icon-cd, icon-pci
+# icon-cd, icon-pci
# are self made (sources as .xcf)
# icon-swap, icon-display, icon-harddisk, icon-keyboard, icon-network, icon-usb, icon-cloud
# come from fontawesome (respective fa-refresh, fa-desktop, fa-hdd-o, fa-keyboard-o, fa-exchange, fa-usb, fa-ellipsis-h, fa-cloud)
@@ -65,8 +65,6 @@ IMAGES = ${GNOME_IMAGES} \
openvz-off.png \
blank.gif \
swap.png \
- icon-ram.png \
- icon-cpu.png \
icon-swap.png \
icon-cd.png \
icon-network.png \
diff --git a/www/images/icon-cpu.png b/www/images/icon-cpu.png
deleted file mode 100644
index e1cc6c2b1eaa188e52ee2f7661911874d56e132d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 205
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b
z3=G`DAk4@xYmNj^kiEpy*OmPNvlth@M);3UAfq@+Tq8=H^K)}k^GX=Lotd^DDCXwr
z;uvCaIyu3C^?&D*hYg*LP6s-UmQDI%xF|D4#mTs<N=(J~e`f)w@-9~$6)V}hq7ktU
rK@vT?8n|9IJeqRC;K9t!BnAe%cxjpJUyk#DCNg-s`njxgN@xNAPL)7X
diff --git a/www/images/icon-cpu.xcf b/www/images/icon-cpu.xcf
deleted file mode 100644
index be5e6034fa4398d08a6d31a27dcd07a864f054d7..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 816
zcmb_aOHRWu5VcJUC8eT#S1i0t7eVcY1N0PZ(=;&_`BX_NwGt9n-~wEeT?uaz8xj$A
zO!Pc&-pphiJ4z=TxeFp0={RJtsR8i|fO9NYz-al#7y)(-41gox)^Mu3LHz^#MB%kw
zkR?f&mWUZ832a(tbmFVfQ@LJ~h6HDBQSReV7Fn#<Gslfoki}Up-P(D%TKRH*Kd-Ha
zEKF*K)>Tid&C9<DweE_IALvxcg`EX)-zOT)+ormdIt`w}g8H*4D#G%6gVg<7YLsp(
zor5v{ZW+A24m!N?(hr_ho^8|m*n}xNhNsJ@fRW);erh-zyK8Z$#m6mv*5Z>EKL@Ax
zS~~%ud1UrSuzP_d9_!4{)=?|st|ne6e#I^=1pBD)1<f;T2Lt9*f{AJb2zEflusWcS
VBmSfS3;&l)Gr_4k<2%76`vM+NtEK<|
diff --git a/www/images/icon-ram.png b/www/images/icon-ram.png
deleted file mode 100644
index cf9c8121777844a6f3f74ea15a585055be5a6cc9..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 193
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b
z3=G`DAk4@xYmNj^kiEpy*OmPNvlthr{`_MH%7H>0C9V-A&iT2ysd*&~-_A_i4-~WV
zba4!^IQ{m5As2%JkMqUl75}xb$Cg|uGx5$)P_5Y~rF65tPQc*WgAF<5&GS+(Xgf?Z
g=vXDX{a-6*o2&rSws$7VKvNhzUHx3vIVCg!06ddBl>h($
diff --git a/www/images/icon-ram.xcf b/www/images/icon-ram.xcf
deleted file mode 100644
index 1507a041f1f0e51d2991c501280ce38ed5179b1f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 747
zcmZ`%%TB{E5Og90r6Ewn<HW(o^bpiuxPtl>T+`Gs7I{=jDzy?4zrYXhlN_l^n04(a
z6=9|Ej%R0+jUB17C11x0PgE)xVq`%45^x+WSHNKQ!59H?4IBYO;MQ>R-N65V>`Od0
zjEgK2d5t}zB7u!`MP-o`p)A#cG!z^bRP`nmyed+)7!QL)#zk6`JkTjD<vik(`-zSo
zGBu?!TIW5jw$A@2)Vi*gQLJ*wr}kYCH+`bf!d0$nuJZUrRMcN2NhRubK<fT0?Uln;
zItLTZr)9|YI_U7cSros@vRLK%*j!^fMyAVXfPvv;KQ$bQ-E}x!8u=+a!1A*W_dEOo
zoStjr1jP2(AHmLolKX6oc64~%^iXr(X#b8WEgso<v%@ENY}+6;PV>_)-z2m<t@lV<
T?ef?TR=;uBmu}j(Vtr!2fCZER
diff --git a/www/manager6/lxc/Resources.js b/www/manager6/lxc/Resources.js
index 02a9f999..96114460 100644
--- a/www/manager6/lxc/Resources.js
+++ b/www/manager6/lxc/Resources.js
@@ -39,7 +39,7 @@ Ext.define('PVE.lxc.RessourceView', {
header: gettext('Memory'),
editor: caps.vms['VM.Config.Memory'] ? 'PVE.lxc.MemoryEdit' : undefined,
defaultValue: 512,
- tdCls: 'pve-itype-icon-memory',
+ tdCls: 'pmx-itype-icon-memory',
group: 1,
renderer: function(value) {
return Proxmox.Utils.format_size(value*1024*1024);
@@ -59,7 +59,7 @@ Ext.define('PVE.lxc.RessourceView', {
header: gettext('Cores'),
editor: caps.vms['VM.Config.CPU'] ? 'PVE.lxc.CPUEdit' : undefined,
defaultValue: '',
- tdCls: 'pve-itype-icon-processor',
+ tdCls: 'pmx-itype-icon-processor',
group: 3,
renderer: function(value) {
var cpulimit = me.getObjectValue('cpulimit');
diff --git a/www/manager6/node/StatusView.js b/www/manager6/node/StatusView.js
index bc16da6a..573fbfae 100644
--- a/www/manager6/node/StatusView.js
+++ b/www/manager6/node/StatusView.js
@@ -23,7 +23,7 @@ Ext.define('PVE.node.StatusView', {
items: [
{
itemId: 'cpu',
- iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-processor pmx-icon',
title: gettext('CPU usage'),
valueField: 'cpu',
maxField: 'cpuinfo',
@@ -49,7 +49,7 @@ Ext.define('PVE.node.StatusView', {
padding: '0 0 20 0',
},
{
- iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-memory pmx-icon',
itemId: 'memory',
title: gettext('RAM usage'),
valueField: 'memory',
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index 83a3ce9d..d8439e5d 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -67,7 +67,7 @@ Ext.define('PVE.panel.GuestStatusView', {
},
{
itemId: 'cpu',
- iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-processor pmx-icon',
title: gettext('CPU usage'),
valueField: 'cpu',
maxField: 'cpus',
@@ -78,7 +78,7 @@ Ext.define('PVE.panel.GuestStatusView', {
},
{
itemId: 'memory',
- iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-memory pmx-icon',
title: gettext('Memory usage'),
valueField: 'mem',
maxField: 'maxmem',
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index f7080043..b8e01d43 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -36,13 +36,13 @@ Ext.define('PVE.panel.TemplateStatusView', {
},
{
itemId: 'cpus',
- iconCls: 'fa fa-fw pve-itype-icon-processor pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-processor pmx-icon',
title: gettext('Processors'),
textField: 'cpus',
},
{
itemId: 'memory',
- iconCls: 'fa fa-fw pve-itype-icon-memory pve-icon',
+ iconCls: 'fa fa-fw pmx-itype-icon-memory pmx-icon',
title: gettext('Memory'),
textField: 'maxmem',
renderer: Proxmox.Utils.render_size,
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 98352e3f..200e3c28 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -66,7 +66,7 @@ Ext.define('PVE.qemu.HardwareView', {
editor: caps.vms['VM.Config.Memory'] ? 'PVE.qemu.MemoryEdit' : undefined,
never_delete: true,
defaultValue: '512',
- tdCls: 'pve-itype-icon-memory',
+ tdCls: 'pmx-itype-icon-memory',
group: 2,
multiKey: ['memory', 'balloon', 'shares'],
renderer: function(value, metaData, record, ri, ci, store, pending) {
@@ -95,7 +95,7 @@ Ext.define('PVE.qemu.HardwareView', {
never_delete: true,
editor: caps.vms['VM.Config.CPU'] || caps.vms['VM.Config.HWType']
? 'PVE.qemu.ProcessorEdit' : undefined,
- tdCls: 'pve-itype-icon-processor',
+ tdCls: 'pmx-itype-icon-processor',
group: 3,
defaultValue: '1',
multiKey: ['sockets', 'cpu', 'cores', 'numa', 'vcpus', 'cpulimit', 'cpuunits'],
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH manager 3/4] ui: Utils: use updateColumns from widget-toolkit
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (5 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH manager 2/4] ui: use some icons " Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 4/4] ui: panel/StatusView: use from widget-toolkit instead Dominik Csapak
2021-04-22 18:41 ` [pve-devel] applied: [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Thomas Lamprecht
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
it was moved there
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/manager6/Utils.js | 30 ------------------------------
www/manager6/dc/Summary.js | 4 ++--
www/manager6/node/Summary.js | 4 ++--
www/manager6/panel/GuestSummary.js | 4 ++--
4 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 48d94a64..87366842 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1614,36 +1614,6 @@ Ext.define('PVE.Utils', {
}
},
- updateColumns: function(container) {
- let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
- let factor;
- if (mode !== 'auto') {
- factor = parseInt(mode, 10);
- if (Number.isNaN(factor)) {
- factor = 1;
- }
- } else {
- factor = container.getSize().width < 1400 ? 1 : 2;
- }
-
- if (container.oldFactor === factor) {
- return;
- }
-
- let items = container.query('>'); // direct childs
- factor = Math.min(factor, items.length);
- container.oldFactor = factor;
-
- items.forEach((item) => {
- item.columnWidth = 1 / factor;
- });
-
- // we have to update the layout twice, since the first layout change
- // can trigger the scrollbar which reduces the amount of space left
- container.updateLayout();
- container.updateLayout();
- },
-
forEachCorosyncLink: function(nodeinfo, cb) {
let re = /(?:ring|link)(\d+)_addr/;
Ext.iterate(nodeinfo, (prop, val) => {
diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index 67d5e95b..e845c261 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -75,7 +75,7 @@ Ext.define('PVE.dc.Summary', {
listeners: {
resize: function(panel) {
- PVE.Utils.updateColumns(panel);
+ Proxmox.Utils.updateColumns(panel);
},
},
@@ -291,7 +291,7 @@ Ext.define('PVE.dc.Summary', {
if (key !== 'summarycolumns') {
return;
}
- PVE.Utils.updateColumns(me);
+ Proxmox.Utils.updateColumns(me);
});
rstore.startUpdate();
diff --git a/www/manager6/node/Summary.js b/www/manager6/node/Summary.js
index ccddd5a0..1c93ef04 100644
--- a/www/manager6/node/Summary.js
+++ b/www/manager6/node/Summary.js
@@ -161,7 +161,7 @@ Ext.define('PVE.node.Summary', {
],
listeners: {
resize: function(panel) {
- PVE.Utils.updateColumns(panel);
+ Proxmox.Utils.updateColumns(panel);
},
},
},
@@ -186,7 +186,7 @@ Ext.define('PVE.node.Summary', {
if (key !== 'summarycolumns') {
return;
}
- PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+ Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
});
},
});
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index 9dc69913..7061b1a4 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -120,7 +120,7 @@ Ext.define('PVE.qemu.Summary', {
items: items,
listeners: {
resize: function(container) {
- PVE.Utils.updateColumns(container);
+ Proxmox.Utils.updateColumns(container);
},
},
},
@@ -137,7 +137,7 @@ Ext.define('PVE.qemu.Summary', {
if (key !== 'summarycolumns') {
return;
}
- PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+ Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
});
},
});
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] [PATCH manager 4/4] ui: panel/StatusView: use from widget-toolkit instead
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (6 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH manager 3/4] ui: Utils: use updateColumns " Dominik Csapak
@ 2021-04-19 11:00 ` Dominik Csapak
2021-04-22 18:41 ` [pve-devel] applied: [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Thomas Lamprecht
8 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2021-04-19 11:00 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/manager6/Makefile | 1 -
www/manager6/node/StatusView.js | 2 +-
www/manager6/panel/GuestStatusView.js | 2 +-
www/manager6/panel/StatusView.js | 126 -----------------------
www/manager6/panel/TemplateStatusView.js | 2 +-
www/manager6/storage/StatusView.js | 2 +-
6 files changed, 4 insertions(+), 131 deletions(-)
delete mode 100644 www/manager6/panel/StatusView.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index a2f7be6d..928d8b15 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -81,7 +81,6 @@ JSSRC= \
panel/NotesView.js \
panel/RunningChart.js \
panel/StatusPanel.js \
- panel/StatusView.js \
panel/GuestStatusView.js \
panel/GuestSummary.js \
panel/TemplateStatusView.js \
diff --git a/www/manager6/node/StatusView.js b/www/manager6/node/StatusView.js
index 573fbfae..afbc57e8 100644
--- a/www/manager6/node/StatusView.js
+++ b/www/manager6/node/StatusView.js
@@ -1,5 +1,5 @@
Ext.define('PVE.node.StatusView', {
- extend: 'PVE.panel.StatusView',
+ extend: 'Proxmox.panel.StatusView',
alias: 'widget.pveNodeStatus',
height: 300,
diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index d8439e5d..8d16827e 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -1,5 +1,5 @@
Ext.define('PVE.panel.GuestStatusView', {
- extend: 'PVE.panel.StatusView',
+ extend: 'Proxmox.panel.StatusView',
alias: 'widget.pveGuestStatusView',
mixins: ['Proxmox.Mixin.CBind'],
diff --git a/www/manager6/panel/StatusView.js b/www/manager6/panel/StatusView.js
deleted file mode 100644
index a8f01ce8..00000000
--- a/www/manager6/panel/StatusView.js
+++ /dev/null
@@ -1,126 +0,0 @@
-Ext.define('PVE.panel.StatusView', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.pveStatusView',
-
- layout: {
- type: 'column',
- },
-
- title: gettext('Status'),
-
- getRecordValue: function(key, store) {
- if (!key) {
- throw "no key given";
- }
- var me = this;
-
- if (store === undefined) {
- store = me.getStore();
- }
-
- var rec = store.getById(key);
- if (rec) {
- return rec.data.value;
- }
-
- return '';
- },
-
- fieldRenderer: function(val, max) {
- if (max === undefined) {
- return val;
- }
-
- if (!Ext.isNumeric(max) || max === 1) {
- return Proxmox.Utils.render_usage(val);
- }
- return Proxmox.Utils.render_size_usage(val, max);
- },
-
- fieldCalculator: function(used, max) {
- if (!Ext.isNumeric(max) && Ext.isNumeric(used)) {
- return used;
- } else if (!Ext.isNumeric(used)) {
- /* we come here if the field is from a node
- * where the records are not mem and maxmem
- * but mem.used and mem.total
- */
- if (used.used !== undefined &&
- used.total !== undefined) {
- return used.used/used.total;
- }
- }
-
- return used/max;
- },
-
- updateField: function(field) {
- var me = this;
- var text = '';
- var renderer = me.fieldRenderer;
- if (Ext.isFunction(field.renderer)) {
- renderer = field.renderer;
- }
- if (field.multiField === true) {
- field.updateValue(renderer.call(field, me.getStore().getRecord()));
- } else if (field.textField !== undefined) {
- field.updateValue(renderer.call(field, me.getRecordValue(field.textField)));
- } else if (field.valueField !== undefined) {
- var used = me.getRecordValue(field.valueField);
- /* string and int */
- var max = field.maxField !== undefined ? me.getRecordValue(field.maxField) : 1;
-
- var calculate = me.fieldCalculator;
-
- if (Ext.isFunction(field.calculate)) {
- calculate = field.calculate;
- }
- field.updateValue(renderer.call(field, used, max), calculate(used, max));
- }
- },
-
- getStore: function() {
- var me = this;
- if (!me.rstore) {
- throw "there is no rstore";
- }
-
- return me.rstore;
- },
-
- updateTitle: function() {
- var me = this;
- me.setTitle(me.getRecordValue('name'));
- },
-
- updateValues: function(store, records, success) {
- if (!success) {
- return; // do not update if store load was not successful
- }
- var me = this;
- var itemsToUpdate = me.query('pveInfoWidget');
-
- itemsToUpdate.forEach(me.updateField, me);
-
- me.updateTitle(store);
- },
-
- initComponent: function() {
- var me = this;
-
- if (!me.rstore) {
- throw "no rstore given";
- }
-
- if (!me.title) {
- throw "no title given";
- }
-
- Proxmox.Utils.monStoreErrors(me, me.rstore);
-
- me.callParent();
-
- me.mon(me.rstore, 'load', 'updateValues');
- },
-
-});
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index b8e01d43..44d983b3 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -1,5 +1,5 @@
Ext.define('PVE.panel.TemplateStatusView', {
- extend: 'PVE.panel.StatusView',
+ extend: 'Proxmox.panel.StatusView',
alias: 'widget.pveTemplateStatusView',
layout: {
diff --git a/www/manager6/storage/StatusView.js b/www/manager6/storage/StatusView.js
index e42e8a7d..923d73f2 100644
--- a/www/manager6/storage/StatusView.js
+++ b/www/manager6/storage/StatusView.js
@@ -1,5 +1,5 @@
Ext.define('PVE.storage.StatusView', {
- extend: 'PVE.panel.StatusView',
+ extend: 'Proxmox.panel.StatusView',
alias: 'widget.pveStorageStatusView',
height: 230,
--
2.20.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] applied: [PATCH widget-toolkit 4/4] panel: add StatusView from PVE
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE Dominik Csapak
@ 2021-04-22 18:38 ` Thomas Lamprecht
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2021-04-22 18:38 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
On 19.04.21 13:00, Dominik Csapak wrote:
> with 2 minor fixups:
> * one lint error
> * binding of the 'updateValues' function in the event
> (we want to avoid breaking this when used in a context where
> a controller exists, in that case using a string will only look in
> the controller and not in the component itself anymore, so use
> the function directly)
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/Makefile | 1 +
> src/panel/StatusView.js | 125 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 126 insertions(+)
> create mode 100644 src/panel/StatusView.js
applied, with a some unimportant cleanups and an important fix (or better said, workaround)
for the use in PVE, see below.
> diff --git a/src/panel/StatusView.js b/src/panel/StatusView.js
> new file mode 100644
> index 0000000..059508a
> --- /dev/null
> +++ b/src/panel/StatusView.js
> + updateValues: function(store, records, success) {
> + if (!success) {
> + return; // do not update if store load was not successful
> + }
> + var me = this;
> + var itemsToUpdate = me.query('pmxInfoWidget');
does not finds the pveInfoWidgets from, well, PVE, and makes for a pretty boring
view there ;-)
> +
> + itemsToUpdate.forEach(me.updateField, me);
> +
> + me.updateTitle(store);
> + },
> +
^ permalink raw reply [flat|nested] 11+ messages in thread
* [pve-devel] applied: [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
` (7 preceding siblings ...)
2021-04-19 11:00 ` [pve-devel] [PATCH manager 4/4] ui: panel/StatusView: use from widget-toolkit instead Dominik Csapak
@ 2021-04-22 18:41 ` Thomas Lamprecht
8 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2021-04-22 18:41 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
On 19.04.21 13:00, Dominik Csapak wrote:
> manager needs a depends on a bumped widget-toolkit ofc
>
> proxmox-widget-toolkit:
>
> Dominik Csapak (4):
> Utils: add several render functions from PVE
> bring over some icons from PVE
> Utils: refactor updateColumns from pve-manager
> panel: add StatusView from PVE
>
> pve-manger:
>
> Dominik Csapak (4):
> ui: Utils: use render functions from widget-toolkit
> ui: use some icons from widget-toolkit
> ui: Utils: use updateColumns from widget-toolkit
> ui: panel/StatusView: use from widget-toolkit instead
>
applied series, besides one issue in the status panel (replied inline) it was all OK,
FWICT, thanks!
Process wise it would be nicer to include the pbs one here too, or at least the
widget-toolkit in the pbs-series, it's a bit hard to follow the correlation else...
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-04-22 18:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 2/4] bring over some icons " Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 3/4] Utils: refactor updateColumns from pve-manager Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE Dominik Csapak
2021-04-22 18:38 ` [pve-devel] applied: " Thomas Lamprecht
2021-04-19 11:00 ` [pve-devel] [PATCH manager 1/4] ui: Utils: use render functions from widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 2/4] ui: use some icons " Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 3/4] ui: Utils: use updateColumns " Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 4/4] ui: panel/StatusView: use from widget-toolkit instead Dominik Csapak
2021-04-22 18:41 ` [pve-devel] applied: [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox