Browse Source

refactor/gui-v2 added allowcsv flag to shared grid view

pull/3083/head
Muhammed Mustafa 2 years ago
parent
commit
25ddcb70e8
  1. 4
      packages/nc-gui-v2/components/smartsheet/Toolbar.vue
  2. 4
      packages/nc-gui-v2/composables/useSharedView.ts

4
packages/nc-gui-v2/components/smartsheet/Toolbar.vue

@ -3,6 +3,7 @@ import { useSmartsheetStoreOrThrow } from '~/composables'
import { IsPublicInj } from '~/context' import { IsPublicInj } from '~/context'
const { isGrid, isForm, isGallery } = useSmartsheetStoreOrThrow() const { isGrid, isForm, isGallery } = useSmartsheetStoreOrThrow()
const { allowCSVDownload } = useSharedView()
const isPublic = inject(IsPublicInj, ref(false)) const isPublic = inject(IsPublicInj, ref(false))
</script> </script>
@ -16,7 +17,8 @@ const isPublic = inject(IsPublicInj, ref(false))
<SmartsheetToolbarShareView v-if="(isForm || isGrid) && !isPublic" /> <SmartsheetToolbarShareView v-if="(isForm || isGrid) && !isPublic" />
<SmartsheetToolbarMoreActions v-if="isGrid" /> <SmartsheetToolbarMoreActions v-if="(isGrid && !isPublic) || (isGrid && isPublic && allowCSVDownload)" />
<div class="flex-1" /> <div class="flex-1" />
<SmartsheetToolbarSearchData v-if="isGrid || isGallery" class="shrink mr-2" /> <SmartsheetToolbarSearchData v-if="isGrid || isGallery" class="shrink mr-2" />
</div> </div>

4
packages/nc-gui-v2/composables/useSharedView.ts

@ -7,6 +7,7 @@ const paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 })
const sharedView = ref<ViewType>() const sharedView = ref<ViewType>()
const sorts = ref<SortType[]>([]) const sorts = ref<SortType[]>([])
const password = ref<string | undefined>() const password = ref<string | undefined>()
const allowCSVDownload = ref<boolean>(false)
export function useSharedView() { export function useSharedView() {
const meta = ref<TableType>(sharedView.value?.model) const meta = ref<TableType>(sharedView.value?.model)
@ -32,6 +33,8 @@ export function useSharedView() {
}, },
}) })
allowCSVDownload.value = JSON.parse(viewMeta.meta).allowCSVDownload
if (localPassword) password.value = localPassword if (localPassword) password.value = localPassword
sharedView.value = viewMeta sharedView.value = viewMeta
@ -97,5 +100,6 @@ export function useSharedView() {
sorts, sorts,
exportFile, exportFile,
formColumns, formColumns,
allowCSVDownload,
} }
} }

Loading…
Cancel
Save