Browse Source

UI: Updated default time window in dashboard; Add new time interval 6 hours and 8 hours

pull/14379/head
Vladyslav_Prykhodko 10 months ago
parent
commit
71a3336aa7
  1. 2
      ui-ngx/src/app/core/services/dashboard-utils.service.ts
  2. 4
      ui-ngx/src/app/core/services/time.service.ts
  3. 2
      ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts
  4. 18
      ui-ngx/src/app/shared/models/time/time.models.ts

2
ui-ngx/src/app/core/services/dashboard-utils.service.ts

@ -169,7 +169,7 @@ export class DashboardUtilsService {
}
if (isUndefined(dashboard.configuration.timewindow)) {
dashboard.configuration.timewindow = this.timeService.defaultTimewindow();
dashboard.configuration.timewindow = this.timeService.defaultTimewindow(true);
}
if (isUndefined(dashboard.configuration.settings)) {
dashboard.configuration.settings = {};

4
ui-ngx/src/app/core/services/time.service.ts

@ -146,8 +146,8 @@ export class TimeService {
return this.boundMaxInterval(max);
}
public defaultTimewindow(): Timewindow {
return defaultTimewindow(this);
public defaultTimewindow(isDashboard = false): Timewindow {
return defaultTimewindow(this, isDashboard);
}
private toBound(value: number, min: number, max: number, defValue: number): number {

2
ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts

@ -224,7 +224,7 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
this.dashboardWidgets.parentDashboard = this.parentDashboard;
this.dashboardWidgets.popoverComponent = this.popoverComponent;
if (!this.dashboardTimewindow) {
this.dashboardTimewindow = this.timeService.defaultTimewindow();
this.dashboardTimewindow = this.timeService.defaultTimewindow(true);
}
this.gridsterOpts = {
gridType: this.gridType || GridType.ScrollVertical,

18
ui-ngx/src/app/shared/models/time/time.models.ts

@ -279,14 +279,14 @@ export const historyInterval = (timewindowMs: number): Timewindow => ({
}
});
export const defaultTimewindow = (timeService: TimeService): Timewindow => {
export const defaultTimewindow = (timeService: TimeService, isDashboard = false): Timewindow => {
const currentTime = moment().valueOf();
return {
selectedTab: TimewindowType.REALTIME,
realtime: {
realtimeType: RealtimeWindowType.LAST_INTERVAL,
interval: SECOND,
timewindowMs: MINUTE,
timewindowMs: isDashboard ? HOUR : MINUTE,
quickInterval: QuickTimeInterval.CURRENT_DAY,
},
history: {
@ -300,8 +300,8 @@ export const defaultTimewindow = (timeService: TimeService): Timewindow => {
quickInterval: QuickTimeInterval.CURRENT_DAY,
},
aggregation: {
type: AggregationType.AVG,
limit: Math.floor(timeService.getMaxDatapointsLimit() / 2)
type: isDashboard ? AggregationType.NONE : AggregationType.AVG ,
limit: isDashboard ? timeService.getMaxDatapointsLimit() : Math.floor(timeService.getMaxDatapointsLimit() / 2)
}
};
};
@ -1271,6 +1271,16 @@ export const defaultTimeIntervals = new Array<TimeInterval>(
translateParams: {hours: 5},
value: 5 * HOUR
},
{
name: 'timeinterval.hours-interval',
translateParams: {hours: 6},
value: 6 * HOUR
},
{
name: 'timeinterval.hours-interval',
translateParams: {hours: 8},
value: 8 * HOUR
},
{
name: 'timeinterval.hours-interval',
translateParams: {hours: 10},

Loading…
Cancel
Save