Skip to content

Commit 3fbcb02

Browse files
authored
fix(compass-connections-navigation): disable dropping database in readonly in the context menu COMPASS-10058 (#7557)
disable dropping database in readonly in the context menu
1 parent 57923d7 commit 3fbcb02

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/compass-connections-navigation/src/connections-navigation-tree.spec.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,10 +1064,13 @@ describe('ConnectionsNavigationTree', function () {
10641064
const contextMenu = screen.getByTestId('context-menu');
10651065

10661066
// Check that write actions are not present in read-only mode
1067-
expect(() => within(contextMenu).getByText('Create collection')).to
1068-
.throw;
1069-
expect(() => within(contextMenu).getByText('Create database')).to.throw;
1070-
expect(() => within(contextMenu).getByText('Drop database')).to.throw;
1067+
expect(() =>
1068+
within(contextMenu).getByText('Create collection')
1069+
).to.throw();
1070+
expect(() =>
1071+
within(contextMenu).getByText('Create database')
1072+
).to.throw();
1073+
expect(() => within(contextMenu).getByText('Drop database')).to.throw();
10711074

10721075
// Check that read-only actions are still present
10731076
expect(within(contextMenu).getByText('View performance metrics')).to.be

packages/compass-connections-navigation/src/item-actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ export const databaseContextMenuActions = ({
379379
icon: 'Plus',
380380
label: 'Create database',
381381
},
382-
hasWriteActionsDisabled && canDeleteDatabase
382+
hasWriteActionsDisabled || !canDeleteDatabase
383383
? null
384384
: {
385385
action: 'drop-database',

0 commit comments

Comments
 (0)