fix(项目管理): 修复环境重命名失败的缺陷

--bug=1037584 --user=王孝刚 【项目管理】环境管理-环境名称重命名功能未实现
https://www.tapd.cn/55049933/s/1501133
This commit is contained in:
wxg0103 2024-04-18 16:39:42 +08:00 committed by 刘瑞斌
parent f6936b5ce8
commit ea9fa5aa1c
4 changed files with 12 additions and 8 deletions

View File

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

View File

@ -5,6 +5,7 @@ export interface EnvListItem {
mock?: boolean;
name: string;
id: string;
description: string;
}
export interface EnvGroupProjectListItem {

View File

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

View File

@ -34,7 +34,7 @@
<div
class="env-item justify-between font-medium text-[var(--color-text-1)] hover:bg-[rgb(var(--primary-1))]"
:class="{ 'bg-[rgb(var(--primary-1))] !text-[rgb(var(--primary-5))]': activeKey === ALL_PARAM }"
@click="handleListItemClick({ id: 'allParam', name: 'allParam' })"
@click="handleListItemClick({ id: 'allParam', name: 'allParam', description: '' })"
>
{{ t('project.environmental.allParam') }}
<div class="node-extra">
@ -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;