Browse Source

fix: hide context menu for shared base

pull/6637/head
mertmit 1 year ago
parent
commit
90ab437436
  1. 2
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  2. 24
      tests/playwright/pages/Dashboard/TreeView.ts
  3. 1
      tests/playwright/tests/db/features/baseShare.spec.ts

2
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -477,7 +477,7 @@ const projectDelete = () => {
</span> </span>
<div :class="{ 'flex flex-grow h-full': !editMode }" @click="onProjectClick(base)"></div> <div :class="{ 'flex flex-grow h-full': !editMode }" @click="onProjectClick(base)"></div>
<NcDropdown v-model:visible="isOptionsOpen" :trigger="['click']"> <NcDropdown v-if="!isSharedBase" v-model:visible="isOptionsOpen" :trigger="['click']">
<NcButton <NcButton
v-e="['c:base:options']" v-e="['c:base:options']"
class="nc-sidebar-node-btn" class="nc-sidebar-node-btn"

24
tests/playwright/pages/Dashboard/TreeView.ts

@ -267,7 +267,13 @@ export class TreeViewPage extends BasePage {
).toHaveCount(1); ).toHaveCount(1);
} }
async validateRoleAccess(param: { role: string; baseTitle?: string; tableTitle?: string; context: NcContext }) { async validateRoleAccess(param: {
role: string;
baseTitle?: string;
tableTitle?: string;
mode?: string;
context: NcContext;
}) {
const context = param.context; const context = param.context;
param.baseTitle = param.baseTitle ?? context.base.title; param.baseTitle = param.baseTitle ?? context.base.title;
@ -275,14 +281,16 @@ export class TreeViewPage extends BasePage {
const pjtNode = await this.getProject({ title: param.baseTitle }); const pjtNode = await this.getProject({ title: param.baseTitle });
await pjtNode.hover(); await pjtNode.hover();
// add new table button & context menu is visible only for owner & creator if (mode !== 'shareBase') {
await expect(pjtNode.locator('[data-testid="nc-sidebar-add-base-entity"]')).toHaveCount(count); // add new table button & context menu is visible only for owner & creator
await expect(pjtNode.locator('[data-testid="nc-sidebar-context-menu"]')).toHaveCount(1); await expect(pjtNode.locator('[data-testid="nc-sidebar-add-base-entity"]')).toHaveCount(count);
await expect(pjtNode.locator('[data-testid="nc-sidebar-context-menu"]')).toHaveCount(1);
// table context menu // table context menu
const tblNode = await this.getTable({ index: 0, tableTitle: param.tableTitle }); const tblNode = await this.getTable({ index: 0, tableTitle: param.tableTitle });
await tblNode.hover(); await tblNode.hover();
await expect(tblNode.locator('.nc-tbl-context-menu')).toHaveCount(count); await expect(tblNode.locator('.nc-tbl-context-menu')).toHaveCount(count);
}
} }
async openProject({ title, context }: { title: string; context: NcContext }) { async openProject({ title, context }: { title: string; context: NcContext }) {

1
tests/playwright/tests/db/features/baseShare.spec.ts

@ -36,6 +36,7 @@ test.describe('Shared base', () => {
await dashboard.treeView.validateRoleAccess({ await dashboard.treeView.validateRoleAccess({
role: role.toLowerCase(), role: role.toLowerCase(),
mode: 'shareBase',
context, context,
}); });

Loading…
Cancel
Save