|
|
|
@ -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;"> |
|
|
|
|
<!– <v-row class="text-center">–> |
|
|
|
|
<!– <v-col cols="12">–> |
|
|
|
|
<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-card> |
|
|
|
|
<!– </v-col>–> |
|
|
|
|
<!– </v-row>–> |
|
|
|
|
<v-row> |
|
|
|
|
<v-col> |
|
|
|
|
<v-card dark class=" elevation-10"> |
|
|
|
|
<v-card-text class="pb-0 font-weight-bold"># Databases</v-card-text> |
|
|
|
|
<v-card-text class="title white--text"> |
|
|
|
|
<v-icon class="mt-n2 mr-1" color="info">mdi-database-sync</v-icon> |
|
|
|
|
|
|
|
|
|
180/190 |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
</v-col> |
|
|
|
|
<v-col> |
|
|
|
|
<v-card dark class=" elevation-10"> |
|
|
|
|
<v-card-text class="pb-0 font-weight-bold"># Tables</v-card-text> |
|
|
|
|
<v-card-text class="title white--text"> |
|
|
|
|
<v-icon class="mr-1 mt-n1 " color="info">mdi-table-large</v-icon> |
|
|
|
|
50000 |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
</v-col> |
|
|
|
|
<v-col> |
|
|
|
|
<v-card dark class=" elevation-10"> |
|
|
|
|
<v-card-text class="pb-0 font-weight-bold">Time Saved</v-card-text> |
|
|
|
|
<v-card-text class="title white--text"> |
|
|
|
|
<v-icon class="mr-1 mt-n1" color="secondary">mdi-clock-fast</v-icon> |
|
|
|
|
10hrs |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
</v-col> |
|
|
|
|
<v-col> |
|
|
|
|
<v-card dark class=" elevation-10"> |
|
|
|
|
<v-card-text class="pb-0 font-weight-bold">CostSaved</v-card-text> |
|
|
|
|
<v-card-text class="title white--text"> |
|
|
|
|
<v-icon color="success" class="mt-n2 mr-1">mdi-currency-usd-circle</v-icon> |
|
|
|
|
100$ |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
</v-col> |
|
|
|
|
</v-row> |
|
|
|
|
<!– <v-divider class="my-3 "></v-divider>–> |
|
|
|
|
<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-icon> |
|
|
|
|
<span class="caption">Database {{ i }} {{ j }}</span> |
|
|
|
|
<v-spacer></v-spacer> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</v-simple-table> |
|
|
|
|
</v-card> |
|
|
|
|
</v-container> |
|
|
|
|
</v-card> |
|
|
|
|
</div>--> |
|
|
|
|
<!-- </v-overlay>--> |
|
|
|
|
|
|
|
|
|
<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-icon>--> |
|
|
|
|
</v-text-field> |
|
|
|
|
|
|
|
|
|
<!-- 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-icon> |
|
|
|
|
<span class="caption">{{ type.text }}</span> |
|
|
|
|
</v-chip> |
|
|
|
|
</template> |
|
|
|
|
</v-radio> |
|
|
|
|
</v-radio-group> |
|
|
|
|
/> |
|
|
|
|
</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-icon> |
|
|
|
|
</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-icon> {{ item.text }}</span> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
</v-select>--> |
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
<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-icon> --> |
|
|
|
|
<!-- <span class="title"> <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-tab> |
|
|
|
|
<!-- <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-icon> |
|
|
|
|
</v-hover> |
|
|
|
|
</x-btn> |
|
|
|
|
</template> |
|
|
|
|
<span>Add new database to '{{ envKey }}' environment</span> |
|
|
|
|
</v-tooltip> |
|
|
|
|
--> |
|
|
|
|
<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-chip> |
|
|
|
|
<!-- <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]"/>--> |
|
|
|
|
<!-- <!– {{ data.item }}–>--> |
|
|
|
|
|
|
|
|
|
<!-- <p v-if="!databaseNames[data.item]" class="text-center grey--text">--> |
|
|
|
|
<!-- Coming soon</p>--> |
|
|
|
|
<!-- </div>--> |
|
|
|
|
</template> |
|
|
|
|
</v-select> |
|
|
|
|
</v-col> |
|
|
|
@ -523,6 +374,7 @@
|
|
|
|
|
:label="$t('labels.dbCreateIfNotExists')" |
|
|
|
|
/> |
|
|
|
|
</v-col> |
|
|
|
|
<!-- 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.column_name" |
|
|
|
|
:disabled="edit" |
|
|
|
|
class="caption" |
|
|
|
|
:label=" |
|
|
|
@ -775,158 +627,8 @@
|
|
|
|
|
</v-col> |
|
|
|
|
</v-expansion-panel-content> |
|
|
|
|
</v-expansion-panel> |
|
|
|
|
|
|
|
|
|
<!-- <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-icon> |
|
|
|
|
Add Another Environment |
|
|
|
|
</x-btn> |
|
|
|
|
</template> |
|
|
|
|
<span>Add new environment to {{ project.title }} project</span> |
|
|
|
|
</v-tooltip> |
|
|
|
|
<template v-slot:actions> |
|
|
|
|
<i></i> |
|
|
|
|
</template> |
|
|
|
|
</v-expansion-panel-header> |
|
|
|
|
</v-expansion-panel>--> |
|
|
|
|
</v-expansion-panels> |
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
<!-- <v-col cols="10" offset="1" v-show="isTitle" |
|
|
|
|
: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}">–> |
|
|
|
|
<!– Advanced Configuration</h2>–> |
|
|
|
|
<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-icon> |
|
|
|
|
<span class="grey--text text--darken-1">Advance Configuration</span> |
|
|
|
|
</p> |
|
|
|
|
|
|
|
|
|
</v-expansion-panel-header> |
|
|
|
|
<v-expansion-panel-content eager> |
|
|
|
|
<v-card class="mt-3"> |
|
|
|
|
<v-card-title> |
|
|
|
|
<v-icon class="mr-2">mdi-shield-account-outline</v-icon> |
|
|
|
|
Authentication Configuration |
|
|
|
|
</v-card-title> |
|
|
|
|
|
|
|
|
|
<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-select> |
|
|
|
|
|
|
|
|
|
</v-col> |
|
|
|
|
<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-icon> |
|
|
|
|
</template> |
|
|
|
|
</v-text-field> |
|
|
|
|
<v-text-field |
|
|
|
|
v-else |
|
|
|
|
|
|
|
|
|
v-model="auth.webhook" |
|
|
|
|
label="Webhook url" |
|
|
|
|
|
|
|
|
|
> |
|
|
|
|
</v-text-field> |
|
|
|
|
|
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
</v-row> |
|
|
|
|
</v-container> |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
<!– </v-expansion-panel-content>–> |
|
|
|
|
<!– </v-expansion-panel>–> |
|
|
|
|
<!– </v-expansion-panels>–> |
|
|
|
|
<!– </v-col>–> |
|
|
|
|
<!– <v-col cols="10" offset="1" v-show="project.title.trim().length"–> |
|
|
|
|
<!– :class="{'mt-0 pt-0':!edit,'mt-3 pt-3':edit}">–> |
|
|
|
|
|
|
|
|
|
<!– <v-expansion-panels v-model="smtpPanel" focusable accordion="" class="elevation-20"–> |
|
|
|
|
<!– style="border: 1px solid grey">–> |
|
|
|
|
|
|
|
|
|
<!– <v-expansion-panel>–> |
|
|
|
|
<!– <v-expansion-panel-header disable-icon-rotate>–> |
|
|
|
|
|
|
|
|
|
<!– <p class="pa-0 ma-0">–> |
|
|
|
|
<!– <v-icon class="mt-n2 " color="grey darken-1">mdi-email-edit</v-icon> –> |
|
|
|
|
<!– <span class="grey--text text--darken-1">SMTP Configuration</span>–> |
|
|
|
|
<!– </p>–> |
|
|
|
|
|
|
|
|
|
<!– </v-expansion-panel-header>–> |
|
|
|
|
<!– <v-expansion-panel-content :eager="false">–> |
|
|
|
|
|
|
|
|
|
<v-card class="mt-3"> |
|
|
|
|
<v-card-title> |
|
|
|
|
<v-icon class="mr-2">mdi-email-edit</v-icon> |
|
|
|
|
SMTP Configuration |
|
|
|
|
</v-card-title> |
|
|
|
|
<v-card-text> |
|
|
|
|
|
|
|
|
|
<v-text-field |
|
|
|
|
v-model="smtpConfiguration.from" |
|
|
|
|
label="From address" |
|
|
|
|
placeholder="Company<noreply@company.com>" |
|
|
|
|
|
|
|
|
|
> |
|
|
|
|
</v-text-field> |
|
|
|
|
|
|
|
|
|
<label>Mailer Config Options<span class="caption"> (For connection example visit: <a |
|
|
|
|
href="https://nodemailer.com/smtp/#examples">https://nodemailer.com/smtp/#examples</a>)</span></label> |
|
|
|
|
<monaco-json-editor |
|
|
|
|
ref="monacoEditor" |
|
|
|
|
v-model="smtpConfiguration.options" |
|
|
|
|
style="height: 300px; width:100% "></monaco-json-editor> |
|
|
|
|
</v-card-text> |
|
|
|
|
</v-card> |
|
|
|
|
</v-expansion-panel-content> |
|
|
|
|
</v-expansion-panel> |
|
|
|
|
|
|
|
|
|
</v-expansion-panels> |
|
|
|
|
|
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
<v-col cols="10" offset="1" v-show="isTitle" |
|
|
|
|
:class="{'mt-0 pt-0':!edit,'mt-3 pt-3':edit}"> |
|
|
|
|
|
|
|
|
|
<create-project-coming-soon></create-project-coming-soon> |
|
|
|
|
</v-col>--> |
|
|
|
|
</v-row> |
|
|
|
|
</v-container> |
|
|
|
|
</div> |
|
|
|
@ -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() |
|
|
|
|
|
|
|
|
|
// console.log(obj, key); |
|
|
|
|
// const file = dialog.showOpenDialog({ |
|
|
|
|
// properties: ["openFile"] |
|
|
|
|
// }); |
|
|
|
|
// console.log(typeof file, file, typeof file[0]); |
|
|
|
|
// if (file && file[0]) { |
|
|
|
|
// let fileName = path.basename(file[0]); |
|
|
|
|
// db.ui[obj][key] = fileName; |
|
|
|
|
// Vue.set(db.ui[obj], key, fileName) |
|
|
|
|
// //db.connection[obj][key] = file[0].toString(); |
|
|
|
|
// Vue.set(db.connection[obj], key, file[0].toString()) |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
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.column_name)) { |
|
|
|
|
inflectionObj.column_name = inflectionObj.column_name.join(',') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inflectionObj.tn = inflectionObj.tn || 'none' |
|
|
|
|
inflectionObj.cn = inflectionObj.cn || 'none' |
|
|
|
|
inflectionObj.table_name = inflectionObj.table_name || 'none' |
|
|
|
|
inflectionObj.column_name = inflectionObj.column_name || 'none' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.allSchemas) { |
|
|
|
@ -1563,14 +1277,10 @@ export default {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('Project json : after', xcConfig) |
|
|
|
|
return xcConfig |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
constructProjectJsonFromProject(project) { |
|
|
|
|
// const {projectJson: envs, ...rest} = project; |
|
|
|
|
|
|
|
|
|
// let p = {...rest, ...envs}; |
|
|
|
|
const p = project // JSON.parse(JSON.stringify(project.projectJson)); |
|
|
|
|
|
|
|
|
|
p.ui = { |
|
|
|
@ -1651,26 +1361,22 @@ export default {
|
|
|
|
|
|
|
|
|
|
this.projectReloading = true |
|
|
|
|
|
|
|
|
|
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [ |
|
|
|
|
{ |
|
|
|
|
query: { |
|
|
|
|
skipProjectHasDb: 1 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
this.edit ? 'projectUpdateByWeb' : 'projectCreateByWeb', |
|
|
|
|
{ |
|
|
|
|
project: { |
|
|
|
|
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, |
|
|
|
|
folder: 'config.xc.json', |
|
|
|
|
type: 'pg' |
|
|
|
|
}, |
|
|
|
|
projectJson |
|
|
|
|
} |
|
|
|
|
]) |
|
|
|
|
bases: [{ |
|
|
|
|
type: con.client, |
|
|
|
|
config: con, |
|
|
|
|
inflection_column: inflection.column_name, |
|
|
|
|
inflection_table: inflection.table_name |
|
|
|
|
}], |
|
|
|
|
external: true |
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
clearInterval(interv) |
|
|
|
|
toast.goAway(100) |
|
|
|
|
console.log('project created redirect to project page', projectJson, result) |
|
|
|
|
|
|
|
|
|
await this.$store.dispatch('project/ActLoadProjectInfo') |
|
|
|
|
|
|
|
|
@ -1686,15 +1392,18 @@ export default {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.projectCreated = true |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000) |
|
|
|
|
toast.goAway(0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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', |
|
|
|
|
column_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', |
|
|
|
|
column_name: 'camelize' |
|
|
|
|
}, |
|
|
|
|
api: { |
|
|
|
|
type: '' |
|
|
|
@ -1786,24 +1494,8 @@ export default {
|
|
|
|
|
this.dialog.show = false |
|
|
|
|
}, |
|
|
|
|
selectDir(ev) { |
|
|
|
|
// console.log(ev) |
|
|
|
|
// const file = dialog.showOpenDialog({ |
|
|
|
|
// properties: ['openDirectory'] |
|
|
|
|
// }) |
|
|
|
|
// if (file && file[0]) { |
|
|
|
|
// this.baseFolder = file[0] |
|
|
|
|
// this.project.folder = file[0] |
|
|
|
|
// this.userSelectedDir = true |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
selectSqliteFile(db) { |
|
|
|
|
// console.log(ev) |
|
|
|
|
// const file = dialog.showOpenDialog({ |
|
|
|
|
// properties: ["openFile"] |
|
|
|
|
// }); |
|
|
|
|
// if (file && file[0]) { |
|
|
|
|
// db.connection.connection.filename = file[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) { |
|
|
|
|
// ignore |
|
|
|
|
} 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) { |
|
|
|
|
// args.ssl = undefined; |
|
|
|
|
db.connection.ssl = undefined |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (db.connection.ssl) { |
|
|
|
|
// db.connection.ssl.caFilePath = db.connection.ssl.ca; |
|
|
|
|
// db.connection.ssl.keyFilePath = db.connection.ssl.key; |
|
|
|
|
// db.connection.ssl.certFilePath = db.connection.ssl.cert; |
|
|
|
|
// if(creating) { |
|
|
|
|
// delete db.connection.ssl.ca; |
|
|
|
|
// delete db.connection.ssl.key; |
|
|
|
|
// delete db.connection.ssl.cert; |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
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))) { |
|
|
|
|
// this.activeDbNode.testConnectionStatus = false; |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// const result = await this.sqlMgr.testConnection(c1); |
|
|
|
|
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 |
|
|
|
|
// this.dialog.heading = "Connection was successful" |
|
|
|
@ -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( |
|
|
|
|
'/' |
|
|
|
|
), |
|
|
|
|
// database: path.join(this.project.folder, `${this.project.title}_${env}_${index + 1}`), |
|
|
|
|
useNullAsDefault: true |
|
|
|
|
}) |
|
|
|
|
// Vue.set(db.connection, 'connection', {filename: `${this.project.folder}/${this.project.title}_${env}_${index + 1}`}) |
|
|
|
|
// Vue.set(db.connection, 'database', `${this.project.folder}/${this.project.title}_${env}_${index + 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 { |
|
|
|
|
// Vue.set(db.connection, 'connection', { |
|
|
|
|
// filename: path.join( |
|
|
|
|
// this.project.folder, |
|
|
|
|
// `${this.project.title}_${env}_${index + 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) { |
|
|
|
|
// this.edit = true; |
|
|
|
|
// await this.$store.dispatch('sqlMgr/instantiateSqlMgr'); |
|
|
|
|
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 } |
|
|
|
|
} |
|
|
|
|
// db.ui.setup = await PortScanner.isAlive(db.connection.host, parseInt(db.connection.port)) ? 0 : -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// for (let env in this.project.envs) { |
|
|
|
|
// for (let db of this.project.envs[env]) { |
|
|
|
|
// db.ui.setup = await PortScanner.isAlive(db.connection.host, parseInt(db.connection.port)) ? 0 : -1; |
|
|
|
|
// console.log('testing port', env, db.connection.database, db.ui.setup); |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
beforeMount() { |
|
|
|
|