|
|
@ -33,6 +33,7 @@ export function useKanbanViewData( |
|
|
|
// ],
|
|
|
|
// ],
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
const formattedData = useState<Record<string, Row[]>>('KanbanFormattedData', () => ({})) |
|
|
|
const formattedData = useState<Record<string, Row[]>>('KanbanFormattedData', () => ({})) |
|
|
|
|
|
|
|
const countByStack = useState<Record<string, Row[]>>('KanbanCountByStack', () => ({})) |
|
|
|
const groupingField = useState<string>('KanbanGroupingField', () => '') |
|
|
|
const groupingField = useState<string>('KanbanGroupingField', () => '') |
|
|
|
const groupingFieldColumn = useState<Record<string, any>>('KanbanGroupingFieldColumn', () => ({})) |
|
|
|
const groupingFieldColumn = useState<Record<string, any>>('KanbanGroupingFieldColumn', () => ({})) |
|
|
|
|
|
|
|
|
|
|
@ -46,21 +47,30 @@ export function useKanbanViewData( |
|
|
|
async function loadKanbanData() { |
|
|
|
async function loadKanbanData() { |
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
// reset formattedData to avoid storing previous data after changing grouping field
|
|
|
|
// reset formattedData & countByStack to avoid storing previous data after changing grouping field
|
|
|
|
formattedData.value = {} |
|
|
|
formattedData.value = {} |
|
|
|
|
|
|
|
countByStack.value = {} |
|
|
|
|
|
|
|
|
|
|
|
await Promise.all( |
|
|
|
await Promise.all( |
|
|
|
groupingFieldColOptions.value.map(async (option) => { |
|
|
|
groupingFieldColOptions.value.map(async (option) => { |
|
|
|
let where = `(${groupingField.value},eq,${option.title})` |
|
|
|
const where = |
|
|
|
if (option.title === 'Uncategorized') { |
|
|
|
option.title === 'Uncategorized' ? `(${groupingField.value},is,null)` : `(${groupingField.value},eq,${option.title})` |
|
|
|
where = `(${groupingField.value},is,null)` |
|
|
|
|
|
|
|
} |
|
|
|
formattedData.value[option.title] = formatData( |
|
|
|
const response = await api.dbViewRow.list('noco', project.value.id!, meta!.value.id!, viewMeta!.value.id, { |
|
|
|
( |
|
|
|
...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }), |
|
|
|
await api.dbViewRow.list('noco', project.value.id!, meta!.value.id!, viewMeta!.value.id, { |
|
|
|
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), |
|
|
|
...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }), |
|
|
|
where, |
|
|
|
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), |
|
|
|
}) |
|
|
|
where, |
|
|
|
formattedData.value[option.title] = formatData(response.list) |
|
|
|
}) |
|
|
|
|
|
|
|
).list, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
countByStack.value[option.title] = |
|
|
|
|
|
|
|
( |
|
|
|
|
|
|
|
await api.dbViewRow.count('noco', project.value.id!, meta!.value.id!, viewMeta!.value.id, { |
|
|
|
|
|
|
|
where, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
).count || 0 |
|
|
|
}), |
|
|
|
}), |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -230,6 +240,7 @@ export function useKanbanViewData( |
|
|
|
updateKanbanMeta, |
|
|
|
updateKanbanMeta, |
|
|
|
kanbanMetaData, |
|
|
|
kanbanMetaData, |
|
|
|
formattedData, |
|
|
|
formattedData, |
|
|
|
|
|
|
|
countByStack, |
|
|
|
groupingField, |
|
|
|
groupingField, |
|
|
|
groupingFieldColOptions, |
|
|
|
groupingFieldColOptions, |
|
|
|
groupingFieldColumn, |
|
|
|
groupingFieldColumn, |
|
|
|