public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct
@ 2020-10-06 10:25 Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

the same as the regular TaskState, but without its fields, so that
we can use the api macro and use it as api call parameter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/types/mod.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/api2/types/mod.rs b/src/api2/types/mod.rs
index 348d3bf4..75b68879 100644
--- a/src/api2/types/mod.rs
+++ b/src/api2/types/mod.rs
@@ -662,6 +662,20 @@ impl From<crate::server::TaskListInfo> for TaskListItem {
     }
 }
 
+#[api()]
+#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum TaskStateType {
+    /// Ok
+    OK,
+    /// Warning
+    Warning,
+    /// Error
+    Error,
+    /// Unknown
+    Unknown,
+}
+
 #[api()]
 #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 2/6] api2/status: add type- and statusfilter to tasks api call
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
@ 2020-10-06 10:25 ` Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable Dominik Csapak
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

we will use this for the pbs dashboard

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/status.rs | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/api2/status.rs b/src/api2/status.rs
index fd40f14d..372b4822 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -17,6 +17,7 @@ use crate::api2::types::{
     RRDMode,
     RRDTimeFrameResolution,
     TaskListItem,
+    TaskStateType,
     Userid,
 };
 
@@ -186,6 +187,19 @@ fn datastore_status(
                 description: "Only list tasks since this UNIX epoch.",
                 optional: true,
             },
+            typefilter: {
+                optional: true,
+                type: String,
+                description: "Only list tasks, whose type contains this string.",
+            },
+            statusfilter: {
+                optional: true,
+                type: Array,
+                description: "Only list tasks which have any one of the listed status.",
+                items: {
+                    type: TaskStateType,
+                },
+            },
         },
     },
     returns: {
@@ -201,6 +215,8 @@ fn datastore_status(
 /// List tasks.
 pub fn list_tasks(
     since: Option<i64>,
+    typefilter: Option<String>,
+    statusfilter: Option<Vec<TaskStateType>>,
     _param: Value,
     rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<Vec<TaskListItem>, Error> {
@@ -223,6 +239,27 @@ pub fn list_tasks(
             match info {
                 Ok(info) => {
                     if list_all || info.upid.userid == userid {
+                        if let Some(filter) = &typefilter {
+                            if !info.upid.worker_type.contains(filter) {
+                                return None;
+                            }
+                        }
+
+                        if let Some(filters) = &statusfilter {
+                            if let Some(state) = &info.state {
+                                let statetype = match state {
+                                    server::TaskState::OK { .. } => TaskStateType::OK,
+                                    server::TaskState::Unknown { .. } => TaskStateType::Unknown,
+                                    server::TaskState::Error { .. } => TaskStateType::Error,
+                                    server::TaskState::Warning { .. } => TaskStateType::Warning,
+                                };
+
+                                if !filters.contains(&statetype) {
+                                    return None;
+                                }
+                            }
+                        }
+
                         Some(Ok(TaskListItem::from(info)))
                     } else {
                         None
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
@ 2020-10-06 10:25 ` Dominik Csapak
  2020-10-06 10:53   ` Thomas Lamprecht
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 4/6] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

we showed 'last month' even if we did not limit the api call
implement that and make the number of days configurable
(we have most of the code already available for that, since
the base dashboard got copied from pmg and never cleaned up)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* use the days for the relevant subpanels only
 www/Dashboard.js              | 52 +++++++++++++++++++++++------------
 www/dashboard/LongestTasks.js |  2 +-
 www/dashboard/TaskSummary.js  |  2 +-
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index a04b4040..5c9d5c3a 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -21,23 +21,23 @@ Ext.define('PBS.Dashboard', {
 		    defaultButton: 'savebutton',
 		    items: [{
 			xtype: 'proxmoxintegerfield',
-			itemId: 'hours',
+			itemId: 'days',
 			labelWidth: 100,
 			anchor: '100%',
 			allowBlank: false,
 			minValue: 1,
-			maxValue: 24,
-			value: viewModel.get('hours'),
+			maxValue: 60,
+			value: viewModel.get('days'),
 			fieldLabel: gettext('Hours to show'),
 		    }],
 		    buttons: [{
 			text: gettext('Save'),
-			reference: 'loginButton',
+			reference: 'savebutton',
 			formBind: true,
 			handler: function() {
 			    var win = this.up('window');
-			    var hours = win.down('#hours').getValue();
-			    me.setHours(hours, true);
+			    var days = win.down('#days').getValue();
+			    me.setDays(days, true);
 			    win.close();
 			},
 		    }],
@@ -45,15 +45,17 @@ Ext.define('PBS.Dashboard', {
 	    }).show();
 	},
 
-	setHours: function(hours, setState) {
+	setDays: function(days, setState) {
 	    var me = this;
 	    var viewModel = me.getViewModel();
-	    viewModel.set('hours', hours);
+	    viewModel.set('days', days);
 	    viewModel.notify();
 
+	    viewModel.getStore('tasks').reload();
+
 	    if (setState) {
 		var sp = Ext.state.Manager.getProvider();
-		sp.set('dashboard-hours', hours);
+		sp.set('dashboard-days', days);
 	    }
 	},
 
@@ -164,24 +166,20 @@ Ext.define('PBS.Dashboard', {
 	init: function(view) {
 	    var me = this;
 	    var sp = Ext.state.Manager.getProvider();
-	    var hours = sp.get('dashboard-hours') || 12;
-	    me.setHours(hours, false);
+	    var days = sp.get('dashboard-days') || 30;
+	    me.setDays(days, false);
 	},
     },
 
     viewModel: {
 	data: {
-	    timespan: 300, // in seconds
-	    hours: 12, // in hours
-	    error_shown: false,
 	    fingerprint: "",
-	    'bytes_in': 0,
-	    'bytes_out': 0,
-	    'avg_ptime': 0.0,
+	    days: 30,
 	},
 
 	formulas: {
 	    disableFPButton: (get) => get('fingerprint') === "",
+	    sinceEpoch: (get) => (Date.now()/1000 - get('days') * 24*3600).toFixed(0),
 	},
 
 	stores: {
@@ -226,6 +224,9 @@ Ext.define('PBS.Dashboard', {
 		proxy: {
 		    type: 'proxmox',
 		    url: '/api2/json/status/tasks',
+		    extraParams: {
+			since: '{sinceEpoch}',
+		    },
 		},
 		listeners: {
 		    load: 'updateTasks',
@@ -234,7 +235,7 @@ Ext.define('PBS.Dashboard', {
 	},
     },
 
-    title: gettext('Dashboard') + ' - WIP',
+    title: gettext('Dashboard'),
 
     layout: {
 	type: 'column',
@@ -248,6 +249,13 @@ Ext.define('PBS.Dashboard', {
 	margin: '0 20 20 0',
     },
 
+    tools: [
+	{
+	    type: 'gear',
+	    handler: 'openDashboardOptions',
+	},
+    ],
+
     scrollable: true,
 
     items: [
@@ -296,6 +304,10 @@ Ext.define('PBS.Dashboard', {
 	},
 	{
 	    xtype: 'pbsLongestTasks',
+	    bind: {
+		title: gettext('Longest Tasks') + ' (' +
+		Ext.String.format(gettext('{0} days'), '{days}') + ')',
+	    },
 	    reference: 'longesttasks',
 	    height: 250,
 	},
@@ -304,6 +316,10 @@ Ext.define('PBS.Dashboard', {
 	    height: 250,
 	},
 	{
+	    bind: {
+		title: gettext('Task Summary') + ' (' +
+		Ext.String.format(gettext('{0} days'), '{days}') + ')',
+	    },
 	    xtype: 'pbsTaskSummary',
 	    reference: 'tasksummary',
 	},
diff --git a/www/dashboard/LongestTasks.js b/www/dashboard/LongestTasks.js
index f74e768e..20cf1183 100644
--- a/www/dashboard/LongestTasks.js
+++ b/www/dashboard/LongestTasks.js
@@ -2,7 +2,7 @@ Ext.define('PBS.LongestTasks', {
     extend: 'Ext.grid.Panel',
     alias: 'widget.pbsLongestTasks',
 
-    title: gettext('Longest Tasks (last Month)'),
+    title: gettext('Longest Tasks'),
 
     hideHeaders: true,
     rowLines: false,
diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index fcf32ab1..0cf049cd 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -2,7 +2,7 @@ Ext.define('PBS.TaskSummary', {
     extend: 'Ext.panel.Panel',
     alias: 'widget.pbsTaskSummary',
 
-    title: gettext('Task Summary (last Month)'),
+    title: gettext('Task Summary'),
 
     controller: {
 	xclass: 'Ext.app.ViewController',
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 4/6] ui: Dashboard/TaskSummary: refactor types and title
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable Dominik Csapak
@ 2020-10-06 10:25 ` Dominik Csapak
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

by moving the definition into the controller and dynamically use them
in the updateTasks function

we will reuse/extend this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* correctly change function signature
 www/dashboard/TaskSummary.js | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index 0cf049cd..c5095751 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -7,6 +7,20 @@ Ext.define('PBS.TaskSummary', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	types: [
+	    "backup",
+	    "prune",
+	    "garbage_collection",
+	    "sync",
+	],
+
+	titles: {
+	    "backup": gettext('Backups'),
+	    "prune": gettext('Prunes'),
+	    "garbage_collection": gettext('Garbage collections'),
+	    "sync": gettext('Syncs'),
+	},
+
 	render_icon: function(state, count) {
 	    let cls = 'question';
 	    let color = 'faded';
@@ -40,18 +54,15 @@ Ext.define('PBS.TaskSummary', {
 	},
     },
 
-    updateTasks: function(data) {
+    updateTasks: function(source) {
 	let me = this;
-	data.backup.type = gettext('Backups');
-	data.prune.type = gettext('Prunes');
-	data.garbage_collection.type = gettext('Garbage collections');
-	data.sync.type = gettext('Syncs');
-	me.lookup('grid').getStore().setData([
-	    data.backup,
-	    data.prune,
-	    data.garbage_collection,
-	    data.sync,
-	]);
+	let controller = me.getController();
+	let data = [];
+	controller.types.forEach((type) => {
+	    source[type].type = controller.titles[type];
+	    data.push(source[type]);
+	});
+	me.lookup('grid').getStore().setData(data);
     },
 
     layout: 'fit',
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
                   ` (2 preceding siblings ...)
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 4/6] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
@ 2020-10-06 10:25 ` Dominik Csapak
  2020-10-06 11:10   ` Thomas Lamprecht
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 6/6] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak
  2020-10-06 14:07 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Thomas Lamprecht
  5 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

and count every type that starts with 'verify' (e.g. verifyjob)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Dashboard.js             | 6 ++++++
 www/dashboard/TaskSummary.js | 1 +
 2 files changed, 7 insertions(+)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index 5c9d5c3a..961100df 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -136,6 +136,7 @@ Ext.define('PBS.Dashboard', {
 	updateTasks: function(store, records, success) {
 	    if (!success) return;
 	    let me = this;
+	    let viewModel = me.getViewModel();
 
 	    records.sort((a, b) => a.data.duration - b.data.duration);
 	    let top10 = records.slice(-10);
@@ -146,6 +147,7 @@ Ext.define('PBS.Dashboard', {
 		prune: { error: 0, warning: 0, ok: 0 },
 		garbage_collection: { error: 0, warning: 0, ok: 0 },
 		sync: { error: 0, warning: 0, ok: 0 },
+		verify: { error: 0, warning: 0, ok: 0 },
 	    };
 
 	    records.forEach(record => {
@@ -154,6 +156,10 @@ Ext.define('PBS.Dashboard', {
 		    type = 'sync';
 		}
 
+		if (type.startsWith('verify')) {
+		    type = 'verify';
+		}
+
 		if (data[type] && record.data.status) {
 		    let parsed = Proxmox.Utils.parse_task_status(record.data.status);
 		    data[type][parsed]++;
diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index c5095751..58393e1d 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -12,6 +12,7 @@ Ext.define('PBS.TaskSummary', {
 	    "prune",
 	    "garbage_collection",
 	    "sync",
+	    "verify",
 	],
 
 	titles: {
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] [PATCH proxmox-backup v2 6/6] ui: Dashboard/TaskSummary: show task overlay when clicking on a count
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
                   ` (3 preceding siblings ...)
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
@ 2020-10-06 10:25 ` Dominik Csapak
  2020-10-06 14:07 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Thomas Lamprecht
  5 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 10:25 UTC (permalink / raw)
  To: pbs-devel

when clicking on a count in the summary, a small task overlay now pops
up that shows those tasks. this way, the user has an easy way
of seeing which tasks failed exactly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Dashboard.js             |   2 +-
 www/dashboard/TaskSummary.js | 138 ++++++++++++++++++++++++++++++++++-
 2 files changed, 138 insertions(+), 2 deletions(-)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index 961100df..1a68029f 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -166,7 +166,7 @@ Ext.define('PBS.Dashboard', {
 		}
 	    });
 
-	    me.lookup('tasksummary').updateTasks(data);
+	    me.lookup('tasksummary').updateTasks(data, viewModel.get('sinceEpoch'));
 	},
 
 	init: function(view) {
diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index 58393e1d..6a503979 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -7,6 +7,13 @@ Ext.define('PBS.TaskSummary', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	states: [
+	    "",
+	    "error",
+	    "warning",
+	    "ok",
+	],
+
 	types: [
 	    "backup",
 	    "prune",
@@ -20,6 +27,130 @@ Ext.define('PBS.TaskSummary', {
 	    "prune": gettext('Prunes'),
 	    "garbage_collection": gettext('Garbage collections'),
 	    "sync": gettext('Syncs'),
+	    "verify": gettext('Verify'),
+	},
+
+	openTaskList: function(grid, td, cellindex, record, tr, rowindex) {
+	    let me = this;
+	    let view = me.getView();
+
+	    if (cellindex > 0) {
+		let tasklist = view.tasklist;
+		let state = me.states[cellindex];
+		let type = me.types[rowindex];
+		let filterParam = {
+		    'statusfilter': state,
+		    'typefilter': type,
+		};
+
+		if (me.since) {
+		    filterParam.since = me.since;
+		}
+
+		if (record.data[state] === 0) {
+		    return;
+		}
+
+		if (tasklist === undefined) {
+		    tasklist = Ext.create('Ext.grid.Panel', {
+			tools: [{
+			    handler: () => tasklist.setVisible(false),
+			}],
+			floating: true,
+			scrollable: true,
+
+			height: 400,
+			width: 600,
+
+			columns: [
+			    {
+				text: gettext('Task'),
+				dataIndex: 'upid',
+				renderer: Proxmox.Utils.render_upid,
+				flex: 1,
+			    },
+			    {
+				header: gettext("Start Time"),
+				dataIndex: 'starttime',
+				width: 130,
+				renderer: function(value) {
+				    return Ext.Date.format(value, "M d H:i:s");
+				},
+			    },
+			    {
+				xtype: 'actioncolumn',
+				width: 40,
+				items: [
+				    {
+					iconCls: 'fa fa-chevron-right',
+					tooltip: gettext('Open Task'),
+					handler: function(g, rowIndex) {
+					    let rec = tasklist.getStore().getAt(rowIndex);
+					    tasklist.setVisible(false);
+					    Ext.create('Proxmox.window.TaskViewer', {
+						upid: rec.data.upid,
+						endtime: rec.data.endtime,
+						listeners: {
+						    close: () => tasklist.setVisible(true),
+						},
+					    }).show();
+					},
+				    },
+				],
+			    },
+			],
+
+			store: {
+			    sorters: [
+				{
+				    property: 'starttime',
+				    direction: 'DESC',
+				},
+			    ],
+			    type: 'store',
+			    model: 'proxmox-tasks',
+			    proxy: {
+				type: 'proxmox',
+				url: "/api2/json/status/tasks",
+			    },
+			},
+		    });
+
+		    view.on('destroy', function() {
+			tasklist.setVisible(false);
+			tasklist.destroy();
+			tasklist = undefined;
+		    });
+
+		    view.tasklist = tasklist;
+		} else {
+		    let cidx = tasklist.cidx;
+		    let ridx = tasklist.ridx;
+
+		    if (cidx === cellindex && ridx === rowindex && tasklist.isVisible()) {
+			tasklist.setVisible(false);
+			return;
+		    }
+		}
+
+		tasklist.cidx = cellindex;
+		tasklist.ridx = rowindex;
+
+		let task = me.titles[type];
+		let status = "";
+		switch (state) {
+		    case 'ok': status = gettext("OK"); break;
+		    case 'warnings': status = gettext("Warning"); break;
+		    case 'error': status = Proxmox.Utils.errorText; break;
+		}
+		let icon = me.render_icon(state, 1);
+		tasklist.setTitle(`${task} - ${status} ${icon}`);
+		tasklist.getStore().getProxy().setExtraParams(filterParam);
+		tasklist.getStore().removeAll();
+
+		tasklist.showBy(td, 'bl-tl');
+		setTimeout(() => tasklist.getStore().reload(), 10);
+	    }
 	},
 
 	render_icon: function(state, count) {
@@ -55,7 +186,7 @@ Ext.define('PBS.TaskSummary', {
 	},
     },
 
-    updateTasks: function(source) {
+    updateTasks: function(source, since) {
 	let me = this;
 	let controller = me.getController();
 	let data = [];
@@ -64,6 +195,7 @@ Ext.define('PBS.TaskSummary', {
 	    data.push(source[type]);
 	});
 	me.lookup('grid').getStore().setData(data);
+	controller.since = since;
     },
 
     layout: 'fit',
@@ -90,6 +222,10 @@ Ext.define('PBS.TaskSummary', {
 		data: [],
 	    },
 
+	    listeners: {
+		cellclick: 'openTaskList',
+	    },
+
 	    columns: [
 		{
 		    dataIndex: 'type',
-- 
2.20.1





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable Dominik Csapak
@ 2020-10-06 10:53   ` Thomas Lamprecht
  2020-10-06 11:25     ` Dominik Csapak
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-06 10:53 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 06.10.20 12:25, Dominik Csapak wrote:
> we showed 'last month' even if we did not limit the api call
> implement that and make the number of days configurable
> (we have most of the code already available for that, since
> the base dashboard got copied from pmg and never cleaned up)
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v1:
> * use the days for the relevant subpanels only
>  www/Dashboard.js              | 52 +++++++++++++++++++++++------------
>  www/dashboard/LongestTasks.js |  2 +-
>  www/dashboard/TaskSummary.js  |  2 +-
>  3 files changed, 36 insertions(+), 20 deletions(-)
> 
> diff --git a/www/Dashboard.js b/www/Dashboard.js
> index a04b4040..5c9d5c3a 100644
> --- a/www/Dashboard.js
> +++ b/www/Dashboard.js
> @@ -21,23 +21,23 @@ Ext.define('PBS.Dashboard', {
>  		    defaultButton: 'savebutton',
>  		    items: [{
>  			xtype: 'proxmoxintegerfield',
> -			itemId: 'hours',
> +			itemId: 'days',
>  			labelWidth: 100,
>  			anchor: '100%',
>  			allowBlank: false,
>  			minValue: 1,
> -			maxValue: 24,
> -			value: viewModel.get('hours'),
> +			maxValue: 60,
> +			value: viewModel.get('days'),
>  			fieldLabel: gettext('Hours to show'),

s/Hours/Days/

(can do a fixup here, though)


>  		    }],
>  		    buttons: [{
>  			text: gettext('Save'),
> -			reference: 'loginButton',
> +			reference: 'savebutton',
>  			formBind: true,
>  			handler: function() {
>  			    var win = this.up('window');
> -			    var hours = win.down('#hours').getValue();
> -			    me.setHours(hours, true);
> +			    var days = win.down('#days').getValue();
> +			    me.setDays(days, true);
>  			    win.close();
>  			},
>  		    }],
> @@ -45,15 +45,17 @@ Ext.define('PBS.Dashboard', {
>  	    }).show();
>  	},
>  
> -	setHours: function(hours, setState) {
> +	setDays: function(days, setState) {
>  	    var me = this;
>  	    var viewModel = me.getViewModel();
> -	    viewModel.set('hours', hours);
> +	    viewModel.set('days', days);
>  	    viewModel.notify();
>  
> +	    viewModel.getStore('tasks').reload();
> +
>  	    if (setState) {
>  		var sp = Ext.state.Manager.getProvider();
> -		sp.set('dashboard-hours', hours);
> +		sp.set('dashboard-days', days);
>  	    }
>  	},
>  
> @@ -164,24 +166,20 @@ Ext.define('PBS.Dashboard', {
>  	init: function(view) {
>  	    var me = this;
>  	    var sp = Ext.state.Manager.getProvider();
> -	    var hours = sp.get('dashboard-hours') || 12;
> -	    me.setHours(hours, false);
> +	    var days = sp.get('dashboard-days') || 30;
> +	    me.setDays(days, false);
>  	},
>      },
>  
>      viewModel: {
>  	data: {
> -	    timespan: 300, // in seconds
> -	    hours: 12, // in hours
> -	    error_shown: false,
>  	    fingerprint: "",
> -	    'bytes_in': 0,
> -	    'bytes_out': 0,
> -	    'avg_ptime': 0.0,
> +	    days: 30,
>  	},
>  
>  	formulas: {
>  	    disableFPButton: (get) => get('fingerprint') === "",
> +	    sinceEpoch: (get) => (Date.now()/1000 - get('days') * 24*3600).toFixed(0),
>  	},
>  
>  	stores: {
> @@ -226,6 +224,9 @@ Ext.define('PBS.Dashboard', {
>  		proxy: {
>  		    type: 'proxmox',
>  		    url: '/api2/json/status/tasks',
> +		    extraParams: {
> +			since: '{sinceEpoch}',
> +		    },
>  		},
>  		listeners: {
>  		    load: 'updateTasks',
> @@ -234,7 +235,7 @@ Ext.define('PBS.Dashboard', {
>  	},
>      },
>  
> -    title: gettext('Dashboard') + ' - WIP',
> +    title: gettext('Dashboard'),
>  
>      layout: {
>  	type: 'column',
> @@ -248,6 +249,13 @@ Ext.define('PBS.Dashboard', {
>  	margin: '0 20 20 0',
>      },
>  
> +    tools: [
> +	{
> +	    type: 'gear',
> +	    handler: 'openDashboardOptions',
> +	},
> +    ],
> +
>      scrollable: true,
>  
>      items: [
> @@ -296,6 +304,10 @@ Ext.define('PBS.Dashboard', {
>  	},
>  	{
>  	    xtype: 'pbsLongestTasks',
> +	    bind: {
> +		title: gettext('Longest Tasks') + ' (' +
> +		Ext.String.format(gettext('{0} days'), '{days}') + ')',
> +	    },
>  	    reference: 'longesttasks',
>  	    height: 250,
>  	},
> @@ -304,6 +316,10 @@ Ext.define('PBS.Dashboard', {
>  	    height: 250,
>  	},
>  	{
> +	    bind: {
> +		title: gettext('Task Summary') + ' (' +
> +		Ext.String.format(gettext('{0} days'), '{days}') + ')',
> +	    },
>  	    xtype: 'pbsTaskSummary',
>  	    reference: 'tasksummary',
>  	},
> diff --git a/www/dashboard/LongestTasks.js b/www/dashboard/LongestTasks.js
> index f74e768e..20cf1183 100644
> --- a/www/dashboard/LongestTasks.js
> +++ b/www/dashboard/LongestTasks.js
> @@ -2,7 +2,7 @@ Ext.define('PBS.LongestTasks', {
>      extend: 'Ext.grid.Panel',
>      alias: 'widget.pbsLongestTasks',
>  
> -    title: gettext('Longest Tasks (last Month)'),
> +    title: gettext('Longest Tasks'),
>  
>      hideHeaders: true,
>      rowLines: false,
> diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
> index fcf32ab1..0cf049cd 100644
> --- a/www/dashboard/TaskSummary.js
> +++ b/www/dashboard/TaskSummary.js
> @@ -2,7 +2,7 @@ Ext.define('PBS.TaskSummary', {
>      extend: 'Ext.panel.Panel',
>      alias: 'widget.pbsTaskSummary',
>  
> -    title: gettext('Task Summary (last Month)'),
> +    title: gettext('Task Summary'),
>  
>      controller: {
>  	xclass: 'Ext.app.ViewController',
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
@ 2020-10-06 11:10   ` Thomas Lamprecht
  2020-10-06 11:25     ` Thomas Lamprecht
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-06 11:10 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 06.10.20 12:25, Dominik Csapak wrote:
> and count every type that starts with 'verify' (e.g. verifyjob)
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  www/Dashboard.js             | 6 ++++++
>  www/dashboard/TaskSummary.js | 1 +
>  2 files changed, 7 insertions(+)
> 


I have some weird stuff going on here, namely, I get tasks with the same upid
multiple times in the store??

This screws up the counts, e.g., verifies are counted all double,  gc are also
more (but here not doubled!)

I.e., if I apply the below diff I get different numbers, now matching with the
actual task list which opens when clicking on such a summary number..

diff --git a/www/Dashboard.js b/www/Dashboard.js
index 1a68029f..0597194b 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -150,7 +150,12 @@ Ext.define('PBS.Dashboard', {
                verify: { error: 0, warning: 0, ok: 0 },
            };

+           let upid_seen = {};
            records.forEach(record => {
+               if (upid_seen[record.data.upid]) {
+                   return;
+               }
+               upid_seen[record.data.upid] = 1;
                let type = record.data.worker_type;
                if (type === 'syncjob') {
                    type = 'sync';





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary
  2020-10-06 11:10   ` Thomas Lamprecht
@ 2020-10-06 11:25     ` Thomas Lamprecht
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-06 11:25 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 06.10.20 13:10, Thomas Lamprecht wrote:
> On 06.10.20 12:25, Dominik Csapak wrote:
>> and count every type that starts with 'verify' (e.g. verifyjob)
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>  www/Dashboard.js             | 6 ++++++
>>  www/dashboard/TaskSummary.js | 1 +
>>  2 files changed, 7 insertions(+)
>>
> 
> 
> I have some weird stuff going on here, namely, I get tasks with the same upid
> multiple times in the store??
> 
> This screws up the counts, e.g., verifies are counted all double,  gc are also
> more (but here not doubled!)
> 
> I.e., if I apply the below diff I get different numbers, now matching with the
> actual task list which opens when clicking on such a summary number..
> 
> diff --git a/www/Dashboard.js b/www/Dashboard.js
> index 1a68029f..0597194b 100644
> --- a/www/Dashboard.js
> +++ b/www/Dashboard.js
> @@ -150,7 +150,12 @@ Ext.define('PBS.Dashboard', {
>                 verify: { error: 0, warning: 0, ok: 0 },
>             };
> 
> +           let upid_seen = {};
>             records.forEach(record => {
> +               if (upid_seen[record.data.upid]) {
> +                   return;
> +               }
> +               upid_seen[record.data.upid] = 1;
>                 let type = record.data.worker_type;
>                 if (type === 'syncjob') {
>                     type = 'sync';
> 

ignore me, this is a side effect of left over from when I tried to reproduce some
task log active to index move behavior, I may have duplicated some tasks there by
accident.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable
  2020-10-06 10:53   ` Thomas Lamprecht
@ 2020-10-06 11:25     ` Dominik Csapak
  0 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06 11:25 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox Backup Server development discussion

On 10/6/20 12:53 PM, Thomas Lamprecht wrote:
> On 06.10.20 12:25, Dominik Csapak wrote:
>> we showed 'last month' even if we did not limit the api call
>> implement that and make the number of days configurable
>> (we have most of the code already available for that, since
>> the base dashboard got copied from pmg and never cleaned up)
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>> changes from v1:
>> * use the days for the relevant subpanels only
>>   www/Dashboard.js              | 52 +++++++++++++++++++++++------------
>>   www/dashboard/LongestTasks.js |  2 +-
>>   www/dashboard/TaskSummary.js  |  2 +-
>>   3 files changed, 36 insertions(+), 20 deletions(-)
>>
>> diff --git a/www/Dashboard.js b/www/Dashboard.js
>> index a04b4040..5c9d5c3a 100644
>> --- a/www/Dashboard.js
>> +++ b/www/Dashboard.js
>> @@ -21,23 +21,23 @@ Ext.define('PBS.Dashboard', {
>>   		    defaultButton: 'savebutton',
>>   		    items: [{
>>   			xtype: 'proxmoxintegerfield',
>> -			itemId: 'hours',
>> +			itemId: 'days',
>>   			labelWidth: 100,
>>   			anchor: '100%',
>>   			allowBlank: false,
>>   			minValue: 1,
>> -			maxValue: 24,
>> -			value: viewModel.get('hours'),
>> +			maxValue: 60,
>> +			value: viewModel.get('days'),
>>   			fieldLabel: gettext('Hours to show'),
> 
> s/Hours/Days/
> 
> (can do a fixup here, though)
> 

argh, yes ... vim search is case-sensitive^^
i'll fix it if a v3 is necessary, otherwise a fixup would be appreciated :)

> 
>>   		    }],
>>   		    buttons: [{
>>   			text: gettext('Save'),
>> -			reference: 'loginButton',
>> +			reference: 'savebutton',
>>   			formBind: true,
>>   			handler: function() {
>>   			    var win = this.up('window');
>> -			    var hours = win.down('#hours').getValue();
>> -			    me.setHours(hours, true);
>> +			    var days = win.down('#days').getValue();
>> +			    me.setDays(days, true);
>>   			    win.close();
>>   			},
>>   		    }],
>> @@ -45,15 +45,17 @@ Ext.define('PBS.Dashboard', {
>>   	    }).show();
>>   	},
>>   
>> -	setHours: function(hours, setState) {
>> +	setDays: function(days, setState) {
>>   	    var me = this;
>>   	    var viewModel = me.getViewModel();
>> -	    viewModel.set('hours', hours);
>> +	    viewModel.set('days', days);
>>   	    viewModel.notify();
>>   
>> +	    viewModel.getStore('tasks').reload();
>> +
>>   	    if (setState) {
>>   		var sp = Ext.state.Manager.getProvider();
>> -		sp.set('dashboard-hours', hours);
>> +		sp.set('dashboard-days', days);
>>   	    }
>>   	},
>>   
>> @@ -164,24 +166,20 @@ Ext.define('PBS.Dashboard', {
>>   	init: function(view) {
>>   	    var me = this;
>>   	    var sp = Ext.state.Manager.getProvider();
>> -	    var hours = sp.get('dashboard-hours') || 12;
>> -	    me.setHours(hours, false);
>> +	    var days = sp.get('dashboard-days') || 30;
>> +	    me.setDays(days, false);
>>   	},
>>       },
>>   
>>       viewModel: {
>>   	data: {
>> -	    timespan: 300, // in seconds
>> -	    hours: 12, // in hours
>> -	    error_shown: false,
>>   	    fingerprint: "",
>> -	    'bytes_in': 0,
>> -	    'bytes_out': 0,
>> -	    'avg_ptime': 0.0,
>> +	    days: 30,
>>   	},
>>   
>>   	formulas: {
>>   	    disableFPButton: (get) => get('fingerprint') === "",
>> +	    sinceEpoch: (get) => (Date.now()/1000 - get('days') * 24*3600).toFixed(0),
>>   	},
>>   
>>   	stores: {
>> @@ -226,6 +224,9 @@ Ext.define('PBS.Dashboard', {
>>   		proxy: {
>>   		    type: 'proxmox',
>>   		    url: '/api2/json/status/tasks',
>> +		    extraParams: {
>> +			since: '{sinceEpoch}',
>> +		    },
>>   		},
>>   		listeners: {
>>   		    load: 'updateTasks',
>> @@ -234,7 +235,7 @@ Ext.define('PBS.Dashboard', {
>>   	},
>>       },
>>   
>> -    title: gettext('Dashboard') + ' - WIP',
>> +    title: gettext('Dashboard'),
>>   
>>       layout: {
>>   	type: 'column',
>> @@ -248,6 +249,13 @@ Ext.define('PBS.Dashboard', {
>>   	margin: '0 20 20 0',
>>       },
>>   
>> +    tools: [
>> +	{
>> +	    type: 'gear',
>> +	    handler: 'openDashboardOptions',
>> +	},
>> +    ],
>> +
>>       scrollable: true,
>>   
>>       items: [
>> @@ -296,6 +304,10 @@ Ext.define('PBS.Dashboard', {
>>   	},
>>   	{
>>   	    xtype: 'pbsLongestTasks',
>> +	    bind: {
>> +		title: gettext('Longest Tasks') + ' (' +
>> +		Ext.String.format(gettext('{0} days'), '{days}') + ')',
>> +	    },
>>   	    reference: 'longesttasks',
>>   	    height: 250,
>>   	},
>> @@ -304,6 +316,10 @@ Ext.define('PBS.Dashboard', {
>>   	    height: 250,
>>   	},
>>   	{
>> +	    bind: {
>> +		title: gettext('Task Summary') + ' (' +
>> +		Ext.String.format(gettext('{0} days'), '{days}') + ')',
>> +	    },
>>   	    xtype: 'pbsTaskSummary',
>>   	    reference: 'tasksummary',
>>   	},
>> diff --git a/www/dashboard/LongestTasks.js b/www/dashboard/LongestTasks.js
>> index f74e768e..20cf1183 100644
>> --- a/www/dashboard/LongestTasks.js
>> +++ b/www/dashboard/LongestTasks.js
>> @@ -2,7 +2,7 @@ Ext.define('PBS.LongestTasks', {
>>       extend: 'Ext.grid.Panel',
>>       alias: 'widget.pbsLongestTasks',
>>   
>> -    title: gettext('Longest Tasks (last Month)'),
>> +    title: gettext('Longest Tasks'),
>>   
>>       hideHeaders: true,
>>       rowLines: false,
>> diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
>> index fcf32ab1..0cf049cd 100644
>> --- a/www/dashboard/TaskSummary.js
>> +++ b/www/dashboard/TaskSummary.js
>> @@ -2,7 +2,7 @@ Ext.define('PBS.TaskSummary', {
>>       extend: 'Ext.panel.Panel',
>>       alias: 'widget.pbsTaskSummary',
>>   
>> -    title: gettext('Task Summary (last Month)'),
>> +    title: gettext('Task Summary'),
>>   
>>       controller: {
>>   	xclass: 'Ext.app.ViewController',
>>
> 





^ permalink raw reply	[flat|nested] 11+ messages in thread

* [pbs-devel] applied-series: [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct
  2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
                   ` (4 preceding siblings ...)
  2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 6/6] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak
@ 2020-10-06 14:07 ` Thomas Lamprecht
  5 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-06 14:07 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 06.10.20 12:25, Dominik Csapak wrote:
> the same as the regular TaskState, but without its fields, so that
> we can use the api macro and use it as api call parameter
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/api2/types/mod.rs | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
>

applied series, thanks!
With the s/Hours/Days/ followup fix for patch 3/6.




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-10-06 14:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 10:25 [pbs-devel] [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Dominik Csapak
2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] ui: implment task history limit and make it configurable Dominik Csapak
2020-10-06 10:53   ` Thomas Lamprecht
2020-10-06 11:25     ` Dominik Csapak
2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 4/6] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
2020-10-06 11:10   ` Thomas Lamprecht
2020-10-06 11:25     ` Thomas Lamprecht
2020-10-06 10:25 ` [pbs-devel] [PATCH proxmox-backup v2 6/6] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak
2020-10-06 14:07 ` [pbs-devel] applied-series: [PATCH proxmox-backup v2 1/6] api2/types: add TaskStateType struct Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal