Browse Source

fix(nc-gui): add loadKanbanData in useViewData

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
5eb466276b
  1. 9
      packages/nc-gui/composables/useViewData.ts

9
packages/nc-gui/composables/useViewData.ts

@ -1,4 +1,4 @@
import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type { Api, ColumnType, FormType, GalleryType, KanbanType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue' import type { ComputedRef, Ref } from 'vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
@ -45,6 +45,7 @@ export function useViewData(
const _paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 }) const _paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 })
const aggCommentCount = ref<{ row_id: string; count: number }[]>([]) const aggCommentCount = ref<{ row_id: string; count: number }[]>([])
const galleryData = ref<GalleryType>() const galleryData = ref<GalleryType>()
const kanbanData = ref<KanbanType>()
const formColumnData = ref<FormType>() const formColumnData = ref<FormType>()
// todo: missing properties on FormType (success_msg, show_blank_form, // todo: missing properties on FormType (success_msg, show_blank_form,
const formViewData = ref<FormType & { success_msg?: string; show_blank_form?: boolean }>() const formViewData = ref<FormType & { success_msg?: string; show_blank_form?: boolean }>()
@ -182,6 +183,11 @@ export function useViewData(
galleryData.value = await $api.dbView.galleryRead(viewMeta.value.id) galleryData.value = await $api.dbView.galleryRead(viewMeta.value.id)
} }
async function loadKanbanData() {
if (!viewMeta?.value?.id) return
galleryData.value = await $api.dbView.kanbanRead(viewMeta.value.id)
}
async function insertRow(row: Record<string, any>, rowIndex = formattedData.value?.length) { async function insertRow(row: Record<string, any>, rowIndex = formattedData.value?.length) {
try { try {
const insertObj = meta?.value?.columns?.reduce((o: any, col) => { const insertObj = meta?.value?.columns?.reduce((o: any, col) => {
@ -408,5 +414,6 @@ export function useViewData(
aggCommentCount, aggCommentCount,
loadAggCommentsCount, loadAggCommentsCount,
removeLastEmptyRow, removeLastEmptyRow,
loadKanbanData,
} }
} }

Loading…
Cancel
Save