]> git.proxmox.com Git - pmg-gui.git/commitdiff
normalize the dashboard graph to per minute
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 12 Oct 2017 08:09:29 +0000 (10:09 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Oct 2017 09:11:15 +0000 (11:11 +0200)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/Dashboard.js
js/Utils.js

index 38b861a07f55bc849d8b5e8421b3f482371824e6..60fbebb50f7aff02935bf13ec208811b5e7c941e 100644 (file)
@@ -77,7 +77,8 @@ Ext.define('PMG.Dashboard', {
            records.forEach(function(item) {
                bytes_in += item.data.bytes_in;
                bytes_out += item.data.bytes_out;
-               count += item.data.count;
+               // unnormalize
+               count += (item.data.count*item.data.timespan)/60;
                ptime += item.data.ptimesum;
            });
 
@@ -189,14 +190,38 @@ Ext.define('PMG.Dashboard', {
                    }
                },
                fields: [
-                   { type: 'integer', name: 'count' },
-                   { type: 'integer', name: 'count_in' },
-                   { type: 'integer', name: 'count_out' },
-                   { type: 'integer', name: 'spam' },
-                   { type: 'integer', name: 'spam_in' },
-                   { type: 'integer', name: 'spam_out' },
-                   { type: 'integer', name: 'virus' },
-                   { type: 'integer', name: 'virus_in' },
+                   {
+                       type: 'number', name: 'count',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'count_in',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'count_out',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'spam',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'spam_in',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'spam_out',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'virus',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
+                   {
+                       type: 'number', name: 'virus_in',
+                       convert: PMG.Utils.convert_field_to_per_min
+                   },
                    { type: 'integer', name: 'virus_out' },
                    { type: 'integer', name: 'bytes_in' },
                    { type: 'integer', name: 'bytes_out' },
@@ -273,7 +298,7 @@ Ext.define('PMG.Dashboard', {
            items: [
                {
                    fields: ['count'],
-                   fieldTitles: [ gettext('Mails') ],
+                   fieldTitles: [ gettext('Mails / min') ],
                    seriesConfig: {
                        colors: [ '#00617F' ],
                        style: {
@@ -288,7 +313,7 @@ Ext.define('PMG.Dashboard', {
                },
                {
                    fields: ['spam'],
-                   fieldTitles: [ gettext('Spam') ],
+                   fieldTitles: [ gettext('Spam / min') ],
                    seriesConfig: {
                        colors: [ '#E67300' ],
                        style: {
index fed1b145c60fd11184a121e47a22a3098b017747..e8d43d4b94d4efe4b1f8a1453489bfcf05388f36 100644 (file)
@@ -129,6 +129,10 @@ Ext.define('PMG.Utils', {
        return 'unknown';
     },
 
+    convert_field_to_per_min: function(value, record) {
+       return (value/(record.data.timespan/60));
+    },
+
     object_editors: {
        1000: {
            xtype: 'proxmoxWindowEdit',