all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart
Date: Tue, 10 Nov 2020 10:18:08 +0100	[thread overview]
Message-ID: <20201110091808.4476-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20201110091808.4476-1-d.csapak@proxmox.com>

changes the layout to look i little bit more like the statistics panel
we have for ceph in pve, while changing to the UsageChart and adding
some more datastore infos (from last garbage collect)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/datastore/DataStoreListSummary.js | 128 ++++++++++++--------------
 1 file changed, 61 insertions(+), 67 deletions(-)

diff --git a/www/datastore/DataStoreListSummary.js b/www/datastore/DataStoreListSummary.js
index 67d01e16..778bbac8 100644
--- a/www/datastore/DataStoreListSummary.js
+++ b/www/datastore/DataStoreListSummary.js
@@ -7,21 +7,20 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
     cbind: {
 	title: '{datastore}',
     },
+
+    referenceHolder: true,
     bodyPadding: 10,
 
-    controller: {
-	xclass: 'Ext.app.ViewController',
+    layout: {
+	type: 'hbox',
+	align: 'stretch',
     },
+
     viewModel: {
 	data: {
 	    full: "N/A",
-	    history: [],
-	},
-
-	stores: {
-	    historystore: {
-		data: [],
-	    },
+	    stillbad: 0,
+	    deduplication: 1.0,
 	},
     },
     setTasks: function(taskdata, since) {
@@ -44,46 +43,53 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
 
 	let estimate = PBS.Utils.render_estimate(statusData['estimated-full-date']);
 	vm.set('full', estimate);
+	vm.set('deduplication', PBS.Utils.calculate_dedup_factor(statusData['gc-status']).toFixed(2));
+	vm.set('stillbad', statusData['gc-status']['still-bad']);
+
 	let last = 0;
+	let time = statusData['history-start'];
+	let delta = statusData['history-delta'];
 	let data = statusData.history.map((val) => {
 	    if (val === null) {
 		val = last;
 	    } else {
 		last = val;
 	    }
-	    return val;
+	    let entry = {
+		time: time*1000, // js Dates are ms since epoch
+		val,
+	    };
+
+	    time += delta;
+	    return entry;
 	});
-	let historyStore = vm.getStore('historystore');
-	historyStore.setData([
-	    {
-		history: data,
-	    },
-	]);
+
+	me.lookup('historychart').setData(data);
     },
 
     items: [
 	{
 	    xtype: 'container',
 	    layout: {
-		type: 'hbox',
+		type: 'vbox',
 		align: 'stretch',
 	    },
 
-	    defaults: {
-		padding: 5,
-	    },
+	    width: 350,
+	    padding: 10,
 
 	    items: [
 		{
-		    xtype: 'panel',
-		    border: false,
+		    xtype: 'proxmoxGauge',
+		    warningThreshold: 0.8,
+		    criticalThreshold: 0.95,
 		    flex: 1,
+		    reference: 'usage',
 		},
 		{
 		    xtype: 'pmxInfoWidget',
 		    iconCls: 'fa fa-fw fa-line-chart',
 		    title: gettext('Estimated Full'),
-		    width: 230,
 		    printBar: false,
 		    bind: {
 			data: {
@@ -91,64 +97,52 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
 			},
 		    },
 		},
-	    ],
-	},
-	{
-	    // we cannot autosize a sparklineline widget,
-	    // abuse a grid with a single column/row to do it for us
-	    xtype: 'grid',
-	    hideHeaders: true,
-	    minHeight: 70,
-	    border: false,
-	    bodyBorder: false,
-	    rowLines: false,
-	    disableSelection: true,
-	    viewConfig: {
-		trackOver: false,
-	    },
-	    bind: {
-		store: '{historystore}',
-	    },
-	    columns: [{
-		xtype: 'widgetcolumn',
-		flex: 1,
-		dataIndex: 'history',
-		widget: {
-		    xtype: 'sparklineline',
-		    bind: '{record.history}',
-		    spotRadius: 0,
-		    fillColor: '#ddd',
-		    lineColor: '#555',
-		    lineWidth: 0,
-		    chartRangeMin: 0,
-		    chartRangeMax: 1,
-		    tipTpl: '{y:number("0.00")*100}%',
-		    height: 60,
+		{
+		    xtype: 'pmxInfoWidget',
+		    iconCls: 'fa fa-fw fa-compress',
+		    title: gettext('Deduplication Factor'),
+		    printBar: false,
+		    bind: {
+			data: {
+			    text: '{deduplication}',
+			},
+		    },
 		},
-	    }],
+		{
+		    xtype: 'pmxInfoWidget',
+		    iconCls: 'fa critical fa-fw fa-exclamation-triangle',
+		    title: gettext('Bad Chunks'),
+		    printBar: false,
+		    hidden: true,
+		    bind: {
+			data: {
+			    text: '{stillbad}',
+			},
+			visible: '{stillbad}',
+		    },
+		},
+	    ],
 	},
 	{
 	    xtype: 'container',
 	    layout: {
-		type: 'hbox',
+		type: 'vbox',
 		align: 'stretch',
 	    },
 
-	    defaults: {
-		padding: 5,
-	    },
+	    flex: 1,
 
 	    items: [
 		{
-		    xtype: 'proxmoxGauge',
-		    warningThreshold: 0.8,
-		    criticalThreshold: 0.95,
-		    flex: 1,
-		    reference: 'usage',
+		    padding: 5,
+		    xtype: 'pbsUsageChart',
+		    reference: 'historychart',
+		    title: gettext('Usage History'),
+		    height: 100,
 		},
 		{
 		    xtype: 'container',
-		    flex: 2,
+		    flex: 1,
 		    layout: {
 			type: 'vbox',
 			align: 'stretch',
-- 
2.20.1





  parent reply	other threads:[~2020-11-10  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
2020-11-10  9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
2020-11-10  9:18 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor Dominik Csapak
2020-11-10  9:18 ` Dominik Csapak [this message]
2020-11-10 10:47 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201110091808.4476-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal