all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] fix #2933: correct behaviour of initgpt button
Date: Fri, 14 Aug 2020 10:33:52 +0200	[thread overview]
Message-ID: <20200814083352.9557-1-d.csapak@proxmox.com> (raw)

fixes 4 issues:
* use correct /api2/ext url to get the 'success' parameter
* check 'used' property for 'unused' (pbs vs pve)
* use 'name' instead of 'devpath' for id
  (name always contains the correct id for the product,
  e.g. /dev/sdd for pve and sdd for pbs)
* add a reload in taskDone to reload the list of disks when the inti is done

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/grid/DiskList.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/grid/DiskList.js b/src/grid/DiskList.js
index 03d6725..2985cc4 100644
--- a/src/grid/DiskList.js
+++ b/src/grid/DiskList.js
@@ -73,10 +73,10 @@ Ext.define('Proxmox.DiskList', {
 
 	    let rec = selection[0];
 	    Proxmox.Utils.API2Request({
-		url: `${view.baseurl}/initgpt`,
+		url: `${view.exturl}/initgpt`,
 		waitMsgTarget: view,
 		method: 'POST',
-		params: { disk: rec.data.devpath },
+		params: { disk: rec.data.name },
 		failure: function(response, options) {
 		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
 		},
@@ -84,6 +84,9 @@ Ext.define('Proxmox.DiskList', {
 		    var upid = response.result.data;
 		    var win = Ext.create('Proxmox.window.TaskProgress', {
 		        upid: upid,
+			taskDone: function() {
+			    me.reload()
+			}
 		    });
 		    win.show();
 		},
@@ -95,6 +98,7 @@ Ext.define('Proxmox.DiskList', {
 
 	    let nodename = view.nodename || 'localhost';
 	    view.baseurl = `/api2/json/nodes/${nodename}/disks`;
+	    view.exturl = `/api2/extjs/nodes/${nodename}/disks`;
 	    view.getStore().getProxy().setUrl(`${view.baseurl}/list`);
 	    view.getStore().load();
 	},
@@ -129,7 +133,7 @@ Ext.define('Proxmox.DiskList', {
 	    text: gettext('Initialize Disk with GPT'),
 	    disabled: true,
 	    enableFn: function(rec) {
-		if (!rec || rec.data.used) {
+		if (!rec || (rec.data.used && rec.data.used !== 'unused')) {
 		    return false;
 		} else {
 		    return true;
-- 
2.20.1





             reply	other threads:[~2020-08-14  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14  8:33 Dominik Csapak [this message]
2020-08-20 15:32 ` [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=20200814083352.9557-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 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