]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/BulkAction.js
1 Ext
.define('PVE.window.BulkAction', {
2 extend
: 'Ext.window.Window',
13 // the action to set, currently there are: `startall`, `migrateall`, `stopall`
16 submit: function(params
) {
19 Proxmox
.Utils
.API2Request({
21 url
: `/nodes/${me.nodename}/${me.action}`,
24 failure
: response
=> Ext
.Msg
.alert('Error', response
.htmlStatus
),
25 success: function({ result
}, options
) {
26 Ext
.create('Proxmox.window.TaskViewer', {
30 destroy
: () => me
.close(),
38 initComponent: function() {
42 throw "no node name specified";
45 throw "no action specified";
48 throw "no button text specified";
51 throw "no title specified";
55 if (me
.action
=== 'migrateall') {
58 xtype
: 'pveNodeSelector',
60 disallowedNodes
: [me
.nodename
],
61 fieldLabel
: gettext('Target node'),
63 onlineValidator
: true,
66 xtype
: 'proxmoxintegerfield',
71 fieldLabel
: gettext('Parallel jobs'),
75 xtype
: 'fieldcontainer',
76 fieldLabel
: gettext('Allow local disk migration'),
79 xtype
: 'proxmoxcheckbox',
80 name
: 'with-local-disks',
84 change
: (cb
, val
) => me
.down('#localdiskwarning').setVisible(val
),
88 itemId
: 'localdiskwarning',
89 xtype
: 'displayfield',
93 value
: 'Note: Migration with local disks might take long.',
98 xtype
: 'displayfield',
100 value
: 'Warning: Running CTs will be migrated in Restart Mode.',
101 hidden
: true, // only visible if running container chosen
104 } else if (me
.action
=== 'startall') {
106 xtype
: 'hiddenfield',
110 } else if (me
.action
=== 'stopall') {
113 xtype
: 'proxmoxcheckbox',
115 fieldLabel
: gettext('Force Stop'),
116 boxLabel
: gettext('Force stop guest if shutdown times out.'),
121 xtype
: 'proxmoxintegerfield',
123 fieldLabel
: gettext('Timeout (s)'),
140 nodename
: me
.nodename
,
143 selectionchange: function(vmselector
, records
) {
144 if (me
.action
=== 'migrateall') {
145 let showWarning
= records
.some(
146 item
=> item
.data
.type
=== 'lxc' && item
.data
.status
=== 'running',
148 me
.down('#lxcwarning').setVisible(showWarning
);
154 me
.formPanel
= Ext
.create('Ext.form.Panel', {
162 labelWidth
: me
.action
=== 'migrateall' ? 300 : 120,
168 let form
= me
.formPanel
.getForm();
170 let submitBtn
= Ext
.create('Ext.Button', {
172 handler: function() {
174 me
.submit(form
.getValues());
179 items
: [me
.formPanel
],
180 buttons
: [submitBtn
],
185 form
.on('validitychange', function() {
186 let valid
= form
.isValid();
187 submitBtn
.setDisabled(!valid
);