From 41f294db7ba5cae2111c416845c3d95d4fbc3771 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:29:15 +0530 Subject: [PATCH] Revert "feat(nc-gui): new share ui (#7845)" This reverts commit f3c626abc3a401c0123970bb7745155f99b2223c. --- .../dlg/share-and-collaborate/ShareBase.vue | 489 ++---------------- .../dlg/share-and-collaborate/SharePage.vue | 376 ++++++-------- .../dlg/share-and-collaborate/View.vue | 248 +++++---- .../nc-gui/components/general/CopyUrl.vue | 4 +- .../components/general/ShareProject.vue | 3 +- packages/nc-gui/components/nc/Modal.vue | 4 +- packages/nc-gui/components/nc/Switch.vue | 23 +- packages/nc-gui/components/nc/Tabs.vue | 2 +- .../components/project/ShareBaseDlg.vue | 9 +- packages/nc-gui/components/roles/Badge.vue | 2 +- .../components/workspace/InviteSection.vue | 4 + packages/nc-gui/lang/en.json | 8 +- .../pages/Dashboard/common/Topbar/Share.ts | 38 +- .../pages/Dashboard/common/Topbar/index.ts | 5 +- .../tests/db/features/baseShare.spec.ts | 5 +- 15 files changed, 401 insertions(+), 819 deletions(-) diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue index f05f5313d4..3bd06fe17e 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue @@ -1,8 +1,5 @@ - - diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue index e53e15f81c..fafadd37ba 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue @@ -1,7 +1,7 @@ @@ -523,4 +459,18 @@ const openManageAccess = async () => { line-height: 1rem !important; } } + +.nc-modal-share-view-preFillMode { + @apply flex flex-col; + + .ant-radio-wrapper { + @apply !m-0 !flex !items-center w-full px-2 py-1 rounded-lg hover:bg-gray-100; + .ant-radio { + @apply !top-0; + } + .ant-radio + span { + @apply !flex !pl-4; + } + } +} diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/View.vue b/packages/nc-gui/components/dlg/share-and-collaborate/View.vue index e3ee76d5db..dd2742470a 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/View.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/View.vue @@ -1,12 +1,19 @@ + diff --git a/packages/nc-gui/components/roles/Badge.vue b/packages/nc-gui/components/roles/Badge.vue index 35da2f77f3..8da82c3c19 100644 --- a/packages/nc-gui/components/roles/Badge.vue +++ b/packages/nc-gui/components/roles/Badge.vue @@ -13,7 +13,7 @@ const props = withDefaults( { clickable: false, inherit: false, - border: false, + border: true, size: 'sm', }, ) diff --git a/packages/nc-gui/components/workspace/InviteSection.vue b/packages/nc-gui/components/workspace/InviteSection.vue index bc01590197..48b2fbe87a 100644 --- a/packages/nc-gui/components/workspace/InviteSection.vue +++ b/packages/nc-gui/components/workspace/InviteSection.vue @@ -268,6 +268,10 @@ const onRoleChange = (role: keyof typeof RoleLabels) => (inviteData.roles = role @apply rounded; } +.badge-text { + @apply text-[14px] pt-1 text-center; +} + :deep(.ant-select-selection-item) { @apply mt-0.75; } diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index ce4c83be21..00857cae81 100644 --- a/packages/nc-gui/lang/en.json +++ b/packages/nc-gui/lang/en.json @@ -433,7 +433,6 @@ "surveyFormSubmitConfirmMsg": "Are you sure you want to submit this form?" }, "labels": { - "enterMultipleEmails": "Enter multiple E-mails by using commas to separate them", "selectYear": "Select Year", "save": "Save", "cancel": "Cancel", @@ -704,9 +703,6 @@ "clearSelection": "Clear selection" }, "activity": { - "inviteAs": "Invite as", - "toBase": "to base", - "manageAccess": "Manage Access", "addMembers": "Add Members", "enterEmail": "Enter email addresses", "inviteToBase": "Invite to Base", @@ -741,7 +737,7 @@ "outOfSync": "Out of sync", "newSource": "New Data Source", "newWebhook": "New Webhook", - "enablePublicAccess": "Enable Public Viewing", + "enablePublicAccess": "Enable Public Access", "doYouWantToSaveTheChanges": "Do you want to save the changes ?", "editingAccess": "Editing access", "enabledPublicViewing": "Enable Public Viewing", @@ -805,8 +801,6 @@ "invite": "Invite", "inviteMore": "Invite more", "inviteTeam": "Invite Team", - "inviteMembers": "Invite Member(s)", - "inviteUsers": "Invite User(s)", "inviteUser": "Invite User", "inviteToken": "Invite Token", "linkedRecords": "Linked Records", diff --git a/tests/playwright/pages/Dashboard/common/Topbar/Share.ts b/tests/playwright/pages/Dashboard/common/Topbar/Share.ts index 1bc668e9c6..bfcfdbfe53 100644 --- a/tests/playwright/pages/Dashboard/common/Topbar/Share.ts +++ b/tests/playwright/pages/Dashboard/common/Topbar/Share.ts @@ -11,21 +11,22 @@ export class TopbarSharePage extends BasePage { } get() { - return this.rootPage.locator(`.nc-modal-share-collaborate`); + return this.rootPage.locator(`.nc-modal-share-collaborate`).locator('.ant-modal-content'); } - async clickShareProject() { - await this.get().locator(`[data-testid="docs-share-dlg-share-base"]`).click(); + async clickShareView() { + await this.get().waitFor(); + // collapse header 0: Share Base, 1: Share View + await this.get().locator(`.ant-collapse-header`).nth(1).click(); } - async switchBaseShareTab({ tab }: { tab: 'public' | 'member' }) { - await this.get().getByTestId(`nc-base-share-${tab}`).waitFor({ state: 'visible' }); - await this.get().getByTestId(`nc-base-share-${tab}`).click(); + async clickShareProject() { + await this.get().locator(`[data-testid="docs-share-dlg-share-base"]`).click(); } async clickShareViewPublicAccess() { - await expect(this.get().getByTestId('share-view-toggle')).toHaveCount(1); - await this.get().getByTestId('share-view-toggle').click(); + await expect(this.get().locator(`[data-testid="share-view-toggle"]`)).toHaveCount(1); + await this.get().locator(`[data-testid="share-view-toggle"]`).click(); } async clickCopyLink() { @@ -34,7 +35,7 @@ export class TopbarSharePage extends BasePage { async closeModal() { // await this.rootPage.keyboard.press('Escape'); - await this.get().locator('.ant-btn.ant-btn-secondary:has-text("Finish")').click(); + await this.get().locator('.ant-btn.ant-btn-secondary:has-text("Close")').click(); } async clickShareViewWithPassword({ password }: { password: string }) { @@ -47,22 +48,7 @@ export class TopbarSharePage extends BasePage { } async clickShareBase() { - await this.get().waitFor(); - const shareBase = this.get().getByTestId('nc-share-base-tab'); - - if (await shareBase.isVisible()) { - await shareBase.click(); - } - } - - async clickShareView() { - await this.get().waitFor(); - - const shareView = this.get().getByTestId('nc-share-view-tab'); - - if (await shareView.isVisible()) { - await shareView.click(); - } + await this.get().locator(`[data-testid="db-share-base"]`).click(); } async clickShareBasePublicAccess() { @@ -86,8 +72,6 @@ export class TopbarSharePage extends BasePage { async clickShareBaseEditorAccess() { await this.rootPage.waitForTimeout(1000); - await this.switchBaseShareTab({ tab: 'public' }); - const shareBaseSwitch = this.get().locator(`[data-testid="nc-share-base-sub-modal"]`).locator('.ant-switch'); const count = await shareBaseSwitch.count(); diff --git a/tests/playwright/pages/Dashboard/common/Topbar/index.ts b/tests/playwright/pages/Dashboard/common/Topbar/index.ts index 1b2981d8ed..d02fd3bddb 100644 --- a/tests/playwright/pages/Dashboard/common/Topbar/index.ts +++ b/tests/playwright/pages/Dashboard/common/Topbar/index.ts @@ -36,7 +36,7 @@ export class TopbarPage extends BasePage { async getSharedViewUrl(surveyMode = false, password = '', download = false) { await this.clickShare(); - await this.share.clickShareView(); + // await this.share.clickShareView(); await this.share.clickShareViewPublicAccess(); await this.share.clickCopyLink(); if (surveyMode) { @@ -57,9 +57,6 @@ export class TopbarPage extends BasePage { async getSharedBaseUrl({ role, enableSharedBase }: { role: string; enableSharedBase: boolean }) { await this.clickShare(); - await this.share.clickShareBase(); - await this.share.switchBaseShareTab({ tab: 'public' }); - if (enableSharedBase) await this.share.clickShareBasePublicAccess(); if (role === 'editor' && enableSharedBase) { diff --git a/tests/playwright/tests/db/features/baseShare.spec.ts b/tests/playwright/tests/db/features/baseShare.spec.ts index 8879106d08..a7426caa17 100644 --- a/tests/playwright/tests/db/features/baseShare.spec.ts +++ b/tests/playwright/tests/db/features/baseShare.spec.ts @@ -3,7 +3,7 @@ import { DashboardPage } from '../../../pages/Dashboard'; import setup, { NcContext, unsetup } from '../../../setup'; import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar'; import { LoginPage } from '../../../pages/LoginPage'; -import { getDefaultPwd } from '../../utils/general'; +import { getDefaultPwd } from '../../../tests/utils/general'; import { isEE } from '../../../setup/db'; // To be enabled after shared base is implemented @@ -62,6 +62,9 @@ test.describe('Shared base', () => { }); test('#1', async () => { + // close 'Team & Auth' tab + await dashboard.closeTab({ title: 'Team & Auth' }); + let url = ''; // share button visible only if a table is opened await dashboard.treeView.openTable({ title: 'Country' });