Skip to content

Commit 877e8bb

Browse files
committed
update banner
1 parent 2d7c937 commit 877e8bb

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
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

2326
import type { RootState } from '../../modules';
2427
import { createSearchIndexOpened } from '../../modules/search-indexes';
28+
import { getAtlasSearchIndexesLink } from '../../utils/atlas-search-indexes-link';
2529
import { createIndexOpened } from '../../modules/create-index';
2630
import type { IndexView } from '../../modules/index-view';
2731
import { indexViewChanged } from '../../modules/index-view';
@@ -46,6 +50,7 @@ const createIndexButtonContainerStyles = css({
4650
});
4751

4852
type 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+
6674
export 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

265294
const 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,

packages/compass-indexes/src/components/indexes/indexes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const containerStyles = css({
4848
flexGrow: 1,
4949
});
5050

51-
const linkTitle = 'Atlas Search.';
51+
const linkTitle = 'Search and Vector Search.';
5252

5353
const DISMISSED_SEARCH_INDEXES_BANNER_LOCAL_STORAGE_KEY =
5454
'mongodb_compass_dismissedSearchIndexesBanner' as const;

0 commit comments

Comments
 (0)