Added support for EDGE entity

This commit is contained in:
Volodymyr Babak 2020-12-13 19:28:05 +02:00
parent 0ce128725d
commit b48d43f4dd
5 changed files with 41 additions and 14 deletions

View File

@ -66,6 +66,7 @@ import org.thingsboard.server.common.data.security.UserCredentials;
import org.thingsboard.server.common.data.widget.WidgetType;
import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.common.transport.util.JsonUtils;
import org.thingsboard.server.dao.util.mapping.JacksonUtil;
import org.thingsboard.server.gen.edge.AdminSettingsUpdateMsg;
import org.thingsboard.server.gen.edge.AlarmUpdateMsg;
import org.thingsboard.server.gen.edge.AssetUpdateMsg;
@ -957,17 +958,24 @@ public final class EdgeGrpcSession implements Closeable {
}
private EdgeConfiguration constructEdgeConfigProto(Edge edge) {
return EdgeConfiguration.newBuilder()
EdgeConfiguration.Builder builder = EdgeConfiguration.newBuilder()
.setEdgeIdMSB(edge.getId().getId().getMostSignificantBits())
.setEdgeIdLSB(edge.getId().getId().getLeastSignificantBits())
.setTenantIdMSB(edge.getTenantId().getId().getMostSignificantBits())
.setTenantIdLSB(edge.getTenantId().getId().getLeastSignificantBits())
.setName(edge.getName())
.setRoutingKey(edge.getRoutingKey())
.setType(edge.getType())
.setRoutingKey(edge.getRoutingKey())
.setSecret(edge.getSecret())
.setEdgeLicenseKey(edge.getEdgeLicenseKey())
.setCloudEndpoint(edge.getCloudEndpoint())
.setCloudType("CE")
.setConfiguration(JacksonUtil.toString(edge.getConfiguration()))
.setCloudType("CE");
if (edge.getCustomerId() != null) {
builder.setCustomerIdMSB(edge.getCustomerId().getId().getMostSignificantBits())
.setCustomerIdLSB(edge.getCustomerId().getId().getLeastSignificantBits());
}
return builder
.build();
}

View File

@ -79,12 +79,16 @@ message EdgeConfiguration {
int64 edgeIdLSB = 2;
int64 tenantIdMSB = 3;
int64 tenantIdLSB = 4;
string name = 5;
string routingKey = 6;
string type = 7;
string edgeLicenseKey = 8;
string cloudEndpoint = 9;
string cloudType = 10;
int64 customerIdMSB = 5;
int64 customerIdLSB = 6;
string name = 7;
string type = 8;
string routingKey = 9;
string secret = 10;
string edgeLicenseKey = 11;
string cloudEndpoint = 12;
string configuration = 13;
string cloudType = 14;
}
enum UpdateMsgType {

View File

@ -195,9 +195,11 @@ public class HashPartitionService implements PartitionService {
if (current.getServiceTypesList().contains(serviceType.name())) {
result.add(current.getServiceId());
}
for (ServiceInfo serviceInfo : currentOtherServices) {
if (serviceInfo.getServiceTypesList().contains(serviceType.name())) {
result.add(serviceInfo.getServiceId());
if (currentOtherServices != null) {
for (ServiceInfo serviceInfo : currentOtherServices) {
if (serviceInfo.getServiceTypesList().contains(serviceType.name())) {
result.add(serviceInfo.getServiceId());
}
}
}
return result;

View File

@ -153,6 +153,7 @@ export default function EntityFilterViewDirective($compile, $templateCache, $q,
case types.aliasFilterType.assetSearchQuery.value:
case types.aliasFilterType.deviceSearchQuery.value:
case types.aliasFilterType.entityViewSearchQuery.value:
case types.aliasFilterType.edgeSearchQuery.value:
allEntitiesText = $translate.instant('alias.all-entities');
anyRelationText = $translate.instant('alias.any-relation');
if (scope.filter.rootStateEntity) {
@ -204,6 +205,16 @@ export default function EntityFilterViewDirective($compile, $templateCache, $q,
scope.filterDisplayValue = $translate.instant('alias.filter-type-entity-view-search-query-description',
translationValues
);
} else if (scope.filter.type == types.aliasFilterType.edgeSearchQuery.value) {
var edgeTypesQuoted = [];
scope.filter.edgeTypes.forEach(function(edgeType) {
edgeTypesQuoted.push("'"+edgeType+"'");
});
var edgeTypesText = edgeTypesQuoted.join(', ');
translationValues.edgeTypes = edgeTypesText;
scope.filterDisplayValue = $translate.instant('alias.filter-type-edge-search-query-description',
translationValues
);
}
break;
default:

View File

@ -200,10 +200,11 @@
"filter-type-device-type-description": "Devices of type '{{deviceType}}'",
"filter-type-device-type-and-name-description": "Devices of type '{{deviceType}}' and with name starting with '{{prefix}}'",
"filter-type-entity-view-type": "Entity View type",
"filter-type-entity-view-type-description": "Entity Views of type '{{entityView}}'",
"filter-type-entity-view-type-and-name-description": "Entity Views of type '{{entityView}}' and with name starting with '{{prefix}}'",
"filter-type-entity-view-type-description": "Entity Views of type '{{entityViewType}}'",
"filter-type-entity-view-type-and-name-description": "Entity Views of type '{{entityViewType}}' and with name starting with '{{prefix}}'",
"filter-type-edge-type": "Edge type",
"filter-type-edge-type-description": "Edges of type '{{edgeType}}'",
"filter-type-edge-type-and-name-description": "Edges of type '{{edgeType}}' and with name starting with '{{prefix}}'",
"filter-type-relations-query": "Relations query",
"filter-type-relations-query-description": "{{entities}} that have {{relationType}} relation {{direction}} {{rootEntity}}",
"filter-type-asset-search-query": "Asset search query",
@ -779,6 +780,7 @@
"delete-edges-action-title": "Delete { count, plural, 1 {1 edge} other {# edges} }",
"delete-edges-text": "Be careful, after the confirmation all selected edges will be removed and all related data will become unrecoverable.",
"name": "Name",
"name-starts-with": "Edge name starts with",
"name-required": "Name is required.",
"edge-license-key": "Edge License Key",
"edge-license-key-required": "Edge License Key is required.",