when the host has ifupdown2 installed, we can hot apply the config add a button to do this
if the user does not meet the requirements, the api call will show why and throw an error (without changing anything) the button has to be enabled via 'showApplyBtn', because for now, we do not want it for pmg Signed-off-by: Dominik Csapak <[email protected]> --- i am not entirely happy with the changed gettext for the reboot, but did not find a better one (suggestions welcome) node/NetworkView.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/node/NetworkView.js b/node/NetworkView.js index af2da87..5880c4e 100644 --- a/node/NetworkView.js +++ b/node/NetworkView.js @@ -20,6 +20,8 @@ Ext.define('Proxmox.node.NetworkView', { // order is always the same types: ['bridge', 'bond', 'ovs'], + showApplyBtn: false, + initComponent : function() { var me = this; @@ -45,6 +47,7 @@ Ext.define('Proxmox.node.NetworkView', { var reload = function() { var changeitem = me.down('#changes'); + var apply_btn = me.down('#apply'); Proxmox.Utils.API2Request({ url: baseUrl, failure: function(response, opts) { @@ -60,9 +63,11 @@ Ext.define('Proxmox.node.NetworkView', { if (changes === undefined || changes === '') { changes = gettext("No changes"); changeitem.setHidden(true); + apply_btn.setDisabled(true); } else { changeitem.update("<pre>" + Ext.htmlEncode(changes) + "</pre>"); changeitem.setHidden(false); + apply_btn.setDisabled(false); } } }); @@ -118,6 +123,32 @@ Ext.define('Proxmox.node.NetworkView', { } }); + var apply_btn = Ext.create('Proxmox.button.Button', { + text: gettext('Apply Configuration'), + itemId: 'apply', + disabled: true, + hidden: !me.showApplyBtn, + handler: function() { + Proxmox.Utils.API2Request({ + url: baseUrl, + method: 'PUT', + waitMsgTarget: me, + success: function(response, opts) { + var upid = response.result.data; + + var win = Ext.create('Proxmox.window.TaskProgress', { + taskDone: reload, + upid: upid + }); + win.show(); + }, + failure: function(response, opts) { + Ext.Msg.alert(gettext('Error'), response.htmlStatus); + } + }); + } + }); + var set_button_status = function() { var grid = me.down('gridpanel'); var sm = grid.getSelectionModel(); @@ -265,7 +296,9 @@ Ext.define('Proxmox.node.NetworkView', { } }, edit_btn, - del_btn + del_btn, + ' ', + apply_btn ], items: [ { @@ -383,7 +416,7 @@ Ext.define('Proxmox.node.NetworkView', { itemId: 'changes', tbar: [ gettext('Pending changes') + ' (' + - gettext('Please reboot to activate changes') + ')' + gettext('Please reboot or apply to activate changes') + ')' ], split: true, bodyPadding: 5, -- 2.20.1 _______________________________________________ pve-devel mailing list [email protected] https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
