|
|
@ -1,6 +1,5 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { Form } from 'ant-design-vue' |
|
|
|
import type { Form } from 'ant-design-vue' |
|
|
|
import type { ProjectType } from 'nocodb-sdk' |
|
|
|
|
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { message } from 'ant-design-vue' |
|
|
|
import { |
|
|
|
import { |
|
|
|
extractSdkResponseErrorMsg, |
|
|
|
extractSdkResponseErrorMsg, |
|
|
@ -15,12 +14,16 @@ import { |
|
|
|
useSidebar, |
|
|
|
useSidebar, |
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const { api, isLoading } = useApi() |
|
|
|
const { isLoading } = useApi() |
|
|
|
|
|
|
|
|
|
|
|
useSidebar({ hasSidebar: false }) |
|
|
|
useSidebar({ hasSidebar: false }) |
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute() |
|
|
|
const route = useRoute() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { project, loadProject, updateProject } = useProject(route.params.id as string) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await loadProject() |
|
|
|
|
|
|
|
|
|
|
|
const nameValidationRules = [ |
|
|
|
const nameValidationRules = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
@ -35,18 +38,9 @@ const formState = reactive({ |
|
|
|
title: '', |
|
|
|
title: '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const getProject = async () => { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
const result: ProjectType = await api.project.read(route.params.id as string) |
|
|
|
|
|
|
|
formState.title = result.title as string |
|
|
|
|
|
|
|
} catch (e: any) { |
|
|
|
|
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const renameProject = async () => { |
|
|
|
const renameProject = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await api.project.update(route.params.id as string, formState) |
|
|
|
await updateProject(formState) |
|
|
|
|
|
|
|
|
|
|
|
navigateTo(`/nc/${route.params.id}`) |
|
|
|
navigateTo(`/nc/${route.params.id}`) |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
@ -56,6 +50,7 @@ const renameProject = async () => { |
|
|
|
|
|
|
|
|
|
|
|
// select and focus title field on load |
|
|
|
// select and focus title field on load |
|
|
|
onMounted(async () => { |
|
|
|
onMounted(async () => { |
|
|
|
|
|
|
|
formState.title = project.value.title as string |
|
|
|
await nextTick(() => { |
|
|
|
await nextTick(() => { |
|
|
|
// todo: replace setTimeout and follow better approach |
|
|
|
// todo: replace setTimeout and follow better approach |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
@ -67,8 +62,6 @@ onMounted(async () => { |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
await getProject() |
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|