From ffcc5be0aeea67ba2723929d427514c8ad39e8a1 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 4 Feb 2022 17:34:46 +0200 Subject: [PATCH] Removed edge license and cloud endpoint from edge instance - refactoring edge ce --- .../server/controller/BaseController.java | 4 - .../server/controller/EdgeController.java | 70 +---------- .../edge/DefaultEdgeLicenseService.java | 110 ------------------ .../service/edge/EdgeBulkImportService.java | 6 - .../service/edge/EdgeLicenseService.java | 26 ----- .../service/edge/rpc/EdgeGrpcSession.java | 2 - .../importing/BulkImportColumnType.java | 2 - .../server/controller/AbstractWebTest.java | 2 - .../controller/BaseEdgeControllerTest.java | 2 - .../server/common/data/edge/Edge.java | 20 ---- common/edge-api/src/main/proto/edge.proto | 6 +- .../server/dao/edge/EdgeServiceImpl.java | 6 - .../server/dao/model/ModelConstants.java | 2 - .../dao/model/sql/AbstractEdgeEntity.java | 14 --- .../main/resources/sql/schema-entities.sql | 2 - .../dao/service/AbstractServiceTest.java | 2 - .../dao/service/BaseDashboardServiceTest.java | 4 - .../dao/service/BaseEntityServiceTest.java | 2 - ui-ngx/src/app/core/http/entity.service.ts | 10 -- .../import-export/import-export.models.ts | 4 - .../table-columns-assignment.component.ts | 12 -- .../home/pages/edge/edge.component.html | 26 ----- .../modules/home/pages/edge/edge.component.ts | 7 -- ui-ngx/src/app/shared/models/edge.models.ts | 2 - ui-ngx/src/app/shared/models/entity.models.ts | 2 - .../assets/locale/locale.constant-cs_CZ.json | 8 -- .../assets/locale/locale.constant-de_DE.json | 6 - .../assets/locale/locale.constant-en_US.json | 10 -- .../assets/locale/locale.constant-es_ES.json | 6 - .../assets/locale/locale.constant-fr_FR.json | 6 - .../assets/locale/locale.constant-tr_TR.json | 8 -- 31 files changed, 4 insertions(+), 385 deletions(-) delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/DefaultEdgeLicenseService.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/edge/EdgeLicenseService.java diff --git a/application/src/main/java/org/thingsboard/server/controller/BaseController.java b/application/src/main/java/org/thingsboard/server/controller/BaseController.java index 3ed2d4a47d..f945cc30b7 100644 --- a/application/src/main/java/org/thingsboard/server/controller/BaseController.java +++ b/application/src/main/java/org/thingsboard/server/controller/BaseController.java @@ -123,7 +123,6 @@ import org.thingsboard.server.queue.provider.TbQueueProducerProvider; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.action.EntityActionService; import org.thingsboard.server.service.component.ComponentDiscoveryService; -import org.thingsboard.server.service.edge.EdgeLicenseService; import org.thingsboard.server.service.edge.EdgeNotificationService; import org.thingsboard.server.service.edge.rpc.EdgeRpcService; import org.thingsboard.server.service.ota.OtaPackageStateService; @@ -269,9 +268,6 @@ public abstract class BaseController { @Autowired(required = false) protected EdgeRpcService edgeGrpcService; - @Autowired(required = false) - protected EdgeLicenseService edgeLicenseService; - @Autowired protected EntityActionService entityActionService; diff --git a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java index c9e4a34ebf..5f79efaffa 100644 --- a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java +++ b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java @@ -15,7 +15,6 @@ */ package org.thingsboard.server.controller; -import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.ListenableFuture; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -23,7 +22,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -52,7 +50,6 @@ import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; import org.thingsboard.server.common.data.rule.RuleChain; -import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.dao.exception.IncorrectParameterException; import org.thingsboard.server.dao.model.ModelConstants; @@ -118,11 +115,7 @@ public class EdgeController extends BaseController { checkParameter(EDGE_ID, strEdgeId); try { EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); - Edge edge = checkEdgeId(edgeId, Operation.READ); - if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { - cleanUpLicenseKey(edge); - } - return edge; + return checkEdgeId(edgeId, Operation.READ); } catch (Exception e) { throw handleException(e); } @@ -139,11 +132,7 @@ public class EdgeController extends BaseController { checkParameter(EDGE_ID, strEdgeId); try { EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); - EdgeInfo edgeInfo = checkEdgeInfoId(edgeId, Operation.READ); - if (Authority.CUSTOMER_USER.equals(getCurrentUser().getAuthority())) { - cleanUpLicenseKey(edgeInfo); - } - return edgeInfo; + return checkEdgeInfoId(edgeId, Operation.READ); } catch (Exception e) { throw handleException(e); } @@ -525,11 +514,6 @@ public class EdgeController extends BaseController { } else { result = edgeService.findEdgesByTenantIdAndCustomerId(tenantId, customerId, pageLink); } - if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { - for (Edge edge : result.getData()) { - cleanUpLicenseKey(edge); - } - } return checkNotNull(result); } catch (Exception e) { throw handleException(e); @@ -570,11 +554,6 @@ public class EdgeController extends BaseController { } else { result = edgeService.findEdgeInfosByTenantIdAndCustomerId(tenantId, customerId, pageLink); } - if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { - for (Edge edge : result.getData()) { - cleanUpLicenseKey(edge); - } - } return checkNotNull(result); } catch (Exception e) { throw handleException(e); @@ -606,11 +585,6 @@ public class EdgeController extends BaseController { edgesFuture = edgeService.findEdgesByTenantIdCustomerIdAndIdsAsync(tenantId, customerId, edgeIds); } List edges = edgesFuture.get(); - if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { - for (Edge edge : edges) { - cleanUpLicenseKey(edge); - } - } return checkNotNull(edges); } catch (Exception e) { throw handleException(e); @@ -642,11 +616,6 @@ public class EdgeController extends BaseController { return false; } }).collect(Collectors.toList()); - if (Authority.CUSTOMER_USER.equals(user.getAuthority())) { - for (Edge edge : edges) { - cleanUpLicenseKey(edge); - } - } return edges; } catch (Exception e) { throw handleException(e); @@ -732,39 +701,4 @@ public class EdgeController extends BaseController { } }); } - - private void cleanUpLicenseKey(Edge edge) { - edge.setEdgeLicenseKey(null); - } - - @ApiOperation(value = "Check edge license (checkInstance)", - notes = "Checks license request from edge service by forwarding request to license portal.", - produces = MediaType.APPLICATION_JSON_VALUE) - @RequestMapping(value = "/license/checkInstance", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity checkInstance(@RequestBody JsonNode request) throws ThingsboardException { - log.debug("Checking instance [{}]", request); - try { - return edgeLicenseService.checkInstance(request); - } catch (Exception e) { - log.error("Error occurred: [{}]", e.getMessage(), e); - throw new ThingsboardException(e, ThingsboardErrorCode.SUBSCRIPTION_VIOLATION); - } - } - - @ApiOperation(value = "Activate edge instance (activateInstance)", - notes = "Activates edge license on license portal.", - produces = MediaType.APPLICATION_JSON_VALUE) - @RequestMapping(value = "/license/activateInstance", params = {"licenseSecret", "releaseDate"}, method = RequestMethod.POST) - @ResponseBody - public ResponseEntity activateInstance(@RequestParam String licenseSecret, - @RequestParam String releaseDate) throws ThingsboardException { - log.debug("Activating instance [{}], [{}]", licenseSecret, releaseDate); - try { - return edgeLicenseService.activateInstance(licenseSecret, releaseDate); - } catch (Exception e) { - log.error("Error occurred: [{}]", e.getMessage(), e); - throw new ThingsboardException(e, ThingsboardErrorCode.SUBSCRIPTION_VIOLATION); - } - } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/DefaultEdgeLicenseService.java b/application/src/main/java/org/thingsboard/server/service/edge/DefaultEdgeLicenseService.java deleted file mode 100644 index 034ac51484..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/DefaultEdgeLicenseService.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright © 2016-2022 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge; - -import com.fasterxml.jackson.databind.JsonNode; -import lombok.extern.slf4j.Slf4j; -import org.apache.http.HttpHost; -import org.apache.http.conn.ssl.DefaultHostnameVerifier; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; -import org.thingsboard.server.queue.util.TbCoreComponent; - -import javax.annotation.PostConstruct; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.util.HashMap; -import java.util.Map; - -import static org.apache.commons.lang3.StringUtils.isNotEmpty; - -@Service -@TbCoreComponent -@Slf4j -public class DefaultEdgeLicenseService implements EdgeLicenseService { - - private RestTemplate restTemplate; - - private static final String EDGE_LICENSE_SERVER_ENDPOINT = "https://license.thingsboard.io"; - - @Value("${edges.enabled:false}") - private boolean edgesEnabled; - - @PostConstruct - public void init() { - if (edgesEnabled) { - initRestTemplate(); - } - } - - @Override - public ResponseEntity checkInstance(JsonNode request) { - return this.restTemplate.postForEntity(EDGE_LICENSE_SERVER_ENDPOINT + "/api/license/checkInstance", request, JsonNode.class); - } - - @Override - public ResponseEntity activateInstance(String edgeLicenseSecret, String releaseDate) { - Map params = new HashMap<>(); - params.put("licenseSecret", edgeLicenseSecret); - params.put("releaseDate", releaseDate); - return this.restTemplate.postForEntity(EDGE_LICENSE_SERVER_ENDPOINT + "/api/license/activateInstance?licenseSecret={licenseSecret}&releaseDate={releaseDate}", null, JsonNode.class, params); - } - - private void initRestTemplate() { - boolean jdkHttpClientEnabled = isNotEmpty(System.getProperty("tb.proxy.jdk")) && System.getProperty("tb.proxy.jdk").equalsIgnoreCase("true"); - boolean systemProxyEnabled = isNotEmpty(System.getProperty("tb.proxy.system")) && System.getProperty("tb.proxy.system").equalsIgnoreCase("true"); - boolean proxyEnabled = isNotEmpty(System.getProperty("tb.proxy.host")) && isNotEmpty(System.getProperty("tb.proxy.port")); - if (jdkHttpClientEnabled) { - log.warn("Going to use plain JDK Http Client!"); - SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - if (proxyEnabled) { - log.warn("Going to use Proxy Server: [{}:{}]", System.getProperty("tb.proxy.host"), System.getProperty("tb.proxy.port")); - factory.setProxy(new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(System.getProperty("tb.proxy.host"), Integer.parseInt(System.getProperty("tb.proxy.port"))))); - } - - this.restTemplate = new RestTemplate(new SimpleClientHttpRequestFactory()); - } else { - CloseableHttpClient httpClient; - HttpComponentsClientHttpRequestFactory requestFactory; - if (systemProxyEnabled) { - log.warn("Going to use System Proxy Server!"); - httpClient = HttpClients.createSystem(); - requestFactory = new HttpComponentsClientHttpRequestFactory(); - requestFactory.setHttpClient(httpClient); - this.restTemplate = new RestTemplate(requestFactory); - } else if (proxyEnabled) { - log.warn("Going to use Proxy Server: [{}:{}]", System.getProperty("tb.proxy.host"), System.getProperty("tb.proxy.port")); - httpClient = HttpClients.custom().setSSLHostnameVerifier(new DefaultHostnameVerifier()).setProxy(new HttpHost(System.getProperty("tb.proxy.host"), Integer.parseInt(System.getProperty("tb.proxy.port")), "https")).build(); - requestFactory = new HttpComponentsClientHttpRequestFactory(); - requestFactory.setHttpClient(httpClient); - this.restTemplate = new RestTemplate(requestFactory); - } else { - httpClient = HttpClients.custom().setSSLHostnameVerifier(new DefaultHostnameVerifier()).build(); - requestFactory = new HttpComponentsClientHttpRequestFactory(); - requestFactory.setHttpClient(httpClient); - this.restTemplate = new RestTemplate(requestFactory); - } - } - } -} - - diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeBulkImportService.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeBulkImportService.java index 8b86490447..ff393a2b3d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeBulkImportService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeBulkImportService.java @@ -55,12 +55,6 @@ public class EdgeBulkImportService extends AbstractBulkImportService { case DESCRIPTION: additionalInfo.set("description", new TextNode(value)); break; - case EDGE_LICENSE_KEY: - entity.setEdgeLicenseKey(value); - break; - case CLOUD_ENDPOINT: - entity.setCloudEndpoint(value); - break; case ROUTING_KEY: entity.setRoutingKey(value); break; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeLicenseService.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeLicenseService.java deleted file mode 100644 index aa4d281aba..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeLicenseService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2016-2022 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.edge; - -import com.fasterxml.jackson.databind.JsonNode; -import org.springframework.http.ResponseEntity; - -public interface EdgeLicenseService { - - ResponseEntity checkInstance(JsonNode request); - - ResponseEntity activateInstance(String licenseSecret, String releaseDate); -} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 632bac27aa..fdcbdbd849 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -690,8 +690,6 @@ public final class EdgeGrpcSession implements Closeable { .setType(edge.getType()) .setRoutingKey(edge.getRoutingKey()) .setSecret(edge.getSecret()) - .setEdgeLicenseKey(edge.getEdgeLicenseKey()) - .setCloudEndpoint(edge.getCloudEndpoint()) .setAdditionalInfo(JacksonUtil.toString(edge.getAdditionalInfo())) .setCloudType("CE"); if (edge.getCustomerId() != null) { diff --git a/application/src/main/java/org/thingsboard/server/service/importing/BulkImportColumnType.java b/application/src/main/java/org/thingsboard/server/service/importing/BulkImportColumnType.java index c7698df87b..96075eb4c8 100644 --- a/application/src/main/java/org/thingsboard/server/service/importing/BulkImportColumnType.java +++ b/application/src/main/java/org/thingsboard/server/service/importing/BulkImportColumnType.java @@ -45,8 +45,6 @@ public enum BulkImportColumnType { LWM2M_SERVER_CLIENT_SECRET_KEY("clientSecretKey"), IS_GATEWAY, DESCRIPTION, - EDGE_LICENSE_KEY, - CLOUD_ENDPOINT, ROUTING_KEY, SECRET; diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java index 6cbf5d82d0..6625bdefc7 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java @@ -606,8 +606,6 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest { edge.setType(type); edge.setSecret(RandomStringUtils.randomAlphanumeric(20)); edge.setRoutingKey(RandomStringUtils.randomAlphanumeric(20)); - edge.setEdgeLicenseKey(RandomStringUtils.randomAlphanumeric(20)); - edge.setCloudEndpoint("http://localhost:8080"); return edge; } } diff --git a/application/src/test/java/org/thingsboard/server/controller/BaseEdgeControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseEdgeControllerTest.java index e4cab0cca7..6bf1a6f1d2 100644 --- a/application/src/test/java/org/thingsboard/server/controller/BaseEdgeControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseEdgeControllerTest.java @@ -105,8 +105,6 @@ public abstract class BaseEdgeControllerTest extends AbstractControllerTest { Assert.assertNotNull(savedEdge.getCustomerId()); Assert.assertEquals(NULL_UUID, savedEdge.getCustomerId().getId()); Assert.assertEquals(edge.getName(), savedEdge.getName()); - Assert.assertTrue(StringUtils.isNoneBlank(savedEdge.getEdgeLicenseKey())); - Assert.assertTrue(StringUtils.isNoneBlank(savedEdge.getCloudEndpoint())); savedEdge.setName("My new edge"); doPost("/api/edge", savedEdge, Edge.class); 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 aedbd17bcf..4a4cd1afc4 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 @@ -57,12 +57,6 @@ public class Edge extends SearchTextBasedWithAdditionalInfo implements H @NoXss @Length(fieldName = "secret") private String secret; - @NoXss - @Length(fieldName = "edgeLicenseKey", max = 30) - private String edgeLicenseKey; - @NoXss - @Length(fieldName = "cloudEndpoint") - private String cloudEndpoint; public Edge() { super(); @@ -82,8 +76,6 @@ public class Edge extends SearchTextBasedWithAdditionalInfo implements H this.name = edge.getName(); this.routingKey = edge.getRoutingKey(); this.secret = edge.getSecret(); - this.edgeLicenseKey = edge.getEdgeLicenseKey(); - this.cloudEndpoint = edge.getCloudEndpoint(); } public void update(Edge edge) { @@ -95,8 +87,6 @@ public class Edge extends SearchTextBasedWithAdditionalInfo implements H this.name = edge.getName(); this.routingKey = edge.getRoutingKey(); this.secret = edge.getSecret(); - this.edgeLicenseKey = edge.getEdgeLicenseKey(); - this.cloudEndpoint = edge.getCloudEndpoint(); } @ApiModelProperty(position = 1, value = "JSON object with the Edge Id. " + @@ -162,14 +152,4 @@ public class Edge extends SearchTextBasedWithAdditionalInfo implements H return this.secret; } - @ApiModelProperty(position = 11, required = true, value = "Edge license key obtained from license portal", example = "AgcnI24Z06XC&m6Sxsdgf") - public String getEdgeLicenseKey() { - return this.edgeLicenseKey; - } - - @ApiModelProperty(position = 12, required = true, value = "Edge uses this cloud URL to activate and periodically check it's license", example = "https://thingsboard.cloud") - public String getCloudEndpoint() { - return this.cloudEndpoint; - } - } diff --git a/common/edge-api/src/main/proto/edge.proto b/common/edge-api/src/main/proto/edge.proto index 0d39f16140..2bc6a18d6e 100644 --- a/common/edge-api/src/main/proto/edge.proto +++ b/common/edge-api/src/main/proto/edge.proto @@ -99,10 +99,8 @@ message EdgeConfiguration { string type = 8; string routingKey = 9; string secret = 10; - string edgeLicenseKey = 11; - string cloudEndpoint = 12; - string additionalInfo = 13; - string cloudType = 14; + string additionalInfo = 11; + string cloudType = 12; } enum UpdateMsgType { diff --git a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java index 31ed496b9e..3cdbcf7bc9 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java @@ -404,12 +404,6 @@ public class EdgeServiceImpl extends AbstractEntityService implements EdgeServic if (StringUtils.isEmpty(edge.getRoutingKey())) { throw new DataValidationException("Edge routing key should be specified!"); } - if (StringUtils.isEmpty(edge.getEdgeLicenseKey())) { - throw new DataValidationException("Edge license key should be specified!"); - } - if (StringUtils.isEmpty(edge.getCloudEndpoint())) { - throw new DataValidationException("Cloud endpoint should be specified!"); - } if (edge.getTenantId() == null) { throw new DataValidationException("Edge should be assigned to tenant!"); } else { diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java index 5afcd894ea..8f692d5a12 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java @@ -544,8 +544,6 @@ public class ModelConstants { public static final String EDGE_ROUTING_KEY_PROPERTY = "routing_key"; public static final String EDGE_SECRET_PROPERTY = "secret"; - public static final String EDGE_LICENSE_KEY_PROPERTY = "edge_license_key"; - public static final String EDGE_CLOUD_ENDPOINT_KEY_PROPERTY = "cloud_endpoint"; /** * Edge queue constants. 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 e1e49cc018..40ef7d82ab 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 @@ -35,10 +35,8 @@ import javax.persistence.Column; import javax.persistence.MappedSuperclass; import java.util.UUID; -import static org.thingsboard.server.dao.model.ModelConstants.EDGE_CLOUD_ENDPOINT_KEY_PROPERTY; import static org.thingsboard.server.dao.model.ModelConstants.EDGE_CUSTOMER_ID_PROPERTY; import static org.thingsboard.server.dao.model.ModelConstants.EDGE_LABEL_PROPERTY; -import static org.thingsboard.server.dao.model.ModelConstants.EDGE_LICENSE_KEY_PROPERTY; import static org.thingsboard.server.dao.model.ModelConstants.EDGE_NAME_PROPERTY; import static org.thingsboard.server.dao.model.ModelConstants.EDGE_ROOT_RULE_CHAIN_ID_PROPERTY; import static org.thingsboard.server.dao.model.ModelConstants.EDGE_ROUTING_KEY_PROPERTY; @@ -80,12 +78,6 @@ public abstract class AbstractEdgeEntity extends BaseSqlEntity extends BaseSqlEntity extends BaseSqlEntity extends BaseSqlEntity column.type === ImportEntityColumnType.type) > -1; const isSelectLabel = this.columns.findIndex((column) => column.type === ImportEntityColumnType.label) > -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; @@ -171,14 +167,6 @@ export class TableColumnsAssignmentComponent implements OnInit, ControlValueAcce }); } - 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; diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge.component.html b/ui-ngx/src/app/modules/home/pages/edge/edge.component.html index 1ea725db13..6acc4cba0c 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge.component.html +++ b/ui-ngx/src/app/modules/home/pages/edge/edge.component.html @@ -141,32 +141,6 @@ [required]="true" [entityType]="entityType.EDGE"> -
-
- - edge.edge-license-key - - - {{ 'edge.edge-license-key-required' | translate }} - - - {{ 'edge.edge-license-key-max-length' | translate }} - - -
-
-
edge.cloud-endpoint-hint
- - edge.cloud-endpoint - - - {{ 'edge.cloud-endpoint-required' | translate }} - - - {{ 'edge.cloud-endpoint-max-length' | translate }} - - -
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 515e0a3b0d..00a9390eeb 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 @@ -49,9 +49,6 @@ export class EdgeComponent extends EntityComponent { ngOnInit() { this.edgeScope = this.entitiesTableConfig.componentsData.edgeScope; - this.entityForm.patchValue({ - cloudEndpoint: window.location.origin - }); super.ngOnInit(); } @@ -73,8 +70,6 @@ export class EdgeComponent extends EntityComponent { name: [entity ? entity.name : '', [Validators.required, Validators.maxLength(255)]], type: [entity?.type ? entity.type : 'default', [Validators.required, Validators.maxLength(255)]], label: [entity ? entity.label : '', Validators.maxLength(255)], - cloudEndpoint: [null, [Validators.required, Validators.maxLength(255)]], - edgeLicenseKey: ['', [Validators.required, Validators.maxLength(30)]], routingKey: this.fb.control({value: entity ? entity.routingKey : null, disabled: true}), secret: this.fb.control({value: entity ? entity.secret : null, disabled: true}), additionalInfo: this.fb.group( @@ -93,8 +88,6 @@ export class EdgeComponent extends EntityComponent { name: entity.name, type: entity.type, label: entity.label, - cloudEndpoint: entity.cloudEndpoint ? entity.cloudEndpoint : window.location.origin, - edgeLicenseKey: entity.edgeLicenseKey, routingKey: entity.routingKey, secret: entity.secret, additionalInfo: { diff --git a/ui-ngx/src/app/shared/models/edge.models.ts b/ui-ngx/src/app/shared/models/edge.models.ts index 1fbc2df344..7ffe7270f3 100644 --- a/ui-ngx/src/app/shared/models/edge.models.ts +++ b/ui-ngx/src/app/shared/models/edge.models.ts @@ -30,8 +30,6 @@ export interface Edge extends BaseData { type: string; secret: string; routingKey: string; - cloudEndpoint: string; - edgeLicenseKey: string; label?: string; additionalInfo?: any; rootRuleChainId?: RuleChainId; diff --git a/ui-ngx/src/app/shared/models/entity.models.ts b/ui-ngx/src/app/shared/models/entity.models.ts index c23b38fed4..8bcfa6c34a 100644 --- a/ui-ngx/src/app/shared/models/entity.models.ts +++ b/ui-ngx/src/app/shared/models/entity.models.ts @@ -56,8 +56,6 @@ export interface ImportEntityData { export interface EdgeImportEntityData extends ImportEntityData { secret: string; routingKey: string; - cloudEndpoint: string; - edgeLicenseKey: string; } export interface ImportEntitiesResultInfo { diff --git a/ui-ngx/src/assets/locale/locale.constant-cs_CZ.json b/ui-ngx/src/assets/locale/locale.constant-cs_CZ.json index 903afc2c9d..dd4b9cc0b0 100644 --- a/ui-ngx/src/assets/locale/locale.constant-cs_CZ.json +++ b/ui-ngx/src/assets/locale/locale.constant-cs_CZ.json @@ -1389,12 +1389,6 @@ "name": "Název", "name-starts-with": "Název edge začíná", "name-required": "Název je povinný.", - "edge-license-key": "Licenční klíč edge", - "edge-license-key-required": "Licenční klíč edge je povinný.", - "edge-license-key-hint": "Pro získání licence jděte na pricing page a vyberte is vhodnou licenci.", - "cloud-endpoint": "Cloud Endpoint", - "cloud-endpoint-required": "Cloud Endpoint je povinný.", - "cloud-endpoint-hint": "Edge vyžaduje HTTP(s) přístup do Cloudu (ThingsBoard CE/PE) pro ověření licenčního klíče. Zadejte prosím Cloud URL, ke které se může edge připojit.", "description": "Popis", "details": "Detail", "events": "Události", @@ -2168,8 +2162,6 @@ "isgateway": "Je bránou", "activity-time-from-gateway-device": "Čas aktivity ze zařízení brány", "description": "Popis", - "edge-license-key": "Licenční klíč", - "cloud-endpoint": "Cloud Endpoint", "routing-key": "Klíč edge", "secret": "Edge secret" }, 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 f3f96a3a53..59adb6bf31 100644 --- a/ui-ngx/src/assets/locale/locale.constant-de_DE.json +++ b/ui-ngx/src/assets/locale/locale.constant-de_DE.json @@ -752,12 +752,6 @@ "name": "Name", "name-starts-with": "Der Kantenname beginnt mit", "name-required": "Name ist erforderlich.", - "edge-license-key": "Edge Lizenzschlüssel", - "edge-license-key-required": "Edge Lizenzschlüssel ist erforderlich.", - "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.", - "cloud-endpoint": "Cloud-Endpunkt", - "cloud-endpoint-required": "Cloud-Endpunkt ist erforderlich.", - "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.", "description": "Beschreibung", "details": "Details", "events": "Ereignisse", 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 bb1e9cdd37..0845ee351d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1487,14 +1487,6 @@ "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.", - "edge-license-key-max-length": "Edge License Key should be less than 31", - "edge-license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", - "cloud-endpoint": "Cloud Endpoint", - "cloud-endpoint-required": "Cloud Endpoint is required.", - "cloud-endpoint-max-length": "Cloud Endpoint should be less than 256", - "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.", "description": "Description", "details": "Details", "events": "Events", @@ -2300,8 +2292,6 @@ "isgateway": "Is Gateway", "activity-time-from-gateway-device": "Activity time from gateway device", "description": "Description", - "edge-license-key": "License Key", - "cloud-endpoint": "Cloud Endpoint", "routing-key": "Edge key", "secret": "Edge secret" }, 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 963334cc88..caadecc9ae 100644 --- a/ui-ngx/src/assets/locale/locale.constant-es_ES.json +++ b/ui-ngx/src/assets/locale/locale.constant-es_ES.json @@ -1126,12 +1126,6 @@ "name": "Nombre", "name-starts-with": "Edge name starts with", "name-required": "Se requiere nombre", - "edge-license-key": "Edge Clave de licencia", - "edge-license-key-required": "Se requiere edge clave de licencia", - "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.", - "cloud-endpoint": "Punto final de la nube", - "cloud-endpoint-required": "Se requiere punto final de la nube", - "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.", "description": "Descripción", "details": "Detalles", "events": "Eventos", 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 02aef41b95..bf9b25df6b 100644 --- a/ui-ngx/src/assets/locale/locale.constant-fr_FR.json +++ b/ui-ngx/src/assets/locale/locale.constant-fr_FR.json @@ -758,12 +758,6 @@ "name": "Nom", "name-starts-with": "Le nom du bord commence par", "name-required": "Le nom de la bordure est requis", - "edge-license-key": "Edge Clé de licence", - "edge-license-key-required": "La edge clé de licence est requise", - "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": "Clé de licence", - "cloud-endpoint-required": "La clé de licence est requise", - "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.", "description": "Dispositifs", "details": "Détails de l'entité", "events": "Événements", diff --git a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json index 5ecc3ed23a..76d8c99709 100644 --- a/ui-ngx/src/assets/locale/locale.constant-tr_TR.json +++ b/ui-ngx/src/assets/locale/locale.constant-tr_TR.json @@ -1404,12 +1404,6 @@ "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.", - "edge-license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", - "cloud-endpoint": "Cloud Endpoint", - "cloud-endpoint-required": "Cloud Endpoint is required.", - "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.", "description": "Description", "details": "Details", "events": "Events", @@ -2183,8 +2177,6 @@ "isgateway": "Ağ Geçidi", "activity-time-from-gateway-device": "Ağ geçidi cihazından etkinlik süresi", "description": "Açıklama", - "edge-license-key": "Lisans anahtarı", - "cloud-endpoint": "Bulut Uç Noktası", "routing-key": "Uç Anahtarı", "secret": "Uç Secret" },