9
9
ErrorSummary ,
10
10
Tooltip ,
11
11
WarningSummary ,
12
+ Link ,
12
13
css ,
13
14
spacing ,
14
15
Icon ,
@@ -19,9 +20,11 @@ import {
19
20
SegmentedControl ,
20
21
SegmentedControlOption ,
21
22
} from '@mongodb-js/compass-components' ;
23
+ import { useConnectionInfo } from '@mongodb-js/compass-connections/provider' ;
22
24
23
25
import type { RootState } from '../../modules' ;
24
26
import { createSearchIndexOpened } from '../../modules/search-indexes' ;
27
+ import { getAtlasSearchIndexesLink } from '../../utils/atlas-search-indexes-link' ;
25
28
import { createIndexOpened } from '../../modules/create-index' ;
26
29
import type { IndexView } from '../../modules/index-view' ;
27
30
import { indexViewChanged } from '../../modules/index-view' ;
@@ -46,9 +49,11 @@ const createIndexButtonContainerStyles = css({
46
49
} ) ;
47
50
48
51
type IndexesToolbarProps = {
52
+ namespace : string ;
49
53
indexView : IndexView ;
50
54
errorMessage : string | null ;
51
55
hasTooManyIndexes : boolean ;
56
+ showAtlasSearchLink : boolean ;
52
57
isRefreshing : boolean ;
53
58
onRefreshIndexes : ( ) => void ;
54
59
onIndexViewChanged : ( newView : IndexView ) => void ;
@@ -64,6 +69,7 @@ type IndexesToolbarProps = {
64
69
} ;
65
70
66
71
export const IndexesToolbar : React . FunctionComponent < IndexesToolbarProps > = ( {
72
+ namespace,
67
73
indexView,
68
74
errorMessage,
69
75
isReadonlyView,
@@ -73,12 +79,14 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
73
79
isRefreshing,
74
80
writeStateDescription,
75
81
hasTooManyIndexes,
82
+ showAtlasSearchLink,
76
83
isSearchIndexesSupported,
77
84
onRefreshIndexes,
78
85
onIndexViewChanged,
79
86
readOnly, // preferences readOnly.
80
87
} ) => {
81
88
const isSearchManagementActive = usePreference ( 'enableAtlasSearchIndexes' ) ;
89
+ const { atlasMetadata } = useConnectionInfo ( ) ;
82
90
const showInsights = usePreference ( 'showInsights' ) && ! errorMessage ;
83
91
const showCreateIndexButton = ! isReadonlyView && ! readOnly && ! errorMessage ;
84
92
const refreshButtonIcon = isRefreshing ? (
@@ -124,6 +132,18 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
124
132
>
125
133
Refresh
126
134
</ Button >
135
+ { showAtlasSearchLink && atlasMetadata && (
136
+ < Link
137
+ href = { getAtlasSearchIndexesLink ( {
138
+ clusterName : atlasMetadata . clusterName ,
139
+ namespace,
140
+ } ) }
141
+ hideExternalIcon
142
+ arrowAppearance = "persist"
143
+ >
144
+ Manage your search indexes
145
+ </ Link >
146
+ ) }
127
147
{ showInsights && hasTooManyIndexes && (
128
148
< SignalPopover
129
149
signals = { PerformanceSignals . get ( 'too-many-indexes' ) }
@@ -263,6 +283,7 @@ export const CreateIndexButton: React.FunctionComponent<
263
283
} ;
264
284
265
285
const mapState = ( {
286
+ namespace,
266
287
isWritable,
267
288
isReadonlyView,
268
289
isSearchIndexesSupported,
@@ -271,6 +292,7 @@ const mapState = ({
271
292
searchIndexes,
272
293
indexView,
273
294
} : RootState ) => ( {
295
+ namespace,
274
296
isWritable,
275
297
isReadonlyView,
276
298
isSearchIndexesSupported,
0 commit comments