From ea9fa5aa1c5cf29b0f0b54e9788e3bccbd78d8b8 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 18 Apr 2024 16:39:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037584 --user=王孝刚 【项目管理】环境管理-环境名称重命名功能未实现 https://www.tapd.cn/55049933/s/1501133 --- .../metersphere/project/service/EnvironmentService.java | 7 +++---- frontend/src/models/projectManagement/environmental.ts | 1 + .../environmental/components/RenamePop.vue | 8 +++++--- .../src/views/project-management/environmental/index.vue | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentService.java index faae6ba9d5..66949ee56a 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentService.java @@ -320,11 +320,10 @@ public class EnvironmentService extends MoveNodeService { environmentMapper.updateByPrimaryKeySelective(environment); EnvironmentBlob environmentBlob = new EnvironmentBlob(); environmentBlob.setId(environment.getId()); - if (request.getConfig() == null) { - request.setConfig(new EnvironmentConfig()); + if (request.getConfig() != null) { + environmentBlob.setConfig(JSON.toJSONBytes(request.getConfig())); + environmentBlobMapper.updateByPrimaryKeySelective(environmentBlob); } - environmentBlob.setConfig(JSON.toJSONBytes(request.getConfig())); - environmentBlobMapper.updateByPrimaryKeySelective(environmentBlob); uploadFileToMinio(sslFiles, environment); return environment; } diff --git a/frontend/src/models/projectManagement/environmental.ts b/frontend/src/models/projectManagement/environmental.ts index e7af0bd7d2..be9cc0dab1 100644 --- a/frontend/src/models/projectManagement/environmental.ts +++ b/frontend/src/models/projectManagement/environmental.ts @@ -5,6 +5,7 @@ export interface EnvListItem { mock?: boolean; name: string; id: string; + description: string; } export interface EnvGroupProjectListItem { diff --git a/frontend/src/views/project-management/environmental/components/RenamePop.vue b/frontend/src/views/project-management/environmental/components/RenamePop.vue index 6f155c2821..c76930e700 100644 --- a/frontend/src/views/project-management/environmental/components/RenamePop.vue +++ b/frontend/src/views/project-management/environmental/components/RenamePop.vue @@ -42,7 +42,7 @@ import { useAppStore } from '@/store'; import useProjectEnvStore, { NEW_ENV_GROUP } from '@/store/modules/setting/useProjectEnvStore'; - import { EnvListItem } from '@/models/projectManagement/environmental'; + import { EnvDetailItem, EnvListItem } from '@/models/projectManagement/environmental'; import { EnvAuthScopeEnum } from '@/enums/envEnum'; import type { FormInstance, ValidatedError } from '@arco-design/web-vue'; @@ -81,7 +81,7 @@ if (value === props.defaultName) { callback(); } else { - const isExist = props.list.some((item) => item.name === value); + const isExist = props.list.some((item) => item.name === value && item.id !== props.id); if (isExist) { callback(t('system.userGroup.userGroupNameIsExist', { name: value })); } @@ -103,7 +103,9 @@ loading.value = true; if (props.type === EnvAuthScopeEnum.PROJECT) { - await updateOrAddEnv({ fileList: [], request: { ...store.currentEnvDetailInfo, name: form.name } }); + const envListItem = props.list.filter((item) => item.id === props.id)[0] as EnvDetailItem; + envListItem.name = form.name; + await updateOrAddEnv({ fileList: [], request: envListItem }); } else { const id = store.currentGroupId === NEW_ENV_GROUP ? undefined : store.currentGroupId; if (id) { diff --git a/frontend/src/views/project-management/environmental/index.vue b/frontend/src/views/project-management/environmental/index.vue index edc0c8aefb..106c95f878 100644 --- a/frontend/src/views/project-management/environmental/index.vue +++ b/frontend/src/views/project-management/environmental/index.vue @@ -34,7 +34,7 @@
{{ t('project.environmental.allParam') }}
@@ -437,6 +437,7 @@ tmpArr.unshift({ id: NEW_ENV_PARAM, name: t('project.environmental.newEnv'), + description: '', }); store.setCurrentId(NEW_ENV_PARAM); envList.value = tmpArr; @@ -448,6 +449,7 @@ tmpArr.unshift({ id: NEW_ENV_GROUP, name: t('project.environmental.newEnv'), + description: '', }); store.setCurrentGroupId(NEW_ENV_GROUP); evnGroupList.value = tmpArr;