Browse Source

Fixed Datasource determination for autocomplete patterns if datasource is empty

pull/15392/head
Maksym Tsymbarov 6 months ago
committed by Vladyslav Prykhodko
parent
commit
9fed9c789f
  1. 6
      ui-ngx/src/app/modules/home/models/widget-component.models.ts

6
ui-ngx/src/app/modules/home/models/widget-component.models.ts

@ -68,7 +68,7 @@ import {
formatValue, formatValue,
getEntityDetailsPageURL, getEntityDetailsPageURL,
hasDatasourceLabelsVariables, hasDatasourceLabelsVariables,
isDefined isDefined, isDefinedAndNotNull
} from '@core/utils'; } from '@core/utils';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
@ -555,7 +555,9 @@ export class LabelVariablePattern {
const entityInfo = this.ctx.defaultSubscription.getFirstEntityInfo(); const entityInfo = this.ctx.defaultSubscription.getFirstEntityInfo();
label = createLabelFromSubscriptionEntityInfo(entityInfo, label); label = createLabelFromSubscriptionEntityInfo(entityInfo, label);
} else { } else {
const datasource = this.ctx.defaultSubscription?.firstDatasource ?? (this.ctx as any).mapInstance?.getData()[0]; const datasource = isDefinedAndNotNull(this.ctx.defaultSubscription)
? this.ctx.defaultSubscription.firstDatasource ?? undefined
: (this.ctx as any).mapInstance?.getData()[0];
label = createLabelFromDatasource(datasource, label); label = createLabelFromDatasource(datasource, label);
} }
} }

Loading…
Cancel
Save