Browse Source

feat(nc-gui): kanban share view

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
586d7d1ff3
  1. 42
      packages/nc-gui/components/shared-view/Kanban.vue
  2. 34
      packages/nc-gui/pages/[projectType]/kanban/[viewId]/index.vue

42
packages/nc-gui/components/shared-view/Kanban.vue

@ -0,0 +1,42 @@
<script setup lang="ts">
import { message } from 'ant-design-vue'
import { ActiveViewInj, FieldsInj, IsPublicInj, MetaInj, ReadonlyInj, ReloadViewDataHookInj } from '#imports'
const { sharedView, meta, sorts, nestedFilters } = useSharedView()
const { signedIn } = useGlobal()
const { loadProject } = useProject(meta.value?.project_id)
const reloadEventHook = createEventHook<void>()
provide(ReloadViewDataHookInj, reloadEventHook)
provide(ReadonlyInj, true)
provide(MetaInj, meta)
provide(ActiveViewInj, sharedView)
provide(FieldsInj, ref(meta.value?.columns || []))
provide(IsPublicInj, ref(true))
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
if (signedIn.value) {
try {
await loadProject()
} catch (e: any) {
console.error(e)
message.error(await extractSdkResponseErrorMsg(e))
}
}
</script>
<template>
<div class="nc-container flex flex-col h-full mt-1.5 px-12">
<SmartsheetToolbar />
<SmartsheetKanban />
</div>
</template>

34
packages/nc-gui/pages/[projectType]/kanban/[viewId]/index.vue

@ -0,0 +1,34 @@
<script setup lang="ts">
import { message } from 'ant-design-vue'
definePageMeta({
public: true,
requiresAuth: false,
layout: 'shared-view',
})
const route = useRoute()
const { loadSharedView } = useSharedView()
const showPassword = ref(false)
try {
await loadSharedView(route.params.viewId as string)
} catch (e: any) {
if (e?.response?.status === 403) {
showPassword.value = true
} else {
message.error(await extractSdkResponseErrorMsg(e))
}
}
</script>
<template>
<NuxtLayout id="content" class="flex" name="shared-view">
<div v-if="showPassword">
<SharedViewAskPassword v-model="showPassword" />
</div>
<SharedViewKanban v-else />
</NuxtLayout>
</template>
Loading…
Cancel
Save