Skip to content

Commit 6237988

Browse files
authored
🎨 [Frontend] UX: Usage in the last 24h (#8034)
1 parent 5922050 commit 6237988

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

services/static-webserver/client/source/class/osparc/desktop/credits/CreditsSummary.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ qx.Class.define("osparc.desktop.credits.CreditsSummary", {
4646
WIDTH: 350,
4747
TIME_RANGES: [{
4848
key: 1,
49-
label: "Today"
49+
label: "Last 24h"
5050
}, {
5151
key: 7,
5252
label: "Last week"
@@ -116,8 +116,8 @@ qx.Class.define("osparc.desktop.credits.CreditsSummary", {
116116
const trItem = new qx.ui.form.ListItem(tr.label, null, tr.key);
117117
control.add(trItem);
118118
});
119-
// default one week
120-
const found = control.getSelectables().find(trItem => trItem.getModel() === 7);
119+
// default last 24h
120+
const found = control.getSelectables().find(trItem => trItem.getModel() === 1);
121121
if (found) {
122122
control.setSelection([found]);
123123
}

services/static-webserver/client/source/class/osparc/desktop/credits/DateFilters.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,25 @@ qx.Class.define("osparc.desktop.credits.DateFilters", {
2121
members: {
2222
_buildLayout() {
2323
this._removeAll();
24-
const defaultFrom = new Date()
25-
defaultFrom.setMonth(defaultFrom.getMonth() - 1)
26-
// Range defaults to previous month
24+
25+
// Range defaults: today
26+
const defaultFrom = new Date();
27+
const defaultTo = new Date();
28+
2729
this.__from = this.__addDateInput("From", defaultFrom);
28-
this.__until = this.__addDateInput("Until");
30+
this.__until = this.__addDateInput("Until", defaultTo);
31+
32+
const todayBtn = new qx.ui.form.Button("Today").set({
33+
allowStretchY: false,
34+
alignY: "bottom"
35+
});
36+
todayBtn.addListener("execute", () => {
37+
const today = new Date();
38+
this.__from.setValue(today);
39+
this.__until.setValue(today);
40+
});
41+
this._add(todayBtn);
42+
2943
const lastWeekBtn = new qx.ui.form.Button("Last week").set({
3044
allowStretchY: false,
3145
alignY: "bottom"
@@ -38,6 +52,7 @@ qx.Class.define("osparc.desktop.credits.DateFilters", {
3852
this.__until.setValue(today);
3953
});
4054
this._add(lastWeekBtn);
55+
4156
const lastMonthBtn = new qx.ui.form.Button("Last month").set({
4257
allowStretchY: false,
4358
alignY: "bottom"
@@ -50,6 +65,7 @@ qx.Class.define("osparc.desktop.credits.DateFilters", {
5065
this.__until.setValue(today);
5166
});
5267
this._add(lastMonthBtn);
68+
5369
const lastYearBtn = new qx.ui.form.Button("Last year").set({
5470
allowStretchY: false,
5571
alignY: "bottom"

0 commit comments

Comments
 (0)