[pve-devel] [PATCH 03/18] improving oclass formatter

Dominik Csapak d.csapak at proxmox.com
Tue Apr 4 13:48:43 CEST 2017


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 at proxmox.com>
---
 js/Utils.js | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/js/Utils.js b/js/Utils.js
index 8054249..d9d6b8e 100644
--- a/js/Utils.js
+++ b/js/Utils.js
@@ -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: {
-- 
2.11.0





More information about the pve-devel mailing list