From 9b95cd6a2c68d7f34f3510f02b48da6b6acd587b Mon Sep 17 00:00:00 2001 From: Daniel Spaude Date: Mon, 13 Mar 2023 12:19:32 +0100 Subject: [PATCH] Revert "shared map view issue debugging - WIP" This reverts commit 19b14d9e4216b8eb4663fb7b4e1db8cc64776d17. --- .../nc-gui/composables/useMapViewDataStore.ts | 53 +++++++++---------- .../publicControllers/publicMeta.ctl.ts | 1 - 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/packages/nc-gui/composables/useMapViewDataStore.ts b/packages/nc-gui/composables/useMapViewDataStore.ts index f8ffde3a60..1ac4a6ecba 100644 --- a/packages/nc-gui/composables/useMapViewDataStore.ts +++ b/packages/nc-gui/composables/useMapViewDataStore.ts @@ -33,7 +33,7 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState( const formattedData = ref([]) - // const { api } = useApi() + const { api } = useApi() const { project } = useProject() @@ -61,43 +61,42 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState( })) async function syncCount() { - // const { count } = await $api.dbViewRow.count( - // NOCO, - // project?.value?.title as string, - // meta?.value?.id as string, - // viewMeta?.value?.id as string, - // ) - // paginationData.value.totalRows = count + const { count } = await $api.dbViewRow.count( + NOCO, + project?.value?.title as string, + meta?.value?.id as string, + viewMeta?.value?.id as string, + ) + paginationData.value.totalRows = count } async function loadMapMeta() { - alert('loadMapData') - // if (!viewMeta?.value?.id || !meta?.value?.columns) return - // mapMetaData.value = await $api.dbView.mapRead(viewMeta.value.id) - // geoDataFieldColumn.value = - // (meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {} + if (!viewMeta?.value?.id || !meta?.value?.columns) return + mapMetaData.value = await $api.dbView.mapRead(viewMeta.value.id) + geoDataFieldColumn.value = + (meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {} } async function loadMapData() { - // if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic?.value) return + if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic?.value) return - // const res = !isPublic.value - // ? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, { - // ...queryParams.value, - // ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), - // where: where?.value, - // }) - // : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) + const res = !isPublic.value + ? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, { + ...queryParams.value, + ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), + where: where?.value, + }) + : await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value }) - // formattedData.value = formatData(res.list) + formattedData.value = formatData(res.list) } async function updateMapMeta(updateObj: Partial) { - // if (!viewMeta?.value?.id || !isUIAllowed('xcDatatableEditable')) return - // await $api.dbView.mapUpdate(viewMeta.value.id, { - // ...mapMetaData.value, - // ...updateObj, - // }) + if (!viewMeta?.value?.id || !isUIAllowed('xcDatatableEditable')) return + await $api.dbView.mapUpdate(viewMeta.value.id, { + ...mapMetaData.value, + ...updateObj, + }) } const { getMeta } = useMetas() diff --git a/packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts b/packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts index 680107b06c..3517527884 100644 --- a/packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts +++ b/packages/nocodb/src/lib/controllers/publicControllers/publicMeta.ctl.ts @@ -4,7 +4,6 @@ import { publicMetaService } from '../../services'; import type { Request, Response } from 'express'; export async function viewMetaGet(req: Request, res: Response) { - console.log('FOO viewMetaGet'); res.json( await publicMetaService.viewMetaGet({ password: req.headers?.['xc-password'] as string,