Skip to content

Commit

Permalink
Merge branch 'main' into COMPASS-8275-setup-global-writes-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit authored Sep 25, 2024
2 parents 22ff79f + 9d33a70 commit c6b53f4
Show file tree
Hide file tree
Showing 29 changed files with 1,009 additions and 408 deletions.
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The following third-party software is used by and included in **Mongodb Compass**.
This document was automatically generated on Mon Sep 23 2024.
This document was automatically generated on Tue Sep 24 2024.

## List of dependencies

Expand Down
2 changes: 1 addition & 1 deletion docs/tracking-plan.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Compass Tracking Plan

Generated on Mon, Sep 23, 2024 at 01:02 PM
Generated on Tue, Sep 24, 2024 at 03:03 PM

## Table of Contents

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ export function DropdownMenuButton<Action extends string>({
buttonProps,
iconSize = ItemActionButtonSize.Default,
'data-testid': dataTestId,
hideOnNarrow = true,
}: {
actions: MenuAction<Action>[];
onAction(actionName: Action): void;
Expand All @@ -514,6 +515,7 @@ export function DropdownMenuButton<Action extends string>({
'data-testid'?: string;
buttonText: string;
buttonProps: ButtonProps;
hideOnNarrow?: boolean;
}) {
// this ref is used by the Menu component to calculate the height and position
// of the menu, and by us to give back the focus to the trigger when the menu
Expand Down Expand Up @@ -567,7 +569,9 @@ export function DropdownMenuButton<Action extends string>({
rightGlyph={<Icon glyph={'CaretDown'} />}
title={buttonText}
>
<span className={hiddenOnNarrowStyles}>{buttonText}</span>
<span className={hideOnNarrow ? hiddenOnNarrowStyles : undefined}>
{buttonText}
</span>
{children}
</Button>
);
Expand Down
4 changes: 0 additions & 4 deletions packages/compass-crud/src/stores/crud-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2064,10 +2064,6 @@ export function activateDocumentsPlugin(
}
});

on(localAppRegistry, 'refresh-collection-stats', () => {
void collection.fetch({ dataService, force: true });
});

if (!options.noRefreshOnConfigure) {
queueMicrotask(() => {
void store.refreshDocuments();
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-indexes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"devDependencies": {
"@mongodb-js/atlas-service": "^0.28.2",
"@mongodb-js/eslint-config-compass": "^1.1.7",
"@mongodb-js/mocha-config-compass": "^1.4.2",
"@mongodb-js/prettier-config-compass": "^1.0.2",
Expand All @@ -61,14 +60,14 @@
"electron-mocha": "^12.2.0",
"eslint": "^7.25.0",
"mocha": "^10.2.0",
"mongodb-ns": "^2.4.2",
"nyc": "^15.1.0",
"react-dom": "^17.0.2",
"sinon": "^9.2.3",
"typescript": "^5.0.4",
"xvfb-maybe": "^0.2.1"
},
"dependencies": {
"@mongodb-js/atlas-service": "^0.28.3",
"@mongodb-js/compass-app-stores": "^7.28.0",
"@mongodb-js/compass-components": "^1.29.4",
"@mongodb-js/compass-connections": "^1.42.0",
Expand All @@ -88,6 +87,7 @@
"mongodb-collection-model": "^5.23.3",
"mongodb-data-service": "^22.23.3",
"mongodb-query-parser": "^4.2.3",
"mongodb-ns": "^2.4.2",
"numeral": "^2.0.6",
"react": "^17.0.2",
"react-redux": "^8.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import type {
LGColumnDef,
LGTableDataType,
HeaderGroup,
LeafyGreenTableCell,
LeafyGreenTableRow,
SortingState,
Expand Down Expand Up @@ -76,6 +75,7 @@ const tableHeadDarkModeStyles = css({
});

const tableHeadCellStyles = css({
whiteSpace: 'nowrap',
'> div': {
// Push the sort button to the right of the head cell.
justifyContent: 'space-between',
Expand Down Expand Up @@ -126,7 +126,7 @@ export function IndexesTable<T>({
isSticky
className={cx(tableHeadStyles, darkMode && tableHeadDarkModeStyles)}
>
{table.getHeaderGroups().map((headerGroup: HeaderGroup<T>) => (
{table.getHeaderGroups().map((headerGroup) => (
<HeaderRow key={headerGroup.id}>
{headerGroup.headers.map((header) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('IndexesToolbar Component', function () {
isWritable={true}
writeStateDescription={undefined}
onRefreshIndexes={() => {}}
isAtlasSearchSupported={false}
isSearchIndexesSupported={false}
isRefreshing={false}
onIndexViewChanged={() => {}}
onCreateRegularIndexClick={() => {}}
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('IndexesToolbar Component', function () {
showInsights: true,
});

renderIndexesToolbar({ isAtlasSearchSupported: true });
renderIndexesToolbar({ isSearchIndexesSupported: true });
});

it('should render the create index dropdown button enabled', async function () {
Expand All @@ -100,7 +100,7 @@ describe('IndexesToolbar Component', function () {
showInsights: true,
});

renderIndexesToolbar({ isAtlasSearchSupported: false });
renderIndexesToolbar({ isSearchIndexesSupported: false });
});

it('should render the create index button only', function () {
Expand Down Expand Up @@ -198,7 +198,7 @@ describe('IndexesToolbar Component', function () {
it('calls onCreateRegularIndexClick when index button is clicked', function () {
const onCreateRegularIndexClickSpy = sinon.spy();
renderIndexesToolbar({
isAtlasSearchSupported: true,
isSearchIndexesSupported: true,
onCreateRegularIndexClick: onCreateRegularIndexClickSpy,
});

Expand All @@ -221,7 +221,7 @@ describe('IndexesToolbar Component', function () {
it('calls onCreateSearchIndexClick when index button is clicked', function () {
const onCreateSearchIndexClickSpy = sinon.spy();
renderIndexesToolbar({
isAtlasSearchSupported: true,
isSearchIndexesSupported: true,
onCreateSearchIndexClick: onCreateSearchIndexClickSpy,
});

Expand Down Expand Up @@ -308,7 +308,7 @@ describe('IndexesToolbar Component', function () {

it('when it supports search management, it changes tab view', function () {
renderIndexesToolbar({
isAtlasSearchSupported: true,
isSearchIndexesSupported: true,
onIndexViewChanged: onChangeViewCallback,
});
const segmentControl = screen.getByText('Search Indexes');
Expand All @@ -320,7 +320,7 @@ describe('IndexesToolbar Component', function () {

it('when it does not support search management, it renders tab as disabled', function () {
renderIndexesToolbar({
isAtlasSearchSupported: false,
isSearchIndexesSupported: false,
onIndexViewChanged: onChangeViewCallback,
});
const segmentControl = screen.getByText('Search Indexes');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
} from '@mongodb-js/compass-components';

import type { RootState } from '../../modules';
import {
SearchIndexesStatuses,
createSearchIndexOpened,
} from '../../modules/search-indexes';
import { createSearchIndexOpened } from '../../modules/search-indexes';
import { createIndexOpened } from '../../modules/create-index';
import type { IndexView } from '../../modules/index-view';
import { indexViewChanged } from '../../modules/index-view';
Expand Down Expand Up @@ -61,7 +58,7 @@ type IndexesToolbarProps = {
onCreateRegularIndexClick: () => void;
onCreateSearchIndexClick: () => void;
writeStateDescription?: string;
isAtlasSearchSupported: boolean;
isSearchIndexesSupported: boolean;
// via withPreferences:
readOnly?: boolean;
};
Expand All @@ -76,7 +73,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
isRefreshing,
writeStateDescription,
hasTooManyIndexes,
isAtlasSearchSupported,
isSearchIndexesSupported,
onRefreshIndexes,
onIndexViewChanged,
readOnly, // preferences readOnly.
Expand Down Expand Up @@ -106,7 +103,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
<div className={createIndexButtonContainerStyles}>
<CreateIndexButton
isSearchManagementActive={isSearchManagementActive}
isAtlasSearchSupported={isAtlasSearchSupported}
isSearchIndexesSupported={isSearchIndexesSupported}
isWritable={isWritable}
onCreateRegularIndexClick={onCreateRegularIndexClick}
onCreateSearchIndexClick={onCreateSearchIndexClick}
Expand Down Expand Up @@ -147,7 +144,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
>
Indexes
</SegmentedControlOption>
{!isAtlasSearchSupported && (
{!isSearchIndexesSupported && (
<Tooltip
align="top"
justify="middle"
Expand All @@ -174,7 +171,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
</p>
</Tooltip>
)}
{isAtlasSearchSupported && (
{isSearchIndexesSupported && (
<SegmentedControlOption
data-testid="search-indexes-tab"
value="search-indexes"
Expand All @@ -200,7 +197,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({

type CreateIndexButtonProps = {
isSearchManagementActive: boolean;
isAtlasSearchSupported: boolean;
isSearchIndexesSupported: boolean;
isWritable: boolean;
onCreateRegularIndexClick: () => void;
onCreateSearchIndexClick: () => void;
Expand All @@ -212,7 +209,7 @@ export const CreateIndexButton: React.FunctionComponent<
CreateIndexButtonProps
> = ({
isSearchManagementActive,
isAtlasSearchSupported,
isSearchIndexesSupported,
isWritable,
onCreateRegularIndexClick,
onCreateSearchIndexClick,
Expand All @@ -229,7 +226,7 @@ export const CreateIndexButton: React.FunctionComponent<
[onCreateRegularIndexClick, onCreateSearchIndexClick]
);

if (isAtlasSearchSupported && isSearchManagementActive) {
if (isSearchIndexesSupported && isSearchManagementActive) {
return (
<DropdownMenuButton
data-testid="multiple-index-types-creation-dropdown"
Expand All @@ -244,6 +241,7 @@ export const CreateIndexButton: React.FunctionComponent<
{ action: 'createSearchIndex', label: 'Search Index' },
]}
onAction={onActionDispatch}
hideOnNarrow={false}
/>
);
}
Expand All @@ -264,18 +262,19 @@ export const CreateIndexButton: React.FunctionComponent<
const mapState = ({
isWritable,
isReadonlyView,
isSearchIndexesSupported,
description,
serverVersion,
searchIndexes,
indexView,
}: RootState) => ({
isWritable,
isReadonlyView,
isSearchIndexesSupported,
writeStateDescription: description,
indexView,
serverVersion,
isAtlasSearchSupported:
searchIndexes.status !== SearchIndexesStatuses.NOT_AVAILABLE,
searchIndexes,
});

const mapDispatch = {
Expand Down
Loading

0 comments on commit c6b53f4

Please sign in to comment.