geodata: switch info about record limits depending on the size of data in map view

This commit is contained in:
flisowna
2022-12-28 18:26:12 +01:00
parent d7cafa2ef9
commit f3430611f0
2 changed files with 23 additions and 16 deletions

View File

@@ -13,14 +13,12 @@ const formatData = (list: Row[]) =>
rowMeta: {},
}))
const { appInfo } = $(useGlobal())
const appInfoDefaultLimit = 1000
const paginationData = ref<PaginatedType>({ page: 1, pageSize: appInfoDefaultLimit })
const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
(
meta: Ref<TableType | MapType | undefined>,
meta: Ref<TableType | undefined>,
viewMeta: Ref<ViewType | MapType | undefined> | ComputedRef<(ViewType & { id: string }) | undefined>,
where?: ComputedRef<string | undefined>,
) => {
@@ -36,6 +34,10 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
const geoDataFieldColumn = ref<ColumnType | undefined>()
const view = inject(ActiveViewInj)
const { syncCount } = useViewData(meta, view!)
const queryParams = computed(() => ({
// offset: ((paginationData.value.page ?? 0) - 1) * (paginationData.value.pageSize ?? appInfoDefaultLimit),
limit: paginationData.value.pageSize ?? appInfoDefaultLimit,
@@ -54,12 +56,11 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
const res = await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!, {
...queryParams.value,
// ...params,
// ...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }),
// ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where: where?.value,
})
syncCount()
formattedData.value = formatData(res.list)
}
@@ -108,6 +109,8 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
oldRow: { ...insertedData },
})
syncCount()
return insertedData
} catch (error: any) {
message.error(await extractSdkResponseErrorMsg(error))