]> git.proxmox.com Git - pmg-gui.git/commitdiff
add doQuarantineAction and sender_renderer
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 28 Sep 2017 11:45:49 +0000 (13:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 28 Sep 2017 12:44:38 +0000 (14:44 +0200)
doQuarantineAction executes a quarantine action with a callback

sender_renderer is the renderer for the quarantine list

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/Utils.js

index d477759ca48aa234f0836e384a9d555bf8b56891..1611ca3c4bbe8695c306a66764a9f7e422bf7040 100644 (file)
@@ -450,6 +450,44 @@ Ext.define('PMG.Utils', {
        }
     },
 
+    doQuarantineAction: function(action, id, callback) {
+       Proxmox.Utils.API2Request({
+           url: '/quarantine/content/',
+           params: {
+               action: action,
+               id: id
+           },
+           method: 'POST',
+           failure: function(response, opts) {
+               Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+           },
+           success: function(response, opts) {
+               Ext.Msg.show({
+                   title: gettext('Info'),
+                   message: "Action '" + action + ' ' +
+                   id + "' successful",
+                   buttons: Ext.Msg.OK,
+                   icon: Ext.MessageBox.INFO
+               });
+
+               if (Ext.isFunction(callback)) {
+                   callback();
+               }
+           }
+       });
+    },
+
+    sender_renderer: function(value, metaData, rec) {
+       var subject = Ext.htmlEncode(value);
+       var from = Ext.htmlEncode(rec.data.from);
+       var sender = Ext.htmlEncode(rec.data.sender);
+       if (sender) {
+           from = Ext.String.format(gettext("{0} on behalf of {1}"),
+                                    sender, from);
+       }
+       return '<small>' + from + '</small><br>' + subject;
+    },
+
     constructor: function() {
        var me = this;