Skip to content

Commit ae91539

Browse files
committed
hide indexes when not available
1 parent 856f210 commit ae91539

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/compass-indexes/src/plugin-title.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
33
import type { RootState } from './modules';
44
import { Badge, css, spacing, Tooltip } from '@mongodb-js/compass-components';
55
import numeral from 'numeral';
6+
import { usePreference } from 'compass-preferences-model/provider';
67

78
const containerStyles = css({
89
display: 'flex',
@@ -90,6 +91,8 @@ const TabTitle = ({
9091
};
9192
}, [collectionStats]);
9293

94+
const enableDbAndCollStats = usePreference('enableDbAndCollStats');
95+
9396
const details = [
9497
`Indexes: ${indexCount}`,
9598
`Total Size: ${totalIndexSize}`,
@@ -99,7 +102,9 @@ const TabTitle = ({
99102
return (
100103
<div data-testid="indexes-tab-title" className={containerStyles}>
101104
Indexes
102-
<CollectionStats text={indexCount} details={details} />
105+
{enableDbAndCollStats && (
106+
<CollectionStats text={indexCount} details={details} />
107+
)}
103108
</div>
104109
);
105110
};

0 commit comments

Comments
 (0)