diff --git a/packages/nc-gui-v2/components/shared-view/AskPassword.vue b/packages/nc-gui-v2/components/shared-view/AskPassword.vue new file mode 100644 index 0000000000..8dc57a3e71 --- /dev/null +++ b/packages/nc-gui-v2/components/shared-view/AskPassword.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/packages/nc-gui-v2/components/shared-view/Grid.vue b/packages/nc-gui-v2/components/shared-view/Grid.vue new file mode 100644 index 0000000000..2c7eb73b56 --- /dev/null +++ b/packages/nc-gui-v2/components/shared-view/Grid.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/packages/nc-gui-v2/composables/useSharedView.ts b/packages/nc-gui-v2/composables/useSharedView.ts index 8b702bbb48..db8027ebc9 100644 --- a/packages/nc-gui-v2/composables/useSharedView.ts +++ b/packages/nc-gui-v2/composables/useSharedView.ts @@ -1,5 +1,5 @@ import type { ColumnType, ExportTypes, FilterType, PaginatedType, SortType, TableType, ViewType } from 'nocodb-sdk' -import { UITypes, isVirtualCol } from 'nocodb-sdk' +import { UITypes } from 'nocodb-sdk' import { useNuxtApp } from '#app' const nestedFilters = ref<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>([]) @@ -9,8 +9,8 @@ const sorts = ref([]) const password = ref() export function useSharedView() { - const meta = ref(() => sharedView.value?.model) - const columns = ref(() => sharedView.value?.model?.columns ?? []) + const meta = ref(sharedView.value?.model) + const columns = ref(sharedView.value?.model?.columns) const formColumns = computed( () => columns.value @@ -25,8 +25,14 @@ export function useSharedView() { const { $api } = useNuxtApp() const { setMeta } = useMetas() - const loadSharedView = async (viewId: string) => { - const viewMeta = await $api.public.sharedViewMetaGet(viewId) + const loadSharedView = async (viewId: string, localPassword: string | undefined = undefined) => { + const viewMeta = await $api.public.sharedViewMetaGet(viewId, { + headers: { + 'xc-password': localPassword ?? password.value, + }, + }) + + if (localPassword) password.value = localPassword sharedView.value = viewMeta meta.value = viewMeta.model @@ -42,11 +48,19 @@ export function useSharedView() { const page = paginationData.value.page || 1 const pageSize = paginationData.value.pageSize || 25 - const { data } = await $api.public.dataList(sharedView?.value?.uuid, { - offset: (page - 1) * pageSize, - filterArrJson: JSON.stringify(nestedFilters.value), - sortArrJson: JSON.stringify(sorts.value), - } as any) + const { data } = await $api.public.dataList( + sharedView?.value?.uuid, + { + offset: (page - 1) * pageSize, + filterArrJson: JSON.stringify(nestedFilters.value), + sortArrJson: JSON.stringify(sorts.value), + } as any, + { + headers: { + 'xc-password': password.value, + }, + }, + ) return data } @@ -67,7 +81,7 @@ export function useSharedView() { filterArrJson: JSON.stringify(nestedFilters.value), }, headers: { - 'xc-password': password, + 'xc-password': password.value, }, }) } diff --git a/packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue b/packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue index 035cdc8930..09668bcf02 100644 --- a/packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue +++ b/packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue @@ -1,8 +1,5 @@ - -