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 1 year 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 {
@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 {
// .nc-icon {

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

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

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

@ -75,6 +75,8 @@ async function changeLockType(type: LockType) {
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
}
isDropdownOpen.value = false
}
const { copy } = useCopy()
@ -221,7 +223,7 @@ watch(isDropdownOpen, () => {
<NcDropdown
v-else
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"
>
<div
@ -293,7 +295,7 @@ watch(isDropdownOpen, () => {
</template>
<NcSubMenu key="download">
<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" />
{{ $t('general.download') }}
</div>
@ -327,13 +329,13 @@ watch(isDropdownOpen, () => {
<template #expandIcon></template>
<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)">
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" />
</NcMenuItem>
<a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction">
<LazySmartsheetToolbarLockType :type="LockType.Collaborative" @click="changeLockType(LockType.Collaborative)" />
</a-menu-item>
<NcMenuItem @click="changeLockType(LockType.Locked)">
<LazySmartsheetToolbarLockType :type="LockType.Locked" />
</NcMenuItem>
<a-menu-item class="!mx-1 !py-2 !rounded-md nc-view-action-lock-subaction">
<LazySmartsheetToolbarLockType :type="LockType.Locked" @click="changeLockType(LockType.Locked)" />
</a-menu-item>
</NcSubMenu>
</NcMenu>
</template>

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

@ -22,6 +22,6 @@ export class ToolbarActionsPage extends BasePage {
}
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) {
super(toolbar.rootPage);
this.toolbar = toolbar;
this.viewsMenuBtn = this.toolbar.get().locator(`.nc-actions-menu-btn`);
this.viewsMenuBtn = this.rootPage.locator('.nc-view-context-btn');
}
get() {

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

@ -65,7 +65,7 @@ export class ToolbarPage extends BasePage {
async clickActions() {
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
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') {
await this.get().locator(`.nc-actions-menu-btn`).click();
await this.rootPage.locator(`.nc-view-context-btn`).click();
const [download] = await Promise.all([
// Start waiting for the download
@ -195,7 +195,13 @@ export class ToolbarPage extends BasePage {
}
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() {

Loading…
Cancel
Save