Browse Source

UI: (#2372)

Added fetchLastLevelOnly checkbox to alias query filter.
Updated ENG, RUS, UKR locales.
Updated getRelatedEntities and (constructRelatedEntitiesSearchQuery) function(s) by adding fetchLastLevelOnly attribute.
pull/2432/head
DudnikMaksym 7 years ago
committed by GitHub
parent
commit
308fa1fd8c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      ui/src/app/api/entity.service.js
  2. 1
      ui/src/app/entity/entity-filter.directive.js
  3. 32
      ui/src/app/entity/entity-filter.tpl.html
  4. 1
      ui/src/app/locale/locale.constant-en_US.json
  5. 1
      ui/src/app/locale/locale.constant-ru_RU.json
  6. 1
      ui/src/app/locale/locale.constant-uk_UA.json

15
ui/src/app/api/entity.service.js

@ -593,7 +593,8 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
parameters: {
rootId: relationQueryRootEntityId.id,
rootType: relationQueryRootEntityId.entityType,
direction: filter.direction
direction: filter.direction,
fetchLastLevelOnly: filter.fetchLastLevelOnly
},
filters: filter.filters
};
@ -643,7 +644,8 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
parameters: {
rootId: searchQueryRootEntityId.id,
rootType: searchQueryRootEntityId.entityType,
direction: filter.direction
direction: filter.direction,
fetchLastLevelOnly: filter.fetchLastLevelOnly
},
relationType: filter.relationType
};
@ -1075,10 +1077,10 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
}
}
function getRelatedEntities(rootEntityId, entityType, entitySubTypes, maxLevel, keys, typeTranslatePrefix, relationType, direction) {
function getRelatedEntities(rootEntityId, entityType, entitySubTypes, maxLevel, keys, typeTranslatePrefix, relationType, direction, fetchLastLevelOnly) {
var deferred = $q.defer();
var entitySearchQuery = constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction);
var entitySearchQuery = constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction,fetchLastLevelOnly);
if (!entitySearchQuery) {
deferred.reject();
} else {
@ -1499,13 +1501,14 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
);
}
function constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction) {
function constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction, fetchLastLevelOnly) {
var searchQuery = {
parameters: {
rootId: rootEntityId.id,
rootType: rootEntityId.entityType,
direction: direction
direction: direction,
fetchLastLevelOnly: !!fetchLastLevelOnly
},
relationType: relationType
};

1
ui/src/app/entity/entity-filter.directive.js

@ -83,6 +83,7 @@ export default function EntityFilterDirective($compile, $templateCache, $q, $doc
filter.rootEntity = null;
filter.direction = types.entitySearchDirection.from;
filter.maxLevel = 1;
filter.fetchLastLevelOnly = false;
if (filter.type === types.aliasFilterType.relationsQuery.value) {
filter.filters = [];
} else if (filter.type === types.aliasFilterType.assetSearchQuery.value) {

32
ui/src/app/entity/entity-filter.tpl.html

@ -161,6 +161,14 @@
</tb-entity-select>
</div>
</div>
<div flex layout="row">
<section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;">
<md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly"
aria-label="{{ 'alias.last-level-relation' | translate }}">
</md-switch>
<label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label>
</section>
</div>
<div flex layout="row">
<md-input-container class="md-block" style="min-width: 100px;">
<label translate>relation.direction</label>
@ -222,6 +230,14 @@
</tb-entity-select>
</div>
</div>
<div flex layout="row">
<section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;">
<md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly"
aria-label="{{ 'alias.last-level-relation' | translate }}">
</md-switch>
<label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label>
</section>
</div>
<div flex layout="row">
<md-input-container class="md-block" style="min-width: 100px;">
<label translate>relation.direction</label>
@ -291,6 +307,14 @@
</tb-entity-select>
</div>
</div>
<div flex layout="row">
<section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;">
<md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly"
aria-label="{{ 'alias.last-level-relation' | translate }}">
</md-switch>
<label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label>
</section>
</div>
<div flex layout="row">
<md-input-container class="md-block" style="min-width: 100px;">
<label translate>relation.direction</label>
@ -360,6 +384,14 @@
</tb-entity-select>
</div>
</div>
<div flex layout="row">
<section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;">
<md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly"
aria-label="{{ 'alias.last-level-relation' | translate }}">
</md-switch>
<label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label>
</section>
</div>
<div flex layout="row">
<md-input-container class="md-block" style="min-width: 100px;">
<label translate>relation.direction</label>

1
ui/src/app/locale/locale.constant-en_US.json

@ -207,6 +207,7 @@
"entity-filter-no-entity-matched": "No entities matching specified filter were found.",
"no-entity-filter-specified": "No entity filter specified",
"root-state-entity": "Use dashboard state entity as root",
"last-level-relation": "Fetch last level relation only",
"root-entity": "Root entity",
"state-entity-parameter-name": "State entity parameter name",
"default-state-entity": "Default state entity",

1
ui/src/app/locale/locale.constant-ru_RU.json

@ -206,6 +206,7 @@
"entity-filter-no-entity-matched": "Объекты, соответствующие фильтру, не найдены.",
"no-entity-filter-specified": "Не указан фильтр объектов",
"root-state-entity": "Использовать объект, полученный из дашборда, как корневой",
"last-level-relation": "Использовать только отношения последнего уровня",
"root-entity": "Корневой объект",
"state-entity-parameter-name": "Название объекта состояния",
"default-state-entity": "Объект состояния по умолчанию",

1
ui/src/app/locale/locale.constant-uk_UA.json

@ -225,6 +225,7 @@
"entity-filter-no-entity-matched": "Не знайдено жодних сутностей, які відповідають вказаному фільтру.",
"no-entity-filter-specified": "Фільтр обїектів не вказано",
"root-state-entity": "Використовувати сутінсть стану як кореневу",
"last-level-relation": "Використовувати лише відношення останнього рівня",
"group-state-entity": "Використовувати групу сутностей стану як кореневу",
"root-entity": "Коренева сутність",
"state-entity-parameter-name": "Параметр сутності стану",

Loading…
Cancel
Save