From e6b156df63a8ed23c96ea851a0ab6a277d2dc14e Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Wed, 13 Jan 2021 15:34:00 +0200 Subject: [PATCH 01/14] Hide edge management for customers if Edge is disabled --- .../pages/customer/customer.component.html | 3 +- .../home/pages/customer/customer.component.ts | 6 +++ .../customers-table-config.resolver.ts | 37 +++++++++++-------- .../assets/locale/locale.constant-en_US.json | 3 +- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/customer/customer.component.html b/ui-ngx/src/app/modules/home/pages/customer/customer.component.html index 750be237c3..0dda6645cf 100644 --- a/ui-ngx/src/app/modules/home/pages/customer/customer.component.html +++ b/ui-ngx/src/app/modules/home/pages/customer/customer.component.html @@ -43,7 +43,8 @@ @@ -85,7 +85,7 @@ ngxClipboard (cbOnSuccess)="onEdgeInfoCopied('key')" [cbContent]="entity?.routingKey" - [fxShow]="!isEdit && edgeScope === 'tenant'"> + [fxShow]="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer')"> edge.copy-edge-key @@ -93,7 +93,7 @@ ngxClipboard (cbOnSuccess)="onEdgeInfoCopied('secret')" [cbContent]="entity?.secret" - [fxShow]="!isEdit && edgeScope === 'tenant'"> + [fxShow]="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer')"> edge.copy-edge-secret @@ -101,7 +101,7 @@ ngxClipboard [disabled]="(isLoading$ | async)" (click)="onEntityAction($event, 'syncEdge')" - [fxShow]="!isEdit && edgeScope === 'tenant'"> + [fxShow]="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer')"> edge.sync @@ -111,12 +111,12 @@ - edge.assigned-to-customer + edge.assignedToCustomer
- {{ 'edge.public' | translate }} + [fxShow]="!isEdit && entity?.customerIsPublic && edgeScope === 'tenant'"> + {{ 'edge.edge-public' | translate }}
@@ -132,7 +132,7 @@ [required]="true" [entityType]="entityType.EDGE"> -
+
edge.edge-license-key @@ -142,7 +142,7 @@
-
+
edge.cloud-endpoint-hint
edge.cloud-endpoint @@ -153,7 +153,7 @@
-
+
edge.edge-key @@ -164,7 +164,7 @@
-
+
edge.edge-secret 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 c3c45fcc5a..b0c10b4905 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1234,6 +1234,8 @@ "assign-to-customer-text": "Please select the customer to assign the edge(s)", "assign-edge-to-customer": "Assign Edge(s) To Customer", "assign-edge-to-customer-text": "Please select the edges to assign to the customer", + "assignedToCustomer": "Assigned to customer", + "edge-public": "Edge is public", "assigned-to-customer": "Assigned to: {{customerTitle}}", "unassign-from-customer": "Unassign from customer", "assign-edges-text": "Assign { count, plural, 1 {1 edge} other {# edges} } to customer", From 226f7f4ebad6e2f1593ca962dabb15c08e8534cd Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Wed, 13 Jan 2021 16:26:16 +0200 Subject: [PATCH 03/14] Move ruleChainType assignment from validateImportedRuleChain() to importRuleChain() --- .../home/components/import-export/import-export.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts b/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts index c55027d10c..e850215928 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts @@ -406,6 +406,9 @@ export class ImportExportService { public importRuleChain(expectedRuleChainType: RuleChainType): Observable { return this.openImportDialog('rulechain.import', 'rulechain.rulechain-file').pipe( mergeMap((ruleChainImport: RuleChainImport) => { + if (isUndefined(ruleChainImport.ruleChain.type)) { + ruleChainImport.ruleChain.type = ruleChainType.core; + } if (!this.validateImportedRuleChain(ruleChainImport)) { this.store.dispatch(new ActionNotificationShow( {message: this.translate.instant('rulechain.invalid-rulechain-file-error'), @@ -469,9 +472,6 @@ export class ImportExportService { || isUndefined(ruleChainImport.ruleChain.name)) { return false; } - if (isUndefined(ruleChainImport.ruleChain.type)) { - ruleChainImport.ruleChain.type = ruleChainType.core; - } return true; } From f8e80aa94b604e8b55c4dad7477e57ec27730332 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Wed, 13 Jan 2021 20:43:11 +0200 Subject: [PATCH 04/14] Fix import edges, update() is not working --- ui-ngx/src/app/core/http/edge.service.ts | 4 ++++ ui-ngx/src/app/core/http/entity.service.ts | 16 ++++++++++++++++ .../import-dialog-csv.component.ts | 18 +++++++++++++++++- .../import-export/import-export.models.ts | 10 +++++++++- .../table-columns-assignment.component.ts | 8 ++++++++ .../home/dialogs/home-dialogs.service.ts | 2 ++ ui-ngx/src/app/shared/models/entity.models.ts | 4 ++++ 7 files changed, 60 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/core/http/edge.service.ts b/ui-ngx/src/app/core/http/edge.service.ts index 9c87f449fc..55313babde 100644 --- a/ui-ngx/src/app/core/http/edge.service.ts +++ b/ui-ngx/src/app/core/http/edge.service.ts @@ -104,4 +104,8 @@ export class EdgeService { public findMissingToRelatedRuleChains(edgeId: string, config?: RequestConfig): Observable { return this.http.get(`/api/edge/missingToRelatedRuleChains/${edgeId}`, defaultHttpOptionsFromConfig(config)); } + + public findByName(edgeName: string, config?: RequestConfig): Observable { + return this.http.get(`/api/tenant/edges?edgeName=${edgeName}`, defaultHttpOptionsFromConfig(config)); + } } diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index c9832b4cc3..cf760b95b8 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -70,6 +70,7 @@ import { import { alarmFields } from '@shared/models/alarm.models'; import { EdgeService } from "@core/http/edge.service"; import { ruleChainType } from "@shared/models/rule-chain.models"; +import { Edge } from '@shared/models/edge.models'; @Injectable({ providedIn: 'root' @@ -888,6 +889,21 @@ export class EntityService { }; saveEntityObservable = this.assetService.saveAsset(asset, config); break; + case EntityType.EDGE: + const edge: Edge = { + name: entityData.name, + type: entityData.type, + label: entityData.label, + additionalInfo: { + description: entityData.description + }, + edgeLicenseKey: entityData.edgeLicenseKey, + cloudEndpoint: entityData.cloudEndpoint, + routingKey: entityData.routingKey, + secret: entityData.secret + } + saveEntityObservable = this.edgeService.saveEdge(edge, config); + break; } return saveEntityObservable.pipe( mergeMap((entity) => { diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index 7897d24feb..a3c913357d 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -203,7 +203,11 @@ export class ImportDialogCsvComponent extends DialogComponent Date: Wed, 13 Jan 2021 21:08:29 +0200 Subject: [PATCH 05/14] Get edge label --- .../main/java/org/thingsboard/server/common/data/edge/Edge.java | 1 + 1 file changed, 1 insertion(+) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java b/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java index 67319740ca..44025ad18a 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java @@ -62,6 +62,7 @@ public class Edge extends SearchTextBasedWithAdditionalInfo implements H this.customerId = edge.getCustomerId(); this.rootRuleChainId = edge.getRootRuleChainId(); this.type = edge.getType(); + this.label = edge.getLabel(); this.name = edge.getName(); this.routingKey = edge.getRoutingKey(); this.secret = edge.getSecret(); From 9b27bb2d7ca659eeec0687e38afccd2a6c3a150e Mon Sep 17 00:00:00 2001 From: deaflynx Date: Thu, 14 Jan 2021 14:23:00 +0200 Subject: [PATCH 06/14] Import edges with update --- ui-ngx/src/app/core/http/entity.service.ts | 92 ++++++++++++++----- .../import-dialog-csv.component.ts | 8 +- .../table-columns-assignment.component.ts | 20 ++++ 3 files changed, 94 insertions(+), 26 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index cf760b95b8..1b0891c450 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Injectable } from '@angular/core'; +import { Inject, Injectable } from '@angular/core'; import { EMPTY, forkJoin, Observable, of, throwError } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { PageLink } from '@shared/models/page/page-link'; @@ -46,7 +46,7 @@ import { UtilsService } from '@core/services/utils.service'; import { AliasFilterType, EntityAlias, EntityAliasFilter, EntityAliasFilterResult } from '@shared/models/alias.models'; import { entityFields, EntityInfo, ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entity.models'; import { EntityRelationService } from '@core/http/entity-relation.service'; -import { deepClone, isDefined, isDefinedAndNotNull } from '@core/utils'; +import { deepClone, generateSecret, guid, isDefined, isDefinedAndNotNull } from '@core/utils'; import { Asset } from '@shared/models/asset.models'; import { Device, DeviceCredentialsType } from '@shared/models/device.models'; import { AttributeService } from '@core/http/attribute.service'; @@ -71,6 +71,7 @@ import { alarmFields } from '@shared/models/alarm.models'; import { EdgeService } from "@core/http/edge.service"; import { ruleChainType } from "@shared/models/rule-chain.models"; import { Edge } from '@shared/models/edge.models'; +import { WINDOW } from "@core/services/window.service"; @Injectable({ providedIn: 'root' @@ -91,7 +92,8 @@ export class EntityService { private dashboardService: DashboardService, private entityRelationService: EntityRelationService, private attributeService: AttributeService, - private utils: UtilsService + private utils: UtilsService, + @Inject(WINDOW) protected window: Window ) { } private getEntityObservable(entityType: EntityType, entityId: string, @@ -901,6 +903,15 @@ export class EntityService { cloudEndpoint: entityData.cloudEndpoint, routingKey: entityData.routingKey, secret: entityData.secret + }; + if (edge.cloudEndpoint === '') { + edge.cloudEndpoint = this.window.location.origin; + } + if (edge.routingKey === '') { + edge.routingKey = guid(); + } + if (edge.secret === '') { + edge.secret = generateSecret(20); } saveEntityObservable = this.edgeService.saveEdge(edge, config); break; @@ -924,30 +935,67 @@ export class EntityService { case EntityType.ASSET: findEntityObservable = this.assetService.findByName(entityData.name, config); break; + case EntityType.EDGE: + findEntityObservable = this.edgeService.findByName(entityData.name, config); + break; } return findEntityObservable.pipe( mergeMap((entity) => { const tasks: Observable[] = []; - const result: Device | Asset = entity as (Device | Asset); - const additionalInfo = result.additionalInfo || {}; - if (result.label !== entityData.label || - result.type !== entityData.type || - additionalInfo.description !== entityData.description || - (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { - result.label = entityData.label; - result.type = entityData.type; - result.additionalInfo = additionalInfo; - result.additionalInfo.description = entityData.description; - if (result.id.entityType === EntityType.DEVICE) { - result.additionalInfo.gateway = entityData.gateway; + if (entity.id.entityType === EntityType.EDGE) { + const result: Edge = entity as Edge; + const additionalInfo = result.additionalInfo || {}; + if (result.label !== entityData.label || + result.type !== entityData.type || + result.cloudEndpoint !== entityData.cloudEndpoint || + result.edgeLicenseKey !== entityData.edgeLicenseKey || + result.routingKey !== entityData.routingKey || + result.secret !== entityData.secret || + additionalInfo.description !== entityData.description) { + result.type = entityData.type; + if (entityData.label !== '') { + result.label = entityData.label; + } + if (entityData.description !== '') { + result.additionalInfo = additionalInfo; + result.additionalInfo.description = entityData.description; + } + if (entityData.cloudEndpoint !== '') { + result.cloudEndpoint = entityData.cloudEndpoint; + } + if (entityData.edgeLicenseKey !== '') { + result.edgeLicenseKey = entityData.edgeLicenseKey; + } + if (entityData.routingKey !== '') { + result.routingKey = entityData.routingKey; + } + if (entityData.cloudEndpoint !== '') { + result.secret = entityData.secret; + } + tasks.push(this.edgeService.saveEdge(result, config)); } - switch (result.id.entityType) { - case EntityType.DEVICE: - tasks.push(this.deviceService.saveDevice(result, config)); - break; - case EntityType.ASSET: - tasks.push(this.assetService.saveAsset(result, config)); - break; + } else { + const result: Device | Asset = entity as (Device | Asset); + const additionalInfo = result.additionalInfo || {}; + if (result.label !== entityData.label || + result.type !== entityData.type || + additionalInfo.description !== entityData.description || + (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { + result.label = entityData.label; + result.type = entityData.type; + result.additionalInfo = additionalInfo; + result.additionalInfo.description = entityData.description; + if (result.id.entityType === EntityType.DEVICE) { + result.additionalInfo.gateway = entityData.gateway; + } + switch (result.id.entityType) { + case EntityType.DEVICE: + tasks.push(this.deviceService.saveDevice(result, config)); + break; + case EntityType.ASSET: + tasks.push(this.assetService.saveAsset(result, config)); + break; + } } } tasks.push(this.saveEntityData(entity.id, entityData, config)); diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index a3c913357d..8473b9a3af 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -248,16 +248,16 @@ export class ImportDialogCsvComponent extends DialogComponent column.type === ImportEntityColumnType.accessToken) > -1; const isSelectGateway = this.columns.findIndex((column) => column.type === ImportEntityColumnType.isGateway) > -1; const isSelectDescription = this.columns.findIndex((column) => column.type === ImportEntityColumnType.description) > -1; + const isSelectEdgeLicenseKey = this.columns.findIndex((column) => column.type === ImportEntityColumnType.edgeLicenseKey) > -1; + const isSelectCloudEndpoint = this.columns.findIndex((column) => column.type === ImportEntityColumnType.cloudEndpoint) > -1; + const isSelectRoutingKey = this.columns.findIndex((column) => column.type === ImportEntityColumnType.routingKey) > -1; + const isSelectSecret = this.columns.findIndex((column) => column.type === ImportEntityColumnType.secret) > -1; const hasInvalidColumn = this.columns.findIndex((column) => !this.columnValid(column)) > -1; this.valid = isSelectName && isSelectType && !hasInvalidColumn; @@ -143,6 +147,22 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce if (accessTokenColumnType) { accessTokenColumnType.disabled = isSelectCredentials; } + const edgeLicenseKeyColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.edgeLicenseKey); + if (edgeLicenseKeyColumnType) { + edgeLicenseKeyColumnType.disabled = isSelectEdgeLicenseKey; + } + const cloudEndpointColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.cloudEndpoint); + if (cloudEndpointColumnType) { + cloudEndpointColumnType.disabled = isSelectCloudEndpoint; + } + const routingKeyColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.routingKey); + if (routingKeyColumnType) { + routingKeyColumnType.disabled = isSelectRoutingKey; + } + const secretColumnType = this.columnTypes.find((columnType) => columnType.value === ImportEntityColumnType.secret); + if (secretColumnType) { + secretColumnType.disabled = isSelectSecret; + } if (this.propagateChange) { this.propagateChange(this.columns); } else { From 51bc0a2f17d099e699511465737cf22f5cc5c954 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Fri, 15 Jan 2021 05:29:42 +0200 Subject: [PATCH 07/14] US locale update --- .../home/components/edge/edge-downlink-table-config.ts | 4 ++-- ui-ngx/src/assets/locale/locale.constant-en_US.json | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-config.ts b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-config.ts index a972a19ddc..412776c033 100644 --- a/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/edge/edge-downlink-table-config.ts @@ -221,9 +221,9 @@ export class EdgeDownlinkTableConfig extends EntityTableConfig Date: Fri, 15 Jan 2021 06:02:34 +0200 Subject: [PATCH 08/14] ES,DE,FR locale update for Edge --- .../assets/locale/locale.constant-de_DE.json | 94 ++++++++++++++++--- .../assets/locale/locale.constant-es_ES.json | 92 +++++++++++++++--- .../assets/locale/locale.constant-fr_FR.json | 89 +++++++++++++++--- 3 files changed, 236 insertions(+), 39 deletions(-) diff --git a/ui-ngx/src/assets/locale/locale.constant-de_DE.json b/ui-ngx/src/assets/locale/locale.constant-de_DE.json index 541bf1469f..289bbaa0be 100644 --- a/ui-ngx/src/assets/locale/locale.constant-de_DE.json +++ b/ui-ngx/src/assets/locale/locale.constant-de_DE.json @@ -731,7 +731,6 @@ "no-edges-matching": "Keine passenden Rand '{{entity}}' gefunden.", "rulechain-templates": "Regelkettenvorlagen", "add": "Rand hinzufügen", - "view": "Rand anzeigen", "no-edges-text": "Kein Rand gefunden.", "edge-details": "Details der Rand", "add-edge-text": "Neue Rand hinzufügen", @@ -754,7 +753,6 @@ "id-copied-message": "Regelketten-ID wurde in die Zwischenablage kopiert", "sync": "Sync Edge", "sync-message": "Edge wurde synchronisiert", - "permissions": "Berechtigungen", "edge-required": "Rand ist erforderlich.", "edge-type": "Randtyp", "edge-type-required": "Randtyp ist erforderlich.", @@ -777,14 +775,12 @@ "make-private-edge-text": "Nach der Bestätigung werden der Rand und dessen Daten privat und sind für andere nicht mehr zugänglich.", "import": "Rand importieren", "label": "Bezeichnung", - "assign-to-edge": "Assign to edge", "assign-new-edge": "Neue Rand zuordnen", "manage-edge-dashboards": "Rand-Dashboards verwalten", "unassign-from-edge": "Rand zuweisen", "dashboards": "Rand Dashboards", "manage-edge-rulechains": "Randregelkette verwalten", "rulechains": "Rand Regelketten", - "rulechain": "Rand Regelkette", "edge-key": "Rand Schlüssel", "copy-edge-key": "Rand Schlüssel kopieren", "edge-key-copied-message": "Rand Schlüssel wurde in die Zwischenablage kopiert", @@ -797,18 +793,85 @@ "assets": "Rand Objekte", "devices": "Objekte Geräte", "entity-views": "Objekte Entitätsansichten", - "set-root-rulechain-text": "Bitte wählen Sie die Regelkette zur Wurzel rule chain für die Rand", - "set-root-rulechain-to-edges": "Regelkette zur Wurzel machen für die Rand", - "set-root-rulechain-to-edges-text": "Die Regelkette zur Wurzel für { count, plural, 1 {1 Rand} other {# Rand} } machen", - "status": "Von Rand empfangen", - "success": "Bereitgestellt", - "failed": "Steht aus", "entity-id": "Entität ID", - "entity-info": "Entitätsinfo", "event-action": "Ereignisaktion", "load-entity-error": "Entität nicht gefunden. Fehler beim Laden der Informationen", "unassign-edges-text": "Nach der Bestätigung werden alle ausgewählten Kanten nicht zugewiesen und sind für den Kunden nicht zugänglich.", - "unassign-edges-title": "Sind Sie sicher, dass Sie die Zuordnung aufheben möchten { count, plural, 1 {1 Rand} other {# Rand} }?" + "unassign-edges-title": "Sind Sie sicher, dass Sie die Zuordnung aufheben möchten { count, plural, 1 {1 Rand} other {# Rand} }?", + "edge-rulechains": "Kantenregelketten", + "edge-license-key-hint": "Um Ihre Lizenz zu erhalten, navigieren Sie zur Preisseite und wählen Sie die beste Lizenzoption für Ihre aus Fall.", + "assignedToCustomer": "Dem Kunden zugewiesen", + "edge-public": "Edge ist öffentlich", + "search": "Kanten durchsuchen", + "selected-edges": "{Anzahl, Plural, 1 {1 Kante} andere {# Kanten}} ausgewählt", + "any-edge": "Beliebige Kante", + "dashboard": "Kanten-Dashboard", + "sync-process-started-successfully": "Synchronisierungsprozess erfolgreich gestartet!", + "delete-edges-action-title": "Löschen { count, plural, 1 {1 Rand} other {# Rand} }", + "set-root-rule-chain-text": "Bitte wählen Sie die Regelkette zur Wurzel rule chain für die Rand", + "set-root-rule-chain-to-edges": "Regelkette zur Wurzel machen für die Rand", + "set-root-rule-chain-to-edges-text": "Die Regelkette zur Wurzel für { count, plural, 1 {1 Rand} other {# Rand} } machen", + "status": "Von Rand empfangen", + "deployed": "Bereitgestellt", + "pending": "Steht aus", + "edge-file": "Edge-Datei", + "name-starts-with": "Der Kantenname beginnt mit", + "rulechain-template": "Regelkettenvorlage", + "unassign-edges-action-title": "Heben Sie die Zuordnung von {count, plural, 1 {1 edge} other {# edge}} vom Kunden auf", + "enter-edge-type": "Geben Sie den Kantentyp ein", + "no-edge-types-matching": "Es wurden keine Kantentypen gefunden, die mit '{{entitySubtype}}' übereinstimmen.", + "edge-type-list-empty": "Keine Kantentypen ausgewählt.", + "edge-types": "Kantentypen", + "license-key-hint": "Um Ihre Lizenz zu erhalten, navigieren Sie zur Preisseite und wählen Sie die beste Lizenzoption für Ihre aus Fall.", + "cloud-endpoint-hint": "Edge erfordert HTTP-Zugriff auf die Cloud (ThingsBoard CE / PE), um den Lizenzschlüssel zu überprüfen. Bitte geben Sie die Cloud-URL an, zu der Edge eine Verbindung herstellen kann.", + "missing-related-rule-chains-title": "In Edge fehlen verwandte Regelketten.", + "missing-related-rule-chains-text": "Randregelkette (n) zugewiesen Verwenden Sie Regelknoten, die Nachrichten an Regelkette (n) weiterleiten, die dieser Kante nicht zugeordnet sind.

Liste der fehlenden Regelketten:
{{missingRuleChains}}", + "downlinks": "Downlinks", + "no-downlinks-prompt": "Keine Downlinks gefunden", + "assigned-to-customer-widget": "Zugewiesen an: {{customerTitle}}", + "widget-datasource-error": "Dieses Widget unterstützt nur EDGE-Entitätsdatenquellen" + }, + "edge-event": { + "type-dashboard": "Dashboard", + "type-asset": "Asset", + "type-device": "Device", + "type-device-profile": "Device Profile", + "type-entity-view": "Entity View", + "type-alarm": "Alarm", + "type-rule-chain": "Rule Chain", + "type-rule-chain-metadata": "Rule Chain Metadata", + "type-edge": "Edge", + "type-entity-group": "Entity Group", + "type-scheduler-event": "Scheduler Event", + "type-white-labeling": "White Labeling", + "type-login-white-labeling": "White Labeling Login", + "type-user": "User", + "type-tenant": "Tenant", + "type-customer": "Customer", + "type-custom-translation": "Custom Translation", + "type-relation": "Relation", + "type-widgets-bundle": "Widgets Bundle", + "type-widgets-type": "Widgets Type", + "type-admin-settings": "Admin Settings", + "action-type-added": "Added", + "action-type-deleted": "Deleted", + "action-type-updated": "Updated", + "action-type-post-attributes": "Post Attributes", + "action-type-attributes-updated": "Attributes Updated", + "action-type-attributes-deleted": "Attributes Deleted", + "action-type-timeseries-updated": "Timeseries Updated", + "action-type-credentials-updated": "Credentials Updated", + "action-type-assigned-to-customer": "Assigned to Customer", + "action-type-unassigned-from-customer": "Unassigned from Customer", + "action-type-relation-add-or-update": "Relation Add or Update", + "action-type-relation-deleted": "Relation Deleted", + "action-type-rpc-call": "RPC Call", + "action-type-alarm-ack": "Alarm Ack", + "action-type-alarm-clear": "Alarm Clear", + "action-type-assigned-to-edge": "Assigned to Edge", + "action-type-unassigned-from-edge": "Unassigned from Edge", + "action-type-credentials-request": "Credentials Request", + "action-type-entity-merge-request": "Entity Merge Request" }, "error": { "unable-to-connect": "Es konnte keine Verbindung zum Server hergestellt werden! Bitte überprüfen Sie Ihre Internetverbindung.", @@ -1405,7 +1468,12 @@ "unset-auto-assign-to-edge": "Deaktiviert die Zuordnung der Regelkette zu Kanten bei der Erstellung", "unset-auto-assign-to-edge-title": "Möchten Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung unbedingt den Kanten zuweisen?", "unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen.", - "edge-template-root": "Vorlagenstamm" + "edge-template-root": "Vorlagenstamm", + "search": "Suchen Sie nach Regelketten", + "selected-rulechains": "{count, plural, 1 {1 Regelkette} andere {# Regelketten}} ausgewählt", + "open-rulechain": "Regelkette öffnen", + "assign-to-edge": "Rand zuweisen", + "edge-rulechain": "Kantenregelkette" }, "rulenode": { "details": "Details", diff --git a/ui-ngx/src/assets/locale/locale.constant-es_ES.json b/ui-ngx/src/assets/locale/locale.constant-es_ES.json index 125e6cf4b1..f56cd60989 100644 --- a/ui-ngx/src/assets/locale/locale.constant-es_ES.json +++ b/ui-ngx/src/assets/locale/locale.constant-es_ES.json @@ -753,7 +753,6 @@ "no-edges-matching": "No se encontraron bordes que coincidan con '{{entity}}'", "rulechain-templates": "Plantillas, de cadena de reglas", "add": "Agregar borde", - "view": "Ver borde", "no-edges-text": "No se encontraron bordes", "edge-details": "Detalles del borde", "add-edge-text": "Agregar nuevo borde", @@ -776,12 +775,10 @@ "id-copied-message": "El ID de borde se ha copiado al portapapeles", "sync": "Sinc Edge", "sync-message": "Edge se ha sincronizado", - "permissions": "Permisos", "edge-required": "Edge required", "edge-type": "Type de la bordure", "edge-type-required": "El tipo de borde es requerido.", "select-edge-type": "Seleccionar tipo de borde", - "assign-to-edge": "Asignar al borde", "assign-to-customer": "Asignar al cliente", "assign-to-customer-text": "Seleccione el cliente para asignar los bordes", "assign-edge-to-customer": "Asignar borde(s) al cliente", @@ -806,7 +803,6 @@ "dashboards": "Paneles de borde", "manage-edge-rulechains": "Administrar cadenas de reglas de borde", "rulechains": "Cadenas de regla de borde", - "rulechain": "Cadena de regla de borde", "edge-key": "Clave de borde", "copy-edge-key": "Copiar clave de borde", "edge-key-copied-message": "La clave de borde se ha copiado al portapapeles", @@ -819,18 +815,83 @@ "assets": "Activos de borde", "devices": "Dispositivos de borde", "entity-views": "Vistas de entidad de borde", - "set-root-rulechain-text": "Seleccione la cadena de reglas raíz para los bordes", - "set-root-rulechain-to-edges": "Establecer la cadena de reglas raíz para Edge (s)", - "set-root-rulechain-to-edges-text": "Establecer la cadena de la regla raíz para {count, plural, 1 {1 borde} other {# bordes}}", - "status": "Recibido por borde", - "success": "Desplegada", - "failed": "Pendiente", "entity-id": "ID de entidad", - "entity-info": "Entity info", "event-action": "Información de la entidad", "load-entity-error": "Entidad no encontrada. No se pudo cargar la información", "unassign-edges-text": "Después de la confirmación de todos los bordes seleccionados, se anulará la asignación y el cliente no podrá acceder a ellos.", - "unassign-edges-title": "¿Está seguro de que desea anular la asignación de {count, plural, 1 {1 borde} other {# bordes}}?" + "unassign-edges-title": "¿Está seguro de que desea anular la asignación de {count, plural, 1 {1 borde} other {# bordes}}?", + "edge-rulechains": "Cadenas de reglas de borde", + "edge-license-key-hint": "Para obtener su licencia, vaya a la página de precios y seleccione la mejor opción de licencia para su caso.", + "assignedToCustomer": "Asignada a la cliente", + "edge-public": "Edge es pública", + "set-root-rule-chain-text": "Seleccione la cadena de reglas raíz para los bordes", + "set-root-rule-chain-to-edges": "Establecer cadena de reglas raíz para Edge (s)", + "set-root-rule-chain-to-edges-text": "Establecer cadena de reglas raíz para {count, plural, 1 {1 edge} other {# ends}}", + "search": "Bordes de búsqueda", + "selected-edges": "{count, plural, 1 {1 borde} other {# bordes}} seleccionados", + "any-edge": "Cualquier bordee", + "dashboard": "Panel de control Edge", + "deployed": "Desplegada", + "pending": "Pending", + "sync-process-started-successfully": "¡El proceso de sincronización se inició correctamente!", + "edge-file": "Archivo de borde", + "name-starts-with": "Edge name starts with", + "rulechain-template": "Plantilla de cadena de reglas", + "unassign-edges-action-title": "Anular la asignación de {count, plural, 1 {1 borde} other {# bordes}} del cliente", + "enter-edge-type": "Ingrese el tipo de borde", + "no-edge-types-matching": "No se encontraron tipos de aristas que coincidan con '{{entitySubtype}}'.", + "edge-type-list-empty": "No se seleccionó ningún tipo de borde.", + "edge-types": "Tipos de bordes", + "license-key-hint": "Para obtener su licencia, vaya a la página de precios y seleccione la mejor opción de licencia para su caso.", + "cloud-endpoint-hint": "Edge requiere acceso HTTP (s) a la nube (ThingsBoard CE / PE) para verificar la clave de licencia. Especifique la URL de la nube a la que Edge puede conectarse.", + "missing-related-rule-chains-title": "Al borde le faltan cadenas de reglas relacionadas", + "missing-related-rule-chains-text": "Asignado a la (s) cadena (s) de reglas de borde usa nodos de reglas que reenvían mensajes a cadenas de reglas que no están asignadas a este borde.

Lista de cadenas de reglas faltantes:
{{missingRuleChains}}", + "downlinks": "Enlaces descendentes", + "no-downlinks-prompt": "No se encontraron enlaces descendentes", + "assigned-to-customer-widget": "Asignado a: {{customerTitle}}", + "widget-datasource-error": "Este widget solo admite la fuente de datos de la entidad EDGE" + }, + "edge-event": { + "type-dashboard": "Dashboard", + "type-asset": "Asset", + "type-device": "Device", + "type-device-profile": "Device Profile", + "type-entity-view": "Entity View", + "type-alarm": "Alarm", + "type-rule-chain": "Rule Chain", + "type-rule-chain-metadata": "Rule Chain Metadata", + "type-edge": "Edge", + "type-entity-group": "Entity Group", + "type-scheduler-event": "Scheduler Event", + "type-white-labeling": "White Labeling", + "type-login-white-labeling": "White Labeling Login", + "type-user": "User", + "type-tenant": "Tenant", + "type-customer": "Customer", + "type-custom-translation": "Custom Translation", + "type-relation": "Relation", + "type-widgets-bundle": "Widgets Bundle", + "type-widgets-type": "Widgets Type", + "type-admin-settings": "Admin Settings", + "action-type-added": "Added", + "action-type-deleted": "Deleted", + "action-type-updated": "Updated", + "action-type-post-attributes": "Post Attributes", + "action-type-attributes-updated": "Attributes Updated", + "action-type-attributes-deleted": "Attributes Deleted", + "action-type-timeseries-updated": "Timeseries Updated", + "action-type-credentials-updated": "Credentials Updated", + "action-type-assigned-to-customer": "Assigned to Customer", + "action-type-unassigned-from-customer": "Unassigned from Customer", + "action-type-relation-add-or-update": "Relation Add or Update", + "action-type-relation-deleted": "Relation Deleted", + "action-type-rpc-call": "RPC Call", + "action-type-alarm-ack": "Alarm Ack", + "action-type-alarm-clear": "Alarm Clear", + "action-type-assigned-to-edge": "Assigned to Edge", + "action-type-unassigned-from-edge": "Unassigned from Edge", + "action-type-credentials-request": "Credentials Request", + "action-type-entity-merge-request": "Entity Merge Request" }, "error": { "unable-to-connect": "Imposible conectar con el servidor! Por favor, revise su conexión a internet.", @@ -1576,7 +1637,12 @@ "unset-auto-assign-to-edge": "Desmarcar asignar cadena de reglas a los bordes en la creación", "unset-auto-assign-to-edge-title": "¿Está seguro de que desea anular la asignación de la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?", "unset-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde ya no se asignará automáticamente a los bordes en la creación.", - "edge-template-root": "Raíz de plantilla" + "edge-template-root": "Raíz de plantilla", + "search": "Cadenas de reglas de búsqueda", + "selected-rulechains": "{count, plural, 1 {1 cadena de reglas} otras {# cadenas de reglas}} seleccionadas", + "open-rulechain": "Cadena de reglas abierta", + "assign-to-edge": "Asignar a Edge", + "edge-rulechain": "Cadena de regla de borde" }, "rulenode": { "details": "Detalles", diff --git a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json index b16ffe3268..074042d65b 100644 --- a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json +++ b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json @@ -749,7 +749,6 @@ "no-edges-matching": "Aucun bordure correspondant à {{entity}} n'a été trouvé.", "rulechain-templates": "Modèles de chaîne de règles", "add": "Ajouter un bordure", - "view": "Afficher la bordure", "no-edges-text": "Aucun bordure trouvé", "edge-details": "Détails de la bordure", "add-edge-text": "Ajouter une nouveau bordure", @@ -772,12 +771,10 @@ "id-copied-message": "Id de la bordure a été copié dans le presse-papier", "sync": "Sync Edge", "sync-message": "Edge a été synchronisé", - "permissions": "Autorisations", "edge-required": "Bordure est requise", "edge-type": "Type de la bordure", "edge-type-required": "Type de la bordure est requise.", "select-edge-type": "Selectionner un type de la bordure", - "assign-to-edge": "Attribuer au bord", "assign-to-customer": "Attribuer au client", "assign-to-customer-text": "Veuillez sélectionner la bordure pour attribuer le ou les dispositifs", "assign-edge-to-customer": "Attribuer la bordure au client", @@ -802,7 +799,6 @@ "dashboards": "Tableau de bord de la bordure", "manage-edge-rulechains": "Gérer les chaînes de règles", "rulechains": "Chaînes de règles de la bordure", - "rulechain": "Chaîne de règles de la bordure", "edge-key": "Clé de la bordure", "copy-edge-key": "Copier clé de la bordure", "edge-key-copied-message": "Clé de la bordure a été copié dans le presse-papier", @@ -815,18 +811,79 @@ "assets": "Actifs de la bordure", "devices": "Dispositifs de la bordure", "entity-views": "Vues de l'entité bordure", - "set-root-rulechain-text": "Veuillez sélectionner la chaîne de règles racine pour les bordure(s)", - "set-rootrule-chain-to-edges": "Définir la chaîne de règles racine pour bordure(s)", - "set-root-rulechain-to-edges-text": "Définir la chaîne de règles racine pour {count, plural, 1 {1 bordure} other {# bordures} }", - "status": "Reçu par bord", - "success": "Déployée", - "failed": "En attente", "entity-id": "ID d'entité", - "entity-info": "Informations sur l'entité", "event-action": "Action d'événement", "load-entity-error": "Entité introuvable. Échec du chargement des informations", "unassign-edges-text": "Après la confirmation, tous les bordures sélectionnés ne seront plus attribués et ne seront pas accessibles par le client.", - "unassign-edges-title": "Voulez-vous vraiment annuler l'attribution de {count, plural, 1 {1 bordure} other {# bordures}}?" + "unassign-edges-title": "Voulez-vous vraiment annuler l'attribution de {count, plural, 1 {1 bordure} other {# bordures}}?", + "edge-file": "Fichier Edge", + "edge-rulechains": "Chaînes de règles Edge", + "name-starts-with": "Le nom du bord commence par", + "edge-license-key-hint": "Pour obtenir votre licence, accédez à la page de tarification and select the best license option for your case.", + "cloud-endpoint-hint": "Edge nécessite un accès HTTP (s) au Cloud (ThingsBoard CE / PE) pour vérifier la clé de licence. Veuillez spécifier l'URL du cloud à laquelle Edge peut se connecter.", + "assignedToCustomer": "Attribué au client", + "edge-public": "Edge est public", + "set-root-rule-chain-text": "Veuillez sélectionner la chaîne de règles racine pour les arêtes", + "set-root-rule-chain-to-edges": "Définir la chaîne de règles racine pour Edge (s)", + "set-root-rule-chain-to-edges-text": "Définir la chaîne de règles racine pour {count, plural, 1 {1 edge} other {# edges}}", + "search": "Rechercher les bords", + "selected-edges": "{count, plural, 1 {1 edge} other {# bords}} sélectionné", + "any-edge": "Tout bord", + "no-edge-types-matching": "Aucun type d'arête correspondant à \"{{entitySubtype}}\" n'a été trouvé.", + "edge-type-list-empty": "Aucun type d'arête sélectionné.", + "edge-types": "Types de bords", + "dashboard": "Tableau de bord Edge", + "enter-edge-type": "Entrez le type d'arête", + "deployed": "Déployé", + "pending": "En attente", + "downlinks": "Liens descendants", + "no-downlinks-prompt": "Aucun lien descendant trouvé", + "sync-process-started-successfully": "Le processus de synchronisation a démarré avec succès!", + "missing-related-rule-chains-title": "Edge n'a pas de chaîne (s) de règles associées", + "missing-related-rule-chains-text": "Les chaînes de règles affectées aux tronçons utilisent des nœuds de règles qui transfèrent les messages vers les chaînes de règles non affectées à ce tronçon.

Liste des chaînes de règles manquantes:
{{missingRuleChains}}", + "widget-datasource-error": "Ce widget prend en charge uniquement la source de données d'entité EDGE" + }, + "edge-event": { + "type-dashboard": "Dashboard", + "type-asset": "Asset", + "type-device": "Device", + "type-device-profile": "Device Profile", + "type-entity-view": "Entity View", + "type-alarm": "Alarm", + "type-rule-chain": "Rule Chain", + "type-rule-chain-metadata": "Rule Chain Metadata", + "type-edge": "Edge", + "type-entity-group": "Entity Group", + "type-scheduler-event": "Scheduler Event", + "type-white-labeling": "White Labeling", + "type-login-white-labeling": "White Labeling Login", + "type-user": "User", + "type-tenant": "Tenant", + "type-customer": "Customer", + "type-custom-translation": "Custom Translation", + "type-relation": "Relation", + "type-widgets-bundle": "Widgets Bundle", + "type-widgets-type": "Widgets Type", + "type-admin-settings": "Admin Settings", + "action-type-added": "Added", + "action-type-deleted": "Deleted", + "action-type-updated": "Updated", + "action-type-post-attributes": "Post Attributes", + "action-type-attributes-updated": "Attributes Updated", + "action-type-attributes-deleted": "Attributes Deleted", + "action-type-timeseries-updated": "Timeseries Updated", + "action-type-credentials-updated": "Credentials Updated", + "action-type-assigned-to-customer": "Assigned to Customer", + "action-type-unassigned-from-customer": "Unassigned from Customer", + "action-type-relation-add-or-update": "Relation Add or Update", + "action-type-relation-deleted": "Relation Deleted", + "action-type-rpc-call": "RPC Call", + "action-type-alarm-ack": "Alarm Ack", + "action-type-alarm-clear": "Alarm Clear", + "action-type-assigned-to-edge": "Assigned to Edge", + "action-type-unassigned-from-edge": "Unassigned from Edge", + "action-type-credentials-request": "Credentials Request", + "action-type-entity-merge-request": "Entity Merge Request" }, "entity": { "add-alias": "Ajouter un alias d'entité", @@ -1450,7 +1507,13 @@ "unset-auto-assign-to-edge": "Non défini, attribuer une chaîne de règles aux arêtes lors de la création", "unset-auto-assign-to-edge-title": "Voulez-vous vraiment annuler l'attribution de la chaîne de règles d'arête \"{{ruleChainName}}\" aux arêtes lors de la création?", "unset-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes ne sera plus automatiquement affectée aux arêtes lors de la création.", - "edge-template-root": "Racine du modèle" + "edge-template-root": "Racine du modèle", + "search": "Rechercher des chaînes de règles", + "selected-rulechains": "{count, plural, 1 {1 rule chain} other {# rule chains}} sélectionné", + "open-rulechain": "Chaîne de règles ouverte", + "assign-to-edge": "Attribuer à Edge", + "edge-rulechain": "Chaîne de règles Edge", + "unassign-rulechains-from-edge-title": "Voulez-vous vraiment annuler l'attribution de {count, plural, 1 {1 rulechain} other {# rulechains}}?" }, "rulenode": { "add": "Ajouter un noeud de règle", From 57bf6c09036ecd5e190165ed3734c9198459b015 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 15 Jan 2021 17:56:41 +0200 Subject: [PATCH 09/14] Code review updates --- ui-ngx/src/app/core/http/entity.service.ts | 193 ++++++++++-------- .../import-dialog-csv.component.ts | 56 +++-- .../import-export/import-export.models.ts | 6 +- .../import-export/import-export.service.ts | 16 +- .../home/pages/customer/customer.component.ts | 7 +- ui-ngx/src/app/shared/models/entity.models.ts | 3 + .../assets/locale/locale.constant-en_US.json | 6 +- 7 files changed, 167 insertions(+), 120 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index cf70871a62..1eb379aa33 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -44,7 +44,13 @@ import { AliasInfo, StateParams, SubscriptionInfo } from '@core/api/widget-api.m import { Datasource, DatasourceType, KeyInfo } from '@app/shared/models/widget.models'; import { UtilsService } from '@core/services/utils.service'; import { AliasFilterType, EntityAlias, EntityAliasFilter, EntityAliasFilterResult } from '@shared/models/alias.models'; -import { entityFields, EntityInfo, ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entity.models'; +import { + EdgeImportEntityData, + entityFields, + EntityInfo, + ImportEntitiesResultInfo, + ImportEntityData +} from '@shared/models/entity.models'; import { EntityRelationService } from '@core/http/entity-relation.service'; import { deepClone, generateSecret, guid, isDefined, isDefinedAndNotNull } from '@core/utils'; import { Asset } from '@shared/models/asset.models'; @@ -891,30 +897,6 @@ export class EntityService { }; saveEntityObservable = this.assetService.saveAsset(asset, config); break; - case EntityType.EDGE: - const edge: Edge = { - name: entityData.name, - type: entityData.type, - label: entityData.label, - additionalInfo: { - description: entityData.description - }, - edgeLicenseKey: entityData.edgeLicenseKey, - cloudEndpoint: entityData.cloudEndpoint, - routingKey: entityData.routingKey, - secret: entityData.secret - }; - if (edge.cloudEndpoint === '') { - edge.cloudEndpoint = this.window.location.origin; - } - if (edge.routingKey === '') { - edge.routingKey = guid(); - } - if (edge.secret === '') { - edge.secret = generateSecret(20); - } - saveEntityObservable = this.edgeService.saveEdge(edge, config); - break; } return saveEntityObservable.pipe( mergeMap((entity) => { @@ -935,67 +917,30 @@ export class EntityService { case EntityType.ASSET: findEntityObservable = this.assetService.findByName(entityData.name, config); break; - case EntityType.EDGE: - findEntityObservable = this.edgeService.findByName(entityData.name, config); - break; } return findEntityObservable.pipe( mergeMap((entity) => { const tasks: Observable[] = []; - if (entity.id.entityType === EntityType.EDGE) { - const result: Edge = entity as Edge; - const additionalInfo = result.additionalInfo || {}; - if (result.label !== entityData.label || - result.type !== entityData.type || - result.cloudEndpoint !== entityData.cloudEndpoint || - result.edgeLicenseKey !== entityData.edgeLicenseKey || - result.routingKey !== entityData.routingKey || - result.secret !== entityData.secret || - additionalInfo.description !== entityData.description) { - result.type = entityData.type; - if (entityData.label !== '') { - result.label = entityData.label; - } - if (entityData.description !== '') { - result.additionalInfo = additionalInfo; - result.additionalInfo.description = entityData.description; - } - if (entityData.cloudEndpoint !== '') { - result.cloudEndpoint = entityData.cloudEndpoint; - } - if (entityData.edgeLicenseKey !== '') { - result.edgeLicenseKey = entityData.edgeLicenseKey; - } - if (entityData.routingKey !== '') { - result.routingKey = entityData.routingKey; - } - if (entityData.cloudEndpoint !== '') { - result.secret = entityData.secret; - } - tasks.push(this.edgeService.saveEdge(result, config)); + const result: Device | Asset = entity as (Device | Asset); + const additionalInfo = result.additionalInfo || {}; + if (result.label !== entityData.label || + result.type !== entityData.type || + additionalInfo.description !== entityData.description || + (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { + result.label = entityData.label; + result.type = entityData.type; + result.additionalInfo = additionalInfo; + result.additionalInfo.description = entityData.description; + if (result.id.entityType === EntityType.DEVICE) { + result.additionalInfo.gateway = entityData.gateway; } - } else { - const result: Device | Asset = entity as (Device | Asset); - const additionalInfo = result.additionalInfo || {}; - if (result.label !== entityData.label || - result.type !== entityData.type || - additionalInfo.description !== entityData.description || - (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { - result.label = entityData.label; - result.type = entityData.type; - result.additionalInfo = additionalInfo; - result.additionalInfo.description = entityData.description; - if (result.id.entityType === EntityType.DEVICE) { - result.additionalInfo.gateway = entityData.gateway; - } - switch (result.id.entityType) { - case EntityType.DEVICE: - tasks.push(this.deviceService.saveDevice(result, config)); - break; - case EntityType.ASSET: - tasks.push(this.assetService.saveAsset(result, config)); - break; - } + switch (result.id.entityType) { + case EntityType.DEVICE: + tasks.push(this.deviceService.saveDevice(result, config)); + break; + case EntityType.ASSET: + tasks.push(this.assetService.saveAsset(result, config)); + break; } } tasks.push(this.saveEntityData(entity.id, entityData, config)); @@ -1015,6 +960,92 @@ export class EntityService { ); } + public saveEdgeParameters(entityData: ImportEntityData, update: boolean, + config?: RequestConfig): Observable { + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + const edge: Edge = { + name: edgeEntityData.name, + type: edgeEntityData.type, + label: edgeEntityData.label, + additionalInfo: { + description: edgeEntityData.description + }, + edgeLicenseKey: edgeEntityData.edgeLicenseKey, + cloudEndpoint: edgeEntityData.cloudEndpoint, + routingKey: edgeEntityData.routingKey, + secret: edgeEntityData.secret + }; + if (edge.cloudEndpoint === '') { + edge.cloudEndpoint = this.window.location.origin; + } + if (edge.routingKey === '') { + edge.routingKey = guid(); + } + if (edge.secret === '') { + edge.secret = generateSecret(20); + } + return this.edgeService.saveEdge(edge, config).pipe( + mergeMap((entity) => { + return this.saveEntityData(entity.id, edgeEntityData, config).pipe( + map(() => { + return { create: { entity: 1 } } as ImportEntitiesResultInfo; + }), + catchError(err => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + }), + catchError(err => { + if (update) { + return this.edgeService.findByName(edgeEntityData.name, config).pipe( + mergeMap((entity) => { + const tasks: Observable[] = []; + const result: Edge = entity as Edge; + const additionalInfo = result.additionalInfo || {}; + if (result.label !== edgeEntityData.label || + result.type !== edgeEntityData.type || + result.cloudEndpoint !== edgeEntityData.cloudEndpoint || + result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey || + result.routingKey !== edgeEntityData.routingKey || + result.secret !== edgeEntityData.secret || + additionalInfo.description !== edgeEntityData.description) { + result.type = edgeEntityData.type; + if (edgeEntityData.label !== '') { + result.label = edgeEntityData.label; + } + if (edgeEntityData.description !== '') { + result.additionalInfo = additionalInfo; + result.additionalInfo.description = edgeEntityData.description; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.cloudEndpoint = edgeEntityData.cloudEndpoint; + } + if (edgeEntityData.edgeLicenseKey !== '') { + result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; + } + if (edgeEntityData.routingKey !== '') { + result.routingKey = edgeEntityData.routingKey; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.secret = edgeEntityData.secret; + } + tasks.push(this.edgeService.saveEdge(result, config)); + } + tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); + return forkJoin(tasks).pipe( + map(() => { + return { update: { entity: 1 } } as ImportEntitiesResultInfo; + }), + catchError(updateError => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + }), + catchError(findErr => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + } else { + return of({ error: { entity: 1 } } as ImportEntitiesResultInfo); + } + }) + ); + } + public saveEntityData(entityId: EntityId, entityData: ImportEntityData, config?: RequestConfig): Observable { const observables: Observable[] = []; let observable: Observable; diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index 8473b9a3af..d62485a09f 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -32,7 +32,7 @@ import { CsvToJsonResult, ImportEntityColumnType } from '@home/components/import-export/import-export.models'; -import { ImportEntitiesResultInfo, ImportEntityData } from '@app/shared/models/entity.models'; +import { ImportEntitiesResultInfo, ImportEntityData, EdgeImportEntityData } from '@app/shared/models/entity.models'; import { ImportExportService } from '@home/components/import-export/import-export.service'; export interface ImportDialogCsvData { @@ -186,29 +186,14 @@ export class ImportDialogCsvComponent extends DialogComponent[] = []; for (let i = 0; i < partSize; i++) { - const importEntityPromise = - this.entityService.saveEntityParameters(entityType, entitiesData[i], updateData, config).pipe( + let saveEntityPromise: Observable; + if (entityType === EntityType.EDGE) { + saveEntityPromise = this.entityService.saveEdgeParameters(entitiesData[i], updateData, config); + } else { + saveEntityPromise = this.entityService.saveEntityParameters(entityType, entitiesData[i], updateData, config); + } + const importEntityPromise = saveEntityPromise.pipe( tap((res) => { if (importEntityCompleted) { importEntityCompleted(); diff --git a/ui-ngx/src/app/modules/home/pages/customer/customer.component.ts b/ui-ngx/src/app/modules/home/pages/customer/customer.component.ts index aed8dd606d..7d4f02d220 100644 --- a/ui-ngx/src/app/modules/home/pages/customer/customer.component.ts +++ b/ui-ngx/src/app/modules/home/pages/customer/customer.component.ts @@ -24,6 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; import { ContactBasedComponent } from '../../components/entity/contact-based.component'; import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; import { getCurrentAuthState } from '@core/auth/auth.selectors'; +import { AuthState } from '@core/auth/auth.models'; @Component({ selector: 'tb-customer', @@ -33,6 +34,8 @@ export class CustomerComponent extends ContactBasedComponent { isPublic = false; + authState: AuthState = getCurrentAuthState(this.store); + constructor(protected store: Store, protected translate: TranslateService, @Inject('entity') protected entityValue: Customer, @@ -80,8 +83,6 @@ export class CustomerComponent extends ContactBasedComponent { } edgesSupportEnabled() { - const authState = getCurrentAuthState(this.store); - return authState.edgesSupportEnabled; + return this.authState.edgesSupportEnabled; } - } diff --git a/ui-ngx/src/app/shared/models/entity.models.ts b/ui-ngx/src/app/shared/models/entity.models.ts index 70267c9f6c..ae4b552840 100644 --- a/ui-ngx/src/app/shared/models/entity.models.ts +++ b/ui-ngx/src/app/shared/models/entity.models.ts @@ -43,6 +43,9 @@ export interface ImportEntityData { shared: AttributeData[] }; timeseries: AttributeData[]; +} + +export interface EdgeImportEntityData extends ImportEntityData { secret: string; routingKey: string; cloudEndpoint: string; 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 b0c10b4905..368a823f25 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1981,9 +1981,9 @@ "access-token": "Access token", "isgateway": "Is Gateway", "description": "Description", - "edgeLicenseKey": "License Key", - "cloudEndpoint": "Cloud Endpoint", - "routingKey": "Edge key", + "edge-license-key": "License Key", + "cloud-endpoint": "Cloud Endpoint", + "routing-key": "Edge key", "secret": "Edge secret" }, "stepper-text":{ From 4aa0b02467604023755da6132dc11c341c4b6e0f Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 20 Jan 2021 17:40:35 +0200 Subject: [PATCH 10/14] Code review updates --- ui-ngx/src/app/core/http/entity.service.ts | 278 +++++++++--------- .../import-dialog-csv.component.ts | 9 +- .../import-export/import-export.service.ts | 12 +- .../modules/home/pages/edge/edge.component.ts | 8 +- 4 files changed, 144 insertions(+), 163 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 1eb379aa33..e68a1e486b 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Inject, Injectable } from '@angular/core'; +import { Injectable } from '@angular/core'; import { EMPTY, forkJoin, Observable, of, throwError } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { PageLink } from '@shared/models/page/page-link'; @@ -33,7 +33,7 @@ import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { Authority } from '@shared/models/authority.enum'; import { Tenant } from '@shared/models/tenant.model'; -import { catchError, concatMap, expand, map, mergeMap, toArray } from 'rxjs/operators'; +import { catchError, concatMap, expand, map, mergeMap, retry, toArray } from 'rxjs/operators'; import { Customer } from '@app/shared/models/customer.model'; import { AssetService } from '@core/http/asset.service'; import { EntityViewService } from '@core/http/entity-view.service'; @@ -52,7 +52,7 @@ import { ImportEntityData } from '@shared/models/entity.models'; import { EntityRelationService } from '@core/http/entity-relation.service'; -import { deepClone, generateSecret, guid, isDefined, isDefinedAndNotNull } from '@core/utils'; +import { deepClone, isDefined, isDefinedAndNotNull } from '@core/utils'; import { Asset } from '@shared/models/asset.models'; import { Device, DeviceCredentialsType } from '@shared/models/device.models'; import { AttributeService } from '@core/http/attribute.service'; @@ -74,10 +74,9 @@ import { StringOperation } from '@shared/models/query/query.models'; import { alarmFields } from '@shared/models/alarm.models'; -import { EdgeService } from "@core/http/edge.service"; +import { EdgeService } from '@core/http/edge.service'; import { Edge } from '@shared/models/edge.models'; -import { WINDOW } from "@core/services/window.service"; -import { RuleChainType } from "@shared/models/rule-chain.models"; +import { RuleChainType } from '@shared/models/rule-chain.models'; @Injectable({ providedIn: 'root' @@ -98,8 +97,7 @@ export class EntityService { private dashboardService: DashboardService, private entityRelationService: EntityRelationService, private attributeService: AttributeService, - private utils: UtilsService, - @Inject(WINDOW) protected window: Window + private utils: UtilsService ) { } private getEntityObservable(entityType: EntityType, entityId: string, @@ -867,37 +865,7 @@ export class EntityService { public saveEntityParameters(entityType: EntityType, entityData: ImportEntityData, update: boolean, config?: RequestConfig): Observable { - let saveEntityObservable: Observable>; - switch (entityType) { - case EntityType.DEVICE: - const device: Device = { - name: entityData.name, - type: entityData.type, - label: entityData.label, - additionalInfo: { - description: entityData.description - } - }; - if (entityData.gateway !== null) { - device.additionalInfo = { - ...device.additionalInfo, - gateway: entityData.gateway - }; - } - saveEntityObservable = this.deviceService.saveDevice(device, config); - break; - case EntityType.ASSET: - const asset: Asset = { - name: entityData.name, - type: entityData.type, - label: entityData.label, - additionalInfo: { - description: entityData.description - } - }; - saveEntityObservable = this.assetService.saveAsset(asset, config); - break; - } + const saveEntityObservable: Observable> = this.getSaveEntityObservable(entityType, entityData, config); return saveEntityObservable.pipe( mergeMap((entity) => { return this.saveEntityData(entity.id, entityData, config).pipe( @@ -917,34 +885,14 @@ export class EntityService { case EntityType.ASSET: findEntityObservable = this.assetService.findByName(entityData.name, config); break; + case EntityType.EDGE: + findEntityObservable = this.edgeService.findByName(entityData.name, config); + break; } return findEntityObservable.pipe( mergeMap((entity) => { - const tasks: Observable[] = []; - const result: Device | Asset = entity as (Device | Asset); - const additionalInfo = result.additionalInfo || {}; - if (result.label !== entityData.label || - result.type !== entityData.type || - additionalInfo.description !== entityData.description || - (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { - result.label = entityData.label; - result.type = entityData.type; - result.additionalInfo = additionalInfo; - result.additionalInfo.description = entityData.description; - if (result.id.entityType === EntityType.DEVICE) { - result.additionalInfo.gateway = entityData.gateway; - } - switch (result.id.entityType) { - case EntityType.DEVICE: - tasks.push(this.deviceService.saveDevice(result, config)); - break; - case EntityType.ASSET: - tasks.push(this.assetService.saveAsset(result, config)); - break; - } - } - tasks.push(this.saveEntityData(entity.id, entityData, config)); - return forkJoin(tasks).pipe( + const updateEntityTasks: Observable[] = this.getUpdateEntityTasks(entityType, entityData, entity, config); + return forkJoin(updateEntityTasks).pipe( map(() => { return { update: { entity: 1 } } as ImportEntitiesResultInfo; }), @@ -960,90 +908,128 @@ export class EntityService { ); } - public saveEdgeParameters(entityData: ImportEntityData, update: boolean, - config?: RequestConfig): Observable { - const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; - const edge: Edge = { - name: edgeEntityData.name, - type: edgeEntityData.type, - label: edgeEntityData.label, - additionalInfo: { - description: edgeEntityData.description - }, - edgeLicenseKey: edgeEntityData.edgeLicenseKey, - cloudEndpoint: edgeEntityData.cloudEndpoint, - routingKey: edgeEntityData.routingKey, - secret: edgeEntityData.secret - }; - if (edge.cloudEndpoint === '') { - edge.cloudEndpoint = this.window.location.origin; - } - if (edge.routingKey === '') { - edge.routingKey = guid(); - } - if (edge.secret === '') { - edge.secret = generateSecret(20); + private getSaveEntityObservable(entityType: EntityType, entityData: ImportEntityData, + config?: RequestConfig): Observable> { + let saveEntityObservable: Observable>; + switch (entityType) { + case EntityType.DEVICE: + const device: Device = { + name: entityData.name, + type: entityData.type, + label: entityData.label, + additionalInfo: { + description: entityData.description + } + }; + if (entityData.gateway !== null) { + device.additionalInfo = { + ...device.additionalInfo, + gateway: entityData.gateway + }; + } + saveEntityObservable = this.deviceService.saveDevice(device, config); + break; + case EntityType.ASSET: + const asset: Asset = { + name: entityData.name, + type: entityData.type, + label: entityData.label, + additionalInfo: { + description: entityData.description + } + }; + saveEntityObservable = this.assetService.saveAsset(asset, config); + break; + case EntityType.EDGE: + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + const edge: Edge = { + name: edgeEntityData.name, + type: edgeEntityData.type, + label: edgeEntityData.label, + additionalInfo: { + description: edgeEntityData.description + }, + edgeLicenseKey: edgeEntityData.edgeLicenseKey, + cloudEndpoint: edgeEntityData.cloudEndpoint, + routingKey: edgeEntityData.routingKey, + secret: edgeEntityData.secret + }; + saveEntityObservable = this.edgeService.saveEdge(edge, config); + break; } - return this.edgeService.saveEdge(edge, config).pipe( - mergeMap((entity) => { - return this.saveEntityData(entity.id, edgeEntityData, config).pipe( - map(() => { - return { create: { entity: 1 } } as ImportEntitiesResultInfo; - }), - catchError(err => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - }), - catchError(err => { - if (update) { - return this.edgeService.findByName(edgeEntityData.name, config).pipe( - mergeMap((entity) => { - const tasks: Observable[] = []; - const result: Edge = entity as Edge; - const additionalInfo = result.additionalInfo || {}; - if (result.label !== edgeEntityData.label || - result.type !== edgeEntityData.type || - result.cloudEndpoint !== edgeEntityData.cloudEndpoint || - result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey || - result.routingKey !== edgeEntityData.routingKey || - result.secret !== edgeEntityData.secret || - additionalInfo.description !== edgeEntityData.description) { - result.type = edgeEntityData.type; - if (edgeEntityData.label !== '') { - result.label = edgeEntityData.label; - } - if (edgeEntityData.description !== '') { - result.additionalInfo = additionalInfo; - result.additionalInfo.description = edgeEntityData.description; - } - if (edgeEntityData.cloudEndpoint !== '') { - result.cloudEndpoint = edgeEntityData.cloudEndpoint; - } - if (edgeEntityData.edgeLicenseKey !== '') { - result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; - } - if (edgeEntityData.routingKey !== '') { - result.routingKey = edgeEntityData.routingKey; - } - if (edgeEntityData.cloudEndpoint !== '') { - result.secret = edgeEntityData.secret; - } - tasks.push(this.edgeService.saveEdge(result, config)); - } - tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); - return forkJoin(tasks).pipe( - map(() => { - return { update: { entity: 1 } } as ImportEntitiesResultInfo; - }), - catchError(updateError => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - }), - catchError(findErr => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - } else { - return of({ error: { entity: 1 } } as ImportEntitiesResultInfo); + return saveEntityObservable; + + } + + private getUpdateEntityTasks(entityType: EntityType, entityData: ImportEntityData | EdgeImportEntityData, + entity: BaseData, config?: RequestConfig): Observable[] { + const tasks: Observable[] = []; + let result; + let additionalInfo; + switch (entityType) { + case EntityType.EDGE: + result = entity as Edge; + additionalInfo = result.additionalInfo || {}; + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + if (result.label !== edgeEntityData.label || + result.type !== edgeEntityData.type || + result.cloudEndpoint !== edgeEntityData.cloudEndpoint || + result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey || + result.routingKey !== edgeEntityData.routingKey || + result.secret !== edgeEntityData.secret || + additionalInfo.description !== edgeEntityData.description) { + result.type = edgeEntityData.type; + if (edgeEntityData.label !== '') { + result.label = edgeEntityData.label; + } + if (edgeEntityData.description !== '') { + result.additionalInfo = additionalInfo; + result.additionalInfo.description = edgeEntityData.description; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.cloudEndpoint = edgeEntityData.cloudEndpoint; + } + if (edgeEntityData.edgeLicenseKey !== '') { + result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; + } + if (edgeEntityData.routingKey !== '') { + result.routingKey = edgeEntityData.routingKey; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.secret = edgeEntityData.secret; + } + tasks.push(this.edgeService.saveEdge(result, config)); } - }) - ); + tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); + break; + case EntityType.ASSET: + case EntityType.DEVICE: + result = entity as (Device | Asset); + additionalInfo = result.additionalInfo || {}; + if (result.label !== entityData.label || + result.type !== entityData.type || + additionalInfo.description !== entityData.description || + (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { + result.label = entityData.label; + result.type = entityData.type; + result.additionalInfo = additionalInfo; + result.additionalInfo.description = entityData.description; + if (result.id.entityType === EntityType.DEVICE) { + result.additionalInfo.gateway = entityData.gateway; + } + switch (result.id.entityType) { + case EntityType.DEVICE: + tasks.push(this.deviceService.saveDevice(result, config)); + break; + case EntityType.ASSET: + tasks.push(this.assetService.saveAsset(result, config)); + break; + } + } + tasks.push(this.saveEntityData(entity.id, entityData, config)); + break; + } + return tasks; } public saveEntityData(entityId: EntityId, entityData: ImportEntityData, config?: RequestConfig): Observable { diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index d62485a09f..f4af41b46e 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -34,6 +34,7 @@ import { } from '@home/components/import-export/import-export.models'; import { ImportEntitiesResultInfo, ImportEntityData, EdgeImportEntityData } from '@app/shared/models/entity.models'; import { ImportExportService } from '@home/components/import-export/import-export.service'; +import { generateSecret, guid } from '@core/utils'; export interface ImportDialogCsvData { entityType: EntityType; @@ -281,11 +282,11 @@ export class ImportDialogCsvComponent extends DialogComponent[] = []; for (let i = 0; i < partSize; i++) { let saveEntityPromise: Observable; - if (entityType === EntityType.EDGE) { - saveEntityPromise = this.entityService.saveEdgeParameters(entitiesData[i], updateData, config); - } else { - saveEntityPromise = this.entityService.saveEntityParameters(entityType, entitiesData[i], updateData, config); - } + saveEntityPromise = this.entityService.saveEntityParameters(entityType, entitiesData[i], updateData, config); const importEntityPromise = saveEntityPromise.pipe( tap((res) => { if (importEntityCompleted) { @@ -412,7 +408,7 @@ export class ImportExportService { throw new Error('Invalid rule chain file'); } else if (ruleChainImport.ruleChain.type !== expectedRuleChainType) { this.store.dispatch(new ActionNotificationShow( - {message: this.translate.instant('rulechain.invalid-rulechain-type-error', { expectedRuleChainType: expectedRuleChainType }), + {message: this.translate.instant('rulechain.invalid-rulechain-type-error', {expectedRuleChainType}), type: 'error'})); throw new Error('Invalid rule chain type'); } else { @@ -602,7 +598,7 @@ export class ImportExportService { private editMissingAliases(widgets: Array, isSingleWidget: boolean, customTitle: string, missingEntityAliases: EntityAliases): Observable { - let allowedEntityTypes: Array = + const allowedEntityTypes: Array = this.entityService.prepareAllowedEntityTypesList(null, true); return this.dialog.open { diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts b/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts index 87c745be28..8bd2d3337b 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge.component.ts @@ -26,7 +26,6 @@ import { NULL_UUID } from '@shared/models/id/has-uuid'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { generateSecret, guid } from '@core/utils'; import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; -import { WINDOW } from '@core/services/window.service'; @Component({ selector: 'tb-edge', @@ -43,15 +42,14 @@ export class EdgeComponent extends EntityComponent { protected translate: TranslateService, @Inject('entity') protected entityValue: EdgeInfo, @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig, - public fb: FormBuilder, - @Inject(WINDOW) protected window: Window) { + public fb: FormBuilder) { super(store, fb, entityValue, entitiesTableConfigValue); } ngOnInit() { this.edgeScope = this.entitiesTableConfig.componentsData.edgeScope; this.entityForm.patchValue({ - cloudEndpoint: this.window.location.origin + cloudEndpoint: window.location.origin }); super.ngOnInit(); } @@ -94,7 +92,7 @@ export class EdgeComponent extends EntityComponent { name: entity.name, type: entity.type, label: entity.label, - cloudEndpoint: entity.cloudEndpoint ? entity.cloudEndpoint : this.window.location.origin, + cloudEndpoint: entity.cloudEndpoint ? entity.cloudEndpoint : window.location.origin, edgeLicenseKey: entity.edgeLicenseKey, routingKey: entity.routingKey, secret: entity.secret, From 898e5c67bf5fe576e62d23a9eca11e5986a0e47e Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 20 Jan 2021 17:43:04 +0200 Subject: [PATCH 11/14] Import fixes --- ui-ngx/src/app/core/http/entity.service.ts | 2 +- .../components/import-export/import-dialog-csv.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index e68a1e486b..7d043c51b0 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -33,7 +33,7 @@ import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { Authority } from '@shared/models/authority.enum'; import { Tenant } from '@shared/models/tenant.model'; -import { catchError, concatMap, expand, map, mergeMap, retry, toArray } from 'rxjs/operators'; +import { catchError, concatMap, expand, map, mergeMap, toArray } from 'rxjs/operators'; import { Customer } from '@app/shared/models/customer.model'; import { AssetService } from '@core/http/asset.service'; import { EntityViewService } from '@core/http/entity-view.service'; diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index f4af41b46e..44038e3c0e 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -32,7 +32,7 @@ import { CsvToJsonResult, ImportEntityColumnType } from '@home/components/import-export/import-export.models'; -import { ImportEntitiesResultInfo, ImportEntityData, EdgeImportEntityData } from '@app/shared/models/entity.models'; +import { EdgeImportEntityData, ImportEntitiesResultInfo, ImportEntityData } from '@app/shared/models/entity.models'; import { ImportExportService } from '@home/components/import-export/import-export.service'; import { generateSecret, guid } from '@core/utils'; From ea9f1491680d95c21184bbbb474d60aea0a81c15 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 21 Jan 2021 13:31:48 +0200 Subject: [PATCH 12/14] Edge widget updates --- .../data/json/system/widget_bundles/edge_widgets.json | 8 ++++---- .../widget/lib/edges-overview-widget.component.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/src/main/data/json/system/widget_bundles/edge_widgets.json b/application/src/main/data/json/system/widget_bundles/edge_widgets.json index 32047f20a4..6412ff9d99 100644 --- a/application/src/main/data/json/system/widget_bundles/edge_widgets.json +++ b/application/src/main/data/json/system/widget_bundles/edge_widgets.json @@ -7,7 +7,7 @@ "widgetTypes": [ { "alias": "edges_overview", - "name": "Edges Quick Overview", + "name": "Edge Quick Overview", "descriptor": { "type": "latest", "sizeX": 7.5, @@ -15,10 +15,10 @@ "resources": [], "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n};\n\nself.onDestroy = function() {\n};\n", - "settingsSchema": "{}", + "controllerScript": "self.onInit = function() {\n};\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n dataKeysOptional: true\n };\n}\n\nself.onDestroy = function() {\n};\n", + "settingsSchema": "{}\n", "dataKeySettingsSchema": "{}\n", - "defaultConfig": "{\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":86400000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"4px\",\"settings\":{},\"title\":\"Edges Quick Overview\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"datasources\":[{\"type\":\"function\",\"name\":\"Simulated\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Sin\",\"color\":\"#2196f3\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.472295003170325,\"funcBody\":\"return Math.round(1000*Math.sin(time/5000));\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Cos\",\"color\":\"#4caf50\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.8926244886945558,\"funcBody\":\"return Math.round(1000*Math.cos(time/5000));\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#f44336\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.6401141393938932,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"widgetStyle\":{},\"actions\":{}}" + "defaultConfig": "{\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":86400000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"showTitleIcon\":true,\"titleIcon\":\"router\",\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"4px\",\"settings\":{},\"title\":\"Edge Quick Overview\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"datasources\":[{\"type\":\"function\",\"name\":\"Simulated\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Sin\",\"color\":\"#2196f3\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.472295003170325,\"funcBody\":\"return Math.round(1000*Math.sin(time/5000));\"}]}],\"widgetStyle\":{},\"actions\":{}}" } } ] diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts index edacb1bb97..6a61c12fc6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts @@ -87,7 +87,7 @@ export class EdgesOverviewWidgetComponent extends PageComponent implements OnIni if (datasource.type === DatasourceType.entity && datasource.entity.id.entityType === EntityType.EDGE) { var selectedEdge: BaseData = datasource.entity; this.getCustomerTitle(selectedEdge.id.id); - this.ctx.widgetTitle = selectedEdge.name; + this.ctx.widgetTitle = `${selectedEdge.name} Quick Overview`; cb(this.loadNodesForEdge(selectedEdge.id.id, selectedEdge)); } else if (datasource.type === DatasourceType.function) { cb(this.loadNodesForEdge(datasource.entityId, datasource.entity)); From cd59a8d9c6c901cb8707dd908ef0426340b09001 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 21 Jan 2021 15:40:54 +0200 Subject: [PATCH 13/14] Import edge fix --- ui-ngx/src/app/core/http/entity.service.ts | 187 ++++++++++++++------- 1 file changed, 130 insertions(+), 57 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index ac9e6af793..585050d637 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -45,6 +45,7 @@ import { DataKey, Datasource, DatasourceType, KeyInfo } from '@app/shared/models import { UtilsService } from '@core/services/utils.service'; import { AliasFilterType, EntityAlias, EntityAliasFilter, EntityAliasFilterResult } from '@shared/models/alias.models'; import { + EdgeImportEntityData, EntitiesKeysByQuery, entityFields, EntityInfo, @@ -76,6 +77,7 @@ import { import { alarmFields } from '@shared/models/alarm.models'; import { EdgeService } from "@core/http/edge.service"; import { RuleChainType } from "@shared/models/rule-chain.models"; +import { Edge } from '@shared/models/edge.models'; @Injectable({ providedIn: 'root' @@ -924,6 +926,51 @@ export class EntityService { public saveEntityParameters(entityType: EntityType, entityData: ImportEntityData, update: boolean, config?: RequestConfig): Observable { + const saveEntityObservable: Observable> = this.getSaveEntityObservable(entityType, entityData, config); + return saveEntityObservable.pipe( + mergeMap((entity) => { + return this.saveEntityData(entity.id, entityData, config).pipe( + map(() => { + return { create: { entity: 1 } } as ImportEntitiesResultInfo; + }), + catchError(err => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + }), + catchError(err => { + if (update) { + let findEntityObservable: Observable>; + switch (entityType) { + case EntityType.DEVICE: + findEntityObservable = this.deviceService.findByName(entityData.name, config); + break; + case EntityType.ASSET: + findEntityObservable = this.assetService.findByName(entityData.name, config); + break; + case EntityType.EDGE: + findEntityObservable = this.edgeService.findByName(entityData.name, config); + break; + } + return findEntityObservable.pipe( + mergeMap((entity) => { + const updateEntityTasks: Observable[] = this.getUpdateEntityTasks(entityType, entityData, entity, config); + return forkJoin(updateEntityTasks).pipe( + map(() => { + return { update: { entity: 1 } } as ImportEntitiesResultInfo; + }), + catchError(updateError => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + }), + catchError(findErr => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) + ); + } else { + return of({ error: { entity: 1 } } as ImportEntitiesResultInfo); + } + }) + ); + } + + private getSaveEntityObservable(entityType: EntityType, entityData: ImportEntityData, + config?: RequestConfig): Observable> { let saveEntityObservable: Observable>; switch (entityType) { case EntityType.DEVICE: @@ -954,70 +1001,96 @@ export class EntityService { }; saveEntityObservable = this.assetService.saveAsset(asset, config); break; + case EntityType.EDGE: + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + const edge: Edge = { + name: edgeEntityData.name, + type: edgeEntityData.type, + label: edgeEntityData.label, + additionalInfo: { + description: edgeEntityData.description + }, + edgeLicenseKey: edgeEntityData.edgeLicenseKey, + cloudEndpoint: edgeEntityData.cloudEndpoint, + routingKey: edgeEntityData.routingKey, + secret: edgeEntityData.secret + }; + saveEntityObservable = this.edgeService.saveEdge(edge, config); + break; } - return saveEntityObservable.pipe( - mergeMap((entity) => { - return this.saveEntityData(entity.id, entityData, config).pipe( - map(() => { - return { create: { entity: 1 } } as ImportEntitiesResultInfo; - }), - catchError(err => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - }), - catchError(err => { - if (update) { - let findEntityObservable: Observable>; - switch (entityType) { + return saveEntityObservable; + + } + + private getUpdateEntityTasks(entityType: EntityType, entityData: ImportEntityData | EdgeImportEntityData, + entity: BaseData, config?: RequestConfig): Observable[] { + const tasks: Observable[] = []; + let result; + let additionalInfo; + switch (entityType) { + case EntityType.EDGE: + result = entity as Edge; + additionalInfo = result.additionalInfo || {}; + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + if (result.label !== edgeEntityData.label || + result.type !== edgeEntityData.type || + result.cloudEndpoint !== edgeEntityData.cloudEndpoint || + result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey || + result.routingKey !== edgeEntityData.routingKey || + result.secret !== edgeEntityData.secret || + additionalInfo.description !== edgeEntityData.description) { + result.type = edgeEntityData.type; + if (edgeEntityData.label !== '') { + result.label = edgeEntityData.label; + } + if (edgeEntityData.description !== '') { + result.additionalInfo = additionalInfo; + result.additionalInfo.description = edgeEntityData.description; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.cloudEndpoint = edgeEntityData.cloudEndpoint; + } + if (edgeEntityData.edgeLicenseKey !== '') { + result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; + } + if (edgeEntityData.routingKey !== '') { + result.routingKey = edgeEntityData.routingKey; + } + if (edgeEntityData.cloudEndpoint !== '') { + result.secret = edgeEntityData.secret; + } + tasks.push(this.edgeService.saveEdge(result, config)); + } + tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); + break; + case EntityType.ASSET: + case EntityType.DEVICE: + result = entity as (Device | Asset); + additionalInfo = result.additionalInfo || {}; + if (result.label !== entityData.label || + result.type !== entityData.type || + additionalInfo.description !== entityData.description || + (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { + result.label = entityData.label; + result.type = entityData.type; + result.additionalInfo = additionalInfo; + result.additionalInfo.description = entityData.description; + if (result.id.entityType === EntityType.DEVICE) { + result.additionalInfo.gateway = entityData.gateway; + } + switch (result.id.entityType) { case EntityType.DEVICE: - findEntityObservable = this.deviceService.findByName(entityData.name, config); + tasks.push(this.deviceService.saveDevice(result, config)); break; case EntityType.ASSET: - findEntityObservable = this.assetService.findByName(entityData.name, config); + tasks.push(this.assetService.saveAsset(result, config)); break; } - return findEntityObservable.pipe( - mergeMap((entity) => { - const tasks: Observable[] = []; - const result: Device & Asset = entity as (Device | Asset); - const additionalInfo = result.additionalInfo || {}; - if (result.label !== entityData.label || - result.type !== entityData.type || - additionalInfo.description !== entityData.description || - (result.id.entityType === EntityType.DEVICE && (additionalInfo.gateway !== entityData.gateway)) ) { - result.label = entityData.label; - result.type = entityData.type; - result.additionalInfo = additionalInfo; - result.additionalInfo.description = entityData.description; - if (result.id.entityType === EntityType.DEVICE) { - result.additionalInfo.gateway = entityData.gateway; - } - if (result.id.entityType === EntityType.DEVICE && result.deviceProfileId) { - delete result.deviceProfileId; - } - switch (result.id.entityType) { - case EntityType.DEVICE: - tasks.push(this.deviceService.saveDevice(result, config)); - break; - case EntityType.ASSET: - tasks.push(this.assetService.saveAsset(result, config)); - break; - } - } - tasks.push(this.saveEntityData(entity.id, entityData, config)); - return forkJoin(tasks).pipe( - map(() => { - return { update: { entity: 1 } } as ImportEntitiesResultInfo; - }), - catchError(updateError => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - }), - catchError(findErr => of({ error: { entity: 1 } } as ImportEntitiesResultInfo)) - ); - } else { - return of({ error: { entity: 1 } } as ImportEntitiesResultInfo); } - }) - ); + tasks.push(this.saveEntityData(entity.id, entityData, config)); + break; + } + return tasks; } public saveEntityData(entityId: EntityId, entityData: ImportEntityData, config?: RequestConfig): Observable { From b4800ac4c58424f4d8852b8b03c370575cf7e1dd Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 22 Jan 2021 10:49:20 +0200 Subject: [PATCH 14/14] Fixes for import --- ui-ngx/src/app/core/http/entity.service.ts | 74 +++++++++---------- .../import-dialog-csv.component.ts | 7 +- 2 files changed, 38 insertions(+), 43 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 585050d637..7da7bf61f7 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -53,7 +53,7 @@ import { ImportEntityData } from '@shared/models/entity.models'; import { EntityRelationService } from '@core/http/entity-relation.service'; -import { deepClone, isDefined, isDefinedAndNotNull } from '@core/utils'; +import { deepClone, generateSecret, guid, isDefined, isDefinedAndNotNull } from '@core/utils'; import { Asset } from '@shared/models/asset.models'; import { Device, DeviceCredentialsType } from '@shared/models/device.models'; import { AttributeService } from '@core/http/attribute.service'; @@ -1011,9 +1011,9 @@ export class EntityService { description: edgeEntityData.description }, edgeLicenseKey: edgeEntityData.edgeLicenseKey, - cloudEndpoint: edgeEntityData.cloudEndpoint, - routingKey: edgeEntityData.routingKey, - secret: edgeEntityData.secret + cloudEndpoint: edgeEntityData.cloudEndpoint !== '' ? edgeEntityData.cloudEndpoint : window.location.origin, + routingKey: edgeEntityData.routingKey !== '' ? edgeEntityData.routingKey : guid(), + secret: edgeEntityData.secret !== '' ? edgeEntityData.secret : generateSecret(20) }; saveEntityObservable = this.edgeService.saveEdge(edge, config); break; @@ -1028,41 +1028,6 @@ export class EntityService { let result; let additionalInfo; switch (entityType) { - case EntityType.EDGE: - result = entity as Edge; - additionalInfo = result.additionalInfo || {}; - const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; - if (result.label !== edgeEntityData.label || - result.type !== edgeEntityData.type || - result.cloudEndpoint !== edgeEntityData.cloudEndpoint || - result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey || - result.routingKey !== edgeEntityData.routingKey || - result.secret !== edgeEntityData.secret || - additionalInfo.description !== edgeEntityData.description) { - result.type = edgeEntityData.type; - if (edgeEntityData.label !== '') { - result.label = edgeEntityData.label; - } - if (edgeEntityData.description !== '') { - result.additionalInfo = additionalInfo; - result.additionalInfo.description = edgeEntityData.description; - } - if (edgeEntityData.cloudEndpoint !== '') { - result.cloudEndpoint = edgeEntityData.cloudEndpoint; - } - if (edgeEntityData.edgeLicenseKey !== '') { - result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; - } - if (edgeEntityData.routingKey !== '') { - result.routingKey = edgeEntityData.routingKey; - } - if (edgeEntityData.cloudEndpoint !== '') { - result.secret = edgeEntityData.secret; - } - tasks.push(this.edgeService.saveEdge(result, config)); - } - tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); - break; case EntityType.ASSET: case EntityType.DEVICE: result = entity as (Device | Asset); @@ -1089,6 +1054,37 @@ export class EntityService { } tasks.push(this.saveEntityData(entity.id, entityData, config)); break; + case EntityType.EDGE: + result = entity as Edge; + additionalInfo = result.additionalInfo || {}; + const edgeEntityData: EdgeImportEntityData = entityData as EdgeImportEntityData; + if (result.label !== edgeEntityData.label || + result.type !== edgeEntityData.type || + (edgeEntityData.cloudEndpoint !== '' && result.cloudEndpoint !== edgeEntityData.cloudEndpoint) || + (edgeEntityData.edgeLicenseKey !== '' && result.edgeLicenseKey !== edgeEntityData.edgeLicenseKey) || + (edgeEntityData.routingKey !== '' && result.routingKey !== edgeEntityData.routingKey) || + (edgeEntityData.secret !== '' && result.secret !== edgeEntityData.secret) || + additionalInfo.description !== edgeEntityData.description) { + result.label = edgeEntityData.label; + result.type = edgeEntityData.type; + result.additionalInfo = additionalInfo; + result.additionalInfo.description = edgeEntityData.description; + if (edgeEntityData.cloudEndpoint !== '') { + result.cloudEndpoint = edgeEntityData.cloudEndpoint; + } + if (edgeEntityData.edgeLicenseKey !== '') { + result.edgeLicenseKey = edgeEntityData.edgeLicenseKey; + } + if (edgeEntityData.routingKey !== '') { + result.routingKey = edgeEntityData.routingKey; + } + if (edgeEntityData.secret !== '') { + result.secret = edgeEntityData.secret; + } + tasks.push(this.edgeService.saveEdge(result, config)); + } + tasks.push(this.saveEntityData(entity.id, edgeEntityData, config)); + break; } return tasks; } diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts index c7e40e92ea..f878d67dee 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog-csv.component.ts @@ -34,7 +34,6 @@ import { } from '@home/components/import-export/import-export.models'; import { EdgeImportEntityData, ImportEntitiesResultInfo, ImportEntityData } from '@app/shared/models/entity.models'; import { ImportExportService } from '@home/components/import-export/import-export.service'; -import { generateSecret, guid } from '@core/utils'; export interface ImportDialogCsvData { entityType: EntityType; @@ -284,9 +283,9 @@ export class ImportDialogCsvComponent extends DialogComponent