Browse Source

Merge pull request #14435 from ChantsovaEkaterina/improvement/clear-dashboard-timewindow-config

Dashboard timewindow: remove unused parameters on creating/editing dashboard
pull/14454/head
Vladyslav Prykhodko 10 months ago
committed by GitHub
parent
commit
c3a0efc0fa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ui-ngx/src/app/core/services/dashboard-utils.service.ts
  2. 7
      ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts
  3. 5
      ui-ngx/src/app/shared/models/time/time.models.ts

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

@ -168,9 +168,8 @@ export class DashboardUtilsService {
dashboard.configuration.filters = {}; dashboard.configuration.filters = {};
} }
if (isUndefined(dashboard.configuration.timewindow)) { dashboard.configuration.timewindow = initModelFromDefaultTimewindow(dashboard.configuration.timewindow,
dashboard.configuration.timewindow = this.timeService.defaultTimewindow(true); false, false, this.timeService, true, true);
}
if (isUndefined(dashboard.configuration.settings)) { if (isUndefined(dashboard.configuration.settings)) {
dashboard.configuration.settings = {}; dashboard.configuration.settings = {};
dashboard.configuration.settings.stateControllerId = 'entity'; dashboard.configuration.settings.stateControllerId = 'entity';

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

@ -34,7 +34,7 @@ import { AppState } from '@core/core.state';
import { PageComponent } from '@shared/components/page.component'; import { PageComponent } from '@shared/components/page.component';
import { AuthUser } from '@shared/models/user.model'; import { AuthUser } from '@shared/models/user.model';
import { getCurrentAuthUser } from '@core/auth/auth.selectors'; import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { Timewindow, toHistoryTimewindow } from '@shared/models/time/time.models'; import { initModelFromDefaultTimewindow, Timewindow, toHistoryTimewindow } from '@shared/models/time/time.models';
import { TimeService } from '@core/services/time.service'; import { TimeService } from '@core/services/time.service';
import { GridsterComponent, GridsterConfig, GridType } from 'angular-gridster2'; import { GridsterComponent, GridsterConfig, GridType } from 'angular-gridster2';
import { import {
@ -223,9 +223,8 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
ngOnInit(): void { ngOnInit(): void {
this.dashboardWidgets.parentDashboard = this.parentDashboard; this.dashboardWidgets.parentDashboard = this.parentDashboard;
this.dashboardWidgets.popoverComponent = this.popoverComponent; this.dashboardWidgets.popoverComponent = this.popoverComponent;
if (!this.dashboardTimewindow) { this.dashboardTimewindow = initModelFromDefaultTimewindow(this.dashboardTimewindow,
this.dashboardTimewindow = this.timeService.defaultTimewindow(true); false, false, this.timeService, true, true);
}
this.gridsterOpts = { this.gridsterOpts = {
gridType: this.gridType || GridType.ScrollVertical, gridType: this.gridType || GridType.ScrollVertical,
keepFixedHeightInMobile: true, keepFixedHeightInMobile: true,

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

@ -315,8 +315,9 @@ const getTimewindowType = (timewindow: Timewindow): TimewindowType => {
}; };
export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalOnly: boolean, export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalOnly: boolean,
historyOnly: boolean, timeService: TimeService, hasAggregation: boolean): Timewindow => { historyOnly: boolean, timeService: TimeService, hasAggregation: boolean,
const model = defaultTimewindow(timeService); isDashboard = false): Timewindow => {
const model = defaultTimewindow(timeService, isDashboard);
if (value) { if (value) {
if (value.allowedAggTypes?.length) { if (value.allowedAggTypes?.length) {
model.allowedAggTypes = value.allowedAggTypes; model.allowedAggTypes = value.allowedAggTypes;

Loading…
Cancel
Save