This commit is contained in:
liqiang-fit2cloud 2022-12-20 17:55:15 +08:00
commit 496f85d416
14 changed files with 280 additions and 127 deletions

View File

@ -158,6 +158,11 @@ public class TestPlanApiCaseController {
return testPlanApiCaseService.getApiCaseEnv(planId);
}
@GetMapping("/get/project/ids/{planId}")
public List<String> getApiCaseProjectIds(@PathVariable("planId") String planId) {
return testPlanApiCaseService.getApiCaseProjectIds(planId);
}
@GetMapping("/is/executing/{planId}")
public Boolean isExecuting(@PathVariable("planId") String planId) {
return testPlanApiCaseService.isExecuting(planId);

View File

@ -175,6 +175,11 @@ public class TestPlanScenarioCaseController {
return testPlanScenarioCaseService.getApiScenarioEnv(planId);
}
@GetMapping("/get/project/ids/{planId}")
public List<String> getApiScenarioProjectIds(@PathVariable("planId") String planId) {
return testPlanScenarioCaseService.getApiScenarioProjectIds(planId);
}
@PostMapping("/plan/report")
public ApiPlanReportDTO buildApiReport(@RequestBody ApiPlanReportRequest request) {
return testPlanScenarioCaseService.buildApiReport(request);

View File

@ -817,4 +817,18 @@ public class TestPlanApiCaseService {
List<ApiDefinitionExecResultWithBLOBs> results = apiDefinitionExecResultMapper.selectByExampleWithBLOBs(example);
return results;
}
public List<String> getApiCaseProjectIds(String planId) {
TestPlanApiCaseExample caseExample = new TestPlanApiCaseExample();
caseExample.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(caseExample);
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(apiCaseIds)) {
return new ArrayList<>();
}
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(apiCaseIds);
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
return apiTestCases.stream().map(ApiTestCase::getProjectId).collect(Collectors.toList());
}
}

View File

@ -1245,4 +1245,18 @@ public class TestPlanScenarioCaseService {
public String selectProjectId(String testPlanId) {
return extTestPlanScenarioCaseMapper.selectProjectId(testPlanId);
}
public List<String> getApiScenarioProjectIds(String planId) {
TestPlanApiScenarioExample scenarioExample = new TestPlanApiScenarioExample();
scenarioExample.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExample(scenarioExample);
List<String> scenarioIds = testPlanApiScenarios.stream().map(TestPlanApiScenario::getApiScenarioId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(scenarioIds)) {
return new ArrayList<>();
}
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(scenarioIds);
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
return apiScenarios.stream().map(ApiScenario::getProjectId).collect(Collectors.toList());
}
}

View File

@ -121,11 +121,7 @@
:label="$t('api_test.automation.tag')"
prop="tags"
>
<ms-input-tag
:currentScenario="data"
ref="tag"
@onblur="save"
/>
<ms-input-tag :currentScenario="data" ref="tag" />
</el-form-item>
<el-form-item
@ -245,6 +241,7 @@ export default {
isFirst: false,
isLast: false,
isPullBtnLoading: false,
showPanel: "baseInfo",
results: [],
moduleObj: {
id: "id",
@ -368,9 +365,13 @@ export default {
this.visible = false;
},
saveAndClose() {
this.showPanel = "baseInfo";
this.visible = false;
this.save();
this.$emit("setCurrentPage", this.currentPage);
this.$nextTick(() => {
this.$emit("getProjectFiles");
this.showPanel = "baseInfo";
this.visible = false;
});
},
open(data, size, page, t) {
this.showPanel = "baseInfo";

View File

@ -1,15 +1,21 @@
<template>
<el-card v-loading="result.loading" class="table-card">
<el-card v-loading="tableLoading" class="table-card">
<template v-slot:header>
<ms-table-header :condition.sync="condition"
:show-create="false"
@change="change"
@search="getProjectFiles" title="">
<ms-table-header
:condition.sync="condition"
:show-create="false"
@change="change"
@search="getProjectFiles"
title=""
>
<template v-slot:button>
<ms-table-button icon="el-icon-upload2" v-if="moduleType==='repository'"
:content="$t('variables.add_file')"
@click="addRepositoryFile"
v-permission="['PROJECT_FILE:READ+UPLOAD+JAR']"/>
<ms-table-button
icon="el-icon-upload2"
v-if="moduleType === 'repository'"
:content="$t('variables.add_file')"
@click="addRepositoryFile"
v-permission="['PROJECT_FILE:READ+UPLOAD+JAR']"
/>
<el-upload
v-else
action=""
@ -17,61 +23,73 @@
:show-file-list="false"
:before-upload="beforeUploadFile"
:http-request="handleUpload"
:on-exceed="handleExceed">
<ms-table-button icon="el-icon-upload2"
:content="$t('variables.add_file')"
v-permission="['PROJECT_FILE:READ+UPLOAD+JAR']"/>
:on-exceed="handleExceed"
>
<ms-table-button
icon="el-icon-upload2"
:content="$t('variables.add_file')"
v-permission="['PROJECT_FILE:READ+UPLOAD+JAR']"
/>
</el-upload>
</template>
</ms-table-header>
</template>
<div v-if="showView === 'list'">
<ms-table v-loading="data.loading"
class="basic-config"
:total="total"
:screen-height="height"
:batch-operators="buttons"
:data="metadataArr"
:condition="condition"
:hidePopover="true"
@refresh="getProjectFiles" ref="table">
<ms-table
v-loading="data.loading"
class="basic-config"
:total="total"
:screen-height="height"
:batch-operators="buttons"
:data="metadataArr"
:condition="condition"
:hidePopover="true"
@refresh="getProjectFiles"
ref="table"
>
<ms-table-column
prop="name"
show-overflow-tooltip
:min-width="120"
:label="$t('load_test.file_name')">
:label="$t('load_test.file_name')"
>
</ms-table-column>
<ms-table-column
sortable
prop="type"
:min-width="120"
:filters="typeFilters"
:label="$t('load_test.file_type')">
:label="$t('load_test.file_type')"
>
</ms-table-column>
<ms-table-column
prop="description"
:label="$t('group.description')">
<ms-table-column prop="description" :label="$t('group.description')">
</ms-table-column>
<ms-table-column
prop="tags"
min-width="60px"
:show-overflow-tooltip=false
:label="$t('commons.tag')">
:show-overflow-tooltip="false"
:label="$t('commons.tag')"
>
<template v-slot:default="scope">
<el-tooltip class="item" effect="dark" placement="top">
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
<div class="oneLine">
<ms-tag v-for="(itemName,index) in scope.row.tags"
:key="index"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 20"
:content="itemName"
type="success" effect="plain"
class="ms-tags"/>
<ms-tag
v-for="(itemName, index) in scope.row.tags"
:key="index"
:show-tooltip="
scope.row.tags.length === 1 && itemName.length * 12 <= 20
"
:content="itemName"
type="success"
effect="plain"
class="ms-tags"
/>
</div>
</el-tooltip>
<span/>
<span />
</template>
</ms-table-column>
@ -79,19 +97,22 @@
sortable
prop="createUser"
:min-width="100"
:label="$t('commons.create_user')">
:label="$t('commons.create_user')"
>
</ms-table-column>
<ms-table-column
sortable
prop="updateUser"
:min-width="100"
:label="$t('ui.update_user')">
:label="$t('ui.update_user')"
>
</ms-table-column>
<ms-table-column
sortable
:label="$t('commons.create_time')"
:min-width="120"
prop="createTime">
prop="createTime"
>
<template v-slot="scope">
<span>{{ scope.row.createTime | datetimeFormat }}</span>
</template>
@ -101,20 +122,26 @@
sortable
:min-width="120"
:label="$t('commons.update_time')"
prop="updateTime">
prop="updateTime"
>
<template v-slot="scope">
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
</template>
</ms-table-column>
<ms-table-column :label="$t('commons.operating')" fixed="right" :width="130">
<ms-table-column
:label="$t('commons.operating')"
fixed="right"
:width="130"
>
<template v-slot:default="scope">
<ms-table-operator-button
icon="el-icon-view"
type="primary"
:tip="$t('permission.project_report_analysis.read')"
v-permission="['PROJECT_FILE:READ']"
@exec="handleView(scope.row)">
@exec="handleView(scope.row)"
>
</ms-table-operator-button>
<ms-table-operator-button
@ -122,14 +149,16 @@
type="success"
:tip="$t('project.file_download')"
v-permission="['PROJECT_FILE:READ+DOWNLOAD+JAR']"
@exec="handleDownload(scope.row)">
@exec="handleDownload(scope.row)"
>
</ms-table-operator-button>
<ms-table-operator-button
icon="el-icon-delete"
type="danger"
:tip="$t('commons.delete')"
v-permission="['PROJECT_FILE:READ+DELETE+JAR']"
@exec="handleDelete(scope.row)">
@exec="handleDelete(scope.row)"
>
</ms-table-operator-button>
</template>
</ms-table-column>
@ -138,7 +167,8 @@
:change="getProjectFiles"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:total="total"/>
:total="total"
/>
</div>
<!-- 缩略图 -->
<div v-else>
@ -153,10 +183,11 @@
@delete="handleDelete"
@refreshModule="refreshModule"
@setCurrentPage="setCurrentPage"
@change="changeList"/>
@change="changeList"
/>
</div>
<!-- 移动组建-->
<ms-file-batch-move @refreshModule="refreshModule" ref="batchMove"/>
<ms-file-batch-move @refreshModule="refreshModule" ref="batchMove" />
<!--编辑页面-->
<ms-edit-file-metadata
:metadata-array="metadataArr"
@ -166,8 +197,14 @@
@reload="getProjectFiles"
@download="handleDownload"
@setCurrentPage="setCurrentPage"
@delete="handleDelete" ref="editFileMetadata"/>
<file-metadata-dialog :module-id="moduleId" @refresh="refreshModuleAndList" ref="repositoryFileDialog"/>
@delete="handleDelete"
ref="editFileMetadata"
/>
<file-metadata-dialog
:module-id="moduleId"
@refresh="refreshModuleAndList"
ref="repositoryFileDialog"
/>
</el-card>
</template>
@ -175,8 +212,11 @@
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
import MsTableButton from "metersphere-frontend/src/components/MsTableButton";
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {getCurrentProjectID, getCurrentUserId} from "metersphere-frontend/src/utils/token";
import {operationConfirm} from "metersphere-frontend/src/utils";
import {
getCurrentProjectID,
getCurrentUserId,
} from "metersphere-frontend/src/utils/token";
import { operationConfirm } from "metersphere-frontend/src/utils";
import MsTableOperatorButton from "metersphere-frontend/src/components/MsTableOperatorButton";
import MsTableHeader from "../header/FileHeader";
import MsContainer from "metersphere-frontend/src/components/MsContainer";
@ -195,7 +235,7 @@ import {
downloadFileZip,
downloadMetaData,
getAllTypeFileMeta,
getFileMetaPages
getFileMetaPages,
} from "../../../../api/file";
export default {
@ -221,7 +261,7 @@ export default {
nodeTree: Array,
moduleType: {
type: String,
default: 'module',
default: "module",
},
},
data() {
@ -237,23 +277,23 @@ export default {
metadataArr: [],
condition: {},
projectId: getCurrentProjectID(),
height: 'calc(100vh - 160px)',
height: "calc(100vh - 160px)",
typeFilters: [],
buttons: [
{
name: this.$t('file_manage.batch_delete'),
name: this.$t("file_manage.batch_delete"),
handleClick: this.handleDeleteBatch,
permissions: ['PROJECT_FILE:READ+BATCH+DELETE']
permissions: ["PROJECT_FILE:READ+BATCH+DELETE"],
},
{
name: this.$t('file_manage.batch_download'),
name: this.$t("file_manage.batch_download"),
handleClick: this.exportZip,
permissions: ['PROJECT_FILE:READ+BATCH+DOWNLOAD']
permissions: ["PROJECT_FILE:READ+BATCH+DOWNLOAD"],
},
{
name: this.$t('file_manage.batch_move'),
name: this.$t("file_manage.batch_move"),
handleClick: this.handleBatchMove,
permissions: ['PROJECT_FILE:READ+BATCH+MOVE']
permissions: ["PROJECT_FILE:READ+BATCH+MOVE"],
},
],
showView: "list",
@ -273,7 +313,7 @@ export default {
this.showView = value;
},
refreshModule() {
this.$emit('refreshModule');
this.$emit("refreshModule");
},
refreshList() {
this.$emit("refreshList");
@ -289,7 +329,7 @@ export default {
},
myFile() {
if (!this.condition.filters) {
this.condition.filters = {createUser: [getCurrentUserId()]};
this.condition.filters = { createUser: [getCurrentUserId()] };
} else {
this.condition.filters.createUser = [getCurrentUserId()];
}
@ -297,11 +337,16 @@ export default {
this.getProjectFiles();
},
getProjectFiles() {
this.tableLoading = getFileMetaPages(this.projectId, this.currentPage, this.pageSize, this.condition).then(res => {
this.tableLoading = getFileMetaPages(
this.projectId,
this.currentPage,
this.pageSize,
this.condition
).then((res) => {
let data = res.data;
this.total = data.itemCount;
this.metadataArr = data.listObject;
this.metadataArr.forEach(item => {
this.metadataArr.forEach((item) => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
@ -322,7 +367,7 @@ export default {
return false;
}
if (file.size / 1024 / 1024 > 500) {
this.$warning(this.$t('api_test.request.body_upload_limit_size'));
this.$warning(this.$t("api_test.request.body_upload_limit_size"));
return false;
}
return true;
@ -333,26 +378,31 @@ export default {
createUser: getCurrentUserId(),
updateUser: getCurrentUserId(),
projectId: this.projectId,
moduleId: this.moduleId
moduleId: this.moduleId,
};
this.cardLoading = createFileMeta(file, request).then(() => {
this.$success(this.$t('commons.save_success'));
this.$success(this.$t("commons.save_success"));
this.getProjectFiles();
this.refreshModule();
});
},
handleExceed() {
this.$error(this.$t('load_test.file_size_limit'));
this.$error(this.$t("load_test.file_size_limit"));
},
handleView(row) {
this.$refs.editFileMetadata.open(row, this.pageSize, this.currentPage, this.total);
this.$refs.editFileMetadata.open(
row,
this.pageSize,
this.currentPage,
this.total
);
},
getTagToolTips(tags) {
try {
let showTips = "";
tags.forEach(item => {
tags.forEach((item) => {
showTips += item + ",";
})
});
return showTips.substr(0, showTips.length - 1);
} catch (e) {
return "";
@ -378,54 +428,64 @@ export default {
},
exportZip() {
let array = [];
this.$refs.table.selectRows.forEach(item => {
this.$refs.table.selectRows.forEach((item) => {
let request = JSON.parse(JSON.stringify(item));
request.tags = "";
array.push(request);
})
let request = {projectId: getCurrentProjectID, requests: array};
});
let request = { projectId: getCurrentProjectID, requests: array };
downloadFileZip(request);
// this.$fileDownloadPost("/file/metadata/download/zip", request, ".zip");
},
handleDeleteBatch() {
operationConfirm(this, this.$t('project.file_delete_tip', [this.$refs.table.selectIds.length + " 条 "]), () => {
batchDeleteMetaData(this.$refs.table.selectIds).then(() => {
this.$refs.table.clear();
this.$success(this.$t('commons.delete_success'));
this.getProjectFiles();
this.refreshModule();
})
});
operationConfirm(
this,
this.$t("project.file_delete_tip", [
this.$refs.table.selectIds.length + " 条 ",
]),
() => {
batchDeleteMetaData(this.$refs.table.selectIds).then(() => {
this.$refs.table.clear();
this.$success(this.$t("commons.delete_success"));
this.getProjectFiles();
this.refreshModule();
});
}
);
},
handleDelete(row) {
if (row && row.confirm) {
deleteFileMetaById(row.id).then(() => {
this.$success(this.$t('commons.delete_success'));
this.$success(this.$t("commons.delete_success"));
this.getProjectFiles();
this.refreshModule();
});
return;
}
operationConfirm(this, this.$t('project.file_delete_tip', [row.name]), () => {
deleteFileMetaById(row.id).then(() => {
this.$success(this.$t('commons.delete_success'));
this.getProjectFiles();
this.refreshModule();
});
});
operationConfirm(
this,
this.$t("project.file_delete_tip", [row.name]),
() => {
deleteFileMetaById(row.id).then(() => {
this.$success(this.$t("commons.delete_success"));
this.getProjectFiles();
this.refreshModule();
});
}
);
},
getTypes() {
this.typeFilters = [];
getAllTypeFileMeta().then(res => {
res.data.forEach(item => {
this.typeFilters.push({text: item, value: item});
})
getAllTypeFileMeta().then((res) => {
res.data.forEach((item) => {
this.typeFilters.push({ text: item, value: item });
});
});
},
moduleChange(ids) {
if (!this.condition.filters) {
this.condition.filters = {moduleIds: ids};
this.condition.filters = { moduleIds: ids };
} else {
this.condition.filters.moduleIds = ids;
}
@ -437,8 +497,8 @@ export default {
},
moveSave(param) {
// this.buildBatchParam(param);
}
}
},
},
};
</script>

View File

@ -227,6 +227,11 @@ public class TestPlanController {
return testPlanService.getPlanCaseEnv(plan.getId());
}
@PostMapping("/case/relevance/project/ids")
public List<String> getRelevanceProjectIds(@RequestBody TestPlan plan) {
return testPlanService.getRelevanceProjectIds(plan.getId());
}
@PostMapping("/edit/run/config")
public void updateRunModeConfig(@RequestBody TestPlanRunRequest testplanRunRequest) {

View File

@ -2059,7 +2059,7 @@ public class TestPlanService {
}
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
List<UiScenarioReportWithBLOBs> apiDefinitionLists = planTestPlanUiScenarioCaseService.selectExtForPlanReport(reportId);
if(CollectionUtils.isNotEmpty(apiDefinitionLists)){
if (CollectionUtils.isNotEmpty(apiDefinitionLists)) {
UiScenarioReportWithBLOBs apiDefinition = apiDefinitionLists.get(0);
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
@ -2068,4 +2068,17 @@ public class TestPlanService {
}
return testPlanExtReportDTO;
}
public List<String> getRelevanceProjectIds(String planId) {
List<String> projectIds = new ArrayList<>();
List<String> apiCaseProjectIds = planTestPlanApiCaseService.getApiCaseProjectIds(planId);
List<String> apiScenarioProjectIds = planTestPlanScenarioCaseService.getApiScenarioProjectIds(planId);
if (DiscoveryUtil.hasService(MicroServiceName.UI_TEST)) {
List<String> uiScenarioProjectIds = planTestPlanUiScenarioCaseService.getUiScenarioProjectIds(planId);
projectIds.addAll(uiScenarioProjectIds);
}
projectIds.addAll(apiCaseProjectIds);
projectIds.addAll(apiScenarioProjectIds);
return projectIds.stream().distinct().collect(Collectors.toList());
}
}

View File

@ -131,6 +131,10 @@ public class PlanTestPlanApiCaseService extends ApiTestService {
return (Map<String, List<String>>) microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId);
}
public List<String> getApiCaseProjectIds(String planId) {
return (List<String>) microService.getForData(serviceName, BASE_UEL + "/get/project/ids/" + planId);
}
public Boolean isCaseExecuting(String planId) {
return (Boolean) microService.getForData(serviceName, BASE_UEL + "/is/executing/" + planId);
}

View File

@ -143,6 +143,10 @@ public class PlanTestPlanScenarioCaseService extends ApiTestService {
return microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId, Map.class);
}
public List<String> getApiScenarioProjectIds(String planId) {
return microService.getForData(serviceName, BASE_UEL + "/get/project/ids/" + planId, List.class);
}
public ApiPlanReportDTO getApiReport(ApiPlanReportRequest request) {
return microService.postForData(serviceName, BASE_UEL + "/plan/report", request, ApiPlanReportDTO.class);
}

View File

@ -157,4 +157,8 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService {
public Map<String, List<String>> getUiScenarioEnv(String planId) {
return microService.getForData(serviceName, BASE_URL + "/get/env/" + planId, Map.class);
}
public List<String> getUiScenarioProjectIds(String planId) {
return microService.getForData(serviceName, BASE_URL + "/get/project/ids/" + planId, List.class);
}
}

View File

@ -1081,21 +1081,25 @@ public class IssuesService {
private void deleteSyncAttachment(AttachmentModuleRelationMapper batchAttachmentModuleRelationMapper,
Set<String> jiraAttachmentSet,
List<FileAttachmentMetadata> allMsAttachments) {
// 删除Jira中不存在的附件
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
.filter(msAttachment -> !jiraAttachmentSet.contains(msAttachment.getName()))
.collect(Collectors.toList());
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
List<String> ids = List.of(fileAttachmentMetadata.getId());
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());
// 删除MS附件及关联数据
attachmentService.deleteAttachmentByIds(ids);
attachmentService.deleteFileAttachmentByIds(ids);
batchAttachmentModuleRelationMapper.deleteByExample(example);
});
}
try {
// 删除Jira中不存在的附件
if (CollectionUtils.isNotEmpty(allMsAttachments)) {
List<FileAttachmentMetadata> deleteMsAttachments = allMsAttachments.stream()
.filter(msAttachment -> !jiraAttachmentSet.contains(msAttachment.getName()))
.collect(Collectors.toList());
deleteMsAttachments.forEach(fileAttachmentMetadata -> {
List<String> ids = List.of(fileAttachmentMetadata.getId());
AttachmentModuleRelationExample example = new AttachmentModuleRelationExample();
example.createCriteria().andAttachmentIdIn(ids).andRelationTypeEqualTo(AttachmentType.ISSUE.type());
// 删除MS附件及关联数据
attachmentService.deleteAttachmentByIds(ids);
attachmentService.deleteFileAttachmentByIds(ids);
batchAttachmentModuleRelationMapper.deleteByExample(example);
});
}
} catch (Exception e) {
LogUtil.error(e);
}
}
private void saveAttachmentModuleRelation(Platform platform, String issueId,
@ -1871,7 +1875,9 @@ public class IssuesService {
xpackIssueService.syncThirdPartyIssues(project, syncRequest);
syncAllPluginIssueAttachment(project, syncRequest);
if (platformPluginService.isPluginPlatform(project.getPlatform())) {
syncAllPluginIssueAttachment(project, syncRequest);
}
} catch (Exception e) {
LogUtil.error(e);
MSException.throwException(e);

View File

@ -289,12 +289,16 @@ export function updateSchedule(param){
return post(BASE_URL + 'schedule/update',param);
}
export function getApiScenarioEnv(param){
return post(BASE_URL + 'api/scenario/env',param);
export function getApiScenarioEnv(param) {
return post(BASE_URL + 'api/scenario/env', param);
}
export function getPlanCaseEnv(param){
return post(BASE_URL + 'case/env',param);
export function getPlanCaseEnv(param) {
return post(BASE_URL + 'case/env', param);
}
export function getPlanCaseProjectIds(param) {
return post(BASE_URL + 'case/relevance/project/ids', param);
}
export function run(testId, reportId) {

View File

@ -200,7 +200,7 @@ import {getCurrentProjectID, getOwnerProjects} from "@/business/utils/sdk-utils"
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
import {getApiScenarioEnv, getPlanCaseEnv} from "@/api/remote/plan/test-plan";
import {getApiScenarioEnv, getPlanCaseEnv, getPlanCaseProjectIds} from "@/api/remote/plan/test-plan";
import EnvGroupWithOption from "../env/EnvGroupWithOption";
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
@ -402,9 +402,23 @@ export default {
this.projectIds.add(d);
}
}
this.$refs.envSelectPopover.open();
if (this.projectIds.size === 0) {
param = {id: this.planId};
getPlanCaseProjectIds(param).then((res) => {
let data = res.data;
if (data) {
for (let i = 0; i < data.length; i++) {
this.projectIds.add(data[i]);
}
}
this.$refs.envSelectPopover.open();
});
} else {
this.$refs.envSelectPopover.open();
}
});
}
},
handleCommand(command) {
if (