diff --git a/frontend/src/business/components/api/test/components/ApiScenarioForm.vue b/frontend/src/business/components/api/test/components/ApiScenarioForm.vue index b71a0aacc6..afe9aaedb5 100644 --- a/frontend/src/business/components/api/test/components/ApiScenarioForm.vue +++ b/frontend/src/business/components/api/test/components/ApiScenarioForm.vue @@ -37,6 +37,9 @@ :environment="scenario.environment" :description="$t('api_test.scenario.kv_description')"/> + + +
Config Center
@@ -62,10 +65,12 @@ import {REQUEST_HEADERS} from "@/common/js/constants"; import MsDubboRegistryCenter from "@/business/components/api/test/components/request/dubbo/RegistryCenter"; import MsDubboConfigCenter from "@/business/components/api/test/components/request/dubbo/ConfigCenter"; import MsDubboConsumerService from "@/business/components/api/test/components/request/dubbo/ConsumerAndService"; +import MsDatabaseConfig from "./request/database/DatabaseConfig"; export default { name: "MsApiScenarioForm", components: { + MsDatabaseConfig, MsDubboConsumerService, MsDubboConfigCenter, MsDubboRegistryCenter, ApiEnvironmentConfig, MsApiScenarioVariables, MsApiKeyValue }, 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 3ab228bf13..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; } @@ -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"];