fix(项目管理): 修复环境相关bug

--bug=1037797 --user=王孝刚 【项目管理】项目管理员查看项目环境管理页面-环境组,报错了
https://www.tapd.cn/55049933/s/1484387
This commit is contained in:
wxg0103 2024-03-29 18:48:13 +08:00 committed by Craftsman
parent c7c8734ced
commit fa1016566f
7 changed files with 25 additions and 8 deletions

View File

@ -132,7 +132,6 @@ public class EnvironmentController {
@GetMapping("/get-options/{projectId}") @GetMapping("/get-options/{projectId}")
@Operation(summary = "项目管理-环境-环境目录-列表") @Operation(summary = "项目管理-环境-环境目录-列表")
@RequiresPermissions(PermissionConstants.PROJECT_ENVIRONMENT_READ)
@CheckOwner(resourceId = "#projectId", resourceType = "project") @CheckOwner(resourceId = "#projectId", resourceType = "project")
public List<EnvironmentOptionsDTO> list(@PathVariable String projectId) { public List<EnvironmentOptionsDTO> list(@PathVariable String projectId) {
return environmentService.listOption(projectId); return environmentService.listOption(projectId);

View File

@ -21,7 +21,6 @@ import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.UserRoleRelationExample; import io.metersphere.system.domain.UserRoleRelationExample;
import io.metersphere.system.dto.sdk.BaseSystemConfigDTO; import io.metersphere.system.dto.sdk.BaseSystemConfigDTO;
import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.sdk.enums.MoveTypeEnum;
import io.metersphere.system.dto.sdk.request.NodeMoveRequest; import io.metersphere.system.dto.sdk.request.NodeMoveRequest;
import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.mapper.UserRoleRelationMapper; import io.metersphere.system.mapper.UserRoleRelationMapper;
@ -39,7 +38,10 @@ import org.mybatis.spring.SqlSessionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -72,7 +74,6 @@ public class EnvironmentGroupService extends MoveNodeService{
environmentGroup.setId(IDGenerator.nextStr()); environmentGroup.setId(IDGenerator.nextStr());
this.checkEnvironmentGroup(environmentGroup); this.checkEnvironmentGroup(environmentGroup);
environmentGroup.setId(UUID.randomUUID().toString());
environmentGroup.setCreateTime(System.currentTimeMillis()); environmentGroup.setCreateTime(System.currentTimeMillis());
environmentGroup.setUpdateTime(System.currentTimeMillis()); environmentGroup.setUpdateTime(System.currentTimeMillis());
environmentGroup.setCreateUser(userId); environmentGroup.setCreateUser(userId);

View File

@ -103,7 +103,7 @@ const useProjectEnvStore = defineStore(
currentEnvDetailInfo.value = { currentEnvDetailInfo.value = {
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
name: '', name: '',
config: envParamsDefaultConfig, config: cloneDeep(envParamsDefaultConfig),
}; };
backupEnvDetailInfo.value = { backupEnvDetailInfo.value = {
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,

View File

@ -14,12 +14,24 @@
>{{ t('project.environmental.addHttp') }}</a-button >{{ t('project.environmental.addHttp') }}</a-button
> >
<div class="flex flex-row gap-[8px]"> <div class="flex flex-row gap-[8px]">
<a-input-number v-model:model-value="form.requestTimeout" :min="0" class="w-[180px]" :disabled="isDisabled"> <a-input-number
v-model:model-value="form.requestTimeout"
:min="0"
:step="100"
class="w-[180px]"
:disabled="isDisabled"
>
<template #prefix> <template #prefix>
<span class="text-[var(--color-text-3)]">{{ t('project.environmental.http.linkTimeOut') }}</span> <span class="text-[var(--color-text-3)]">{{ t('project.environmental.http.linkTimeOut') }}</span>
</template> </template>
</a-input-number> </a-input-number>
<a-input-number v-model:model-value="form.responseTimeout" :min="0" class="w-[180px]" :disabled="isDisabled"> <a-input-number
v-model:model-value="form.responseTimeout"
:min="0"
:step="100"
class="w-[180px]"
:disabled="isDisabled"
>
<template #prefix> <template #prefix>
<span class="text-[var(--color-text-3)]">{{ t('project.environmental.http.resTimeOut') }}</span> <span class="text-[var(--color-text-3)]">{{ t('project.environmental.http.resTimeOut') }}</span>
</template> </template>

View File

@ -264,7 +264,7 @@
// typeNONE 1 // typeNONE 1
const noneData = store.currentEnvDetailInfo.config.httpConfig.filter((item) => item.type === 'NONE'); const noneData = store.currentEnvDetailInfo.config.httpConfig.filter((item) => item.type === 'NONE');
if (noneData.length >= 1) { if (noneData.length >= 1 && (props.isCopy || !props.currentId)) {
Message.error(t('project.environmental.http.noneDataExist')); Message.error(t('project.environmental.http.noneDataExist'));
return; return;
} }
@ -326,6 +326,9 @@
const title = ref<string>(''); const title = ref<string>('');
watchEffect(() => { watchEffect(() => {
title.value = props.currentId ? t('project.environmental.http.edit') : t('project.environmental.http.add'); title.value = props.currentId ? t('project.environmental.http.edit') : t('project.environmental.http.add');
if (props.isCopy) {
title.value = t('project.environmental.http.copy');
}
if (props.currentId) { if (props.currentId) {
const currentItem = store.currentEnvDetailInfo.config.httpConfig.find( const currentItem = store.currentEnvDetailInfo.config.httpConfig.find(
(item) => item.id === props.currentId (item) => item.id === props.currentId

View File

@ -50,6 +50,7 @@ export default {
'project.environmental.http.value': 'Value', 'project.environmental.http.value': 'Value',
'project.environmental.http.add': 'Add HTTP', 'project.environmental.http.add': 'Add HTTP',
'project.environmental.http.edit': 'Update HTTP', 'project.environmental.http.edit': 'Update HTTP',
'project.environmental.http.copy': 'Copy HTTP',
'project.environmental.http.hostName': 'Host Name', 'project.environmental.http.hostName': 'Host Name',
'project.environmental.http.hostNameRequired': 'Host name is required', 'project.environmental.http.hostNameRequired': 'Host name is required',
'project.environmental.http.httpHostNamePlaceholder': 'For example: http://127.0.0.1', 'project.environmental.http.httpHostNamePlaceholder': 'For example: http://127.0.0.1',

View File

@ -55,6 +55,7 @@ export default {
'project.environmental.http.value': '值', 'project.environmental.http.value': '值',
'project.environmental.http.add': '添加HTTP', 'project.environmental.http.add': '添加HTTP',
'project.environmental.http.edit': '更新HTTP', 'project.environmental.http.edit': '更新HTTP',
'project.environmental.http.copy': '复制HTTP',
'project.environmental.http.hostName': '域名', 'project.environmental.http.hostName': '域名',
'project.environmental.http.hostNameRequired': '域名必填', 'project.environmental.http.hostNameRequired': '域名必填',
'project.environmental.http.httpHostNamePlaceholder': '例如http://127.0.0.1', 'project.environmental.http.httpHostNamePlaceholder': '例如http://127.0.0.1',