fix(接口定义): 修复通知跳转到接口定义,模块缺失的缺陷 (#18131)

--bug=1017085 --user=王孝刚 【接口管理】接口定义修改接口后提示信息跳转至编辑页面模块无提示请选择模块
https://www.tapd.cn/55049933/s/1248536

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-09-21 17:07:46 +08:00 committed by GitHub
parent 24a176b615
commit 09f3b04151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 11 deletions

View File

@ -87,10 +87,7 @@ import MsApiReportDetail from "@/business/components/api/automation/report/ApiRe
import MsTableMoreBtn from "@/business/components/api/automation/scenario/TableMoreBtn";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {
API_SCENARIO_CONFIGS,
TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS
} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {ENV_TYPE} from "@/common/js/constants";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable";
@ -174,22 +171,21 @@ export default {
this.getVersionOptions();
},
methods: {
search(projectId) {
search(currentProjectId) {
this.selectRows = new Set();
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId) {
this.projectId = projectId;
}
if (this.projectId != null && typeof projectId === 'string') {
this.condition.projectId = this.projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (currentProjectId) {
this.condition.projectId = currentProjectId;
}
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
if (this.condition.projectId) {

View File

@ -134,7 +134,7 @@
@handleTestCase="handleTestCase"
@refreshTree="refreshTree"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi"
@editApiModule="editApiModule"
@copyApi="copyApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
@ -273,6 +273,7 @@ import ApiSchedule from "@/business/components/api/definition/components/import/
import MsEditCompleteContainer from "./components/EditCompleteContainer";
import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect";
import {PROJECT_ID, WORKSPACE_ID} from "@/common/js/constants";
import {buildTree} from "@/business/components/api/definition/model/NodeTree";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
@ -808,6 +809,23 @@ export default {
}
}
},
editApiModule(row) {
if (this.moduleOptions && this.moduleOptions.length === 0) {
let url = "/api/module/list/" + (row.projectId ? row.projectId : this.projectId) + "/" + row.protocol;
this.$get(url, response => {
if (response.data) {
response.data.forEach(node => {
node.name = node.name === '未规划接口' ? this.$t('api_test.definition.unplanned_api') : node.name
buildTree(node, {path: ''});
});
this.moduleOptions = response.data;
}
this.editApi(row);
});
} else {
this.editApi(row);
}
},
editApi(row) {
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
if (!index) {

View File

@ -777,7 +777,7 @@ export default {
},
editApi(row) {
this.$emit('editApi', row);
this.$emit('editApiModule', row);
},
handleCopy(row) {
let obj = JSON.parse(JSON.stringify(row));