- {{request.showType()}}
+ {{ request.showType() }}
- {{request.showMethod()}}
+ {{ request.showMethod() }}
- {{$t('api_test.request.copy')}}
+ {{ $t('api_test.request.copy') }}
- {{$t('api_test.request.delete')}}
+ {{ $t('api_test.request.delete') }}
-
- {{$t('api_test.scenario.disable')}}
+
+ {{ $t('api_test.scenario.disable') }}
-
- {{$t('api_test.scenario.enable')}}
+
+ {{ $t('api_test.scenario.enable') }}
@@ -48,173 +51,176 @@
diff --git a/frontend/src/business/components/api/test/components/request/database/DatabaseConfig.vue b/frontend/src/business/components/api/test/components/request/database/DatabaseConfig.vue
new file mode 100644
index 0000000000..cbd209758a
--- /dev/null
+++ b/frontend/src/business/components/api/test/components/request/database/DatabaseConfig.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/business/components/api/test/components/request/database/DatabaseConfigDialog.vue b/frontend/src/business/components/api/test/components/request/database/DatabaseConfigDialog.vue
new file mode 100644
index 0000000000..e6e81b0b13
--- /dev/null
+++ b/frontend/src/business/components/api/test/components/request/database/DatabaseConfigDialog.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/business/components/api/test/components/request/database/DatabaseConfigList.vue b/frontend/src/business/components/api/test/components/request/database/DatabaseConfigList.vue
new file mode 100644
index 0000000000..ee76b5242a
--- /dev/null
+++ b/frontend/src/business/components/api/test/components/request/database/DatabaseConfigList.vue
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/business/components/api/test/components/request/database/DatabaseFrom.vue b/frontend/src/business/components/api/test/components/request/database/DatabaseFrom.vue
new file mode 100644
index 0000000000..f9adfa69f7
--- /dev/null
+++ b/frontend/src/business/components/api/test/components/request/database/DatabaseFrom.vue
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js
index 60c20baa78..d632da62d5 100644
--- a/frontend/src/business/components/api/test/model/ScenarioModel.js
+++ b/frontend/src/business/components/api/test/model/ScenarioModel.js
@@ -211,14 +211,16 @@ export class Scenario extends BaseConfig {
this.environment = undefined;
this.enableCookieShare = false;
this.enable = true;
+ this.databaseConfigs = undefined;
this.set(options);
- this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory}, options);
+ this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory, databaseConfigs: DatabaseConfig}, options);
}
initOptions(options = {}) {
options.id = options.id || uuid();
options.requests = options.requests || [new RequestFactory()];
+ options.databaseConfigs = options.databaseConfigs || [];
options.dubboConfig = new DubboConfig(options.dubboConfig);
return options;
}
@@ -405,7 +407,7 @@ export class DubboRequest extends Request {
this.debugReport = undefined;
this.beanShellPreProcessor = new BeanShellProcessor(options.beanShellPreProcessor);
this.beanShellPostProcessor = new BeanShellProcessor(options.beanShellPostProcessor);
- this.enable = options.enable == undefined ? true : options.enable;
+ this.enable = options.enable === undefined ? true : options.enable;
this.jsr223PreProcessor = new JSR223Processor(options.jsr223PreProcessor);
this.jsr223PostProcessor = new JSR223Processor(options.jsr223PostProcessor);
@@ -479,6 +481,51 @@ export class ConfigCenter extends BaseConfig {
}
}
+export class DatabaseConfig extends BaseConfig {
+ static DRIVER_CLASS = ["com.mysql.jdbc.Driver"];
+
+ constructor(options) {
+ super();
+ this.id = undefined;
+ this.name = undefined;
+ this.poolMax = undefined;
+ this.timeout = undefined;
+ this.driver = undefined;
+ this.dbUrl = undefined;
+ this.username = undefined;
+ this.password = undefined;
+
+ this.set(options);
+ }
+
+ initOptions(options = {}) {
+ // options.id = options.id || uuid();
+ return options;
+ }
+//
+// true
+//
+// 5000
+//
+// test
+// jdbc:mysql://localhost:3306/metersphere?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
+// com.mysql.jdbc.Driver
+//
+// true
+// root
+// 10
+// false
+// 10000
+// DEFAULT
+// 60000
+// root
+//
+
+ isValid() {
+ return !!this.name || !!this.poolMax || !!this.timeout || !!this.driver || !!this.dbUrl || !!this.username || !!this.password;
+ }
+}
+
export class RegistryCenter extends BaseConfig {
static PROTOCOLS = ["none", "zookeeper", "nacos", "apollo", "multicast", "redis", "simple"];
diff --git a/frontend/src/business/components/track/case/components/SwitchProject.vue b/frontend/src/business/components/track/case/components/SwitchProject.vue
new file mode 100644
index 0000000000..57b9335340
--- /dev/null
+++ b/frontend/src/business/components/track/case/components/SwitchProject.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+ {{ scope.row.description }}
+
+
+
+
+ {{ scope.row.createTime | timestampFormatDate }}
+
+
+
+
+ {{ scope.row.updateTime | timestampFormatDate }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue
index aa87b401bd..49aac93523 100644
--- a/frontend/src/business/components/track/common/NodeTree.vue
+++ b/frontend/src/business/components/track/common/NodeTree.vue
@@ -230,10 +230,14 @@ export default {
this.$emit("refresh");
},
nodeExpand(data) {
- this.expandedNode.push(data.id);
+ if (data.id) {
+ this.expandedNode.push(data.id);
+ }
},
nodeCollapse(data) {
- this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
+ if (data.id) {
+ this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
+ }
}
}
};
diff --git a/frontend/src/business/components/track/home/components/RelatedTestPlanList.vue b/frontend/src/business/components/track/home/components/RelatedTestPlanList.vue
index a90ba82c26..9740c1ed94 100644
--- a/frontend/src/business/components/track/home/components/RelatedTestPlanList.vue
+++ b/frontend/src/business/components/track/home/components/RelatedTestPlanList.vue
@@ -90,6 +90,12 @@
initTableData() {
this.result = this.$post('/test/plan/list/all/relate', this.condition, response => {
this.tableData = response.data;
+ for (let i = 0; i < this.tableData.length; i++) {
+ let path = "/test/plan/project/name/" + this.tableData[i].id;
+ this.$get(path, res => {
+ this.$set(this.tableData[i], "projectName", res.data);
+ })
+ }
});
},
intoPlan(row, event, column) {
diff --git a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue
index a8a5cf7450..d33f136c71 100644
--- a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue
+++ b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue
@@ -22,11 +22,14 @@
-
+
-
+
{
this.$refs['planFrom'].resetFields();
this.form.name = '';
- this.form.projectId = '';
+ this.form.projectIds = [];
this.form.principal = '';
this.form.stage = '';
this.form.description = '';
diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue
index ae6af307b8..a2aee7c3da 100644
--- a/frontend/src/business/components/track/plan/components/TestPlanList.vue
+++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue
@@ -191,6 +191,16 @@ export default {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
+ for (let i = 0; i < this.tableData.length; i++) {
+ let path = "/test/plan/project";
+ this.$post(path,{planId: this.tableData[i].id}, res => {
+ let arr = res.data;
+ let projectName = arr.map(data => data.name).join("、");
+ let projectIds = arr.map(data => data.id);
+ this.$set(this.tableData[i], "projectName", projectName);
+ this.$set(this.tableData[i], "projectIds", projectIds);
+ })
+ }
});
},
buildPagePath(path) {
diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue
index ba1d285f68..04e484e6fc 100644
--- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue
@@ -6,10 +6,12 @@
:visible.sync="dialogFormVisible"
@close="close"
width="60%" v-loading="result.loading"
+ :close-on-click-modal="false"
top="50px">
+ {{projectName ? projectName : '切换项目' }}
+
+
@@ -86,6 +90,7 @@
import MsTableAdvSearchBar from "../../../../common/components/search/MsTableAdvSearchBar";
import MsTableHeader from "../../../../common/components/MsTableHeader";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
+ import SwitchProject from "../../../case/components/SwitchProject";
export default {
name: "TestCaseRelevance",
@@ -96,7 +101,8 @@
TypeTableItem,
MsTableSearchBar,
MsTableAdvSearchBar,
- MsTableHeader
+ MsTableHeader,
+ SwitchProject
},
data() {
return {
@@ -108,6 +114,9 @@
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
+ projectId: '',
+ projectName: '',
+ projects: [],
condition: {
components: TEST_CASE_CONFIGS
},
@@ -135,6 +144,9 @@
},
selectNodeIds() {
this.getCaseNames();
+ },
+ projectId() {
+ this.getProjectNode();
}
},
updated() {
@@ -157,7 +169,6 @@
});
},
getCaseNames() {
- let param = {};
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@@ -168,12 +179,17 @@
} else {
this.condition.nodeIds = [];
}
- this.result = this.$post('/test/case/name', this.condition, response => {
- this.testCases = response.data;
- this.testCases.forEach(item => {
- item.checked = false;
+
+ if (this.projectId) {
+ this.condition.projectId = this.projectId;
+ this.result = this.$post('/test/case/name', this.condition, response => {
+ this.testCases = response.data;
+ this.testCases.forEach(item => {
+ item.checked = false;
+ });
});
- });
+ }
+
},
handleSelectAll(selection) {
if (selection.length > 0) {
@@ -203,13 +219,18 @@
initData() {
this.getCaseNames();
this.getAllNodeTreeByPlanId();
+ this.getProject();
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.planId) {
- this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => {
+ let param = {
+ testPlanId: this.planId,
+ projectId: this.projectId
+ };
+ this.result = this.$post("/case/node/list/all/plan", param , response => {
this.treeNodes = response.data;
});
}
@@ -233,6 +254,36 @@
})
})
},
+ getProject() {
+ if (this.planId) {
+ this.$post("/test/plan/project/", {planId: this.planId},res => {
+ let data = res.data;
+ if (data) {
+ this.projects = data;
+ this.projectId = data[0].id;
+ this.projectName = data[0].name;
+ }
+ })
+ }
+ },
+ switchProject() {
+ this.$refs.switchProject.open(this.planId);
+ },
+ getProjectNode(projectId) {
+ const index = this.projects.findIndex(project => project.id === projectId);
+ if (index !== -1) {
+ this.projectName = this.projects[index].name;
+ }
+ if (projectId) {
+ this.projectId = projectId;
+ }
+ this.result = this.$post("/case/node/list/all/plan",
+ {testPlanId: this.planId, projectId: this.projectId} , response => {
+ this.treeNodes = response.data;
+ });
+
+ this.selectNodeIds = [];
+ }
}
}
@@ -281,4 +332,10 @@
/*border: 1px solid #EBEEF5;*/
}
+ .project-link {
+ float: right;
+ margin-right: 12px;
+ margin-bottom: 10px;
+ }
+
diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
index c524c9ef3f..c8a2b56e08 100644
--- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
+++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
@@ -89,6 +89,13 @@