fix: 接口定义创建到其他项目
This commit is contained in:
parent
41a1a5f38b
commit
e2285238d3
|
@ -140,7 +140,7 @@ import MsRunTestHttpPage from "./components/runtest/RunTestHTTPPage";
|
|||
import MsRunTestTcpPage from "./components/runtest/RunTestTCPPage";
|
||||
import MsRunTestSqlPage from "./components/runtest/RunTestSQLPage";
|
||||
import MsRunTestDubboPage from "./components/runtest/RunTestDubboPage";
|
||||
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import {checkoutTestManagerOrTestUser, getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import MsApiModule from "./components/module/ApiModule";
|
||||
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
|
||||
|
||||
|
@ -159,7 +159,10 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
|
|||
},
|
||||
isReadOnly(){
|
||||
return !checkoutTestManagerOrTestUser();
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
components: {
|
||||
MsTabButton,
|
||||
|
@ -211,13 +214,9 @@ import MsTabButton from "@/business/components/common/components/MsTabButton";
|
|||
}],
|
||||
activeDom: "left",
|
||||
syncTabs: [],
|
||||
projectId: "",
|
||||
nodeTree: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
},
|
||||
watch: {
|
||||
currentProtocol() {
|
||||
this.handleCommand("CLOSE_ALL");
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import {getCurrentProjectID, getCurrentUser} from "../../../../../../common/js/utils";
|
||||
import {getCurrentUser} from "../../../../../../common/js/utils";
|
||||
import {createComponent, Request} from "../jmeter/components";
|
||||
|
||||
export default {
|
||||
|
@ -94,8 +94,12 @@
|
|||
value: REQ_METHOD[0].id,
|
||||
options: REQ_METHOD,
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
saveApi(saveAs) {
|
||||
this.$refs['httpForm'].validate((valid) => {
|
||||
|
@ -137,7 +141,7 @@
|
|||
break;
|
||||
}
|
||||
this.httpForm.bodyUploadIds = [];
|
||||
this.httpForm.projectId = getCurrentProjectID();
|
||||
this.httpForm.projectId = this.projectId;
|
||||
this.httpForm.id = this.httpForm.request.id;
|
||||
this.httpForm.protocol = this.currentProtocol;
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
<script>
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsSetEnvironment",
|
||||
|
@ -64,6 +63,11 @@ export default {
|
|||
this.environmentChange(this.environmentId);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
environmentChange(value) {
|
||||
for (let i in this.environments) {
|
||||
|
@ -74,7 +78,7 @@ export default {
|
|||
}
|
||||
},
|
||||
getEnvironments() {
|
||||
let selectProjectId = getCurrentProjectID();
|
||||
let selectProjectId = this.projectId;
|
||||
if (selectProjectId) {
|
||||
this.$get('/api/environment/list/' + selectProjectId, response => {
|
||||
this.environments = response.data;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
import ApiCaseHeader from "./ApiCaseHeader";
|
||||
import ApiCaseItem from "./ApiCaseItem";
|
||||
import MsRun from "../Run";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsDrawer from "../../../../common/components/MsDrawer";
|
||||
import {CASE_ORDER} from "../../model/JsonData";
|
||||
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
|
@ -89,7 +89,6 @@
|
|||
runData: [],
|
||||
selectdCases: [],
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
testCaseId: "",
|
||||
checkedCases: new Set(),
|
||||
visible: false,
|
||||
|
@ -128,7 +127,6 @@
|
|||
},
|
||||
created() {
|
||||
this.api = this.currentApi;
|
||||
this.projectId = getCurrentProjectID();
|
||||
if (this.createCase) {
|
||||
this.sysAddition();
|
||||
}
|
||||
|
@ -136,7 +134,10 @@
|
|||
computed: {
|
||||
isCaseEdit() {
|
||||
return this.testCaseId ? true : false;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(api, testCaseId) {
|
||||
|
@ -290,7 +291,7 @@
|
|||
this.singleRunId = row.id;
|
||||
row.request.name = row.id;
|
||||
row.request.useEnvironment = this.environment;
|
||||
row.request.projectId = getCurrentProjectID();
|
||||
row.request.projectId = this.projectId;
|
||||
this.runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
|
@ -354,7 +355,7 @@
|
|||
if (form) {
|
||||
param[form.type] = form.value;
|
||||
param.ids = this.selectdCases;
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
param.envId = form.envId;
|
||||
if (this.api) {
|
||||
param.protocol = this.api.protocol;
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID} from "../../../../../../common/js/utils";
|
||||
import ScheduleImport from "@/business/components/api/definition/components/import/ImportScheduleEdit";
|
||||
|
||||
export default {
|
||||
|
@ -202,7 +201,10 @@ export default {
|
|||
},
|
||||
isScenarioModel() {
|
||||
return this.model === 'scenario';
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
scheduleEdit() {
|
||||
|
@ -283,7 +285,7 @@ export default {
|
|||
})
|
||||
param.modeId = this.formData.modeId
|
||||
}
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
if (!this.swaggerUrlEnable) {
|
||||
param.swaggerUrl = undefined;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
|||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
|
||||
import {getBodyUploadFiles, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import {getBodyUploadFiles} from "@/common/js/utils";
|
||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
|
||||
import MsReferenceView from "../reference/ReferenceView";
|
||||
|
@ -282,11 +282,13 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
// 接口定义用例列表
|
||||
isApiModel() {
|
||||
return this.model === 'api'
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
|
@ -305,7 +307,7 @@ export default {
|
|||
this.selectAll = false;
|
||||
this.unSelection = [];
|
||||
this.selectDataCounts = 0;
|
||||
this.condition.projectId = getCurrentProjectID();
|
||||
this.condition.projectId = this.projectId;
|
||||
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
|
@ -409,7 +411,7 @@ export default {
|
|||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let obj = {};
|
||||
obj.projectId = getCurrentProjectID();
|
||||
obj.projectId = this.projectId;
|
||||
obj.selectAllDate = this.isSelectAllDate;
|
||||
obj.unSelectIds = this.unSelection;
|
||||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
|
@ -456,7 +458,7 @@ export default {
|
|||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
param = Object.assign(param, this.condition);
|
||||
|
@ -528,7 +530,7 @@ export default {
|
|||
},
|
||||
showEnvironment(row) {
|
||||
|
||||
let projectID = getCurrentProjectID();
|
||||
let projectID = this.projectId;
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
|
@ -580,7 +582,7 @@ export default {
|
|||
id: row.id,
|
||||
testElement: testPlan,
|
||||
name: row.name,
|
||||
projectId: getCurrentProjectID(),
|
||||
projectId: this.projectId,
|
||||
};
|
||||
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
||||
reqObj.reportId = "run";
|
||||
|
|
|
@ -225,7 +225,6 @@
|
|||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {checkoutTestManagerOrTestUser, downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {PROJECT_NAME} from '@/common/js/constants';
|
||||
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
|
||||
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
|
@ -370,6 +369,11 @@
|
|||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
if (this.trashEnable) {
|
||||
this.condition.filters = {status: ["Trash"]};
|
||||
|
@ -409,7 +413,7 @@
|
|||
initCondition(this.condition);
|
||||
this.selectDataCounts = 0;
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
this.condition.projectId = getCurrentProjectID();
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
}
|
||||
|
@ -636,7 +640,7 @@
|
|||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
param.ids = ids;
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
param.moduleId = param.nodeId;
|
||||
param.condition = this.condition;
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
|
|
|
@ -38,7 +38,6 @@ import MsAddBasisApi from "../basis/AddBasisApi";
|
|||
import SelectMenu from "../../../../track/common/SelectMenu";
|
||||
import {OPTIONS} from "../../model/JsonData";
|
||||
import ApiImport from "../import/ApiImport";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsNodeTree from "../../../../track/common/NodeTree";
|
||||
import ApiModuleHeader from "./ApiModuleHeader";
|
||||
import {buildNodePath} from "../../model/NodeTree";
|
||||
|
@ -60,7 +59,6 @@ export default {
|
|||
filterText: "",
|
||||
trashEnable: false
|
||||
},
|
||||
projectId: "",
|
||||
data: [],
|
||||
currentModule: {},
|
||||
}
|
||||
|
@ -85,10 +83,12 @@ export default {
|
|||
},
|
||||
isReviewModel() {
|
||||
return this.reviewId ? true : false;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.$emit('protocolChange', this.condition.protocol);
|
||||
this.list();
|
||||
},
|
||||
|
|
|
@ -58,7 +58,6 @@ import {OPTIONS} from "../../model/JsonData";
|
|||
import MsAddBasisApi from "../basis/AddBasisApi";
|
||||
import ApiImport from "../import/ApiImport";
|
||||
import ModuleTrashButton from "./ModuleTrashButton";
|
||||
import {getCurrentProjectID} from "../../../../../../common/js/utils";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import TemplateComponent from "../../../../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
|
||||
|
||||
|
@ -91,6 +90,11 @@ export default {
|
|||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleCommand(e) {
|
||||
|
@ -104,12 +108,12 @@ export default {
|
|||
case "add-module":
|
||||
break;
|
||||
case "import":
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
this.protocol = "HTTP";
|
||||
this.result = this.$get("/api/module/list/" + getCurrentProjectID() + "/" + this.protocol, response => {
|
||||
this.result = this.$get("/api/module/list/" + this.projectId + "/" + this.protocol, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data = response.data;
|
||||
let moduleOptions = [];
|
||||
|
@ -124,7 +128,7 @@ export default {
|
|||
}
|
||||
},
|
||||
chooseExportType(e) {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
@ -138,7 +142,7 @@ export default {
|
|||
}
|
||||
},
|
||||
addApi() {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,10 @@ export default {
|
|||
let projectId = localStorage.getItem(PROJECT_ID);
|
||||
if (!projectId || projectId != userLastProjectId) {
|
||||
localStorage.setItem(PROJECT_ID, userLastProjectId);
|
||||
this.$store.commit('setProjectId', userLastProjectId);
|
||||
window.location.reload();
|
||||
} else {
|
||||
this.$store.commit('setProjectId', projectId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +112,7 @@ export default {
|
|||
}
|
||||
this.$post("/user/update/current", {id: this.userId, lastProjectId: projectId}, () => {
|
||||
localStorage.setItem(PROJECT_ID, projectId);
|
||||
this.$store.commit('setProjectId', projectId);
|
||||
let path = this.$route.matched[0].path ? this.$route.matched[0].path : '/';
|
||||
if (path === '/api') {
|
||||
if (this.isNewVersion) {
|
||||
|
|
Loading…
Reference in New Issue