* [pve-devel] [PATCH manager 1/2] ui: factor out standalone node check
@ 2023-11-13 8:59 Dominik Csapak
2023-11-13 8:59 ` [pve-devel] [PATCH manager v2 2/2] ui: hide bulk migrate options on standalone nodes Dominik Csapak
2023-11-13 10:20 ` [pve-devel] applied: [PATCH manager 1/2] ui: factor out standalone node check Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-11-13 8:59 UTC (permalink / raw)
To: pve-devel
into Utils and use it where we manually checked that
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
I put it into utils since i did not find a better place. Could have put it
in the ResourceStore, but coupling those things seemed wrong to me.
www/manager6/Utils.js | 4 ++++
www/manager6/form/ComboBoxSetStoreNode.js | 2 +-
www/manager6/grid/Replication.js | 4 ++--
| 2 +-
www/manager6/lxc/Config.js | 2 +-
| 2 +-
| 2 +-
www/manager6/qemu/Config.js | 2 +-
www/manager6/storage/LVMEdit.js | 2 +-
9 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index be30393e..9b77ebd3 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1921,6 +1921,10 @@ Ext.define('PVE.Utils', {
'ok': 2,
'__default__': 3,
},
+
+ isStandaloneNode: function() {
+ return PVE.data.ResourceStore.getNodes().length < 2;
+ },
},
singleton: true,
diff --git a/www/manager6/form/ComboBoxSetStoreNode.js b/www/manager6/form/ComboBoxSetStoreNode.js
index d5695bad..26b1f95b 100644
--- a/www/manager6/form/ComboBoxSetStoreNode.js
+++ b/www/manager6/form/ComboBoxSetStoreNode.js
@@ -56,7 +56,7 @@ Ext.define('PVE.form.ComboBoxSetStoreNode', {
initComponent: function() {
let me = this;
- if (me.showNodeSelector && PVE.data.ResourceStore.getNodes().length > 1) {
+ if (me.showNodeSelector && !PVE.Utils.isStandaloneNode()) {
me.errorHeight = 140;
Ext.apply(me.listConfig ?? {}, {
tbar: {
diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js
index 1e4e00fc..79824b9b 100644
--- a/www/manager6/grid/Replication.js
+++ b/www/manager6/grid/Replication.js
@@ -220,7 +220,7 @@ Ext.define('PVE.grid.ReplicaView', {
// currently replication is for cluster only, so disable the whole component for non-cluster
checkPrerequisites: function() {
let view = this.getView();
- if (PVE.data.ResourceStore.getNodes().length < 2) {
+ if (PVE.Utils.isStandaloneNode()) {
view.mask(gettext("Replication needs at least two nodes"), ['pve-static-mask']);
}
},
@@ -450,7 +450,7 @@ Ext.define('PVE.grid.ReplicaView', {
// if we set the warning mask, we do not want to load
// or set the mask on store errors
- if (PVE.data.ResourceStore.getNodes().length < 2) {
+ if (PVE.Utils.isStandaloneNode()) {
return;
}
--git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index 56f36b5e..b1403fc6 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -31,7 +31,7 @@ Ext.define('PVE.lxc.CmdMenu', {
};
let caps = Ext.state.Manager.get('GuiCap');
- let standalone = PVE.data.ResourceStore.getNodes().length < 2;
+ let standalone = PVE.Utils.isStandaloneNode();
let running = false, stopped = true, suspended = false;
switch (info.status) {
diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 85d32e3c..4516ee8f 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -92,7 +92,7 @@ Ext.define('PVE.lxc.Config', {
var migrateBtn = Ext.create('Ext.Button', {
text: gettext('Migrate'),
disabled: !caps.vms['VM.Migrate'],
- hidden: PVE.data.ResourceStore.getNodes().length < 2,
+ hidden: PVE.Utils.isStandaloneNode(),
handler: function() {
var win = Ext.create('PVE.window.Migrate', {
vmtype: 'lxc',
--git a/www/manager6/menu/TemplateMenu.js b/www/manager6/menu/TemplateMenu.js
index eb91481c..7cd87f6a 100644
--- a/www/manager6/menu/TemplateMenu.js
+++ b/www/manager6/menu/TemplateMenu.js
@@ -22,7 +22,7 @@ Ext.define('PVE.menu.TemplateMenu', {
me.title = (guestType === 'qemu' ? 'VM ' : 'CT ') + info.vmid;
let caps = Ext.state.Manager.get('GuiCap');
- let standaloneNode = PVE.data.ResourceStore.getNodes().length < 2;
+ let standaloneNode = PVE.Utils.isStandaloneNode();
me.items = [
{
--git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index ccc5f74d..4f59d5f7 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -32,7 +32,7 @@ Ext.define('PVE.qemu.CmdMenu', {
};
let caps = Ext.state.Manager.get('GuiCap');
- let standalone = PVE.data.ResourceStore.getNodes().length < 2;
+ let standalone = PVE.Utils.isStandaloneNode();
let running = false, stopped = true, suspended = false;
switch (info.status) {
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 6acf589c..fb0d9cde 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -67,7 +67,7 @@ Ext.define('PVE.qemu.Config', {
var migrateBtn = Ext.create('Ext.Button', {
text: gettext('Migrate'),
disabled: !caps.vms['VM.Migrate'],
- hidden: PVE.data.ResourceStore.getNodes().length < 2,
+ hidden: PVE.Utils.isStandaloneNode(),
handler: function() {
var win = Ext.create('PVE.window.Migrate', {
vmtype: 'qemu',
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 75c7bdb8..fde302fc 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -114,7 +114,7 @@ Ext.define('PVE.storage.LunSelector', {
initComponent: function() {
let me = this;
- if (PVE.data.ResourceStore.getNodes().length > 1) {
+ if (!PVE.Utils.isStandaloneNode()) {
me.errorHeight = 140;
Ext.apply(me.listConfig ?? {}, {
tbar: {
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH manager v2 2/2] ui: hide bulk migrate options on standalone nodes
2023-11-13 8:59 [pve-devel] [PATCH manager 1/2] ui: factor out standalone node check Dominik Csapak
@ 2023-11-13 8:59 ` Dominik Csapak
2023-11-13 10:20 ` [pve-devel] applied: [PATCH manager 1/2] ui: factor out standalone node check Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-11-13 8:59 UTC (permalink / raw)
To: pve-devel
since there is nowhere to migrate to and we hide the regular migrate
buttons/options too.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use new 'isStandaloneNode()' from Utils
| 4 ++++
www/manager6/node/Config.js | 1 +
2 files changed, 5 insertions(+)
--git a/www/manager6/node/CmdMenu.js b/www/manager6/node/CmdMenu.js
index dc56ef08..1dbcd781 100644
--- a/www/manager6/node/CmdMenu.js
+++ b/www/manager6/node/CmdMenu.js
@@ -139,5 +139,9 @@ Ext.define('PVE.node.CmdMenu', {
if (me.pveSelNode.data.running) {
me.getComponent('wakeonlan').setDisabled(true);
}
+
+ if (PVE.Utils.isStandaloneNode()) {
+ me.getComponent('bulkmigrate').setVisible(false);
+ }
},
});
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 6ed2172a..6deafcdf 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -69,6 +69,7 @@ Ext.define('PVE.node.Config', {
text: gettext('Bulk Migrate'),
iconCls: 'fa fa-fw fa-send-o',
disabled: !caps.vms['VM.Migrate'],
+ hidden: PVE.Utils.isStandaloneNode(),
handler: function() {
Ext.create('PVE.window.BulkAction', {
autoShow: true,
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH manager 1/2] ui: factor out standalone node check
2023-11-13 8:59 [pve-devel] [PATCH manager 1/2] ui: factor out standalone node check Dominik Csapak
2023-11-13 8:59 ` [pve-devel] [PATCH manager v2 2/2] ui: hide bulk migrate options on standalone nodes Dominik Csapak
@ 2023-11-13 10:20 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-11-13 10:20 UTC (permalink / raw)
To: Proxmox VE development discussion, Dominik Csapak
Am 13/11/2023 um 09:59 schrieb Dominik Csapak:
> into Utils and use it where we manually checked that
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> I put it into utils since i did not find a better place. Could have put it
> in the ResourceStore, but coupling those things seemed wrong to me.
>
> www/manager6/Utils.js | 4 ++++
> www/manager6/form/ComboBoxSetStoreNode.js | 2 +-
> www/manager6/grid/Replication.js | 4 ++--
> www/manager6/lxc/CmdMenu.js | 2 +-
> www/manager6/lxc/Config.js | 2 +-
> www/manager6/menu/TemplateMenu.js | 2 +-
> www/manager6/qemu/CmdMenu.js | 2 +-
> www/manager6/qemu/Config.js | 2 +-
> www/manager6/storage/LVMEdit.js | 2 +-
> 9 files changed, 13 insertions(+), 9 deletions(-)
>
>
applied series, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-13 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 8:59 [pve-devel] [PATCH manager 1/2] ui: factor out standalone node check Dominik Csapak
2023-11-13 8:59 ` [pve-devel] [PATCH manager v2 2/2] ui: hide bulk migrate options on standalone nodes Dominik Csapak
2023-11-13 10:20 ` [pve-devel] applied: [PATCH manager 1/2] ui: factor out standalone node check Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal