Skip to content
Open
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 @@ -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 <ChangeArrayItemArray item={item as ArrayItemBranch} />;
return <ChangeArrayItemArray item={item} />;
} else if (shape === 'object') {
// object summary followed by object properties if expanded
return <ChangeArrayItemObject item={item as ObjectItemBranch} />;
Expand Down Expand Up @@ -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 (
<ChangeObjectPropertyArray property={property as ArrayPropertyBranch} />
);
return <ChangeObjectPropertyArray property={property} />;
} else if (shape === 'object') {
// object summary followed by object properties if expanded
return (
Expand Down
2 changes: 0 additions & 2 deletions packages/compass-crud/src/components/crud-toolbar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ describe('CrudToolbar Component', function () {
isWritable
instanceDescription=""
onApplyClicked={noop}
onResetClicked={noop}
onUpdateButtonClicked={noop}
onDeleteButtonClicked={noop}
onExpandAllClicked={noop}
Expand Down Expand Up @@ -920,7 +919,6 @@ describe('CrudToolbar Component', function () {
lastCountRunMaxTimeMS={1234}
instanceDescription=""
onApplyClicked={noop}
onResetClicked={noop}
onUpdateButtonClicked={noop}
onDeleteButtonClicked={noop}
onExpandAllClicked={noop}
Expand Down
3 changes: 0 additions & 3 deletions packages/compass-crud/src/components/crud-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export type CrudToolbarProps = {
lastCountRunMaxTimeMS: number;
loadingCount: boolean;
onApplyClicked: () => void;
onResetClicked: () => void;
onUpdateButtonClicked: () => void;
onDeleteButtonClicked: () => void;
onExpandAllClicked: () => void;
Expand Down Expand Up @@ -184,7 +183,6 @@ const CrudToolbar: React.FunctionComponent<CrudToolbarProps> = ({
lastCountRunMaxTimeMS,
loadingCount,
onApplyClicked,
onResetClicked,
onUpdateButtonClicked,
onDeleteButtonClicked,
onExpandAllClicked,
Expand Down Expand Up @@ -326,7 +324,6 @@ const CrudToolbar: React.FunctionComponent<CrudToolbarProps> = ({
resultId={resultId}
buttonLabel="Find"
onApply={onApplyClicked}
onReset={onResetClicked}
showExplainButton={enableExplainPlan}
/>
</div>
Expand Down
5 changes: 0 additions & 5 deletions packages/compass-crud/src/components/document-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,6 @@ const DocumentList: React.FunctionComponent<DocumentListProps> = (props) => {
void store.refreshDocuments(true);
}, [store]);

const onResetClicked = useCallback(() => {
void store.refreshDocuments();
}, [store]);

const onCancelClicked = useCallback(() => {
void store.cancelOperation();
}, [store]);
Expand Down Expand Up @@ -585,7 +581,6 @@ const DocumentList: React.FunctionComponent<DocumentListProps> = (props) => {
getPage={getPage}
insertDataHandler={onOpenInsert}
onApplyClicked={onApplyClicked}
onResetClicked={onResetClicked}
onUpdateButtonClicked={onUpdateButtonClicked}
onDeleteButtonClicked={onDeleteButtonClicked}
onExpandAllClicked={onExpandAllClicked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ describe('<CellEditor />', function () {
/>
);

const input = screen.getByTestId(
'table-view-cell-editor-value-input'
) as HTMLInputElement;
const input = screen.getByTestId('table-view-cell-editor-value-input');
Comment thread
Anemy marked this conversation as resolved.
expect(input).to.exist;
userEvent.clear(input);
userEvent.type(input, 'new input');
Expand Down Expand Up @@ -527,7 +525,7 @@ describe('<CellEditor />', function () {

const fieldInput = screen.getByTestId(
'table-view-cell-editor-fieldname-input'
) as HTMLInputElement;
);
Comment thread
Anemy marked this conversation as resolved.
expect(fieldInput).to.exist;
userEvent.clear(fieldInput);
userEvent.type(fieldInput, 'fieldname');
Expand Down Expand Up @@ -574,7 +572,7 @@ describe('<CellEditor />', function () {

const fieldInput = screen.getByTestId(
'table-view-cell-editor-fieldname-input'
) as HTMLInputElement;
);
Comment thread
Anemy marked this conversation as resolved.
expect(fieldInput).to.exist;
userEvent.clear(fieldInput);
userEvent.type(fieldInput, 'fieldname');
Expand Down Expand Up @@ -697,9 +695,7 @@ describe('<CellEditor />', function () {
/>
);

const input = screen.getByTestId(
'table-view-cell-editor-value-input'
) as HTMLInputElement;
const input = screen.getByTestId('table-view-cell-editor-value-input');
Comment thread
Anemy marked this conversation as resolved.
expect(input).to.exist;
userEvent.clear(input);
userEvent.type(input, 'new input');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class CellEditor
*/
}
this.props.api.refreshCells({
rowNodes: [this.props.node as RowNode],
rowNodes: [this.props.node],
force: true,
});
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ describe('<DocumentTableView />', 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;
);
Comment thread
Anemy marked this conversation as resolved.
const idHeader = document.querySelector(
'.ag-header-cell[col-id="_id"]'
) as HTMLElement | null;
);
Comment thread
Anemy marked this conversation as resolved.
expect(nameHeader, 'name column header should exist').to.exist;
expect(idHeader, '_id column header should exist').to.exist;
if (nameHeader) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import type {
GridApi,
GridCellDef,
GridReadyEvent,
RowNode,
ValueGetterParams,
ColumnResizedEvent,
} from 'ag-grid-community';
Expand Down Expand Up @@ -256,7 +255,7 @@ export class DocumentTableView extends React.Component<DocumentTableViewProps> {
node.data.hasFooter = true;
node.data.state = state;
this.gridApi?.refreshCells({
rowNodes: [node as RowNode],
rowNodes: [node],
columns: ['$rowActions'],
force: true,
});
Expand Down
1 change: 1 addition & 0 deletions packages/compass-crud/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions packages/compass-crud/src/stores/crud-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function onceDocumentEvent(
): Promise<unknown[]> {
// 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 = {
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'
);
Expand All @@ -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'
);
Expand All @@ -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'
);
Expand Down
8 changes: 4 additions & 4 deletions packages/compass-crud/test/render-with-query-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions packages/compass-e2e-tests/helpers/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]`;
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-e2e-tests/tests/in-use-encryption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ describe('CSFLE / QE', function () {

if (
['prefixPreview', 'suffixPreview', 'substringPreview'].includes(
mode as string
mode
) &&
!serverSatisfies('>= 8.2.0', true)
) {
Expand All @@ -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
Expand Down
12 changes: 5 additions & 7 deletions packages/compass-query-bar/src/components/query-ai.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ describe('QueryAI Component', function () {
// TODO(COMPASS-7415): use default values instead of updating values
<PreferencesProvider value={preferences}>
<LoggerProvider
value={
{
createLogger() {
return createNoopLogger();
},
} as any
}
value={{
createLogger() {
return createNoopLogger();
},
}}
>
<TelemetryProvider
options={{
Expand Down
Loading
Loading