|
|
@ -1,5 +1,6 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { onMounted } from '@vue/runtime-core' |
|
|
|
import { onMounted } from '@vue/runtime-core' |
|
|
|
|
|
|
|
import type { Form } from 'ant-design-vue' |
|
|
|
import { ref } from 'vue' |
|
|
|
import { ref } from 'vue' |
|
|
|
import { navigateTo, useNuxtApp } from '#app' |
|
|
|
import { navigateTo, useNuxtApp } from '#app' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
|
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' |
|
|
@ -10,7 +11,7 @@ const name = ref('') |
|
|
|
const loading = ref(false) |
|
|
|
const loading = ref(false) |
|
|
|
const valid = ref(false) |
|
|
|
const valid = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const { $api, $toast } = useNuxtApp() |
|
|
|
const { $api, $toast, $state } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
|
|
const nameValidationRules = [ |
|
|
|
const nameValidationRules = [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -38,10 +39,18 @@ const createProject = async () => { |
|
|
|
loading.value = false |
|
|
|
loading.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const input = ref() |
|
|
|
const form = ref<typeof Form>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// hide sidebar |
|
|
|
|
|
|
|
$state.sidebarOpen.value = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// select and focus title field on load |
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
input.value.input.focus() |
|
|
|
const input = form.value?.$el?.querySelector('input') |
|
|
|
|
|
|
|
if (input) { |
|
|
|
|
|
|
|
input.setSelectionRange(0, formState.title.length) |
|
|
|
|
|
|
|
input.focus() |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
@ -49,9 +58,9 @@ onMounted(() => { |
|
|
|
<a-card class="w-[500px] mx-auto !mt-100px shadow-md"> |
|
|
|
<a-card class="w-[500px] mx-auto !mt-100px shadow-md"> |
|
|
|
<h3 class="text-3xl text-center font-semibold mb-2">{{ $t('activity.createProject') }}</h3> |
|
|
|
<h3 class="text-3xl text-center font-semibold mb-2">{{ $t('activity.createProject') }}</h3> |
|
|
|
|
|
|
|
|
|
|
|
<a-form :model="formState" name="basic" layout="vertical" autocomplete="off" @submit="createProject"> |
|
|
|
<a-form ref="form" :model="formState" name="basic" layout="vertical" autocomplete="off" @submit="createProject"> |
|
|
|
<a-form-item :label="$t('labels.projName')" name="title" :rules="nameValidationRules" class="my-10 mx-10"> |
|
|
|
<a-form-item :label="$t('labels.projName')" name="title" :rules="nameValidationRules" class="my-10 mx-10"> |
|
|
|
<a-input ref="input" v-model:value="formState.title" name="title" class="nc-metadb-project-name" /> |
|
|
|
<a-input v-model:value="formState.title" name="title" class="nc-metadb-project-name" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<a-form-item style="text-align: center" class="mt-2"> |
|
|
|
<a-form-item style="text-align: center" class="mt-2"> |
|
|
|