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 77  WorkspaceContainer , 
88  css , 
99  spacing , 
10+   usePersistedState , 
1011}  from  '@mongodb-js/compass-components' ; 
1112
1213import  IndexesToolbar  from  '../indexes-toolbar/indexes-toolbar' ; 
@@ -49,13 +50,22 @@ const containerStyles = css({
4950
5051const  linkTitle  =  'Atlas Search.' ; 
5152
53+ const  DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY  = 
54+   'mongodb_compass_dismissedSearchIndexesBanner'  as  const ; 
55+ 
5256const  AtlasIndexesBanner  =  ( {  namespace } : {  namespace : string  } )  =>  { 
5357  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 )  { 
5564    return  null ; 
5665  } 
66+ 
5767  return  ( 
58-     < Banner  variant = "info" > 
68+     < Banner  variant = "info"   dismissible   onClose = { ( )   =>   setDismissed ( true ) } > 
5969      < Body  weight = "medium" > Looking for search indexes?</ Body > 
6070      These indexes can be created and viewed under{ ' ' } 
6171      { atlasMetadata  ? ( 
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222  spacing , 
2323  useDarkMode , 
2424  WorkspaceContainer , 
25+   usePersistedState , 
2526  lighten , 
2627  Banner , 
2728  Body , 
@@ -298,6 +299,9 @@ const AnalyzingScreen: React.FunctionComponent<{
298299  ) ; 
299300} ; 
300301
302+ const  DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY  = 
303+   'mongodb_compass_dismissedSearchIndexesBanner'  as  const ; 
304+ 
301305const  FieldList : React . FunctionComponent < { 
302306  schema : MongodbSchema  |  null ; 
303307  analysisState : AnalysisState ; 
@@ -341,8 +345,18 @@ const title = 'Atlas’ Performance Advisor.';
341345const  PerformanceAdvisorBanner  =  ( )  =>  { 
342346  const  connectionInfo  =  useConnectionInfo ( ) ; 
343347  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+ 
344358  return  ( 
345-     < Banner  variant = "info" > 
359+     < Banner  variant = "info"   dismissible   onClose = { ( )   =>   setDismissed ( true ) } > 
346360      < Body  weight = "medium" > Looking for schema anti-patterns?</ Body > 
347361      In its place, you may refer to Data Explorer’s performance insights{ ' ' } 
348362      < Badge  className = { insightsBadgeStyles }  variant = "blue" > 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments