π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
chore: sync
Pranav C130687bcd785
diff --git a/packages/nc-gui/components/dashboard/FeatureExperimentation.vue b/packages/nc-gui/components/dashboard/FeatureExperimentation.vueindex 83ab3062ea..7b4603cf9b 100644--- a/packages/nc-gui/components/dashboard/FeatureExperimentation.vue+++ b/packages/nc-gui/components/dashboard/FeatureExperimentation.vue@@ -5,7 +5,7 @@ interface Props {const props = defineProps<Props>()-const { toggleFeature, features, isEngineeringModeOn } = useBetaFeatureToggle()+const { toggleFeature, features, isEngineeringModeOn, isAdvancedModeOn } = useBetaFeatureToggle()const value = useVModel(props, 'value')@@ -23,7 +23,12 @@ const isEnabledOnPremFeature = (feature: BetaFeatureType) => {}const isFeatureVisible = (feature: BetaFeatureType) => {- return (!feature?.isEE || isEeUI) && (!feature?.isEngineering || isEngineeringModeOn.value) && isEnabledOnPremFeature(feature)+ return (+ (!feature?.isEE || isEeUI) &&+ (!feature?.isEngineering || isEngineeringModeOn.value) &&+ (!feature?.isAdvanced || isAdvancedModeOn.value) &&+ isEnabledOnPremFeature(feature)+ )}const filteredFeatures = computed(() => {@@ -120,6 +125,26 @@ const handleClick = () => {}}+const advancedClickCount = ref(0)+const advancedClickTimer = ref<NodeJS.Timeout | undefined>(undefined)+const handleAdvancedClick = () => {+ advancedClickCount.value+++ if (advancedClickCount.value === 1) {+ if (advancedClickTimer.value) clearTimeout(advancedClickTimer.value)+ advancedClickTimer.value = setTimeout(() => {+ advancedClickCount.value = 0+ }, 3000)+ }+ if (advancedClickCount.value >= 3) {+ isAdvancedModeOn.value = !isAdvancedModeOn.value+ advancedClickCount.value = 0+ if (advancedClickTimer.value) {+ clearTimeout(advancedClickTimer.value)+ advancedClickTimer.value = undefined+ }+ }+}+useEventListener('keydown', (e: KeyboardEvent) => {if (isActiveInputElementExist()) returnif (e.shiftKey && e.altKey && e.code === 'KeyE') {@@ -153,6 +178,7 @@ onUnmounted(() => {<divclass="text-sm font-weight-500 text-nc-content-gray-subtle2 leading-5 m-4 mb-0 flex items-center justify-between gap-3 pr-3"+ @click="handleAdvancedClick"><span>{{ $t('labels.toggleExperimentalFeature') }}diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vueindex 2013abb2a8..0ea011d719 100644--- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue+++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue@@ -369,6 +369,12 @@ const duplicateProject = (base: BaseType) => {isDuplicateDlgOpen.value = true}+const isConvertToSandboxDlgOpen = ref(false)++const convertToSandbox = () => {+ isConvertToSandboxDlgOpen.value = true+}+const tableDelete = () => {isTableDeleteDialogVisible.value = true$e('c:table:delete')@@ -613,6 +619,7 @@ defineExpose({@click-menu="onClickMenu"@rename="enableEditMode()"@duplicate-project="duplicateProject($event)"+ @convert-to-sandbox="convertToSandbox"@copy-project-info="copyProjectInfo()"@open-erd-view="openErdView($event)"@open-base-settings="openBaseSettings($event)"@@ -673,6 +680,7 @@ defineExpose({@click-menu="onClickMenu"@rename="enableEditMode(true)"@duplicate-project="duplicateProject($event)"+ @convert-to-sandbox="convertToSandbox"@copy-project-info="copyProjectInfo()"@open-erd-view="openErdView($event)"@open-base-settings="openBaseSettings($event)"@@ -757,6 +765,7 @@ defineExpose({/><DlgBaseDelete v-model:visible="isBaseDeleteDialogVisible" :base-id="base?.id" /><DlgBaseDuplicate v-if="selectedProjectToDuplicate" v-model="isDuplicateDlgOpen" :base="selectedProjectToDuplicate" />+ <DlgConvertToSandbox v-if="base?.id" v-model:visible="isConvertToSandboxDlgOpen" :base-id="base.id" /><GeneralModal v-model:visible="isErdModalOpen" size="large"><div class="h-[80vh]"><LazyDashboardSettingsErd :base-id="base?.id" :source-id="activeBaseId" />diff --git a/packages/nc-gui/components/dlg/AirtableImport.vue b/packages/nc-gui/components/dlg/AirtableImport.vueindex 6f71852ead..0ab6bc3438 100644--- a/packages/nc-gui/components/dlg/AirtableImport.vue+++ b/packages/nc-gui/components/dlg/AirtableImport.vue@@ -144,19 +144,25 @@ async function createOrUpdate() {const { id, ...payload } = syncSource.valueif (id !== '') {- await $fetch(`/api/v1/db/meta/syncs/${id}`, {- baseURL,- method: 'PATCH',- headers: { 'xc-auth': $state.token.value as string },- body: payload,- })+ await $api.internal.postOperation(+ activeWorkspace.value!.id,+ baseId,+ {+ operation: 'syncSourceUpdate',+ syncId: id,+ },+ payload,+ )} else {- syncSource.value = await $fetch(`/api/v1/db/meta/projects/${baseId}/syncs/${customSourceId.value}`, {- baseURL,- method: 'POST',- headers: { 'xc-auth': $state.token.value as string },- body: payload,- })+ syncSource.value = await $api.internal.postOperation(+ activeWorkspace.value!.id,+ baseId,+ {+ operation: 'syncSourceCreate',+ sourceId: customSourceId.value,+ },+ payload,+ )}} catch (e: any) {message.error(await extractSdkResponseErrorMsg(e))@@ -213,10 +219,9 @@ async function listenForUpdates(id?: string) {}async function loadSyncSrc() {- const data: any = await $fetch(`/api/v1/db/meta/projects/${baseId}/syncs/${customSourceId.value}`, {- baseURL,- method: 'GET',- headers: { 'xc-auth': $state.token.value as string },+ const data: any = await $api.internal.getOperation(activeWorkspace.value!.id, baseId, {+ operation: 'syncSourceList',+ sourceId: customSourceId.value,})const { list: srcs } = data@@ -255,11 +260,15 @@ async function loadSyncSrc() {async function sync() {try {- const jobData: any = await $fetch(`/api/v1/db/meta/syncs/${syncSource.value.id}/trigger`, {- baseURL,- method: 'POST',- headers: { 'xc-auth': $state.token.value as string },- })+ const jobData: any = await $api.internal.postOperation(+ activeWorkspace.value!.id,+ baseId,+ {+ operation: 'atImportTrigger',+ syncId: syncSource.value.id,+ },+ {},+ )listeningForUpdates.value = falselistenForUpdates(jobData.id)} catch (e: any) {diff --git a/packages/nc-gui/components/dlg/ConvertToSandbox.vue b/packages/nc-gui/components/dlg/ConvertToSandbox.vuenew file mode 100644index 0000000000..ee858fe439--- /dev/null+++ b/packages/nc-gui/components/dlg/ConvertToSandbox.vue@@ -0,0 +1,168 @@+<script setup lang="ts">+const props = defineProps<{+ baseId: string+}>()++const visible = defineModel<boolean>('visible', { required: true })++const { $api } = useNuxtApp()+const { t } = useI18n()++const isLoading = ref(false)+const sandboxForm = reactive({+ title: '',+ description: '',+ category: '',+ visibility: 'private',+})++const { base } = storeToRefs(useBase())++const basesStore = useBases()++watch(visible, (isVisible) => {+ if (isVisible && base.value) {+ sandboxForm.title = base.value.title || ''+ sandboxForm.description = ''+ sandboxForm.category = ''+ sandboxForm.visibility = 'private'+ }+})++const convertToSandbox = async () => {+ if (!sandboxForm.title?.trim()) {+ message.error(t('msg.error.titleRequired'))+ return+ }++ isLoading.value = true+ try {+ const response = await $api.internal.postOperation(+ base.value.fk_workspace_id,+ props.baseId,+ {+ operation: 'sandboxCreate',+ } as any,+ {+ title: sandboxForm.title,+ description: sandboxForm.description,+ category: sandboxForm.category,+ visibility: sandboxForm.visibility,+ },+ )++ message.success(t('msg.success.sandboxCreated'))+ visible.value = false++ // Update the base with the sandbox_id from response+ if (response && response.sandbox_id) {+ const currentBase = basesStore.bases.get(props.baseId)+ if (currentBase) {+ ;(currentBase as any).sandbox_id = response.sandbox_id+ }+ }++ // Reload base to ensure all sandbox data is loaded+ await basesStore.loadProject(props.baseId, true)+ } catch (e: any) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ isLoading.value = false+ }+}+</script>++<template>+ <GeneralModal v-model:visible="visible" size="medium" centered>+ <div class="flex flex-col p-6">+ <div class="flex items-center gap-3 pb-4 mb-4 border-b border-nc-border-gray-medium">+ <div class="w-10 h-10 rounded-lg bg-gradient-to-br from-brand-500 to-brand-600 flex items-center justify-center">+ <GeneralIcon icon="ncBox" class="w-5 h-5 text-white" />+ </div>+ <div>+ <div class="font-semibold text-lg text-nc-content-gray-emphasis">Convert to Sandbox</div>+ <div class="text-xs text-nc-content-gray-subtle2">{{ $t('labels.publishToAppStore') }}</div>+ </div>+ </div>++ <div class="space-y-4">+ <div class="bg-nc-bg-blue-light border border-nc-border-blue rounded-lg p-3 mb-4">+ <div class="flex gap-2 text-sm text-nc-content-gray">+ <GeneralIcon icon="info" class="w-4 h-4 text-nc-content-blue-dark mt-0.5 flex-shrink-0" />+ <div>+ Convert this base into a living application that can be published to the App Store. You'll be able to manage+ versions and push updates to all installations.+ </div>+ </div>+ </div>++ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">+ {{ $t('labels.sandboxTitle') }} <span class="text-nc-content-red-dark">*</span>+ </label>+ <a-input v-model:value="sandboxForm.title" placeholder="Enter a descriptive title" size="large" class="rounded-lg" />+ </div>++ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">+ {{ $t('labels.sandboxDescription') }}+ </label>+ <a-textarea+ v-model:value="sandboxForm.description"+ placeholder="Describe your application's capabilities"+ :rows="3"+ size="large"+ class="rounded-lg"+ />+ </div>++ <div class="grid grid-cols-2 gap-4">+ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">+ {{ $t('labels.sandboxCategory') }}+ </label>+ <a-input v-model:value="sandboxForm.category" placeholder="e.g., CRM, HR" size="large" class="rounded-lg" />+ </div>++ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">+ {{ $t('labels.sandboxVisibility') }}+ </label>+ <a-select v-model:value="sandboxForm.visibility" size="large" class="w-full rounded-lg">+ <a-select-option disabled value="public">+ <div class="flex items-center gap-2">+ <GeneralIcon icon="eye" class="w-4 h-4" />+ <span>Public</span>+ </div>+ </a-select-option>+ <a-select-option value="private">+ <div class="flex items-center gap-2">+ <GeneralIcon icon="lock" class="w-4 h-4" />+ <span>Private</span>+ </div>+ </a-select-option>+ <a-select-option value="unlisted">+ <div class="flex items-center gap-2">+ <GeneralIcon icon="ncEyeOff" class="w-4 h-4" />+ <span>Unlisted</span>+ </div>+ </a-select-option>+ </a-select>+ </div>+ </div>+ </div>++ <div class="flex justify-end gap-2 mt-6 pt-4 border-t border-nc-border-gray-medium">+ <NcButton size="medium" type="secondary" :disabled="isLoading" @click="visible = false">+ {{ $t('general.cancel') }}+ </NcButton>+ <NcButton size="medium" type="primary" :loading="isLoading" @click="convertToSandbox">+ <template #icon>+ <GeneralIcon icon="ncBox" />+ </template>+ Convert to sandbox+ </NcButton>+ </div>+ </div>+ </GeneralModal>+</template>diff --git a/packages/nc-gui/components/general/ShareProject.vue b/packages/nc-gui/components/general/ShareProject.vueindex 5da005c48a..5660f05a2f 100644--- a/packages/nc-gui/components/general/ShareProject.vue+++ b/packages/nc-gui/components/general/ShareProject.vue@@ -12,7 +12,7 @@ const { visibility, showShareModal } = storeToRefs(useShare())const { activeTable } = storeToRefs(useTablesStore())-const { base, isSharedBase } = storeToRefs(useBase())+const { base, isSharedBase, isSandboxMaster } = storeToRefs(useBase())const { hideSharedBaseBtn } = storeToRefs(useConfigStore())@@ -46,7 +46,7 @@ const copySharedBase = async () => {<template><div- v-if="!isSharedBase && isUIAllowed('baseShare') && visibility !== 'hidden' && (activeTable || base)"+ v-if="!isSharedBase && !isSandboxMaster && isUIAllowed('baseShare') && visibility !== 'hidden' && (activeTable || base)"class="nc-share-base-button flex flex-col justify-center"data-testid="share-base-button":data-sharetype="visibility"diff --git a/packages/nc-gui/components/project/View.vue b/packages/nc-gui/components/project/View.vueindex 68ca51fb96..d8539246c5 100644--- a/packages/nc-gui/components/project/View.vue+++ b/packages/nc-gui/components/project/View.vue@@ -231,7 +231,10 @@ onMounted(() => {</NcBadge></div></div>- <LazyGeneralShareProject v-if="!showEmptySkeleton && !isMobileMode" />+ <div v-if="!showEmptySkeleton && !isMobileMode" class="flex items-center gap-2">+ <SmartsheetTopbarSandboxStatus />+ <LazyGeneralShareProject />+ </div></div><divv-if="!showEmptySkeleton"diff --git a/packages/nc-gui/components/smartsheet/Topbar.vue b/packages/nc-gui/components/smartsheet/Topbar.vueindex ebbc34159d..b83fa533dc 100644--- a/packages/nc-gui/components/smartsheet/Topbar.vue+++ b/packages/nc-gui/components/smartsheet/Topbar.vue@@ -72,6 +72,9 @@ const topbarBreadcrumbItemWidth = computed(() => {<div class="flex items-center justify-end gap-2 flex-1"><GeneralApiLoader v-if="!isMobileMode && !activeScriptId && !activeDashboardId" />+ <!-- Sandbox Status -->+ <LazySmartsheetTopbarSandboxStatus v-if="!isSharedBase && !isMobileMode" />+<NcButtonv-if="(appInfo.isOnPrem || isEeUI || isFeatureEnabled(FEATURE_FLAG.EXTENSIONS)) &&diff --git a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vueindex 4539f97e4c..1a7c62061a 100644--- a/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue+++ b/packages/nc-gui/components/smartsheet/grid/InfiniteTable.vue@@ -1228,6 +1228,8 @@ const bulkExecuteScript = async () => {runScript((field.colOptions as ButtonType).fk_script_id!, row.row, {pk,fieldId: field.id,+ }).catch((e: any) => {+ // ignore - console error is logged in runScript})}}diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useDataFetch.ts b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useDataFetch.tsindex f9b8e70c47..449646e6ea 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useDataFetch.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useDataFetch.ts@@ -196,7 +196,9 @@ export function useDataFetch({clearCache(Math.max(0, start - BUFFER_SIZE), Math.min(totalRows.value, end + BUFFER_SIZE))- debouncedFetchChunks(chunksToFetch, firstChunkId)+ debouncedFetchChunks(chunksToFetch, firstChunkId).catch((error) => {+ console.error('Error fetching chunks:', error)+ })}const rafId = ref<number | null>(null)diff --git a/packages/nc-gui/components/smartsheet/topbar/SandboxModal.vue b/packages/nc-gui/components/smartsheet/topbar/SandboxModal.vuenew file mode 100644index 0000000000..ec394d520a--- /dev/null+++ b/packages/nc-gui/components/smartsheet/topbar/SandboxModal.vue@@ -0,0 +1,508 @@+<script setup lang="ts">+const props = defineProps<{+ visible: boolean+ sandbox: any+ currentVersion: any+ initialTab?: 'publish' | 'fork' | 'deployments'+}>()++const emit = defineEmits(['update:visible', 'published', 'forked'])++const { $api } = useNuxtApp()+const baseStore = useBase()+const { base } = storeToRefs(baseStore)++const activeTab = ref('publish')+const isLoading = ref(false)+const isLoadingDeployments = ref(false)+const versions = ref<any[]>([])+const deploymentStats = ref<any>(null)++// Version deployments modal+const showVersionDeploymentsModal = ref(false)+const selectedVersion = ref<any>(null)++// Publish form (for draft versions)+const publishForm = reactive({+ releaseNotes: '',+})++// Fork form (for creating new draft from published)+const forkForm = reactive({+ version: '',+ releaseNotes: '',+})++const isPublished = computed(() => props.currentVersion?.status === 'published')+const isDraft = computed(() => props.currentVersion?.status === 'draft')++// Load versions+const loadVersions = async () => {+ if (!props.sandbox?.id || !base.value?.fk_workspace_id) return++ try {+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxVersionsList',+ sandboxId: props.sandbox.id,+ } as any)+ if (response?.list) {+ versions.value = response.list+ }+ } catch (e: any) {+ console.error('Failed to load versions:', e)+ }+}++// Load real deployment statistics+const loadDeployments = async () => {+ if (!props.sandbox?.id || !base.value?.fk_workspace_id) return++ isLoadingDeployments.value = true+ try {+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxDeployments',+ sandboxId: props.sandbox.id,+ } as any)+ if (response) {+ deploymentStats.value = response+ }+ } catch (e: any) {+ console.error('Failed to load deployments:', e)+ } finally {+ isLoadingDeployments.value = false+ }+}++const publishCurrentDraft = async () => {+ if (!base.value?.fk_workspace_id || !base.value?.id || !props.currentVersion?.id) return++ isLoading.value = true+ try {+ await $api.internal.postOperation(+ base.value.fk_workspace_id,+ base.value.id,+ {+ operation: 'sandboxPublish',+ },+ {+ sandboxVersionId: props.currentVersion.id,+ },+ )++ // Reload base to get updated sandbox version info+ if (base.value?.id) {+ await baseStore.loadProject()+ }++ message.success(`Version ${props.currentVersion.version} published successfully!`)+ emit('published')+ emit('update:visible', false)+ } catch (e: any) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ isLoading.value = false+ }+}++const createNewDraft = async () => {+ if (!base.value?.fk_workspace_id || !base.value?.id || !props.sandbox?.id) return+ if (!forkForm.version) {+ message.error('Please provide a version')+ return+ }++ isLoading.value = true+ try {+ await $api.internal.postOperation(+ base.value.fk_workspace_id,+ base.value.id,+ {+ operation: 'sandboxCreateDraft',+ },+ {+ sandboxId: props.sandbox.id,+ version: forkForm.version,+ },+ )++ // Reload base to get updated sandbox version info+ if (base.value?.id) {+ await baseStore.loadProject()+ }++ message.success(`New draft version ${forkForm.version} created successfully!`)+ emit('forked')+ emit('update:visible', false)+ } catch (e: any) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ isLoading.value = false+ }+}++const formatDate = (dateString: string) => {+ if (!dateString) return 'N/A'+ const date = new Date(dateString)+ return new Intl.DateTimeFormat('en-US', {+ year: 'numeric',+ month: 'short',+ day: 'numeric',+ hour: '2-digit',+ minute: '2-digit',+ }).format(date)+}++const suggestNextVersion = () => {+ if (!props.currentVersion?.version) {+ forkForm.version = '1.0.0'+ return+ }++ const currentVersion = props.currentVersion.version+ const versionParts = currentVersion.split('.')+ if (versionParts.length === 3) {+ // Increment minor version for new draft+ versionParts[1] = String(Number(versionParts[1]) + 1)+ versionParts[2] = '0'+ forkForm.version = versionParts.join('.')+ } else {+ forkForm.version = ''+ }+}++const openVersionDeploymentsModal = (version: any) => {+ selectedVersion.value = version+ showVersionDeploymentsModal.value = true+}++watch(+ () => props.visible,+ async (val) => {+ if (val) {+ // Use initialTab if provided, otherwise default based on version status+ if (props.initialTab) {+ activeTab.value = props.initialTab+ } else if (isDraft.value) {+ activeTab.value = 'publish'+ } else if (isPublished.value) {+ activeTab.value = 'fork'+ } else {+ // Fallback to deployments if version status is unclear+ activeTab.value = 'deployments'+ }++ await loadVersions()+ await loadDeployments()+ if (!isDraft.value && !props.initialTab) {+ suggestNextVersion()+ }+ }+ },+)+</script>++<template>+ <GeneralModal :visible="visible" size="large" centered @update:visible="emit('update:visible', $event)">+ <div class="flex flex-col h-full">+ <!-- Header -->+ <div class="flex items-center justify-between px-6 py-4 border-b border-nc-border-gray-medium">+ <div>+ <div class="font-semibold text-lg text-nc-content-gray-emphasis">Sandbox Management</div>+ <div class="text-xs text-nc-content-gray-subtle2">Manage versions and track deployments</div>+ </div>+ <GeneralIcon+ icon="close"+ class="w-5 h-5 text-nc-content-gray cursor-pointer hover:text-nc-content-gray-emphasis"+ @click="emit('update:visible', false)"+ />+ </div>++ <!-- Tabs -->+ <div class="flex gap-6 px-6 pt-3 border-b border-nc-border-gray-medium">+ <button+ v-if="isDraft"+ class="pb-2 px-1 text-sm font-medium transition-colors border-b-2"+ :class="[+ activeTab === 'publish'+ ? 'border-nc-content-brand text-nc-content-brand'+ : 'border-transparent text-nc-content-gray hover:text-nc-content-gray-emphasis',+ ]"+ @click="activeTab = 'publish'"+ >+ Publish+ </button>+ <button+ v-if="isPublished"+ class="pb-2 px-1 text-sm font-medium transition-colors border-b-2"+ :class="[+ activeTab === 'fork'+ ? 'border-nc-content-brand text-nc-content-brand'+ : 'border-transparent text-nc-content-gray hover:text-nc-content-gray-emphasis',+ ]"+ @click="activeTab = 'fork'"+ >+ Fork+ </button>+ <button+ class="pb-2 px-1 text-sm font-medium transition-colors border-b-2"+ :class="[+ activeTab === 'deployments'+ ? 'border-nc-content-brand text-nc-content-brand'+ : 'border-transparent text-nc-content-gray hover:text-nc-content-gray-emphasis',+ ]"+ @click="activeTab = 'deployments'"+ >+ Deployments+ </button>+ </div>++ <!-- Content -->+ <div class="flex-1 overflow-y-auto">+ <!-- Publish Tab -->+ <div v-if="activeTab === 'publish'" class="p-6">+ <div class="mb-4 bg-nc-bg-blue-light border border-nc-border-blue rounded-lg p-4">+ <div class="flex gap-3">+ <GeneralIcon icon="info" class="w-5 h-5 text-nc-content-blue-dark mt-0.5 flex-shrink-0" />+ <div class="text-sm text-nc-content-gray">+ Publishing version <strong>{{ currentVersion?.version }}</strong> will make it available in the App Store and+ automatically update all installations.+ </div>+ </div>+ </div>++ <div class="space-y-4">+ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">Version</label>+ <a-input :value="currentVersion?.version" disabled size="large" class="rounded-lg">+ <template #prefix>+ <span class="text-nc-content-gray-subtle2">v</span>+ </template>+ </a-input>+ </div>++ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">Release Notes (Optional)</label>+ <a-textarea+ v-model:value="publishForm.releaseNotes"+ placeholder="Describe what's new in this version"+ :rows="6"+ size="large"+ class="rounded-lg"+ />+ </div>+ </div>+ </div>++ <!-- Fork Tab -->+ <div v-if="activeTab === 'fork'" class="p-6">+ <div class="mb-4 bg-nc-bg-blue-light border border-nc-border-blue rounded-lg p-4">+ <div class="flex gap-3">+ <GeneralIcon icon="info" class="w-5 h-5 text-nc-content-blue-dark mt-0.5 flex-shrink-0" />+ <div class="text-sm text-nc-content-gray">+ Create a new draft version to work on updates. Current published version+ <strong>{{ currentVersion?.version }}</strong> will remain unchanged.+ </div>+ </div>+ </div>++ <div class="space-y-4">+ <div>+ <label class="text-nc-content-gray text-sm font-medium mb-2 block">+ New Version <span class="text-nc-content-red-dark">*</span>+ </label>+ <a-input v-model:value="forkForm.version" placeholder="e.g., 2.0.0" size="large" class="rounded-lg">+ <template #prefix>+ <span class="text-nc-content-gray-subtle2">v</span>+ </template>+ </a-input>+ <div class="text-xs text-nc-content-gray-subtle2 mt-1.5">Use semantic versioning (e.g., 2.0.0, 2.1.0)</div>+ </div>+ </div>+ </div>++ <!-- Deployments Tab -->+ <div v-if="activeTab === 'deployments'" class="p-6">+ <div v-if="isLoadingDeployments" class="flex items-center justify-center py-12">+ <a-spin size="large" />+ </div>++ <template v-else-if="deploymentStats">+ <!-- Stats Cards -->+ <div class="grid grid-cols-4 gap-4 mb-8">+ <!-- Total Deployments -->+ <div class="bg-nc-bg-gray-light rounded-lg p-4 border border-nc-border-gray-light">+ <div class="flex items-center justify-between mb-3">+ <div class="p-2 bg-nc-bg-blue-light rounded-lg">+ <GeneralIcon icon="ncServer" class="w-5 h-5 text-nc-content-blue-dark" />+ </div>+ </div>+ <div class="text-3xl font-bold text-nc-content-gray-emphasis mb-1">+ {{ deploymentStats.statistics?.totalDeployments || 0 }}+ </div>+ <div class="text-xs font-medium text-nc-content-gray-subtle2 uppercase tracking-wide">Total Deployments</div>+ </div>++ <!-- Active -->+ <div class="bg-nc-bg-gray-light rounded-lg p-4 border border-nc-border-gray-light">+ <div class="flex items-center justify-between mb-3">+ <div class="p-2 bg-nc-bg-green-light rounded-lg">+ <GeneralIcon icon="check" class="w-5 h-5 text-nc-content-green-dark" />+ </div>+ </div>+ <div class="text-3xl font-bold text-nc-content-gray-emphasis mb-1">+ {{ deploymentStats.statistics?.activeDeployments || 0 }}+ </div>+ <div class="text-xs font-medium text-nc-content-gray-subtle2 uppercase tracking-wide">Active</div>+ </div>++ <!-- Failed -->+ <div class="bg-nc-bg-gray-light rounded-lg p-4 border border-nc-border-gray-light">+ <div class="flex items-center justify-between mb-3">+ <div class="p-2 bg-nc-bg-red-light rounded-lg">+ <GeneralIcon icon="alertTriangle" class="w-5 h-5 text-nc-content-red-dark" />+ </div>+ </div>+ <div class="text-3xl font-bold text-nc-content-gray-emphasis mb-1">+ {{ deploymentStats.statistics?.failedDeployments || 0 }}+ </div>+ <div class="text-xs font-medium text-nc-content-gray-subtle2 uppercase tracking-wide">Failed</div>+ </div>++ <!-- Versions -->+ <div class="bg-nc-bg-gray-light rounded-lg p-4 border border-nc-border-gray-light">+ <div class="flex items-center justify-between mb-3">+ <div class="p-2 bg-nc-bg-purple-light rounded-lg">+ <GeneralIcon icon="ncGitBranch" class="w-5 h-5 text-nc-content-purple-dark" />+ </div>+ </div>+ <div class="text-3xl font-bold text-nc-content-gray-emphasis mb-1">+ {{ deploymentStats.statistics?.totalVersions || 0 }}+ </div>+ <div class="text-xs font-medium text-nc-content-gray-subtle2 uppercase tracking-wide">Versions</div>+ </div>+ </div>++ <!-- Version List Header -->+ <div v-if="deploymentStats.versionStats && deploymentStats.versionStats.length > 0" class="mb-4">+ <h3 class="text-sm font-semibold text-nc-content-gray-emphasis">Version History</h3>+ <p class="text-xs text-nc-content-gray-subtle2 mt-1">Track deployments across all published versions</p>+ </div>++ <!-- Version List with Real Stats -->+ <div v-if="deploymentStats.versionStats && deploymentStats.versionStats.length > 0" class="space-y-2">+ <div+ v-for="(versionStat, index) in deploymentStats.versionStats"+ :key="versionStat.versionId"+ class="bg-nc-bg-gray-light border border-nc-border-gray-light rounded-lg p-4 hover:border-nc-border-brand hover:shadow-sm transition-all duration-200"+ >+ <div class="flex items-center justify-between">+ <div class="flex items-center gap-4 flex-1">+ <!-- Version Badge -->+ <div class="flex items-center gap-2">+ <div class="p-2 bg-white dark:bg-nc-bg-gray-medium rounded-md">+ <GeneralIcon icon="ncGitBranch" class="w-4 h-4 text-nc-content-gray" />+ </div>+ <div>+ <div class="flex items-center gap-2">+ <span class="font-mono font-bold text-base text-nc-content-gray-emphasis"+ >v{{ versionStat.version }}</span+ >+ <div+ v-if="index === 0 && versionStat.status === 'published'"+ class="px-2 py-0.5 text-xs rounded-full bg-nc-bg-green-light text-nc-content-green-dark font-semibold"+ >+ Current+ </div>+ </div>+ <div class="text-xs text-nc-content-gray-subtle2 mt-0.5">+ {{ formatDate(versionStat.publishedAt) }}+ </div>+ </div>+ </div>+ </div>++ <!-- Deployment Count -->+ <template v-if="versionStat.deploymentCount === 0">+ <div+ class="flex items-center gap-3 px-4 py-2 bg-white dark:bg-nc-bg-gray-medium rounded-lg border border-nc-border-gray-light transition-all"+ >+ <GeneralIcon icon="ncServer" class="w-4 h-4 text-nc-content-gray-subtle2" />+ <div class="text-right">+ <div class="text-lg font-bold text-nc-content-gray-emphasis">{{ versionStat.deploymentCount }}</div>+ </div>+ </div>+ </template>+ <template v-else>+ <a-tooltip placement="top" title="Click to view deployments">+ <div+ class="flex items-center gap-3 px-4 py-2 bg-white dark:bg-nc-bg-gray-medium rounded-lg border border-nc-border-gray-light cursor-pointer hover:border-nc-border-brand hover:shadow-sm transition-all"+ @click="openVersionDeploymentsModal(versionStat)"+ >+ <GeneralIcon icon="ncServer" class="w-4 h-4 text-nc-content-gray-subtle2" />+ <div class="text-right">+ <div class="text-lg font-bold text-nc-content-gray-emphasis">{{ versionStat.deploymentCount }}</div>+ </div>+ </div>+ </a-tooltip>+ </template>+ </div>+ </div>+ </div>++ <!-- Empty State -->+ <div v-else class="text-center py-16">+ <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-nc-bg-gray-light mb-4">+ <GeneralIcon icon="ncServer" class="w-8 h-8 text-nc-content-gray-subtle2" />+ </div>+ <div class="text-base font-medium text-nc-content-gray-emphasis mb-1">No deployments yet</div>+ <div class="text-sm text-nc-content-gray-subtle2">Users will appear here once they install your application</div>+ </div>+ </template>++ <div v-else class="text-center py-16">+ <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-nc-bg-red-light mb-4">+ <GeneralIcon icon="alertTriangle" class="w-8 h-8 text-nc-content-red-dark" />+ </div>+ <div class="text-base font-medium text-nc-content-gray-emphasis mb-1">Failed to load statistics</div>+ <div class="text-sm text-nc-content-gray-subtle2">Please try refreshing the page</div>+ </div>+ </div>+ </div>++ <!-- Footer -->+ <div v-if="activeTab === 'publish' || activeTab === 'fork'" class="px-6 py-4 border-t border-nc-border-gray-medium">+ <div class="flex justify-end gap-2">+ <NcButton type="secondary" size="medium" @click="emit('update:visible', false)"> Cancel </NcButton>++ <NcButton v-if="activeTab === 'publish'" type="primary" size="medium" :loading="isLoading" @click="publishCurrentDraft">+ <template #icon>+ <GeneralIcon icon="upload" />+ </template>+ Publish Version+ </NcButton>++ <NcButton+ v-if="activeTab === 'fork'"+ type="primary"+ size="medium"+ :loading="isLoading"+ :disabled="!forkForm.version"+ @click="createNewDraft"+ >+ <template #icon>+ <GeneralIcon icon="plus" />+ </template>+ Create Draft+ </NcButton>+ </div>+ </div>+ </div>++ <!-- Version Deployments Modal -->+ <SmartsheetTopbarSandboxVersionDeploymentsModal+ v-model:visible="showVersionDeploymentsModal"+ :sandbox="sandbox"+ :version="selectedVersion"+ />+ </GeneralModal>+</template>diff --git a/packages/nc-gui/components/smartsheet/topbar/SandboxStatus.vue b/packages/nc-gui/components/smartsheet/topbar/SandboxStatus.vuenew file mode 100644index 0000000000..4735089ed0--- /dev/null+++ b/packages/nc-gui/components/smartsheet/topbar/SandboxStatus.vue@@ -0,0 +1,108 @@+<script setup lang="ts">+const { base } = storeToRefs(useBase())+const { $api } = useNuxtApp()++const isModalVisible = ref(false)+const initialTab = ref<'publish' | 'fork' | 'deployments' | undefined>(undefined)++const sandbox = ref<any>(null)+const currentVersion = ref<any>(null)++const isSandboxMaster = computed(() => !!(base.value as any)?.sandbox_master && !!(base.value as any)?.sandbox_id)++// Load sandbox info and current version+const loadSandbox = async () => {+ if (!(base.value as any)?.sandbox_id || !base.value?.fk_workspace_id) return++ try {+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxGet',+ baseId: base.value.id,+ } as any)+ if (response) {+ sandbox.value = response+ }+ } catch (e) {+ console.error('Failed to load sandbox:', e)+ }+}++// Load current version info+const loadCurrentVersion = async () => {+ if (!base.value?.sandbox_version_id || !base.value?.fk_workspace_id) return++ try {+ // Get version details from versions list+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxVersionsList',+ sandboxId: (base.value as any).sandbox_id,+ } as any)+ if (response?.list) {+ currentVersion.value = response.list.find((v: any) => v.id === base.value.sandbox_version_id)+ }+ } catch (e) {+ console.error('Failed to load current version:', e)+ }+}++const openModal = (tab?: 'publish' | 'fork' | 'deployments') => {+ initialTab.value = tab+ isModalVisible.value = true+}++const handlePublished = async () => {+ await loadSandbox()+ await loadCurrentVersion()+}++const handleForked = async () => {+ await loadSandbox()+ await loadCurrentVersion()+}++watch(+ () => (base.value as any)?.sandbox_id,+ async (sandboxId) => {+ if (sandboxId) {+ await loadSandbox()+ await loadCurrentVersion()+ }+ },+ { immediate: true },+)+</script>++<template>+ <div v-if="isSandboxMaster" class="flex items-center gap-2">+ <!-- Version Badge (clickable to open modal) -->+ <div+ class="flex items-center gap-1.5 px-2.5 py-1 bg-nc-bg-gray-light rounded-md border border-nc-border-gray-medium cursor-pointer hover:bg-nc-bg-gray-medium transition-colors"+ @click="openModal()"+ >+ <GeneralIcon icon="ncInfoSolid" class="w-3.5 h-3.5 text-nc-content-gray" />+ <span class="text-xs font-mono font-semibold text-nc-content-gray-emphasis">v{{ currentVersion?.version || '1.0.0' }}</span>+ <div+ v-if="currentVersion?.status === 'draft'"+ class="ml-1 px-1.5 py-0.5 text-xs rounded bg-nc-bg-orange-light text-nc-content-orange-dark font-medium"+ >+ {{ $t('labels.draft') }}+ </div>+ <div+ v-else-if="currentVersion?.status === 'published'"+ class="ml-1 px-1.5 py-0.5 text-xs rounded bg-nc-bg-green-dark text-nc-content-green-dark font-medium"+ >+ {{ $t('labels.published') }}+ </div>+ </div>+ </div>++ <!-- Sandbox Modal -->+ <SmartsheetTopbarSandboxModal+ v-model:visible="isModalVisible"+ :sandbox="sandbox"+ :current-version="currentVersion"+ :initial-tab="initialTab"+ @published="handlePublished"+ @forked="handleForked"+ />+</template>diff --git a/packages/nc-gui/components/smartsheet/topbar/SandboxVersionDeploymentsModal.vue b/packages/nc-gui/components/smartsheet/topbar/SandboxVersionDeploymentsModal.vuenew file mode 100644index 0000000000..8385303087--- /dev/null+++ b/packages/nc-gui/components/smartsheet/topbar/SandboxVersionDeploymentsModal.vue@@ -0,0 +1,295 @@+<script setup lang="ts">+import { DeploymentStatus } from 'nocodb-sdk'++const props = defineProps<{+ visible: boolean+ sandbox: any+ version: any+}>()++const emit = defineEmits(['update:visible'])++const { $api } = useNuxtApp()+const { base } = storeToRefs(useBase())++const isLoading = ref(false)+const deployments = ref<any[]>([])+const pageInfo = ref<any>({})+const currentPage = ref(1)+const pageSize = 10++// Expanded deployment logs state+const expandedBaseId = ref<string | null>(null)+const deploymentLogs = ref<any[]>([])+const logsPageInfo = ref<any>({})+const logsCurrentPage = ref(1)+const logsPageSize = 10+const isLoadingLogs = ref(false)++const loadDeployments = async (page = 1) => {+ if (!props.sandbox?.id || !props.version?.versionId || !base.value?.fk_workspace_id) return++ isLoading.value = true+ try {+ const offset = (page - 1) * pageSize+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxVersionDeployments',+ sandboxId: props.sandbox.id,+ versionId: props.version.versionId,+ limit: pageSize,+ offset,+ } as any)++ if (response) {+ deployments.value = response.list || []+ pageInfo.value = response.pageInfo || {}+ currentPage.value = page+ }+ } catch (e: any) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ isLoading.value = false+ }+}++const loadDeploymentLogs = async (baseId: string, page = 1) => {+ if (!base.value?.fk_workspace_id) return++ isLoadingLogs.value = true+ try {+ const offset = (page - 1) * logsPageSize+ const response = await $api.internal.getOperation(base.value.fk_workspace_id, base.value.id!, {+ operation: 'sandboxDeploymentLogs',+ baseId,+ limit: logsPageSize,+ offset,+ } as any)++ if (response) {+ deploymentLogs.value = response.logs || []+ logsPageInfo.value = response.pageInfo || {}+ logsCurrentPage.value = page+ }+ } catch (e: any) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ isLoadingLogs.value = false+ }+}++const toggleExpand = async (deployment: any) => {+ if (expandedBaseId.value === deployment.baseId) {+ // Collapse+ expandedBaseId.value = null+ deploymentLogs.value = []+ logsCurrentPage.value = 1+ } else {+ // Expand and load logs+ expandedBaseId.value = deployment.baseId+ await loadDeploymentLogs(deployment.baseId, 1)+ }+}++const formatDate = (dateString: string) => {+ if (!dateString) return 'N/A'+ const date = new Date(dateString)+ return new Intl.DateTimeFormat('en-US', {+ year: 'numeric',+ month: 'short',+ day: 'numeric',+ hour: '2-digit',+ minute: '2-digit',+ }).format(date)+}++const getDeploymentTypeLabel = (type: string) => {+ const labels = {+ install: 'Initial Install',+ update: 'Update',+ }+ return labels[type as keyof typeof labels] || type+}++const getStatusColor = (status: string) => {+ const colors = {+ [DeploymentStatus.SUCCESS]: 'text-nc-content-green-dark bg-nc-bg-green-light',+ [DeploymentStatus.FAILED]: 'text-nc-content-red-dark bg-nc-bg-red-light',+ [DeploymentStatus.PENDING]: 'text-nc-content-orange-dark bg-nc-bg-orange-light',+ [DeploymentStatus.IN_PROGRESS]: 'text-nc-content-blue-dark bg-nc-bg-blue-light',+ }+ return colors[status as keyof typeof colors] || 'text-nc-content-gray bg-nc-bg-gray-light'+}++const handlePageChange = (page: number) => {+ loadDeployments(page)+}++const handleLogsPageChange = (page: number) => {+ if (expandedBaseId.value) {+ loadDeploymentLogs(expandedBaseId.value, page)+ }+}++watch(+ () => props.visible,+ (val) => {+ if (val) {+ loadDeployments(1)+ expandedBaseId.value = null+ deploymentLogs.value = []+ }+ },+)+</script>++<template>+ <GeneralModal :visible="visible" size="large" centered @update:visible="emit('update:visible', $event)">+ <div class="flex flex-col h-full max-h-[80vh]">+ <!-- Header -->+ <div class="flex items-center justify-between px-6 py-4 border-b border-nc-border-gray-medium">+ <div>+ <div class="font-semibold text-lg text-nc-content-gray-emphasis">Version Deployments</div>+ <div class="text-xs text-nc-content-gray-subtle2">+ Tracking deployments for+ <span class="font-mono font-semibold">v{{ version?.version }}</span>+ </div>+ </div>+ <GeneralIcon+ icon="close"+ class="w-5 h-5 text-nc-content-gray cursor-pointer hover:text-nc-content-gray-emphasis"+ @click="emit('update:visible', false)"+ />+ </div>++ <!-- Content -->+ <div class="flex-1 overflow-y-auto p-6">+ <div v-if="isLoading" class="flex items-center justify-center py-12">+ <a-spin size="large" />+ </div>++ <template v-else-if="deployments.length > 0">+ <div class="space-y-3">+ <div+ v-for="deployment in deployments"+ :key="deployment.baseId"+ class="bg-nc-bg-gray-light border border-nc-border-gray-light rounded-lg overflow-hidden"+ >+ <!-- Deployment Row -->+ <div class="p-4 cursor-pointer transition-colors" @click="toggleExpand(deployment)">+ <div class="flex items-center justify-between">+ <div class="flex items-center gap-4 flex-1">+ <!-- Expand Icon -->+ <GeneralIcon+ :icon="expandedBaseId === deployment.baseId ? 'ncChevronDown' : 'ncChevronRight'"+ class="w-4 h-4 text-nc-content-gray-subtle2 transition-transform"+ />++ <!-- Deployment Info -->+ <div class="flex items-center gap-3">+ <div class="p-2 bg-white dark:bg-nc-bg-gray-light rounded-md">+ <GeneralIcon icon="ncServer" class="w-4 h-4 text-nc-content-gray" />+ </div>+ <div>+ <div class="font-medium text-sm text-nc-content-gray-emphasis">{{ deployment.baseTitle }}</div>+ <div class="text-xs text-nc-content-gray-subtle2 mt-0.5">+ Installed: {{ formatDate(deployment.installedAt) }}+ </div>+ </div>+ </div>+ </div>++ <!-- Status Badge -->+ <div class="px-2.5 py-1 text-xs rounded-full font-semibold" :class="getStatusColor(deployment.status)">+ {{ deployment.status }}+ </div>+ </div>+ </div>++ <!-- Expanded Logs Section -->+ <div v-if="expandedBaseId === deployment.baseId" class="border-t border-nc-border-gray-medium">+ <div class="p-4 bg-nc-bg-gray-light">+ <div class="text-xs font-semibold text-nc-content-gray-emphasis mb-3 uppercase tracking-wide">+ Deployment History+ </div>++ <div v-if="isLoadingLogs" class="flex items-center justify-center py-8">+ <a-spin />+ </div>++ <template v-else-if="deploymentLogs.length > 0">+ <div class="space-y-2">+ <div v-for="log in deploymentLogs" :key="log.id" class="bg-white dark:bg-nc-bg-gray-light rounded-md p-3">+ <div class="flex items-start justify-between">+ <div class="flex-1">+ <div class="flex items-center gap-2 mb-1.5">+ <span class="px-2 py-0.5 text-xs rounded font-semibold" :class="getStatusColor(log.status)">+ {{ log.status }}+ </span>+ <span class="text-xs font-medium text-nc-content-gray">+ {{ getDeploymentTypeLabel(log.deploymentType) }}+ </span>+ </div>++ <div class="flex items-center gap-3 text-xs text-nc-content-gray-subtle2">+ <div v-if="log.fromVersion">+ <span class="font-mono">v{{ log.fromVersion.version }}</span>+ <GeneralIcon icon="arrowRight" class="inline-block w-3 h-3 mx-1" />+ </div>+ <span class="font-mono font-semibold">v{{ log.toVersion?.version }}</span>+ <span class="text-nc-content-gray-subtle2">β’</span>+ <span>{{ formatDate(log.createdAt) }}</span>+ </div>++ <div v-if="log.errorMessage" class="mt-2 text-xs text-nc-content-red-dark">+ {{ log.errorMessage }}+ </div>+ </div>+ </div>+ </div>+ </div>++ <!-- Logs Pagination -->+ <div v-if="logsPageInfo.totalRows > logsPageSize" class="flex justify-center mt-4">+ <a-pagination+ v-model:current="logsCurrentPage"+ :total="logsPageInfo.totalRows"+ :page-size="logsPageSize"+ :show-size-changer="false"+ size="small"+ @change="handleLogsPageChange"+ />+ </div>+ </template>++ <div v-else class="text-center py-8">+ <div class="text-sm text-nc-content-gray-subtle2">No deployment history available</div>+ </div>+ </div>+ </div>+ </div>+ </div>++ <!-- Deployments Pagination -->+ <div v-if="pageInfo.totalRows > pageSize" class="flex justify-center mt-6">+ <a-pagination+ v-model:current="currentPage"+ :total="pageInfo.totalRows"+ :page-size="pageSize"+ :show-size-changer="false"+ @change="handlePageChange"+ />+ </div>+ </template>++ <!-- Empty State -->+ <div v-else class="text-center py-16">+ <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-nc-bg-gray-light mb-4">+ <GeneralIcon icon="ncServer" class="w-8 h-8 text-nc-content-gray-subtle2" />+ </div>+ <div class="text-base font-medium text-nc-content-gray-emphasis mb-1">No deployments found</div>+ <div class="text-sm text-nc-content-gray-subtle2">No installations are using version {{ version?.version }}</div>+ </div>+ </div>+ </div>+ </GeneralModal>+</template>diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vueindex fc0c84dda7..a569da257f 100644--- a/packages/nc-gui/components/tabs/Smartsheet.vue+++ b/packages/nc-gui/components/tabs/Smartsheet.vue@@ -97,6 +97,18 @@ const extensionPaneRef = ref()const actionPaneRef = ref()+/*+ * NOTE:+ * Splitpanes internally schedules async resize/redo logic.+ * If the component is mounted/unmounted quickly (route change, fullscreen toggle),+ * those callbacks can run after unmount and crash with:+ * "Cannot read properties of null (reading 'children')".+ *+ * We delay rendering Splitpanes until the parent component is fully mounted+ * and show a loader meanwhile to ensure DOM stability.+ */+const isMounted = ref(false)+const onDrop = async (event: DragEvent) => {event.preventDefault()try {@@ -251,9 +263,15 @@ const checkIfViewExists = async () => {}onMounted(async () => {+ isMounted.value = true+await checkIfViewExists()})+onBeforeUnmount(() => {+ isMounted.value = false+})+watch(isViewsLoading, async () => {await checkIfViewExists()})@@ -269,7 +287,9 @@ watch(isViewsLoading, async () => {<SmartsheetTopbar v-if="!isFullScreen" /><div style="height: calc(100% - var(--topbar-height))"><NcFullScreen v-if="openedViewsTab === 'view'" v-model="isFullScreen" class="h-full" :page-only="true">+ <!-- Splitpanes is conditionally rendered only after mount to avoid race conditions with its internal async resize logic. --><Splitpanes+ v-if="isMounted"class="nc-extensions-content-resizable-wrapper":class="{'nc-is-open-extensions': isPanelExpanded,@@ -306,6 +326,9 @@ watch(isViewsLoading, async () => {<LazyExtensionsPane v-if="isPanelExpanded" ref="extensionPaneRef" /><LazyActionsPane v-if="isActionPanelExpanded" ref="actionPaneRef" /></Splitpanes>+ <div v-else class="flex items-center justify-center h-full w-full">+ <a-spin size="large" />+ </div></NcFullScreen><LazySmartsheetDetails v-else />diff --git a/packages/nc-gui/components/workspace/CreateProjectDlg.vue b/packages/nc-gui/components/workspace/CreateProjectDlg.vueindex f23223ae35..3143a4312e 100644--- a/packages/nc-gui/components/workspace/CreateProjectDlg.vue+++ b/packages/nc-gui/components/workspace/CreateProjectDlg.vue@@ -116,6 +116,20 @@ const onInit = () => {}, 5)}+const onSandboxInstalled = async (sandbox: any) => {+ // Close the dialog and refresh the base list+ dialogShow.value = false+ refreshCommandPalette()+ // Navigate to the newly installed base if available+ // TODO: Once install returns the new baseId, navigate to it+ // if (sandbox.installedBaseId) {+ // await navigateToProject({+ // workspaceId: activeWorkspace.value?.id,+ // baseId: sandbox.installedBaseId,+ // })+ // }+}+const handleResetInitialValue = () => {// Avoid unnecessary reset of initial valueif (!aiModeInitialValue.value.basePrompt && !route.value?.query?.basePrompt) return@@ -202,7 +216,12 @@ if (props.isCreateNewActionMenu) {</div></template><template v-if="aiMode === null">- <WorkspaceProjectCreateMode v-model:ai-mode="aiMode" />+ <WorkspaceProjectCreateMode+ v-model:ai-mode="aiMode"+ :workspace-id="activeWorkspace?.id"+ @sandbox-installed="onSandboxInstalled"+ @close="dialogShow = false"+ /></template><template v-if="aiMode === false"><div class="mt-1">diff --git a/packages/nc-gui/components/workspace/project/AppMarket.vue b/packages/nc-gui/components/workspace/project/AppMarket.vuenew file mode 100644index 0000000000..9f65410618--- /dev/null+++ b/packages/nc-gui/components/workspace/project/AppMarket.vue@@ -0,0 +1,220 @@+<script lang="ts" setup>+interface SandboxType {+ id: string+ title: string+ description?: string+ category?: string+ version?: string+ install_count?: number+}++interface Props {+ workspaceId: string+}++const props = defineProps<Props>()++const emit = defineEmits(['close', 'installed'])++const { $api } = useNuxtApp()+const { t } = useI18n()++const visible = ref(true)+const sandboxes = ref<SandboxType[]>([])+const loading = ref(false)+const installing = ref<string | null>(null)+const searchQuery = ref('')+const selectedCategory = ref<string | null>(null)++// Watch visible to emit close when modal is closed by clicking outside+watch(visible, (newVal) => {+ if (!newVal) {+ emit('close')+ }+})++const categories = computed(() => {+ const cats = new Set<string>()+ sandboxes.value.forEach((sb) => {+ if (sb.category) cats.add(sb.category)+ })+ return Array.from(cats).sort()+})++const filteredSandboxes = computed(() => {+ let filtered = sandboxes.value++ if (selectedCategory.value) {+ filtered = filtered.filter((sb) => sb.category === selectedCategory.value)+ }++ if (searchQuery.value) {+ const query = searchQuery.value.toLowerCase()+ filtered = filtered.filter(+ (sb) =>+ sb.title?.toLowerCase().includes(query) ||+ sb.description?.toLowerCase().includes(query) ||+ sb.category?.toLowerCase().includes(query),+ )+ }++ return filtered+})++const loadSandboxes = async () => {+ if (!props.workspaceId) {+ console.error('WorkspaceId is required')+ return+ }++ if (typeof props.workspaceId !== 'string') {+ console.error('WorkspaceId must be a string, got:', typeof props.workspaceId, props.workspaceId)+ return+ }++ loading.value = true+ try {+ const response = await $api.internal.getOperation(props.workspaceId, NO_SCOPE, {+ operation: 'sandboxStoreList',+ })++ sandboxes.value = response?.list || []+ } catch (e) {+ console.error('API error:', e)+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ loading.value = false+ }+}++const installSandbox = async (sandbox: SandboxType) => {+ installing.value = sandbox.id+ try {+ await $api.internal.postOperation(+ props.workspaceId,+ NO_SCOPE,+ {+ operation: 'sandboxInstall',+ },+ {+ sandboxId: sandbox.id,+ target_workspace_id: props.workspaceId,+ },+ )++ message.success(t('msg.success.baseInstalled'))+ emit('installed', sandbox)+ emit('close')+ } catch (e) {+ message.error(await extractSdkResponseErrorMsg(e))+ } finally {+ installing.value = null+ }+}++watch(+ () => props.workspaceId,+ (newVal) => {+ if (newVal) {+ loadSandboxes()+ }+ },+ { immediate: true },+)+</script>++<template>+ <NcModal v-model:visible="visible" :footer="null" size="large" @close="emit('close')">+ <template #header>+ <div class="flex items-center gap-3">+ <GeneralIcon icon="ncStore" class="h-5 w-5" />+ <span>{{ t('labels.appMarket') }}</span>+ </div>+ </template>++ <div class="flex flex-col gap-4 h-[600px]">+ <!-- Search and Filter Bar -->+ <div class="flex gap-3">+ <a-input v-model:value="searchQuery" class="flex-1" :placeholder="t('placeholder.searchByTitle')" allow-clear>+ <template #prefix>+ <GeneralIcon icon="search" class="h-4 w-4 text-gray-500" />+ </template>+ </a-input>++ <a-select v-model:value="selectedCategory" class="w-48" :placeholder="t('labels.category')" allow-clear>+ <a-select-option v-for="cat in categories" :key="cat" :value="cat">+ {{ cat }}+ </a-select-option>+ </a-select>+ </div>++ <!-- Sandbox List -->+ <div v-if="loading" class="flex items-center justify-center h-full">+ <a-spin size="large" />+ </div>++ <div v-else-if="filteredSandboxes.length === 0" class="flex flex-col items-center justify-center h-full gap-3">+ <GeneralIcon icon="inbox" class="h-16 w-16 text-gray-400" />+ <span class="text-gray-500">{{ t('msg.info.noSandboxesFound') }}</span>+ </div>++ <div v-else class="flex flex-col gap-3 overflow-y-auto pr-2">+ <div+ v-for="sandbox in filteredSandboxes"+ :key="sandbox.id"+ class="nc-sandbox-card border-1 border-gray-200 rounded-lg p-4 hover:shadow-md transition-all cursor-pointer"+ @click="installSandbox(sandbox)"+ >+ <div class="flex gap-4">+ <div class="flex-1">+ <div class="flex items-start justify-between gap-3 mb-2">+ <div class="flex-1">+ <h3 class="text-base font-semibold text-gray-800 mb-1">{{ sandbox.title }}</h3>+ <p class="text-sm text-gray-600 line-clamp-2">{{ sandbox.description }}</p>+ </div>+ <NcButton+ :loading="installing === sandbox.id"+ :disabled="!!installing"+ size="small"+ type="primary"+ @click.stop="installSandbox(sandbox)"+ >+ <template #icon>+ <GeneralIcon icon="download" />+ </template>+ {{ t('general.install') }}+ </NcButton>+ </div>++ <div class="flex items-center gap-4 text-xs text-gray-500 mt-3">+ <span v-if="sandbox.category" class="flex items-center gap-1">+ <GeneralIcon icon="tag" class="h-3 w-3" />+ {{ sandbox.category }}+ </span>+ <span class="flex items-center gap-1">+ <GeneralIcon icon="download" class="h-3 w-3" />+ {{ sandbox.install_count || 0 }} {{ t('labels.installs') }}+ </span>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </NcModal>+</template>++<style lang="scss" scoped>+.nc-sandbox-card {+ &:hover {+ @apply border-brand-500;+ }+}++.line-clamp-2 {+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+}+</style>diff --git a/packages/nc-gui/components/workspace/project/CreateMode.vue b/packages/nc-gui/components/workspace/project/CreateMode.vueindex 0f4bc784e6..6af9d8317e 100644--- a/packages/nc-gui/components/workspace/project/CreateMode.vue+++ b/packages/nc-gui/components/workspace/project/CreateMode.vue@@ -2,17 +2,62 @@import NcCreateBasePlaceholder from '~icons/nc-icons/create-base-placeholder'import NcCreateBaseWithAiPlaceholder from '~icons/nc-icons/create-base-with-ai-placeholder'+type CreateMode = 'scratch' | 'ai' | 'market' | null+interface Props {aiMode: boolean | null+ workspaceId?: string}+const props = withDefaults(defineProps<Props>(), {})-const emit = defineEmits(['update:aiMode'])+const emit = defineEmits(['update:aiMode', 'update:mode', 'sandboxInstalled', 'close'])const aiMode = useVModel(props, 'aiMode', emit)const { isAiFeaturesEnabled } = useNocoAi()+const { isFeatureEnabled } = useBetaFeatureToggle()++const showAppMarket = ref(false)++// Reset showAppMarket when aiMode changes back to null (dialog reopened)+watch(+ () => props.aiMode,+ (newVal) => {+ if (newVal === null) {+ showAppMarket.value = false+ }+ },+)++const selectMode = (mode: CreateMode) => {+ if (mode === 'ai') {+ aiMode.value = true+ } else if (mode === 'scratch') {+ aiMode.value = false+ } else if (mode === 'market') {+ if (!props.workspaceId) {+ console.error('Cannot open market without workspaceId')+ message.error('Workspace not available')+ return+ }+ showAppMarket.value = true+ return+ }+ emit('update:mode', mode)+}++const onSandboxInstalled = (sandbox: any) => {+ showAppMarket.value = false+ emit('sandboxInstalled', sandbox)+}++const onAppMarketClose = () => {+ showAppMarket.value = false+ emit('close')+}+onMounted(() => {if (!isAiFeaturesEnabled.value) {aiMode.value = false@@ -21,31 +66,57 @@ onMounted(() => {</script><template>- <div v-if="isAiFeaturesEnabled" class="nc-create-base-wrapper">- <div v-e="['c:base:create:scratch']" class="nc-create-base" @click="aiMode = false">- <div class="nc-placeholder-icon-wrapper">- <component :is="NcCreateBasePlaceholder" class="nc-placeholder-icon stroke-transparent" />- </div>- <div class="nc-create-base-content">- <div class="nc-create-base-content-title">- <GeneralIcon icon="plus" class="h-4 w-4 !text-nc-content-gray-subtle" />- Start from scratch+ <div>+ <div v-if="isAiFeaturesEnabled" class="nc-create-base-wrapper">+ <div v-e="['c:base:create:scratch']" class="nc-create-base" @click="selectMode('scratch')">+ <div class="nc-placeholder-icon-wrapper">+ <component :is="NcCreateBasePlaceholder" class="nc-placeholder-icon stroke-transparent" />+ </div>+ <div class="nc-create-base-content">+ <div class="nc-create-base-content-title">+ <GeneralIcon icon="plus" class="h-4 w-4 !text-nc-content-gray-subtle" />+ Start from scratch+ </div>+ <div class="nc-create-base-content-subtitle">Build your Base according to your specific requirements.</div></div>- <div class="nc-create-base-content-subtitle">Build your Base according to your specific requirements.</div></div>- </div>- <div v-e="['c:base:ai:create']" class="nc-create-base-ai" @click="aiMode = true">- <div class="nc-placeholder-icon-wrapper">- <component :is="NcCreateBaseWithAiPlaceholder" class="nc-placeholder-icon stroke-transparent" />+ <div v-e="['c:base:ai:create']" class="nc-create-base-ai" @click="selectMode('ai')">+ <div class="nc-placeholder-icon-wrapper">+ <component :is="NcCreateBaseWithAiPlaceholder" class="nc-placeholder-icon stroke-transparent" />+ </div>+ <div class="nc-create-base-content">+ <div class="nc-create-base-content-title">+ <GeneralIcon icon="ncAutoAwesome" class="h-4 w-4 !text-nc-fill-purple-dark" />+ Build Base with AI+ </div>+ <div class="nc-create-base-content-subtitle">Quickly build your ideal Base with all tables, views and fields.</div>+ </div></div>- <div class="nc-create-base-content">- <div class="nc-create-base-content-title">- <GeneralIcon icon="ncAutoAwesome" class="h-4 w-4 !text-nc-fill-purple-dark" />- Build Base with AI+ <div+ v-if="isFeatureEnabled(FEATURE_FLAG.SANDBOXES)"+ v-e="['c:base:market:create']"+ class="nc-create-base-market"+ @click="selectMode('market')"+ >+ <div class="nc-placeholder-icon-wrapper">+ <GeneralIcon icon="ncStore" class="nc-placeholder-icon !h-20 !w-20" />+ </div>+ <div class="nc-create-base-content">+ <div class="nc-create-base-content-title">+ <GeneralIcon icon="ncStore" class="h-4 w-4 !text-nc-content-gray-subtle" />+ Install from App Market+ </div>+ <div class="nc-create-base-content-subtitle">Browse and install pre-built Bases from the App Market.</div></div>- <div class="nc-create-base-content-subtitle">Quickly build your ideal Base with all tables, views and fields.</div></div></div>++ <WorkspaceProjectAppMarket+ v-if="showAppMarket && workspaceId"+ :workspace-id="workspaceId"+ @close="onAppMarketClose"+ @installed="onSandboxInstalled"+ /></div></template>@@ -76,6 +147,18 @@ onMounted(() => {}}+ &.nc-create-base-market {+ @apply border-nc-border-gray-medium;++ &:hover {+ box-shadow: 0px 12px 16px -4px rgba(107, 114, 128, 0.12), 0px 4px 6px -2px rgba(107, 114, 128, 0.08);+ }++ .nc-placeholder-icon-wrapper {+ @apply border-nc-border-gray-medium bg-nc-bg-gray-light;+ }+ }+&.nc-create-base-ai {@apply border-nc-border-purple-medium;diff --git a/packages/nc-gui/composables/useBetaFeatureToggle.ts b/packages/nc-gui/composables/useBetaFeatureToggle.tsindex 8957348592..f0f4685fd6 100644--- a/packages/nc-gui/composables/useBetaFeatureToggle.ts+++ b/packages/nc-gui/composables/useBetaFeatureToggle.ts@@ -2,11 +2,18 @@ import rfdc from 'rfdc'const deepClone = rfdc()const FEATURES = [+ {+ id: 'sandboxes',+ title: 'Sandboxes',+ description: 'Allow users to create replicable sandbox environments',+ enabled: false,+ isEngineering: true,+ isAdvanced: true,+ },{id: 'bases_v3',title: 'Bases V3',- description:- 'Experience the next generation of NocoDB with Bases V3, allowing duplicates with same id and enhanced performance.',+ description: 'Experience the next generation of NocoDB with Bases V3 with and enhanced performance and optimizations.',enabled: false,version: 1,},@@ -246,6 +253,8 @@ export const useBetaFeatureToggle = createSharedComposable(() => {const isEngineeringModeOn = ref(false)+ const isAdvancedModeOn = ref(false)+const isExperimentalFeatureModalOpen = ref(false)const saveFeatures = () => {@@ -328,6 +337,7 @@ export const useBetaFeatureToggle = createSharedComposable(() => {toggleFeature,isFeatureEnabled,isEngineeringModeOn,+ isAdvancedModeOn,isExperimentalFeatureModalOpen,initializeFeatures,}diff --git a/packages/nc-gui/composables/useNocoAi.ts b/packages/nc-gui/composables/useNocoAi.tsindex 1912196e3c..465aef742b 100644--- a/packages/nc-gui/composables/useNocoAi.ts+++ b/packages/nc-gui/composables/useNocoAi.ts@@ -1,4 +1,4 @@-import type { IntegrationType, SerializedAiViewType, TableType } from 'nocodb-sdk'+import { BaseVersion, type IntegrationType, type SerializedAiViewType, type TableType } from 'nocodb-sdk'const aiIntegrationNotFound = 'AI integration not found'@@ -110,7 +110,11 @@ export const useNocoAi = createSharedComposable(() => {aiLoading.value = trueaiError.value = ''- const res = await $api.ai.schemaCreate(workspaceStore.activeWorkspaceId, { operation, input })+ const res = await $api.ai.schemaCreate(workspaceStore.activeWorkspaceId, {+ operation,+ input,+ ...(isFeatureEnabled(FEATURE_FLAG.BASES_V3) ? { version: BaseVersion.V3 } : {}),+ })return res} catch (e) {diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.jsonindex 17130fca58..88eaa48069 100644--- a/packages/nc-gui/lang/en.json+++ b/packages/nc-gui/lang/en.json@@ -448,6 +448,8 @@"billable": "Billable","total": "Total","downgrade": "Downgrade",+ "publish": "Publish",+ "unpublish": "Unpublish","upgrade": "Upgrade","upgradeNow": "Upgrade Now","reviewAndUpgrade": "Review & Upgrade",@@ -1049,6 +1051,8 @@"relevantDocumentation": "Relevant documentation"},"labels": {+ "appMarket": "App Market",+ "installs": "installs","checkingDependencies": "Checking Dependencies","changingConfigWillImpact": "Changing this will impact {count} dependencies","changingEntityWillImpact": "{action} this {entity} will impact {count} dependencies",@@ -1168,6 +1172,23 @@"visibilityAndDataHandling": "Visibility & Data Handling","visibilityConfigLabel": "Base specific additional configurations to customise data display & default behaviours.","migrateToV3": "Migrate to V3",+ "sandbox": "Sandbox",+ "sandboxAppStore": "Sandbox App Store",+ "baseMustBeV3": "Base must be V3",+ "createSandbox": "Create Sandbox",+ "sandboxDetails": "Sandbox Details",+ "publishToAppStore": "Publish to App Store",+ "publishChanges": "Publish Changes",+ "publishingChanges": "Publishing changes",+ "unpublish": "Unpublish",+ "updateDetails": "Update Details",+ "published": "Published",+ "draft": "Draft",+ "sandboxTitle": "Title",+ "sandboxDescription": "Description",+ "sandboxCategory": "Category",+ "sandboxTags": "Tags",+ "sandboxVisibility": "Visibility","snapShotSubText": "Snapshots serve as comprehensive backups of your base, capturing its state at the time of creation. Restoring a snapshot creates a new instance of the base in the designated workspace.","newSnapshot": "New Snapshot","searchASnapshot": "Search a snapshot",@@ -1707,7 +1728,9 @@"showFieldHeader": "Show field header","cellsSelected": "cells selected","recordSelected": "record selected",- "recordsSelected": "records selected"+ "recordsSelected": "records selected",+ "saveChanges": "Save changes",+ "publishing": "Publishing"},"activity": {"clickToResolve": "Click to resolve",@@ -2138,6 +2161,7 @@"syncScopeNotEditableInEditMode": "Sync scope can't be modified"},"placeholder": {+ "searchByTitle": "Search by title or description","enterSyncName": "Enter sync name","searchIcons": "Search icons","selectSlackChannels": "Select Slack channels",@@ -2454,6 +2478,7 @@"deleteProject": "Do you want to delete the base?","shareBasePrivate": "Generate publicly shareable readonly base","shareBasePublic": "Anyone on the internet with this link can view",+ "noSandboxesFound": "No apps found in the marketplace","userInviteNoSMTP": "Looks like you have not configured mailer yet! Please copy above invite link and send it to","dragDropHide": "Drag and drop fields here to hide","formInput": "Enter form input label",@@ -2780,6 +2805,11 @@},"success": {"passwordSet": "Password set successfully",+ "sandboxCreated": "Sandbox created successfully",+ "sandboxUpdated": "Sandbox updated successfully",+ "sandboxPublished": "Sandbox published successfully",+ "sandboxUnpublished": "Sandbox unpublished successfully",+ "changesPublished": "Changes published to all installations successfully","mcpTokenDeleted": "MCP Token Deleted","mcpTokenUpdated": "MCP Token Updated","mcpTokenCreated": "MCP Token Created",@@ -2805,6 +2835,7 @@"userAdded": "Successfully added user","userDeletedFromProject": "Successfully deleted user from base","inviteEmailSent": "Invite Email sent successfully",+ "baseInstalled": "Base installed successfully","inviteURLCopied": "Invite URL copied to clipboard","commentCopied": "Comment copied to clipboard","passwordResetURLCopied": "Password reset URL copied to clipboard",diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.tsindex 40933e759f..f6209baab1 100644--- a/packages/nc-gui/lib/types.ts+++ b/packages/nc-gui/lib/types.ts@@ -224,6 +224,12 @@ type NcProject = BaseType & {users?: User[]default_role?: ProjectRoles | stringversion?: BaseVersion+ // Sandbox fields+ sandbox_master?: boolean+ sandbox_id?: string+ sandbox_version_id?: string+ auto_update?: boolean+ sandbox_schema_locked?: boolean}interface UndoRedoAction {diff --git a/packages/nc-gui/store/base.ts b/packages/nc-gui/store/base.tsindex 85fc1e67d2..3f2458b55b 100644--- a/packages/nc-gui/store/base.ts+++ b/packages/nc-gui/store/base.ts@@ -18,6 +18,8 @@ export const useBase = defineStore('baseStore', () => {const basesStore = useBases()+ const isSandboxMaster = ref(false)+const baseId = computed(() => {// In shared base mode, use activeProjectId from basesStore which has the correct base IDif (route.value.params.typeOrId === 'base') {@@ -340,6 +342,7 @@ export const useBase = defineStore('baseStore', () => {idUserMap,isPrivateBase,showBaseAccessRequestOverlay,+ isSandboxMaster,}})diff --git a/packages/noco-integrations/core/src/index.ts b/packages/noco-integrations/core/src/index.tsindex 2c00a34330..c8d39c16f4 100644--- a/packages/noco-integrations/core/src/index.ts+++ b/packages/noco-integrations/core/src/index.ts@@ -16,4 +16,4 @@ export type {TicketingUserRecord,TicketingCommentRecord,TicketingTeamRecord,-} from './sync/schema-ticketing';\ No newline at end of file+} from './sync/schema-ticketing';diff --git a/packages/nocodb-sdk/src/lib/globals.ts b/packages/nocodb-sdk/src/lib/globals.tsindex e253ff306e..ab3023160a 100644--- a/packages/nocodb-sdk/src/lib/globals.ts+++ b/packages/nocodb-sdk/src/lib/globals.ts@@ -368,3 +368,26 @@ export enum BaseVersion {V2 = 2,V3 = 3,}++export enum SandboxVersionStatus {+ DRAFT = 'draft',+ PUBLISHED = 'published',+}++export enum SandboxVisibility {+ PUBLIC = 'public',+ PRIVATE = 'private',+ UNLISTED = 'unlisted',+}++export enum DeploymentStatus {+ PENDING = 'pending',+ IN_PROGRESS = 'in_progress',+ SUCCESS = 'success',+ FAILED = 'failed',+}++export enum DeploymentType {+ INSTALL = 'install',+ UPDATE = 'update',+}diff --git a/packages/nocodb-sdk/src/lib/ncTypes.ts b/packages/nocodb-sdk/src/lib/ncTypes.tsindex fbbc8872c6..724c947d36 100644--- a/packages/nocodb-sdk/src/lib/ncTypes.ts+++ b/packages/nocodb-sdk/src/lib/ncTypes.ts@@ -18,6 +18,7 @@ export interface NcContext {timezone?: string;suppressDependencyEvaluation?: boolean;additionalContext?: Record<string, any>;+ schema_locked?: boolean;}export interface NcRequest extends Partial<Request> {diff --git a/packages/nocodb-sdk/src/lib/realtime/index.ts b/packages/nocodb-sdk/src/lib/realtime/index.tsindex 29245afcef..c0825fa1d4 100644--- a/packages/nocodb-sdk/src/lib/realtime/index.ts+++ b/packages/nocodb-sdk/src/lib/realtime/index.ts@@ -1,10 +1,11 @@-import { UserType } from '~/lib/Api';+import { UserType, NotificationType } from '~/lib/Api';export enum EventType {HANDSHAKE = 'handshake',CONNECTION_WELCOME = 'connection-welcome',CONNECTION_ERROR = 'connection-error',NOTIFICATION = 'notification',+ NOTIFICATION_EVENT = 'event-notification',USER_EVENT = 'event-user',DATA_EVENT = 'event-data',META_EVENT = 'event-meta',@@ -104,16 +105,23 @@ export interface UserEventPayload<T = any> extends BaseSocketPayload {workspaceId?: string;}+export interface NotificationPayload extends BaseSocketPayload {+ action: 'create';+ payload: Partial<NotificationType>;+}+// Union type for all socket event payloadsexport type SocketEventPayload =| ConnectionWelcomePayload| ConnectionErrorPayload| DataPayload| MetaPayload- | CommentPayload;+ | CommentPayload+ | NotificationPayload;// Type mapping for event types to their corresponding payloadsexport type SocketEventPayloadMap = {+ [EventType.NOTIFICATION_EVENT]: NotificationPayload;[EventType.CONNECTION_WELCOME]: ConnectionWelcomePayload;[EventType.CONNECTION_ERROR]: ConnectionErrorPayload;[EventType.DATA_EVENT]: DataPayload;diff --git a/packages/nocodb/src/controllers/internal/modules/UiGet.operations.ts b/packages/nocodb/src/controllers/internal/modules/UiGet.operations.tsindex 6767a7a49c..a260c3904e 100644--- a/packages/nocodb/src/controllers/internal/modules/UiGet.operations.ts+++ b/packages/nocodb/src/controllers/internal/modules/UiGet.operations.ts@@ -18,6 +18,7 @@ import { HooksService } from '~/services/hooks.service';import { FormsService } from '~/services/forms.service';import { MapsService } from '~/services/maps.service';import { CommentsService } from '~/services/comments.service';+import { SyncService } from '~/services/sync.service';@Injectable()export class UiGetOperations@@ -36,6 +37,7 @@ export class UiGetOperationsprotected formsService: FormsService,protected mapsService: MapsService,protected commentsService: CommentsService,+ protected syncService: SyncService,) {}operations = ['nestedDataList' as const,@@ -61,6 +63,7 @@ export class UiGetOperations'commentCount' as const,'dataList' as const,'linkDataList' as const,+ 'syncSourceList' as const,];httpMethod = 'GET' as const;@@ -217,6 +220,11 @@ export class UiGetOperationsreq,linkColumnId: req.query.columnId as string,});+ case 'syncSourceList':+ return await this.syncService.syncSourceList(context, {+ baseId: context.base_id,+ sourceId: req.query.sourceId as string,+ });}}}diff --git a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.tsindex 85ccd1de56..defa39401c 100644--- a/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts+++ b/packages/nocodb/src/controllers/internal/modules/UiPost.operations.ts@@ -24,6 +24,11 @@ import { MapsService } from '~/services/maps.service';import { CalendarsService } from '~/services/calendars.service';import { CommentsService } from '~/services/comments.service';import { BulkDataAliasService } from '~/services/bulk-data-alias.service';+import { SyncService } from '~/services/sync.service';+import { SyncSource } from '~/models';+import { NcError } from '~/helpers/catchError';+import { JobTypes } from '~/interface/Jobs';+import { NocoJobsService } from '~/services/noco-jobs.service';@Injectable()export class UiPostOperations@@ -49,6 +54,8 @@ export class UiPostOperationsprotected calendarsService: CalendarsService,protected commentsService: CommentsService,protected bulkDataAliasService: BulkDataAliasService,+ protected syncService: SyncService,+ protected readonly nocoJobsService: NocoJobsService,) {}operations = ['tableUpdate' as const,@@ -113,7 +120,11 @@ export class UiPostOperations'commentResolve' as const,'dataDelete' as const,'bulkDataDeleteAll' as const,- ] satisfies ReadonlyArray<keyof typeof OPERATION_SCOPES>;+ 'syncSourceCreate' as const,+ 'syncSourceUpdate' as const,+ 'syncSourceDelete' as const,+ 'atImportTrigger' as const,+ ];httpMethod = 'POST' as const;async handle(@@ -529,6 +540,62 @@ export class UiPostOperationsbaseId: req.query.baseId as string,body: payload,});+ case 'syncSourceCreate':+ return await this.syncService.syncCreate(context, {+ baseId: context.base_id,+ sourceId: req.query.sourceId as string,+ userId: (req as any).user.id,+ syncPayload: payload,+ req,+ });+ case 'syncSourceUpdate':+ return await this.syncService.syncUpdate(context, {+ syncId: req.query.syncId as string,+ syncPayload: payload,+ req,+ });+ case 'syncSourceDelete':+ return await this.syncService.syncDelete(context, {+ syncId: req.query.syncId as string,+ req,+ });+ case 'atImportTrigger': {+ const jobs = await this.nocoJobsService.getJobList();+ const fnd = jobs.find((j) => j.data.syncId === req.query.syncId);++ if (fnd) {+ NcError.badRequest('Sync already in progress');+ }++ const syncSource = await SyncSource.get(+ context,+ req.query.syncId as string,+ );++ const user = await syncSource.getUser();++ // Treat default baseUrl as siteUrl from req object+ let baseURL = (req as any).ncSiteUrl;++ // if environment value avail use it+ // or if it's docker construct using `PORT`+ if (process.env.NC_DOCKER) {+ baseURL = `http://localhost:${process.env.PORT || 8080}`;+ }++ const job = await this.nocoJobsService.add(JobTypes.AtImport, {+ context,+ syncId: req.query.syncId as string,+ ...(syncSource?.details || {}),+ baseId: syncSource.base_id,+ sourceId: syncSource.source_id,+ authToken: '',+ baseURL,+ user: user,+ });++ return { id: job.id };+ }}}}diff --git a/packages/nocodb/src/controllers/internal/operationScopes.ts b/packages/nocodb/src/controllers/internal/operationScopes.tsindex f5558684ce..2248696fe0 100644--- a/packages/nocodb/src/controllers/internal/operationScopes.ts+++ b/packages/nocodb/src/controllers/internal/operationScopes.ts@@ -104,5 +104,31 @@ export const OPERATION_SCOPES = {dataList: 'base',linkDataList: 'base',dataDelete: 'base',+ dataDeleteAll: 'base',bulkDataDeleteAll: 'base',++ // AT Import+ syncSourceList: 'base',+ syncSourceCreate: 'base',+ syncSourceUpdate: 'base',+ syncSourceDelete: 'base',+ atImportTrigger: 'base',++ // Sandbox Operations+ sandboxStoreList: 'org',+ sandboxList: 'workspace',+ sandboxGet: 'org',+ sandboxCreate: 'workspace',+ sandboxUpdate: 'base',+ sandboxDelete: 'base',+ sandboxPublish: 'base',+ sandboxCreateDraft: 'base',+ sandboxUnpublish: 'base',+ sandboxInstall: 'workspace',+ sandboxGetUpdates: 'base',+ sandboxVersionsList: 'base',+ sandboxInstallationsList: 'base',+ sandboxDeployments: 'base',+ sandboxVersionDeployments: 'base',+ sandboxDeploymentLogs: 'base',} as const;diff --git a/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts b/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.tsindex f09d525dff..272031a3bf 100644--- a/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2/relation-data-fetcher.ts@@ -24,23 +24,24 @@ export const relationDataFetcher = (param: {context: NcContext,{data,- model,- query,}: {data: any[];model: Model;query: any;},) {- // get ast- const { ast, parsedQuery } = await getAst(context, {- model,- query,- extractOnlyPrimaries: false,- });- // nocoexecute- const result = await nocoExecute(ast, data, {}, parsedQuery);- return result;+ return data;++ // FIXME: reopen when we have fixed nocoexecute+ // // get ast+ // const { ast, parsedQuery } = await getAst(context, {+ // model,+ // query,+ // extractOnlyPrimaries: false,+ // });+ // // nocoexecute+ // const result = await nocoExecute(ast, data, {}, parsedQuery);+ // return result;}return {diff --git a/packages/nocodb/src/helpers/NcErrorV1.ts b/packages/nocodb/src/helpers/NcErrorV1.tsindex 2dcfedbf9b..4de8f98854 100644--- a/packages/nocodb/src/helpers/NcErrorV1.ts+++ b/packages/nocodb/src/helpers/NcErrorV1.ts@@ -126,4 +126,19 @@ export class NcErrorV1 extends NcErrorBase {// backward compatibility for v1 and v2 apisreturn this.badRequest(message);}++ sourceDataReadOnly(name: string): never {+ return this.forbidden(`Source '${name}' is read-only`);+ }++ sourceMetaReadOnly(name: string): never {+ return this.forbidden(`Source '${name}' schema is read-only`);+ }++ schemaLocked(message?: string): never {+ return this.forbidden(+ message ||+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }}diff --git a/packages/nocodb/src/interface/Jobs.ts b/packages/nocodb/src/interface/Jobs.tsindex 164dda3477..fc012e1820 100644--- a/packages/nocodb/src/interface/Jobs.ts+++ b/packages/nocodb/src/interface/Jobs.ts@@ -61,6 +61,7 @@ export enum JobTypes {WorkflowResumeSchedule = 'workflow-resume-schedule',ResumeWorkflow = 'resume-workflow',TestWorkflowNode = 'test-workflow-node',+ HeartbeatWorkflow = 'heartbeat-workflow',}export const SKIP_STORING_JOB_META = [@@ -79,6 +80,7 @@ export const SKIP_STORING_JOB_META = [JobTypes.WorkflowCronSchedule,JobTypes.WorkflowResumeSchedule,JobTypes.ResumeWorkflow,+ JobTypes.HeartbeatWorkflow,];export enum JobStatus {@@ -289,3 +291,7 @@ export interface TestWorkflowNodeJobData extends JobData {nodeId: string;testTriggerData?: any;}++export interface HeartbeatWorkflowJobData extends JobData {+ workflowId: string;+}diff --git a/packages/nocodb/src/meta/meta.service.ts b/packages/nocodb/src/meta/meta.service.tsindex b5c0942b8b..fe20b92fd5 100644--- a/packages/nocodb/src/meta/meta.service.ts+++ b/packages/nocodb/src/meta/meta.service.ts@@ -131,6 +131,9 @@ export class MetaService {[MetaTable.INSTALLATIONS]: 'inst',[MetaTable.AUTOMATIONS]: 'aut',[MetaTable.AUTOMATION_EXECUTIONS]: 'auex',+ [MetaTable.SANDBOXES]: 'sb',+ [MetaTable.SANDBOX_VERSIONS]: 'sbv',+ [MetaTable.SANDBOX_DEPLOYMENT_LOGS]: 'sbdl',};const prefix = prefixMap[target] || 'nc';diff --git a/packages/nocodb/src/meta/migrations/XcMigrationSourcev0.ts b/packages/nocodb/src/meta/migrations/XcMigrationSourcev0.tsindex f449f77637..5e3283df6e 100644--- a/packages/nocodb/src/meta/migrations/XcMigrationSourcev0.ts+++ b/packages/nocodb/src/meta/migrations/XcMigrationSourcev0.ts@@ -11,6 +11,7 @@ import * as nc_010_add_constraints_col_in_column_table from './v0/nc_010_add_conimport * as nc_011_merge_workflows_scripts from './v0/nc_011_merge_workflows_scripts';import * as nc_012_workflow_delay from './v0/nc_012_workflow_delay';import * as nc_013_composite_pk_missing_tables from './v0/nc_013_composite_pk_missing_tables';+import * as nc_014_sandboxes from './v0/nc_014_sandboxes';// Create a custom migration source classexport default class XcMigrationSourcev0 {@@ -33,6 +34,7 @@ export default class XcMigrationSourcev0 {'nc_011_merge_workflows_scripts','nc_012_workflow_delay','nc_013_composite_pk_missing_tables',+ 'nc_014_sandboxes',]);}@@ -68,6 +70,8 @@ export default class XcMigrationSourcev0 {return nc_012_workflow_delay;case 'nc_013_composite_pk_missing_tables':return nc_013_composite_pk_missing_tables;+ case 'nc_014_sandboxes':+ return nc_014_sandboxes;}}}diff --git a/packages/nocodb/src/meta/migrations/v0/nc_014_sandboxes.ts b/packages/nocodb/src/meta/migrations/v0/nc_014_sandboxes.tsnew file mode 100644index 0000000000..6f670ea3ed--- /dev/null+++ b/packages/nocodb/src/meta/migrations/v0/nc_014_sandboxes.ts@@ -0,0 +1,196 @@+import type { Knex } from 'knex';+import { MetaTable } from '~/utils/globals';++const up = async (knex: Knex) => {+ // Create sandboxes table+ await knex.schema.createTable(MetaTable.SANDBOXES, (table) => {+ table.string('id', 20).primary();+ table.string('fk_workspace_id', 20).notNullable();+ table.string('base_id', 20).notNullable().unique();++ table.string('title', 255).notNullable();+ table.text('description');++ // Owner of the sandbox app+ table.string('created_by', 20).notNullable();++ // Visibility in app store: 'public', 'private', 'unlisted'+ table.string('visibility', 20).notNullable().defaultTo('private');++ // Category for filtering in app store+ table.string('category', 255);++ // Installation/usage stats+ table.integer('install_count').unsigned().defaultTo(0);++ table.text('meta');++ // Soft delete support+ table.boolean('deleted').defaultTo(false);++ // Timestamps+ table.timestamps(true, true);++ // When first version was published+ table.timestamp('published_at');++ // Indexes for performance+ table.index(['fk_workspace_id'], 'nc_sandboxes_workspace_id_idx');+ table.index(['created_by'], 'nc_sandboxes_created_by_idx');+ table.index(['base_id'], 'nc_sandboxes_base_id_idx');+ table.index(['visibility'], 'nc_sandboxes_visibility_idx');+ table.index(['category'], 'nc_sandboxes_category_idx');+ table.index(['deleted'], 'nc_sandboxes_deleted_idx');+ });++ // Create sandbox_versions table to store serialized schemas for each published version+ await knex.schema.createTable(MetaTable.SANDBOX_VERSIONS, (table) => {+ table.string('id', 20).primary();+ table.string('fk_workspace_id', 20).notNullable();+ table.string('fk_sandbox_id', 20).notNullable();++ // Version information (semantic versioning)+ table.string('version', 20).notNullable();+ table.integer('version_number').unsigned().notNullable();++ // Status: 'draft' (editable) or 'published' (locked)+ // Once published, no more changes allowed on this version+ table.string('status', 20).notNullable().defaultTo('draft');++ // Serialized schema snapshot for this version (JSON)+ table.text('schema');++ // Optional release notes for this version+ table.text('release_notes');++ // Timestamps+ table.timestamps(true, true);++ // When this version was published (NULL for drafts)+ table.timestamp('published_at');++ // Composite unique constraint: one schema per version per sandbox+ table.unique(['fk_sandbox_id', 'version'], {+ indexName: 'nc_sandbox_versions_unique_idx',+ });+ table.unique(['fk_sandbox_id', 'version_number'], {+ indexName: 'nc_sandbox_versions_number_unique_idx',+ });++ // Indexes for performance+ table.index(['fk_sandbox_id'], 'nc_sandbox_versions_sandbox_id_idx');+ table.index(['fk_workspace_id'], 'nc_sandbox_versions_workspace_id_idx');+ table.index(['fk_sandbox_id', 'status'], 'nc_sandbox_versions_status_idx');+ table.index(+ ['fk_sandbox_id', 'version_number'],+ 'nc_sandbox_versions_ordering_idx',+ );+ });++ // Add sandbox-related columns to bases table+ await knex.schema.alterTable(MetaTable.PROJECT, (table) => {+ // Is this base a sandbox master?+ table.boolean('sandbox_master').defaultTo(false);++ // Points to SANDBOXES.id (for both master and installed instances)+ table.string('sandbox_id', 20);++ // Current version: for master=draft/published being worked on, for installed=installed version+ // Points to SANDBOX_VERSIONS.id+ table.string('sandbox_version_id', 20);++ // For installed instances: auto-update to new published versions+ table.boolean('auto_update').defaultTo(true);+ });++ // Add indexes for sandbox relationship columns+ await knex.schema.alterTable(MetaTable.PROJECT, (table) => {+ table.index(['sandbox_master'], 'nc_bases_sandbox_master_idx');+ table.index(['sandbox_id'], 'nc_bases_sandbox_id_idx');+ table.index(['sandbox_version_id'], 'nc_bases_sandbox_version_id_idx');+ table.index(+ ['sandbox_id', 'auto_update'],+ 'nc_bases_sandbox_auto_update_idx',+ );+ });++ // Create sandbox_deployment_logs table+ await knex.schema.createTable(MetaTable.SANDBOX_DEPLOYMENT_LOGS, (table) => {+ table.string('id', 20).primary();+ table.string('fk_workspace_id', 20).notNullable();++ // Installation reference+ table.string('base_id', 20).notNullable(); // The installed base+ table.string('fk_sandbox_id', 20).notNullable(); // The sandbox being deployed++ // Version tracking+ table.string('from_version_id', 20); // NULL for initial install+ table.string('to_version_id', 20).notNullable(); // Target version++ // Deployment status: 'pending', 'in_progress', 'success', 'failed'+ table.string('status', 20).notNullable().defaultTo('pending');++ // Deployment type: 'install', 'update'+ table.string('deployment_type', 20).notNullable();++ // Deployment details+ table.text('error_message'); // Error message if failed+ table.text('deployment_log'); // Detailed logs (JSON or text)+ table.text('meta'); // Additional metadata (JSON)++ // Timestamps+ table.timestamps(true, true);+ table.timestamp('started_at');+ table.timestamp('completed_at');++ // Indexes for performance+ table.index(+ ['fk_workspace_id'],+ 'nc_sandbox_deployment_logs_workspace_id_idx',+ );+ table.index(['base_id'], 'nc_sandbox_deployment_logs_base_id_idx');+ table.index(['fk_sandbox_id'], 'nc_sandbox_deployment_logs_sandbox_id_idx');+ table.index(+ ['base_id', 'created_at'],+ 'nc_sandbox_deployment_logs_base_created_idx',+ );+ table.index(['status'], 'nc_sandbox_deployment_logs_status_idx');+ table.index(+ ['from_version_id'],+ 'nc_sandbox_deployment_logs_from_version_idx',+ );+ table.index(['to_version_id'], 'nc_sandbox_deployment_logs_to_version_idx');+ });+};++const down = async (knex: Knex) => {+ // Drop sandbox_deployment_logs table+ await knex.schema.dropTable(MetaTable.SANDBOX_DEPLOYMENT_LOGS);++ // Drop sandbox_versions table+ await knex.schema.dropTable(MetaTable.SANDBOX_VERSIONS);++ // Drop indexes from bases table+ await knex.schema.alterTable(MetaTable.PROJECT, (table) => {+ table.dropIndex(+ ['sandbox_id', 'auto_update'],+ 'nc_bases_sandbox_auto_update_idx',+ );+ table.dropIndex(['sandbox_version_id'], 'nc_bases_sandbox_version_id_idx');+ table.dropIndex(['sandbox_id'], 'nc_bases_sandbox_id_idx');+ table.dropIndex(['sandbox_master'], 'nc_bases_sandbox_master_idx');+ });++ // Drop sandbox columns from bases table+ await knex.schema.alterTable(MetaTable.PROJECT, (table) => {+ table.dropColumn('auto_update');+ table.dropColumn('sandbox_version_id');+ table.dropColumn('sandbox_id');+ table.dropColumn('sandbox_master');+ });++ // Drop sandboxes table+ await knex.schema.dropTable(MetaTable.SANDBOXES);+};++export { up, down };diff --git a/packages/nocodb/src/models/Base.ts b/packages/nocodb/src/models/Base.tsindex 241a8b083c..942ea35641 100644--- a/packages/nocodb/src/models/Base.ts+++ b/packages/nocodb/src/models/Base.ts@@ -54,6 +54,13 @@ export default class Base implements BaseType {roles?: string;fk_custom_url_id?: string;+ // sandbox props+ sandbox_master?: boolean; // Is this base a sandbox master?+ sandbox_id?: string; // Points to SANDBOXES (for both master and installed instances)+ sandbox_version_id?: string; // Current version ID from SANDBOX_VERSIONS+ auto_update?: boolean; // For installed instances: auto-update to new published versions+ sandbox_schema_locked?: boolean; // Computed: whether schema modifications are allowed+constructor(base: Partial<Base>) {Object.assign(this, base);}@@ -62,6 +69,10 @@ export default class Base implements BaseType {return base && new Base(base);}+ public static async computeSchemaLocked(_base: Base): Promise<boolean> {+ return false;+ }+public static async createProject(base: Partial<BaseType>,ncMeta = Noco.ncMeta,@@ -77,6 +88,10 @@ export default class Base implements BaseType {'color','order','version',+ 'sandbox_master',+ 'sandbox_id',+ 'sandbox_version_id',+ 'auto_update',]);if (!insertObj.order) {@@ -272,7 +287,14 @@ export default class Base implements BaseType {baseData = null;}}- return this.castType(baseData);+ const base = this.castType(baseData);++ // Compute sandbox_schema_locked+ if (base && base.sandbox_id) {+ base.sandbox_schema_locked = await this.computeSchemaLocked(base);+ }++ return base;}async getSources(@@ -348,6 +370,11 @@ export default class Base implements BaseType {if (baseData) {const base = this.castType(baseData);+ // Compute sandbox_schema_locked+ if (base.sandbox_id) {+ base.sandbox_schema_locked = await this.computeSchemaLocked(base);+ }+await base.getSources(includeConfig, ncMeta);return base;@@ -444,6 +471,10 @@ export default class Base implements BaseType {'password','roles','version',+ 'sandbox_master',+ 'sandbox_id',+ 'sandbox_version_id',+ 'auto_update',]);// stringify metadiff --git a/packages/nocodb/src/modules/jobs/jobs.module.ts b/packages/nocodb/src/modules/jobs/jobs.module.tsindex ce8331edc1..33988bc9f5 100644--- a/packages/nocodb/src/modules/jobs/jobs.module.ts+++ b/packages/nocodb/src/modules/jobs/jobs.module.ts@@ -133,7 +133,7 @@ export const JobsModuleMetadata = {RecoverDisconnectedTableNames,AuditMigration,],- exports: ['JobsService', JobsLogService],+ exports: ['JobsService', JobsLogService, DuplicateProcessor],};@Module(JobsModuleMetadata)diff --git a/packages/nocodb/src/services/calendars.service.ts b/packages/nocodb/src/services/calendars.service.tsindex 6c8f598eec..712ef37a8e 100644--- a/packages/nocodb/src/services/calendars.service.ts+++ b/packages/nocodb/src/services/calendars.service.ts@@ -44,6 +44,12 @@ export class CalendarsService {param.calendar,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId, ncMeta);param.calendar.title = param.calendar.title?.trim();diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.tsindex 45b04a43e7..a4d5ffed94 100644--- a/packages/nocodb/src/services/columns.service.ts+++ b/packages/nocodb/src/services/columns.service.ts@@ -449,6 +449,12 @@ export class ColumnsService implements IColumnsService {const isSyncedColumn = table.synced && column.readonly;+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const source = await reuseOrSave('source', reuse, async () =>Source.get(context, table.source_id),);@@ -2468,6 +2474,12 @@ export class ColumnsService implements IColumnsService {}),);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const source = await reuseOrSave('source', reuse, async () =>Source.get(context, table.source_id),);@@ -3356,6 +3368,12 @@ export class ColumnsService implements IColumnsService {Source.get(context, table.source_id, false, ncMeta),);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+// check if source is readonly and column type is not allowedif (source?.is_schema_readonly &&diff --git a/packages/nocodb/src/services/filters.service.ts b/packages/nocodb/src/services/filters.service.tsindex 62041b1d8c..1853b4787a 100644--- a/packages/nocodb/src/services/filters.service.ts+++ b/packages/nocodb/src/services/filters.service.ts@@ -59,6 +59,12 @@ export class FiltersService {param: { filterId: string; req: NcRequest },ncMeta?: MetaService,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const filter = await Filter.get(context, param.filterId);if (!filter) {diff --git a/packages/nocodb/src/services/form-columns.service.ts b/packages/nocodb/src/services/form-columns.service.tsindex ee93ea53fe..1b768a35fd 100644--- a/packages/nocodb/src/services/form-columns.service.ts+++ b/packages/nocodb/src/services/form-columns.service.ts@@ -10,6 +10,7 @@ import { AppHooksService } from '~/services/app-hooks/app-hooks.service';import { validatePayload } from '~/helpers';import { Column, FormViewColumn, View } from '~/models';import { extractProps } from '~/helpers/extractProps';+import { NcError } from '~/helpers/ncError';@Injectable()export class FormColumnsService {@@ -26,6 +27,12 @@ export class FormColumnsService {},ncMeta?: MetaService,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+validatePayload('swagger.json#/components/schemas/FormColumnReq',param.formViewColumn,diff --git a/packages/nocodb/src/services/forms.service.ts b/packages/nocodb/src/services/forms.service.tsindex 9702a191a1..632e73f73f 100644--- a/packages/nocodb/src/services/forms.service.ts+++ b/packages/nocodb/src/services/forms.service.ts@@ -44,6 +44,12 @@ export class FormsService {param.body,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId, ncMeta);if (model.synced) {diff --git a/packages/nocodb/src/services/galleries.service.ts b/packages/nocodb/src/services/galleries.service.tsindex 5b44c09ea3..4ecb3dfcd5 100644--- a/packages/nocodb/src/services/galleries.service.ts+++ b/packages/nocodb/src/services/galleries.service.ts@@ -44,7 +44,14 @@ export class GalleriesService {param.gallery,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId, ncMeta);+param.gallery.title = param.gallery.title?.trim();const existingView = await View.getByTitleOrId(context,diff --git a/packages/nocodb/src/services/grids.service.ts b/packages/nocodb/src/services/grids.service.tsindex 5ff903bff5..22a6240f8b 100644--- a/packages/nocodb/src/services/grids.service.ts+++ b/packages/nocodb/src/services/grids.service.ts@@ -35,7 +35,14 @@ export class GridsService {param.grid,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId, ncMeta);+// check for duplicated view titleparam.grid.title = param.grid.title?.trim();const existingView = await View.getByTitleOrId(diff --git a/packages/nocodb/src/services/hooks.service.ts b/packages/nocodb/src/services/hooks.service.tsindex 58d6c11018..923d8541f3 100644--- a/packages/nocodb/src/services/hooks.service.ts+++ b/packages/nocodb/src/services/hooks.service.ts@@ -68,6 +68,12 @@ export class HooksService {isTableDuplicate?: boolean;},) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+// if isTableDuplicate, we let v2 to be createdif (!option?.isTableDuplicate &&@@ -114,6 +120,12 @@ export class HooksService {context: NcContext,param: { hookId: string; req: NcRequest },) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const hook = await Hook.get(context, param.hookId);if (!hook) {diff --git a/packages/nocodb/src/services/kanbans.service.ts b/packages/nocodb/src/services/kanbans.service.tsindex b5bb39f449..893f3dd28b 100644--- a/packages/nocodb/src/services/kanbans.service.ts+++ b/packages/nocodb/src/services/kanbans.service.ts@@ -55,6 +55,12 @@ export class KanbansService {param.kanban,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId, ncMeta);let fk_cover_image_col_id =diff --git a/packages/nocodb/src/services/maps.service.ts b/packages/nocodb/src/services/maps.service.tsindex 3dc6e8e376..ce1a74c815 100644--- a/packages/nocodb/src/services/maps.service.ts+++ b/packages/nocodb/src/services/maps.service.ts@@ -31,6 +31,12 @@ export class MapsService {param.map,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId);const { id } = await View.insertMetaOnly(context, {diff --git a/packages/nocodb/src/services/sorts.service.ts b/packages/nocodb/src/services/sorts.service.tsindex c4e1e53c17..38052def46 100644--- a/packages/nocodb/src/services/sorts.service.ts+++ b/packages/nocodb/src/services/sorts.service.ts@@ -31,6 +31,12 @@ export class SortsService {},ncMeta = Noco.ncMeta,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const sort = await Sort.get(context, param.sortId, ncMeta);if (!sort) {@@ -94,6 +100,12 @@ export class SortsService {},ncMeta = Noco.ncMeta,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+validatePayload('swagger.json#/components/schemas/SortReq', param.sort);const sort = await Sort.get(context, param.sortId, ncMeta);@@ -165,6 +177,11 @@ export class SortsService {},ncMeta?: MetaService,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }validatePayload('swagger.json#/components/schemas/SortReq', param.sort);const view = await View.get(context, param.viewId, ncMeta);diff --git a/packages/nocodb/src/services/tables.service.ts b/packages/nocodb/src/services/tables.service.tsindex 987eb9ef34..7554ba5750 100644--- a/packages/nocodb/src/services/tables.service.ts+++ b/packages/nocodb/src/services/tables.service.ts@@ -71,6 +71,12 @@ export class TablesService {req: NcRequest;},) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const model = await Model.get(context, param.tableId);const base = await Base.getWithInfo(@@ -299,6 +305,12 @@ export class TablesService {req?: any;},) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const table = await Model.getByIdOrName(context, { id: param.tableId });if (table?.synced && !param.forceDeleteSyncs) {@@ -704,6 +716,12 @@ export class TablesService {...(param.synced ? { synced: true } : {}),};+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const base = await Base.getWithInfo(context, param.baseId);let source = base.sources[0];diff --git a/packages/nocodb/src/services/view-columns.service.ts b/packages/nocodb/src/services/view-columns.service.tsindex e98bca9a82..9e8012b71f 100644--- a/packages/nocodb/src/services/view-columns.service.ts+++ b/packages/nocodb/src/services/view-columns.service.ts@@ -110,6 +110,12 @@ export class ViewColumnsService {},ncMeta?: MetaService,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+validatePayload('swagger.json#/components/schemas/ViewColumnUpdateReq',param.column,diff --git a/packages/nocodb/src/services/views.service.ts b/packages/nocodb/src/services/views.service.tsindex afb2471d3e..fc438e9ea2 100644--- a/packages/nocodb/src/services/views.service.ts+++ b/packages/nocodb/src/services/views.service.ts@@ -169,6 +169,12 @@ export class ViewsService {'swagger.json#/components/schemas/ViewUpdateReq',param.view,);+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const oldView = await View.get(context, param.viewId, ncMeta);if (!oldView) {@@ -344,6 +350,12 @@ export class ViewsService {param: { viewId: string; user: UserType; req: NcRequest },ncMeta = Noco.ncMeta,) {+ if (context.schema_locked) {+ NcError.get(context).schemaLocked(+ 'Schema modifications are not allowed on installed sandbox bases',+ );+ }+const view = await View.get(context, param.viewId, ncMeta);if (!view) {diff --git a/packages/nocodb/src/utils/globals.ts b/packages/nocodb/src/utils/globals.tsindex 973df45659..cc13ecb23a 100644--- a/packages/nocodb/src/utils/globals.ts+++ b/packages/nocodb/src/utils/globals.ts@@ -102,6 +102,9 @@ export enum MetaTable {AUTOMATION_EXECUTIONS = 'nc_automation_executions',DEPENDENCY_TRACKER = 'nc_dependency_tracker',INSTALLATIONS = 'nc_installations',+ SANDBOXES = 'nc_sandboxes',+ SANDBOX_VERSIONS = 'nc_sandbox_versions',+ SANDBOX_DEPLOYMENT_LOGS = 'nc_sandbox_deployment_logs',}export const BaseRelatedMetaTables = [@@ -322,6 +325,10 @@ export enum CacheScope {DEPENDENCY_TRACKER = 'nc_dependency_tracker',INSTALLATION = 'installation',INSTALLATION_ALIAS = 'installationAlias',+ SANDBOX = 'sandbox',+ SANDBOX_VERSION = 'sandboxVersion',+ SANDBOX_DEPLOYMENT_LOG = 'sandboxDeploymentLog',+ SUBSCRIPTIONS_ALIAS = 'subscriptionsAlias',}export enum CacheGetType {@@ -369,6 +376,9 @@ export const RootScopeTables = {MetaTable.JOBS,MetaTable.FILE_REFERENCES,MetaTable.DATA_REFLECTION,+ MetaTable.SANDBOXES,+ MetaTable.SANDBOX_VERSIONS,+ MetaTable.SANDBOX_DEPLOYMENT_LOGS,// Temporarily added need to be discussed within teamMetaTable.AUDIT,MetaTable.CUSTOM_URLS,