[pmg-devel] [PATCH pmg-gui 2/3] reword the action success message to not show the id

Dominik Csapak d.csapak at proxmox.com
Wed Mar 28 10:36:01 CEST 2018


but the count if we have multiple messages

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/Utils.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/js/Utils.js b/js/Utils.js
index 9b61ba3..852f653 100644
--- a/js/Utils.js
+++ b/js/Utils.js
@@ -680,6 +680,15 @@ Ext.define('PMG.Utils', {
     },
 
     doQuarantineAction: function(action, id, callback) {
+	var count = id.split(';').length;
+	var successMessage = "Action '{0}'";
+	if (count > 1) {
+	    successMessage += " for '{1}' items";
+	}
+	successMessage += " successful";
+
+	/*jslint confusion: true*/
+	/*format is string and function*/
 	Proxmox.Utils.API2Request({
 	    url: '/quarantine/content/',
 	    params: {
@@ -695,8 +704,7 @@ Ext.define('PMG.Utils', {
 		    closeAction: 'destroy'
 		}).show({
 		    title: gettext('Info'),
-		    message: "Action '" + action + ' ' +
-		    id + "' successful",
+		    message: Ext.String.format(successMessage, action, count),
 		    buttons: Ext.Msg.OK,
 		    icon: Ext.MessageBox.INFO
 		});
@@ -706,6 +714,7 @@ Ext.define('PMG.Utils', {
 		}
 	    }
 	});
+	/*jslint confusion: false*/
     },
 
     sender_renderer: function(value, metaData, rec) {
-- 
2.11.0




More information about the pmg-devel mailing list