Commit 5fb08ba3 authored by Medicean's avatar Medicean

(Enhance:Database) 新增「测试连接」功能

parent ca4510a0
......@@ -10,6 +10,7 @@
### 数据管理
* 新增「测试连接」功能
* 新增「检测」功能, 检测支持的数据库函数(目前仅 PHP 有效)
* 新增 php sqlsrv 连接方式, php5.3之后 mssql 默认不存在,可使用该类型连接 sqlserver >= 2008
......
......@@ -438,7 +438,8 @@ module.exports = {
toolbar: {
add: 'Add',
clear: 'Clear',
edit: 'Edit'
edit: 'Edit',
test: 'Test connect'
},
conn: 'Connection String',
type: 'Database type',
......@@ -448,6 +449,8 @@ module.exports = {
passwd: 'Password',
warning: 'Please fill in the complete!',
success: 'Successful add configuration!',
test_success: 'Connection Successful!',
test_warning: 'Response is null!',
del: {
title: 'Delete configuration',
confirm: 'Determine delete this configuration?',
......
......@@ -439,7 +439,8 @@ module.exports = {
toolbar: {
add: '添加',
clear: '清空',
edit: '编辑'
edit: '编辑',
test: '测试连接'
},
conn: '连接字符串',
type: '数据库类型',
......@@ -449,6 +450,8 @@ module.exports = {
passwd: '连接密码',
warning: '请填写完整!',
success: '成功添加配置!',
test_success: '连接成功!',
test_warning: '返回数据为空',
del: {
title: '删除配置',
confirm: '确定删除此配置吗?',
......
......@@ -168,6 +168,13 @@ class ASP {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -225,6 +232,29 @@ class ASP {
this.manager.list.imgs[0]
);
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
conn: _data['conn']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......@@ -259,6 +289,13 @@ class ASP {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -310,6 +347,29 @@ class ASP {
// 刷新 UI
this.parse();
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
conn: _data['conn']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......
......@@ -164,6 +164,13 @@ class CUSTOM {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -221,6 +228,29 @@ class CUSTOM {
this.manager.list.imgs[0]
);
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
conn: _data['conn']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......@@ -255,6 +285,13 @@ class CUSTOM {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -307,6 +344,29 @@ class CUSTOM {
// 刷新 UI
this.parse();
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
conn: _data['conn']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......
......@@ -308,6 +308,13 @@ class PHP {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -436,6 +443,31 @@ class PHP {
this.manager.list.imgs[0]
);
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
host: _data['host'],
user: _data['user'],
passwd: _data['passwd']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......@@ -470,6 +502,13 @@ class PHP {
type: 'button',
icon: 'remove',
text: LANG['form']['toolbar']['clear']
}, {
type: 'separator'
}, {
id: 'test',
type: 'button',
icon: 'spinner',
text: LANG['form']['toolbar']['test']
}]);
// form
......@@ -605,6 +644,31 @@ class PHP {
// 刷新 UI
this.parse();
break;
case 'test':
if (!form.validate()) {
return toastr.warning(LANG['form']['warning'], LANG_T['warning']);
};
// 解析数据
let _data = form.getValues();
win.progressOn();
this.core.request(
this.core[`database_${_data['type']}`].show_databases({
host: _data['host'],
user: _data['user'],
passwd: _data['passwd']
})
).then((res) => {
if(res['text'].length > 0){
toastr.success(LANG['form']['test_success'], LANG_T['success']);
}else{
toastr.warning(LANG['form']['test_warning'], LANG_T['warning']);
}
win.progressOff();
}).catch((err)=>{
toastr.error(JSON.stringify(err), LANG_T['error']);
win.progressOff();
});
break;
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment