[pbs-devel] [PATCH v6 proxmox-widget-toolkit 3/3] add upgrade button

Fabian Ebner f.ebner at proxmox.com
Fri Jun 11 13:44:03 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v5:
    * Allow specifiyng a link to the upgrade guide.

 src/node/APTRepositories.js | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js
index 5f8b2e5..8b71dab 100644
--- a/src/node/APTRepositories.js
+++ b/src/node/APTRepositories.js
@@ -345,6 +345,49 @@ Ext.define('Proxmox.node.APTRepositories', {
 		me.up('proxmoxNodeAPTRepositories').reload();
 	    },
 	},
+	{
+	    xtype: 'proxmoxButton',
+	    text: gettext('Upgrade Package Distribution'),
+	    cbind: {
+		nodename: '{nodename}',
+		hidden: '{!majorUpgradeAllowed}',
+		majorUpgradeLink: '{majorUpgradeLink}',
+	    },
+	    confirmMsg: function() {
+		let me = this;
+
+		let msg = Ext.String.format(
+		    gettext('Please read the detailed upgrade guide: {0} first!'),
+		    Proxmox.Utils.render_optional_url(me.majorUpgradeLink),
+		);
+		msg += "<br>";
+		msg += gettext('Upgrade from \'buster\' to \'bullseye\' for enabled repositories?');
+
+		return msg;
+	    },
+	    handler: function() {
+		let me = this;
+		let panel = me.up('proxmoxNodeAPTRepositories');
+
+		let params = {};
+		if (panel.digest !== undefined) {
+		    params.digest = panel.digest;
+		}
+
+		Proxmox.Utils.API2Request({
+		    url: `/nodes/${me.nodename}/apt/upgraderepositories`,
+		    method: 'PUT',
+		    params: params,
+		    failure: function(response, opts) {
+			Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+			panel.reload();
+		    },
+		    success: function(response, opts) {
+			panel.reload();
+		    },
+		});
+	    },
+	},
     ],
 
     check_subscription: function() {
-- 
2.20.1






More information about the pbs-devel mailing list