]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/window/BulkAction.js
e2675e88d7e7df83c2ff66dbc3966456d40336c9
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',
119 nodename
: me
.nodename
,
122 selectionchange: function(vmselector
, records
) {
123 if (me
.action
=== 'migrateall') {
124 let showWarning
= records
.some(
125 item
=> item
.data
.type
=== 'lxc' && item
.data
.status
=== 'running',
127 me
.down('#lxcwarning').setVisible(showWarning
);
133 me
.formPanel
= Ext
.create('Ext.form.Panel', {
147 let form
= me
.formPanel
.getForm();
149 let submitBtn
= Ext
.create('Ext.Button', {
151 handler: function() {
153 me
.submit(form
.getValues());
158 items
: [me
.formPanel
],
159 buttons
: [submitBtn
],
164 form
.on('validitychange', function() {
165 let valid
= form
.isValid();
166 submitBtn
.setDisabled(!valid
);