>>;
if (filter.type === AliasFilterType.assetSearchQuery) {
const assetSearchQuery = searchQuery as AssetSearchQuery;
@@ -988,8 +1034,8 @@ export class EntityService {
);
}
- private getStateEntityId(filter: EntityAliasFilter, stateParams: StateParams): EntityId {
- let entityId = null;
+ private getStateEntityInfo(filter: EntityAliasFilter, stateParams: StateParams): {entityId: EntityId} {
+ let entityId: EntityId = null;
if (stateParams) {
if (filter.stateEntityParamName && filter.stateEntityParamName.length) {
if (stateParams[filter.stateEntityParamName]) {
@@ -1005,7 +1051,7 @@ export class EntityService {
if (entityId) {
entityId = this.resolveAliasEntityId(entityId.entityType, entityId.id);
}
- return entityId;
+ return {entityId};
}
private resolveAliasEntityId(entityType: EntityType | AliasEntityType, id: string): EntityId {
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 05247b5e04..6670b17214 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
@@ -133,6 +133,14 @@
+
+
+
+
+
+
+
relation.direction
@@ -191,6 +199,14 @@
+
+
+
+
+
+
+
relation.direction
diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.scss b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.scss
index 267e0a5773..01e8dc7cc8 100644
--- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.scss
+++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.scss
@@ -25,6 +25,7 @@
.tb-root-state-entity-switch {
padding-left: 10px;
+ padding-bottom: 10px;
.root-state-entity-switch {
margin: 0;
diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts
index ecaaad5fd2..600ce2d6da 100644
--- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts
+++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts
@@ -165,6 +165,7 @@ export class EntityFilterComponent implements ControlValueAccessor, OnInit {
rootEntity: [filter ? filter.rootEntity : null, (filter && filter.rootStateEntity) ? [] : [Validators.required]],
direction: [filter ? filter.direction : EntitySearchDirection.FROM, [Validators.required]],
maxLevel: [filter ? filter.maxLevel : 1, []],
+ fetchLastLevelOnly: [filter ? filter.fetchLastLevelOnly : false, []]
});
this.filterFormGroup.get('rootStateEntity').valueChanges.subscribe((rootStateEntity: boolean) => {
this.filterFormGroup.get('rootEntity').setValidators(rootStateEntity ? [] : [Validators.required]);
diff --git a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.html b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.html
index c8311620e0..8b15c59196 100644
--- a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.html
@@ -38,6 +38,12 @@
+
+
+
@@ -87,6 +93,12 @@
+
+
+
@@ -114,15 +126,22 @@
-
-
+
+
+
+
- timeline
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts
index e4b6a32637..29482e63b9 100644
--- a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts
@@ -420,6 +420,7 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie
const dataKeyTypes = [DataKeyType.timeseries];
if (this.widgetType === widgetType.latest) {
dataKeyTypes.push(DataKeyType.attribute);
+ dataKeyTypes.push(DataKeyType.entityField);
}
fetchObservable = this.callbacks.fetchEntityKeys(this.entityAliasId, this.searchText, dataKeyTypes);
} else {
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
index 8446ee0723..c9735fd364 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
@@ -14,7 +14,7 @@
/// limitations under the License.
///
-import { ChangeDetectionStrategy, Component, forwardRef, Input, OnInit } from '@angular/core';
+import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
@@ -22,12 +22,11 @@ import {
DataKey,
Datasource,
DatasourceType,
- datasourceTypeTranslationMap, defaultLegendConfig,
- WidgetActionDescriptor,
+ datasourceTypeTranslationMap,
+ defaultLegendConfig,
widgetType
} from '@shared/models/widget.models';
import {
- AbstractControl,
ControlValueAccessor,
FormArray,
FormBuilder,
@@ -58,7 +57,8 @@ import { MatDialog } from '@angular/material/dialog';
import { EntityService } from '@core/http/entity.service';
import { JsonFormComponentData } from '@shared/components/json-form/json-form-component.models';
import { WidgetActionsData } from './action/manage-widget-actions.component.models';
-import { Dashboard, DashboardState } from '@shared/models/dashboard.models';
+import { DashboardState } from '@shared/models/dashboard.models';
+import { entityFields } from '@shared/models/entity.models';
const emptySettingsSchema = {
type: 'object',
@@ -621,10 +621,10 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
return chip;
} else {
let label: string = chip;
- if (type === DataKeyType.alarm) {
- const alarmField = alarmFields[label];
- if (alarmField) {
- label = this.translate.instant(alarmField.name);
+ if (type === DataKeyType.alarm || type === DataKeyType.entityField) {
+ const keyField = type === DataKeyType.alarm ? alarmFields[label] : entityFields[chip];;
+ if (keyField) {
+ label = this.translate.instant(keyField.name);
}
}
label = this.genNextLabel(label);
diff --git a/ui-ngx/src/app/shared/models/alias.models.ts b/ui-ngx/src/app/shared/models/alias.models.ts
index 14f9193952..50d26f10a0 100644
--- a/ui-ngx/src/app/shared/models/alias.models.ts
+++ b/ui-ngx/src/app/shared/models/alias.models.ts
@@ -91,6 +91,7 @@ export interface RelationsQueryFilter {
direction?: EntitySearchDirection;
filters?: Array;
maxLevel?: number;
+ fetchLastLevelOnly?: boolean;
}
export interface EntitySearchQueryFilter {
@@ -100,6 +101,8 @@ export interface EntitySearchQueryFilter {
rootEntity?: EntityId;
relationType?: string;
direction?: EntitySearchDirection;
+ maxLevel?: number;
+ fetchLastLevelOnly?: boolean;
}
export interface AssetSearchQueryFilter extends EntitySearchQueryFilter {
diff --git a/ui-ngx/src/app/shared/models/device.models.ts b/ui-ngx/src/app/shared/models/device.models.ts
index ef527eb33c..7378fc430a 100644
--- a/ui-ngx/src/app/shared/models/device.models.ts
+++ b/ui-ngx/src/app/shared/models/device.models.ts
@@ -57,3 +57,18 @@ export interface DeviceCredentials extends BaseData {
export interface DeviceSearchQuery extends EntitySearchQuery {
deviceTypes: Array;
}
+
+export interface ClaimRequest {
+ secretKey: string;
+}
+
+export enum ClaimResponse {
+ SUCCESS = 'SUCCESS',
+ FAILURE = 'FAILURE',
+ CLAIMED = 'CLAIMED'
+}
+
+export interface ClaimResult {
+ device: Device,
+ response: ClaimResponse
+}
diff --git a/ui-ngx/src/app/shared/models/entity.models.ts b/ui-ngx/src/app/shared/models/entity.models.ts
index eb3fc2d387..502f470f20 100644
--- a/ui-ngx/src/app/shared/models/entity.models.ts
+++ b/ui-ngx/src/app/shared/models/entity.models.ts
@@ -53,3 +53,89 @@ export interface ImportEntitiesResultInfo {
entity: number;
};
}
+
+export interface EntityField {
+ keyName: string;
+ value: string;
+ name: string;
+ time?: boolean;
+}
+
+export const entityFields: {[fieldName: string]: EntityField} = {
+ createdTime: {
+ keyName: 'createdTime',
+ name: 'entity-field.created-time',
+ value: 'createdTime',
+ time: true
+ },
+ name: {
+ keyName: 'name',
+ name: 'entity-field.name',
+ value: 'name'
+ },
+ type: {
+ keyName: 'type',
+ name: 'entity-field.type',
+ value: 'type'
+ },
+ firstName: {
+ keyName: 'firstName',
+ name: 'entity-field.first-name',
+ value: 'firstName'
+ },
+ lastName: {
+ keyName: 'lastName',
+ name: 'entity-field.last-name',
+ value: 'lastName'
+ },
+ email: {
+ keyName: 'email',
+ name: 'entity-field.email',
+ value: 'email'
+ },
+ title: {
+ keyName: 'title',
+ name: 'entity-field.title',
+ value: 'title'
+ },
+ country: {
+ keyName: 'country',
+ name: 'entity-field.country',
+ value: 'country'
+ },
+ state: {
+ keyName: 'state',
+ name: 'entity-field.state',
+ value: 'state'
+ },
+ city: {
+ keyName: 'city',
+ name: 'entity-field.city',
+ value: 'city'
+ },
+ address: {
+ keyName: 'address',
+ name: 'entity-field.address',
+ value: 'address'
+ },
+ address2: {
+ keyName: 'address2',
+ name: 'entity-field.address2',
+ value: 'address2'
+ },
+ zip: {
+ keyName: 'zip',
+ name: 'entity-field.zip',
+ value: 'zip'
+ },
+ phone: {
+ keyName: 'phone',
+ name: 'entity-field.phone',
+ value: 'phone'
+ },
+ label: {
+ keyName: 'label',
+ name: 'entity-field.label',
+ value: 'label'
+ }
+};
diff --git a/ui-ngx/src/app/shared/models/relation.models.ts b/ui-ngx/src/app/shared/models/relation.models.ts
index 26a34f2f46..0cb4f20ca9 100644
--- a/ui-ngx/src/app/shared/models/relation.models.ts
+++ b/ui-ngx/src/app/shared/models/relation.models.ts
@@ -64,6 +64,7 @@ export interface RelationsSearchParameters {
direction: EntitySearchDirection;
relationTypeGroup?: RelationTypeGroup;
maxLevel?: number;
+ fetchLastLevelOnly?: boolean;
}
export interface EntityRelationsQuery {
diff --git a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
index 8be79c8ed1..d98a02e471 100644
--- a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
+++ b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts
@@ -26,7 +26,8 @@ export enum DataKeyType {
timeseries = 'timeseries',
attribute = 'attribute',
function = 'function',
- alarm = 'alarm'
+ alarm = 'alarm',
+ entityField = 'entityField'
}
export enum LatestTelemetry {