]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/BulkAction.js
1 Ext
.define('PVE.window.BulkAction', {
2 extend
: 'Ext.window.Window',
12 // the action to be set
13 // currently there are
19 submit: function(params
) {
22 Proxmox
.Utils
.API2Request({
24 url
: '/nodes/' + me
.nodename
+ '/' + me
.action
,
27 failure: function(response
, opts
) {
28 Ext
.Msg
.alert('Error', response
.htmlStatus
);
30 success: function(response
, options
) {
31 var upid
= response
.result
.data
;
33 var win
= Ext
.create('Proxmox.window.TaskViewer', {
38 win
.on('destroy', function() {
45 initComponent: function() {
49 throw "no node name specified";
52 throw "no action specified";
55 throw "no button text specified";
58 throw "no title specified";
63 if (me
.action
=== 'migrateall') {
64 /*value is string and number*/
67 xtype
: 'pveNodeSelector',
69 disallowedNodes
: [me
.nodename
],
70 fieldLabel
: gettext('Target node'),
72 onlineValidator
: true,
75 xtype
: 'proxmoxintegerfield',
80 fieldLabel
: gettext('Parallel jobs'),
84 xtype
: 'fieldcontainer',
85 fieldLabel
: gettext('Allow local disk migration'),
88 xtype
: 'proxmoxcheckbox',
89 name
: 'with-local-disks',
93 change
: (cb
, val
) => me
.down('#localdiskwarning').setVisible(val
),
98 itemId
: 'localdiskwarning',
99 xtype
: 'displayfield',
103 value
: 'Note: Migration with local disks might take long.',
107 itemId
: 'lxcwarning',
108 xtype
: 'displayfield',
110 value
: 'Warning: Running CTs will be migrated in Restart Mode.',
111 hidden
: true, // only visible if running container chosen
114 } else if (me
.action
=== 'startall') {
116 xtype
: 'hiddenfield',
130 nodename
: me
.nodename
,
133 selectionchange: function(vmselector
, records
) {
134 if (me
.action
=== 'migrateall') {
135 let showWarning
= records
.some(
136 item
=> item
.data
.type
=== 'lxc' && item
.data
.status
=== 'running',
138 me
.down('#lxcwarning').setVisible(showWarning
);
144 me
.formPanel
= Ext
.create('Ext.form.Panel', {
158 var form
= me
.formPanel
.getForm();
160 var submitBtn
= Ext
.create('Ext.Button', {
162 handler: function() {
164 me
.submit(form
.getValues());
169 items
: [me
.formPanel
],
170 buttons
: [submitBtn
],
175 form
.on('validitychange', function() {
176 var valid
= form
.isValid();
177 submitBtn
.setDisabled(!valid
);