all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH/RFC pve-manager 0/2] allow to automatically open guest panel after create wizard
@ 2026-11-24 14:37 Dominik Csapak
  2026-11-24 14:37 ` [PATCH pve-manager 1/2] ui: qemu create wizard: show the task progress after submitting Dominik Csapak
  2026-11-24 14:37 ` [RFC PATCH pve-manager 2/2] ui: create wizards: optionally open the new guest's summary or console Dominik Csapak
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2026-11-24 14:37 UTC (permalink / raw)
  To: pve-devel

The first patch is to bring the qemu creation wizard
in line with the container, except using a taskprogress instead
of a taskviewer (since there often isn't too much to be shown)

The second patch is the actual reason for this series:

Add a dropdown to the wizard to let the user automatically navigate
to the guests panel after it's creation, either on the summary
or the console (since that seem to be the most obvious ones)

I ran into this often: i just created a vm only that my first action is
to open either the console or navigate to the guest, and i have to
search for it in the tree...

Dominik Csapak (2):
  ui: qemu create wizard: show the task progress after submitting
  ui: create wizards: optionally open the new guest's summary or console

 www/manager6/Makefile                        |  1 +
 www/manager6/Utils.js                        | 48 ++++++++++++++++++++
 www/manager6/form/AfterCreateViewSelector.js | 32 +++++++++++++
 www/manager6/lxc/CreateWizard.js             | 28 ++++++++++--
 www/manager6/qemu/CreateWizard.js            | 37 +++++++++++++--
 5 files changed, 140 insertions(+), 6 deletions(-)
 create mode 100644 www/manager6/form/AfterCreateViewSelector.js

-- 
2.47.3





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH pve-manager 1/2] ui: qemu create wizard: show the task progress after submitting
  2026-11-24 14:37 [PATCH/RFC pve-manager 0/2] allow to automatically open guest panel after create wizard Dominik Csapak
@ 2026-11-24 14:37 ` Dominik Csapak
  2026-11-24 14:37 ` [RFC PATCH pve-manager 2/2] ui: create wizards: optionally open the new guest's summary or console Dominik Csapak
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2026-11-24 14:37 UTC (permalink / raw)
  To: pve-devel

so users see when the creation finished or why it failed, like the
container wizard already does with its task viewer.

This can matter if the guest takes a longer time to create, for example
if creating the disks takes a while due to slow storage.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/qemu/CreateWizard.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index 5eb784c4..9c6e18d3 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -356,6 +356,10 @@ Ext.define('PVE.qemu.CreateWizard', {
                     method: 'POST',
                     params: kv,
                     success: function (response) {
+                        Ext.create('Proxmox.window.TaskProgress', {
+                            autoShow: true,
+                            upid: response.result.data,
+                        });
                         wizard.close();
                     },
                     failure: function (response, opts) {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [RFC PATCH pve-manager 2/2] ui: create wizards: optionally open the new guest's summary or console
  2026-11-24 14:37 [PATCH/RFC pve-manager 0/2] allow to automatically open guest panel after create wizard Dominik Csapak
  2026-11-24 14:37 ` [PATCH pve-manager 1/2] ui: qemu create wizard: show the task progress after submitting Dominik Csapak
@ 2026-11-24 14:37 ` Dominik Csapak
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2026-11-24 14:37 UTC (permalink / raw)
  To: pve-devel

after it was created, so users don't have to search for it in the tree.

Select it once the creation task succeeded, but only if the user did
not select something else in the meantime. Use the embedded Console tab
instead of a console window, since the browser would block such a popup
that isn't directly initiated by the user.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
in case the the current tree does not show the guests, nothing happens.
(e.g. storage view). This is IMO an ok tradeoff for this edge case.

Also if the guest vanishes in the backend before the ResourceStore could
update, it's limited to 3 tries of finding it.

 www/manager6/Makefile                        |  1 +
 www/manager6/Utils.js                        | 48 ++++++++++++++++++++
 www/manager6/form/AfterCreateViewSelector.js | 32 +++++++++++++
 www/manager6/lxc/CreateWizard.js             | 28 ++++++++++--
 www/manager6/qemu/CreateWizard.js            | 33 ++++++++++++--
 5 files changed, 136 insertions(+), 6 deletions(-)
 create mode 100644 www/manager6/form/AfterCreateViewSelector.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index cdf222a2..41f7d745 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -23,6 +23,7 @@ JSSRC= 							\
 	form/ACMEAPISelector.js 			\
 	form/ACMEAccountSelector.js			\
 	form/ACMEPluginSelector.js			\
+	form/AfterCreateViewSelector.js			\
 	form/AgentFeatureSelector.js			\
 	form/BackupCompressionSelector.js		\
 	form/BackupModeSelector.js			\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index fc3667f5..5079726d 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1665,6 +1665,54 @@ Ext.define('PVE.Utils', {
             }
         },
 
+        // Returns the currently selected ID in the resource tree if possible
+        getCurrentTreeSelection: function () {
+            let tree = Ext.ComponentQuery.query('pveResourceTree')[0];
+            if (!tree) {
+                return;
+            }
+            return tree.getSelection()[0]?.data.id;
+        },
+
+        // Selects a freshly created guest and opens the given tab (e.g. 'console'). Meant to be
+        // called once its creation task succeeded, but the resource store might not know the
+        // guest yet, so wait for up to two loads after that.
+        showGuestAfterCreate: function (type, vmid, tab, initialSelection) {
+            let tree = Ext.ComponentQuery.query('pveResourceTree')[0];
+            if (!tree) {
+                return;
+            }
+            let rstore = PVE.data.ResourceStore;
+            let id = `${type}/${vmid}`;
+
+            let select = function (attempt) {
+                // the user navigated away in the meantime, do not pull them back
+                if (PVE.Utils.getCurrentTreeSelection() !== initialSelection) {
+                    return;
+                }
+
+                // retry on the next load if it's not in the ResourceStore yet
+                if (rstore.findExact('id', id) === -1) {
+                    if (attempt < 3) {
+                        rstore.on('load', select, undefined, { single: true, args: [attempt + 1] });
+                    }
+                    return;
+                }
+
+                if (tab) {
+                    let stateId = type === 'qemu' ? 'kvmtab' : 'lxctab';
+                    // lxc console tab is named differently
+                    if (stateId === 'lxctab' && tab === 'console') {
+                        tab = 'consolejs';
+                    }
+                    Ext.state.Manager.getProvider().set(stateId, { value: tab });
+                }
+                tree.selectById(id);
+            };
+
+            select(1);
+        },
+
         // test automation helper
         call_menu_handler: function (menu, text) {
             let item = menu.query('menuitem').find((el) => el.text === text);
diff --git a/www/manager6/form/AfterCreateViewSelector.js b/www/manager6/form/AfterCreateViewSelector.js
new file mode 100644
index 00000000..1580cbb2
--- /dev/null
+++ b/www/manager6/form/AfterCreateViewSelector.js
@@ -0,0 +1,32 @@
+// Selects which view of a guest to open once the create wizard has submitted it.
+// Automatically saves the last selected value.
+Ext.define('PVE.form.AfterCreateViewSelector', {
+    extend: 'Proxmox.form.KVComboBox',
+    alias: ['widget.pveAfterCreateViewSelector'],
+
+    submitValue: false,
+    deleteEmpty: false,
+
+    fieldLabel: gettext('Then open'),
+    labelAlign: 'right',
+    width: 250,
+
+    comboItems: [
+        ['none', Proxmox.Utils.noneText],
+        ['summary', gettext('Summary')],
+        ['console', gettext('Console')],
+    ],
+
+    stateKey: 'guest-create-open-view',
+
+    initComponent: function () {
+        let me = this;
+
+        let sp = Ext.state.Manager.getProvider();
+        me.value = sp.get(me.stateKey) || 'none';
+
+        me.callParent();
+
+        me.on('change', (_field, value) => sp.set(me.stateKey, value));
+    },
+});
diff --git a/www/manager6/lxc/CreateWizard.js b/www/manager6/lxc/CreateWizard.js
index caa04fc9..757f9810 100644
--- a/www/manager6/lxc/CreateWizard.js
+++ b/www/manager6/lxc/CreateWizard.js
@@ -291,11 +291,25 @@ Ext.define('PVE.lxc.CreateWizard', {
             ],
             dockedItems: [
                 {
-                    xtype: 'proxmoxcheckbox',
-                    name: 'start',
+                    xtype: 'container',
                     dock: 'bottom',
                     margin: '5 0 0 0',
-                    boxLabel: gettext('Start after created'),
+                    layout: {
+                        type: 'hbox',
+                        align: 'middle',
+                    },
+                    items: [
+                        {
+                            xtype: 'proxmoxcheckbox',
+                            name: 'start',
+                            flex: 1,
+                            boxLabel: gettext('Start after created'),
+                        },
+                        {
+                            xtype: 'pveAfterCreateViewSelector',
+                            itemId: 'afterCreateView',
+                        },
+                    ],
                 },
             ],
             listeners: {
@@ -340,15 +354,23 @@ Ext.define('PVE.lxc.CreateWizard', {
                     delete kv.password;
                 }
 
+                let currentId = PVE.Utils.getCurrentTreeSelection();
+
                 Proxmox.Utils.API2Request({
                     url: `/nodes/${nodename}/lxc`,
                     waitMsgTarget: wizard,
                     method: 'POST',
                     params: kv,
                     success: function (response, opts) {
+                        let view = wizard.down('#afterCreateView').getValue();
                         Ext.create('Proxmox.window.TaskViewer', {
                             autoShow: true,
                             upid: response.result.data,
+                            taskDone: (success) => {
+                                if (success && view !== 'none') {
+                                    PVE.Utils.showGuestAfterCreate('lxc', kv.vmid, view, currentId);
+                                }
+                            },
                         });
                         wizard.close();
                     },
diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index 9c6e18d3..535adab5 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -291,11 +291,25 @@ Ext.define('PVE.qemu.CreateWizard', {
             ],
             dockedItems: [
                 {
-                    xtype: 'proxmoxcheckbox',
-                    name: 'start',
+                    xtype: 'container',
                     dock: 'bottom',
                     margin: '5 0 0 0',
-                    boxLabel: gettext('Start after created'),
+                    layout: {
+                        type: 'hbox',
+                        align: 'middle',
+                    },
+                    items: [
+                        {
+                            xtype: 'proxmoxcheckbox',
+                            name: 'start',
+                            flex: 1,
+                            boxLabel: gettext('Start after created'),
+                        },
+                        {
+                            xtype: 'pveAfterCreateViewSelector',
+                            itemId: 'afterCreateView',
+                        },
+                    ],
                 },
             ],
             listeners: {
@@ -350,15 +364,28 @@ Ext.define('PVE.qemu.CreateWizard', {
                     kv.kvm = 0;
                 }
 
+                let currentId = PVE.Utils.getCurrentTreeSelection();
+
                 Proxmox.Utils.API2Request({
                     url: '/nodes/' + nodename + '/qemu',
                     waitMsgTarget: wizard,
                     method: 'POST',
                     params: kv,
                     success: function (response) {
+                        let view = wizard.down('#afterCreateView').getValue();
                         Ext.create('Proxmox.window.TaskProgress', {
                             autoShow: true,
                             upid: response.result.data,
+                            taskDone: (success) => {
+                                if (success && view !== 'none') {
+                                    PVE.Utils.showGuestAfterCreate(
+                                        'qemu',
+                                        kv.vmid,
+                                        view,
+                                        currentId,
+                                    );
+                                }
+                            },
                         });
                         wizard.close();
                     },
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-24 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 14:37 [PATCH/RFC pve-manager 0/2] allow to automatically open guest panel after create wizard Dominik Csapak
2026-11-24 14:37 ` [PATCH pve-manager 1/2] ui: qemu create wizard: show the task progress after submitting Dominik Csapak
2026-11-24 14:37 ` [RFC PATCH pve-manager 2/2] ui: create wizards: optionally open the new guest's summary or console Dominik Csapak

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