Browse Source

feat(nc-gui): integrate with groupby api in kanban

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
0d0366ce3e
  1. 32
      packages/nc-gui/composables/useKanbanViewData.ts

32
packages/nc-gui/composables/useKanbanViewData.ts

@ -80,23 +80,29 @@ export function useKanbanViewData(
formattedData.value = {} formattedData.value = {}
countByStack.value = {} countByStack.value = {}
await Promise.all( let res
groupingFieldColOptions.value.map(async (option: GroupingFieldColOptionsType) => {
const where =
option.title === 'uncategorized' ? `(${groupingField.value},is,null)` : `(${groupingField.value},eq,${option.title})`
const response = !isPublic.value if (isPublic.value) {
? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, { // TODO: we need a public API for groupedDataList instead of fetchSharedViewData
where, } else {
}) res = await api.dbViewRow.groupedDataList(
: await fetchSharedViewData({ where }) 'noco',
project.value.id!,
formattedData.value[option.title!] = formatData(response.list) meta.value!.id!,
countByStack.value[option.title!] = response.pageInfo.totalRows || 0 viewMeta.value!.id!,
}), groupingFieldColumn!.value!.id!,
{},
{},
) )
} }
for (const data of res) {
const key = data.key === 'null' ? 'uncategorized' : data.key
formattedData.value[key] = formatData(data.value.list)
countByStack.value[key] = data.value.pageInfo.totalRows || 0
}
}
async function loadMoreKanbanData(stackTitle: string, params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) { async function loadMoreKanbanData(stackTitle: string, params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) {
if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic.value) return if ((!project?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic.value) return
let where = `(${groupingField.value},eq,${stackTitle})` let where = `(${groupingField.value},eq,${stackTitle})`

Loading…
Cancel
Save