From 91c4affb0748f733c67233abb471c5a739a60938 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 8 Dec 2020 09:23:55 +0200 Subject: [PATCH] Minor edge changes --- .run/[CE Edge] Install.run.xml | 2 +- .run/[CE Edge] Server.run.xml | 4 +-- .../dao/model/sql/AbstractEdgeEntity.java | 2 +- ui-ngx/src/app/core/http/edge.service.ts | 6 ----- .../src/app/core/http/rule-chain.service.ts | 6 +++++ .../home/pages/edge/edge-routing.module.ts | 2 +- .../pages/edge/edges-table-config.resolver.ts | 26 +++++++++---------- .../rulechain/rulechain-routing.module.ts | 6 ++--- .../rulechains-table-config.resolver.ts | 4 +-- .../assets/locale/locale.constant-en_US.json | 3 +-- ui/src/app/edge/edge.routes.js | 2 +- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.run/[CE Edge] Install.run.xml b/.run/[CE Edge] Install.run.xml index ecc4c081a5..f9e18724d9 100644 --- a/.run/[CE Edge] Install.run.xml +++ b/.run/[CE Edge] Install.run.xml @@ -1,5 +1,5 @@ - + diff --git a/.run/[CE Edge] Server.run.xml b/.run/[CE Edge] Server.run.xml index 89667da5db..70f1bc1e6a 100644 --- a/.run/[CE Edge] Server.run.xml +++ b/.run/[CE Edge] Server.run.xml @@ -1,9 +1,9 @@ - + - + diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java index 7292b16078..1f62bec85a 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java @@ -176,4 +176,4 @@ public abstract class AbstractEdgeEntity extends BaseSqlEntity { - return this.http.post(`/api/edge/${edgeId}/${ruleChainId}/root`, - defaultHttpOptionsFromConfig(config)); - } - public getTenantEdgeInfos(pageLink: PageLink, type: string = '', config?: RequestConfig): Observable> { return this.http.get>(`/api/tenant/edgeInfos${pageLink.toQuery()}&type=${type}`, diff --git a/ui-ngx/src/app/core/http/rule-chain.service.ts b/ui-ngx/src/app/core/http/rule-chain.service.ts index 61a52e899b..5c01902896 100644 --- a/ui-ngx/src/app/core/http/rule-chain.service.ts +++ b/ui-ngx/src/app/core/http/rule-chain.service.ts @@ -44,6 +44,7 @@ import { TranslateService } from '@ngx-translate/core'; import { EntityType } from '@shared/models/entity-type.models'; import { deepClone, snakeCase } from '@core/utils'; import { DebugRuleNodeEventBody } from '@app/shared/models/event.models'; +import { Edge } from "@shared/models/edge.models"; @Injectable({ providedIn: 'root' @@ -323,4 +324,9 @@ export class RuleChainService { return this.http.get>(`/api/ruleChain/defaultEdgeRuleChains`, defaultHttpOptionsFromConfig(config)); } + public setEdgeRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable { //TODO deaflynx EdgeInfo vs. Edge check usage + return this.http.post(`/api/edge/${edgeId}/${ruleChainId}/root`, + defaultHttpOptionsFromConfig(config)); + } + } diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts index 4fcad45d19..58870eed4f 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts @@ -53,7 +53,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], ruleChainsType: 'edge', breadcrumb: { - label: 'edge.rulechains', + label: 'rulechain.edge-rulechains', icon: 'settings_ethernet' }, }, diff --git a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts index 614c801653..3eff42b70a 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts @@ -149,10 +149,10 @@ export class EdgesTableConfigResolver implements Resolve('customerTitle', 'customer.customer', '25%'), - new EntityTableColumn('customerIsPublic', 'edge.public', '60px', + /* new EntityTableColumn('customerIsPublic', 'edge.public', '60px', entity => { return checkBoxCell(entity.customerIsPublic); - }, () => ({}), false), + }, () => ({}), false) */ ); } return columns; @@ -175,12 +175,12 @@ export class EdgesTableConfigResolver implements Resolve> = []; if (edgeScope === 'tenant') { actions.push( - { - name: this.translate.instant('edge.make-public'), - icon: 'share', - isEnabled: (entity) => (!entity.customerId || entity.customerId.id === NULL_UUID), - onAction: ($event, entity) => this.makePublic($event, entity) - }, + /* { + name: this.translate.instant('edge.make-public'), + icon: 'share', + isEnabled: (entity) => (!entity.customerId || entity.customerId.id === NULL_UUID), + onAction: ($event, entity) => this.makePublic($event, entity) + }, */ { name: this.translate.instant('edge.assign-to-customer'), icon: 'assignment_ind', @@ -335,7 +335,7 @@ export class EdgesTableConfigResolver implements Resolve): boolean { switch (action.action) { - case 'makePublic': - this.makePublic(action.event, action.entity); - return true; + // case 'makePublic': + // this.makePublic(action.event, action.entity); + // return true; case 'assignToCustomer': this.assignToCustomer(action.event, [action.entity.id]); return true; diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts index fd7b58f0f0..7c2f3e31ef 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts @@ -210,7 +210,7 @@ const routes: Routes = [ component: EntitiesTableComponent, data: { auth: [Authority.TENANT_ADMIN], - title: 'edge.rulechains', + title: 'rulechain.edge-rulechains', ruleChainsType: 'edges' }, resolve: { @@ -227,7 +227,7 @@ const routes: Routes = [ icon: 'settings_ethernet' } as BreadCrumbConfig, auth: [Authority.TENANT_ADMIN], - title: 'edge.rulechain', + title: 'rulechain.edge-rulechain', import: false, ruleChainType: ruleChainType.edge }, @@ -248,7 +248,7 @@ const routes: Routes = [ icon: 'settings_ethernet' } as BreadCrumbConfig, auth: [Authority.TENANT_ADMIN], - title: 'edge.rulechain', + title: 'rulechain.edge-rulechain', import: true, ruleChainType: ruleChainType.edge }, diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts index 280e4082ba..afa1784e98 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts @@ -100,11 +100,11 @@ export class RuleChainsTableConfigResolver implements Resolve this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; - this.config.deleteEnabled = () => false; this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => { this.config.componentsData.edge = edge; this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains'); }); + this.config.entitiesDeleteEnabled = false; } else { this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root; @@ -294,7 +294,7 @@ export class RuleChainsTableConfigResolver implements Resolve { if (res) { if (this.config.componentsData.edgeId) { - this.edgeService.setRootRuleChain(this.config.componentsData.edgeId, ruleChain.id.id).subscribe( + this.ruleChainService.setEdgeRootRuleChain(this.config.componentsData.edgeId, ruleChain.id.id).subscribe( (edge) => { this.config.componentsData.edge = edge; this.config.table.updateData(); 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 1fbfcfc2dc..554f18ff68 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -980,8 +980,6 @@ "unassign-from-edge": "Unassign from edge", "dashboards": "Edge Dashboards", "manage-edge-rulechains": "Manage edge rule chains", - "rulechains": "Edge Rule Chains", - "rulechain": "Edge Rule Chain", "edge-key": "Edge key", "copy-edge-key": "Copy Edge key", "edge-key-copied-message": "Edge key has been copied to clipboard", @@ -1832,6 +1830,7 @@ "open-rulechain": "Open rule chain", "assign-new-rulechain": "Assign new rulechain", "edge-rulechains": "Edge Rule chains", + "edge-rulechain": "Edge Rule chain", "core-rulechains": "Core Rule chains", "unassign-rulechain-from-edge-text": "After the confirmation the rulechain will be unassigned and won't be accessible by the edge.", "unassign-rulechains-from-edge-title": "Unassign { count, plural, 1 {1 rulechain} other {# rulechains} } from edge", diff --git a/ui/src/app/edge/edge.routes.js b/ui/src/app/edge/edge.routes.js index bcba2cffe1..364f4c935d 100644 --- a/ui/src/app/edge/edge.routes.js +++ b/ui/src/app/edge/edge.routes.js @@ -194,7 +194,7 @@ export default function EdgeRoutes($stateProvider, types) { }, data: { searchEnabled: true, - pageTitle: 'edge.rulechains', + pageTitle: 'rulechain.edge-rulechains', ruleChainsType: 'edge' }, ncyBreadcrumb: {