]> git.proxmox.com Git - pmg-gui.git/commitdiff
improving oclass formatter
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 4 Apr 2017 11:48:43 +0000 (13:48 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 5 Apr 2017 04:36:55 +0000 (06:36 +0200)
this adds from/to to the oclass text object
adds a new oclass_icon object
and a new format_oclass function, which
combines the icon with the text

this will be used in the new ruleinfo sidebar

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

index 80542494075f73688f704aa5c566167ffd0dbd08..d9d6b8e975f8642b203f8480d2f780da28a60176 100644 (file)
@@ -15,7 +15,24 @@ Ext.define('PMG.Utils', {
        who: gettext('Who Objects'),
        what: gettext('What Objects'),
        when: gettext('When Objects'),
-       action: gettext('Action Objects')
+       action: gettext('Action Objects'),
+       from: gettext('From'),
+       to: gettext('To')
+    },
+
+    oclass_icon: {
+       who: '<span class="fa fa-fw fa-user-circle"></span> ',
+       what: '<span class="fa fa-fw fa-cube"></span> ',
+       when: '<span class="fa fa-fw fa-clock-o"></span> ',
+       action: '<span class="fa fa-fw fa-flag"></span> ',
+       from: '<span class="fa fa-fw fa-user-circle"></span> ',
+       to: '<span class="fa fa-fw fa-user-circle"></span> ',
+    },
+
+    format_oclass: function(oclass) {
+       var icon = PMG.Utils.oclass_icon[oclass] || '';
+       var text = PMG.Utils.oclass_text[oclass] || oclass;
+       return icon + text;
     },
 
     rule_direction_text: {