Vladyslav
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
21 additions and
5 deletions
-
ui/src/app/api/entity.service.js
-
ui/src/app/common/types.constant.js
-
ui/src/app/entity/entity-select.directive.js
-
ui/src/app/entity/entity-select.tpl.html
-
ui/src/app/locale/locale.constant-cs_CZ.json
-
ui/src/app/locale/locale.constant-en_US.json
-
ui/src/app/locale/locale.constant-ru_RU.json
-
ui/src/app/locale/locale.constant-uk_UA.json
|
|
|
@ -435,6 +435,10 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
if (user.authority === 'CUSTOMER_USER') { |
|
|
|
entityId.id = user.customerId; |
|
|
|
} |
|
|
|
} else if (entityType === types.aliasEntityType.current_tenant){ |
|
|
|
let user = userService.getCurrentUser(); |
|
|
|
entityId.entityType = types.entityType.tenant; |
|
|
|
entityId.id = user.tenantId; |
|
|
|
} |
|
|
|
return entityId; |
|
|
|
} |
|
|
|
@ -806,6 +810,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
entityTypes.dashboard = types.entityType.dashboard; |
|
|
|
if (useAliasEntityTypes) { |
|
|
|
entityTypes.current_customer = types.aliasEntityType.current_customer; |
|
|
|
entityTypes.current_tenant = types.aliasEntityType.current_tenant; |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'CUSTOMER_USER': |
|
|
|
|
|
|
|
@ -408,7 +408,8 @@ export default angular.module('thingsboard.types', []) |
|
|
|
} |
|
|
|
}, |
|
|
|
aliasEntityType: { |
|
|
|
current_customer: "CURRENT_CUSTOMER" |
|
|
|
current_customer: "CURRENT_CUSTOMER", |
|
|
|
current_tenant: "CURRENT_TENANT" |
|
|
|
}, |
|
|
|
entityTypeTranslations: { |
|
|
|
"DEVICE": { |
|
|
|
@ -474,6 +475,10 @@ export default angular.module('thingsboard.types', []) |
|
|
|
"CURRENT_CUSTOMER": { |
|
|
|
type: 'entity.type-current-customer', |
|
|
|
list: 'entity.type-current-customer' |
|
|
|
}, |
|
|
|
"CURRENT_TENANT": { |
|
|
|
type: 'entity.type-current-tenant', |
|
|
|
list: 'entity.type-current-tenant' |
|
|
|
} |
|
|
|
}, |
|
|
|
entityField: { |
|
|
|
|
|
|
|
@ -22,13 +22,14 @@ import entitySelectTemplate from './entity-select.tpl.html'; |
|
|
|
/* eslint-enable import/no-unresolved, import/default */ |
|
|
|
|
|
|
|
/*@ngInject*/ |
|
|
|
export default function EntitySelect($compile, $templateCache, entityService) { |
|
|
|
export default function EntitySelect($compile, $templateCache, entityService, types) { |
|
|
|
|
|
|
|
var linker = function (scope, element, attrs, ngModelCtrl) { |
|
|
|
var template = $templateCache.get(entitySelectTemplate); |
|
|
|
element.html(template); |
|
|
|
|
|
|
|
scope.tbRequired = angular.isDefined(scope.tbRequired) ? scope.tbRequired : false; |
|
|
|
scope.entityTypeCurrentTenant = types.aliasEntityType.current_tenant; |
|
|
|
|
|
|
|
var entityTypes = entityService.prepareAllowedEntityTypesList(scope.allowedEntityTypes, scope.useAliasEntityTypes); |
|
|
|
|
|
|
|
@ -48,7 +49,8 @@ export default function EntitySelect($compile, $templateCache, entityService) { |
|
|
|
scope.updateView = function () { |
|
|
|
if (!scope.disabled) { |
|
|
|
var value = ngModelCtrl.$viewValue; |
|
|
|
if (scope.model && scope.model.entityType && scope.model.entityId) { |
|
|
|
if (scope.model && scope.model.entityType && |
|
|
|
(scope.model.entityId || scope.model.entityType === scope.entityTypeCurrentTenant)) { |
|
|
|
if (!value) { |
|
|
|
value = {}; |
|
|
|
} |
|
|
|
|
|
|
|
@ -25,11 +25,11 @@ |
|
|
|
allowed-entity-types="allowedEntityTypes" |
|
|
|
ng-model="model.entityType"> |
|
|
|
</tb-entity-type-select> |
|
|
|
<tb-entity-autocomplete flex ng-if="model.entityType" |
|
|
|
<tb-entity-autocomplete flex ng-if="model.entityType && model.entityType !== entityTypeCurrentTenant" |
|
|
|
the-form="theForm" |
|
|
|
ng-disabled="disabled" |
|
|
|
tb-required="tbRequired" |
|
|
|
entity-type="model.entityType" |
|
|
|
ng-model="model.entityId"> |
|
|
|
</tb-entity-autocomplete> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -770,6 +770,7 @@ |
|
|
|
"list-of-rulenodes": "{ count, plural, 1 {Jeden uzel pravidla} other {Seznam # uzlů pravidel} }", |
|
|
|
"rulenode-name-starts-with": "Uzly pravidel, jejichž název začíná '{{prefix}}'", |
|
|
|
"type-current-customer": "Stávající zákazník", |
|
|
|
"type-current-tenant": "Stávající tenant", |
|
|
|
"search": "Vyhledat entity", |
|
|
|
"selected-entities": "{ count, plural, 1 {1 entita} other {# entit} } zvoleno", |
|
|
|
"entity-name": "Název entity", |
|
|
|
|
|
|
|
@ -811,6 +811,7 @@ |
|
|
|
"list-of-rulenodes": "{ count, plural, 1 {One rule node} other {List of # rule nodes} }", |
|
|
|
"rulenode-name-starts-with": "Rule nodes whose names start with '{{prefix}}'", |
|
|
|
"type-current-customer": "Current Customer", |
|
|
|
"type-current-tenant": "Current Tenant", |
|
|
|
"search": "Search entities", |
|
|
|
"selected-entities": "{ count, plural, 1 {1 entity} other {# entities} } selected", |
|
|
|
"entity-name": "Entity name", |
|
|
|
|
|
|
|
@ -809,6 +809,7 @@ |
|
|
|
"list-of-rulenodes": "{ count, plural, 1 {Одно правило} other {Список из # правил} }", |
|
|
|
"rulenode-name-starts-with": "Правила, чьи названия начинаются с '{{prefix}}'", |
|
|
|
"type-current-customer": "Текущий клиент", |
|
|
|
"type-current-tenant": "Текущий владелец", |
|
|
|
"search": "Поиск объектов", |
|
|
|
"selected-entities": "Выбран(ы) { count, plural, 1 {1 объект} few {# объекта} other {# объектов} }", |
|
|
|
"entity-name": "Название объекта", |
|
|
|
|
|
|
|
@ -942,6 +942,7 @@ |
|
|
|
"list-of-rulenodes": "{ count, plural, 1 {Одне правило} other {Список # правил} }", |
|
|
|
"rulenode-name-starts-with": "Список правил, імена яких починаються '{{prefix}}'", |
|
|
|
"type-current-customer": "Поточний клієнт", |
|
|
|
"type-current-tenant": "Поточний власник", |
|
|
|
"search": "Пошук сутностей", |
|
|
|
"selected-entities": "{ count, plural, 1 {1 сутність} other {# сутності} } вибрано", |
|
|
|
"entity-name": "Ім'я сутності", |
|
|
|
|