X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=www%2Fmanager6%2Fwindow%2FBulkAction.js;h=01233080ec1afa6901e2d0e4418ce9d79759bfda;hb=6a3052b2994c94baf0a61b3d177e200c421c8fd3;hp=043e23215ea47a73510896b04b122f7e62202a4b;hpb=e2c97a19e30fffd6ffdb02eeb394cea2d9f9a706;p=pve-manager.git diff --git a/www/manager6/window/BulkAction.js b/www/manager6/window/BulkAction.js index 043e2321..01233080 100644 --- a/www/manager6/window/BulkAction.js +++ b/www/manager6/window/BulkAction.js @@ -5,7 +5,7 @@ Ext.define('PVE.window.BulkAction', { width: 800, modal: true, layout: { - type: 'fit' + type: 'fit', }, border: false, @@ -18,6 +18,7 @@ Ext.define('PVE.window.BulkAction', { submit: function(params) { var me = this; + Proxmox.Utils.API2Request({ params: params, url: '/nodes/' + me.nodename + '/' + me.action, @@ -30,32 +31,29 @@ Ext.define('PVE.window.BulkAction', { var upid = response.result.data; var win = Ext.create('Proxmox.window.TaskViewer', { - upid: upid + upid: upid, }); win.show(); me.hide(); win.on('destroy', function() { me.close(); }); - } + }, }); }, - initComponent : function() { + initComponent: function() { var me = this; if (!me.nodename) { throw "no node name specified"; } - if (!me.action) { throw "no action specified"; } - if (!me.btnText) { throw "no button text specified"; } - if (!me.title) { throw "no title specified"; } @@ -63,6 +61,7 @@ Ext.define('PVE.window.BulkAction', { var items = []; if (me.action === 'migrateall') { + /*value is string and number*/ items.push( { xtype: 'pveNodeSelector', @@ -70,7 +69,7 @@ Ext.define('PVE.window.BulkAction', { disallowedNodes: [me.nodename], fieldLabel: gettext('Target node'), allowBlank: false, - onlineValidator: true + onlineValidator: true, }, { xtype: 'proxmoxintegerfield', @@ -79,21 +78,44 @@ Ext.define('PVE.window.BulkAction', { maxValue: 100, value: 1, fieldLabel: gettext('Parallel jobs'), - allowBlank: false + allowBlank: false, + }, + { + xtype: 'fieldcontainer', + fieldLabel: gettext('Allow local disk migration'), + layout: 'hbox', + items: [{ + xtype: 'proxmoxcheckbox', + name: 'with-local-disks', + checked: true, + uncheckedValue: 0, + listeners: { + change: (cb, val) => me.down('#localdiskwarning').setVisible(val), + }, + + }, + { + itemId: 'localdiskwarning', + xtype: 'displayfield', + flex: 1, + padding: '0 0 0 10', + userCls: 'pmx-hint', + value: 'Note: Migration with local disks might take long.', + }], }, { itemId: 'lxcwarning', xtype: 'displayfield', - userCls: 'pve-hint', + userCls: 'pmx-hint', value: 'Warning: Running CTs will be migrated in Restart Mode.', - hidden: true // only visible if running container chosen - } + hidden: true, // only visible if running container chosen + }, ); } else if (me.action === 'startall') { items.push({ xtype: 'hiddenfield', name: 'force', - value: 1 + value: 1, }); } @@ -109,15 +131,14 @@ Ext.define('PVE.window.BulkAction', { action: me.action, listeners: { selectionchange: function(vmselector, records) { - if (me.action == 'migrateall') { - let showWarning = records.some(function(item) { - return (item.data.type == 'lxc' && - item.data.status == 'running'); - }); + if (me.action === 'migrateall') { + let showWarning = records.some( + item => item.data.type === 'lxc' && item.data.status === 'running', + ); me.down('#lxcwarning').setVisible(showWarning); } - } - } + }, + }, }); me.formPanel = Ext.create('Ext.form.Panel', { @@ -125,13 +146,13 @@ Ext.define('PVE.window.BulkAction', { border: false, layout: { type: 'vbox', - align: 'stretch' + align: 'stretch', }, fieldDefaults: { labelWidth: 300, - anchor: '100%' + anchor: '100%', }, - items: items + items: items, }); var form = me.formPanel.getForm(); @@ -141,12 +162,12 @@ Ext.define('PVE.window.BulkAction', { handler: function() { form.isValid(); me.submit(form.getValues()); - } + }, }); Ext.apply(me, { - items: [ me.formPanel ], - buttons: [ submitBtn ] + items: [me.formPanel], + buttons: [submitBtn], }); me.callParent(); @@ -156,5 +177,5 @@ Ext.define('PVE.window.BulkAction', { submitBtn.setDisabled(!valid); }); form.isValid(); - } + }, });