File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
compass-indexes/src/components/indexes
compass-schema/src/components Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 7
7
WorkspaceContainer ,
8
8
css ,
9
9
spacing ,
10
+ usePersistedState ,
10
11
} from '@mongodb-js/compass-components' ;
11
12
12
13
import IndexesToolbar from '../indexes-toolbar/indexes-toolbar' ;
@@ -49,13 +50,22 @@ const containerStyles = css({
49
50
50
51
const linkTitle = 'Atlas Search.' ;
51
52
53
+ const DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY =
54
+ 'mongodb_compass_dismissedSearchIndexesBanner' as const ;
55
+
52
56
const AtlasIndexesBanner = ( { namespace } : { namespace : string } ) => {
53
57
const { atlasMetadata } = useConnectionInfo ( ) ;
54
- if ( ! atlasMetadata ) {
58
+ const [ dismissed , setDismissed ] = usePersistedState (
59
+ DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY ,
60
+ false
61
+ ) ;
62
+
63
+ if ( ! atlasMetadata || dismissed ) {
55
64
return null ;
56
65
}
66
+
57
67
return (
58
- < Banner variant = "info" >
68
+ < Banner variant = "info" dismissible onClose = { ( ) => setDismissed ( true ) } >
59
69
< Body weight = "medium" > Looking for search indexes?</ Body >
60
70
These indexes can be created and viewed under{ ' ' }
61
71
{ atlasMetadata ? (
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
22
22
spacing ,
23
23
useDarkMode ,
24
24
WorkspaceContainer ,
25
+ usePersistedState ,
25
26
lighten ,
26
27
Banner ,
27
28
Body ,
@@ -298,6 +299,9 @@ const AnalyzingScreen: React.FunctionComponent<{
298
299
) ;
299
300
} ;
300
301
302
+ const DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY =
303
+ 'mongodb_compass_dismissedSearchIndexesBanner' as const ;
304
+
301
305
const FieldList : React . FunctionComponent < {
302
306
schema : MongodbSchema | null ;
303
307
analysisState : AnalysisState ;
@@ -341,8 +345,18 @@ const title = 'Atlas’ Performance Advisor.';
341
345
const PerformanceAdvisorBanner = ( ) => {
342
346
const connectionInfo = useConnectionInfo ( ) ;
343
347
const track = useTelemetry ( ) ;
348
+
349
+ const [ dismissed , setDismissed ] = usePersistedState (
350
+ DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY ,
351
+ false
352
+ ) ;
353
+
354
+ if ( dismissed ) {
355
+ return < > </ > ;
356
+ }
357
+
344
358
return (
345
- < Banner variant = "info" >
359
+ < Banner variant = "info" dismissible onClose = { ( ) => setDismissed ( true ) } >
346
360
< Body weight = "medium" > Looking for schema anti-patterns?</ Body >
347
361
In its place, you may refer to Data Explorer’s performance insights{ ' ' }
348
362
< Badge className = { insightsBadgeStyles } variant = "blue" >
You can’t perform that action at this time.
0 commit comments