@ -1,7 +1,7 @@
import { DATA_BASE_TYPES , DATA_BASE_TYPES_OTHER , DESIGN_DRIVER_TYPE , OTHER_JDBC } from '@constants/constant' ;
import { DATA_BASE_TYPES , DATA_BASE_TYPES_OTHER , DESIGN_DRIVER_TYPE , OTHER_JDBC } from '@constants/constant' ;
import { DatabaseType } from './app.typings' ;
import { DatabaseType } from './app.typings' ;
import { Connection } from './crud/crud.typings' ;
import { Connection } from './crud/crud.typings' ;
export function getAllDatabaseTypes ( ) : DatabaseType [ ] {
export function getAllDatabaseTypes ( ) : DatabaseType [ ] {
return [
return [
. . . DATA_BASE_TYPES ,
. . . DATA_BASE_TYPES ,
. . . BI . Providers . getProvider ( 'dec.connection.provider.datebase' ) . customDatabaseType . map ( item = > {
. . . BI . Providers . getProvider ( 'dec.connection.provider.datebase' ) . customDatabaseType . map ( item = > {
@ -45,11 +45,11 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
if ( ! databaseType ) {
if ( ! databaseType ) {
return DATA_BASE_TYPES_OTHER ;
return DATA_BASE_TYPES_OTHER ;
}
}
return databaseType ;
return databaseType ;
}
}
export function resolveUrlInfo ( url : string , database? : string ) {
export function resolveUrlInfo ( url : string , database? : string ) {
if ( BI . isNull ( url ) ) return { } ;
if ( BI . isNull ( url ) ) return { } ;
return BI . Providers . getProvider ( 'dec.connection.provider.datebase' ) . getJdbcResolveByType ( database ) ( url ) || {
return BI . Providers . getProvider ( 'dec.connection.provider.datebase' ) . getJdbcResolveByType ( database ) ( url ) || {
@ -70,11 +70,11 @@ export function splitUrl(host: string, port: string, database: string, baseUrl:
// https://work.fineres.com/browse/REPORT-72078
// https://work.fineres.com/browse/REPORT-72078
if ( baseUrl . startsWith ( 'jdbc:informix-sqli' ) ) {
if ( baseUrl . startsWith ( 'jdbc:informix-sqli' ) ) {
return baseUrl . replace ( 'hostname' , host )
return baseUrl . replace ( 'hostname' , host )
. replace ( ':port' , port ? ` : ${ port } ` : '' )
. replace ( ':port' , port ? ` : ${ port } ` : '' )
. replace ( 'database' , database )
. replace ( 'database' , database )
. replace ( ':INFORMIXSERVER={server}' , '' ) ;
. replace ( ':INFORMIXSERVER={server}' , '' ) ;
}
}
return baseUrl . replace ( 'hostname' , host ) . replace ( ':port' , port ? ` : ${ port } ` : '' )
return baseUrl . replace ( 'hostname' , host ) . replace ( ':port' , port ? ` : ${ port } ` : '' )
. replace ( 'database' , database )
. replace ( 'database' , database )
. replace ( 'dbname' , database ) ;
. replace ( 'dbname' , database ) ;
@ -85,13 +85,13 @@ export function connectionCanEdit(connection: Connection) {
// privilegeType === 4 代表编辑权限,privilegeValue === 2 代表有权限
// privilegeType === 4 代表编辑权限,privilegeValue === 2 代表有权限
return connection . privilegeDetailBeanList . some ( item = > item . privilegeType === 4 && item . privilegeValue === 2 ) ;
return connection . privilegeDetailBeanList . some ( item = > item . privilegeType === 4 && item . privilegeValue === 2 ) ;
}
}
return true ;
return true ;
}
}
export function getTextByDatabaseType ( databaseType : string ) {
export function getTextByDatabaseType ( databaseType : string ) {
const database = getAllDatabaseTypes ( ) . find ( item = > item . databaseType === databaseType ) ;
const database = getAllDatabaseTypes ( ) . find ( item = > item . databaseType === databaseType ) ;
return database ? database . text : '' ;
return database ? database . text : '' ;
}
}