diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts index afde26d619..0f65f33bc2 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts @@ -14,11 +14,11 @@ /// limitations under the License. /// -import { Component, forwardRef } from '@angular/core'; -import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { AliasFilterType, EntityAliasFilter } from '@shared/models/alias.models'; -import { AliasEntityType, EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; -import { TranslateService } from '@ngx-translate/core'; +import {Component, forwardRef} from '@angular/core'; +import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; +import {AliasFilterType, EntityAliasFilter} from '@shared/models/alias.models'; +import {AliasEntityType, EntityType, entityTypeTranslations} from '@shared/models/entity-type.models'; +import {TranslateService} from '@ngx-translate/core'; @Component({ selector: 'tb-entity-filter-view', @@ -101,6 +101,17 @@ export class EntityFilterViewComponent implements ControlValueAccessor { {deviceType}); } break; + case AliasFilterType.edgeType: + const edgeType = this.filter.edgeType; + prefix = this.filter.edgeNameFilter; + if (prefix && prefix.length) { + this.filterDisplayValue = this.translate.instant('alias.filter-type-edge-type-and-name-description', + {edgeType, prefix}); + } else { + this.filterDisplayValue = this.translate.instant('alias.filter-type-edge-type-description', + {edgeType}); + } + break; case AliasFilterType.entityViewType: const entityView = this.filter.entityViewType; prefix = this.filter.entityViewNameFilter; @@ -166,6 +177,7 @@ export class EntityFilterViewComponent implements ControlValueAccessor { break; case AliasFilterType.assetSearchQuery: case AliasFilterType.deviceSearchQuery: + case AliasFilterType.edgeSearchQuery: case AliasFilterType.entityViewSearchQuery: allEntitiesText = this.translate.instant('alias.all-entities'); anyRelationText = this.translate.instant('alias.any-relation'); @@ -207,6 +219,16 @@ export class EntityFilterViewComponent implements ControlValueAccessor { this.filterDisplayValue = this.translate.instant('alias.filter-type-device-search-query-description', translationValues ); + } else if (this.filter.type === AliasFilterType.edgeSearchQuery) { + const edgeTypesQuoted = []; + this.filter.edgeTypes.forEach((filterEdgeType) => { + edgeTypesQuoted.push(`'${filterEdgeType}'`); + }); + const edgeTypesText = edgeTypesQuoted.join(', '); + translationValues.edgeTypes = edgeTypesText; + this.filterDisplayValue = this.translate.instant('alias.filter-type-edge-search-query-description', + translationValues + ); } else if (this.filter.type === AliasFilterType.entityViewSearchQuery) { const entityViewTypesQuoted = []; this.filter.entityViewTypes.forEach((filterEntityViewType) => { diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html index d736917c89..e17709999f 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html @@ -103,6 +103,16 @@ + + + + + edge.name-starts-with + + +
@@ -169,6 +179,7 @@ @@ -248,6 +259,14 @@ formControlName="deviceTypes"> + +
edge.edge-types
+ + +
entity-view.entity-view-types
> { const routeParams = route.params; this.config.componentsData = { - edgeScope: route.data.edgesType + edgeScope: route.data.edgesType, + edgeType: '' }; this.customerId = routeParams.customerId; return this.store.pipe(select(selectAuthUser), take(1)).pipe( @@ -161,7 +162,7 @@ export class EdgesTableConfigResolver implements Resolve - this.edgeService.getTenantEdgeInfos(pageLink); + this.edgeService.getTenantEdgeInfos(pageLink, this.config.componentsData.edgeType); this.config.deleteEntity = id => this.edgeService.deleteEdge(id.id); } if (edgeScope === 'customer') { diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index c70314c284..ca149b5d61 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -143,9 +143,10 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, break; case EntityType.EDGE: this.placeholder = this.required ? this.translate.instant('edge.enter-edge-type') - : this.translate.instant('edge.edge-any-edge'); + : this.translate.instant('edge.any-edge'); this.secondaryPlaceholder = '+' + this.translate.instant('edge.edge-type'); this.noSubtypesMathingText = 'edge.no-edge-types-matching'; + this.subtypeListEmptyText = 'edge.edge-type-list-empty'; this.broadcastSubscription = this.broadcast.on('edgeSaved', () => { this.entitySubtypes = null; }); diff --git a/ui-ngx/src/app/shared/models/id/public-api.ts b/ui-ngx/src/app/shared/models/id/public-api.ts index 57287b1a16..7b1a81c3a9 100644 --- a/ui-ngx/src/app/shared/models/id/public-api.ts +++ b/ui-ngx/src/app/shared/models/id/public-api.ts @@ -33,3 +33,4 @@ export * from './tenant-profile-id'; export * from './user-id'; export * from './widget-type-id'; export * from './widgets-bundle-id'; +export * from './edge-id'; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 554f18ff68..c64f730c1a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -213,6 +213,7 @@ "filter-type-entity-view-type-and-name-description": "Entity Views of type '{{entityView}}' and with name starting with '{{prefix}}'", "filter-type-edge-type": "Edge type", "filter-type-edge-type-description": "Edges of type '{{edgeType}}'", + "filter-type-edge-type-and-name-description": "Edges of type '{{edgeType}}' and with name starting with '{{prefix}}'", "filter-type-relations-query": "Relations query", "filter-type-relations-query-description": "{{entities}} that have {{relationType}} relation {{direction}} {{rootEntity}}", "filter-type-asset-search-query": "Asset search query", @@ -1002,7 +1003,9 @@ "selected-edges": "{ count, plural, 1 {1 edge} other {# edges} } selected", "enter-edge-type": "Enter entity view type", "any-edge": "Any edge", - "no-edge-types-matching": "No edge types matching '{{entitySubtype}}' were found." + "no-edge-types-matching": "No edge types matching '{{entitySubtype}}' were found.", + "edge-type-list-empty": "No device types selected.", + "edge-types": "Edge types" }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.",