增加数据源测试
This commit is contained in:
8
zyplayer-doc-ui/db-ui/package-lock.json
generated
8
zyplayer-doc-ui/db-ui/package-lock.json
generated
@@ -239,7 +239,7 @@
|
||||
},
|
||||
"async-validator": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz?cache=0&sync_timestamp=1565685468183&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
|
||||
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
|
||||
"requires": {
|
||||
"babel-runtime": "6.x"
|
||||
@@ -2238,7 +2238,7 @@
|
||||
},
|
||||
"element-ui": {
|
||||
"version": "2.11.1",
|
||||
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.11.1.tgz?cache=0&sync_timestamp=1564126738326&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-ui%2Fdownload%2Felement-ui-2.11.1.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.11.1.tgz",
|
||||
"integrity": "sha1-K2f57uPtouaISHPBxYnL4w2anWA=",
|
||||
"requires": {
|
||||
"async-validator": "~1.8.1",
|
||||
@@ -4646,7 +4646,7 @@
|
||||
},
|
||||
"normalize-wheel": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "http://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-wheel%2Fdownload%2Fnormalize-wheel-1.0.1.tgz",
|
||||
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
|
||||
},
|
||||
"nth-check": {
|
||||
@@ -6041,7 +6041,7 @@
|
||||
},
|
||||
"resize-observer-polyfill": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "http://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.1.tgz",
|
||||
"integrity": "sha1-DpAg3T0hAkRY1OvSfiPkAmmBBGQ="
|
||||
},
|
||||
"resolve": {
|
||||
|
||||
@@ -5,6 +5,10 @@ export function queryExecuteSql(data) {
|
||||
return request({url: '/zyplayer-doc-db/executor/execute', method: 'post', data: Qs.stringify(data)});
|
||||
}
|
||||
|
||||
export function queryTestDatasource(data) {
|
||||
return request({url: '/zyplayer-doc-db/datasource/test', method: 'post', data: Qs.stringify(data)});
|
||||
}
|
||||
|
||||
export function queryTableDdl(data) {
|
||||
return request({url: '/zyplayer-doc-db/doc-db/getTableDdl', method: 'post', data: Qs.stringify(data)});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const service = axios.create({
|
||||
// 增加不需要验证结果的标记
|
||||
const noValidate = {
|
||||
"/zyplayer-doc-db/executor/execute": true,
|
||||
"/zyplayer-doc-db/datasource/test": true,
|
||||
};
|
||||
|
||||
service.interceptors.request.use(
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
<el-form-item label="密码:">
|
||||
<el-input v-model="newDatasource.sourcePassword" placeholder="密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="测试:">
|
||||
<el-button v-on:click="testDatasource" type="primary" v-loading="testDatasourceErrLoading">测试数据源</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" style="text-align: center;">
|
||||
<el-button v-on:click="saveDatasource" type="primary">保存</el-button>
|
||||
@@ -90,12 +93,19 @@
|
||||
<el-button type="primary" v-on:click="saveUserDbSourceAuth">保存配置</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--错误信息弹窗-->
|
||||
<el-dialog title="测试数据源失败" :visible.sync="testDatasourceErrVisible" :footer="null" width="760px">
|
||||
<div v-highlight>
|
||||
<pre><code v-html="testDatasourceErrInfo"></code></pre>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
import {queryTestDatasource} from '../../common/api/datasource'
|
||||
|
||||
var app;
|
||||
|
||||
@@ -113,6 +123,10 @@
|
||||
dbSourceAuthUserLoading: false,
|
||||
searchUserList: [],
|
||||
dbSourceAuthNewUser: "",
|
||||
// 测试数据源
|
||||
testDatasourceErrInfo: "",
|
||||
testDatasourceErrVisible: false,
|
||||
testDatasourceErrLoading: false,
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
@@ -208,6 +222,18 @@
|
||||
app.getDatasourceList();
|
||||
});
|
||||
},
|
||||
testDatasource() {
|
||||
this.testDatasourceErrLoading = true;
|
||||
queryTestDatasource(this.newDatasource).then(res => {
|
||||
this.testDatasourceErrLoading = false;
|
||||
if (res.errCode == 200) {
|
||||
this.$message.success("测试成功!");
|
||||
} else {
|
||||
this.testDatasourceErrVisible = true;
|
||||
this.testDatasourceErrInfo = res.errMsg || '';
|
||||
}
|
||||
});
|
||||
},
|
||||
driverClassNameChange() {
|
||||
if (this.newDatasource.driverClassName == 'com.mysql.jdbc.Driver') {
|
||||
this.urlPlaceholder = "例:jdbc:mysql://127.0.0.1:3306/user_info?useUnicode=true&characterEncoding=utf8";
|
||||
|
||||
Reference in New Issue
Block a user