@ -74,81 +74,6 @@
< div ref = "panelContainer" style = "" >
< api -overlay v -show = " projectReloading " :project-created ="projectCreated" / >
<!-- < v -overlay absolute color = "grey" opacity = "0.4" - - >
<!-- class = "create-project-overlay" > -- >
<!-- < div >
< v -card dark style = "width: 100%; max-height:100%;overflow: auto" >
< v -container fluid style = "min-height:200px;" >
& lt ; ! & ndash ; < v -row class = "text-center" > & ndash ; & gt ;
& lt ; ! & ndash ; < v -col cols = "12" > & ndash ; & gt ;
< v -card class = "pa-2 text-center elevation-10" dark >
< h3 class = "title mb-3 mt-4" > APIs Generated < / h3 >
< p > < span class = "display-2 font-weight-bold" > 1 , 200 , 000 < / span > < br >
< span class = "subtitle grey--text text--lighten-1" > within 60 seconds < / span > < / p >
< / v - c a r d >
& lt ; ! & ndash ; < / v - c o l > & n d a s h ; & g t ;
& lt ; ! & ndash ; < / v - r o w > & n d a s h ; & g t ;
< v -row >
< v -col >
< v -card dark class = " elevation-10" >
< v -card -text class = "pb-0 font-weight-bold" > # Databases < / v - c a r d - t e x t >
< v -card -text class = "title white--text" >
< v -icon class = "mt-n2 mr-1" color = "info" > mdi - database - sync < / v - i c o n >
180 / 190
< / v - c a r d - t e x t >
< / v - c a r d >
< / v - c o l >
< v -col >
< v -card dark class = " elevation-10" >
< v -card -text class = "pb-0 font-weight-bold" > # Tables < / v - c a r d - t e x t >
< v -card -text class = "title white--text" >
< v -icon class = "mr-1 mt-n1 " color = "info" > mdi - table - large < / v - i c o n >
50000
< / v - c a r d - t e x t >
< / v - c a r d >
< / v - c o l >
< v -col >
< v -card dark class = " elevation-10" >
< v -card -text class = "pb-0 font-weight-bold" > Time Saved < / v - c a r d - t e x t >
< v -card -text class = "title white--text" >
< v -icon class = "mr-1 mt-n1" color = "secondary" > mdi - clock - fast < / v - i c o n >
10 hrs
< / v - c a r d - t e x t >
< / v - c a r d >
< / v - c o l >
< v -col >
< v -card dark class = " elevation-10" >
< v -card -text class = "pb-0 font-weight-bold" > CostSaved < / v - c a r d - t e x t >
< v -card -text class = "title white--text" >
< v -icon color = "success" class = "mt-n2 mr-1" > mdi - currency - usd - circle < / v - i c o n >
100 $
< / v - c a r d - t e x t >
< / v - c a r d >
< / v - c o l >
< / v - r o w >
& lt ; ! & ndash ; < v -divider class = "my-3 " > < / v - d i v i d e r > & n d a s h ; & g t ;
< v -card dark class = " elevation-10" >
< p class = "title text-center pt-2" > List of Database < / p >
< v -simple -table style = "width: 100%" >
< tr v-for ="i in 40" >
< td v-for ="j in 5" class="py-2 px-3" >
< div class = "d-flex" >
< v -icon color = "green" x -small class = "mr-2" > mdi - moon - full < / v - i c o n >
< span class = "caption" > Database { { i } } { { j } } < / span >
< v -spacer > < / v - s p a c e r >
< / div >
< / td >
< / tr >
< / v - s i m p l e - t a b l e >
< / v - c a r d >
< / v - c o n t a i n e r >
< / v - c a r d >
< / div > -- >
<!-- < / v - o v e r l a y > - - >
< v -container fluid >
< v -row >
< v -col cols = "12" class = "mb-0 pb-0" >
@ -162,53 +87,8 @@
: height = "20"
: label = "$t('placeholder.projName')"
autofocus
>
<!-- < v -icon color = "info" class = "blink_me mt-n1" slot = "prepend" > -- >
<!-- mdi - lightbulb - on -- >
<!-- < / v - i c o n > - - >
< / v - t e x t - f i e l d >
<!-- Access Project via -- >
< label class = "caption" > { { $t ( 'msg.info.apiOptions' ) } } < / label >
< v -radio -group
v - model = "project.projectType"
row
hide - details
dense
class = "mb-0 mt-0"
>
< v -radio
v - for = "(type, i) in projectTypes"
: key = "type.value"
: color = "type.iconColor"
: value = "type.value"
>
< template # label >
< v -chip : color = "i ? colors[3] : colors[7]" >
< v -icon small class = "mr-1" >
{ { type . icon } }
< / v - i c o n >
< span class = "caption" > { { type . text } } < / span >
< / v - c h i p >
< / template >
< / v - r a d i o >
< / v - r a d i o - g r o u p >
/ >
< / div >
<!-- < v -select
v - model = "project.projectType" hint = "Access via API type" persistent - hint dense
: items = "projectTypes" >
< template v -slot : prepend >
< img v-if ="typeIcon.type === 'img'" :src="typeIcon.icon" style="width: 32px" >
< v -icon v -else :color ="typeIcon.iconColor" > { { typeIcon . icon } } < / v - i c o n >
< / template >
< template v -slot :item ="{item}" >
< span class = "caption d-flex align-center" >
< img v-if ="item.type === 'img'" :src="item.icon" style="width: 30px" >
< v -icon v -else :color ="item.iconColor" > { { item . icon } } < / v - i c o n > & n b s p ; { { i t e m . t e x t } } < / s p a n >
< / template >
< / v - s e l e c t > - - >
< / v - c o l >
< v -col
@ -217,10 +97,6 @@
offset = "1"
: class = "{ 'mt-0 pt-0': !edit, 'mt-3 pt-3': edit }"
>
<!-- < h2 : class = "{'text-center mb-2':!edit,'text-center mb-2 grey--text':edit}" >
{ { project . title && project . title . toUpperCase ( ) } } ' s
Environments < / h2 > -- >
< p
: class = " {
'text-center mb-2 mt-3' : ! edit ,
@ -244,8 +120,6 @@
>
< v -expansion -panel -header disable -icon -rotate >
< p class = "pa-0 ma-0" >
<!-- < v -icon > mdi - test - tube < / v - i c o n > & n b s p ; - - >
<!-- < span class = "title" > & nbsp ; < b > '{{ envKey }}' < / b > environment : < / span > -- >
< v -tooltip v -for = " ( db , tabIndex ) in envData.db " :key ="tabIndex" bottom >
< template # activator = "{ on }" >
< v -icon
@ -321,21 +195,6 @@
db . connection . database
} } < / span >
< / v - t a b >
<!-- < v -tooltip bottom >
< template v -slot : activator = "{ on }" >
< x -btn tooltip = "Add New Database to Environment" text small class = "ma-2" v -on = " on "
@ click . prevent . stop = "addNewDB(envKey,panelIndex)"
v - ge = "['project','env-db-add']"
>
< v -hover v -slot : default = "{ hover }" >
< v -icon : color = "hover ? 'primary' : 'grey'" > mdi - database - plus
< / v - i c o n >
< / v - h o v e r >
< / x - b t n >
< / template >
< span > Add new database to '{{ envKey }}' environment < / span >
< / v - t o o l t i p >
-- >
< v -tabs -items v-model ="databases[panelIndex]" >
< v -tab -item
v - for = "(db, dbIndex) in project.envs[envKey].db"
@ -422,14 +281,6 @@
>
{ { data . item } }
< / v - c h i p >
<!-- < div class = "d-flex flex-column mx-auto " - - >
<!-- style = "width:100%;border-bottom: 1px solid #ddd" > -- >
<!-- < img class = "mx-auto py-3" width = "80" :src ="dbIcons[data.item]" / > -- >
<!-- & lt ; ! & ndash ; { { data . item } } & ndash ; & gt ; -- >
<!-- < p v-if ="!databaseNames[data.item]" class="text-center grey--text" > - - >
<!-- Coming soon < / p > -- >
<!-- < / div > -- >
< / template >
< / v - s e l e c t >
< / v - c o l >
@ -523,6 +374,7 @@
: label = "$t('labels.dbCreateIfNotExists')"
/ >
< / v - c o l >
<!-- todo : ssl & inflection -- >
< v -col v-if ="db.client !== 'sqlite3'" class="" >
< v -expansion -panels >
< v -expansion -panel style = "border: 1px solid wheat" >
@ -649,7 +501,7 @@
< v -col >
<!-- Inflection - Table name -- >
< v -select
v - model = "db.meta.inflection.tn"
v - model = "db.meta.inflection.table_ name "
: disabled = "edit"
class = "caption"
: label = "
@ -667,7 +519,7 @@
< v -col >
<!-- Inflection - Column name -- >
< v -select
v - model = "db.meta.inflection.cn"
v - model = "db.meta.inflection.colum n_name "
: disabled = "edit"
class = "caption"
: label = "
@ -775,158 +627,8 @@
< / v - c o l >
< / v - e x p a n s i o n - p a n e l - c o n t e n t >
< / v - e x p a n s i o n - p a n e l >
<!-- < v -expansion -panel >
< v -expansion -panel -header disable -icon -rotate >
< v -tooltip bottom >
< template v -slot : activator = "{ on }" >
< x -btn tooltip = "Add New Environment to Project" color = "grey" block v -on = " on " outlined
v - ge = "['project','env-add']"
@ click . stop = "addNewEnvironment" >
< v -icon > mdi - plus < / v - i c o n >
Add Another Environment
< / x - b t n >
< / template >
< span > Add new environment to { { project . title } } project < / span >
< / v - t o o l t i p >
< template v -slot : actions >
< i > < / i >
< / template >
< / v - e x p a n s i o n - p a n e l - h e a d e r >
< / v - e x p a n s i o n - p a n e l > - - >
< / v - e x p a n s i o n - p a n e l s >
< / v - c o l >
<!-- < v -col cols = "10" offset = "1" v -show = " isTitle "
: class = "{'mt-0 pt-0':!edit,'mt-3 pt-3':edit}" >
& lt ; ! & ndash ; < h2 : class = "{'text-center mb-2':!edit,'text-center mb-2 grey--text':edit}" > & ndash ; & gt ;
& lt ; ! & ndash ; Advanced Configuration < / h2 > & ndash ; & gt ;
< v -expansion -panels focusable accordion = "" class = "elevation-20"
style = "border: 1px solid grey" >
< v -expansion -panel
@ change = "onAdvancePanelToggle"
>
< v -expansion -panel -header disable -icon -rotate >
< p class = "pa-0 ma-0" >
< v -icon class = "mt-n2 " color = "grey darken-1" > mdi - cog < / v - i c o n > & n b s p ;
< span class = "grey--text text--darken-1" > Advance Configuration < / span >
< / p >
< / v - e x p a n s i o n - p a n e l - h e a d e r >
< v -expansion -panel -content eager >
< v -card class = "mt-3" >
< v -card -title >
< v -icon class = "mr-2" > mdi - shield - account - outline < / v - i c o n >
Authentication Configuration
< / v - c a r d - t i t l e >
< v -card -text >
< v -container class = "justify-center" >
< v -row >
< v -col cols = "12" class = "py-0" >
< v -select
v - model = "auth.authType" hint = "Choose Authentication type"
persistent - hint dense
: items = "authTypes" >
< template v -slot :item ="{item}" >
< span class = "caption" >
{ { item . text } } < / span >
< / template >
< / v - s e l e c t >
< / v - c o l >
< v -col cols = "12" class = "py-0" v-if ="auth.authType && auth.authType !== 'none'" >
< v -text -field
v - if = "auth.authType !== 'middleware'"
v - model = "auth.authSecret"
label = "Enter Auth Secret (Randomly generated)"
: type = "showSecret ? 'text' : 'password'"
>
< template v -slot : append >
< v -icon small
@ click = "showSecret = !showSecret"
> { {
showSecret ? 'visibility_off' :
'visibility'
} }
< / v - i c o n >
< / template >
< / v - t e x t - f i e l d >
< v -text -field
v - else
v - model = "auth.webhook"
label = "Webhook url"
>
< / v - t e x t - f i e l d >
< / v - c o l >
< / v - r o w >
< / v - c o n t a i n e r >
< / v - c a r d - t e x t >
< / v - c a r d >
& lt ; ! & ndash ; < / v - e x p a n s i o n - p a n e l - c o n t e n t > & n d a s h ; & g t ;
& lt ; ! & ndash ; < / v - e x p a n s i o n - p a n e l > & n d a s h ; & g t ;
& lt ; ! & ndash ; < / v - e x p a n s i o n - p a n e l s > & n d a s h ; & g t ;
& lt ; ! & ndash ; < / v - c o l > & n d a s h ; & g t ;
& lt ; ! & ndash ; < v -col cols = "10" offset = "1" v -show = " project.title.trim ( ) .length " & ndash ; & gt ;
& lt ; ! & ndash ; : class = "{'mt-0 pt-0':!edit,'mt-3 pt-3':edit}" > & ndash ; & gt ;
& lt ; ! & ndash ; < v -expansion -panels v -model = " smtpPanel " focusable accordion = "" class = "elevation-20" & ndash ; & gt ;
& lt ; ! & ndash ; style = "border: 1px solid grey" > & ndash ; & gt ;
& lt ; ! & ndash ; < v -expansion -panel > & ndash ; & gt ;
& lt ; ! & ndash ; < v -expansion -panel -header disable -icon -rotate > & ndash ; & gt ;
& lt ; ! & ndash ; < p class = "pa-0 ma-0" > & ndash ; & gt ;
& lt ; ! & ndash ; < v -icon class = "mt-n2 " color = "grey darken-1" > mdi - email - edit < / v - i c o n > & n b s p ; & n d a s h ; & g t ;
& lt ; ! & ndash ; < span class = "grey--text text--darken-1" > SMTP Configuration < / span > & ndash ; & gt ;
& lt ; ! & ndash ; < / p > & ndash ; & gt ;
& lt ; ! & ndash ; < / v - e x p a n s i o n - p a n e l - h e a d e r > & n d a s h ; & g t ;
& lt ; ! & ndash ; < v -expansion -panel -content :eager ="false" > & ndash ; & gt ;
< v -card class = "mt-3" >
< v -card -title >
< v -icon class = "mr-2" > mdi - email - edit < / v - i c o n >
SMTP Configuration
< / v - c a r d - t i t l e >
< v -card -text >
< v -text -field
v - model = "smtpConfiguration.from"
label = "From address"
placeholder = "Company<noreply@company.com>"
>
< / v - t e x t - f i e l d >
< label > Mailer Config Options < span class = "caption" > ( For connection example visit : < a
href = "https://nodemailer.com/smtp/#examples" > https : / / n o d e m a i l e r . c o m / s m t p / # e x a m p l e s < / a > ) < / s p a n > < / l a b e l >
< monaco -json -editor
ref = "monacoEditor"
v - model = "smtpConfiguration.options"
style = "height: 300px; width:100% " > < / m o n a c o - j s o n - e d i t o r >
< / v - c a r d - t e x t >
< / v - c a r d >
< / v - e x p a n s i o n - p a n e l - c o n t e n t >
< / v - e x p a n s i o n - p a n e l >
< / v - e x p a n s i o n - p a n e l s >
< / v - c o l >
< v -col cols = "10" offset = "1" v -show = " isTitle "
: class = "{'mt-0 pt-0':!edit,'mt-3 pt-3':edit}" >
< create -project -coming -soon > < / c r e a t e - p r o j e c t - c o m i n g - s o o n >
< / v - c o l > - - >
< / v - r o w >
< / v - c o n t a i n e r >
< / div >
@ -941,8 +643,8 @@
: type = "dialog.type"
/ >
<!-- heading = "Connection was successful" -- >
<!-- ok - label = "Ok & Save Project" -- >
<!-- heading = "Connection was successful" -- >
<!-- ok - label = "Ok & Save Project" -- >
< dlg -ok -new
v - model = "testSuccess"
: heading = "$t('msg.info.dbConnected')"
@ -999,7 +701,12 @@ import colors from '@/mixins/colors'
import DlgOkNew from '@/components/utils/dlgOkNew'
import readFile from '@/helpers/fileReader'
const { uniqueNamesGenerator , starWars , adjectives , animals } = require ( 'unique-names-generator' )
const {
uniqueNamesGenerator ,
starWars ,
adjectives ,
animals
} = require ( 'unique-names-generator' )
const homeDir = ''
@ -1052,14 +759,36 @@ export default {
projectReloading : false ,
enableDbEdit : 0 ,
authTypes : [
{ text : 'JWT' , value : 'jwt' } ,
{ text : 'Master Key' , value : 'masterKey' } ,
{ text : 'Middleware' , value : 'middleware' } ,
{ text : 'Disabled' , value : 'none' }
{
text : 'JWT' ,
value : 'jwt'
} ,
{
text : 'Master Key' ,
value : 'masterKey'
} ,
{
text : 'Middleware' ,
value : 'middleware'
} ,
{
text : 'Disabled' ,
value : 'none'
}
] ,
projectTypes : [
{ text : 'REST APIs' , value : 'rest' , icon : 'mdi-code-json' , iconColor : 'green' } ,
{ text : 'GRAPHQL APIs' , value : 'graphql' , icon : 'mdi-graphql' , iconColor : 'pink' }
{
text : 'REST APIs' ,
value : 'rest' ,
icon : 'mdi-code-json' ,
iconColor : 'green'
} ,
{
text : 'GRAPHQL APIs' ,
value : 'graphql' ,
icon : 'mdi-graphql' ,
iconColor : 'pink'
}
] ,
showPass : { } ,
@ -1115,8 +844,8 @@ export default {
graphqlDepthLimit : 10
} ,
inflection : {
tn : [ 'camelize' ] ,
cn : [ 'camelize' ]
table _name : 'camelize' ,
column _name : 'camelize'
}
} ,
ui : {
@ -1374,7 +1103,10 @@ export default {
if ( this . project . projectType ) {
return this . projectTypes . find ( ( { value } ) => value === this . project . projectType )
} else {
return { icon : 'mdi-server' , iconColor : 'primary' }
return {
icon : 'mdi-server' ,
iconColor : 'primary'
}
}
} ,
databaseNamesReverse ( ) {
@ -1415,19 +1147,6 @@ export default {
} ,
selectFile ( db , obj , key , index ) {
this . $refs [ key ] [ index ] . click ( )
/ / c o n s o l e . l o g ( o b j , k e y ) ;
/ / c o n s t f i l e = d i a l o g . s h o w O p e n D i a l o g ( {
/ / p r o p e r t i e s : [ " o p e n F i l e " ]
/ / } ) ;
/ / c o n s o l e . l o g ( t y p e o f f i l e , f i l e , t y p e o f f i l e [ 0 ] ) ;
/ / i f ( f i l e & & f i l e [ 0 ] ) {
/ / l e t f i l e N a m e = p a t h . b a s e n a m e ( f i l e [ 0 ] ) ;
/ / d b . u i [ o b j ] [ k e y ] = f i l e N a m e ;
/ / V u e . s e t ( d b . u i [ o b j ] , k e y , f i l e N a m e )
/ / / / d b . c o n n e c t i o n [ o b j ] [ k e y ] = f i l e [ 0 ] . t o S t r i n g ( ) ;
/ / V u e . s e t ( d b . c o n n e c t i o n [ o b j ] , k e y , f i l e [ 0 ] . t o S t r i n g ( ) )
/ / }
} ,
onPanelToggle ( panelIndex , envKey ) {
this . $nextTick ( ( ) => {
@ -1455,20 +1174,15 @@ export default {
Vue . set ( this . databases , panelIndex , tabIndex )
} ,
getProjectJson ( ) {
console . log ( 'Project json before creating' , this . project )
/ * *
* remove UI keys within project
* /
const xcConfig = JSON . parse ( JSON . stringify ( this . project ) )
console . log ( JSON . stringify ( this . project ) )
console . log ( 'Project json after parsing' , xcConfig )
delete xcConfig . ui
for ( const env in xcConfig . envs ) {
for ( let i = 0 ; i < xcConfig . envs [ env ] . db . length ; ++ i ) {
xcConfig . envs [ env ] . db [ i ] . meta . api . type = this . project . projectType
console . log ( 'getProjectJson:' , env , i , xcConfig . envs [ env ] . db [ i ] )
if (
xcConfig . envs [ env ] . db [ i ] . client === 'mysql' ||
xcConfig . envs [ env ] . db [ i ] . client === 'mysql2'
@ -1495,15 +1209,15 @@ export default {
const inflectionObj = xcConfig . envs [ env ] . db [ i ] . meta . inflection
if ( inflectionObj ) {
if ( Array . isArray ( inflectionObj . tn ) ) {
inflectionObj . tn = inflectionObj . tn . join ( ',' )
if ( Array . isArray ( inflectionObj . table _name ) ) {
inflectionObj . table _name = inflectionObj . table _name . join ( ',' )
}
if ( Array . isArray ( inflectionObj . cn ) ) {
inflectionObj . cn = inflectionObj . cn . join ( ',' )
if ( Array . isArray ( inflectionObj . colum n _name ) ) {
inflectionObj . colum n _name = inflectionObj . colum n _name . join ( ',' )
}
inflectionObj . tn = inflectionObj . tn || 'none'
inflectionObj . cn = inflectionObj . cn || 'none'
inflectionObj . table _name = inflectionObj . table _name || 'none'
inflectionObj . colum n _name = inflectionObj . colum n _name || 'none'
}
if ( this . allSchemas ) {
@ -1563,14 +1277,10 @@ export default {
}
}
console . log ( 'Project json : after' , xcConfig )
return xcConfig
} ,
constructProjectJsonFromProject ( project ) {
/ / c o n s t { p r o j e c t J s o n : e n v s , . . . r e s t } = p r o j e c t ;
/ / l e t p = { . . . r e s t , . . . e n v s } ;
const p = project / / J S O N . p a r s e ( J S O N . s t r i n g i f y ( p r o j e c t . p r o j e c t J s o n ) ) ;
p . ui = {
@ -1651,50 +1361,49 @@ export default {
this . projectReloading = true
const result = await this . $store . dispatch ( 'sqlMgr/ActSqlOp' , [
{
query : {
skipProjectHasDb : 1
}
} ,
this . edit ? 'projectUpdateByWeb' : 'projectCreateByWeb' ,
{
project : {
title : projectJson . title ,
folder : 'config.xc.json' ,
type : 'pg'
} ,
projectJson
const con = projectJson . envs . _noco . db [ 0 ]
const inflection = ( con . meta && con . meta . inflection ) || { }
try {
const result = ( await this . $api . project . create ( {
title : projectJson . title ,
bases : [ {
type : con . client ,
config : con ,
inflection _column : inflection . column _name ,
inflection _table : inflection . table _name
} ] ,
external : true
} ) )
clearInterval ( interv )
toast . goAway ( 100 )
await this . $store . dispatch ( 'project/ActLoadProjectInfo' )
this . projectReloading = false
if ( ! this . edit && ! this . allSchemas ) {
this . $router . push ( {
path : ` /nc/ ${ result . id } ` ,
query : {
new : 1
}
} )
}
] )
clearInterval ( interv )
toast . goAway ( 100 )
console . log ( 'project created redirect to project page' , projectJson , result )
await this . $store . dispatch ( 'project/ActLoadProjectInfo' )
this . projectReloading = false
if ( ! this . edit && ! this . allSchemas ) {
this . $router . push ( {
path : ` /nc/ ${ result . id } ` ,
query : {
new : 1
}
} )
this . projectCreated = true
} catch ( e ) {
this . $toast . error ( await this . _extractSdkResponseErrorMsg ( e ) ) . goAway ( 3000 )
toast . goAway ( 0 )
}
this . projectCreated = true
this . projectReloading = false
this . $tele . emit ( 'project:create:extdb:submit' )
} ,
mtdDialogGetEnvNameSubmit ( envName , cookie ) {
console . log ( envName )
this . dialogGetEnvName . dialogShow = false
if ( envName in this . project . envs ) {
console . log ( 'Environment exists' )
} else {
Vue . set ( this . project . envs , envName , {
db : [
@ -1711,8 +1420,8 @@ export default {
tn : 'nc_evolutions' ,
dbAlias : 'db' ,
inflection : {
tn : 'camelize' ,
cn : 'camelize'
table _name : 'camelize' ,
colum n _name : 'camelize'
} ,
api : {
type : ''
@ -1734,7 +1443,6 @@ export default {
}
} ,
mtdDialogGetEnvNameCancel ( ) {
console . log ( 'mtdDialogGetTableNameCancel cancelled' )
this . dialogGetEnvName . dialogShow = false
} ,
@ -1761,8 +1469,8 @@ export default {
tn : 'nc_evolutions' ,
dbAlias ,
inflection : {
tn : 'camelize' ,
cn : 'camelize'
table _name : 'camelize' ,
colum n _name : 'camelize'
} ,
api : {
type : ''
@ -1786,24 +1494,8 @@ export default {
this . dialog . show = false
} ,
selectDir ( ev ) {
/ / c o n s o l e . l o g ( e v )
/ / c o n s t f i l e = d i a l o g . s h o w O p e n D i a l o g ( {
/ / p r o p e r t i e s : [ ' o p e n D i r e c t o r y ' ]
/ / } )
/ / i f ( f i l e & & f i l e [ 0 ] ) {
/ / t h i s . b a s e F o l d e r = f i l e [ 0 ]
/ / t h i s . p r o j e c t . f o l d e r = f i l e [ 0 ]
/ / t h i s . u s e r S e l e c t e d D i r = t r u e
/ / }
} ,
selectSqliteFile ( db ) {
/ / c o n s o l e . l o g ( e v )
/ / c o n s t f i l e = d i a l o g . s h o w O p e n D i a l o g ( {
/ / p r o p e r t i e s : [ " o p e n F i l e " ]
/ / } ) ;
/ / i f ( f i l e & & f i l e [ 0 ] ) {
/ / d b . c o n n e c t i o n . c o n n e c t i o n . f i l e n a m e = f i l e [ 0 ] ;
/ / }
} ,
getDbStatusColor ( db ) {
@ -1838,7 +1530,6 @@ export default {
}
} ,
async newTestConnection ( db , env , panelIndex ) {
console . log ( this . project . envs [ env ] [ 0 ] )
if (
db . connection . host === 'localhost' &&
! this . edit &&
@ -1869,7 +1560,6 @@ export default {
'testConnection' ,
c1
] )
console . log ( 'test connection result' , result )
if ( result . code === 0 ) {
db . ui . setup = 1
@ -1884,10 +1574,11 @@ export default {
if ( e === env ) {
/ / i g n o r e
} else {
console . log ( this . project . envs [ e ] )
const c2 = {
connection : { ... this . project . envs [ e ] . db [ 0 ] . connection , database : undefined } ,
connection : {
... this . project . envs [ e ] . db [ 0 ] . connection ,
database : undefined
} ,
client : this . project . envs [ e ] . db [ 0 ] . client
}
@ -1934,46 +1625,31 @@ export default {
}
let sendAdvancedConfig = false
const sslOptions = Object . values ( connection . ssl ) . filter ( el => ! ! el )
console . log ( 'sslOptions:' , sslOptions )
if ( sslOptions [ 0 ] ) {
sendAdvancedConfig = true
} else {
console . log ( 'no ssl options' )
}
return sendAdvancedConfig
} ,
handleSSL ( db , creating = true ) {
console . log ( 'handleSSL' , db )
const sendAdvancedConfig = this . sendAdvancedConfig ( db . connection )
if ( ! sendAdvancedConfig ) {
/ / a r g s . s s l = u n d e f i n e d ;
db . connection . ssl = undefined
}
if ( db . connection . ssl ) {
/ / d b . c o n n e c t i o n . s s l . c a F i l e P a t h = d b . c o n n e c t i o n . s s l . c a ;
/ / d b . c o n n e c t i o n . s s l . k e y F i l e P a t h = d b . c o n n e c t i o n . s s l . k e y ;
/ / d b . c o n n e c t i o n . s s l . c e r t F i l e P a t h = d b . c o n n e c t i o n . s s l . c e r t ;
/ / i f ( c r e a t i n g ) {
/ / d e l e t e d b . c o n n e c t i o n . s s l . c a ;
/ / d e l e t e d b . c o n n e c t i o n . s s l . k e y ;
/ / d e l e t e d b . c o n n e c t i o n . s s l . c e r t ;
/ / }
}
} ,
getDatabaseForTestConnection ( dbType ) {
} ,
async testConnection ( db , env , panelIndex ) {
this . $tele . emit ( 'project:create:extdb:test-connection' )
this . $store . commit ( 'notification/MutToggleProgressBar' , true )
try {
if ( ! ( await this . newTestConnection ( db , env , panelIndex ) ) ) {
/ / t h i s . a c t i v e D b N o d e . t e s t C o n n e c t i o n S t a t u s = f a l s e ;
/ /
this . handleSSL ( db )
console . log ( 'testconnection params' , db )
if ( db . client === 'sqlite3' ) {
db . ui . setup = 1
} else {
@ -1985,18 +1661,8 @@ export default {
client : db . client
}
/ / c o n s t r e s u l t = a w a i t t h i s . s q l M g r . t e s t C o n n e c t i o n ( c 1 ) ;
const result = await this . $store . dispatch ( 'sqlMgr/ActSqlOp' , [
{
query : {
skipProjectHasDb : 1
}
} ,
'testConnection' ,
c1
] )
const result = ( await this . $api . utils . testConnection ( c1 ) )
console . log ( 'test connection result' , result )
if ( result . code === 0 ) {
db . ui . setup = 1
/ / t h i s . d i a l o g . h e a d i n g = " C o n n e c t i o n w a s s u c c e s s f u l "
@ -2010,8 +1676,6 @@ export default {
this . dialog . type = 'error'
this . dialog . show = true
}
console . log ( 'testconnection params : after' , db )
}
}
} catch ( e ) {
@ -2038,7 +1702,10 @@ export default {
const db = this . project . envs [ env ] . db [ index ]
Vue . set ( db , 'client' , this . databaseNames [ client ] )
if ( client !== 'Sqlite' ) {
const { ssl , ... connectionDet } = this . sampleConnectionData [ client ]
const {
ssl ,
... connectionDet
} = this . sampleConnectionData [ client ]
Vue . set ( db , 'connection' , {
... connectionDet ,
@ -2064,11 +1731,8 @@ export default {
database : [ this . project . folder , ` ${ this . project . title } _ ${ env } _ ${ index + 1 } ` ] . join (
'/'
) ,
/ / d a t a b a s e : p a t h . j o i n ( t h i s . p r o j e c t . f o l d e r , ` $ { t h i s . p r o j e c t . t i t l e } _ $ { e n v } _ $ { i n d e x + 1 } ` ) ,
useNullAsDefault : true
} )
/ / V u e . s e t ( d b . c o n n e c t i o n , ' c o n n e c t i o n ' , { f i l e n a m e : ` $ { t h i s . p r o j e c t . f o l d e r } / $ { t h i s . p r o j e c t . t i t l e } _ $ { e n v } _ $ { i n d e x + 1 } ` } )
/ / V u e . s e t ( d b . c o n n e c t i o n , ' d a t a b a s e ' , ` $ { t h i s . p r o j e c t . f o l d e r } / $ { t h i s . p r o j e c t . t i t l e } _ $ { e n v } _ $ { i n d e x + 1 } ` )
}
}
}
@ -2082,8 +1746,6 @@ export default {
db . ui . setup = status
} ,
removeDBFromEnv ( db , env , panelIndex , dbIndex ) {
console . log ( db , env , panelIndex , dbIndex )
for ( const env in this . project . envs ) {
if ( this . project . envs [ env ] . db . length > dbIndex ) {
this . project . envs [ env ] . db . splice ( dbIndex , 1 )
@ -2095,7 +1757,10 @@ export default {
Vue . set ( this . project , 'envs' , { ... this . project . envs } )
}
} ,
fetch ( { store , params } ) {
fetch ( {
store ,
params
} ) {
} ,
beforeCreated ( ) {
} ,
@ -2115,12 +1780,6 @@ export default {
if ( db . client !== 'sqlite3' ) {
Vue . set ( db . connection , 'database' , ` ${ this . project . title } _ ${ env } _ ${ index + 1 } ` )
} else {
/ / V u e . s e t ( d b . c o n n e c t i o n , ' c o n n e c t i o n ' , {
/ / f i l e n a m e : p a t h . j o i n (
/ / t h i s . p r o j e c t . f o l d e r ,
/ / ` $ { t h i s . p r o j e c t . t i t l e } _ $ { e n v } _ $ { i n d e x + 1 } `
/ / )
/ / } )
Vue . set ( db . connection , 'database' , ` ${ this . project . title } _ ${ env } _ ${ index + 1 } ` )
}
}
@ -2168,12 +1827,9 @@ export default {
this . compErrorMessages [ Math . floor ( Math . random ( ) * this . compErrorMessages . length ) ]
if ( this . edit ) {
/ / t h i s . e d i t = t r u e ;
/ / a w a i t t h i s . $ s t o r e . d i s p a t c h ( ' s q l M g r / i n s t a n t i a t e S q l M g r ' ) ;
try {
let data = await this . $store . dispatch ( 'sqlMgr/ActSqlOp' , [ null , 'xcProjectGetConfig' ] )
data = JSON . parse ( data . config )
console . log ( 'created:' , data )
this . constructProjectJsonFromProject ( data )
this . $set ( this . project , 'folder' , data . folder )
} catch ( e ) {
@ -2215,17 +1871,9 @@ export default {
... this . sampleConnectionData [ dbsAvailable [ 0 ] ] ,
ssl : { ... this . sampleConnectionData [ dbsAvailable [ 0 ] ] . ssl }
}
/ / d b . u i . s e t u p = a w a i t P o r t S c a n n e r . i s A l i v e ( d b . c o n n e c t i o n . h o s t , p a r s e I n t ( d b . c o n n e c t i o n . p o r t ) ) ? 0 : - 1 ;
}
}
}
/ / f o r ( l e t e n v i n t h i s . p r o j e c t . e n v s ) {
/ / f o r ( l e t d b o f t h i s . p r o j e c t . e n v s [ e n v ] ) {
/ / d b . u i . s e t u p = a w a i t P o r t S c a n n e r . i s A l i v e ( d b . c o n n e c t i o n . h o s t , p a r s e I n t ( d b . c o n n e c t i o n . p o r t ) ) ? 0 : - 1 ;
/ / c o n s o l e . l o g ( ' t e s t i n g p o r t ' , e n v , d b . c o n n e c t i o n . d a t a b a s e , d b . u i . s e t u p ) ;
/ / }
/ / }
}
} ,
beforeMount ( ) {