Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---

Notes:
    this is very "bare", obviously we'd want
    - a nicer grid/.. display of usage
    - a way to edit the limits
    
    I am not yet sure how to integrate this nicely, and wanted to get feedback 
on the rest first.

 www/manager6/pool/StatusView.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/www/manager6/pool/StatusView.js b/www/manager6/pool/StatusView.js
index 3d46b3b1a..fdbbb5672 100644
--- a/www/manager6/pool/StatusView.js
+++ b/www/manager6/pool/StatusView.js
@@ -21,6 +21,39 @@ Ext.define('PVE.pool.StatusView', {
                renderer: Ext.String.htmlEncode,
                required: true,
            },
+           usage: {
+               header: gettext('Usage'),
+               required: false,
+               renderer: value => {
+                   if (value === null) {
+                       return '-';
+                   } else {
+                       let rendered = '';
+                       let over = false;
+                       for (const [first, second] of Object.entries(value)) {
+                           if (first === 'over') {
+                               over = second == 1 ? true : false;
+                           } else {
+                               for (const [kind, usage] of 
Object.entries(second)) {
+                                   if (rendered === '') {
+                                       rendered = `${first}-${kind}=${usage}`;
+                                   } else {
+                                       rendered = rendered + `, 
${first}-${kind}=${usage}`;
+                                   }
+                               }
+                           }
+                       }
+                       if (over) {
+                           rendered = rendered + "\nover limit";
+                       }
+                       return rendered;
+                   }
+               },
+           },
+           limits: {
+               header: gettext('Resource Limits'),
+               required: false,
+           },
        };
 
        Ext.apply(me, {
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to