Thomas Lamprecht 8058410f40 ui: eslint: fix various spacing related issues
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-01-19 17:39:15 +01:00

38 lines
963 B
JavaScript

Ext.define('PVE.button.PendingRevert', {
extend: 'Proxmox.button.Button',
alias: 'widget.pvePendingRevertButton',
text: gettext('Revert'),
disabled: true,
config: {
pendingGrid: null,
apiurl: undefined,
},
handler: function() {
if (!this.pendingGrid) {
this.pendingGrid = this.up('proxmoxPendingObjectGrid');
if (!this.pendingGrid) throw "revert button requires a pendingGrid";
}
let view = this.pendingGrid;
let rec = view.getSelectionModel().getSelection()[0];
if (!rec) return;
let rowdef = view.rows[rec.data.key] || {};
let keys = rowdef.multiKey || [rec.data.key];
Proxmox.Utils.API2Request({
url: this.apiurl || view.editorConfig.url,
waitMsgTarget: view,
selModel: view.getSelectionModel(),
method: 'PUT',
params: {
'revert': keys.join(','),
},
callback: () => view.reload(),
failure: (response) => Ext.Msg.alert('Error', response.htmlStatus),
});
},
});