]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/Dashboard.js
disclaimer edit: add position comobobox
[pmg-gui.git] / js / Dashboard.js
index c92b2f0d8f190f8e031b2c12a401c0432bd58866..a08e2c90a9aae73a8cd4aefb97c74bfb3c5db8e8 100644 (file)
@@ -119,6 +119,11 @@ Ext.define('PMG.Dashboard', {
                    subStatus = 0;
                }
 
+               if (item.data.name === Proxmox.NodeName) {
+                   let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus');
+                   repoStatus.setSubscriptionStatus(!!item.data.level);
+               }
+
                // resources count
                cpu += item.data.cpu || 0;
 
@@ -140,6 +145,9 @@ Ext.define('PMG.Dashboard', {
            var subscriptionPanel = me.lookup('subscription');
            subscriptionPanel.setSubStatus(subStatus);
 
+           // the node info already displays this information in case there is no cluster
+           me.lookup('clusterResources').setHidden(records.length === 1);
+
            cpu = cpu/count;
            mem = mem/count;
            hd = hd/count;
@@ -163,6 +171,16 @@ Ext.define('PMG.Dashboard', {
            }
        },
 
+       updateRepositoryStatus: function(store, records, success) {
+           if (!success) {
+               return;
+           }
+
+           let me = this;
+           let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus');
+           repoStatus.setRepositoryInfo(records[0].data['standard-repos']);
+       },
+
        init: function(view) {
            var me = this;
            var sp = Ext.state.Manager.getProvider();
@@ -272,6 +290,21 @@ Ext.define('PMG.Dashboard', {
                    { type: 'string', name: 'receiver' },
                ],
            },
+           repositories: {
+               storeid: 'dash-repositories',
+               type: 'update',
+               interval: 15000,
+               autoStart: true,
+               autoLoad: true,
+               autoDestroy: true,
+               proxy: {
+                   type: 'proxmox',
+                   url: '/api2/json/nodes/localhost/apt/repositories',
+               },
+               listeners: {
+                   load: 'updateRepositoryStatus',
+               },
+           },
        },
     },
 
@@ -374,7 +407,7 @@ Ext.define('PMG.Dashboard', {
                },
                {
                    iconCls: 'fa fa-ticket',
-                   title: 'Subscription',
+                   title: gettext('Subscription'),
                    reference: 'subscription',
                    xtype: 'pmgSubscriptionInfo',
                    margin: '10 0 0 0',
@@ -383,36 +416,14 @@ Ext.define('PMG.Dashboard', {
            ],
        },
        {
-           height: 250,
+           xtype: 'pmgNodeInfoPanel',
+           reference: 'nodeInfo',
+           height: 275,
+           bodyPadding: '15 5 15 5',
            iconCls: 'fa fa-tasks',
-           title: gettext('Node Resources'),
-           bodyPadding: '0 20 0 20',
-           layout: {
-               type: 'hbox',
-               align: 'center',
-           },
-           defaults: {
-               xtype: 'proxmoxGauge',
-               spriteFontSize: '20px',
-               flex: 1,
-           },
-           items: [
-               {
-                   title: gettext('CPU'),
-                   reference: 'cpu',
-               },
-               {
-                   title: gettext('Memory'),
-                   reference: 'mem',
-               },
-               {
-                   title: gettext('Storage'),
-                   reference: 'hd',
-               },
-           ],
        },
        {
-           height: 250,
+           height: 275,
            iconCls: 'fa fa-list',
            title: gettext('Top Receivers'),
 
@@ -427,9 +438,7 @@ Ext.define('PMG.Dashboard', {
                bind: {
                    store: '{receivers}',
                },
-
                emptyText: gettext('No data in database'),
-
                // remove all borders/lines/headers
                border: false,
                bodyBorder: false,
@@ -440,7 +449,6 @@ Ext.define('PMG.Dashboard', {
                viewConfig: {
                    stripeRows: false,
                },
-
                columns: [
                    {
                        dataIndex: 'receiver',
@@ -455,5 +463,36 @@ Ext.define('PMG.Dashboard', {
                ],
            }],
        },
+       {
+           height: 250,
+           iconCls: 'fa fa-tasks',
+           title: gettext('Cluster Resources (average)'),
+           reference: 'clusterResources',
+           hidden: true,
+           bodyPadding: '0 20 0 20',
+           layout: {
+               type: 'hbox',
+               align: 'center',
+           },
+           defaults: {
+               xtype: 'proxmoxGauge',
+               spriteFontSize: '20px',
+               flex: 1,
+           },
+           items: [
+               {
+                   title: gettext('CPU'),
+                   reference: 'cpu',
+               },
+               {
+                   title: gettext('Memory'),
+                   reference: 'mem',
+               },
+               {
+                   title: gettext('Storage'),
+                   reference: 'hd',
+               },
+           ],
+       },
     ],
 });