|
|
@ -1,58 +1,74 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
|
|
|
|
import { ref } from 'vue' |
|
|
|
import { useNuxtApp, useRouter } from "#app"; |
|
|
|
import { useNuxtApp, useRouter } from '#app' |
|
|
|
import { ref } from "vue"; |
|
|
|
|
|
|
|
|
|
|
|
const clientTypes = [ |
|
|
|
const name = ref(''); |
|
|
|
{ |
|
|
|
const loading = ref(false); |
|
|
|
text: 'MySql', |
|
|
|
const valid = ref(false); |
|
|
|
value: 'mysql2', |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
text: 'MSSAL', |
|
|
|
|
|
|
|
value: 'mssql', |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
text: 'PostgreSQL', |
|
|
|
|
|
|
|
value: 'pg', |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
text: 'SQLite', |
|
|
|
|
|
|
|
value: 'sqlite', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const name = ref('') |
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
|
|
|
|
|
const valid = ref(false) |
|
|
|
const projectDatasource = reactive({ |
|
|
|
const projectDatasource = reactive({ |
|
|
|
client:'mysql2', |
|
|
|
client: 'mysql2', |
|
|
|
connection:{ |
|
|
|
connection: { |
|
|
|
user: 'root', |
|
|
|
user: 'root', |
|
|
|
password: 'password', |
|
|
|
password: 'password', |
|
|
|
port: 3306, |
|
|
|
port: 3306, |
|
|
|
host: 'localhost', |
|
|
|
host: 'localhost', |
|
|
|
database: '', |
|
|
|
database: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
const inflection = reactive({ |
|
|
|
const { $api } = useNuxtApp(); |
|
|
|
tableName: 'camelize', |
|
|
|
const $router = useRouter(); |
|
|
|
columnName: 'camelize', |
|
|
|
const {user} = useUser() |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { $api } = useNuxtApp() |
|
|
|
|
|
|
|
const $router = useRouter() |
|
|
|
|
|
|
|
const { user } = useUser() |
|
|
|
|
|
|
|
|
|
|
|
const titleValidationRule = [ |
|
|
|
const titleValidationRule = [ |
|
|
|
v => !!v || "Title is required", |
|
|
|
v => !!v || 'Title is required', |
|
|
|
v => v.length <= 50 || "Project name exceeds 50 characters" |
|
|
|
v => v.length <= 50 || 'Project name exceeds 50 characters', |
|
|
|
]; |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
const createProject = async () => { |
|
|
|
const createProject = async () => { |
|
|
|
loading.value = true; |
|
|
|
loading.value = true |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
const result = await $api.project.create({ |
|
|
|
const result= await $api.project.create({ |
|
|
|
|
|
|
|
title: name.value, |
|
|
|
title: name.value, |
|
|
|
bases: [ |
|
|
|
bases: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: projectDatasource.client, |
|
|
|
type: projectDatasource.client, |
|
|
|
config: projectDatasource, |
|
|
|
config: projectDatasource, |
|
|
|
// inflection_column: inflection.column_name, |
|
|
|
inflection_column: inflection.columnName, |
|
|
|
// inflection_table: inflection.table_name |
|
|
|
inflection_table: inflection.tableName, |
|
|
|
} |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
external: true |
|
|
|
external: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
await $router.push( `/dashboard/${result.id}`); |
|
|
|
await $router.push(`/dashboard/${result.id}`) |
|
|
|
} catch (e) { |
|
|
|
} |
|
|
|
|
|
|
|
catch (e) { |
|
|
|
// todo: toast |
|
|
|
// todo: toast |
|
|
|
// this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000) |
|
|
|
// this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000) |
|
|
|
} |
|
|
|
} |
|
|
|
loading.value = false; |
|
|
|
loading.value = false |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -60,11 +76,10 @@ const createProject = async () => { |
|
|
|
<div class="main justify-center d-flex mx-auto" style="min-height: 600px;overflow: auto"> |
|
|
|
<div class="main justify-center d-flex mx-auto" style="min-height: 600px;overflow: auto"> |
|
|
|
<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 style="width:530px;margin-top: 100px" class="mx-auto"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Create Project --> |
|
|
|
<!-- Create Project --> |
|
|
|
<v-container class="pb-10 px-12" style="padding-top: 43px !important;"> |
|
|
|
<v-container class="pb-10 px-12" style="padding-top: 43px !important;"> |
|
|
|
<h1 class="mt-4 mb-4 text-center"> |
|
|
|
<h1 class="mt-4 mb-4 text-center"> |
|
|
|
<!-- {{ $t('activity.createProject') }}--> |
|
|
|
<!-- {{ $t('activity.createProject') }} --> |
|
|
|
Create Project |
|
|
|
Create Project |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<div class="mx-auto" style="width:350px"> |
|
|
|
<div class="mx-auto" style="width:350px"> |
|
|
@ -75,18 +90,17 @@ const createProject = async () => { |
|
|
|
class="nc-metadb-project-name" |
|
|
|
class="nc-metadb-project-name" |
|
|
|
label="Project name" |
|
|
|
label="Project name" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<!-- :rules="titleValidationRule"--> |
|
|
|
<!-- :rules="titleValidationRule" --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<v-container fluid> |
|
|
|
<v-container fluid> |
|
|
|
<v-row> |
|
|
|
<v-row> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-col cols="6"> |
|
|
|
<v-select |
|
|
|
<v-select |
|
|
|
|
|
|
|
v-model="projectDatasource.client" |
|
|
|
:items="clientTypes" |
|
|
|
:items="clientTypes" |
|
|
|
item-title="text" |
|
|
|
item-title="text" |
|
|
|
item-value="value" |
|
|
|
item-value="value" |
|
|
|
v-model="projectDatasource.client" |
|
|
|
|
|
|
|
class="nc-metadb-project-name" |
|
|
|
class="nc-metadb-project-name" |
|
|
|
label="Database client" |
|
|
|
label="Database client" |
|
|
|
/> |
|
|
|
/> |
|
|
@ -128,12 +142,28 @@ const createProject = async () => { |
|
|
|
label="Database name" |
|
|
|
label="Database name" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</v-col> |
|
|
|
</v-col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<v-col cols="6"> |
|
|
|
|
|
|
|
<v-text-field |
|
|
|
|
|
|
|
v-model="inflection.tableName" |
|
|
|
|
|
|
|
class="nc-metadb-project-name" |
|
|
|
|
|
|
|
type="password" |
|
|
|
|
|
|
|
label="Password" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</v-col> |
|
|
|
|
|
|
|
<v-col cols="6"> |
|
|
|
|
|
|
|
<v-text-field |
|
|
|
|
|
|
|
v-model="inflection.columnName" |
|
|
|
|
|
|
|
class="nc-metadb-project-name" |
|
|
|
|
|
|
|
label="Database name" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</v-col> |
|
|
|
</v-row> |
|
|
|
</v-row> |
|
|
|
</v-container> |
|
|
|
</v-container> |
|
|
|
|
|
|
|
|
|
|
|
<div class="text-center"> |
|
|
|
<div class="text-center"> |
|
|
|
<v-btn |
|
|
|
<v-btn |
|
|
|
class="mt-3" |
|
|
|
class="mt-3 mx-auto" |
|
|
|
large |
|
|
|
large |
|
|
|
:loading="loading" |
|
|
|
:loading="loading" |
|
|
|
color="primary" |
|
|
|
color="primary" |
|
|
@ -143,7 +173,7 @@ const createProject = async () => { |
|
|
|
mdi-rocket-launch-outline |
|
|
|
mdi-rocket-launch-outline |
|
|
|
</v-icon> |
|
|
|
</v-icon> |
|
|
|
<!-- Create --> |
|
|
|
<!-- Create --> |
|
|
|
<!-- <span class="mr-1">{{ // $t("general.create") }}</span>--> |
|
|
|
<!-- <span class="mr-1">{{ // $t("general.create") }}</span> --> |
|
|
|
<span class="mr-1"> Create project </span> |
|
|
|
<span class="mr-1"> Create project </span> |
|
|
|
</v-btn> |
|
|
|
</v-btn> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|