Browse Source

Minor edge changes

pull/3811/head
Artem Babak 6 years ago
parent
commit
91c4affb07
  1. 2
      .run/[CE Edge] Install.run.xml
  2. 4
      .run/[CE Edge] Server.run.xml
  3. 2
      dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java
  4. 6
      ui-ngx/src/app/core/http/edge.service.ts
  5. 6
      ui-ngx/src/app/core/http/rule-chain.service.ts
  6. 2
      ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts
  7. 26
      ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts
  8. 6
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts
  9. 4
      ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts
  10. 3
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  11. 2
      ui/src/app/edge/edge.routes.js

2
.run/[CE Edge] Install.run.xml

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[CE Edge] Install" type="Application" factoryName="Application">
<configuration default="false" name="[CE 3] Install" type="Application" factoryName="Application">
<envs>
<env name="SPRING_DATASOURCE_URL" value="jdbc:postgresql://localhost:5432/tb_ce_3" />
</envs>

4
.run/[CE Edge] Server.run.xml

@ -1,9 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[CE Edge] Server" type="Application" factoryName="Application">
<configuration default="false" name="[CE 3] Server" type="Application" factoryName="Application">
<envs>
<env name="SPRING_DATASOURCE_URL" value="jdbc:postgresql://localhost:5432/tb_ce_3" />
<env name="EDGES_RPC_PORT" value="7070" />
<env name="COAP_ENABLED" value="true" />
<env name="COAP_ENABLED" value="false" />
<env name="EDGES_RPC_ENABLED" value="true" />
<env name="MQTT_BIND_PORT" value="1884" />
</envs>

2
dao/src/main/java/org/thingsboard/server/dao/model/sql/AbstractEdgeEntity.java

@ -176,4 +176,4 @@ public abstract class AbstractEdgeEntity<T extends Edge> extends BaseSqlEntity<T
edge.setAdditionalInfo(additionalInfo);
return edge;
}
}
}

6
ui-ngx/src/app/core/http/edge.service.ts

@ -76,12 +76,6 @@ export class EdgeService {
defaultHttpOptionsFromConfig(config));
}
public setRootRuleChain(edgeId: string, ruleChainId: string,
config?: RequestConfig): Observable<Edge> {
return this.http.post<Edge>(`/api/edge/${edgeId}/${ruleChainId}/root`,
defaultHttpOptionsFromConfig(config));
}
public getTenantEdgeInfos(pageLink: PageLink, type: string = '',
config?: RequestConfig): Observable<PageData<EdgeInfo>> {
return this.http.get<PageData<EdgeInfo>>(`/api/tenant/edgeInfos${pageLink.toQuery()}&type=${type}`,

6
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<Array<RuleChain>>(`/api/ruleChain/defaultEdgeRuleChains`, defaultHttpOptionsFromConfig(config));
}
public setEdgeRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable<Edge> { //TODO deaflynx EdgeInfo vs. Edge check usage
return this.http.post<Edge>(`/api/edge/${edgeId}/${ruleChainId}/root`,
defaultHttpOptionsFromConfig(config));
}
}

2
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'
},
},

26
ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts

@ -149,10 +149,10 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
if (edgeScope === 'tenant') {
columns.push(
new EntityTableColumn<EdgeInfo>('customerTitle', 'customer.customer', '25%'),
new EntityTableColumn<EdgeInfo>('customerIsPublic', 'edge.public', '60px',
/* new EntityTableColumn<EdgeInfo>('customerIsPublic', 'edge.public', '60px',
entity => {
return checkBoxCell(entity.customerIsPublic);
}, () => ({}), false),
}, () => ({}), false) */
);
}
return columns;
@ -175,12 +175,12 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
const actions: Array<CellActionDescriptor<EdgeInfo>> = [];
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<EntityTableConfig<EdgeI
});
}
makePublic($event: Event, edge: Edge) {
/* makePublic($event: Event, edge: Edge) {
if ($event) {
$event.stopPropagation();
}
@ -355,7 +355,7 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
}
}
);
}
} */
openEdgeDashboards($event, edge) {
if ($event) {
@ -474,9 +474,9 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
onEdgeAction(action: EntityAction<EdgeInfo>): 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;

6
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<RuleChainPageComponent>,
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<RuleChainPageComponent>,
auth: [Authority.TENANT_ADMIN],
title: 'edge.rulechain',
title: 'rulechain.edge-rulechain',
import: true,
ruleChainType: ruleChainType.edge
},

4
ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

@ -100,11 +100,11 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
};
if (this.config.componentsData.edgeId) {
this.config.entitySelectionEnabled = ruleChain => 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<EntityTableConfig<
).subscribe((res) => {
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();

3
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",

2
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: {

Loading…
Cancel
Save