public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit] fix #2933: correct behaviour of initgpt button
@ 2020-08-14  8:33 Dominik Csapak
  2020-08-20 15:32 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-08-14  8:33 UTC (permalink / raw)
  To: pve-devel

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





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

end of thread, other threads:[~2020-08-20 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14  8:33 [pve-devel] [PATCH widget-toolkit] fix #2933: correct behaviour of initgpt button Dominik Csapak
2020-08-20 15:32 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal