Browse Source

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

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

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

@ -80,21 +80,27 @@ export function useKanbanViewData(
formattedData.value = {} formattedData.value = {}
countByStack.value = {} countByStack.value = {}
await Promise.all( let res
groupingFieldColOptions.value.map(async (option: GroupingFieldColOptionsType) => {
const where = if (isPublic.value) {
option.title === 'uncategorized' ? `(${groupingField.value},is,null)` : `(${groupingField.value},eq,${option.title})` // TODO: we need a public API for groupedDataList instead of fetchSharedViewData
} else {
const response = !isPublic.value res = await api.dbViewRow.groupedDataList(
? await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, { 'noco',
where, project.value.id!,
}) meta.value!.id!,
: await fetchSharedViewData({ where }) viewMeta.value!.id!,
groupingFieldColumn!.value!.id!,
formattedData.value[option.title!] = formatData(response.list) {},
countByStack.value[option.title!] = response.pageInfo.totalRows || 0 {},
}), )
) }
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] = {}) {

Loading…
Cancel
Save