]>
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 set, currently there are: `startall`, `migrateall`, `stopall`
15 submit: function(params
) {
18 Proxmox
.Utils
.API2Request({
20 url
: `/nodes/${me.nodename}/${me.action}`,
23 failure
: response
=> Ext
.Msg
.alert('Error', response
.htmlStatus
),
24 success: function({ result
}, options
) {
25 Ext
.create('Proxmox.window.TaskViewer', {
29 destroy
: () => me
.close(),
37 initComponent: function() {
41 throw "no node name specified";
44 throw "no action specified";
47 throw "no button text specified";
50 throw "no title specified";
54 if (me
.action
=== 'migrateall') {
57 xtype
: 'pveNodeSelector',
59 disallowedNodes
: [me
.nodename
],
60 fieldLabel
: gettext('Target node'),
62 onlineValidator
: true,
65 xtype
: 'proxmoxintegerfield',
70 fieldLabel
: gettext('Parallel jobs'),
74 xtype
: 'fieldcontainer',
75 fieldLabel
: gettext('Allow local disk migration'),
78 xtype
: 'proxmoxcheckbox',
79 name
: 'with-local-disks',
83 change
: (cb
, val
) => me
.down('#localdiskwarning').setVisible(val
),
87 itemId
: 'localdiskwarning',
88 xtype
: 'displayfield',
92 value
: 'Note: Migration with local disks might take long.',
97 xtype
: 'displayfield',
99 value
: 'Warning: Running CTs will be migrated in Restart Mode.',
100 hidden
: true, // only visible if running container chosen
103 } else if (me
.action
=== 'startall') {
105 xtype
: 'hiddenfield',
109 } else if (me
.action
=== 'stopall') {
112 xtype
: 'proxmoxcheckbox',
114 fieldLabel
: gettext('Force Stop'),
115 boxLabel
: gettext('Force stop guest if shutdown times out.'),
120 xtype
: 'proxmoxintegerfield',
122 fieldLabel
: gettext('Timeout (s)'),
139 nodename
: me
.nodename
,
142 selectionchange: function(vmselector
, records
) {
143 if (me
.action
=== 'migrateall') {
144 let showWarning
= records
.some(
145 item
=> item
.data
.type
=== 'lxc' && item
.data
.status
=== 'running',
147 me
.down('#lxcwarning').setVisible(showWarning
);
153 me
.formPanel
= Ext
.create('Ext.form.Panel', {
161 labelWidth
: me
.action
=== 'migrateall' ? 300 : 120,
167 let form
= me
.formPanel
.getForm();
169 let submitBtn
= Ext
.create('Ext.Button', {
171 handler: function() {
173 me
.submit(form
.getValues());
178 items
: [me
.formPanel
],
179 buttons
: [submitBtn
],
184 form
.on('validitychange', function() {
185 let valid
= form
.isValid();
186 submitBtn
.setDisabled(!valid
);