@ -2,10 +2,12 @@ import { model, Model } from '@core/core';
import { AppModel } from 'src/modules/app.model' ;
import { AppModel } from 'src/modules/app.model' ;
import { getAllDatabaseTypes } from '../../app.service' ;
import { getAllDatabaseTypes } from '../../app.service' ;
import { DatabaseType } from '../../app.typings' ;
import { DatabaseType } from '../../app.typings' ;
import { connectionType } from '@constants/env' ;
import { OTHER_JDBC } from '@constants/constant' ;
@model ( )
@model ( )
export class DatebaseModel extends Model < {
export class DatebaseModel extends Model < {
types : {
types : {
filter : AppModel [ 'TYPE' ] [ 'filter' ] ;
filter : AppModel [ 'TYPE' ] [ 'filter' ] ;
datebaseTypeSelected : AppModel [ 'TYPE' ] [ 'datebaseTypeSelected' ] ;
datebaseTypeSelected : AppModel [ 'TYPE' ] [ 'datebaseTypeSelected' ] ;
} ,
} ,
@ -20,20 +22,30 @@ export class DatebaseModel extends Model<{
isInternal : true ,
isInternal : true ,
isPlugin : true ,
isPlugin : true ,
datebaseTypes : getAllDatabaseTypes ( ) . filter ( item = > item . commonly ) ,
datebaseTypes : getAllDatabaseTypes ( ) . filter ( item = > item . commonly ) ,
isJNDILimit : false ,
} ;
} ;
}
}
computed = {
otherDatabases : ( ) = > {
return this . model . isJNDILimit
? [ OTHER_JDBC ]
: [ OTHER_JDBC , connectionType . JNDI ] ;
}
}
actions = {
actions = {
setSearch : ( search : string ) = > {
setSearch : ( search : string ) = > {
this . model . search = search ;
this . model . search = search ;
} ,
} ,
setFilter : ( filter : string ) = > {
setFilter : ( filter : string ) = > {
this . model . filter = filter ;
this . model . filter = filter ;
} ,
} ,
setDatebaseTypes : ( datebaseTypes : DatabaseType [ ] ) = > {
setDatebaseTypes : ( datebaseTypes : DatabaseType [ ] ) = > {
this . model . datebaseTypes = datebaseTypes ;
this . model . datebaseTypes = datebaseTypes ;
this . model . datebaseTypeSelected = '' ;
this . model . datebaseTypeSelected = '' ;
} ,
} ,
setInternal : ( isInternal : boolean ) = > {
setInternal : ( isInternal : boolean ) = > {
this . model . isInternal = isInternal ;
this . model . isInternal = isInternal ;
} ,
} ,
setPlugin : ( isPlugin : boolean ) = > {
setPlugin : ( isPlugin : boolean ) = > {
@ -42,5 +54,8 @@ export class DatebaseModel extends Model<{
setDatebaseTypeSelected ( datebaseType : string ) {
setDatebaseTypeSelected ( datebaseType : string ) {
this . model . datebaseTypeSelected = datebaseType ;
this . model . datebaseTypeSelected = datebaseType ;
} ,
} ,
setJNDILimit : ( v : boolean ) = > {
this . model . isJNDILimit = v ;
} ,
}
}
}
}