From d20957dbb167fa5252115e518fba5de6481c46a9 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 11 May 2022 13:49:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B5=84=E6=BA=90=E6=B1=A0?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SystemParameterController.java | 8 --- .../settings/system/TestResourcePool.vue | 56 ++++++------------- .../settings/system/test-resource-pool.js | 12 +--- 3 files changed, 21 insertions(+), 55 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java index 6138d95135..ff2f61071a 100644 --- a/backend/src/main/java/io/metersphere/controller/SystemParameterController.java +++ b/backend/src/main/java/io/metersphere/controller/SystemParameterController.java @@ -6,7 +6,6 @@ import io.metersphere.base.domain.UserHeader; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogModule; import io.metersphere.commons.constants.ParamConstants; -import io.metersphere.config.KafkaProperties; import io.metersphere.controller.request.HeaderRequest; import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.SystemStatisticData; @@ -37,8 +36,6 @@ public class SystemParameterController { private WorkspaceService workspaceService; @Resource private ProjectService projectService; - @Resource - private KafkaProperties kafkaProperties; @PostMapping("/edit/email") @MsAuditLog(module = OperLogModule.SYSTEM_PARAMETER_SETTING, type = OperLogConstants.UPDATE, title = "邮件设置", beforeEvent = "#msClass.getMailLogDetails()", content = "#msClass.getMailLogDetails()", msClass = SystemParameterService.class) @@ -56,11 +53,6 @@ public class SystemParameterController { return systemParameterService.getVersion(); } - @GetMapping("/kafka-servers") - public String getKafkaBootstrapServers() { - return kafkaProperties.getBootstrapServers(); - } - @GetMapping("/theme") public String getTheme() { return systemParameterService.getValue("ui.theme"); diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index caf3b0a0e5..41ba74b135 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -87,21 +87,7 @@ - - + Node @@ -127,28 +113,29 @@ - + - - - - - - - - - + @@ -323,14 +310,12 @@ export default { haveTestUsePool: false }, apiImage: '', - kafkaBootstrapServers: '', apiImageTag: '', }; }, activated() { this.initTableData(); this.getApiImageTag(); - this.getKafkaBootstrapServers(); }, methods: { initTableData() { @@ -583,7 +568,7 @@ export default { this.result.loading = false; }); }, - downloadYaml(item) { + downloadYaml(item, deployType) { if (!item.namespace) { this.$error(this.$t('test_resource_pool.fill_the_data')); return; @@ -596,20 +581,15 @@ export default { if (item.apiImage) { apiImage = item.apiImage; } - let yaml = getYaml(item.deployType, item.deployName, item.namespace, apiImage, this.kafkaBootstrapServers); + let yaml = getYaml(deployType, item.deployName, item.namespace, apiImage); let blob = new Blob([yaml], {type: 'application/yaml'}); let url = URL.createObjectURL(blob); let downloadAnchorNode = document.createElement('a') downloadAnchorNode.setAttribute("href", url); - downloadAnchorNode.setAttribute("download", item.deployType.toLowerCase() + ".yaml") + downloadAnchorNode.setAttribute("download", deployType.toLowerCase() + ".yaml") downloadAnchorNode.click(); downloadAnchorNode.remove(); }, - getKafkaBootstrapServers() { - this.$get('/system/kafka-servers', response => { - this.kafkaBootstrapServers = response.data; - }) - }, getApiImageTag() { this.$get('/system/version', response => { if (!response.data) { diff --git a/frontend/src/business/components/settings/system/test-resource-pool.js b/frontend/src/business/components/settings/system/test-resource-pool.js index 2befe63929..e1f23b79a8 100644 --- a/frontend/src/business/components/settings/system/test-resource-pool.js +++ b/frontend/src/business/components/settings/system/test-resource-pool.js @@ -28,8 +28,6 @@ spec: weight: 100 containers: - env: - - name: KAFKA_BOOTSTRAP-SERVERS - value: {kafkaBootstrapServers} image: {image} imagePullPolicy: IfNotPresent name: ms-node-controller @@ -77,8 +75,6 @@ spec: weight: 100 containers: - env: - - name: KAFKA_BOOTSTRAP-SERVERS - value: {kafkaBootstrapServers} image: {image} imagePullPolicy: IfNotPresent name: ms-node-controller @@ -155,20 +151,18 @@ rules: - delete ` -export function getYaml(type, name, namespace, image, kafkaBootstrapServers) { +export function getYaml(type, name, namespace, image) { if (type === 'Deployment') { return deployment .replace('{name}', name) .replace('{namespace}', namespace) - .replace('{image}', image) - .replace('{kafkaBootstrapServers}', kafkaBootstrapServers); + .replace('{image}', image); } if (type === 'DaemonSet') { return daemonSet .replace('{name}', name) .replace('{namespace}', namespace) - .replace('{image}', image) - .replace('{kafkaBootstrapServers}', kafkaBootstrapServers); + .replace('{image}', image); } if (type === 'sa') { return sa.replace('{namespace}', namespace);