[pbs-devel] [PATCH proxmox-backup 08/10] ui: TaskSummary: handle less defined parameters of tasks

Dominik Csapak d.csapak at proxmox.com
Mon Nov 9 16:01:28 CET 2020


this makes it a little easier to provide good data, without
hardcoding all types in the source object

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/dashboard/TaskSummary.js | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index e4c5378c..169da2d4 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -59,7 +59,7 @@ Ext.define('PBS.TaskSummary', {
 		    filterParam.store = view.datastore;
 		}
 
-		if (record.data[state] === 0) {
+		if (record.data[state] === 0 || record.data[state] === undefined) {
 		    return;
 		}
 
@@ -200,8 +200,8 @@ Ext.define('PBS.TaskSummary', {
 	render_count: function(value, md, record, rowindex, colindex) {
 	    let me = this;
 	    let view = me.getView();
-	    let icon = me.render_icon(view.states[colindex], value);
-	    return `${icon} ${value}`;
+	    let icon = me.render_icon(view.states[colindex], value || 0);
+	    return `${icon} ${value || 0}`;
 	},
     },
 
@@ -209,7 +209,17 @@ Ext.define('PBS.TaskSummary', {
 	let me = this;
 	let controller = me.getController();
 	let data = [];
+	if (!source) {
+	    source = {};
+	}
 	me.types.forEach((type) => {
+	    if (!source[type]) {
+		source[type] = {
+		    error: 0,
+		    warning: 0,
+		    ok: 0,
+		};
+	    }
 	    source[type].type = me.titles[type];
 	    data.push(source[type]);
 	});
-- 
2.20.1






More information about the pbs-devel mailing list