Browse Source

Merge pull request #8337 in DEC/decision-webui-dcm from bugfix/11.0 to feature/x

* commit '40d6016050b4cd3890ded499414327a61c2984ba':
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
  REPORT-108103 Starrocks数据连接解析不包含catalog的数据连接出错
feature/x
superman 1 year ago
parent
commit
53de565848
  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 // 拼接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')) { if (baseUrl.startsWith('jdbc:sqlserver')) {
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('=database', `=${database}`); .replace('=database', `=${database}`);
@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database:
.replace(':INFORMIXSERVER={server}', ''); .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}` : '') return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '')
.replace('default_catalog', catalog) .replace('default_catalog.database', databaseStr);
.replace('database', database)
} }
return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') 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) { private onHostPortChange(database) {
const { urls, url } = databaseType; const { urls, url, databaseType } = database;
const driver = this.form.driver.getValue(); const driver = this.form.driver.getValue();
const selectUrl = BI.get(urls, driver.driver) || url; const selectUrl = BI.get(urls, driver.driver) || url;
const host = this.form.host.getValue(); const host = this.form.host.getValue();
const port = this.form.port.getValue(); const port = this.form.port.getValue();
const catalog = this.form.catalog.getValue(); const catalog = this.form.catalog.getValue();
const database = this.form.database.getValue(); const databaseName = this.form.database.getValue();
this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl)); this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType));
} }
private onSshTypeChange(sshType) { private onSshTypeChange(sshType) {

Loading…
Cancel
Save