Browse Source

Merge pull request #6637 from nocodb/nc-fix/copy-follow-up

fix: hide context menu for shared base
pull/6640/head
mertmit 1 year ago committed by GitHub
parent
commit
b780f8d78d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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>
<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
v-e="['c:base:options']"
class="nc-sidebar-node-btn"

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

@ -267,7 +267,13 @@ export class TreeViewPage extends BasePage {
).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;
param.baseTitle = param.baseTitle ?? context.base.title;
@ -275,14 +281,16 @@ export class TreeViewPage extends BasePage {
const pjtNode = await this.getProject({ title: param.baseTitle });
await pjtNode.hover();
// add new table button & context menu is visible only for owner & creator
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);
if (param.mode !== 'shareBase') {
// add new table button & context menu is visible only for owner & creator
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
const tblNode = await this.getTable({ index: 0, tableTitle: param.tableTitle });
await tblNode.hover();
await expect(tblNode.locator('.nc-tbl-context-menu')).toHaveCount(count);
// table context menu
const tblNode = await this.getTable({ index: 0, tableTitle: param.tableTitle });
await tblNode.hover();
await expect(tblNode.locator('.nc-tbl-context-menu')).toHaveCount(count);
}
}
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({
role: role.toLowerCase(),
mode: 'shareBase',
context,
});

Loading…
Cancel
Save