Browse Source

fix: DEC-10031 适配sqlserver 拼接url

qufenxi
alan 5 years ago
parent
commit
440792062b
  1. 11
      src/modules/app.service.ts
  2. 5
      src/modules/pages/maintain/forms/components/form.jdbc.ts

11
src/modules/app.service.ts

@ -78,6 +78,17 @@ export function resolveUrlInfo (url: string) {
};
}
// 拼接url
export function splitUrl(host: string, port: string, database: string, baseUrl: string) {
if (baseUrl.startsWith('jdbc:sqlserver')) {
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('=database', `=${database}`);
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('database', database);
}
export function connectionCanEdit(connection: Connection) {
if (connection && connection.privilegeDetailBeanList) {
// privilegeType === 4 代表编辑权限,privilegeValue === 2 代表有权限

5
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -5,7 +5,7 @@ import { FormItemXtype } from '../../components/form_item/form_item';
import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings';
import { connectionType } from '@constants/env';
import { CONNECT_CHARSET } from '@constants/constant';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../../app.service';
import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service';
export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc';
@shortcut(FormJdbcXtype)
@ -652,8 +652,7 @@ export class FormJdbc extends BI.Widget {
const host = this.form.host.getValue();
const port = this.form.port.getValue();
const database = this.form.database.getValue();
this.form.url.setValue(url.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('database', database));
this.form.url.setValue(splitUrl(host, port, database, url));
}
public setSchemas(schemas: string[]) {

Loading…
Cancel
Save