From 2a1fa76c2f77ee535951ffc74da5bf355ee16fc9 Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Fri, 10 Apr 2020 15:04:12 +0300 Subject: [PATCH] Add new alias Current Tenant (#2604) --- ui-ngx/src/app/core/http/entity.service.ts | 5 +++ .../aliases-entity-select-panel.component.ts | 5 +-- .../alias/entity-alias-dialog.component.html | 4 +- .../entity/entity-filter.component.html | 2 +- .../entity/entity-filter.component.ts | 9 +--- .../entity/entity-autocomplete.component.ts | 45 ++++++++++--------- .../entity/entity-select.component.html | 2 +- .../entity/entity-select.component.ts | 26 ++++++----- .../app/shared/models/entity-type.models.ts | 12 ++++- .../assets/locale/locale.constant-cs_CZ.json | 1 + .../assets/locale/locale.constant-en_US.json | 1 + .../assets/locale/locale.constant-ru_RU.json | 1 + .../assets/locale/locale.constant-uk_UA.json | 1 + 13 files changed, 65 insertions(+), 49 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 442cd22aab..4cf67175e4 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -480,6 +480,7 @@ export class EntityService { entityTypes.push(EntityType.DASHBOARD); if (useAliasEntityTypes) { entityTypes.push(AliasEntityType.CURRENT_CUSTOMER); + entityTypes.push(AliasEntityType.CURRENT_TENANT); } break; case Authority.CUSTOMER_USER: @@ -1065,6 +1066,10 @@ export class EntityService { if (authUser.authority === Authority.CUSTOMER_USER) { entityId.id = authUser.customerId; } + } else if (entityType === AliasEntityType.CURRENT_TENANT){ + const authUser = getCurrentAuthUser(this.store); + entityId.entityType = EntityType.TENANT; + entityId.id = authUser.tenantId; } return entityId; } diff --git a/ui-ngx/src/app/modules/home/components/alias/aliases-entity-select-panel.component.ts b/ui-ngx/src/app/modules/home/components/alias/aliases-entity-select-panel.component.ts index 4ea777ff09..6673d55498 100644 --- a/ui-ngx/src/app/modules/home/components/alias/aliases-entity-select-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/alias/aliases-entity-select-panel.component.ts @@ -14,11 +14,8 @@ /// limitations under the License. /// -import { Component, Inject, InjectionToken, OnInit } from '@angular/core'; -import { Timewindow } from '@shared/models/time/time.models'; +import { Component, Inject, InjectionToken } from '@angular/core'; import { AliasInfo, IAliasController } from '@core/api/widget-api.models'; -import { PageComponent } from '@shared/components/page.component'; -import { TIMEWINDOW_PANEL_DATA, TimewindowPanelData } from '@shared/components/time/timewindow-panel.component'; import { deepClone } from '@core/utils'; export const ALIASES_ENTITY_SELECT_PANEL_DATA = new InjectionToken('AliasesEntitySelectPanelData'); diff --git a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html index 5ddff2f60a..3ea70d7142 100644 --- a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html @@ -15,8 +15,8 @@ limitations under the License. --> -
- + +

{{ (isAdd ? 'alias.add' : 'alias.edit') | translate }}