fix: 接口自动化从vuex获取projectId
This commit is contained in:
parent
0073ed1307
commit
0bd0098b95
|
@ -70,7 +70,6 @@
|
|||
import {getUUID, downloadFile, checkoutTestManagerOrTestUser} from "@/common/js/utils";
|
||||
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
|
||||
import MsEditApiScenario from "./scenario/EditApiScenario";
|
||||
import {getCurrentProjectID} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiAutomation",
|
||||
|
@ -96,7 +95,10 @@
|
|||
},
|
||||
isReadOnly() {
|
||||
return !checkoutTestManagerOrTestUser();
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -145,7 +147,7 @@
|
|||
let selectParamArr = redirectParam.split("edit:");
|
||||
if (selectParamArr.length == 2) {
|
||||
let scenarioId = selectParamArr[1];
|
||||
let projectId = getCurrentProjectID();
|
||||
let projectId = this.projectId;
|
||||
//查找单条数据,跳转修改页面
|
||||
let url = "/api/automation/list/" + 1 + "/" + 1;
|
||||
this.$post(url, {id: scenarioId, projectId: projectId}, response => {
|
||||
|
@ -176,7 +178,7 @@
|
|||
}
|
||||
},
|
||||
addTab(tab) {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
import MsApiReportExport from "./ApiReportExport";
|
||||
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
||||
import {RequestFactory} from "../../definition/model/ApiTestModel";
|
||||
import {windowPrint, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {windowPrint} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsApiReport",
|
||||
|
@ -211,7 +211,7 @@
|
|||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
this.report.projectId = getCurrentProjectID();
|
||||
this.report.projectId = this.projectId;
|
||||
let url = "/api/scenario/report/update";
|
||||
this.result = this.$post(url, this.report, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
|
@ -236,7 +236,10 @@
|
|||
},
|
||||
isNotRunning() {
|
||||
return "Running" !== this.report.status;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
|
@ -84,6 +84,11 @@
|
|||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
saveScenario(saveAs) {
|
||||
this.$refs['scenarioForm'].validate((valid) => {
|
||||
|
@ -105,7 +110,7 @@
|
|||
})
|
||||
},
|
||||
setParameter() {
|
||||
this.scenarioForm.projectId = getCurrentProjectID();
|
||||
this.scenarioForm.projectId = this.projectId;
|
||||
this.scenarioForm.id = getUUID().substring(0, 8);
|
||||
this.scenarioForm.protocol = this.currentProtocol;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import MsTag from "../../../common/components/MsTag";
|
||||
import {downloadFile, getCurrentProjectID, getCurrentUser, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import {downloadFile, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "./TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -264,7 +264,6 @@
|
|||
infoDb: false,
|
||||
runVisible: false,
|
||||
planVisible: false,
|
||||
projectId: "",
|
||||
runData: [],
|
||||
report: {},
|
||||
selectDataSize: 0,
|
||||
|
@ -338,7 +337,6 @@
|
|||
},
|
||||
created() {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.search();
|
||||
this.getPrincipalOptions([]);
|
||||
},
|
||||
|
@ -363,7 +361,10 @@
|
|||
computed: {
|
||||
isNotRunning() {
|
||||
return "Running" !== this.report.status;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
customHeader() {
|
||||
|
@ -559,7 +560,7 @@
|
|||
},
|
||||
buildBatchParam(param) {
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
param.condition = this.condition;
|
||||
},
|
||||
handleBatchExecute() {
|
||||
|
@ -640,7 +641,7 @@
|
|||
let scenarioIds = [];
|
||||
scenarioIds.push(row.id);
|
||||
run.id = getUUID();
|
||||
run.projectId = getCurrentProjectID();
|
||||
run.projectId = this.projectId;
|
||||
run.ids = scenarioIds;
|
||||
this.$post(url, run, response => {
|
||||
let data = response.data;
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
<script>
|
||||
import SelectMenu from "../../../track/common/SelectMenu";
|
||||
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsNodeTree from "../../../track/common/NodeTree";
|
||||
import {buildNodePath} from "../../definition/model/NodeTree";
|
||||
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
|
||||
|
@ -90,7 +89,10 @@
|
|||
},
|
||||
isRelevanceModel() {
|
||||
return this.relevanceProjectId ? true : false;
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -99,14 +101,12 @@
|
|||
filterText: "",
|
||||
trashEnable: false
|
||||
},
|
||||
projectId: "",
|
||||
data: [],
|
||||
currentModule: undefined,
|
||||
moduleOptions: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.list();
|
||||
},
|
||||
watch: {
|
||||
|
@ -130,7 +130,7 @@
|
|||
this.addScenario();
|
||||
break;
|
||||
case "import":
|
||||
this.result = this.$get("/api/automation/module/list/" + getCurrentProjectID(), response => {
|
||||
this.result = this.$get("/api/automation/module/list/" + this.projectId, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data = response.data;
|
||||
let moduleOptions = [];
|
||||
|
@ -238,7 +238,7 @@
|
|||
this.$emit("refreshTable");
|
||||
},
|
||||
addScenario() {
|
||||
if (!getCurrentProjectID()) {
|
||||
if (!this.projectId) {
|
||||
this.$warning(this.$t('commons.check_project_tip'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@
|
|||
import {parseEnvironment} from "../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "./Setting";
|
||||
import MsApiCustomize from "./ApiCustomize";
|
||||
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj, handleCtrlSEvent} from "@/common/js/utils";
|
||||
import {getUUID, objToStrMap, strMapToObj, handleCtrlSEvent} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "./MsInputTag";
|
||||
import MsRun from "./DebugRun";
|
||||
|
@ -300,7 +300,6 @@
|
|||
path: "/api/automation/create",
|
||||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
enableCookieShare: false,
|
||||
globalOptions: {
|
||||
spacing: 30
|
||||
|
@ -317,7 +316,6 @@
|
|||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
}
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.getWsProjects();
|
||||
this.getMaintainerOptions();
|
||||
|
@ -438,7 +436,10 @@
|
|||
}
|
||||
];
|
||||
return buttons.filter(btn => btn.show);
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 打开引用的场景
|
||||
|
@ -574,7 +575,7 @@
|
|||
arr[i].countController.proceed = true;
|
||||
}
|
||||
if (!arr[i].projectId) {
|
||||
arr[i].projectId = getCurrentProjectID();
|
||||
arr[i].projectId = this.projectId;
|
||||
}
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree);
|
||||
|
@ -596,7 +597,7 @@
|
|||
}
|
||||
// 设置项目ID
|
||||
if (!this.scenarioDefinition[i].projectId) {
|
||||
this.scenarioDefinition[i].projectId = getCurrentProjectID();
|
||||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
|
||||
|
@ -957,7 +958,7 @@
|
|||
this.projectEnvMap = objToStrMap(obj.environmentMap);
|
||||
} else {
|
||||
// 兼容历史数据
|
||||
this.projectEnvMap.set(getCurrentProjectID(), obj.environmentId);
|
||||
this.projectEnvMap.set(this.projectId, obj.environmentId);
|
||||
}
|
||||
this.currentScenario.variables = [];
|
||||
let index = 1;
|
||||
|
@ -994,7 +995,7 @@
|
|||
},
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
this.currentScenario.projectId = getCurrentProjectID();
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
|
|
|
@ -69,8 +69,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ScenarioImport",
|
||||
|
@ -161,6 +160,9 @@
|
|||
isHar() {
|
||||
return this.selectedPlatformValue === 'Har';
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
scheduleEdit() {
|
||||
|
@ -241,7 +243,7 @@
|
|||
})
|
||||
param.modeId = this.formData.modeId
|
||||
}
|
||||
param.projectId = getCurrentProjectID();
|
||||
param.projectId = this.projectId;
|
||||
if (!this.swaggerUrlEable) {
|
||||
param.swaggerUrl = undefined;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
import {parseEnvironment} from "../../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "../Setting";
|
||||
import MsApiCustomize from "../ApiCustomize";
|
||||
import {getCurrentProjectID, getUUID, objToStrMap, strMapToObj} from "@/common/js/utils";
|
||||
import {getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "../../../definition/components/environment/ApiEnvironmentConfig";
|
||||
import MsInputTag from "../MsInputTag";
|
||||
import MsRun from "../DebugRun";
|
||||
|
@ -215,7 +215,6 @@
|
|||
path: "/api/automation/create",
|
||||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
enableCookieShare: false,
|
||||
globalOptions: {
|
||||
spacing: 30
|
||||
|
@ -231,7 +230,6 @@
|
|||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
}
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.projectEnvMap = this.envMap;
|
||||
},
|
||||
|
@ -354,7 +352,10 @@
|
|||
}
|
||||
];
|
||||
return buttons.filter(btn => btn.show);
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 打开引用的场景
|
||||
|
@ -496,7 +497,7 @@
|
|||
arr[i].countController.proceed = true;
|
||||
}
|
||||
if (!arr[i].projectId) {
|
||||
arr[i].projectId = getCurrentProjectID();
|
||||
arr[i].projectId = this.projectId;
|
||||
}
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree);
|
||||
|
@ -518,7 +519,7 @@
|
|||
}
|
||||
// 设置项目ID
|
||||
if (!this.scenarioDefinition[i].projectId) {
|
||||
this.scenarioDefinition[i].projectId = getCurrentProjectID();
|
||||
this.scenarioDefinition[i].projectId = this.projectId;
|
||||
}
|
||||
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
|
||||
|
@ -858,7 +859,7 @@
|
|||
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
this.currentScenario.projectId = getCurrentProjectID();
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
|
|
Loading…
Reference in New Issue