π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): update modal
Ramesh Mane13f910368cd8
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vueindex 49d2349551..8f7c2cd11c 100644--- a/packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue+++ b/packages/nc-gui/components/smartsheet/toolbar/ViewActionMenu.vue@@ -29,7 +29,7 @@ const view = computed(() => props.view)const table = computed(() => props.table)-const { navigateToView, duplicateView, updateView } = useViewsStore()+const { navigateToView, duplicateView, updateView, onOpenCopyViewConfigFromAnotherViewModal } = useViewsStore()const { user } = useGlobal()@@ -172,6 +172,12 @@ const openReAssignDlg = () => {emits('closeModal')}+const onClickCopyViewConfig = () => {+ emits('closeModal')++ onOpenCopyViewConfigFromAnotherViewModal()+}+const isViewOwner = computed(() => {return (view.value?.owned_by === user.value?.id ||@@ -515,6 +521,12 @@ defineOptions({</PaymentUpgradeBadgeProvider></SmartsheetToolbarNotAllowedTooltip></template>+ <template v-if="isEeUI">+ <NcMenuItem @click="onClickCopyViewConfig">+ <GeneralIcon icon="copy" class="opacity-80" />+ {{ $t('general.copyViewConfig') }}+ </NcMenuItem>+ </template></template><template v-if="!view.is_default && isUIAllowed('viewCreateOrEdit')">diff --git a/packages/nc-gui/store/views.ts b/packages/nc-gui/store/views.tsindex ee6988a537..7a0ce1c1cf 100644--- a/packages/nc-gui/store/views.ts+++ b/packages/nc-gui/store/views.ts@@ -4,7 +4,7 @@ import { acceptHMRUpdate, defineStore } from 'pinia'import { useTitle } from '@vueuse/core'import type { ViewPageType } from '~/lib/types'import { getFormattedViewTabTitle } from '~/helpers/parsers/parserHelpers'-import { DlgViewCreate } from '#components'+import { DlgViewCopyViewConfigFromAnotherView, DlgViewCreate } from '#components'// Types and Interfacesinterface RecentView {@@ -785,6 +785,28 @@ export const useViewsStore = defineStore('viewsStore', () => {}}+ const onOpenCopyViewConfigFromAnotherViewModal = ({+ defaultSelectedCopyViewConfigTypes,+ }: {+ defaultSelectedCopyViewConfigTypes?: CopyViewConfigType[]+ } = {}) => {+ if (!isEeUI || !isUIAllowed('viewCreateOrEdit')) return++ const isOpen = ref(true)++ const { close } = useDialog(DlgViewCopyViewConfigFromAnotherView, {+ 'modelValue': isOpen,+ 'onUpdate:modelValue': closeDialog,+ 'tableId': tablesStore.activeTableId,+ 'defaultSelectedCopyViewConfigTypes': defaultSelectedCopyViewConfigTypes,+ })++ function closeDialog() {+ isOpen.value = false+ close(1000)+ }+ }+function getViewReadableUrlSlug({ tableTitle, viewOrViewTitle }: { tableTitle?: string; viewOrViewTitle: ViewType | string }) {const viewTitle = ncIsObject(viewOrViewTitle) ? (viewOrViewTitle.is_default ? '' : viewOrViewTitle.title) : viewOrViewTitle@@ -926,6 +948,7 @@ export const useViewsStore = defineStore('viewsStore', () => {setCurrentViewExpandedFormAttachmentColumn,onOpenViewCreateModal,getViewReadableUrlSlug,+ onOpenCopyViewConfigFromAnotherViewModal,}})diff --git a/packages/nc-gui/utils/viewUtils.ts b/packages/nc-gui/utils/viewUtils.tsindex 452f382be7..b345b85b12 100644--- a/packages/nc-gui/utils/viewUtils.ts+++ b/packages/nc-gui/utils/viewUtils.ts@@ -122,16 +122,16 @@ export interface CopyViewConfigOption {/*** A comprehensive mapping of all available copy view configuration options.- *+ ** This map defines the metadata and constraints for each type of view configuration that can be copied,* including display order, labels, i18n keys, and which view types support each configuration option.- *+ ** @remarks* Use this map to:* - Get the configuration options available for a specific view type* - Determine which view types support a particular configuration option* - Access i18n labels and display ordering for UI rendering- *+ ** @example* ```ts* // Get the field visibility option metadata@@ -201,14 +201,14 @@ export const copyViewConfigOptionMap: Record<CopyViewConfigType, CopyViewConfigO/*** Retrieves all copy view configuration options with their availability status for a specific view type.- *+ ** This function returns all available configuration options, marking each as enabled or disabled* based on whether the source view type supports that particular configuration.* The returned options are sorted by their display order.- *+ ** @param copyFromViewType - The view type from which configurations will be copied* @returns An array of configuration options with a 'disabled' flag indicating support status, sorted by order- *+ ** @example* ```ts* // Get all config options for copying from a Grid view@@ -217,13 +217,13 @@ export const copyViewConfigOptionMap: Record<CopyViewConfigType, CopyViewConfigO* const enabledOptions = options.filter(opt => !opt.disabled)* ```*/-export const getCopyViewConfigOptions = (copyFromViewType: ViewTypes) => {+export const getCopyViewConfigOptions = (copyFromViewType?: ViewTypes) => {return Object.values(copyViewConfigOptionMap).map((option) => {const { supportedViewTypes, ...rest } = optionreturn {...rest,- disabled: !supportedViewTypes.includes(copyFromViewType),+ disabled: !ncIsUndefined(copyFromViewType) && !supportedViewTypes.includes(copyFromViewType),}}).sort((a, b) => a.order - b.order)@@ -231,14 +231,14 @@ export const getCopyViewConfigOptions = (copyFromViewType: ViewTypes) => {/*** Filters a list of copy view configuration types to only include those supported by the source view type.- *+ ** This function validates each configuration type against the source view type's capabilities,* removing any unsupported or invalid configuration types from the list.- *+ ** @param copyViewConfigTypes - Array of configuration types to be validated* @param copyFromViewType - The view type from which configurations will be copied* @returns A filtered array containing only the configuration types supported by the source view type- *+ ** @example* ```ts* // Validate selected config types for a Form view