network: use std remove button for confirm
alows to make the code simpler too, but we need to instantiate the selection model explicitly, as we use a bit of a weird layout here to be able to show the pending changes at the bottom, if any, so the main gridpanel is not the parent of the toolbar buttons, so the std-remove button does not automatically finds the selection model when searching in the parent Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
99f3e147e4
commit
bb5511d569
@ -110,31 +110,12 @@ Ext.define('Proxmox.node.NetworkView', {
|
||||
handler: run_editor,
|
||||
});
|
||||
|
||||
let del_btn = new Ext.Button({
|
||||
text: gettext('Remove'),
|
||||
disabled: true,
|
||||
handler: function() {
|
||||
let grid = me.down('gridpanel');
|
||||
let sm = grid.getSelectionModel();
|
||||
let rec = sm.getSelection()[0];
|
||||
if (!rec) {
|
||||
return;
|
||||
}
|
||||
let sm = Ext.create('Ext.selection.RowModel', {});
|
||||
|
||||
let iface = rec.data.iface;
|
||||
|
||||
Proxmox.Utils.API2Request({
|
||||
url: baseUrl + '/' + iface,
|
||||
method: 'DELETE',
|
||||
waitMsgTarget: me,
|
||||
callback: function() {
|
||||
reload();
|
||||
},
|
||||
failure: function(response, opts) {
|
||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||
},
|
||||
});
|
||||
},
|
||||
let del_btn = new Proxmox.button.StdRemoveButton({
|
||||
selModel: sm,
|
||||
getUrl: ({ data }) => `${baseUrl}/${data.iface}`,
|
||||
callback: () => reload(),
|
||||
});
|
||||
|
||||
let apply_btn = Ext.create('Proxmox.button.Button', {
|
||||
@ -165,8 +146,6 @@ Ext.define('Proxmox.node.NetworkView', {
|
||||
});
|
||||
|
||||
let set_button_status = function() {
|
||||
let grid = me.down('gridpanel');
|
||||
let sm = grid.getSelectionModel();
|
||||
let rec = sm.getSelection()[0];
|
||||
|
||||
edit_btn.setDisabled(!rec);
|
||||
@ -328,6 +307,7 @@ Ext.define('Proxmox.node.NetworkView', {
|
||||
stateful: true,
|
||||
stateId: 'grid-node-network',
|
||||
store: store,
|
||||
selModel: sm,
|
||||
region: 'center',
|
||||
border: false,
|
||||
columns: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user