|
|
@ -2,9 +2,10 @@ |
|
|
|
import { ref } from 'vue' |
|
|
|
import { ref } from 'vue' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useToast } from 'vue-toastification' |
|
|
|
import { useToast } from 'vue-toastification' |
|
|
|
import { useNuxtApp, useRouter } from '#app' |
|
|
|
import { navigateTo, useNuxtApp } from '#app' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
|
import { clientTypes, getDefaultConnectionConfig, getTestDatabaseName } from '~/utils/projectCreateUtils' |
|
|
|
import { clientTypes, getDefaultConnectionConfig, getTestDatabaseName } from '~/utils/projectCreateUtils' |
|
|
|
|
|
|
|
import MaterialSymbolsRocketLaunchOutline from '~icons/material-symbols/rocket-launch-outline' |
|
|
|
|
|
|
|
|
|
|
|
const name = ref('') |
|
|
|
const name = ref('') |
|
|
|
const loading = ref(false) |
|
|
|
const loading = ref(false) |
|
|
@ -16,10 +17,9 @@ const inflection = reactive({ |
|
|
|
columnName: 'camelize', |
|
|
|
columnName: 'camelize', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const $router = useRouter() |
|
|
|
|
|
|
|
const { $api, $e } = useNuxtApp() |
|
|
|
const { $api, $e } = useNuxtApp() |
|
|
|
const toast = useToast() |
|
|
|
const toast = useToast() |
|
|
|
const { t: $t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
const titleValidationRule = [ |
|
|
|
const titleValidationRule = [ |
|
|
|
(v: string) => !!v || 'Title is required', |
|
|
|
(v: string) => !!v || 'Title is required', |
|
|
@ -42,7 +42,7 @@ const createProject = async () => { |
|
|
|
external: true, |
|
|
|
external: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
await $router.push(`/nc/${result.id}`) |
|
|
|
await navigateTo(`/nc/${result.id}`) |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
// todo: toast |
|
|
|
// todo: toast |
|
|
|
toast.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
toast.error(await extractSdkResponseErrorMsg(e)) |
|
|
@ -72,7 +72,7 @@ const testConnection = async () => { |
|
|
|
testSuccess.value = true |
|
|
|
testSuccess.value = true |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
testSuccess.value = false |
|
|
|
testSuccess.value = false |
|
|
|
toast.error($t('msg.error.dbConnectionFailed') + result.message) |
|
|
|
toast.error(`${t('msg.error.dbConnectionFailed')} ${result.message}`) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
@ -84,24 +84,25 @@ const testConnection = async () => { |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<NuxtLayout> |
|
|
|
<NuxtLayout> |
|
|
|
<div class="main justify-center d-flex mx-auto" style="min-height: 600px; overflow: auto"> |
|
|
|
<v-container fluid class="d-flex justify-center align-center h-75"> |
|
|
|
<v-form ref="form" v-model="valid" @submit.prevent="createProject"> |
|
|
|
<v-form ref="form" v-model="valid" @submit.prevent="createProject"> |
|
|
|
<v-card style="width: 530px; margin-top: 100px" class="mx-auto"> |
|
|
|
<v-card max-width="600"> |
|
|
|
<!-- Create Project --> |
|
|
|
<!-- Create Project --> |
|
|
|
<v-container class="pb-10 px-12" style="padding-top: 43px !important"> |
|
|
|
<v-container class="pb-10 px-12"> |
|
|
|
<h1 class="mt-4 mb-4 text-center"> |
|
|
|
<h1 class="mb-4 text-center"> |
|
|
|
<!-- {{ $t('activity.createProject') }} --> |
|
|
|
{{ $t('activity.createProject') }} |
|
|
|
Create Project |
|
|
|
|
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<div class="mx-auto" style="width: 350px"> |
|
|
|
|
|
|
|
<!-- label="Enter Project Name" --> |
|
|
|
|
|
|
|
<!-- rule text: Required --> |
|
|
|
|
|
|
|
<v-text-field v-model="name" :rules="titleValidationRule" class="nc-metadb-project-name" label="Project name" /> |
|
|
|
|
|
|
|
<!-- :rules="titleValidationRule" --> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<v-container fluid> |
|
|
|
|
|
|
|
<v-row> |
|
|
|
<v-row> |
|
|
|
|
|
|
|
<v-col offset="2" cols="8"> |
|
|
|
|
|
|
|
<v-text-field |
|
|
|
|
|
|
|
v-model="name" |
|
|
|
|
|
|
|
:rules="titleValidationRule" |
|
|
|
|
|
|
|
class="nc-metadb-project-name" |
|
|
|
|
|
|
|
:label="$t('labels.projName')" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-select |
|
|
|
<v-select |
|
|
|
v-model="projectDatasource.client" |
|
|
|
v-model="projectDatasource.client" |
|
|
@ -114,27 +115,33 @@ const testConnection = async () => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field v-model="projectDatasource.connection.host" density="compact" label="Host" /> |
|
|
|
<v-text-field v-model="projectDatasource.connection.host" density="compact" :label="$t('labels.hostAddress')" /> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field v-model="projectDatasource.connection.port" density="compact" label="Port" type="number" /> |
|
|
|
<v-text-field |
|
|
|
|
|
|
|
v-model="projectDatasource.connection.port" |
|
|
|
|
|
|
|
density="compact" |
|
|
|
|
|
|
|
:label="$t('labels.port')" |
|
|
|
|
|
|
|
type="number" |
|
|
|
|
|
|
|
/> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field v-model="projectDatasource.connection.user" density="compact" label="Username" /> |
|
|
|
<v-text-field v-model="projectDatasource.connection.user" density="compact" :label="$t('labels.username')" /> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field |
|
|
|
<v-text-field |
|
|
|
v-model="projectDatasource.connection.password" |
|
|
|
v-model="projectDatasource.connection.password" |
|
|
|
density="compact" |
|
|
|
density="compact" |
|
|
|
type="password" |
|
|
|
type="password" |
|
|
|
label="Password" |
|
|
|
:label="$t('labels.password')" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field v-model="projectDatasource.connection.database" density="compact" label="Database name" /> |
|
|
|
<v-text-field v-model="projectDatasource.connection.database" density="compact" label="Database name" /> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
|
|
<!-- <v-col cols="6"> |
|
|
|
<!-- todo: reimplement? |
|
|
|
|
|
|
|
<v-col cols="6"> |
|
|
|
<v-text-field |
|
|
|
<v-text-field |
|
|
|
v-model="inflection.tableName" |
|
|
|
v-model="inflection.tableName" |
|
|
|
density="compact" |
|
|
|
density="compact" |
|
|
@ -148,26 +155,24 @@ const testConnection = async () => { |
|
|
|
density="compact" |
|
|
|
density="compact" |
|
|
|
label="Database name" |
|
|
|
label="Database name" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</v-col> --> |
|
|
|
</v-col> |
|
|
|
|
|
|
|
--> |
|
|
|
</v-row> |
|
|
|
</v-row> |
|
|
|
</v-container> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="d-flex justify-center" style="gap: 4px"> |
|
|
|
<div class="d-flex justify-center" style="gap: 4px"> |
|
|
|
<v-btn :disabled="!testSuccess" class="" large :loading="loading" color="primary" @click="createProject"> |
|
|
|
<v-btn :disabled="!testSuccess" large :loading="loading" color="primary" @click="createProject"> |
|
|
|
<v-icon class="mr-1 mt-n1"> mdi-rocket-launch-outline</v-icon> |
|
|
|
<MaterialSymbolsRocketLaunchOutline class="mr-1" /> |
|
|
|
<!-- Create --> |
|
|
|
<span> {{ $t('general.create') }} </span> |
|
|
|
<span class="mr-1">{{ $t('general.create') }} </span> |
|
|
|
|
|
|
|
</v-btn> |
|
|
|
</v-btn> |
|
|
|
|
|
|
|
|
|
|
|
<v-btn size="sm" class="text-sm text-capitalize"> |
|
|
|
<v-btn small class="px-2"> |
|
|
|
<!-- Test Database Connection --> |
|
|
|
|
|
|
|
{{ $t('activity.testDbConn') }} |
|
|
|
{{ $t('activity.testDbConn') }} |
|
|
|
</v-btn> |
|
|
|
</v-btn> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</v-container> |
|
|
|
</v-container> |
|
|
|
</v-card> |
|
|
|
</v-card> |
|
|
|
</v-form> |
|
|
|
</v-form> |
|
|
|
</div> |
|
|
|
</v-container> |
|
|
|
</NuxtLayout> |
|
|
|
</NuxtLayout> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|