Browse Source

fix: shared gallery view

pull/6450/head
DarkPhoenix2704 1 year ago
parent
commit
317f09bcd2
  1. 4
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 2
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  3. 8
      packages/nc-gui/composables/useExpandedFormStore.ts
  4. 20
      packages/nocodb/src/services/public-datas.service.ts

4
packages/nc-gui/components/smartsheet/Gallery.vue

@ -124,10 +124,6 @@ const attachments = (record: any): Attachment[] => {
}
const expandForm = (row: RowType, state?: Record<string, any>) => {
if (isPublic.value) {
return
}
const rowId = extractPkFromRow(row.row, meta.value!.columns!)
if (rowId) {

2
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -316,7 +316,7 @@ useMenuCloseOnEsc(open)
<template #overlay>
<div class="p-4 pr-0 bg-white w-90 rounded-2xl nc-table-toolbar-menu" data-testid="nc-fields-menu" @click.stop>
<div
v-if="!filterQuery && (activeView?.type === ViewTypes.GALLERY || activeView?.type === ViewTypes.KANBAN)"
v-if="!filterQuery && !isPublic && (activeView?.type === ViewTypes.GALLERY || activeView?.type === ViewTypes.KANBAN)"
class="flex flex-col gap-y-2 pr-6 mb-6"
>
<div class="flex text-sm select-none">Select cover image field</div>

8
packages/nc-gui/composables/useExpandedFormStore.ts

@ -25,8 +25,6 @@ import {
import type { Row } from '#imports'
const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((meta: Ref<TableType>, row: Ref<Row>) => {
const { loadKanbanData, addOrEditStackRow } = useKanbanViewStoreOrThrow()
const { $e, $state, $api } = useNuxtApp()
const { api, isLoading: isCommentsLoading, error: commentsError } = useApi()
@ -181,6 +179,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
fn: async (rowData: any) => {
await $api.dbTableRow.create('noco', project.value.id as string, meta.value.id, { ...pkData, ...rowData })
if (activeView.value?.type === ViewTypes.KANBAN) {
const { loadKanbanData } = useKanbanViewStoreOrThrow()
await loadKanbanData()
}
reloadTrigger?.trigger()
@ -200,6 +199,8 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
throw new Error(res.message)
}
if (activeView.value?.type === ViewTypes.KANBAN) {
const { loadKanbanData } = useKanbanViewStoreOrThrow()
await loadKanbanData()
}
reloadTrigger?.trigger()
@ -234,6 +235,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
fn: async (id: string, data: Record<string, any>) => {
await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data)
if (activeView.value?.type === ViewTypes.KANBAN) {
const { loadKanbanData } = useKanbanViewStoreOrThrow()
await loadKanbanData()
}
reloadTrigger?.trigger()
@ -244,6 +246,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
fn: async (id: string, data: Record<string, any>) => {
await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data)
if (activeView.value?.type === ViewTypes.KANBAN) {
const { loadKanbanData } = useKanbanViewStoreOrThrow()
await loadKanbanData()
}
reloadTrigger?.trigger()
@ -265,6 +268,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
}
if (activeView.value?.type === ViewTypes.KANBAN) {
const { addOrEditStackRow } = useKanbanViewStoreOrThrow()
addOrEditStackRow(row.value, isNewRow)
}

20
packages/nocodb/src/services/public-datas.service.ts

@ -27,7 +27,8 @@ export class PublicDatasService {
password?: string;
query: any;
}) {
const view = await View.getByUUID(param.sharedViewUuid);
const { sharedViewUuid, password, query = {} } = param;
const view = await View.getByUUID(sharedViewUuid);
if (!view) NcError.notFound('Not found');
if (
@ -39,7 +40,7 @@ export class PublicDatasService {
NcError.notFound('Not found');
}
if (view.password && view.password !== param.password) {
if (view.password && view.password !== password) {
return NcError.forbidden(ErrorMessages.INVALID_SHARED_VIEW_PASSWORD);
}
@ -55,24 +56,23 @@ export class PublicDatasService {
dbDriver: await NcConnectionMgrv2.get(base),
});
const listArgs: any = { ...param.query };
const { ast, dependencyFields } = await getAst({
model,
query: {},
view,
});
const listArgs: any = { ...query, ...dependencyFields };
try {
listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
} catch (e) {}
try {
listArgs.sortArr = JSON.parse(listArgs.sortArrJson);
} catch (e) {}
let data = [];
let count = 0;
try {
const { ast } = await getAst({
query: param.query,
model,
view,
});
data = await nocoExecute(
ast,
await baseModel.list(listArgs),

Loading…
Cancel
Save