refactor: 修改查询projectId的方式
This commit is contained in:
parent
2c95a05646
commit
5ca32674a2
|
@ -40,7 +40,7 @@
|
|||
import MsApiReportExport from "./ApiReportExport";
|
||||
import MsApiReportViewHeader from "./ApiReportViewHeader";
|
||||
import {RequestFactory} from "../../definition/model/ApiTestModel";
|
||||
import {windowPrint,getUUID} from "@/common/js/utils";
|
||||
import {windowPrint, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsApiReport",
|
||||
|
@ -310,7 +310,7 @@
|
|||
return "Running" !== this.report.status;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
import MsDebugJdbcPage from "../../definition/components/debug/DebugJdbcPage";
|
||||
import MsDebugTcpPage from "../../definition/components/debug/DebugTcpPage";
|
||||
import MsDebugDubboPage from "../../definition/components/debug/DebugDubboPage";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiCustomize",
|
||||
|
@ -68,7 +68,7 @@
|
|||
this.request.method = row.method;
|
||||
}
|
||||
this.request.resourceId = getUUID();
|
||||
this.request.projectId = this.$store.state.projectId;
|
||||
this.request.projectId = getCurrentProjectID();
|
||||
let obj = {};
|
||||
Object.assign(obj, this.request);
|
||||
this.$emit('addCustomizeApi', obj);
|
||||
|
|
|
@ -413,7 +413,7 @@ export default {
|
|||
return "Running" !== this.report.status;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
|
||||
import ApiImport from "./common/ScenarioImport";
|
||||
import MsSearchBar from "@/business/components/common/components/search/MsSearchBar";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: 'MsApiScenarioModule',
|
||||
|
@ -78,7 +79,7 @@
|
|||
return this.relevanceProjectId ? true : false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -501,7 +501,7 @@
|
|||
return buttons.filter(btn => btn.show);
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import MsSelectTree from "../../../../common/select-tree/SelectTree";
|
||||
|
||||
export default {
|
||||
|
@ -164,7 +164,7 @@
|
|||
return this.selectedPlatformValue === 'Har';
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -227,7 +227,7 @@ export default {
|
|||
return false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
this.scenario.projectId = response.data.projectId;
|
||||
const pro = this.projectList.find(p => p.id === response.data.projectId);
|
||||
if (!pro) {
|
||||
this.scenario.projectId = this.$store.state.projectId;
|
||||
this.scenario.projectId = getCurrentProjectID();
|
||||
}
|
||||
if (this.scenario.hashTree) {
|
||||
this.setDisabled(this.scenario.hashTree, this.scenario.projectId);
|
||||
|
@ -103,7 +103,7 @@
|
|||
return false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
@ -148,13 +148,13 @@
|
|||
},
|
||||
calcProjectId(projectId, parentId) {
|
||||
if (!projectId) {
|
||||
return parentId ? parentId : this.$store.state.projectId;
|
||||
return parentId ? parentId : getCurrentProjectID();
|
||||
} else {
|
||||
const project = this.projectList.find(p => p.id === projectId);
|
||||
if (project) {
|
||||
return projectId;
|
||||
}
|
||||
return parentId ? parentId : this.$store.state.projectId;
|
||||
return parentId ? parentId : getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
getProjectName(id) {
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
import {parseEnvironment} from "../../../definition/model/EnvironmentModel";
|
||||
import {ELEMENT_TYPE, ELEMENTS} from "../Setting";
|
||||
import MsApiCustomize from "../ApiCustomize";
|
||||
import {getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import ApiEnvironmentConfig from "@/business/components/api/test/components/ApiEnvironmentConfig";
|
||||
import MsInputTag from "../MsInputTag";
|
||||
import MsRun from "../DebugRun";
|
||||
|
@ -364,7 +364,7 @@
|
|||
return buttons.filter(btn => btn.show);
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {exportPdf} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import {exportPdf, getCurrentProjectID} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import EnvPopover from "../../scenario/EnvPopover";
|
||||
|
||||
export default {
|
||||
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -160,7 +160,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 {getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
|
||||
import MsApiModule from "./components/module/ApiModule";
|
||||
import ApiCaseSimpleList from "./components/list/ApiCaseSimpleList";
|
||||
|
||||
|
@ -185,7 +185,7 @@ export default {
|
|||
return false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<span></span>
|
||||
</template>
|
||||
<script>
|
||||
import {getBodyUploadFiles, strMapToObj} from "@/common/js/utils";
|
||||
import ThreadGroup from "./jmeter/components/thread-group";
|
||||
import {getBodyUploadFiles, getCurrentProjectID, strMapToObj} from "@/common/js/utils";
|
||||
import ThreadGroup from "./jmeter/components/thread-group";
|
||||
import TestPlan from "./jmeter/components/test-plan";
|
||||
|
||||
export default {
|
||||
|
@ -58,10 +58,10 @@
|
|||
}
|
||||
},
|
||||
run() {
|
||||
let projectId = this.$store.state.projectId;
|
||||
let projectId = getCurrentProjectID();
|
||||
// 如果envMap不存在,是单接口调用
|
||||
if (!this.envMap || this.envMap.size === 0) {
|
||||
projectId = this.$store.state.projectId;
|
||||
projectId = getCurrentProjectID();
|
||||
} else {
|
||||
// 场景步骤下接口调用
|
||||
if (this.runData.projectId) {
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||
|
||||
export default {
|
||||
|
@ -65,7 +65,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -48,128 +48,195 @@
|
|||
</template>
|
||||
<script>
|
||||
|
||||
import ApiCaseHeader from "./ApiCaseHeader";
|
||||
import ApiCaseItem from "./ApiCaseItem";
|
||||
import MsRun from "../Run";
|
||||
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";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {CASE_PRIORITY, REQ_METHOD, TCP_METHOD, SQL_METHOD, DUBBO_METHOD} from "../../model/JsonData";
|
||||
import ApiCaseHeader from "./ApiCaseHeader";
|
||||
import ApiCaseItem from "./ApiCaseItem";
|
||||
import MsRun from "../Run";
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import MsDrawer from "../../../../common/components/MsDrawer";
|
||||
import {CASE_ORDER, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
|
||||
export default {
|
||||
name: 'ApiCaseList',
|
||||
components: {
|
||||
MsDrawer,
|
||||
MsRun,
|
||||
ApiCaseHeader,
|
||||
ApiCaseItem,
|
||||
MsBatchEdit
|
||||
export default {
|
||||
name: 'ApiCaseList',
|
||||
components: {
|
||||
MsDrawer,
|
||||
MsRun,
|
||||
ApiCaseHeader,
|
||||
ApiCaseItem,
|
||||
MsBatchEdit
|
||||
},
|
||||
props: {
|
||||
createCase: String,
|
||||
loaded: Boolean,
|
||||
refreshSign: String,
|
||||
currentApi: {
|
||||
type: Object
|
||||
},
|
||||
props: {
|
||||
createCase: String,
|
||||
loaded: Boolean,
|
||||
refreshSign: String,
|
||||
currentApi: {
|
||||
type: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
grades: [],
|
||||
environment: "",
|
||||
isReadOnly: false,
|
||||
selectedEvent: Object,
|
||||
priorities: CASE_ORDER,
|
||||
apiCaseList: [],
|
||||
batchLoadingIds: [],
|
||||
singleLoading: false,
|
||||
singleRunId: "",
|
||||
runData: [],
|
||||
selectdCases: [],
|
||||
reportId: "",
|
||||
testCaseId: "",
|
||||
checkedCases: new Set(),
|
||||
visible: false,
|
||||
condition: {
|
||||
components: API_CASE_CONFIGS
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
grades: [],
|
||||
environment: "",
|
||||
isReadOnly: false,
|
||||
selectedEvent: Object,
|
||||
priorities: CASE_ORDER,
|
||||
apiCaseList: [],
|
||||
batchLoadingIds: [],
|
||||
singleLoading: false,
|
||||
singleRunId: "",
|
||||
runData: [],
|
||||
selectdCases: [],
|
||||
reportId: "",
|
||||
testCaseId: "",
|
||||
checkedCases: new Set(),
|
||||
visible: false,
|
||||
condition: {
|
||||
components: API_CASE_CONFIGS
|
||||
},
|
||||
api: {},
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
valueArr: {
|
||||
priority: CASE_PRIORITY,
|
||||
method: REQ_METHOD,
|
||||
},
|
||||
envMap: new Map,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
refreshSign() {
|
||||
this.api = this.currentApi;
|
||||
this.getApiTest();
|
||||
api: {},
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
valueArr: {
|
||||
priority: CASE_PRIORITY,
|
||||
method: REQ_METHOD,
|
||||
},
|
||||
createCase() {
|
||||
this.api = this.currentApi;
|
||||
this.sysAddition();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
envMap: new Map,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
refreshSign() {
|
||||
this.api = this.currentApi;
|
||||
if (this.createCase) {
|
||||
this.sysAddition();
|
||||
}
|
||||
this.getApiTest();
|
||||
},
|
||||
computed: {
|
||||
isCaseEdit() {
|
||||
return this.testCaseId ? true : false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
createCase() {
|
||||
this.api = this.currentApi;
|
||||
this.sysAddition();
|
||||
},
|
||||
methods: {
|
||||
open(api, testCaseId) {
|
||||
this.api = api;
|
||||
// testCaseId 不为空则为用例编辑页面
|
||||
this.testCaseId = testCaseId;
|
||||
this.condition = {components: API_CASE_CONFIGS};
|
||||
this.getApiTest(true);
|
||||
this.visible = true;
|
||||
},
|
||||
runTestCase(api, testCaseId) {
|
||||
this.api = api;
|
||||
// testCaseId 不为空则为用例编辑页面
|
||||
this.testCaseId = testCaseId;
|
||||
this.condition = {components: API_CASE_CONFIGS};
|
||||
this.getApiTestToRunTestCase(testCaseId);
|
||||
this.visible = true;
|
||||
},
|
||||
saveApiAndCase(api) {
|
||||
this.visible = true;
|
||||
this.api = api;
|
||||
this.currentApi = api;
|
||||
},
|
||||
created() {
|
||||
this.api = this.currentApi;
|
||||
if (this.createCase) {
|
||||
this.sysAddition();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isCaseEdit() {
|
||||
return this.testCaseId ? true : false;
|
||||
},
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
open(api, testCaseId) {
|
||||
this.api = api;
|
||||
// testCaseId 不为空则为用例编辑页面
|
||||
this.testCaseId = testCaseId;
|
||||
this.condition = {components: API_CASE_CONFIGS};
|
||||
this.getApiTest(true);
|
||||
this.visible = true;
|
||||
},
|
||||
runTestCase(api, testCaseId) {
|
||||
this.api = api;
|
||||
// testCaseId 不为空则为用例编辑页面
|
||||
this.testCaseId = testCaseId;
|
||||
this.condition = {components: API_CASE_CONFIGS};
|
||||
this.getApiTestToRunTestCase(testCaseId);
|
||||
this.visible = true;
|
||||
},
|
||||
saveApiAndCase(api) {
|
||||
this.visible = true;
|
||||
this.api = api;
|
||||
this.currentApi = api;
|
||||
this.addCase();
|
||||
},
|
||||
setEnvironment(environment) {
|
||||
this.environment = environment;
|
||||
},
|
||||
sysAddition() {
|
||||
this.condition.projectId = this.projectId;
|
||||
this.condition.apiDefinitionId = this.api.id;
|
||||
this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = response.data;
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
this.$set(apiCase, 'selected', false);
|
||||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
});
|
||||
this.apiCaseList = data;
|
||||
this.addCase();
|
||||
},
|
||||
setEnvironment(environment) {
|
||||
this.environment = environment;
|
||||
},
|
||||
sysAddition() {
|
||||
});
|
||||
},
|
||||
|
||||
apiCaseClose() {
|
||||
this.apiCaseList = [];
|
||||
this.visible = false;
|
||||
this.$emit('refresh');
|
||||
},
|
||||
refreshModule() {
|
||||
this.$emit('refreshModule');
|
||||
},
|
||||
runRefresh() {
|
||||
this.batchLoadingIds = [];
|
||||
this.singleLoading = false;
|
||||
this.singleRunId = "";
|
||||
if (this.$refs.header.isSelectAll) {
|
||||
this.$refs.header.isSelectAll = false;
|
||||
} else {
|
||||
this.apiCaseList.forEach(item => {
|
||||
this.$set(item, 'selected', false);
|
||||
});
|
||||
}
|
||||
// 批量更新最后执行环境
|
||||
let obj = {envId: this.environment, show: true};
|
||||
this.batchEdit(obj);
|
||||
this.$success(this.$t('organization.integration.successful_operation'));
|
||||
},
|
||||
errorRefresh() {
|
||||
this.batchLoadingIds = [];
|
||||
this.singleLoading = false;
|
||||
this.singleRunId = "";
|
||||
},
|
||||
refresh() {
|
||||
this.getApiTest();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
selectAll(isSelectAll) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
this.$set(item, 'selected', isSelectAll);
|
||||
});
|
||||
},
|
||||
getApiTest(addCase) {
|
||||
this.environment = "";
|
||||
if (this.api) {
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.isCaseEdit) {
|
||||
this.condition.id = this.testCaseId;
|
||||
}
|
||||
this.condition.apiDefinitionId = this.api.id;
|
||||
this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = response.data;
|
||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = [];
|
||||
if (response.data) {
|
||||
data = response.data;
|
||||
}
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
|
@ -181,271 +248,203 @@
|
|||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
})
|
||||
const index = this.runData.findIndex(d => d.name === apiCase.id);
|
||||
if (index !== -1) {
|
||||
apiCase.active = true;
|
||||
}
|
||||
});
|
||||
this.apiCaseList = data;
|
||||
this.addCase();
|
||||
});
|
||||
},
|
||||
|
||||
apiCaseClose() {
|
||||
this.apiCaseList = [];
|
||||
this.visible = false;
|
||||
this.$emit('refresh');
|
||||
},
|
||||
refreshModule() {
|
||||
this.$emit('refreshModule');
|
||||
},
|
||||
runRefresh() {
|
||||
this.batchLoadingIds = [];
|
||||
this.singleLoading = false;
|
||||
this.singleRunId = "";
|
||||
if (this.$refs.header.isSelectAll) {
|
||||
this.$refs.header.isSelectAll = false;
|
||||
} else {
|
||||
this.apiCaseList.forEach(item => {
|
||||
this.$set(item, 'selected', false);
|
||||
})
|
||||
}
|
||||
// 批量更新最后执行环境
|
||||
let obj = {envId: this.environment, show: true};
|
||||
this.batchEdit(obj);
|
||||
this.$success(this.$t('organization.integration.successful_operation'));
|
||||
},
|
||||
errorRefresh() {
|
||||
this.batchLoadingIds = [];
|
||||
this.singleLoading = false;
|
||||
this.singleRunId = "";
|
||||
},
|
||||
refresh() {
|
||||
this.getApiTest();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
selectAll(isSelectAll) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
this.$set(item, 'selected', isSelectAll);
|
||||
});
|
||||
},
|
||||
getApiTest(addCase) {
|
||||
this.environment = "";
|
||||
if (this.api) {
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.isCaseEdit) {
|
||||
this.condition.id = this.testCaseId;
|
||||
if (this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||
this.environment = this.apiCaseList[0].request.useEnvironment;
|
||||
}
|
||||
if (addCase && this.apiCaseList.length === 0 && !this.loaded) {
|
||||
this.addCase();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getApiTestToRunTestCase(testCaseId) {
|
||||
if (this.api) {
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.isCaseEdit) {
|
||||
this.condition.id = this.testCaseId;
|
||||
}
|
||||
if (this.api) {
|
||||
this.condition.apiDefinitionId = this.api.id;
|
||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = [];
|
||||
if (response.data) {
|
||||
data = response.data;
|
||||
}
|
||||
|
||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = [];
|
||||
if (response.data) {
|
||||
data = response.data;
|
||||
}
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
this.$set(apiCase, 'selected', false);
|
||||
}
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
this.$set(apiCase, 'selected', false);
|
||||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
const index = this.runData.findIndex(d => d.name === apiCase.id);
|
||||
if (index !== -1) {
|
||||
apiCase.active = true;
|
||||
}
|
||||
});
|
||||
this.apiCaseList = data;
|
||||
if (this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||
this.environment = this.apiCaseList[0].request.useEnvironment;
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
}
|
||||
if (addCase && this.apiCaseList.length === 0 && !this.loaded) {
|
||||
this.addCase();
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
|
||||
});
|
||||
this.apiCaseList = data;
|
||||
if (this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||
this.environment = this.apiCaseList[0].request.useEnvironment;
|
||||
}
|
||||
if (this.apiCaseList.length === 0 && !this.loaded) {
|
||||
this.addCase();
|
||||
}
|
||||
this.apiCaseList.forEach(apicase => {
|
||||
if (apicase.id === testCaseId) {
|
||||
let data = apicase;
|
||||
data.message = true;
|
||||
this.singleRun(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getApiTestToRunTestCase(testCaseId) {
|
||||
if (this.api) {
|
||||
this.condition.projectId = this.projectId;
|
||||
if (this.isCaseEdit) {
|
||||
this.condition.id = this.testCaseId;
|
||||
}
|
||||
if (this.api) {
|
||||
this.condition.apiDefinitionId = this.api.id;
|
||||
}
|
||||
|
||||
this.result = this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = [];
|
||||
if (response.data) {
|
||||
data = response.data;
|
||||
}
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
this.$set(apiCase, 'selected', false);
|
||||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
|
||||
})
|
||||
this.apiCaseList = data;
|
||||
if (this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
|
||||
this.environment = this.apiCaseList[0].request.useEnvironment;
|
||||
}
|
||||
if (this.apiCaseList.length === 0 && !this.loaded) {
|
||||
this.addCase();
|
||||
}
|
||||
this.apiCaseList.forEach(apicase => {
|
||||
if (apicase.id === testCaseId) {
|
||||
let data = apicase;
|
||||
data.message = true;
|
||||
this.singleRun(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
addCase() {
|
||||
if (this.api && this.api.request) {
|
||||
// 初始化对象
|
||||
let request = {};
|
||||
if (this.api.request instanceof Object) {
|
||||
request = this.api.request;
|
||||
} else {
|
||||
request = JSON.parse(this.api.request);
|
||||
}
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
if (request.backScript) {
|
||||
request.hashTree.push(request.backScript);
|
||||
}
|
||||
let uuid = getUUID();
|
||||
request.id = uuid;
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true, tags: [], uuid: uuid};
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
}
|
||||
},
|
||||
copyCase(data) {
|
||||
this.apiCaseList.unshift(data);
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.visible = false;
|
||||
},
|
||||
showExecResult(row) {
|
||||
this.visible = false;
|
||||
this.$emit('showExecResult', row);
|
||||
},
|
||||
|
||||
singleRun(row) {
|
||||
if (this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
this.selectdCases = [];
|
||||
this.selectdCases.push(row.id);
|
||||
this.runData = [];
|
||||
this.singleLoading = true;
|
||||
this.singleRunId = row.id;
|
||||
row.request.name = row.id;
|
||||
row.request.useEnvironment = this.environment;
|
||||
row.request.projectId = this.projectId;
|
||||
this.runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
},
|
||||
|
||||
batchRun() {
|
||||
if (this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
this.envMap = new Map();
|
||||
this.envMap.set(this.$store.state.projectId, this.environment);
|
||||
this.runData = [];
|
||||
this.batchLoadingIds = [];
|
||||
this.selectdCases = [];
|
||||
if (this.apiCaseList.length > 0) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
if (item.selected && item.id) {
|
||||
item.request.name = item.id;
|
||||
item.request.useEnvironment = this.environment;
|
||||
this.runData.push(item.request);
|
||||
this.batchLoadingIds.push(item.id);
|
||||
this.selectdCases.push(item.id);
|
||||
}
|
||||
})
|
||||
if (this.runData.length > 0) {
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
} else {
|
||||
this.$warning("请勾选要执行的用例!");
|
||||
}
|
||||
} else {
|
||||
this.$warning("没有可执行的用例!");
|
||||
}
|
||||
},
|
||||
batchEditCase() {
|
||||
if (this.apiCaseList.length > 0) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
if (item.selected && item.id) {
|
||||
this.selectdCases.push(item.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.selectdCases.length === 0) {
|
||||
this.$warning("请选择用例!");
|
||||
return;
|
||||
}
|
||||
// //根据不同的接口,注入不同的参数
|
||||
if (this.currentApi.protocol === 'HTTP') {
|
||||
this.valueArr.method = REQ_METHOD;
|
||||
} else if (this.currentApi.protocol === 'TCP') {
|
||||
this.valueArr.method = TCP_METHOD;
|
||||
} else if (this.currentApi.protocol === 'SQL') {
|
||||
this.valueArr.method = SQL_METHOD;
|
||||
} else if (this.currentApi.protocol === 'DUBBO') {
|
||||
this.valueArr.method = DUBBO_METHOD;
|
||||
}
|
||||
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
batchEdit(form) {
|
||||
let param = {};
|
||||
if (form) {
|
||||
param[form.type] = form.value;
|
||||
param.ids = this.selectdCases;
|
||||
param.projectId = this.projectId;
|
||||
param.envId = form.envId;
|
||||
if (this.api) {
|
||||
param.protocol = this.api.protocol;
|
||||
}
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
param = Object.assign(param, this.condition);
|
||||
}
|
||||
this.$post('/api/testcase/batch/editByParam', param, () => {
|
||||
if (!form.show) {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
}
|
||||
this.selectdCases = [];
|
||||
this.getApiTest();
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
addCase() {
|
||||
if (this.api && this.api.request) {
|
||||
// 初始化对象
|
||||
let request = {};
|
||||
if (this.api.request instanceof Object) {
|
||||
request = this.api.request;
|
||||
} else {
|
||||
request = JSON.parse(this.api.request);
|
||||
}
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
if (request.backScript) {
|
||||
request.hashTree.push(request.backScript);
|
||||
}
|
||||
let uuid = getUUID();
|
||||
request.id = uuid;
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true, tags: [], uuid: uuid};
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
}
|
||||
},
|
||||
copyCase(data) {
|
||||
this.apiCaseList.unshift(data);
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.visible = false;
|
||||
},
|
||||
showExecResult(row) {
|
||||
this.visible = false;
|
||||
this.$emit('showExecResult', row);
|
||||
},
|
||||
|
||||
singleRun(row) {
|
||||
if (this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
this.selectdCases = [];
|
||||
this.selectdCases.push(row.id);
|
||||
this.runData = [];
|
||||
this.singleLoading = true;
|
||||
this.singleRunId = row.id;
|
||||
row.request.name = row.id;
|
||||
row.request.useEnvironment = this.environment;
|
||||
row.request.projectId = this.projectId;
|
||||
this.runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
},
|
||||
|
||||
batchRun() {
|
||||
if (this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
this.envMap = new Map();
|
||||
this.envMap.set(getCurrentProjectID(), this.environment);
|
||||
this.runData = [];
|
||||
this.batchLoadingIds = [];
|
||||
this.selectdCases = [];
|
||||
if (this.apiCaseList.length > 0) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
if (item.selected && item.id) {
|
||||
item.request.name = item.id;
|
||||
item.request.useEnvironment = this.environment;
|
||||
this.runData.push(item.request);
|
||||
this.batchLoadingIds.push(item.id);
|
||||
this.selectdCases.push(item.id);
|
||||
}
|
||||
});
|
||||
if (this.runData.length > 0) {
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
} else {
|
||||
this.$warning("请勾选要执行的用例!");
|
||||
}
|
||||
} else {
|
||||
this.$warning("没有可执行的用例!");
|
||||
}
|
||||
},
|
||||
batchEditCase() {
|
||||
if (this.apiCaseList.length > 0) {
|
||||
this.apiCaseList.forEach(item => {
|
||||
if (item.selected && item.id) {
|
||||
this.selectdCases.push(item.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.selectdCases.length === 0) {
|
||||
this.$warning("请选择用例!");
|
||||
return;
|
||||
}
|
||||
// //根据不同的接口,注入不同的参数
|
||||
if (this.currentApi.protocol === 'HTTP') {
|
||||
this.valueArr.method = REQ_METHOD;
|
||||
} else if (this.currentApi.protocol === 'TCP') {
|
||||
this.valueArr.method = TCP_METHOD;
|
||||
} else if (this.currentApi.protocol === 'SQL') {
|
||||
this.valueArr.method = SQL_METHOD;
|
||||
} else if (this.currentApi.protocol === 'DUBBO') {
|
||||
this.valueArr.method = DUBBO_METHOD;
|
||||
}
|
||||
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
batchEdit(form) {
|
||||
let param = {};
|
||||
if (form) {
|
||||
param[form.type] = form.value;
|
||||
param.ids = this.selectdCases;
|
||||
param.projectId = this.projectId;
|
||||
param.envId = form.envId;
|
||||
if (this.api) {
|
||||
param.protocol = this.api.protocol;
|
||||
}
|
||||
param.selectAllDate = this.isSelectAllDate;
|
||||
param.unSelectIds = this.unSelection;
|
||||
param = Object.assign(param, this.condition);
|
||||
}
|
||||
this.$post('/api/testcase/batch/editByParam', param, () => {
|
||||
if (!form.show) {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
}
|
||||
this.selectdCases = [];
|
||||
this.getApiTest();
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.ms-drawer >>> .ms-drawer-body {
|
||||
margin-top: 80px;
|
||||
}
|
||||
.ms-drawer >>> .ms-drawer-body {
|
||||
margin-top: 80px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import {listenGoBack, removeGoBackListener,hasLicense} from "@/common/js/utils";
|
||||
import {listenGoBack, removeGoBackListener, hasLicense, getCurrentProjectID} from "@/common/js/utils";
|
||||
import ScheduleImport from "@/business/components/api/definition/components/import/ImportScheduleEdit";
|
||||
import MsSelectTree from "../../../../common/select-tree/SelectTree";
|
||||
|
||||
|
@ -258,7 +258,7 @@
|
|||
return this.model === 'scenario';
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -160,7 +160,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} from "@/common/js/utils";
|
||||
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
|
||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
|
||||
import MsReferenceView from "../reference/ReferenceView";
|
||||
|
@ -313,7 +313,7 @@ export default {
|
|||
return this.model === 'api';
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
selectRows() {
|
||||
return this.$refs.caseTable.getSelectRows();
|
||||
|
|
|
@ -406,7 +406,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
selectRows() {
|
||||
return this.$refs.apiDefinitionTable.getSelectRows();
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
import MsNodeTree from "../../../../track/common/NodeTree";
|
||||
import ApiModuleHeader from "./ApiModuleHeader";
|
||||
import {buildNodePath, buildTree} from "../../model/NodeTree";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: 'MsApiModule',
|
||||
|
@ -94,7 +95,7 @@
|
|||
return this.reviewId ? true : false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -39,6 +39,7 @@ import ApiImport from "../import/ApiImport";
|
|||
import ModuleTrashButton from "./ModuleTrashButton";
|
||||
import TemplateComponent from "../../../../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
|
||||
import MsSearchBar from "@/business/components/common/components/search/MsSearchBar";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiModuleHeader",
|
||||
|
@ -117,7 +118,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
<script>
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsFailureTestCaseList",
|
||||
|
@ -59,7 +60,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
<script>
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
export default {
|
||||
name: "MsRunningTaskList",
|
||||
components: {
|
||||
|
@ -81,7 +82,7 @@ export default {
|
|||
return false;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -339,13 +339,13 @@
|
|||
},
|
||||
getProject() {
|
||||
this.condition.projectIds = [];
|
||||
this.result = this.$get("/project/get/" + this.$store.state.projectId, response => {
|
||||
this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
|
||||
let project = response.data;
|
||||
this.items = [{id: project.id, label: project.name}];
|
||||
this.condition.projectIds = [project.id];
|
||||
this.condition.projectId = project.id;
|
||||
this.initTableData();
|
||||
})
|
||||
});
|
||||
},
|
||||
getType(type) {
|
||||
return this.LOG_TYPE_MAP.get(type);
|
||||
|
|
|
@ -105,7 +105,7 @@ import SelectMenu from "../common/SelectMenu";
|
|||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import {getUUID, hasPermission} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, hasPermission} from "@/common/js/utils";
|
||||
import TestCaseNodeTree from "../common/TestCaseNodeTree";
|
||||
|
||||
import MsTabButton from "@/business/components/common/components/MsTabButton";
|
||||
|
@ -177,7 +177,7 @@ export default {
|
|||
},
|
||||
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
selectNodeIds() {
|
||||
return this.$store.state.testCaseSelectNodeIds;
|
||||
|
|
|
@ -61,6 +61,7 @@ import IssueDescriptionTableItem from "@/business/components/track/issue/IssueDe
|
|||
import {ISSUE_STATUS_MAP} from "@/common/js/table-constants";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import {getPageInfo} from "@/common/js/tableUtils";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
export default {
|
||||
name: "IssueRelateList",
|
||||
components: {MsTablePagination, IssueDescriptionTableItem, MsTableColumn, MsTable, MsEditDialog},
|
||||
|
@ -75,7 +76,7 @@ export default {
|
|||
return ISSUE_STATUS_MAP;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
props: ['caseId'],
|
||||
|
|
|
@ -99,7 +99,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
moduleOptions() {
|
||||
return this.$store.state.testCaseModuleOptions;
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectIds() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
moduleOptions() {
|
||||
return this.$store.state.testCaseModuleOptions;
|
||||
|
|
|
@ -336,7 +336,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
selectNodeIds() {
|
||||
return this.$store.state.testCaseSelectNodeIds;
|
||||
|
|
|
@ -17,6 +17,7 @@ import TemplateComponentEditHeader
|
|||
from "@/business/components/track/plan/view/comonents/report/TemplateComponentEditHeader";
|
||||
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
||||
import MsEditDialog from "@/business/components/common/components/MsEditDialog";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
export default {
|
||||
name: "TestPlanIssueEdit",
|
||||
components: {MsEditDialog, IssueEditDetail, TemplateComponentEditHeader},
|
||||
|
@ -27,7 +28,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
props: ['caseId', 'planId'],
|
||||
|
|
|
@ -43,6 +43,7 @@ import TestCaseImport from "@/business/components/track/case/components/TestCase
|
|||
import MsSearchBar from "@/business/components/common/components/search/MsSearchBar";
|
||||
import {buildTree} from "../../api/definition/model/NodeTree";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestCaseNodeTree",
|
||||
|
@ -100,7 +101,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -43,6 +43,7 @@ import MsRecentList from "../../common/head/RecentList";
|
|||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import SearchList from "@/business/components/common/head/SearchList";
|
||||
import ProjectChange from "@/business/components/common/head/ProjectSwitch";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TrackHeaderMenus",
|
||||
|
@ -76,7 +77,7 @@ export default {
|
|||
},
|
||||
planRecent: {
|
||||
title: this.$t('test_track.recent_plan'),
|
||||
url: this.$store.state.projectId === '' ? "/test/plan/recent/5/" + undefined : "/test/plan/recent/5/" + this.$store.state.projectId,
|
||||
url: getCurrentProjectID() === '' ? "/test/plan/recent/5/" + undefined : "/test/plan/recent/5/" + getCurrentProjectID(),
|
||||
index: function (item) {
|
||||
return '/track/plan/view/' + item.id;
|
||||
},
|
||||
|
|
|
@ -80,6 +80,7 @@ import BugCountCard from "@/business/components/track/home/components/BugCountCa
|
|||
import ReviewList from "@/business/components/track/home/components/ReviewList";
|
||||
import MsRunningTaskList from "@/business/components/api/homepage/components/RunningTaskList";
|
||||
import MsFailureTestCaseList from "@/business/components/api/homepage/components/FailureTestCaseList";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
require('echarts/lib/component/legend');
|
||||
export default {
|
||||
|
@ -111,7 +112,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -76,7 +76,7 @@ import {buildCustomFields, getTemplate, parseCustomField} from "@/common/js/cust
|
|||
import CustomFiledComponent from "@/business/components/settings/workspace/template/CustomFiledComponent";
|
||||
import TestCaseIssueList from "@/business/components/track/issue/TestCaseIssueList";
|
||||
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
||||
import {getCurrentUserId} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "IssueEditDetail",
|
||||
|
@ -140,7 +140,7 @@ export default {
|
|||
return SYSTEM_FIELD_NAME_MAP;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -99,6 +99,7 @@ import {getIssues} from "@/network/Issue";
|
|||
import {getPageInfo} from "@/common/js/tableUtils";
|
||||
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "CustomFieldList",
|
||||
|
@ -153,7 +154,7 @@ export default {
|
|||
return SYSTEM_FIELD_NAME_MAP;
|
||||
},
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import TestPlanEdit from './components/TestPlanEdit';
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestPlan",
|
||||
|
@ -30,7 +31,7 @@
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -252,7 +252,7 @@ import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
|||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain";
|
||||
import {hasPermission} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, hasPermission} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
|
@ -310,7 +310,7 @@ export default {
|
|||
created() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
if (!this.projectId) {
|
||||
this.projectId = this.$store.state.projectId;
|
||||
this.projectId = getCurrentProjectID();
|
||||
}
|
||||
this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT');
|
||||
this.initTableData();
|
||||
|
|
|
@ -601,7 +601,7 @@ export default {
|
|||
},
|
||||
handleRunBatch(config) {
|
||||
let testPlan = new TestPlan();
|
||||
let projectId = this.$store.state.projectId;
|
||||
let projectId = getCurrentProjectID();
|
||||
if (config.mode === 'serial') {
|
||||
testPlan.serializeThreadgroups = true;
|
||||
testPlan.hashTree = [];
|
||||
|
@ -672,7 +672,7 @@ export default {
|
|||
},
|
||||
getProjectId() {
|
||||
if (!this.isRelevanceModel) {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
} else {
|
||||
return this.currentCaseProjectId;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
|
|||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import MsTag from "../../../../../common/components/MsTag";
|
||||
import {getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
|
||||
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
||||
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
|
||||
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
|
||||
|
@ -238,7 +238,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
this.result = this.$get("/project/listAll", res => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
const index = data.findIndex(d => d.id === this.$store.state.projectId);
|
||||
const index = data.findIndex(d => d.id === getCurrentProjectID());
|
||||
this.projects = data;
|
||||
if (index !== -1) {
|
||||
this.projectId = data[index].id;
|
||||
|
|
|
@ -122,7 +122,7 @@ import ApiTestDetail from "../test/ApiTestDetail";
|
|||
import ApiTestResult from "../test/ApiTestResult";
|
||||
import PerformanceTestDetail from "../test/PerformanceTestDetail";
|
||||
import PerformanceTestResult from "../test/PerformanceTestResult";
|
||||
import {getUUID, hasPermission, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, hasPermission, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
import CaseComment from "@/business/components/track/case/components/CaseComment";
|
||||
import MsPreviousNextButton from "../../../../../common/components/MsPreviousNextButton";
|
||||
|
@ -199,7 +199,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
systemNameMap() {
|
||||
return SYSTEM_FIELD_NAME_MAP;
|
||||
|
|
|
@ -50,6 +50,7 @@ import MsTestPlanCommonComponent from "../base/TestPlanCommonComponent";
|
|||
import FunctionalTestCaseList from "./FunctionalTestCaseList";
|
||||
import MsTabButton from "@/business/components/common/components/MsTabButton";
|
||||
import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestPlanFunctional",
|
||||
|
@ -81,7 +82,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
activated() {
|
||||
|
|
|
@ -91,6 +91,7 @@ import {
|
|||
setUnSelectIds, toggleAllSelection,
|
||||
} from "@/common/js/tableUtils";
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestPlanReportList",
|
||||
|
@ -142,7 +143,7 @@ export default {
|
|||
created() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
if (!this.projectId) {
|
||||
this.projectId = this.$store.state.projectId;
|
||||
this.projectId = getCurrentProjectID();
|
||||
}
|
||||
this.isTestManagerOrTestUser = true;
|
||||
this.initTableData();
|
||||
|
|
|
@ -18,6 +18,7 @@ import TestCaseReviewList from "./components/TestCaseReviewList";
|
|||
import TestCaseReviewEdit from "./components/TestCaseReviewEdit";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestCaseReview",
|
||||
|
@ -34,7 +35,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -125,7 +125,7 @@ import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
|||
import MsTableHeader from "../../../common/components/MsTableHeader";
|
||||
import MsCreateBox from "../../../settings/CreateBox";
|
||||
import MsTablePagination from "../../../common/pagination/TablePagination";
|
||||
import {getCurrentWorkspaceId} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
||||
import {_filter, _sort, deepClone, getLabel} from "@/common/js/tableUtils";
|
||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
|
||||
|
@ -182,7 +182,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -47,6 +47,7 @@ import TestReviewRelevance from "@/business/components/track/review/view/compone
|
|||
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
|
||||
import MsTabButton from "@/business/components/common/components/MsTabButton";
|
||||
import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "TestReviewFunction",
|
||||
|
@ -81,7 +82,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -108,6 +108,7 @@ import ReviewStatus from "@/business/components/track/case/components/ReviewStat
|
|||
import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
||||
import SelectMenu from "../../../common/SelectMenu";
|
||||
import {_filter} from "@/common/js/tableUtils";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -316,7 +317,7 @@ export default {
|
|||
let data = res.data;
|
||||
if (data) {
|
||||
this.projects = data;
|
||||
const index = data.findIndex(d => d.id === this.$store.state.projectId);
|
||||
const index = data.findIndex(d => d.id === getCurrentProjectID());
|
||||
if (index !== -1) {
|
||||
this.projectId = data[index].id;
|
||||
this.projectName = data[index].name;
|
||||
|
|
|
@ -134,7 +134,7 @@ import PerformanceTestDetail from "../../../plan/view/comonents/test/Performance
|
|||
import ApiTestResult from "../../../plan/view/comonents/test/ApiTestResult";
|
||||
import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail";
|
||||
import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton";
|
||||
import {getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import ReviewComment from "../../commom/ReviewComment";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
|
||||
|
@ -206,7 +206,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
systemNameMap() {
|
||||
return SYSTEM_FIELD_NAME_MAP;
|
||||
|
|
Loading…
Reference in New Issue