[pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart

Dominik Csapak d.csapak at proxmox.com
Tue Nov 10 10:18:08 CET 2020


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 at 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






More information about the pbs-devel mailing list