Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('IndexesToolbar Component', function () {
onCreateSearchIndexClick={() => {}}
namespace=""
showAtlasSearchLink={false}
serverVersion={'8.0.11'}
{...props}
/>
</PreferencesProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
SegmentedControlOption,
} from '@mongodb-js/compass-components';
import { useConnectionInfo } from '@mongodb-js/compass-connections/provider';
import semver from 'semver';

import type { RootState } from '../../modules';
import { createSearchIndexOpened } from '../../modules/search-indexes';
Expand Down Expand Up @@ -53,6 +54,19 @@ const createIndexButtonContainerStyles = css({
width: 'fit-content',
});

const MIN_SEARCH_INDEX_MANAGEMENT_SERVER_VERSION = '6.0.7';

const serverSupportsSearchIndexManagement = (serverVersion: string) => {
try {
return semver.gte(
serverVersion,
MIN_SEARCH_INDEX_MANAGEMENT_SERVER_VERSION
);
} catch {
return false;
}
};

type IndexesToolbarProps = {
namespace: string;
indexView: IndexView;
Expand All @@ -62,6 +76,7 @@ type IndexesToolbarProps = {
isRefreshing: boolean;
onRefreshIndexes: () => void;
onIndexViewChanged: (newView: IndexView) => void;
serverVersion: string;
// connected:
isReadonlyView: boolean;
isWritable: boolean;
Expand All @@ -88,6 +103,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
isSearchIndexesSupported,
onRefreshIndexes,
onIndexViewChanged,
serverVersion,
readOnly, // preferences readOnly.
}) => {
const isSearchManagementActive = usePreference('enableAtlasSearchIndexes');
Expand Down Expand Up @@ -188,16 +204,27 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
</SegmentedControlOption>
}
>
<p>
Atlas Search index management in Compass is only available
for Atlas local deployments and clusters running MongoDB
6.0.7 or newer.
</p>
<p>
For clusters running an earlier version of MongoDB, you
can manage your Atlas Search indexes from the Atlas web
Ul, with the CLI, or with the Administration API.
</p>
{serverSupportsSearchIndexManagement(serverVersion) ? (
<p>
Unable to fetch search indexes. This can occur when your
cluster does not support search indexes or the request
to list search indexes failed.
</p>
) : (
<>
<p>
Atlas Search index management in Compass is only
available for Atlas local deployments and clusters
running MongoDB 6.0.7 or newer.
</p>
<p>
For clusters running an earlier version of MongoDB,
you can manage your Atlas Search indexes from the
Atlas web Ul, with the CLI, or with the Administration
API.
</p>
</>
)}
</Tooltip>
)}
{isSearchIndexesSupported && (
Expand Down
Loading