Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: base issues

mertmitccbd648e4a38
diff --git a/packages/nc-gui/components/account/ExternalIntegrations.vue b/packages/nc-gui/components/account/ExternalIntegrations.vue
deleted file mode 100644
index 089a9f45bc..0000000000
--- a/packages/nc-gui/components/account/ExternalIntegrations.vue
+++ /dev/null
@@ -1,367 +0,0 @@
-<script lang="ts" setup>
-import dayjs from 'dayjs'
-
-const { t } = useI18n()
-const authStore = useOAuthAuthorizations()
-const { getPossibleAttachmentSrc } = useAttachment()
-const { $api } = useNuxtApp()
-const { getBaseUrl } = useGlobal()
-
-const workspaceMap = ref<Record<string, any>>({})
-const baseMap = ref<Record<string, any>>({})
-
-const {
- sorts,
- sortDirection,
- loadSorts,
- handleGetSortedData,
- saveOrUpdate: saveOrUpdateSort,
-} = useUserSorts('OAuthAuthorization')
-
-const orderBy = computed<Record<string, SordDirectionType>>({
- get: () => {
- return sortDirection.value
- },
- set: (value: Record<string, SordDirectionType>) => {
- if (Object.keys(value).length === 0) {
- saveOrUpdateSort({})
- return
- }
-
- const entries = Object.entries(value)
- if (entries.length > 0) {
- const [field, direction] = entries[0]
- saveOrUpdateSort({
- field,
- direction,
- })
- }
- },
-})
-
-const searchText = ref('')
-
-const filteredAuthorizations = computed(() => {
- if (!searchText.value) return authStore.authorizations
-
- const search = searchText.value.toLowerCase()
- return authStore.authorizations.filter((auth) => {
- return auth.client_name?.toLowerCase().includes(search) || auth.client_description?.toLowerCase().includes(search)
- })
-})
-
-const sortedAuthorizations = computed(() => handleGetSortedData(filteredAuthorizations.value, sorts.value))
-
-const isRevokeModalOpen = ref(false)
-const selectedAuthorization = ref<any>(null)
-
-const openRevokeModal = (authorization: any) => {
- selectedAuthorization.value = authorization
- isRevokeModalOpen.value = true
-}
-
-const handleRevoked = () => {
- isRevokeModalOpen.value = false
- selectedAuthorization.value = null
-}
-
-const columns = [
- {
- key: 'application',
- title: 'Application',
- name: 'Application',
- minWidth: 200,
- padding: '12px 24px',
- showOrderBy: true,
- dataIndex: 'client_name',
- },
- {
- key: 'access',
- title: 'Access',
- width: 250,
- minWidth: 250,
- },
- {
- key: 'created_at',
- title: 'Authorized',
- width: 150,
- minWidth: 150,
- showOrderBy: true,
- dataIndex: 'created_at',
- },
- {
- key: 'action',
- title: 'Actions',
- width: 80,
- minWidth: 80,
- justify: 'justify-end',
- align: 'center',
- },
-] as NcTableColumnProps[]
-
-const getFormattedDate = (date: string) => {
- if (!date) return 'Never'
- return dayjs(date).format('D MMM YYYY')
-}
-
-const getRelativeTime = (date: string) => {
- if (!date) return 'Never'
- const now = dayjs()
- const then = dayjs(date)
- const diffMonths = now.diff(then, 'month')
- const diffYears = now.diff(then, 'year')
-
- if (diffYears >= 2) return `within the last ${diffYears} years`
- if (diffYears === 1) return 'within the last year'
- if (diffMonths >= 7) return `within the last ${diffMonths} months`
- if (diffMonths >= 2) return `within the last ${diffMonths} months`
- return 'recently'
-}
-
-const getHostname = (url: string) => {
- try {
- return new URL(url).hostname
- } catch {
- return url
- }
-}
-
-const loadWorkspacesAndBases = async () => {
- try {
- if (isEeUI) {
- // Load workspaces in EE
- const workspaces = await $api.workspace.list()
- workspaceMap.value = workspaces.list.reduce((acc, ws) => {
- acc[ws.id] = ws
- return acc
- }, {})
-
- // Load bases for each workspace in EE
- for (const ws of workspaces.list) {
- try {
- const { list } = await $api.workspaceBase.list(ws.id, {
- baseURL: getBaseUrl(ws.id),
- })
-
- if (list && list.length > 0) {
- list.forEach((base) => {
- baseMap.value[base.id] = base
- })
- }
- } catch (e) {
- console.error(`Failed to load bases for workspace ${ws.id}:`, e)
- }
- }
- } else {
- // Load bases in CE
- const { list } = await $api.base.list()
- if (list && list.length > 0) {
- baseMap.value = list.reduce((acc, base) => {
- acc[base.id] = base
- return acc
- }, {})
- }
- }
- } catch (e) {
- console.error('Failed to load workspaces/bases:', e)
- }
-}
-
-onMounted(async () => {
- loadSorts()
- await authStore.loadAuthorizations()
- await loadWorkspacesAndBases()
-})
-</script>
-
-<template>
- <div class="flex flex-col">
- <NcPageHeader>
- <template #icon>
- <GeneralIcon icon="ncSliders" class="flex-none h-5 w-5" />
- </template>
- <template #title>
- <span data-rec="true">
- {{ t('title.externalIntegrations') }}
- </span>
- </template>
- </NcPageHeader>
- <div class="nc-content-max-w p-6 flex flex-col gap-6">
- <div class="max-w-280 mx-auto w-full flex flex-col" style="height: calc(100vh - 200px)">
- <div class="flex gap-4 items-baseline justify-between">
- <h6 class="text-xl text-left text-nc-content-gray font-bold my-0" data-rec="true">
- {{ t('title.externalIntegrations') }}
- </h6>
- </div>
-
- <div class="text-nc-content-gray-subtle2 leading-5 mt-2">
- You have granted <span class="font-semibold">{{ authStore.authorizations.length }} applications</span> access to your
- account.
- </div>
-
- <div v-if="authStore.isLoading" class="flex items-center justify-center h-64">
- <GeneralLoader size="large" />
- </div>
-
- <div v-else-if="authStore.authorizations.length === 0" class="flex flex-col items-center justify-center h-64 gap-4">
- <GeneralIcon icon="ncSliders" class="text-nc-content-gray-subtle2 !h-16 !w-16" />
- <div class="text-center">
- <div class="text-lg font-semibold text-nc-content-gray-emphasis">No authorized applications</div>
- <div class="text-sm text-nc-content-gray-subtle mt-1">You haven't authorized any applications yet</div>
- </div>
- </div>
-
- <div v-else class="flex-1 overflow-hidden mt-5">
- <NcTable
- v-model:order-by="orderBy"
- :columns="columns"
- header-row-height="44px"
- row-height="64px"
- :data="sortedAuthorizations"
- class="h-full"
- body-row-class-name="nc-oauth-authorization-item group no-border-last"
- >
- <template #bodyCell="{ column, record: authorization }">
- <template v-if="column.key === 'application'">
- <div class="flex items-center gap-3">
- <CellAttachmentPreviewImage
- v-if="authorization.logo_uri"
- :srcs="getPossibleAttachmentSrc(authorization.logo_uri)"
- class="!object-contain !w-10 !h-10 !rounded-lg"
- :is-cell-preview="false"
- />
- <div v-else class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0">
- <span class="text-primary text-lg font-semibold">{{ authorization.client_name?.charAt(0) || 'A' }}</span>
- </div>
- <div class="flex flex-col min-w-0">
- <div class="text-nc-content-gray-extreme font-semibold text-sm truncate">
- {{ authorization.client_name }}
- </div>
- <div class="text-nc-content-gray-subtle text-xs truncate">
- <template v-if="authorization.last_used_at"> {{ getRelativeTime(authorization.last_used_at) }} Β· </template>
- Owned by
- <a
- v-if="authorization.client_uri"
- :href="authorization.client_uri"
- target="_blank"
- rel="noopener noreferrer"
- class="text-primary hover:underline"
- @click.stop
- >
- {{ getHostname(authorization.client_uri) }}
- </a>
- <span v-else>{{ authorization.client_id }}</span>
- </div>
- </div>
- </div>
- </template>
-
- <template v-if="column.key === 'access'">
- <div class="flex flex-col gap-1.5">
- <!-- Workspace -->
- <div
- v-if="authorization.granted_resources?.workspace_id"
- class="flex items-center gap-2 text-nc-content-gray-subtle text-xs"
- >
- <template v-if="workspaceMap[authorization.granted_resources.workspace_id]">
- <GeneralWorkspaceIcon
- :workspace="workspaceMap[authorization.granted_resources.workspace_id]"
- size="small"
- class="flex-shrink-0"
- />
- <NcTooltip class="truncate max-w-[150px]">
- <template #title>
- {{ workspaceMap[authorization.granted_resources.workspace_id].title }}
- </template>
- <span class="truncate">
- {{ workspaceMap[authorization.granted_resources.workspace_id].title }}
- </span>
- </NcTooltip>
- </template>
- <template v-else>
- <GeneralIcon icon="ncWorkspace" class="!h-3.5 !w-3.5 flex-shrink-0 text-nc-content-gray-disabled" />
- <span class="text-nc-content-gray-disabled italic">Workspace (No access)</span>
- </template>
- </div>
-
- <!-- Base -->
- <div
- v-if="authorization.granted_resources?.base_id"
- class="flex items-center gap-2 text-nc-content-gray-subtle text-xs"
- >
- <template v-if="baseMap[authorization.granted_resources.base_id]">
- <GeneralProjectIcon
- :color="parseProp(baseMap[authorization.granted_resources.base_id]?.meta).iconColor"
- size="small"
- class="flex-shrink-0"
- />
- <NcTooltip class="truncate max-w-[150px]">
- <template #title>
- {{ baseMap[authorization.granted_resources.base_id].title }}
- </template>
- <span class="truncate">
- {{ baseMap[authorization.granted_resources.base_id].title }}
- </span>
- </NcTooltip>
- </template>
- <template v-else>
- <GeneralIcon icon="ncDatabase" class="!h-3.5 !w-3.5 flex-shrink-0 text-nc-content-gray-disabled" />
- <span class="text-nc-content-gray-disabled italic">Base (No access)</span>
- </template>
- </div>
-
- <!-- All resources -->
- <div
- v-if="!authorization.granted_resources?.workspace_id && !authorization.granted_resources?.base_id"
- class="text-nc-content-gray-subtle text-xs"
- >
- All resources
- </div>
- </div>
- </template>
-
- <template v-if="column.key === 'created_at'">
- <div class="text-nc-content-gray-subtle text-sm">
- {{ getFormattedDate(authorization.created_at) }}
- </div>
- </template>
-
- <template v-if="column.key === 'action'">
- <NcDropdown>
- <NcButton type="secondary" class="!hidden !group-hover:block" size="small" @click.stop>
- <GeneralIcon icon="threeDotVertical" />
- </NcButton>
-
- <template #overlay>
- <NcMenu variant="small">
- <NcMenuItem danger @click="openRevokeModal(authorization)">
- <GeneralIcon icon="delete" />
- {{ t('general.revoke') }}
- </NcMenuItem>
- </NcMenu>
- </template>
- </NcDropdown>
- </template>
- </template>
- </NcTable>
- </div>
- </div>
- </div>
-
- <DlgOAuthAuthorizationRevoke
- v-if="selectedAuthorization"
- v-model="isRevokeModalOpen"
- :authorization="selectedAuthorization"
- @revoked="handleRevoked"
- />
- </div>
-</template>
-
-<style scoped lang="scss">
-.line-clamp-2 {
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- overflow: hidden;
-}
-</style>
diff --git a/packages/nc-gui/components/account/mcp/index.vue b/packages/nc-gui/components/account/mcp/index.vue
index 13e101252a..ac9eff3acb 100644
--- a/packages/nc-gui/components/account/mcp/index.vue
+++ b/packages/nc-gui/components/account/mcp/index.vue
@@ -43,12 +43,16 @@ const columns = [
showOrderBy: true,
dataIndex: 'title',
},
- {
- key: 'workspace',
- title: t('objects.workspace'),
- minWidth: 200,
- showOrderBy: false,
- },
+ ...(isEeUI
+ ? [
+ {
+ key: 'workspace',
+ title: t('objects.workspace'),
+ minWidth: 200,
+ showOrderBy: false,
+ },
+ ]
+ : []),
{
key: 'base',
title: t('objects.project'),
diff --git a/packages/nc-gui/components/dashboard/settings/base/MCP/Modal.vue b/packages/nc-gui/components/dashboard/settings/base/MCP/Modal.vue
index 2ac97c0b44..f01cd6d827 100644
--- a/packages/nc-gui/components/dashboard/settings/base/MCP/Modal.vue
+++ b/packages/nc-gui/components/dashboard/settings/base/MCP/Modal.vue
@@ -62,7 +62,9 @@ const serverName = computed(() => {
let title = ''
if (props.showWorkspaceBaseInfo) {
- title = `NocoDB - ${token.value.workspace?.title || 'Workspace'} - ${token.value.base?.title || 'Base'}`
+ title = isEeUI
+ ? `NocoDB ${token.value.workspace?.title || 'Workspace'} - ${token.value.base?.title || 'Base'}`
+ : `NocoDB - ${token.value.base?.title || 'Base'}`
} else {
title = `NocoDB Base - ${openedProject.value?.title}`
}
@@ -123,7 +125,7 @@ const code = computed(
<!-- Workspace/Base Info (for account-level view) -->
<div v-if="showWorkspaceBaseInfo" class="flex flex-col gap-2 p-4 bg-nc-bg-gray-extralight rounded-lg">
- <div class="flex items-center gap-2">
+ <div v-if="isEeUI" class="flex items-center gap-2">
<span class="text-sm font-semibold text-nc-content-gray-subtle">{{ $t('objects.workspace') }}:</span>
<span class="text-sm text-nc-content-gray-subtle2">{{ token.workspace?.title || '-' }}</span>
</div>
diff --git a/packages/nc-gui/components/smartsheet/grid/Aggregation.vue b/packages/nc-gui/components/smartsheet/grid/Aggregation.vue
index b4f1885953..6963498b17 100644
--- a/packages/nc-gui/components/smartsheet/grid/Aggregation.vue
+++ b/packages/nc-gui/components/smartsheet/grid/Aggregation.vue
@@ -1,11 +1,169 @@
<script setup lang="ts">
-defineProps<{
- group: any
- maxDepth: any
- scrollLeft: number
+import { UITypes } from 'nocodb-sdk'
+import type { Group } from '~/lib/types'
+
+const props = defineProps<{
+ group: Group
+ maxDepth: number
+ depth: number
+ scrollLeft?: number
}>()
+
+const group = toRef(props, 'group')
+
+const scrollLeft = toRef(props, 'scrollLeft')
+
+const isLocked = inject(IsLockedInj, ref(false))
+
+const { metas } = useMetas()
+
+const baseStore = useBase()
+
+const { isMysql, isPg } = baseStore
+
+const { meta, isViewOperationsAllowed } = useSmartsheetStoreOrThrow()
+
+const getAddnlMargin = (depth: number) => {
+ if (props.maxDepth === 3) {
+ switch (depth) {
+ case 3:
+ return 17
+ case 2:
+ return 0
+ case 1:
+ return 10
+ default:
+ return 18
+ }
+ } else if (props.maxDepth === 2) {
+ switch (depth) {
+ case 1:
+ return 0
+ default:
+ return 10
+ }
+ }
+}
+
+const { visibleFieldsComputed, updateAggregate, getAggregations } = useViewAggregateOrThrow()
</script>
<template>
- <div></div>
+ <template v-for="({ field, width, column, value }, index) in visibleFieldsComputed" :key="index">
+ <div
+ v-if="index === 0 && scrollLeft > 30"
+ :style="`width: ${getAddnlMargin(depth, true)}px;min-width: ${getAddnlMargin(depth, true)}px;max-width: ${getAddnlMargin(
+ depth,
+ true,
+ )}px`"
+ ></div>
+ <NcDropdown
+ v-if="field && column?.id"
+ :disabled="[UITypes.SpecificDBType, UITypes.ForeignKey, UITypes.Button].includes(column?.uidt!) || isLocked || !isViewOperationsAllowed"
+ overlay-class-name="max-h-64 relative scroll-container nc-scrollbar-thin overflow-auto"
+ @click.stop
+ >
+ <div
+ class="flex items-center overflow-x-hidden justify-end group-aggregation text-nc-content-gray-muted transition-all transition-linear px-3 py-2"
+ :class="{
+ 'cursor-pointer': !isLocked && isViewOperationsAllowed,
+ 'hover:bg-nc-bg-gray-light': isViewOperationsAllowed,
+ 'cursor-auto': !isViewOperationsAllowed,
+ }"
+ :style="{
+ 'min-width': width,
+ 'max-width': width,
+ 'width': width,
+ }"
+ >
+ <template v-if="![UITypes.SpecificDBType, UITypes.ForeignKey, UITypes.Button].includes(column?.uidt!)">
+ <div
+ v-if="field?.aggregation === 'none' || field?.aggregation === null"
+ class="text-nc-content-gray-muted opacity-0 transition"
+ :class="{
+ 'group-hover-aggregation': !isLocked && isViewOperationsAllowed,
+ }"
+ >
+ <GeneralIcon class="text-nc-content-gray-muted" icon="arrowDown" />
+ <span class="text-[10px] font-semibold"> Summary </span>
+ </div>
+
+ <NcTooltip
+ v-else-if="value !== undefined"
+ show-on-truncate-only
+ :style="{
+ maxWidth: `${field?.width}px`,
+ }"
+ >
+ <div class="flex gap-2 truncate text-nowrap overflow-hidden items-center">
+ <span class="text-nc-content-gray-muted text-[12px] leading-4">
+ {{ $t(`aggregation.${field.aggregation}`).replace('Percent ', '') }}
+ </span>
+
+ <span class="text-nc-content-gray-subtle2 font-semibold text-[12px]">
+ {{
+ getFormattedAggrationValue(field.aggregation, group.aggregations[column.title], column, [], {
+ meta,
+ metas,
+ isMysql,
+ isPg,
+ col: column,
+ })
+ }}
+ </span>
+ </div>
+
+ <template #title>
+ <div class="flex gap-2 text-nowrap overflow-hidden items-center">
+ <span class="text-[12px] leading-4">
+ {{ $t(`aggregation.${field.aggregation}`).replace('Percent ', '') }}
+ </span>
+
+ <span class="font-semibold text-[12px]">
+ {{
+ getFormattedAggrationValue(field.aggregation, group.aggregations[column.title], column, [], {
+ meta,
+ metas,
+ isMysql,
+ isPg,
+ col: column,
+ })
+ }}
+ </span>
+ </div>
+ </template>
+ </NcTooltip>
+ </template>
+ </div>
+
+ <template #overlay>
+ <NcMenu variant="small">
+ <NcMenuItem
+ v-for="(agg, i) in getAggregations(column)"
+ :key="i"
+ class="!flex-1 nc-aggregation-menu"
+ @click="updateAggregate(column.id, agg)"
+ >
+ <div class="flex !flex-grow-1 !w-full text-[13px] text-nc-content-gray items-center justify-between">
+ {{ $t(`aggregation_type.${agg}`) }}
+
+ <GeneralIcon v-if="field?.aggregation === agg" class="text-nc-content-brand" icon="check" />
+ </div>
+ </NcMenuItem>
+ </NcMenu>
+ </template>
+ </NcDropdown>
+ </template>
</template>
+
+<style scoped lang="scss">
+:deep(.nc-menu-item-inner) {
+ @apply w-full;
+}
+
+.group-aggregation:hover {
+ .group-hover-aggregation {
+ @apply opacity-100;
+ }
+}
+</style>
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasRender.ts b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasRender.ts
index 4508bc9b8e..3bea65aba7 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasRender.ts
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasRender.ts
@@ -2978,7 +2978,7 @@ export function useCanvasRender({
},
)
- if (appInfo.value?.ee && !appInfo.value.disableGroupByAggregation) {
+ if (!appInfo.value.disableGroupByAggregation) {
const { start: startColIndex, end: endColIndex } = colSlice.value
const visibleCols = columns.value.slice(startColIndex, endColIndex)
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
index 279b40b996..d391be520f 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue
@@ -1475,7 +1475,7 @@ async function handleMouseUp(e: MouseEvent, _elementMap: CanvasElement) {
if (clickType === MouseClickType.SINGLE_CLICK) {
const { column: clickedColumn, xOffset } = findClickedColumn(x, scrollLeft.value)
- if ((clickedColumn && clickedColumn?.fixed) || !appInfo.value.ee) {
+ if (clickedColumn && clickedColumn?.fixed) {
const columnWidth = parseCellWidth(clickedColumn.width)
const diff = x - columnWidth
diff --git a/packages/nc-gui/components/webhook/index.vue b/packages/nc-gui/components/webhook/index.vue
index af2e3b6f7c..d55df5ae64 100644
--- a/packages/nc-gui/components/webhook/index.vue
+++ b/packages/nc-gui/components/webhook/index.vue
@@ -172,8 +172,6 @@ const operationsEnum = computed(() => {
return result
})
-const isBodyShown = ref(hookRef.version === 'v1' || isEeUI)
-
const urlTabKey = ref<'params' | 'headers' | 'body'>('params')
const apps: Record<string, any> = ref()
@@ -1422,7 +1420,7 @@ const webhookV2AndV3Diff = computed(() => {
<LazyApiClientHeaders v-model="hookRef.notification.payload.headers" />
</a-tab-pane>
- <a-tab-pane v-if="isBodyShown" key="body" tab="Body">
+ <a-tab-pane key="body" tab="Body">
<div
style="
box-shadow: 0px 0px 4px 0px rgba(var(--rgb-base), 0.08), 0px 0px 4px 0px rgba(var(--rgb-base), 0.08);
diff --git a/packages/nc-gui/composables/useGridViewData.ts b/packages/nc-gui/composables/useGridViewData.ts
index 8828620702..8503bdf6db 100644
--- a/packages/nc-gui/composables/useGridViewData.ts
+++ b/packages/nc-gui/composables/useGridViewData.ts
@@ -122,7 +122,7 @@ export function useGridViewData(
reloadAggregate?.trigger(params)
- if (!isGroupBy.value || !appInfo.value?.ee) {
+ if (!isGroupBy.value) {
return
}
diff --git a/packages/nc-gui/composables/useInfiniteGroups.ts b/packages/nc-gui/composables/useInfiniteGroups.ts
index 5ec1ab607a..207babc67a 100644
--- a/packages/nc-gui/composables/useInfiniteGroups.ts
+++ b/packages/nc-gui/composables/useInfiniteGroups.ts
@@ -270,7 +270,7 @@ export const useInfiniteGroups = (
groups.push(group)
}
- if (appInfo.value?.ee && groups.length && !appInfo.value.disableGroupByAggregation) {
+ if (groups.length && !appInfo.value.disableGroupByAggregation) {
const aggregationAliasMapper = new AliasMapper()
const aggregation = Object.values(gridViewCols.value)
@@ -564,7 +564,7 @@ export const useInfiniteGroups = (
aggregation?: string
}>,
) {
- if (!appInfo.value?.ee || appInfo.value.disableGroupByAggregation) return
+ if (appInfo.value.disableGroupByAggregation) return
const BATCH_SIZE = 100
const aggregationAliasMapper = new AliasMapper()
diff --git a/packages/nc-gui/composables/useViewGroupBy.ts b/packages/nc-gui/composables/useViewGroupBy.ts
index 668d1ce471..a25a017f9a 100644
--- a/packages/nc-gui/composables/useViewGroupBy.ts
+++ b/packages/nc-gui/composables/useViewGroupBy.ts
@@ -341,7 +341,7 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
group = await processGroupData(response, group)
// }
- if (appInfo.value.ee && group?.children?.length && !appInfo.value.disableGroupByAggregation) {
+ if (group?.children?.length && !appInfo.value.disableGroupByAggregation) {
const aggregationAliasMapper = new AliasMapper()
const aggregation = Object.values(gridViewCols.value)
@@ -440,14 +440,7 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
}>,
) {
try {
- if (
- !meta?.value?.id ||
- !view.value?.id ||
- !view.value?.fk_model_id ||
- !appInfo.value.ee ||
- appInfo.value.disableGroupByAggregation
- )
- return
+ if (!meta?.value?.id || !view.value?.id || !view.value?.fk_model_id || appInfo.value.disableGroupByAggregation) return
let filteredFields = fields
if (!fields) {
diff --git a/packages/nc-gui/pages/account/index.vue b/packages/nc-gui/pages/account/index.vue
index 647fe926eb..e264bc2a8a 100644
--- a/packages/nc-gui/pages/account/index.vue
+++ b/packages/nc-gui/pages/account/index.vue
@@ -141,20 +141,6 @@ const isPending = computed(() => !emailConfigured.value || !storageConfigured.va
<div class="select-none">{{ $t('title.mcpServer') }}</div>
</div>
</NcMenuItem>
- <NcMenuItem
- key="external-integrations"
- :class="{
- active: $route.params.page === 'external-integrations',
- }"
- class="item"
- @click="navigateTo('/account/external-integrations')"
- >
- <div class="flex items-center space-x-2">
- <GeneralIcon icon="ncSliders" class="!h-4 !w-4" />
-
- <div class="select-none">{{ $t('title.externalIntegrations') }}</div>
- </div>
- </NcMenuItem>
<NcMenuItem
v-if="isUIAllowed('superAdminAppStore') && !isEeUI"
key="apps"
@@ -169,7 +155,7 @@ const isPending = computed(() => !emailConfigured.value || !storageConfigured.va
<div class="select-none text-sm">{{ $t('title.appStore') }}</div>
<span class="flex-grow" />
- <NcToolti>
+ <NcTooltip>
<template #title>
<span>
App store will soon be removed. Email & Storage plugins are now available in Accounts/Setup page. Rest of
@@ -177,7 +163,7 @@ const isPending = computed(() => !emailConfigured.value || !storageConfigured.va
</span>
</template>
<GeneralIcon icon="ncAlertCircle" class="text-nc-content-orange-medium w-4 h-4 nc-pending" />
- </NcToolti>
+ </NcTooltip>
</div>
</NcMenuItem>
<a-sub-menu key="users" class="!bg-nc-bg-gray-sidebar !my-0">
diff --git a/packages/nc-gui/pages/account/index/[page].vue b/packages/nc-gui/pages/account/index/[page].vue
index 55b6f6b69d..5577d60017 100644
--- a/packages/nc-gui/pages/account/index/[page].vue
+++ b/packages/nc-gui/pages/account/index/[page].vue
@@ -6,8 +6,6 @@
<AccountSetup v-else-if="$route.params.page === 'setup'" />
<AccountProfile v-else-if="$route.params.page === 'profile'" />
<AccountMcp v-else-if="$route.params.page === 'mcp'" />
- <AccountOAuthClients v-else-if="$route.params.page === 'oauth-clients'" />
- <AccountExternalIntegrations v-else-if="$route.params.page === 'external-integrations'" />
<AccountAppStore v-else-if="$route.params.page === 'apps' && !isEeUI" />
<span v-else></span>
</div>
diff --git a/packages/nocodb/src/controllers/data-table.controller.ts b/packages/nocodb/src/controllers/data-table.controller.ts
index 3f3097046e..bb31faedc1 100644
--- a/packages/nocodb/src/controllers/data-table.controller.ts
+++ b/packages/nocodb/src/controllers/data-table.controller.ts
@@ -319,4 +319,21 @@ export class DataTableController {
user: req.user,
});
}
+
+ @Post(['/api/v2/tables/:modelId/bulk/aggregate'])
+ @Acl('dataAggregate')
+ async bulkAggregate(
+ @TenantContext() context: NcContext,
+ @Req() req: NcRequest,
+ @Param('modelId') modelId: string,
+ @Query('viewId') viewId: string,
+ ) {
+ context.cache = true;
+ return await this.dataTableService.bulkAggregate(context, {
+ query: req.query,
+ modelId,
+ viewId,
+ body: req.body,
+ });
+ }
}
diff --git a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
index f853283711..85ccd1de56 100644
--- a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
+++ b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts
@@ -520,6 +520,15 @@ export class UiPostOperations
viewName: req.query.viewId,
req,
});
+ case 'bulkAggregate':
+ context.cache = true;
+ return await this.dataTableService.bulkAggregate(context, {
+ query: req.query,
+ modelId: req.query.tableId as string,
+ viewId: req.query.viewId as string,
+ baseId: req.query.baseId as string,
+ body: payload,
+ });
}
}
}
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts
index a41d9f4dcc..34bb043ec8 100644
--- a/packages/nocodb/src/db/BaseModelSqlv2.ts
+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts
@@ -5074,7 +5074,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
apiVersion: NcApiVersion.V2,
},
) {
- if (options.raw) {
+ if (options.raw || options.bulkAggregate) {
options.skipDateConversion = true;
options.skipAttachmentConversion = true;
options.skipSubstitutingColumnIds = true;
@@ -5098,6 +5098,27 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
await this.model.getColumns(this.context);
}
+ // we need to post process lookup fields based on the looked up column instead of the lookup column
+ const aliasColumns = {};
+
+ if (!dependencyColumns) {
+ const nestedColumns = this.model?.columns.filter(
+ (col) => col.uidt === UITypes.Lookup,
+ );
+
+ for (const col of nestedColumns) {
+ const nestedColumn = await this.getNestedColumn(col);
+ if (
+ nestedColumn &&
+ [RelationTypes.BELONGS_TO, RelationTypes.ONE_TO_ONE].includes(
+ nestedColumn.colOptions?.type,
+ )
+ ) {
+ aliasColumns[col.id] = nestedColumn;
+ }
+ }
+ }
+
// update attachment fields
if (!options.skipAttachmentConversion) {
data = await this.convertAttachmentType(data, dependencyColumns);
@@ -5120,6 +5141,33 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
if (!options.skipJsonConversion) {
data = await this.convertJsonTypes(data, dependencyColumns);
}
+
+ if (options.bulkAggregate) {
+ data = data.map(async (d) => {
+ for (const key in d) {
+ let data = d[key];
+
+ if (typeof data === 'string' && data.startsWith('{')) {
+ try {
+ data = JSON.parse(data);
+ } catch (e) {
+ // do nothing
+ }
+ }
+
+ d[key] =
+ (
+ await this.substituteColumnIdsWithColumnTitles(
+ [data],
+ dependencyColumns,
+ aliasColumns,
+ )
+ )[0] ?? {};
+ }
+ return d;
+ });
+ }
+
if (options.apiVersion === NcApiVersion.V3) {
data = await this.convertMultiSelectTypes(data, dependencyColumns);
await FieldHandler.fromBaseModel(this).parseDataDbValue({
@@ -5134,6 +5182,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
data = await this.substituteColumnIdsWithColumnTitles(
data,
dependencyColumns,
+ aliasColumns,
);
}
diff --git a/packages/nocodb/src/models/Base.ts b/packages/nocodb/src/models/Base.ts
index 63abf21942..241a8b083c 100644
--- a/packages/nocodb/src/models/Base.ts
+++ b/packages/nocodb/src/models/Base.ts
@@ -140,7 +140,7 @@ export default class Base implements BaseType {
base_id: null,
},
CacheScope.PROJECT,
- [],
+ [base.fk_workspace_id],
`${CacheScope.PROJECT}:${base.id}`,
);
return base;
@@ -153,14 +153,16 @@ export default class Base implements BaseType {
ncMeta = Noco.ncMeta,
): Promise<Base[]> {
// todo: pagination
- const cachedList = await NocoCache.getList(
- {
- workspace_id: workspaceId,
- base_id: null,
- },
- CacheScope.PROJECT,
- [],
- );
+ const cachedList = workspaceId
+ ? await NocoCache.getList(
+ {
+ workspace_id: workspaceId,
+ base_id: null,
+ },
+ CacheScope.PROJECT,
+ [workspaceId],
+ )
+ : { list: [], isNoneList: false };
let { list: baseList } = cachedList;
const { isNoneList } = cachedList;
if (!isNoneList && !baseList.length) {
@@ -207,7 +209,7 @@ export default class Base implements BaseType {
base_id: null,
},
CacheScope.PROJECT,
- [],
+ [workspaceId],
baseList,
);
}
diff --git a/packages/nocodb/src/services/data-table.service.ts b/packages/nocodb/src/services/data-table.service.ts
index 3716ee0de9..46f55f7ca9 100644
--- a/packages/nocodb/src/services/data-table.service.ts
+++ b/packages/nocodb/src/services/data-table.service.ts
@@ -994,4 +994,47 @@ export class DataTableService {
return data;
}
+
+ async bulkAggregate(
+ context: NcContext,
+ param: {
+ baseId?: string;
+ modelId: string;
+ viewId?: string;
+ query: any;
+ body: any;
+ },
+ ) {
+ const { model, view } = await this.getModelAndView(context, param);
+
+ const source = await Source.get(context, model.source_id);
+
+ const baseModel = await Model.getBaseModelSQL(context, {
+ id: model.id,
+ viewId: view?.id,
+ dbDriver: await NcConnectionMgrv2.get(source),
+ });
+
+ if (view && view.type !== ViewTypes.GRID) {
+ NcError.badRequest('Aggregation is only supported on grid views');
+ }
+
+ const listArgs: any = { ...param.query };
+
+ let bulkFilterList = param.body;
+
+ try {
+ listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
+ } catch (e) {}
+
+ try {
+ listArgs.aggregation = JSON.parse(listArgs.aggregation);
+ } catch (e) {}
+
+ try {
+ bulkFilterList = JSON.parse(bulkFilterList);
+ } catch (e) {}
+
+ return await baseModel.bulkAggregate(listArgs, bulkFilterList, view);
+ }
}
diff --git a/packages/nocodb/src/services/public-datas.service.ts b/packages/nocodb/src/services/public-datas.service.ts
index eb92c3a10d..1414e162cf 100644
--- a/packages/nocodb/src/services/public-datas.service.ts
+++ b/packages/nocodb/src/services/public-datas.service.ts
@@ -1076,4 +1076,62 @@ export class PublicDatasService {
return data;
}
+
+ async bulkAggregate(
+ context: NcContext,
+ param: {
+ sharedViewUuid: string;
+ password?: string;
+ query: any;
+ body: any;
+ },
+ ) {
+ const view = await View.getByUUID(context, param.sharedViewUuid);
+
+ if (!view) NcError.viewNotFound(param.sharedViewUuid);
+
+ if (view.type !== ViewTypes.GRID) {
+ NcError.notFound('Not found');
+ }
+
+ const base = await Base.get(context, view.base_id);
+
+ this.publicMetasService.checkViewBaseType(view, base);
+
+ if (view.password && view.password !== param.password) {
+ return NcError.invalidSharedViewPassword();
+ }
+
+ const model = await Model.getByIdOrName(context, {
+ id: view?.fk_model_id,
+ });
+
+ let bulkFilterList = param.body;
+
+ const listArgs: any = { ...param.query };
+
+ try {
+ listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
+ } catch (e) {}
+
+ try {
+ listArgs.aggregation = JSON.parse(listArgs.aggregation);
+ } catch (e) {}
+
+ try {
+ bulkFilterList = JSON.parse(bulkFilterList);
+ } catch (e) {}
+
+ const source = await Source.get(context, model.source_id);
+
+ const baseModel = await Model.getBaseModelSQL(context, {
+ id: model.id,
+ viewId: view?.id,
+ dbDriver: await NcConnectionMgrv2.get(source),
+ });
+
+ const data = await baseModel.bulkAggregate(listArgs, bulkFilterList, view);
+
+ return data;
+ }
}