From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <h.laimer@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 0714F60186
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 11:36:16 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id E4E528475
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 11:35:45 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id E33018463
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 11:35:44 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9DB384617B
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 11:35:44 +0100 (CET)
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Fri,  5 Feb 2021 11:35:38 +0100
Message-Id: <20210205103538.742007-3-h.laimer@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210205103538.742007-1-h.laimer@proxmox.com>
References: <20210205103538.742007-1-h.laimer@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -1.140 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH pve-manager 2/2] ui: add "Bulk Pause" action to
 node
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 05 Feb 2021 10:36:16 -0000

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 www/manager6/Utils.js           |  1 +
 www/manager6/form/VMSelector.js | 10 ++++++++++
 www/manager6/node/CmdMenu.js    | 15 +++++++++++++++
 www/manager6/node/Config.js     | 13 +++++++++++++
 4 files changed, 39 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 5278152d..941eb44a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1706,6 +1706,7 @@ Ext.define('PVE.Utils', {
 	    spiceshell: ['', gettext('Shell') + ' (Spice)'],
 	    startall: ['', gettext('Start all VMs and Containers')],
 	    stopall: ['', gettext('Stop all VMs and Containers')],
+	    suspendall: ['', gettext('Pause all VMs')],
 	    unknownimgdel: ['', gettext('Destroy image from unknown guest')],
 	    vncproxy: ['VM/CT', gettext('Console')],
 	    vncshell: ['', gettext('Shell')],
diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index 6a51a73d..0c176a9b 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -180,6 +180,7 @@ Ext.define('PVE.form.VMSelector', {
 	// only show the relevant guests by default
 	if (me.action) {
 	    var statusfilter = '';
+	    var typefilter = '';
 	    switch (me.action) {
 		case 'startall':
 		    statusfilter = 'stopped';
@@ -187,6 +188,10 @@ Ext.define('PVE.form.VMSelector', {
 		case 'stopall':
 		    statusfilter = 'running';
 		    break;
+		case 'suspendall':
+		    statusfilter = 'running';
+		    typefilter = 'qemu';
+		    break;
 	    }
 	    if (statusfilter !== '') {
 		me.store.filters.add({
@@ -197,6 +202,11 @@ Ext.define('PVE.form.VMSelector', {
 		    operator: 'in',
 		    property: 'status',
 		    value: [statusfilter],
+		}, {
+		    id: 'x-gridfilter-type',
+		    operator: 'in',
+		    property: 'type',
+		    value: [typefilter],
 		});
 	    }
 	}
diff --git a/www/manager6/node/CmdMenu.js b/www/manager6/node/CmdMenu.js
index b650bfa0..38001343 100644
--- a/www/manager6/node/CmdMenu.js
+++ b/www/manager6/node/CmdMenu.js
@@ -60,6 +60,21 @@ Ext.define('PVE.node.CmdMenu', {
 		win.show();
 	    },
 	},
+	{
+	    text: gettext('Bulk Pause'),
+	    itemId: 'bulksuspend',
+	    iconCls: 'fa fa-fw fa-pause',
+	    handler: function() {
+		var me = this.up('menu');
+		var win = Ext.create('PVE.window.BulkAction', {
+		    nodename: me.nodename,
+		    title: gettext('Bulk Pause'),
+		    btnText: gettext('Pause'),
+		    action: 'suspendall',
+		});
+		win.show();
+	    },
+	},
 	{
 	    text: gettext('Bulk Migrate'),
 	    itemId: 'bulkmigrate',
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index ef3ac32c..55e09c58 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -63,6 +63,19 @@ Ext.define('PVE.node.Config', {
 			    win.show();
 			},
 		    },
+		    {
+			text: gettext('Bulk Pause'),
+			iconCls: 'fa fa-fw fa-pause',
+			handler: function() {
+			    var win = Ext.create('PVE.window.BulkAction', {
+				nodename: nodename,
+				title: gettext('Bulk Pause'),
+				btnText: gettext('Pause'),
+				action: 'suspendall',
+			    });
+			    win.show();
+			},
+		    },
 		    {
 			text: gettext('Bulk Migrate'),
 			iconCls: 'fa fa-fw fa-send-o',
-- 
2.20.1