Browse Source

Nc extension url preview (#9789)

* feat(extensions): url preview

* fix(nc-gui): merge conflicts

---------

Co-authored-by: amandesai01 <amandesai01@gmail.com>
pull/9791/head
Ramesh Mane 2 weeks ago committed by GitHub
parent
commit
5de1caf760
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/nc-gui/components/smartsheet/Topbar.vue
  2. 11
      packages/nc-gui/components/smartsheet/grid/Table.vue
  3. 11
      packages/nc-gui/composables/useExtensionHelper.ts
  4. 4
      packages/nc-gui/composables/useExtensions.ts
  5. 1
      packages/nc-gui/lib/enums.ts

2
packages/nc-gui/components/smartsheet/Topbar.vue

@ -12,7 +12,7 @@ const { isMobileMode } = storeToRefs(useConfigStore())
const { appInfo } = useGlobal()
const { toggleExtensionPanel, isPanelExpanded, extensionsEgg, onEggClick } = useExtensions()
const { toggleExtensionPanel, isPanelExpanded } = useExtensions()
const { isFeatureEnabled } = useBetaFeatureToggle()

11
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -1394,6 +1394,17 @@ eventBus.on(async (event, payload) => {
}
})
watch(activeCell, (activeCell) => {
const row = activeCell.row !== null ? dataRef.value[activeCell.row].row : undefined;
const col = (row && activeCell.col !== null) ? fields.value[activeCell.col] : undefined;
const val = (row && col) ? row[col.title as string] : undefined;
const rowId = extractPkFromRow(row!, meta.value?.columns as ColumnType[])
const viewId = view.value?.id;
eventBus.emit(SmartsheetStoreEvents.CELL_SELECTED, { rowId, colId: col?.id, val, viewId });
})
async function reloadViewDataHandler(params: void | { shouldShowLoading?: boolean | undefined; offset?: number | undefined }) {
if (params?.shouldShowLoading) isViewDataLoading.value = true

11
packages/nc-gui/composables/useExtensionHelper.ts

@ -4,6 +4,7 @@ import type { ExtensionManifest, ExtensionType } from '#imports'
const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
(extension: Ref<ExtensionType>, extensionManifest: ComputedRef<ExtensionManifest | undefined>, activeError: Ref<any>) => {
const { $api } = useNuxtApp()
const route = useRoute();
const basesStore = useBases()
@ -27,6 +28,8 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
const fullscreenModalSize = ref<keyof typeof modalSizes>(extensionManifest.value?.config?.modalSize || 'lg')
const activeTableId = computed(() => route.params.viewId as string | undefined)
const collapsed = computed({
get: () => extension.value?.meta?.collapsed ?? false,
set: (value) => {
@ -81,7 +84,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
return getMeta(tableId)
}
const insertData = async (params: { tableId: string; data: Record<string, any> }) => {
const insertData = async (params: { tableId: string; data: Record<string, any>[] }) => {
const { tableId, data } = params
const chunks = []
@ -103,7 +106,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
}
}
const updateData = async (params: { tableId: string; data: Record<string, any> }) => {
const updateData = async (params: { tableId: string; data: Record<string, any>[] }) => {
const { tableId, data } = params
const chunks = []
@ -127,7 +130,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
const upsertData = async (params: {
tableId: string
data: Record<string, any>
data: Record<string, any>[]
upsertField: ColumnType
importType: 'insert' | 'update' | 'insertAndUpdate'
}) => {
@ -221,6 +224,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
tables,
showExpandBtn,
fullscreenModalSize,
activeTableId,
getViewsForTable,
getData,
getTableMeta,
@ -229,6 +233,7 @@ const [useProvideExtensionHelper, useExtensionHelper] = useInjectionState(
upsertData,
reloadData,
reloadMeta,
eventBus,
}
},
'extension-helper',

4
packages/nc-gui/composables/useExtensions.ts

@ -449,10 +449,6 @@ export const useExtensions = createSharedComposable(() => {
} catch (error) {
console.error('Error loading extensions:', error)
}
// if (isEeUI) {
// extensionsEgg.value = true
// }
})
watch(

1
packages/nc-gui/lib/enums.ts

@ -79,6 +79,7 @@ export enum SmartsheetStoreEvents {
GROUP_BY_ADD = 'group-by-add',
GROUP_BY_REMOVE = 'group-by-remove',
FILTER_ADD = 'filter-add',
CELL_SELECTED = 'cell-selected',
}
export enum DataSourcesSubTab {

Loading…
Cancel
Save