From e07f2292c59f872e5d92248f4dadd8ab6c4c8c20 Mon Sep 17 00:00:00 2001 From: djechlin-mongodb <132293929+djechlin-mongodb@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:48:23 -0500 Subject: [PATCH] fix(compass-global-writes): make global writes tab not appear for readonly and config/local/admin collections COMPASS-8447 (#6479) * changes * specialish --- .../compass-collection/src/components/collection-tab.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/compass-collection/src/components/collection-tab.tsx b/packages/compass-collection/src/components/collection-tab.tsx index f4da240c81b..305a115204d 100644 --- a/packages/compass-collection/src/components/collection-tab.tsx +++ b/packages/compass-collection/src/components/collection-tab.tsx @@ -3,6 +3,7 @@ import { connect } from 'react-redux'; import { type CollectionState, selectTab } from '../modules/collection-tab'; import { css, ErrorBoundary, TabNavBar } from '@mongodb-js/compass-components'; import CollectionHeader from './collection-header'; +import toNS from 'mongodb-ns'; import { useLogger } from '@mongodb-js/compass-logging/provider'; import { useCollectionQueryBar, @@ -118,10 +119,10 @@ function WithErrorBoundary({ function useCollectionTabs(props: CollectionMetadata) { const pluginTabs = useCollectionSubTabs(); const connectionInfoRef = useConnectionInfoRef(); - const isGlobalWritesSupported = useConnectionSupports( - connectionInfoRef.current.id, - 'globalWrites' - ); + const isGlobalWritesSupported = + useConnectionSupports(connectionInfoRef.current.id, 'globalWrites') && + !props.isReadonly && + !toNS(props.namespace).specialish; return pluginTabs .filter((x) => { if (x.name === 'GlobalWrites' && !isGlobalWritesSupported) {