From 765d5ec0f0879c5a7e4556a4b94ad3ca2c23aea3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 4 Jul 2022 20:01:07 +0800 Subject: [PATCH 01/21] enhancement: put password protect & allow download to more options --- .../components/SpreadsheetNavDrawer.vue | 143 +++++++++++------- 1 file changed, 90 insertions(+), 53 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue index 9e7a849928..dcc277d79b 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue @@ -388,59 +388,71 @@ - - - - -
- - - - - - {{ $t("placeholder.password.save") }} - -
+ + + + + + {{ $t("placeholder.password.save") }} + + + + + + @@ -497,6 +509,7 @@ export default { queryParams: Object }, data: () => ({ + advanceOptionsPanel: false, webhookSliderModal: false, codeSnippetModal: false, drag: false, @@ -512,6 +525,7 @@ export default { searchQueryVal: '', showShareLinkPassword: false, passwordProtect: false, + allowDownload: true, sharedViewPassword: '', overAdvShieldIcon: false, overShieldIcon: false, @@ -525,7 +539,7 @@ export default { [ViewTypes.GRID]: 'grid', [ViewTypes.FORM]: 'form', [ViewTypes.GALLERY]: 'gallery' - } + }, }), computed: { isSharedBase() { @@ -710,6 +724,9 @@ export default { this.saveShareLinkPassword() } }, + onAllowDownloadChange() { + this.saveAllowDownload() + }, async saveShareLinkPassword() { try { await this.$api.dbViewShare.update(this.shareLink.id, { @@ -733,6 +750,23 @@ export default { this.$e('a:view:share:enable-pwd') }, + async saveAllowDownload() { + try { + await this.$api.dbViewShare.update(this.shareLink.id, { + download: this.allowDownload + }) + this.$toast.success('Successfully updated').goAway(3000) + } catch (e) { + this.$toast + .error(await this._extractSdkResponseErrorMsg(e)) + .goAway(3000) + } + if (this.allowDownload) { + this.$e('a:view:share:enable-download') + } else { + this.$e('a:view:share:disable-download') + } + }, async loadViews() { // this.viewsList = await this.sqlOp( // { @@ -1012,4 +1046,7 @@ export default { opacity: 0.5; background: grey; } +.mx-auto .v-expansion-panel{ + background: var(--v-backgroundColor-base) +} From b89f79a02d311ea9a63cc0102704d6370565a288 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 4 Jul 2022 20:01:33 +0800 Subject: [PATCH 02/21] enhancement: add download to View --- packages/nocodb/src/lib/models/View.ts | 108 +++++++++++++------------ 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts index 02d29ff654..3ceceb8ba6 100644 --- a/packages/nocodb/src/lib/models/View.ts +++ b/packages/nocodb/src/lib/models/View.ts @@ -3,7 +3,7 @@ import { CacheDelDirection, CacheGetType, CacheScope, - MetaTable + MetaTable, } from '../utils/globals'; import Model from './Model'; import FormView from './FormView'; @@ -42,6 +42,7 @@ export default class View implements ViewType { project_id?: string; base_id?: string; show_system_fields?: boolean; + download?: boolean; constructor(data: View) { Object.assign(this, data); @@ -135,15 +136,15 @@ export default class View implements ViewType { _or: [ { id: { - eq: titleOrId - } + eq: titleOrId, + }, }, { title: { - eq: titleOrId - } - } - ] + eq: titleOrId, + }, + }, + ], } ); // todo: cache - titleOrId can be viewId so we need a different scope here @@ -174,7 +175,7 @@ export default class View implements ViewType { MetaTable.VIEWS, { fk_model_id, - is_default: 1 + is_default: 1, }, null ); @@ -188,11 +189,11 @@ export default class View implements ViewType { if (!viewsList.length) { viewsList = await ncMeta.metaList2(null, null, MetaTable.VIEWS, { condition: { - fk_model_id: modelId + fk_model_id: modelId, }, orderBy: { - order: 'asc' - } + order: 'asc', + }, }); await NocoCache.setList(CacheScope.VIEW, [modelId], viewsList); } @@ -201,13 +202,13 @@ export default class View implements ViewType { (a.order != null ? a.order : Infinity) - (b.order != null ? b.order : Infinity) ); - return viewsList?.map(v => new View(v)); + return viewsList?.map((v) => new View(v)); } public async getFilters(ncMeta = Noco.ncMeta) { return (this.filter = (await Filter.getFilterObject( { - viewId: this.id + viewId: this.id, }, ncMeta )) as any); @@ -228,7 +229,7 @@ export default class View implements ViewType { ) { // get order value const order = await ncMeta.metaGetNextOrder(MetaTable.VIEWS, { - fk_model_id: view.fk_model_id + fk_model_id: view.fk_model_id, }); const insertObj = { @@ -242,7 +243,7 @@ export default class View implements ViewType { project_id: view.project_id, base_id: view.base_id, created_at: view.created_at, - updated_at: view.updated_at + updated_at: view.updated_at, }; // get project and base id if missing @@ -275,7 +276,7 @@ export default class View implements ViewType { await GridView.insert( { ...(view as GridView), - fk_view_id: view_id + fk_view_id: view_id, }, ncMeta ); @@ -285,7 +286,7 @@ export default class View implements ViewType { { ...(copyFromView?.view || {}), ...view, - fk_view_id: view_id + fk_view_id: view_id, }, ncMeta ); @@ -296,7 +297,7 @@ export default class View implements ViewType { heading: view.title, ...(copyFromView?.view || {}), ...view, - fk_view_id: view_id + fk_view_id: view_id, }, ncMeta ); @@ -317,7 +318,7 @@ export default class View implements ViewType { { ...sort, fk_view_id: view_id, - id: null + id: null, }, ncMeta ); @@ -328,7 +329,7 @@ export default class View implements ViewType { { ...filter, fk_view_id: view_id, - id: null + id: null, }, ncMeta ); @@ -353,7 +354,7 @@ export default class View implements ViewType { view_id, fk_column_id: vCol.fk_column_id || vCol.id, show, - id: null + id: null, }, ncMeta ); @@ -376,7 +377,7 @@ export default class View implements ViewType { fk_column_id: param.fk_column_id, fk_model_id: param.fk_model_id, order: param.order, - show: param.show + show: param.show, }; const views = await this.list(param.fk_model_id, ncMeta); @@ -386,7 +387,7 @@ export default class View implements ViewType { await GridViewColumn.insert( { ...insertObj, - fk_view_id: view.id + fk_view_id: view.id, }, ncMeta ); @@ -395,7 +396,7 @@ export default class View implements ViewType { await GalleryViewColumn.insert( { ...insertObj, - fk_view_id: view.id + fk_view_id: view.id, }, ncMeta ); @@ -423,7 +424,7 @@ export default class View implements ViewType { col = await GridViewColumn.insert( { ...param, - fk_view_id: view.id + fk_view_id: view.id, }, ncMeta ); @@ -434,7 +435,7 @@ export default class View implements ViewType { col = await GalleryViewColumn.insert( { ...param, - fk_view_id: view.id + fk_view_id: view.id, }, ncMeta ); @@ -445,7 +446,7 @@ export default class View implements ViewType { col = await FormViewColumn.insert( { ...param, - fk_view_id: view.id + fk_view_id: view.id, }, ncMeta ); @@ -525,7 +526,7 @@ export default class View implements ViewType { } const updateObj = { order: colData.order, - show: colData.show + show: colData.show, }; // get existing cache const key = `${cacheScope}:${colId}`; @@ -556,7 +557,7 @@ export default class View implements ViewType { const existingCol = await ncMeta.metaGet2(null, null, table, { fk_view_id: viewId, - fk_column_id: fkColId + fk_column_id: fkColId, }); if (existingCol) { @@ -566,7 +567,7 @@ export default class View implements ViewType { table, { order: colData.order, - show: colData.show + show: colData.show, }, existingCol.id ); @@ -576,14 +577,14 @@ export default class View implements ViewType { fk_view_id: viewId, fk_column_id: fkColId, order: colData.order, - show: colData.show + show: colData.show, }); } } static async getByUUID(uuid: string, ncMeta = Noco.ncMeta) { const view = await ncMeta.metaGet2(null, null, MetaTable.VIEWS, { - uuid + uuid, }); return view && new View(view); @@ -609,7 +610,7 @@ export default class View implements ViewType { null, MetaTable.VIEWS, { - uuid: view.uuid + uuid: view.uuid, }, viewId ); @@ -638,7 +639,7 @@ export default class View implements ViewType { null, MetaTable.VIEWS, { - password + password, }, viewId ); @@ -660,7 +661,7 @@ export default class View implements ViewType { null, MetaTable.VIEWS, { - uuid: null + uuid: null, }, viewId ); @@ -684,7 +685,8 @@ export default class View implements ViewType { 'show_system_fields', 'lock_type', 'password', - 'uuid' + 'download', + 'uuid', ]); // get existing cache const key = `${CacheScope.VIEW}:${viewId}`; @@ -713,7 +715,7 @@ export default class View implements ViewType { const columnTable = this.extractViewColumnsTableName(view); const columnTableScope = this.extractViewColumnsTableNameScope(view); await ncMeta.metaDelete(null, null, columnTable, { - fk_view_id: viewId + fk_view_id: viewId, }); await NocoCache.deepDel( tableScope, @@ -721,7 +723,7 @@ export default class View implements ViewType { CacheDelDirection.CHILD_TO_PARENT ); await ncMeta.metaDelete(null, null, table, { - fk_view_id: viewId + fk_view_id: viewId, }); await NocoCache.deepDel( columnTableScope, @@ -840,15 +842,15 @@ export default class View implements ViewType { table, { show: true }, { - fk_view_id: viewId + fk_view_id: viewId, }, ignoreColdIds?.length ? { _not: { fk_column_id: { - in: ignoreColdIds - } - } + in: ignoreColdIds, + }, + }, } : null ); @@ -881,15 +883,15 @@ export default class View implements ViewType { table, { show: false }, { - fk_view_id: viewId + fk_view_id: viewId, }, ignoreColdIds?.length ? { _not: { fk_column_id: { - in: ignoreColdIds - } - } + in: ignoreColdIds, + }, + }, } : null ); @@ -905,18 +907,18 @@ export default class View implements ViewType { sharedViews = await ncMeta.metaList2(null, null, MetaTable.VIEWS, { xcCondition: { fk_model_id: { - eq: tableId + eq: tableId, }, _not: { uuid: { - eq: null - } - } - } + eq: null, + }, + }, + }, }); await NocoCache.setList(CacheScope.VIEW, [tableId], sharedViews); } - sharedViews = sharedViews.filter(v => v.uuid !== null); - return sharedViews?.map(v => new View(v)); + sharedViews = sharedViews.filter((v) => v.uuid !== null); + return sharedViews?.map((v) => new View(v)); } } From 3ddaa27504036ffc985266afb49b70a1af7e6287 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 4 Jul 2022 20:01:58 +0800 Subject: [PATCH 03/21] enhancement: add download to nc_views_v2 --- .../src/lib/migrations/XcMigrationSourcev2.ts | 6 ++- .../v2/nc_018_add_download_in_view.ts | 38 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 packages/nocodb/src/lib/migrations/v2/nc_018_add_download_in_view.ts diff --git a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts index dbcd223c7b..b0d76dbae9 100644 --- a/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/lib/migrations/XcMigrationSourcev2.ts @@ -5,6 +5,7 @@ import * as nc_014_alter_column_data_types from './v2/nc_014_alter_column_data_t import * as nc_015_add_meta_col_in_column_table from './v2/nc_015_add_meta_col_in_column_table'; import * as nc_016_alter_hooklog_payload_types from './v2/nc_016_alter_hooklog_payload_types'; import * as nc_017_add_user_token_version_column from './v2/nc_017_add_user_token_version_column'; +import * as nc_018_add_download_in_view from './v2/nc_018_add_download_in_view'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -20,7 +21,8 @@ export default class XcMigrationSourcev2 { 'nc_014_alter_column_data_types', 'nc_015_add_meta_col_in_column_table', 'nc_016_alter_hooklog_payload_types', - 'nc_017_add_user_token_version_column' + 'nc_017_add_user_token_version_column', + 'nc_018_add_download_in_view', ]); } @@ -44,6 +46,8 @@ export default class XcMigrationSourcev2 { return nc_016_alter_hooklog_payload_types; case 'nc_017_add_user_token_version_column': return nc_017_add_user_token_version_column; + case 'nc_018_add_download_in_view': + return nc_018_add_download_in_view; } } } diff --git a/packages/nocodb/src/lib/migrations/v2/nc_018_add_download_in_view.ts b/packages/nocodb/src/lib/migrations/v2/nc_018_add_download_in_view.ts new file mode 100644 index 0000000000..ae8494740d --- /dev/null +++ b/packages/nocodb/src/lib/migrations/v2/nc_018_add_download_in_view.ts @@ -0,0 +1,38 @@ +import Knex from 'knex'; +import { MetaTable } from '../../utils/globals'; + +const up = async (knex: Knex) => { + await knex.schema.alterTable(MetaTable.VIEWS, (table) => { + table.boolean('download').defaultTo(true); + }); +}; + +const down = async (knex) => { + await knex.schema.alterTable(MetaTable.VIEWS, (table) => { + table.dropColumns('download'); + }); +}; + +export { up, down }; + +/** + * @copyright Copyright (c) 2021, Xgene Cloud Ltd + * + * @author Wing-Kam Wong + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ From bb6d597a072c27828b84ebf33128675eea2c8b9e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 4 Jul 2022 20:02:15 +0800 Subject: [PATCH 04/21] refactor: make shared view update more general --- packages/nocodb/src/lib/meta/api/viewApis.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nocodb/src/lib/meta/api/viewApis.ts b/packages/nocodb/src/lib/meta/api/viewApis.ts index eb26e825a7..9a7d80872e 100644 --- a/packages/nocodb/src/lib/meta/api/viewApis.ts +++ b/packages/nocodb/src/lib/meta/api/viewApis.ts @@ -34,7 +34,7 @@ export async function viewList( //await View.list(req.params.tableId) const filteredViewList = viewList.filter((view: any) => { return Object.keys((req as any).session?.passport?.user?.roles).some( - role => + (role) => (req as any)?.session?.passport?.user?.roles[role] && !view.disabled[role] ); @@ -69,9 +69,9 @@ export async function viewDelete(req: Request, res: Response, next) { res.json(result); } -async function shareViewPasswordUpdate(req: Request, res) { - Tele.emit('evt', { evt_type: 'sharedView:password-updated' }); - res.json(await View.passwordUpdate(req.params.viewId, req.body)); +async function shareViewUpdate(req: Request, res) { + Tele.emit('evt', { evt_type: 'sharedView:updated' }); + res.json(await View.update(req.params.viewId, req.body)); } async function shareViewDelete(req: Request, res) { @@ -140,7 +140,7 @@ router.post( router.patch( '/api/v1/db/meta/views/:viewId/share', metaApiMetrics, - ncMetaAclMw(shareViewPasswordUpdate, 'shareViewPasswordUpdate') + ncMetaAclMw(shareViewUpdate, 'shareViewUpdate') ); router.delete( '/api/v1/db/meta/views/:viewId/share', From a5a15af6ad58a9a27db5cd6b947ac63dbf80e8b6 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 4 Jul 2022 20:02:46 +0800 Subject: [PATCH 05/21] enhancement: show more action based on allowDownload --- .../components/project/spreadsheet/public/XcTable.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue b/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue index 11d1cdd4bd..aaaf854d7b 100644 --- a/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue @@ -48,7 +48,8 @@ @input="loadTableData" /> - Date: Tue, 5 Jul 2022 11:46:05 +0800 Subject: [PATCH 06/21] cypress: add more options click & change switch to checkbox --- scripts/cypress/integration/common/4b_table_view_share.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index e8c77af5b1..c727df9d46 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -14,8 +14,9 @@ const generateLinkWithPwd = () => { cy.snipActiveModal("Modal_ShareView"); // enable checkbox & feed pwd, save + cy.getActiveModal().find('button:contains("More Options")').click(); cy.getActiveModal() - .find('[role="switch"][type="checkbox"]') + .find('[role="checkbox"][type="checkbox"]') .click({ force: true }); cy.getActiveModal().find('input[type="password"]').type("1"); From 23d9a1607f8edd7866c96aae30c89840553cd277 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 12:33:12 +0800 Subject: [PATCH 07/21] fix: revise passsword & download rendering logic on share view dialog --- .../components/SpreadsheetNavDrawer.vue | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue index dcc277d79b..fcfeaa83ac 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue @@ -868,34 +868,11 @@ export default { this.$e('a:view:delete', { view: view.type }) }, async genShareLink() { - // const sharedViewUrl = await this.$store.dispatch('sqlMgr/ActSqlOp', [ - // { dbAlias: this.nodes.dbAlias }, - // 'createSharedViewLink', - // { - // model_name: this.table, - // // meta: this.meta, - // query_params: { - // where: this.concatenatedXWhere, - // sort: this.sort, - // fields: Object.keys(this.showFields) - // .filter(f => this.showFields[f]) - // .join(','), - // showFields: this.showFields, - // fieldsOrder: this.fieldsOrder, - // extraViewParams: this.extraViewParams, - // selectedViewId: this.selectedViewId, - // columnsWidth: this.columnsWidth - // }, - // view_name: this.selectedView.title, - // type: this.selectedView.type, - // show_as: this.selectedView.show_as, - // password: this.sharedViewPassword - // } - // ]) const shared = await this.$api.dbViewShare.create(this.selectedViewId) - // todo: url this.shareLink = shared + this.passwordProtect = shared.password !== null + this.allowDownload = shared.download this.showShareModel = true }, copyView(view, i) { From 9f05da818f4cd02a07aacffe67a27bce10da5c93 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 12:56:00 +0800 Subject: [PATCH 08/21] enhancement: add download column --- .../spreadsheet/components/SharedViewsList.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue index 540d6bf580..ae374ec34b 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue @@ -18,6 +18,10 @@ {{ $t('labels.password') }} + + + Download Allowed + {{ $t('labels.actions') }} @@ -46,6 +50,12 @@ + + {{ currentView }} + + mdi-content-copy @@ -84,6 +94,12 @@ + + {{ link }} + + mdi-content-copy From 02a19bacdb896be5e0260697564caed6fe192d80 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 13:15:55 +0800 Subject: [PATCH 09/21] cypress: add missing .first() to checkbox --- scripts/cypress/integration/common/4b_table_view_share.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index c727df9d46..cecbafe499 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -15,9 +15,7 @@ const generateLinkWithPwd = () => { // enable checkbox & feed pwd, save cy.getActiveModal().find('button:contains("More Options")').click(); - cy.getActiveModal() - .find('[role="checkbox"][type="checkbox"]') - .click({ force: true }); + cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first().click({ force: true }); cy.getActiveModal().find('input[type="password"]').type("1"); cy.snipActiveModal("Modal_ShareView_Password"); From 0857756aedec1c27ddd5ec3a43dd54200e30e8b3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 13:25:09 +0800 Subject: [PATCH 10/21] chore: remove debug code --- .../project/spreadsheet/components/SharedViewsList.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue index ae374ec34b..301a320b92 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue @@ -51,7 +51,6 @@ - {{ currentView }} @@ -95,7 +94,6 @@ - {{ link }} From 07a7dca92c6ea015939ab92f30f01949e5ad6e20 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 13:26:06 +0800 Subject: [PATCH 11/21] cypress: revise password part & verify Download as CSV is here --- .../integration/common/4b_table_view_share.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index cecbafe499..6545bdad5a 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -15,14 +15,14 @@ const generateLinkWithPwd = () => { // enable checkbox & feed pwd, save cy.getActiveModal().find('button:contains("More Options")').click(); - cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first().click({ force: true }); - cy.getActiveModal().find('input[type="password"]').type("1"); - - cy.snipActiveModal("Modal_ShareView_Password"); - - cy.getActiveModal().find('button:contains("Save password")').click(); - - cy.toastWait("Successfully updated"); + const passwordCheckbox = cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first() + if (passwordCheckbox.eq(0)) { + passwordCheckbox.click({ force: true }); + cy.getActiveModal().find('input[type="password"]').type("1"); + cy.snipActiveModal("Modal_ShareView_Password"); + cy.getActiveModal().find('button:contains("Save password")').click(); + cy.toastWait("Successfully updated"); + } // copy link text, visit URL cy.getActiveModal() @@ -92,6 +92,11 @@ export const genTest = (apiType, dbType) => { cy.get("body") .find(".v-dialog.v-dialog--active") .should("not.exist"); + + // Verify Download as CSV is here + cy.get(".nc-actions-menu-btn").click(); + cy.snipActiveMenu("Menu_ActionsMenu"); + cy.get(`.menuable__content__active .v-list-item span:contains("Download as CSV")`).should("exist"); }); it("Delete view", () => { From 1210511e2961ff95ae54fa572e8b6b948804569d Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 5 Jul 2022 15:16:04 +0800 Subject: [PATCH 12/21] chore: make the download icon center --- .../project/spreadsheet/components/SharedViewsList.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue index 301a320b92..33266b2bf9 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue @@ -50,7 +50,7 @@ - + @@ -93,7 +93,7 @@ - + From c4c1bef8c72b36d0d3ff3af4f67ef0b6d25faf69 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 6 Jul 2022 11:38:03 +0800 Subject: [PATCH 13/21] fix: use meta column instead --- .../components/SharedViewsList.vue | 8 ++--- .../components/SpreadsheetNavDrawer.vue | 24 ++++++++------- .../project/spreadsheet/public/XcTable.vue | 6 ++-- .../src/lib/migrations/XcMigrationSourcev2.ts | 8 ++--- ..._in_view.ts => nc_018_add_meta_in_view.ts} | 4 +-- packages/nocodb/src/lib/models/View.ts | 29 +++++++++++++++++-- 6 files changed, 52 insertions(+), 27 deletions(-) rename packages/nocodb/src/lib/migrations/v2/{nc_018_add_download_in_view.ts => nc_018_add_meta_in_view.ts} (93%) diff --git a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue index 33266b2bf9..b46def2fab 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue @@ -51,8 +51,8 @@ - -