diff --git a/packages/compass-crud/src/components/change-view/change-view.tsx b/packages/compass-crud/src/components/change-view/change-view.tsx index 24bcb9e08d6..bdf569d5d13 100644 --- a/packages/compass-crud/src/components/change-view/change-view.tsx +++ b/packages/compass-crud/src/components/change-view/change-view.tsx @@ -220,7 +220,7 @@ function ChangeArrayItem({ item }: { item: ItemBranch }) { const shape = getValueShape(value); if (shape === 'array') { // array summary followed by array items if expanded - return ; + return ; } else if (shape === 'object') { // object summary followed by object properties if expanded return ; @@ -401,9 +401,7 @@ function ChangeObjectProperty({ property }: { property: PropertyBranch }) { const shape = getValueShape(value); if (shape === 'array') { // array summary followed by array items if expanded - return ( - - ); + return ; } else if (shape === 'object') { // object summary followed by object properties if expanded return ( diff --git a/packages/compass-crud/src/components/crud-toolbar.spec.tsx b/packages/compass-crud/src/components/crud-toolbar.spec.tsx index 52a218884d0..14a05becc5b 100644 --- a/packages/compass-crud/src/components/crud-toolbar.spec.tsx +++ b/packages/compass-crud/src/components/crud-toolbar.spec.tsx @@ -50,7 +50,6 @@ describe('CrudToolbar Component', function () { isWritable instanceDescription="" onApplyClicked={noop} - onResetClicked={noop} onUpdateButtonClicked={noop} onDeleteButtonClicked={noop} onExpandAllClicked={noop} @@ -920,7 +919,6 @@ describe('CrudToolbar Component', function () { lastCountRunMaxTimeMS={1234} instanceDescription="" onApplyClicked={noop} - onResetClicked={noop} onUpdateButtonClicked={noop} onDeleteButtonClicked={noop} onExpandAllClicked={noop} diff --git a/packages/compass-crud/src/components/crud-toolbar.tsx b/packages/compass-crud/src/components/crud-toolbar.tsx index 9a7e274cb2f..414a4a32f20 100644 --- a/packages/compass-crud/src/components/crud-toolbar.tsx +++ b/packages/compass-crud/src/components/crud-toolbar.tsx @@ -149,7 +149,6 @@ export type CrudToolbarProps = { lastCountRunMaxTimeMS: number; loadingCount: boolean; onApplyClicked: () => void; - onResetClicked: () => void; onUpdateButtonClicked: () => void; onDeleteButtonClicked: () => void; onExpandAllClicked: () => void; @@ -184,7 +183,6 @@ const CrudToolbar: React.FunctionComponent = ({ lastCountRunMaxTimeMS, loadingCount, onApplyClicked, - onResetClicked, onUpdateButtonClicked, onDeleteButtonClicked, onExpandAllClicked, @@ -326,7 +324,6 @@ const CrudToolbar: React.FunctionComponent = ({ resultId={resultId} buttonLabel="Find" onApply={onApplyClicked} - onReset={onResetClicked} showExplainButton={enableExplainPlan} /> diff --git a/packages/compass-crud/src/components/document-list.tsx b/packages/compass-crud/src/components/document-list.tsx index 35739e4fe79..c1ccbee8cbc 100644 --- a/packages/compass-crud/src/components/document-list.tsx +++ b/packages/compass-crud/src/components/document-list.tsx @@ -343,10 +343,6 @@ const DocumentList: React.FunctionComponent = (props) => { void store.refreshDocuments(true); }, [store]); - const onResetClicked = useCallback(() => { - void store.refreshDocuments(); - }, [store]); - const onCancelClicked = useCallback(() => { void store.cancelOperation(); }, [store]); @@ -585,7 +581,6 @@ const DocumentList: React.FunctionComponent = (props) => { getPage={getPage} insertDataHandler={onOpenInsert} onApplyClicked={onApplyClicked} - onResetClicked={onResetClicked} onUpdateButtonClicked={onUpdateButtonClicked} onDeleteButtonClicked={onDeleteButtonClicked} onExpandAllClicked={onExpandAllClicked} diff --git a/packages/compass-crud/src/components/table-view/cell-editor.spec.tsx b/packages/compass-crud/src/components/table-view/cell-editor.spec.tsx index ea04d06e2d6..dc75d01c755 100644 --- a/packages/compass-crud/src/components/table-view/cell-editor.spec.tsx +++ b/packages/compass-crud/src/components/table-view/cell-editor.spec.tsx @@ -341,9 +341,7 @@ describe('', function () { /> ); - const input = screen.getByTestId( - 'table-view-cell-editor-value-input' - ) as HTMLInputElement; + const input = screen.getByTestId('table-view-cell-editor-value-input'); expect(input).to.exist; userEvent.clear(input); userEvent.type(input, 'new input'); @@ -527,7 +525,7 @@ describe('', function () { const fieldInput = screen.getByTestId( 'table-view-cell-editor-fieldname-input' - ) as HTMLInputElement; + ); expect(fieldInput).to.exist; userEvent.clear(fieldInput); userEvent.type(fieldInput, 'fieldname'); @@ -574,7 +572,7 @@ describe('', function () { const fieldInput = screen.getByTestId( 'table-view-cell-editor-fieldname-input' - ) as HTMLInputElement; + ); expect(fieldInput).to.exist; userEvent.clear(fieldInput); userEvent.type(fieldInput, 'fieldname'); @@ -697,9 +695,7 @@ describe('', function () { /> ); - const input = screen.getByTestId( - 'table-view-cell-editor-value-input' - ) as HTMLInputElement; + const input = screen.getByTestId('table-view-cell-editor-value-input'); expect(input).to.exist; userEvent.clear(input); userEvent.type(input, 'new input'); diff --git a/packages/compass-crud/src/components/table-view/cell-editor.tsx b/packages/compass-crud/src/components/table-view/cell-editor.tsx index c658a124c20..165fbf6c979 100644 --- a/packages/compass-crud/src/components/table-view/cell-editor.tsx +++ b/packages/compass-crud/src/components/table-view/cell-editor.tsx @@ -269,7 +269,7 @@ class CellEditor */ } this.props.api.refreshCells({ - rowNodes: [this.props.node as RowNode], + rowNodes: [this.props.node], force: true, }); return false; diff --git a/packages/compass-crud/src/components/table-view/document-table-view.spec.tsx b/packages/compass-crud/src/components/table-view/document-table-view.spec.tsx index 0ae9c864745..9d6bd0d43dd 100644 --- a/packages/compass-crud/src/components/table-view/document-table-view.spec.tsx +++ b/packages/compass-crud/src/components/table-view/document-table-view.spec.tsx @@ -60,10 +60,10 @@ describe('', function () { // - the '_id' column should not share that explicit width (keeps default) const nameHeader = document.querySelector( '.ag-header-cell[col-id="name"]' - ) as HTMLElement | null; + ); const idHeader = document.querySelector( '.ag-header-cell[col-id="_id"]' - ) as HTMLElement | null; + ); expect(nameHeader, 'name column header should exist').to.exist; expect(idHeader, '_id column header should exist').to.exist; if (nameHeader) { diff --git a/packages/compass-crud/src/components/table-view/document-table-view.tsx b/packages/compass-crud/src/components/table-view/document-table-view.tsx index e971b601a58..fba68053975 100644 --- a/packages/compass-crud/src/components/table-view/document-table-view.tsx +++ b/packages/compass-crud/src/components/table-view/document-table-view.tsx @@ -35,7 +35,6 @@ import type { GridApi, GridCellDef, GridReadyEvent, - RowNode, ValueGetterParams, ColumnResizedEvent, } from 'ag-grid-community'; @@ -256,7 +255,7 @@ export class DocumentTableView extends React.Component { node.data.hasFooter = true; node.data.state = state; this.gridApi?.refreshCells({ - rowNodes: [node as RowNode], + rowNodes: [node], columns: ['$rowActions'], force: true, }); diff --git a/packages/compass-crud/src/index.ts b/packages/compass-crud/src/index.ts index 36ca93f22da..da38ffa89a0 100644 --- a/packages/compass-crud/src/index.ts +++ b/packages/compass-crud/src/index.ts @@ -50,6 +50,7 @@ const CompassDocumentsPluginProvider = registerCompassPlugin( activate: activateDocumentsPlugin, }, { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion dataService: dataServiceLocator as DataServiceLocator< RequiredDataServiceProps, OptionalDataServiceProps diff --git a/packages/compass-crud/src/stores/crud-store.spec.ts b/packages/compass-crud/src/stores/crud-store.spec.ts index 9a4175d8473..18ca8fc3bcd 100644 --- a/packages/compass-crud/src/stores/crud-store.spec.ts +++ b/packages/compass-crud/src/stores/crud-store.spec.ts @@ -137,7 +137,7 @@ function onceDocumentEvent( ): Promise { // The once function was not meant for strongly typed events, so we need to // do some additional type casting. - return once(doc as unknown as EventEmitter, event as string); + return once(doc as unknown as EventEmitter, event); } const mockFieldStoreService = { @@ -2158,7 +2158,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'update' ); @@ -2188,7 +2188,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'replace' ); @@ -2219,7 +2219,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'update' ); @@ -2250,7 +2250,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'update' ); @@ -2297,7 +2297,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'update' ); @@ -2320,7 +2320,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'update' ); @@ -2347,7 +2347,7 @@ describe('store', function () { const [error, d] = await findAndModifyWithFLEFallback( dataServiceStub, 'compass-crud.test', - { _id: 1234 } as any, + { _id: 1234 }, { name: 'document_12345' }, 'replace' ); diff --git a/packages/compass-crud/test/render-with-query-bar.tsx b/packages/compass-crud/test/render-with-query-bar.tsx index df441090cd4..dc0a0b5a400 100644 --- a/packages/compass-crud/test/render-with-query-bar.tsx +++ b/packages/compass-crud/test/render-with-query-bar.tsx @@ -18,14 +18,14 @@ export const MockQueryBarPlugin: typeof QueryBarPlugin = getConnectionString() { return { hosts: [] } as any; }, - } as any, - instance: { on() {}, removeListener() {} } as any, + }, + instance: { on() {}, removeListener() {} }, favoriteQueryStorageAccess: compassFavoriteQueryStorageAccess, recentQueryStorageAccess: compassRecentQueryStorageAccess, - atlasAiService: {} as any, + atlasAiService: {}, collection: { fetchMetadata: () => Promise.resolve({} as any), - } as any, + }, }); export const renderWithQueryBar = ( diff --git a/packages/compass-e2e-tests/helpers/commands/run-find-operation.ts b/packages/compass-e2e-tests/helpers/commands/run-find-operation.ts index 452815d1a48..e4333097e02 100644 --- a/packages/compass-e2e-tests/helpers/commands/run-find-operation.ts +++ b/packages/compass-e2e-tests/helpers/commands/run-find-operation.ts @@ -92,45 +92,11 @@ async function waitUntilCollapsed(browser: CompassBrowser, tabName: string) { }); } -async function maybeResetQuery(browser: CompassBrowser, tabName: string) { - // click reset if it is enabled to get us back to the empty state - const resetButton = browser.$(Selectors.queryBarResetFilterButton(tabName)); - await resetButton.waitForDisplayed(); - - if (await resetButton.isEnabled()) { - // look up the current resultId - const initialResultId = await browser.getQueryId(tabName); - - await browser.waitUntil(async () => { - // In some very rare cases on particularly slow machines in CI (looking at - // you macos hosts) clicking doesn't register on the first try, to work - // around that, we try to click with pause until the button is disabled - await browser.clickVisible(Selectors.queryBarResetFilterButton(tabName)); - await browser.pause(50); - return !(await resetButton.isEnabled()); - }); - // now we can easily see if we get a new resultId - // (which we should because resetting re-runs the query) - await browser.waitUntil(async () => { - const resultId = await browser.getQueryId(tabName); - return resultId !== initialResultId; - }); - } -} - async function collapseOptions(browser: CompassBrowser, tabName: string) { if (!(await isOptionsExpanded(browser, tabName))) { return; } - // Reset the query if there was one before. This helps to make the tests - // idempotent which is handy because you can work on them by focusing one it() - // at a time and expect it to find the same results as if you ran the whole - // suite. If we ever do want to test that all the options you had set before - // you collapsed the options are still in effect then we can make this - // behaviour opt-out through an option. - await maybeResetQuery(browser, tabName); - await browser.clickVisible(Selectors.queryBarOptionsToggle(tabName)); await waitUntilCollapsed(browser, tabName); } diff --git a/packages/compass-e2e-tests/helpers/selectors.ts b/packages/compass-e2e-tests/helpers/selectors.ts index ae97794e2a6..198a6609355 100644 --- a/packages/compass-e2e-tests/helpers/selectors.ts +++ b/packages/compass-e2e-tests/helpers/selectors.ts @@ -1226,10 +1226,6 @@ export const queryBarOptionsToggle = (tabName: string): string => { const tabSelector = collectionContent(tabName); return `${tabSelector} [data-testid="query-bar-options-toggle"]`; }; -export const queryBarResetFilterButton = (tabName: string): string => { - const tabSelector = collectionContent(tabName); - return `${tabSelector} [data-testid="query-bar-reset-filter-button"]`; -}; export const queryBarExportToLanguageButton = (tabName: string): string => { const tabSelector = collectionContent(tabName); return `${tabSelector} [data-testid="crud-export-to-language-button"]`; diff --git a/packages/compass-e2e-tests/tests/in-use-encryption.test.ts b/packages/compass-e2e-tests/tests/in-use-encryption.test.ts index fb402cca826..1724bc16fd5 100644 --- a/packages/compass-e2e-tests/tests/in-use-encryption.test.ts +++ b/packages/compass-e2e-tests/tests/in-use-encryption.test.ts @@ -642,7 +642,7 @@ describe('CSFLE / QE', function () { if ( ['prefixPreview', 'suffixPreview', 'substringPreview'].includes( - mode as string + mode ) && !serverSatisfies('>= 8.2.0', true) ) { @@ -651,7 +651,7 @@ describe('CSFLE / QE', function () { } if ( - ['prefixPreview', 'suffixPreview'].includes(mode as string) && + ['prefixPreview', 'suffixPreview'].includes(mode) && serverSatisfies('>=9.0.0-alpha0', true) ) { // prefixPreview and suffixPreview are renamed in 9.0.0 diff --git a/packages/compass-query-bar/src/components/query-ai.spec.tsx b/packages/compass-query-bar/src/components/query-ai.spec.tsx index 6c1b11db23b..03ed724a968 100644 --- a/packages/compass-query-bar/src/components/query-ai.spec.tsx +++ b/packages/compass-query-bar/src/components/query-ai.spec.tsx @@ -61,13 +61,11 @@ describe('QueryAI Component', function () { // TODO(COMPASS-7415): use default values instead of updating values @@ -108,7 +106,6 @@ describe('QueryBar Component', function () { beforeEach(async function () { preferences = await createSandboxFromDefaultPreferences(); onApplySpy = sinon.spy(); - onResetSpy = sinon.spy(); }); afterEach(cleanup); @@ -117,7 +114,6 @@ describe('QueryBar Component', function () { beforeEach(function () { renderQueryBar({ onApply: onApplySpy, - onReset: onResetSpy, }); }); @@ -149,7 +145,6 @@ describe('QueryBar Component', function () { renderQueryBar({ expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }); }); @@ -163,7 +158,6 @@ describe('QueryBar Component', function () { beforeEach(function () { renderQueryBar({ onApply: onApplySpy, - onReset: onResetSpy, }); }); @@ -197,7 +191,6 @@ describe('QueryBar Component', function () { queryOptionsLayout: ['project'], expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }, {} ); @@ -224,7 +217,6 @@ describe('QueryBar Component', function () { queryOptionsLayout: ['project'], expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }, {} ); @@ -260,7 +252,6 @@ describe('QueryBar Component', function () { source="test" buttonLabel="Apply" onApply={noop} - onReset={noop} resultId="123" /> @@ -325,7 +316,6 @@ describe('QueryBar Component', function () { queryOptionsLayout: ['project', 'sort'], expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }); }); @@ -341,7 +331,6 @@ describe('QueryBar Component', function () { queryOptionsLayout: ['project', 'sort', 'collation'], expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }); }); @@ -357,7 +346,6 @@ describe('QueryBar Component', function () { queryOptionsLayout: ['project', 'sort', ['collation', 'limit']], expanded: true, onApply: onApplySpy, - onReset: onResetSpy, }); }); diff --git a/packages/compass-query-bar/src/components/query-bar.tsx b/packages/compass-query-bar/src/components/query-bar.tsx index 384ef7aba3b..89cb2d01607 100644 --- a/packages/compass-query-bar/src/components/query-bar.tsx +++ b/packages/compass-query-bar/src/components/query-bar.tsx @@ -29,11 +29,10 @@ import { QueryBarRow } from './query-bar-row'; import { applyQuery, openExportToLanguage, - resetQuery, explainQuery, } from '../stores/query-bar-reducer'; import { toggleQueryOptions } from '../stores/query-bar-reducer'; -import { isEqualDefaultQuery, isQueryValid } from '../utils/query'; +import { isQueryValid } from '../utils/query'; import type { QueryProperty } from '../constants/query-properties'; import { QueryAI } from './query-ai'; import type { @@ -108,10 +107,8 @@ const QueryOptionsToggle = connect( type QueryBarProps = { buttonLabel?: string; onApply: () => void; - onReset: () => void; onOpenExportToLanguage: () => void; queryOptionsLayout?: (QueryOption | QueryOption[])[]; - queryChanged: boolean; resultId?: string | number; /** * For testing purposes only, allows to track whether or not apply button was @@ -133,7 +130,6 @@ type QueryBarProps = { export const QueryBar: React.FunctionComponent = ({ buttonLabel = 'Apply', onApply, - onReset, // Used to specify which query options to show and where they are positioned. queryOptionsLayout = [ 'project', @@ -141,7 +137,6 @@ export const QueryBar: React.FunctionComponent = ({ ['collation', 'skip', 'limit'], 'hint', ], - queryChanged, resultId, applyId, filterHasContent, @@ -259,16 +254,6 @@ export const QueryBar: React.FunctionComponent = ({ Explain )} -