ui: node certs: make delete button safer, add confirmation

IMO the behavior was really dangerous prev., possibly causing
downtime of API accessing stuff with a single mistaken click.

Follow our general pattern and ask for confirmation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-05-19 11:03:28 +02:00
parent b1b0fcbcd3
commit 028e4cd309

View File

@ -252,26 +252,23 @@ Ext.define('PVE.node.Certificates', {
},
},
{
xtype: 'button',
xtype: 'proxmoxStdRemoveButton',
itemId: 'deletebtn',
text: gettext('Delete Custom Certificate'),
handler: function() {
var me = this.up('grid');
Proxmox.Utils.API2Request({
url: '/nodes/' + me.nodename + '/certificates/custom?restart=1',
method: 'DELETE',
success: function(response, opt) {
var txt = gettext('pveproxy will be restarted with new certificates, please reload the GUI!');
Ext.getBody().mask(txt, ['pve-static-mask']);
// reload after 10 seconds automatically
Ext.defer(function() {
window.location.reload(true);
}, 10000);
},
failure: function(response, opt) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
},
});
dangerous: true,
selModel: false,
getUrl: function(rec) {
let view = this.up('grid');
return `/nodes/${view.nodename}/certificates/custom?restart=1`;
},
confirmMsg: gettext('Delete custom certificate and switch to generated one?'),
callback: function(options, success, response) {
if (success) {
let txt = gettext('API server will be restarted to use new certificates, please reload web-interface!');
Ext.getBody().mask(txt, ['pve-static-mask']);
// reload after 10 seconds automatically
Ext.defer(() => window.location.reload(true), 10000);
}
},
},
'-',