From 5006f18f9cde97b6bf64391ce7412032778090c4 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 21 Jul 2022 11:47:50 +0530 Subject: [PATCH] fix(gui-v2): project create/update/list corrections Signed-off-by: Pranav C --- packages/nc-gui-v2/pages/index/index.vue | 38 +++++++++++++------ .../nc-gui-v2/pages/project/index/[id].vue | 10 +++-- .../nc-gui-v2/pages/project/index/create.vue | 12 ++++-- packages/nc-gui-v2/plugins/api.ts | 4 +- 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/packages/nc-gui-v2/pages/index/index.vue b/packages/nc-gui-v2/pages/index/index.vue index 7d353de95e..ca01d3bd8e 100644 --- a/packages/nc-gui-v2/pages/index/index.vue +++ b/packages/nc-gui-v2/pages/index/index.vue @@ -2,6 +2,7 @@ import { Modal } from 'ant-design-vue' import type { ProjectType } from 'nocodb-sdk' import { useToast } from 'vue-toastification' +import { navigateTo } from '#app' import { computed, onMounted } from '#imports' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' @@ -12,7 +13,7 @@ import MdiMenuDown from '~icons/mdi/menu-down' import MdiPlus from '~icons/mdi/plus' import MdiDatabaseOutline from '~icons/mdi/database-outline' -const { $api } = useNuxtApp() +const { $api, $state } = useNuxtApp() const toast = useToast() const filterQuery = ref('') @@ -34,15 +35,14 @@ const filteredProjects = computed(() => { const deleteProject = (project: ProjectType) => { Modal.confirm({ - title: 'Do you want to delete the project?', - content: 'Some descriptions', + title: `Do you want to delete '${project.title}' project?`, okText: 'Yes', okType: 'danger', cancelText: 'No', async onOk() { try { await $api.project.delete(project.id as string) - projects.splice(projects.indexOf(project), 1) + projects.value.splice(projects.value.indexOf(project), 1) } catch (e) { toast.error(await extractSdkResponseErrorMsg(e)) } @@ -53,6 +53,9 @@ const deleteProject = (project: ProjectType) => { onMounted(() => { loadProjects() }) + +// hide sidebar +$state.sidebarOpen.value = false