Browse Source

fix: Fixed styling issues with view context menu and fixed issues with test and removed NcMenuItem as it was causing issues with test

pull/6888/head
Muhammed Mustafa 11 months ago
parent
commit
893e2ccfd9
  1. 2
      packages/nc-gui/assets/style.scss
  2. 30
      packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue
  3. 18
      packages/nc-gui/components/smartsheet/toolbar/OpenedViewAction.vue
  4. 2
      tests/playwright/pages/Dashboard/common/Toolbar/Actions/index.ts
  5. 2
      tests/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts
  6. 12
      tests/playwright/pages/Dashboard/common/Toolbar/index.ts

2
packages/nc-gui/assets/style.scss

@ -236,7 +236,7 @@ a {
} }
.nc-base-menu-item { .nc-base-menu-item {
@apply cursor-pointer flex items-center gap-2 py-2 after:(content-[''] absolute top-0 left-0 bottom-0 right-0 w-full h-full bg-current opacity-0 transition transition-opacity duration-100) hover:(after:(opacity-5)); @apply cursor-pointer flex items-center gap-2 py-2;
// &:hover { // &:hover {
// .nc-icon { // .nc-icon {

30
packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue

@ -102,26 +102,30 @@ const exportFile = async (exportType: ExportTypes) => {
<template> <template>
<div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">Download Data</div> <div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">Download Data</div>
<NcMenuItem @click="exportFile(ExportTypes.CSV)"> <a-menu-item class="!mx-1 !py-2 !rounded-md">
<div class="flex flex-row items-center justify-between"> <div
<div v-e="['a:download:csv']" class="nc-base-menu-item !py-0"> v-e="['a:download:csv']"
<GeneralLoader v-if="isExportingType === ExportTypes.CSV" class="!max-h-4.5 !-mt-1 !mr-0.75" /> class="flex flex-row items-center nc-base-menu-item !py-0"
@click.stop="exportFile(ExportTypes.CSV)"
>
<GeneralLoader v-if="isExportingType === ExportTypes.CSV" class="!max-h-4.5 !-mt-1 !mr-0.7" />
<component :is="iconMap.csv" v-else /> <component :is="iconMap.csv" v-else />
<!-- Download as CSV --> <!-- Download as CSV -->
{{ $t('activity.downloadCSV') }} {{ $t('activity.downloadCSV') }}
</div> </div>
</div> </a-menu-item>
</NcMenuItem>
<a-menu-item class="!mx-1 !py-2 !rounded-md">
<NcMenuItem @click="exportFile(ExportTypes.EXCEL)"> <div
<div class="flex flex-row items-center justify-between"> v-e="['a:download:excel']"
<div v-e="['a:download:excel']" class="nc-base-menu-item !py-0"> class="flex flex-row items-center nc-base-menu-item !py-0"
<GeneralLoader v-if="isExportingType === ExportTypes.EXCEL" class="!max-h-4.5 !-mt-1 !mr-0.75" /> @click="exportFile(ExportTypes.EXCEL)"
>
<GeneralLoader v-if="isExportingType === ExportTypes.EXCEL" class="!max-h-4.5 !-mt-1 !mr-0.7" />
<component :is="iconMap.excel" v-else /> <component :is="iconMap.excel" v-else />
<!-- Download as XLSX --> <!-- Download as XLSX -->
{{ $t('activity.downloadExcel') }} {{ $t('activity.downloadExcel') }}
</div> </div>
</div> </a-menu-item>
</NcMenuItem>
</template> </template>

18
packages/nc-gui/components/smartsheet/toolbar/OpenedViewAction.vue

@ -75,6 +75,8 @@ async function changeLockType(type: LockType) {
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
isDropdownOpen.value = false
} }
const { copy } = useCopy() const { copy } = useCopy()
@ -221,7 +223,7 @@ watch(isDropdownOpen, () => {
<NcDropdown <NcDropdown
v-else v-else
v-model:visible="isDropdownOpen" v-model:visible="isDropdownOpen"
class="!xs:pointer-events-none nc-actions-menu-btn" class="!xs:pointer-events-none nc-actions-menu-btn nc-view-context-btn"
overlay-class-name="nc-dropdown-actions-menu" overlay-class-name="nc-dropdown-actions-menu"
> >
<div <div
@ -293,7 +295,7 @@ watch(isDropdownOpen, () => {
</template> </template>
<NcSubMenu key="download"> <NcSubMenu key="download">
<template #title> <template #title>
<div v-e="['c:download']" class="nc-base-menu-item group"> <div v-e="['c:download']" class="nc-base-menu-item group nc-view-context-download-option">
<DownloadIcon class="w-4 h-4" /> <DownloadIcon class="w-4 h-4" />
{{ $t('general.download') }} {{ $t('general.download') }}
</div> </div>
@ -327,13 +329,13 @@ watch(isDropdownOpen, () => {
<template #expandIcon></template> <template #expandIcon></template>
<div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">View Settings</div> <div class="flex py-3 px-4 font-bold uppercase text-xs text-gray-500">View Settings</div>
<NcMenuItem class="nc-view-action-lock-subaction" @click="changeLockType(LockType.Collaborative)"> <a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction">
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" /> <LazySmartsheetToolbarLockType :type="LockType.Collaborative" @click="changeLockType(LockType.Collaborative)" />
</NcMenuItem> </a-menu-item>
<NcMenuItem @click="changeLockType(LockType.Locked)"> <a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction">
<LazySmartsheetToolbarLockType :type="LockType.Locked" /> <LazySmartsheetToolbarLockType :type="LockType.Locked" @click="changeLockType(LockType.Locked)" />
</NcMenuItem> </a-menu-item>
</NcSubMenu> </NcSubMenu>
</NcMenu> </NcMenu>
</template> </template>

2
tests/playwright/pages/Dashboard/common/Toolbar/Actions/index.ts

@ -22,6 +22,6 @@ export class ToolbarActionsPage extends BasePage {
} }
async clickDownloadSubmenu(label: string) { async clickDownloadSubmenu(label: string) {
await this.rootPage.locator(`div[class="nc-base-menu-item"]:has-text("${label}")`).first().click(); await this.rootPage.locator(`div.nc-base-menu-item:has-text("${label}")`).first().click();
} }
} }

2
tests/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts

@ -12,7 +12,7 @@ export class ToolbarViewMenuPage extends BasePage {
constructor(toolbar: ToolbarPage) { constructor(toolbar: ToolbarPage) {
super(toolbar.rootPage); super(toolbar.rootPage);
this.toolbar = toolbar; this.toolbar = toolbar;
this.viewsMenuBtn = this.toolbar.get().locator(`.nc-actions-menu-btn`); this.viewsMenuBtn = this.rootPage.locator('.nc-view-context-btn');
} }
get() { get() {

12
tests/playwright/pages/Dashboard/common/Toolbar/index.ts

@ -65,7 +65,7 @@ export class ToolbarPage extends BasePage {
async clickActions() { async clickActions() {
const menuOpen = await this.actions.get().isVisible(); const menuOpen = await this.actions.get().isVisible();
await this.get().locator(`button.nc-actions-menu-btn`).click(); await this.rootPage.locator(`div.nc-view-context-btn`).click();
// Wait for the menu to close // Wait for the menu to close
if (menuOpen) await this.fields.get().waitFor({ state: 'hidden' }); if (menuOpen) await this.fields.get().waitFor({ state: 'hidden' });
@ -161,7 +161,7 @@ export class ToolbarPage extends BasePage {
} }
async clickDownload(type: string, verificationFile = 'expectedData.txt') { async clickDownload(type: string, verificationFile = 'expectedData.txt') {
await this.get().locator(`.nc-actions-menu-btn`).click(); await this.rootPage.locator(`.nc-view-context-btn`).click();
const [download] = await Promise.all([ const [download] = await Promise.all([
// Start waiting for the download // Start waiting for the download
@ -195,7 +195,13 @@ export class ToolbarPage extends BasePage {
} }
async verifyDownloadDisabled() { async verifyDownloadDisabled() {
await this.get().locator(`nc-actions-menu-btn`).waitFor({ state: 'hidden' }); await this.rootPage.locator(`.nc-view-context-btn`).click();
await this.rootPage.waitForTimeout(500);
await this.rootPage.locator(`.nc-view-context-download-option`).waitFor({ state: 'hidden' });
await this.rootPage.locator(`.nc-view-context-btn`).click();
} }
async clickAddEditStack() { async clickAddEditStack() {

Loading…
Cancel
Save