From 629dc1cdc186df507ba7fe188d79b7e68dab2dbf Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 2 May 2022 23:41:10 +0530 Subject: [PATCH] feat: gallery view migration- basic Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- packages/nocodb/tests/sync/sync.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/nocodb/tests/sync/sync.js b/packages/nocodb/tests/sync/sync.js index 5ff8285c1f..6906a9ed58 100644 --- a/packages/nocodb/tests/sync/sync.js +++ b/packages/nocodb/tests/sync/sync.js @@ -695,6 +695,8 @@ async function nc_hideColumn(tblName, viewName, columnName, viewType) { if(viewType === 'form') viewDetails = (await api.dbView.formRead(viewId)).columns + else if(viewType === 'gallery') + viewDetails = (await api.dbView.galleryRead(viewId)).columns else viewDetails = await api.dbView.gridColumnsList(viewId); @@ -964,6 +966,21 @@ async function nocoCreateProject(projName) { }); } +async function nocoConfigureGalleryView(sDB, aTblSchema) { + for (let idx = 0; idx < aTblSchema.length; idx++) { + let tblId = (await nc_getTableSchema(aTblSchema[idx].name)).id; + let galleryViews = aTblSchema[idx].views.filter(x => x.type === 'gallery'); + + for(let i=0; i x.id === galleryViews[i].id)?.name + let g = await api.dbView.galleryCreate(tblId, {title: viewName}) + // await nc_configureFields(g.id, vData.columnOrder, aTblSchema[idx].name, viewName, 'gallery'); + } + } +} + async function nocoConfigureFormView(sDB, aTblSchema) { for (let idx = 0; idx < aTblSchema.length; idx++) { let tblId = (await nc_getTableSchema(aTblSchema[idx].name)).id; @@ -1077,6 +1094,7 @@ module.exports = async function nc_migrateATbl(syncDB) { // configure views await nocoConfigureGridView(syncDB, aTblSchema) await nocoConfigureFormView(syncDB, aTblSchema) + await nocoConfigureGalleryView(syncDB, aTblSchema) if(process_aTblData) { // await nc_DumpTableSchema();