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