]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/BulkAction.js
a2005b565773df335025a1a22c3e95e2d9aea711
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 var showWarning
= records
.some(function(item
) {
136 return (item
.data
.type
== 'lxc' &&
137 item
.data
.status
== 'running');
139 me
.down('#lxcwarning').setVisible(showWarning
);
145 me
.formPanel
= Ext
.create('Ext.form.Panel', {
159 var form
= me
.formPanel
.getForm();
161 var submitBtn
= Ext
.create('Ext.Button', {
163 handler: function() {
165 me
.submit(form
.getValues());
170 items
: [ me
.formPanel
],
171 buttons
: [ submitBtn
],
176 form
.on('validitychange', function() {
177 var valid
= form
.isValid();
178 submitBtn
.setDisabled(!valid
);