]> git.proxmox.com Git - pve-manager.git/commitdiff
add optional icon to InfoWidget
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 22 Feb 2018 13:32:38 +0000 (14:32 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 22 Feb 2018 13:36:40 +0000 (14:36 +0100)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/panel/InfoWidget.js

index fe1f87d37509249790598cede3b14fd967ce946a..829ee1120ce5c7aa15817f155c0af39b6481c52b 100644 (file)
@@ -16,9 +16,16 @@ Ext.define('PVE.widget.Info',{
            itemId: 'label',
            data: {
                title: '',
-               usage: ''
+               usage: '',
+               iconCls: undefined
            },
-           tpl: '<div class="left-aligned">{title}</div><div class="right-aligned">{usage}</div>'
+           tpl: [
+               '<div class="left-aligned">',
+               '<tpl if="iconCls">',
+               '<i class="{iconCls}"></i> ',
+               '</tpl>',
+               '{title}</div>&nbsp;<div class="right-aligned">{usage}</div>'
+           ]
        },
        {
            height: 2,
@@ -42,6 +49,11 @@ Ext.define('PVE.widget.Info',{
        me.getComponent('progress').setVisible(enable);
     },
 
+    setIconCls: function(iconCls) {
+       var me = this;
+       me.getComponent('label').data.iconCls = iconCls;
+    },
+
     updateValue: function(text, usage) {
        var me = this;
        var label = me.getComponent('label');
@@ -78,6 +90,7 @@ Ext.define('PVE.widget.Info',{
        me.getComponent('progress').setVisible(me.printBar);
 
        me.updateValue(me.text, me.value);
+       me.setIconCls(me.iconCls);
     }
 
 });