99 ErrorSummary ,
1010 Tooltip ,
1111 WarningSummary ,
12+ Link ,
1213 css ,
1314 spacing ,
1415 Icon ,
@@ -18,10 +19,13 @@ import {
1819 DropdownMenuButton ,
1920 SegmentedControl ,
2021 SegmentedControlOption ,
22+ usePersistedState ,
2123} from '@mongodb-js/compass-components' ;
24+ import { useConnectionInfo } from '@mongodb-js/compass-connections/provider' ;
2225
2326import type { RootState } from '../../modules' ;
2427import { createSearchIndexOpened } from '../../modules/search-indexes' ;
28+ import { getAtlasSearchIndexesLink } from '../../utils/atlas-search-indexes-link' ;
2529import { createIndexOpened } from '../../modules/create-index' ;
2630import type { IndexView } from '../../modules/index-view' ;
2731import { indexViewChanged } from '../../modules/index-view' ;
@@ -46,6 +50,7 @@ const createIndexButtonContainerStyles = css({
4650} ) ;
4751
4852type IndexesToolbarProps = {
53+ namespace : string ;
4954 indexView : IndexView ;
5055 errorMessage : string | null ;
5156 hasTooManyIndexes : boolean ;
@@ -63,7 +68,11 @@ type IndexesToolbarProps = {
6368 readOnly ?: boolean ;
6469} ;
6570
71+ const DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY =
72+ 'mongodb_compass_dismissedSearchIndexesBanner' as const ;
73+
6674export const IndexesToolbar : React . FunctionComponent < IndexesToolbarProps > = ( {
75+ namespace,
6776 indexView,
6877 errorMessage,
6978 isReadonlyView,
@@ -79,6 +88,11 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
7988 readOnly, // preferences readOnly.
8089} ) => {
8190 const isSearchManagementActive = usePreference ( 'enableAtlasSearchIndexes' ) ;
91+ const [ searchIndexesBannerDismissed ] = usePersistedState (
92+ DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY ,
93+ false
94+ ) ;
95+ const { atlasMetadata } = useConnectionInfo ( ) ;
8296 const showInsights = usePreference ( 'showInsights' ) && ! errorMessage ;
8397 const showCreateIndexButton = ! isReadonlyView && ! readOnly && ! errorMessage ;
8498 const refreshButtonIcon = isRefreshing ? (
@@ -124,6 +138,21 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
124138 >
125139 Refresh
126140 </ Button >
141+ { ! isReadonlyView &&
142+ ! isSearchManagementActive &&
143+ searchIndexesBannerDismissed &&
144+ atlasMetadata && (
145+ < Link
146+ href = { getAtlasSearchIndexesLink ( {
147+ clusterName : atlasMetadata . clusterName ,
148+ namespace,
149+ } ) }
150+ hideExternalIcon
151+ arrowAppearance = "persist"
152+ >
153+ Manage your search indexes
154+ </ Link >
155+ ) }
127156 { showInsights && hasTooManyIndexes && (
128157 < SignalPopover
129158 signals = { PerformanceSignals . get ( 'too-many-indexes' ) }
@@ -263,6 +292,7 @@ export const CreateIndexButton: React.FunctionComponent<
263292} ;
264293
265294const mapState = ( {
295+ namespace,
266296 isWritable,
267297 isReadonlyView,
268298 isSearchIndexesSupported,
@@ -271,6 +301,7 @@ const mapState = ({
271301 searchIndexes,
272302 indexView,
273303} : RootState ) => ( {
304+ namespace,
274305 isWritable,
275306 isReadonlyView,
276307 isSearchIndexesSupported,
0 commit comments