Browse Source

Updated 'validateEntityId' logic

pull/4592/head
Kalutka Zhenya 5 years ago
parent
commit
ae7897366d
  1. 4
      ui-ngx/src/app/core/utils.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/widget.component.ts

4
ui-ngx/src/app/core/utils.ts

@ -438,6 +438,6 @@ export function generateSecret(length?: number): string {
return str.concat(generateSecret(length - str.length));
}
export function validateEntityId(entityId: EntityId): boolean {
return isDefinedAndNotNull(entityId.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId.entityType);
export function validateEntityId(entityId: EntityId | null): boolean {
return isDefinedAndNotNull(entityId?.id) && entityId.id !== NULL_UUID && isDefinedAndNotNull(entityId?.entityType);
}

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

@ -1015,7 +1015,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
const type = descriptor.type;
const targetEntityParamName = descriptor.stateEntityParamName;
let targetEntityId: EntityId;
if (this.widgetInfo.type !== 'static' && descriptor.setEntityId && validateEntityId(entityId)) {
if (descriptor.setEntityId && validateEntityId(entityId)) {
targetEntityId = entityId;
}
switch (type) {

Loading…
Cancel
Save