diff --git a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue
index 8051b42df1..c0b471e7c7 100644
--- a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue
+++ b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue
@@ -56,7 +56,7 @@
style="width: 100%" />
{{ $t('run_mode.other_config') }}:
-
+
{{ $t('run_mode.run_with_resource_pool') }}
{
- if (!response.data.runMode) {
- response.data.runMode = 'LOCAL';
- }
- this.runMode = response.data.runMode;
- if (this.runMode === 'POOL') {
- this.runConfig.runWithinResourcePool = true;
- this.getProjectApplication();
- } else {
- this.loading = false;
- }
- });
- },
getProjectApplication() {
getProjectConfig(getCurrentProjectID(), '').then((res) => {
if (res.data && res.data.poolEnable && res.data.resourcePoolId) {
- this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ this.resourcePools.forEach(item => {
+ if (item.id === res.data.resourcePoolId) {
+ this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ }
+ });
}
- this.loading = false;
});
},
currentUser: () => {
@@ -268,6 +255,8 @@ export default {
getResourcePools() {
this.result = getTestResourcePools().then((response) => {
this.resourcePools = response.data;
+ this.runConfig.runWithinResourcePool = true;
+ this.getProjectApplication();
});
},
updateTask(param) {
@@ -321,7 +310,6 @@ export default {
this.activeName = 'first';
this.getResourcePools();
this.getWsProjects();
- this.query();
this.runConfig.environmentType = ENV_TYPE.JSON;
},
findSchedule() {
diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/ApiPoolDebugService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/ApiPoolDebugService.java
index c891b70818..0b595c55f6 100644
--- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/ApiPoolDebugService.java
+++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/ApiPoolDebugService.java
@@ -6,13 +6,14 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.JSON;
import io.metersphere.dto.*;
import io.metersphere.utils.LoggerUtil;
+import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
-import jakarta.annotation.Resource;
import java.util.List;
+import java.util.stream.Collectors;
@Service
public class ApiPoolDebugService {
@@ -66,16 +67,21 @@ public class ApiPoolDebugService {
*/
public void verifyPool(String projectId, RunModeConfigDTO runConfig) {
if (runConfig != null && StringUtils.isEmpty(runConfig.getResourcePoolId())) {
- BaseSystemConfigDTO configDTO = systemParameterService.getBaseInfo();
LoggerUtil.info("校验项目为:【" + projectId + "】", runConfig.getReportId());
- if (StringUtils.equals(configDTO.getRunMode(), POOL)) {
- ProjectConfig config = baseProjectApplicationService.getProjectConfig(projectId);
- if (config == null || !config.getPoolEnable() || StringUtils.isEmpty(config.getResourcePoolId())) {
+ ProjectConfig config = baseProjectApplicationService.getProjectConfig(projectId);
+ List poolList = systemParameterService.getTestResourcePool();
+ boolean contains = poolList.stream().map(TestResourcePoolDTO::getId).collect(Collectors.toList()).contains(config.getResourcePoolId());
+
+ if (StringUtils.isEmpty(config.getResourcePoolId()) || !contains) {
+ String id = systemParameterService.filterQuota(poolList, projectId);
+ if (StringUtils.isBlank(id)) {
MSException.throwException("请在【项目设置-应用管理-接口测试】中选择资源池");
+ } else {
+ config.setResourcePoolId(id);
}
- runConfig = runConfig == null ? new RunModeConfigDTO() : runConfig;
- runConfig.setResourcePoolId(config.getResourcePoolId());
}
+ runConfig = runConfig == null ? new RunModeConfigDTO() : runConfig;
+ runConfig.setResourcePoolId(config.getResourcePoolId());
}
}
}
diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java
index 684a172f33..6f004828ae 100644
--- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java
+++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/SystemParameterService.java
@@ -24,8 +24,6 @@ import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.notice.domain.MailInfo;
-import io.metersphere.notice.domain.Receiver;
-import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.sender.impl.MailNoticeSender;
import io.metersphere.quota.service.BaseQuotaService;
import io.metersphere.request.HeaderRequest;
@@ -309,7 +307,7 @@ public class SystemParameterService {
return baseTestResourcePoolService.listResourcePools(resourcePoolRequest);
}
- private String filterQuota(List list, String projectId) {
+ public String filterQuota(List list, String projectId) {
Set pools = baseQuotaService.getQuotaResourcePools(projectId);
List poolList = new ArrayList<>();
if (!pools.isEmpty()) {
@@ -366,23 +364,20 @@ public class SystemParameterService {
}
public void saveProjectApplication(String projectId) {
- BaseSystemConfigDTO config = getBaseInfo();
- if (config != null && StringUtils.equals(config.getRunMode(), "POOL")) {
- List poolList = getTestResourcePool();
- String id = filterQuota(poolList, projectId);
- if (StringUtils.isNotBlank(id)) {
- ProjectApplication applicationValue = new ProjectApplication();
- applicationValue.setProjectId(projectId);
- applicationValue.setType(ProjectApplicationType.RESOURCE_POOL_ID.name());
- applicationValue.setTypeValue(id);
- projectApplicationMapper.insert(applicationValue);
+ List poolList = getTestResourcePool();
+ String id = filterQuota(poolList, projectId);
+ if (StringUtils.isNotBlank(id)) {
+ ProjectApplication applicationValue = new ProjectApplication();
+ applicationValue.setProjectId(projectId);
+ applicationValue.setType(ProjectApplicationType.RESOURCE_POOL_ID.name());
+ applicationValue.setTypeValue(id);
+ projectApplicationMapper.insert(applicationValue);
- ProjectApplication application = new ProjectApplication();
- application.setProjectId(projectId);
- application.setType(ProjectApplicationType.POOL_ENABLE.name());
- application.setTypeValue(String.valueOf(true));
- projectApplicationMapper.insert(application);
- }
+ ProjectApplication application = new ProjectApplication();
+ application.setProjectId(projectId);
+ application.setType(ProjectApplicationType.POOL_ENABLE.name());
+ application.setTypeValue(String.valueOf(true));
+ projectApplicationMapper.insert(application);
}
}
@@ -403,14 +398,6 @@ public class SystemParameterService {
}
}
}
- // 启用资源池
- if (param.getParamKey().equals("base.run.mode") && param.getParamValue().equals("POOL")) {
- long size = baseProjectService.count();
- List poolList = getTestResourcePool();
- if (CollectionUtils.isNotEmpty(poolList) && size > 0) {
- batchSaveProjectApp(poolList, size);
- }
- }
// 去掉路径最后的 /
param.setParamValue(StringUtils.removeEnd(param.getParamValue(), "/"));
if (StringUtils.equals(param.getParamKey(), "base.url")) {
diff --git a/project-management/frontend/src/business/menu/appmanage/AppManage.vue b/project-management/frontend/src/business/menu/appmanage/AppManage.vue
index f58738a58d..8dc4834e6a 100644
--- a/project-management/frontend/src/business/menu/appmanage/AppManage.vue
+++ b/project-management/frontend/src/business/menu/appmanage/AppManage.vue
@@ -107,7 +107,7 @@
+ :append-span="4">
{
- this.isPool = response.data.runMode === 'POOL';
- })
- },
getResourcePools() {
this.result = getTestResourcePools().then(response => {
this.resourcePools = response.data;
diff --git a/system-setting/frontend/src/business/system/setting/BaseSetting.vue b/system-setting/frontend/src/business/system/setting/BaseSetting.vue
index b1655557d8..320e9a00f3 100644
--- a/system-setting/frontend/src/business/system/setting/BaseSetting.vue
+++ b/system-setting/frontend/src/business/system/setting/BaseSetting.vue
@@ -22,9 +22,6 @@
-
-
-
@@ -95,20 +92,6 @@ export default {
})
});
},
- modeChange(v){
- if(v === 'POOL'){
- this.formInline.runMode = 'LOCAL';
- this.$alert(this.$t('system.api_default_run_message'), '', {
- confirmButtonText: this.$t('commons.confirm'),
- cancelButtonText: this.$t('commons.cancel'),
- callback: (action) => {
- if (action === 'confirm') {
- this.formInline.runMode = v;
- }
- }
- });
- }
- },
edit() {
this.showEdit = false;
this.showSave = true;
@@ -129,8 +112,7 @@ export default {
{paramKey: "base.concurrency", paramValue: this.formInline.concurrency, type: "text", sort: 2},
{paramKey: "base.prometheus.host", paramValue: this.formInline.prometheusHost, type: "text", sort: 1},
{paramKey: "base.selenium.docker.url", paramValue: this.formInline.seleniumDockerUrl, type: "text", sort: 1},
- {paramKey: "base.doc.url", paramValue: this.formInline.docUrl, type: "text", sort: 1},
- {paramKey: "base.run.mode", paramValue: this.formInline.runMode, type: "text", sort: 5}
+ {paramKey: "base.doc.url", paramValue: this.formInline.docUrl, type: "text", sort: 1}
];
this.loading = saveSystemBaseSetting(param).then(res => {
if (res.success) {
diff --git a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue
index 79c79fb747..1bd776debd 100644
--- a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue
+++ b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue
@@ -72,7 +72,7 @@
v-model="runConfig.runWithinResourcePool"
style="padding-right: 10px"
class="radio-change"
- :disabled="runMode === 'POOL'"
+ :disabled="true"
>
{{ $t("run_mode.run_with_resource_pool") }}
@@ -104,7 +104,7 @@
v-model="runConfig.runWithinResourcePool"
style="padding-right: 10px"
class="radio-change"
- :disabled="runMode === 'POOL'"
+ :disabled="true"
>
{{ $t("run_mode.run_with_resource_pool") }}
@@ -241,7 +241,6 @@ export default {
},
data() {
return {
- runMode: "",
btnStyle: {
width: "260px",
},
@@ -329,29 +328,16 @@ export default {
this.getResourcePools();
this.getWsProjects();
this.showPopover();
- this.query();
- },
- query() {
- this.loading = true;
- this.result = getSystemBaseSetting().then((response) => {
- if (!response.data.runMode) {
- response.data.runMode = "LOCAL";
- }
- this.runMode = response.data.runMode;
- if (this.runMode === "POOL") {
- this.runConfig.runWithinResourcePool = true;
- this.getProjectApplication();
- } else {
- this.loading = false;
- }
- });
},
getProjectApplication() {
getProjectConfig(getCurrentProjectID(), "").then((res) => {
if (res.data && res.data.poolEnable && res.data.resourcePoolId) {
- this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ this.resourcePools.forEach(item => {
+ if (item.id === res.data.resourcePoolId) {
+ this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ }
+ });
}
- this.loading = false;
});
},
changeMode() {
@@ -380,6 +366,8 @@ export default {
getResourcePools() {
getQuotaValidResourcePools().then((response) => {
this.resourcePools = response.data;
+ this.runConfig.runWithinResourcePool = true;
+ this.getProjectApplication();
});
},
setDefaultEnv(projectId, envId) {
diff --git a/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue b/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue
index 6db030b2c7..a55a3a7ed6 100644
--- a/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue
+++ b/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue
@@ -118,7 +118,7 @@
{{ $t("run_mode.run_with_resource_pool") }}
@@ -151,7 +151,7 @@
{{ $t("run_mode.run_with_resource_pool") }}
@@ -350,7 +350,6 @@ export default {
}
};
return {
- runMode: "",
result: {},
scheduleReceiverOptions: [],
operation: true,
@@ -400,27 +399,15 @@ export default {
};
},
methods: {
- query() {
- this.loading = true;
- this.result = getSystemBaseSetting().then((response) => {
- if (!response.data.runMode) {
- response.data.runMode = "LOCAL";
- }
- this.runMode = response.data.runMode;
- if (this.runMode === "POOL") {
- this.runConfig.runWithinResourcePool = true;
- this.getProjectApplication();
- } else {
- this.loading = false;
- }
- });
- },
getProjectApplication() {
getProjectConfig(getCurrentProjectID(), "").then((res) => {
if (res.data && res.data.poolEnable && res.data.resourcePoolId) {
- this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ this.resourcePools.forEach(item => {
+ if (item.id === res.data.resourcePoolId) {
+ this.runConfig.resourcePoolId = res.data.resourcePoolId;
+ }
+ });
}
- this.loading = false;
});
},
currentUser: () => {
@@ -451,7 +438,6 @@ export default {
return param;
},
open(row) {
- this.query();
this.planId = row.id;
//测试计划页面跳转来的
let paramTestId = row.id;
@@ -612,6 +598,8 @@ export default {
getResourcePools() {
this.result = getQuotaValidResourcePools().then((response) => {
this.resourcePools = response.data;
+ this.runConfig.runWithinResourcePool = true;
+ this.getProjectApplication();
});
},
changeMode() {