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