Commit 308fa1fd8c497b0dcab14b61c96826dfa2737576
Committed by
GitHub
1 parent
7c9f8d75
UI: (#2372)
Added fetchLastLevelOnly checkbox to alias query filter. Updated ENG, RUS, UKR locales. Updated getRelatedEntities and (constructRelatedEntitiesSearchQuery) function(s) by adding fetchLastLevelOnly attribute.
Showing
6 changed files
with
45 additions
and
6 deletions
... | ... | @@ -593,7 +593,8 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
593 | 593 | parameters: { |
594 | 594 | rootId: relationQueryRootEntityId.id, |
595 | 595 | rootType: relationQueryRootEntityId.entityType, |
596 | - direction: filter.direction | |
596 | + direction: filter.direction, | |
597 | + fetchLastLevelOnly: filter.fetchLastLevelOnly | |
597 | 598 | }, |
598 | 599 | filters: filter.filters |
599 | 600 | }; |
... | ... | @@ -643,7 +644,8 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
643 | 644 | parameters: { |
644 | 645 | rootId: searchQueryRootEntityId.id, |
645 | 646 | rootType: searchQueryRootEntityId.entityType, |
646 | - direction: filter.direction | |
647 | + direction: filter.direction, | |
648 | + fetchLastLevelOnly: filter.fetchLastLevelOnly | |
647 | 649 | }, |
648 | 650 | relationType: filter.relationType |
649 | 651 | }; |
... | ... | @@ -1075,10 +1077,10 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
1075 | 1077 | } |
1076 | 1078 | } |
1077 | 1079 | |
1078 | - function getRelatedEntities(rootEntityId, entityType, entitySubTypes, maxLevel, keys, typeTranslatePrefix, relationType, direction) { | |
1080 | + function getRelatedEntities(rootEntityId, entityType, entitySubTypes, maxLevel, keys, typeTranslatePrefix, relationType, direction, fetchLastLevelOnly) { | |
1079 | 1081 | var deferred = $q.defer(); |
1080 | 1082 | |
1081 | - var entitySearchQuery = constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction); | |
1083 | + var entitySearchQuery = constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction,fetchLastLevelOnly); | |
1082 | 1084 | if (!entitySearchQuery) { |
1083 | 1085 | deferred.reject(); |
1084 | 1086 | } else { |
... | ... | @@ -1499,13 +1501,14 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
1499 | 1501 | ); |
1500 | 1502 | } |
1501 | 1503 | |
1502 | - function constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction) { | |
1504 | + function constructRelatedEntitiesSearchQuery(rootEntityId, entityType, entitySubTypes, maxLevel, relationType, direction, fetchLastLevelOnly) { | |
1503 | 1505 | |
1504 | 1506 | var searchQuery = { |
1505 | 1507 | parameters: { |
1506 | 1508 | rootId: rootEntityId.id, |
1507 | 1509 | rootType: rootEntityId.entityType, |
1508 | - direction: direction | |
1510 | + direction: direction, | |
1511 | + fetchLastLevelOnly: !!fetchLastLevelOnly | |
1509 | 1512 | }, |
1510 | 1513 | relationType: relationType |
1511 | 1514 | }; | ... | ... |
... | ... | @@ -83,6 +83,7 @@ export default function EntityFilterDirective($compile, $templateCache, $q, $doc |
83 | 83 | filter.rootEntity = null; |
84 | 84 | filter.direction = types.entitySearchDirection.from; |
85 | 85 | filter.maxLevel = 1; |
86 | + filter.fetchLastLevelOnly = false; | |
86 | 87 | if (filter.type === types.aliasFilterType.relationsQuery.value) { |
87 | 88 | filter.filters = []; |
88 | 89 | } else if (filter.type === types.aliasFilterType.assetSearchQuery.value) { | ... | ... |
... | ... | @@ -162,6 +162,14 @@ |
162 | 162 | </div> |
163 | 163 | </div> |
164 | 164 | <div flex layout="row"> |
165 | + <section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;"> | |
166 | + <md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly" | |
167 | + aria-label="{{ 'alias.last-level-relation' | translate }}"> | |
168 | + </md-switch> | |
169 | + <label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label> | |
170 | + </section> | |
171 | + </div> | |
172 | + <div flex layout="row"> | |
165 | 173 | <md-input-container class="md-block" style="min-width: 100px;"> |
166 | 174 | <label translate>relation.direction</label> |
167 | 175 | <md-select required ng-model="filter.direction"> |
... | ... | @@ -223,6 +231,14 @@ |
223 | 231 | </div> |
224 | 232 | </div> |
225 | 233 | <div flex layout="row"> |
234 | + <section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;"> | |
235 | + <md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly" | |
236 | + aria-label="{{ 'alias.last-level-relation' | translate }}"> | |
237 | + </md-switch> | |
238 | + <label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label> | |
239 | + </section> | |
240 | + </div> | |
241 | + <div flex layout="row"> | |
226 | 242 | <md-input-container class="md-block" style="min-width: 100px;"> |
227 | 243 | <label translate>relation.direction</label> |
228 | 244 | <md-select required ng-model="filter.direction"> |
... | ... | @@ -292,6 +308,14 @@ |
292 | 308 | </div> |
293 | 309 | </div> |
294 | 310 | <div flex layout="row"> |
311 | + <section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;"> | |
312 | + <md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly" | |
313 | + aria-label="{{ 'alias.last-level-relation' | translate }}"> | |
314 | + </md-switch> | |
315 | + <label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label> | |
316 | + </section> | |
317 | + </div> | |
318 | + <div flex layout="row"> | |
295 | 319 | <md-input-container class="md-block" style="min-width: 100px;"> |
296 | 320 | <label translate>relation.direction</label> |
297 | 321 | <md-select required ng-model="filter.direction"> |
... | ... | @@ -361,6 +385,14 @@ |
361 | 385 | </div> |
362 | 386 | </div> |
363 | 387 | <div flex layout="row"> |
388 | + <section class="tb-root-state-entity-switch" layout="row" layout-align="start center" style="padding-left: 0px;"> | |
389 | + <md-switch class="root-state-entity-switch" ng-model="filter.fetchLastLevelOnly" | |
390 | + aria-label="{{ 'alias.last-level-relation' | translate }}"> | |
391 | + </md-switch> | |
392 | + <label class="tb-small root-state-entity-label" translate>alias.last-level-relation</label> | |
393 | + </section> | |
394 | + </div> | |
395 | + <div flex layout="row"> | |
364 | 396 | <md-input-container class="md-block" style="min-width: 100px;"> |
365 | 397 | <label translate>relation.direction</label> |
366 | 398 | <md-select required ng-model="filter.direction"> | ... | ... |
... | ... | @@ -207,6 +207,7 @@ |
207 | 207 | "entity-filter-no-entity-matched": "No entities matching specified filter were found.", |
208 | 208 | "no-entity-filter-specified": "No entity filter specified", |
209 | 209 | "root-state-entity": "Use dashboard state entity as root", |
210 | + "last-level-relation": "Fetch last level relation only", | |
210 | 211 | "root-entity": "Root entity", |
211 | 212 | "state-entity-parameter-name": "State entity parameter name", |
212 | 213 | "default-state-entity": "Default state entity", | ... | ... |
... | ... | @@ -206,6 +206,7 @@ |
206 | 206 | "entity-filter-no-entity-matched": "Объекты, соответствующие фильтру, не найдены.", |
207 | 207 | "no-entity-filter-specified": "Не указан фильтр объектов", |
208 | 208 | "root-state-entity": "Использовать объект, полученный из дашборда, как корневой", |
209 | + "last-level-relation": "Использовать только отношения последнего уровня", | |
209 | 210 | "root-entity": "Корневой объект", |
210 | 211 | "state-entity-parameter-name": "Название объекта состояния", |
211 | 212 | "default-state-entity": "Объект состояния по умолчанию", | ... | ... |
... | ... | @@ -225,6 +225,7 @@ |
225 | 225 | "entity-filter-no-entity-matched": "Не знайдено жодних сутностей, які відповідають вказаному фільтру.", |
226 | 226 | "no-entity-filter-specified": "Фільтр обїектів не вказано", |
227 | 227 | "root-state-entity": "Використовувати сутінсть стану як кореневу", |
228 | + "last-level-relation": "Використовувати лише відношення останнього рівня", | |
228 | 229 | "group-state-entity": "Використовувати групу сутностей стану як кореневу", |
229 | 230 | "root-entity": "Коренева сутність", |
230 | 231 | "state-entity-parameter-name": "Параметр сутності стану", | ... | ... |