Browse Source

WIP info button on toolbar about record limits in map view - WIP

pull/4723/head
flisowna 2 years ago
parent
commit
d7cafa2ef9
  1. 1
      packages/nc-gui/components.d.ts
  2. 12
      packages/nc-gui/components/smartsheet/toolbar/MapRowsLimits.vue
  3. 23
      packages/nc-gui/composables/useSmartsheetStore.ts

1
packages/nc-gui/components.d.ts vendored

@ -202,6 +202,7 @@ declare module '@vue/runtime-core' {
MdiLogout: typeof import('~icons/mdi/logout')['default']
MdiMagnify: typeof import('~icons/mdi/magnify')['default']
MdiMapMarker: typeof import('~icons/mdi/map-marker')['default']
MdiMapMarkerAlert: typeof import('~icons/mdi/map-marker-alert')['default']
MdiMenu: typeof import('~icons/mdi/menu')['default']
MdiMenuDown: typeof import('~icons/mdi/menu-down')['default']
MdiMenuIcon: typeof import('~icons/mdi/menu-icon')['default']

12
packages/nc-gui/components/smartsheet/toolbar/MapRowsLimits.vue

@ -2,8 +2,14 @@
// import type { MapType } from 'nocodb-sdk'
// import { UITypes } from 'nocodb-sdk'
// import type { SelectProps } from 'ant-design-vue'
import { PaginationDataInj, computed, inject } from '#imports'
const { count } = useSmartsheetStoreOrThrow()
import { ActiveViewInj, MetaInj, inject, useViewData } from '#imports'
// const { totalNumberOfTableRows } = useSmartsheetStoreOrThrow()
const meta = inject(MetaInj)
const view = inject(ActiveViewInj)
const FOO = useViewData(meta!, view!)
</script>
<template>
@ -11,7 +17,7 @@ const { count } = useSmartsheetStoreOrThrow()
<template #title> You're getting close to the limit. The limit of markers in a Map View is 1000 records. </template>
<div class="nc-warning-info flex min-w-32px h-32px items-center gap-1 px-2">
<div>{{ count }} records</div>
<div>{{ FOO.paginationData.value.totalRows }} records</div>
<mdi-map-marker-alert />
</div>
</a-tooltip>

23
packages/nc-gui/composables/useSmartsheetStore.ts

@ -1,7 +1,7 @@
import { ViewTypes } from 'nocodb-sdk'
import type { FilterType, KanbanType, SortType, TableType, ViewType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { computed, ref, unref, useEventBus, useFieldQuery, useInjectionState, useNuxtApp, useProject } from '#imports'
import { NOCO, computed, ref, unref, useEventBus, useFieldQuery, useInjectionState, useNuxtApp, useProject } from '#imports'
import type { SmartsheetStoreEvents } from '~/lib'
const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
@ -12,9 +12,22 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
initialSorts?: Ref<SortType[]>,
initialFilters?: Ref<FilterType[]>,
) => {
const paginatedData = inject(PaginationDataInj)!
// const paginatedData = inject(PaginationDataInj)!
// const { paginationData } = useViewData(meta, view)
// debugger
const { $api } = useNuxtApp()
const { sqlUis } = useProject()
const { sqlUis, project } = useProject()
const totalNumberOfTableRows = ref(async () => {
const { count } = await $api.dbViewRow.count(
NOCO,
project?.value?.title as string,
meta?.value?.id as string,
meta?.value?.id as string,
)
return count
})
const sqlUi = ref(meta.value?.base_id ? sqlUis.value[meta.value?.base_id] : Object.values(sqlUis.value)[0])
@ -25,7 +38,7 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
const eventBus = useEventBus<SmartsheetStoreEvents>(Symbol('SmartsheetStore'))
// getters
const count = computed(() => paginatedData.value?.totalRows ?? Infinity)
// const count = computed(() => paginatedData.value?.totalRows ?? Infinity)
const isLocked = computed(() => view.value?.lock_type === 'locked')
const isPkAvail = computed(() => (meta.value as TableType)?.columns?.some((c) => c.pk))
const isGrid = computed(() => view.value?.type === ViewTypes.GRID)
@ -55,7 +68,7 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(
const nestedFilters = ref<FilterType[]>(unref(initialFilters) ?? [])
return {
count,
totalNumberOfTableRows,
view,
meta,
isLocked,

Loading…
Cancel
Save