From da4a2d9d559bef24de53c04b23da82b7c2008bac Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 10 Jul 2020 11:47:03 +0300 Subject: [PATCH] UI: Blur multiple input widget on submit. Fix datasource single entity resolution. --- .../widget/lib/multiple-input-widget.component.ts | 3 +++ ui-ngx/src/app/shared/models/query/query.models.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts index 890a91e76f..e26600a939 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/multiple-input-widget.component.ts @@ -367,6 +367,9 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni } public save(dataToSave?: MultipleInputWidgetSource) { + if (document && document.activeElement) { + (document.activeElement as HTMLElement).blur(); + } const config: RequestConfig = { ignoreLoading: !this.settings.showActionButtons }; diff --git a/ui-ngx/src/app/shared/models/query/query.models.ts b/ui-ngx/src/app/shared/models/query/query.models.ts index 4136a86cd5..8764b99235 100644 --- a/ui-ngx/src/app/shared/models/query/query.models.ts +++ b/ui-ngx/src/app/shared/models/query/query.models.ts @@ -615,7 +615,12 @@ export function entityDataToEntityInfo(entityData: EntityData): EntityInfo { } export function updateDatasourceFromEntityInfo(datasource: Datasource, entity: EntityInfo, createFilter = false) { - datasource.entity = {}; + datasource.entity = { + id: { + entityType: entity.entityType, + id: entity.id + } + }; datasource.entityId = entity.id; datasource.entityType = entity.entityType; if (datasource.type === DatasourceType.entity) { @@ -623,6 +628,8 @@ export function updateDatasourceFromEntityInfo(datasource: Datasource, entity: E datasource.entityLabel = entity.label; datasource.name = entity.name; datasource.entityDescription = entity.entityDescription; + datasource.entity.label = entity.label; + datasource.entity.name = entity.name; if (createFilter) { datasource.entityFilter = { type: AliasFilterType.singleEntity,