public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct
@ 2020-10-05 13:43 Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 2/7] 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-05 13:43 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 2/7] api2/status: add type- and statusfilter to tasks api call
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 3/7] 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-05 13:43 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 3/7] ui: implment task history limit and make it configurable
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 2/7] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  2020-10-05 14:44   ` Thomas Lamprecht
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 4/7] ui: refactor render_icon code Dominik Csapak
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2020-10-05 13:43 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>
---
 www/Dashboard.js              | 47 +++++++++++++++++++++--------------
 www/dashboard/LongestTasks.js |  2 +-
 www/dashboard/TaskSummary.js  |  2 +-
 3 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index a04b4040..0aefc2f0 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,10 @@ Ext.define('PBS.Dashboard', {
 	},
     },
 
-    title: gettext('Dashboard') + ' - WIP',
+    bind: {
+	title: gettext('Dashboard') + ' (' +
+	    Ext.String.format(gettext('{0} days'), '{days}') + ')',
+    },
 
     layout: {
 	type: 'column',
@@ -248,6 +252,13 @@ Ext.define('PBS.Dashboard', {
 	margin: '0 20 20 0',
     },
 
+    tools: [
+	{
+	    type: 'gear',
+	    handler: 'openDashboardOptions',
+	},
+    ],
+
     scrollable: true,
 
     items: [
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 5e2a4b13..6f2e1d99 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 4/7] ui: refactor render_icon code
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 2/7] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 3/7] ui: implment task history limit and make it configurable Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  2020-10-05 14:52   ` [pbs-devel] applied: " Thomas Lamprecht
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2020-10-05 13:43 UTC (permalink / raw)
  To: pbs-devel

we will reuse this later

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

diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index 6f2e1d99..0cf049cd 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -7,30 +7,36 @@ Ext.define('PBS.TaskSummary', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
-	render_count: function(value, md, record, rowindex, colindex) {
+	render_icon: function(state, count) {
 	    let cls = 'question';
 	    let color = 'faded';
-	    switch (colindex) {
-		case 1:
+	    switch (state) {
+		case "error":
 		    cls = "times-circle";
 		    color = "critical";
 		    break;
-		case 2:
+		case "warning":
 		    cls = "exclamation-circle";
 		    color = "warning";
 		    break;
-		case 3:
+		case "ok":
 		    cls = "check-circle";
 		    color = "good";
 		    break;
 		default: break;
 	    }
 
-	    if (value < 1) {
+	    if (count < 1) {
 		color = "faded";
 	    }
 	    cls += " " + color;
-	    return `<i class="fa fa-${cls}"></i> ${value}`;
+	    return `<i class="fa fa-${cls}"></i>`;
+	},
+
+	render_count: function(value, md, record, rowindex, colindex) {
+	    let me = this;
+	    let icon = me.render_icon(me.states[colindex], value);
+	    return `${icon} ${value}`;
 	},
     },
 
-- 
2.20.1





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

* [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
                   ` (2 preceding siblings ...)
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 4/7] ui: refactor render_icon code Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  2020-10-05 14:52   ` Thomas Lamprecht
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 6/7] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 7/7] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak
  5 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2020-10-05 13:43 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>
---
 www/dashboard/TaskSummary.js | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index 0cf049cd..efbd011d 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';
@@ -42,16 +56,13 @@ Ext.define('PBS.TaskSummary', {
 
     updateTasks: function(data) {
 	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 6/7] ui: Dashboard/TaskSummary: add Verifies to the Summary
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
                   ` (3 preceding siblings ...)
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 7/7] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak
  5 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-05 13:43 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 0aefc2f0..ff89c519 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 efbd011d..d7b13f64 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 7/7] ui: Dashboard/TaskSummary: show task overlay when clicking on a count
  2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
                   ` (4 preceding siblings ...)
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 6/7] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
@ 2020-10-05 13:43 ` Dominik Csapak
  5 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-05 13:43 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>
---
if wanted or necessary, i could implement the grid overlay in its own
file, but it is 'special' enough that we probably will only use it here
(it is different enough from the 'running' tasks grid, that i did
not try to use that)

 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 ff89c519..4f2bae13 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 d7b13f64..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(data) {
+    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 3/7] ui: implment task history limit and make it configurable
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 3/7] ui: implment task history limit and make it configurable Dominik Csapak
@ 2020-10-05 14:44   ` Thomas Lamprecht
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-05 14:44 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

s/implment/implement/


On 05.10.20 15:43, Dominik Csapak wrote:
> @@ -234,7 +235,10 @@ Ext.define('PBS.Dashboard', {
>  	},
>      },
>  
> -    title: gettext('Dashboard') + ' - WIP',
> +    bind: {
> +	title: gettext('Dashboard') + ' (' +
> +	    Ext.String.format(gettext('{0} days'), '{days}') + ')',
> +    },

would not do that, this suggests all dashboard data is from that days,
rather only set the title in the graphs where it actually affects things.

like, for example, ...

>  
>      layout: {
>  	type: 'column',
> @@ -248,6 +252,13 @@ Ext.define('PBS.Dashboard', {
>  	margin: '0 20 20 0',
>      },
>  
> +    tools: [
> +	{
> +	    type: 'gear',
> +	    handler: 'openDashboardOptions',
> +	},
> +    ],
> +
>      scrollable: true,
>  
>      items: [
> 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'),

... here (see above)

>  
>      hideHeaders: true,
>      rowLines: false,
> diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
> index 5e2a4b13..6f2e1d99 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'),

... and here (see above)

>  
>      controller: {
>  	xclass: 'Ext.app.ViewController',
> 






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

* Re: [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
@ 2020-10-05 14:52   ` Thomas Lamprecht
  2020-10-06  6:56     ` Dominik Csapak
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-05 14:52 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 05.10.20 15:43, Dominik Csapak wrote:
> 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>
> ---
>  www/dashboard/TaskSummary.js | 31 +++++++++++++++++++++----------
>  1 file changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
> index 0cf049cd..efbd011d 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';
> @@ -42,16 +56,13 @@ Ext.define('PBS.TaskSummary', {
>  
>      updateTasks: function(data) {
>  	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 = [];

This introduces an linter error:

> [./dashboard/TaskSummary.js]:
> ERR : line 60 col 6: null - Parsing error: Identifier 'data' has already been declared

You're overwriting the function parameter "data" scope here.

> +	controller.types.forEach((type) => {
> +	    source[type].type = controller.titles[type];

"source" is not declared anywhere?

> +	    data.push(source[type]);
> +	});
> +	me.lookup('grid').getStore().setData(data);
>      },
>  
>      layout: 'fit',
> 





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

* [pbs-devel] applied: [PATCH proxmox-backup 4/7] ui: refactor render_icon code
  2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 4/7] ui: refactor render_icon code Dominik Csapak
@ 2020-10-05 14:52   ` Thomas Lamprecht
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2020-10-05 14:52 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 05.10.20 15:43, Dominik Csapak wrote:
> we will reuse this later
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  www/dashboard/TaskSummary.js | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
>

applied, thanks!




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

* Re: [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title
  2020-10-05 14:52   ` Thomas Lamprecht
@ 2020-10-06  6:56     ` Dominik Csapak
  0 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2020-10-06  6:56 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox Backup Server development discussion

On 10/5/20 4:52 PM, Thomas Lamprecht wrote:
> On 05.10.20 15:43, Dominik Csapak wrote:
>> 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>
>> ---
>>   www/dashboard/TaskSummary.js | 31 +++++++++++++++++++++----------
>>   1 file changed, 21 insertions(+), 10 deletions(-)
>>
>> diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
>> index 0cf049cd..efbd011d 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';
>> @@ -42,16 +56,13 @@ Ext.define('PBS.TaskSummary', {
>>   
>>       updateTasks: function(data) {
>>   	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 = [];
> 
> This introduces an linter error:
> 
>> [./dashboard/TaskSummary.js]:
>> ERR : line 60 col 6: null - Parsing error: Identifier 'data' has already been declared
> 
> You're overwriting the function parameter "data" scope here.
> 
>> +	controller.types.forEach((type) => {
>> +	    source[type].type = controller.titles[type];
> 
> "source" is not declared anywhere?

ah yes, this went wrong when i separated the patches

the function signature should be:

updateTasks: function(source) {

(after patch 7/7 it's ok again)

i'll send a v2 later

> 
>> +	    data.push(source[type]);
>> +	});
>> +	me.lookup('grid').getStore().setData(data);
>>       },
>>   
>>       layout: 'fit',
>>
> 





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

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

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

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