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 @@