Browse Source

Merge pull request #8336 in DEC/decision-webui-dcm from release/11.0 to bugfix/11.0

* commit '4f268138b672b650e8d03aad7268603f4815d62e':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
bugfix/11.0
superman 1 year ago
parent
commit
40d6016050
  1. 13
      src/modules/app.service.ts
  2. 8
      src/modules/pages/maintain/forms/components/form.jdbc.ts

13
src/modules/app.service.ts

@ -61,7 +61,7 @@ export function resolveUrlInfo(url: string, database?: string) {
}
// 拼接url
export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string) {
export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string, databaseType: string) {
if (baseUrl.startsWith('jdbc:sqlserver')) {
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('=database', `=${database}`);
@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', '');
}
if (catalog) {
if (databaseType === 'starrocks') {
let databaseStr = '';
if (!catalog || !database) {
databaseStr = catalog + database;
} else {
databaseStr = catalog + '.' + database;
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('default_catalog', catalog)
.replace('database', database)
.replace('default_catalog.database', databaseStr);
}
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')

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

@ -1601,15 +1601,15 @@ export class FormJdbc extends BI.Widget {
];
}
private onHostPortChange(databaseType) {
const { urls, url } = databaseType;
private onHostPortChange(database) {
const { urls, url, databaseType } = database;
const driver = this.form.driver.getValue();
const selectUrl = BI.get(urls, driver.driver) || url;
const host = this.form.host.getValue();
const port = this.form.port.getValue();
const catalog = this.form.catalog.getValue();
const database = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl));
const databaseName = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType));
}
private onSshTypeChange(sshType) {

Loading…
Cancel
Save