diff --git a/packages/compass-aggregations/src/components/aggregations/aggregations.spec.tsx b/packages/compass-aggregations/src/components/aggregations/aggregations.spec.tsx index e770ecd0885..ce792c32aa8 100644 --- a/packages/compass-aggregations/src/components/aggregations/aggregations.spec.tsx +++ b/packages/compass-aggregations/src/components/aggregations/aggregations.spec.tsx @@ -9,7 +9,6 @@ describe('Aggregations [Component]', function () { beforeEach(async function () { await renderWithStore( , + , { pipeline: [{ $match: { _id: 1 } }] }, undefined, { @@ -106,10 +101,6 @@ describe('PipelineToolbar', function () { within(settings).getByTestId('pipeline-toolbar-create-new-button'), 'shows create-new button' ).to.exist; - expect( - within(settings).getByTestId('pipeline-toolbar-export-button'), - 'shows export to language button' - ).to.exist; expect( within(settings).getByTestId('pipeline-toolbar-preview-toggle'), @@ -197,12 +188,7 @@ describe('PipelineToolbar', function () { assignExperiment={mockAssignExperiment} getAssignment={mockGetAssignment} > - + , { pipeline: [] }, // Initial state undefined, // Connection info diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/index.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/index.tsx index edd26f02345..b65563cba51 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/index.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/index.tsx @@ -53,7 +53,6 @@ export type PipelineToolbarProps = { isAggregationGeneratedFromQuery?: boolean; isBuilderView: boolean; showRunButton: boolean; - showExportButton: boolean; showExplainButton: boolean; onHideAIInputClick?: () => void; }; @@ -61,7 +60,6 @@ export type PipelineToolbarProps = { export const PipelineToolbar: React.FunctionComponent = ({ isBuilderView, showRunButton, - showExportButton, showExplainButton, }) => { const darkMode = useDarkMode(); @@ -91,7 +89,6 @@ export const PipelineToolbar: React.FunctionComponent = ({ isOptionsVisible={isOptionsVisible} onToggleOptions={() => setIsOptionsVisible(!isOptionsVisible)} showRunButton={showRunButton} - showExportButton={showExportButton} showExplainButton={showExplainButton} /> {isOptionsVisible && ( diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.spec.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.spec.tsx index 50aeeba6463..4e6be26a6ec 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.spec.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.spec.tsx @@ -17,7 +17,6 @@ describe('PipelineHeader', function () { isOpenPipelineVisible isOptionsVisible showRunButton - showExportButton showExplainButton onToggleOptions={onToggleOptionsSpy} />, diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.tsx index edff962481a..ac64dbeda83 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/index.tsx @@ -57,7 +57,6 @@ const savedAggregationsPopoverStyles = css({ type PipelineHeaderProps = { isOptionsVisible: boolean; showRunButton: boolean; - showExportButton: boolean; showExplainButton: boolean; onToggleOptions: () => void; isOpenPipelineVisible: boolean; @@ -104,7 +103,6 @@ const SavedPipelinesButton: React.FunctionComponent = () => { export const PipelineHeader: React.FunctionComponent = ({ showRunButton, - showExportButton, showExplainButton, onToggleOptions, isOptionsVisible, @@ -126,7 +124,6 @@ export const PipelineHeader: React.FunctionComponent = ({ onToggleOptions={onToggleOptions} isOptionsVisible={isOptionsVisible} showRunButton={showRunButton} - showExportButton={showExportButton} showExplainButton={showExplainButton} /> diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.spec.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.spec.tsx index af50c90ea49..fdc1a9d23a2 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.spec.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.spec.tsx @@ -12,7 +12,6 @@ import { spy } from 'sinon'; import type { SinonSpy } from 'sinon'; import ConnectedPipelineActions, { PipelineActions } from './pipeline-actions'; import { renderWithStore } from '../../../../test/configure-store'; -import { changeStageDisabled } from '../../../modules/pipeline-builder/stage-editor'; import { type PreferencesAccess, createSandboxFromDefaultPreferences, @@ -26,13 +25,11 @@ describe('PipelineActions', function () { describe('options visible', function () { let onRunAggregationSpy: SinonSpy; let onToggleOptionsSpy: SinonSpy; - let onExportAggregationResultsSpy: SinonSpy; let onExplainAggregationSpy: SinonSpy; beforeEach(function () { onRunAggregationSpy = spy(); onToggleOptionsSpy = spy(); - onExportAggregationResultsSpy = spy(); onExplainAggregationSpy = spy(); render( @@ -40,11 +37,9 @@ describe('PipelineActions', function () { isOptionsVisible={true} showAIEntry={false} showRunButton={true} - showExportButton={true} showExplainButton={true} onRunAggregation={onRunAggregationSpy} onToggleOptions={onToggleOptionsSpy} - onExportAggregationResults={onExportAggregationResultsSpy} isExplainButtonDisabled={false} onExplainAggregation={onExplainAggregationSpy} onUpdateView={() => {}} @@ -64,17 +59,6 @@ describe('PipelineActions', function () { expect(onRunAggregationSpy.calledOnce).to.be.true; }); - it('calls onExportAggregationResults on click', function () { - const button = screen.getByTestId( - 'pipeline-toolbar-export-aggregation-button' - ); - expect(button).to.exist; - - userEvent.click(button); - - expect(onExportAggregationResultsSpy.calledOnce).to.be.true; - }); - it('calls onExplainAggregation on click', function () { const button = screen.getByTestId( 'pipeline-toolbar-explain-aggregation-button' @@ -107,11 +91,9 @@ describe('PipelineActions', function () { isOptionsVisible={false} showAIEntry={false} showRunButton={true} - showExportButton={true} showExplainButton={true} onRunAggregation={onRunAggregationSpy} onToggleOptions={onToggleOptionsSpy} - onExportAggregationResults={() => {}} onUpdateView={() => {}} onExplainAggregation={() => {}} onCollectionScanInsightActionButtonClick={() => {}} @@ -151,11 +133,9 @@ describe('PipelineActions', function () { isOptionsVisible={false} showAIEntry={false} showRunButton={true} - showExportButton={true} showExplainButton={true} onRunAggregation={onRunAggregationSpy} onToggleOptions={onToggleOptionsSpy} - onExportAggregationResults={() => {}} onUpdateView={() => {}} onExplainAggregation={() => {}} onCollectionScanInsightActionButtonClick={() => {}} @@ -174,26 +154,21 @@ describe('PipelineActions', function () { describe('disables actions when pipeline is invalid', function () { let onRunAggregationSpy: SinonSpy; - let onExportAggregationResultsSpy: SinonSpy; let onExplainAggregationSpy: SinonSpy; beforeEach(function () { onRunAggregationSpy = spy(); - onExportAggregationResultsSpy = spy(); onExplainAggregationSpy = spy(); render( {}} - onExportAggregationResults={onExportAggregationResultsSpy} onExplainAggregation={onExplainAggregationSpy} onUpdateView={() => {}} onCollectionScanInsightActionButtonClick={() => {}} @@ -213,18 +188,6 @@ describe('PipelineActions', function () { expect(onRunAggregationSpy.calledOnce).to.be.false; }); - it('export action disabled', function () { - const button = screen.getByTestId( - 'pipeline-toolbar-export-aggregation-button' - ); - expect(button.getAttribute('aria-disabled')).to.equal('true'); - - userEvent.click(button, undefined, { - skipPointerEventsCheck: true, - }); - expect(onExportAggregationResultsSpy.calledOnce).to.be.false; - }); - it('explain action disabled', function () { const button = screen.getByTestId( 'pipeline-toolbar-explain-aggregation-button' @@ -243,7 +206,6 @@ describe('PipelineActions', function () { const result = await renderWithStore( {}} >, @@ -264,12 +226,6 @@ describe('PipelineActions', function () { .getAttribute('aria-disabled') ).to.equal('true'); - expect( - screen - .getByTestId('pipeline-toolbar-export-aggregation-button') - .getAttribute('aria-disabled') - ).to.equal('true'); - expect( screen .getByTestId('pipeline-toolbar-run-button') @@ -294,12 +250,6 @@ describe('PipelineActions', function () { .getAttribute('aria-disabled') ).to.equal('true'); - expect( - screen - .getByTestId('pipeline-toolbar-export-aggregation-button') - .getAttribute('aria-disabled') - ).to.equal('true'); - expect( screen .getByTestId('pipeline-toolbar-run-button') @@ -307,33 +257,5 @@ describe('PipelineActions', function () { ).to.equal('true'); }); }); - - it('should disable export button when pipeline is $out / $merge', async function () { - await renderPipelineActions({ - pipeline: [{ $out: 'foo' }], - }); - - expect( - screen - .getByTestId('pipeline-toolbar-export-aggregation-button') - .getAttribute('aria-disabled') - ).to.equal('true'); - }); - - it('should disable export button when last enabled stage is $out / $merge', async function () { - const { store } = await renderPipelineActions({ - pipeline: [{ $out: 'foo' }, { $match: { _id: 1 } }], - }); - - store.dispatch(changeStageDisabled(1, true)); - - await waitFor(() => { - expect( - screen - .getByTestId('pipeline-toolbar-export-aggregation-button') - .getAttribute('aria-disabled') - ).to.equal('true'); - }); - }); }); }); diff --git a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.tsx b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.tsx index 556b20daa6b..7923f91966d 100644 --- a/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.tsx +++ b/packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-header/pipeline-actions.tsx @@ -10,17 +10,13 @@ import { } from '@mongodb-js/compass-components'; import { AIExperienceEntry } from '@mongodb-js/compass-generative-ai'; import type { RootState } from '../../../modules'; -import { - exportAggregationResults, - runAggregation, -} from '../../../modules/aggregation'; +import { runAggregation } from '../../../modules/aggregation'; import { updateView } from '../../../modules/update-view'; import { explainAggregation } from '../../../modules/explain'; import { getIsPipelineInvalidFromBuilderState, getPipelineStageOperatorsFromBuilderState, } from '../../../modules/pipeline-builder/builder-helpers'; -import { isOutputStage } from '../../../utils/stage'; import { openCreateIndexModal } from '../../../modules/insights'; import { useIsAIFeatureEnabled, @@ -40,10 +36,6 @@ type PipelineActionsProps = { isRunButtonDisabled?: boolean; onRunAggregation: () => void; - showExportButton?: boolean; - isExportButtonDisabled?: boolean; - onExportAggregationResults: () => void; - showUpdateViewButton?: boolean; isUpdateViewButtonDisabled?: boolean; onUpdateView: () => void; @@ -68,8 +60,6 @@ export const PipelineActions: React.FunctionComponent = ({ isOptionsVisible, showRunButton, isRunButtonDisabled, - showExportButton, - isExportButtonDisabled, showUpdateViewButton, isUpdateViewButtonDisabled, isExplainButtonDisabled, @@ -79,7 +69,6 @@ export const PipelineActions: React.FunctionComponent = ({ onUpdateView, onRunAggregation, onToggleOptions, - onExportAggregationResults, onExplainAggregation, showCollectionScanInsight, onCollectionScanInsightActionButtonClick, @@ -152,18 +141,6 @@ export const PipelineActions: React.FunctionComponent = ({ Explain )} - {!showUpdateViewButton && showExportButton && ( - - )} {!showUpdateViewButton && showRunButton && ( )} + {enableImportExport && isExportDataEnabled && ( + + )} {editViewName && ( @@ -96,14 +132,25 @@ export const PipelineSettings: React.FunctionComponent< export default connect( (state: RootState) => { + const resultPipeline = getPipelineStageOperatorsFromBuilderState(state); + const lastStage = resultPipeline[resultPipeline.length - 1]; + const isMergeOrOutPipeline = isOutputStage(lastStage); const hasSyntaxErrors = getIsPipelineInvalidFromBuilderState(state, false); + const isAIFetching = state.pipelineBuilder.aiPipeline.status === 'fetching'; return { editViewName: state.editViewName ?? undefined, - isExportToLanguageEnabled: !hasSyntaxErrors, + isExportToLanguageEnabled: !hasSyntaxErrors && !isAIFetching, + isExportDataEnabled: + !isMergeOrOutPipeline && !hasSyntaxErrors && !isAIFetching, }; }, { onExportToLanguage: exportToLanguage, + onExportData: () => { + return (dispatch: PipelineBuilderThunkDispatch) => { + dispatch(exportAggregationResults()); + }; + }, onCreateNewPipeline: confirmNewPipeline, } )(PipelineSettings); diff --git a/packages/compass-aggregations/src/components/pipeline/pipeline.tsx b/packages/compass-aggregations/src/components/pipeline/pipeline.tsx index 748408e056a..df3902420d7 100644 --- a/packages/compass-aggregations/src/components/pipeline/pipeline.tsx +++ b/packages/compass-aggregations/src/components/pipeline/pipeline.tsx @@ -49,10 +49,7 @@ export type PipelineProps = Pick< | 'savingPipelineCancel' | 'clonePipeline' > & - Pick< - PipelineToolbarProps, - 'showRunButton' | 'showExportButton' | 'showExplainButton' - > & + Pick & Pick< SettingsProps, | 'toggleSettingsIsExpanded' @@ -108,7 +105,6 @@ class Pipeline extends PureComponent< return ( ); diff --git a/packages/compass-aggregations/src/plugin.spec.tsx b/packages/compass-aggregations/src/plugin.spec.tsx index 23cfe762682..0ec341cea37 100644 --- a/packages/compass-aggregations/src/plugin.spec.tsx +++ b/packages/compass-aggregations/src/plugin.spec.tsx @@ -5,13 +5,11 @@ import { renderWithStore } from '../test/configure-store'; import { AggregationsPlugin } from './plugin'; describe('Aggregations [Plugin]', function () { - it('should render plugin with toolbar and export button', async function () { + it('should render plugin with toolbar', async function () { const metadata = {} as any; await renderWithStore( ); expect(screen.getByTestId('pipeline-toolbar')).to.exist; - expect(screen.getByTestId('pipeline-toolbar-export-aggregation-button')).to - .exist; }); }); diff --git a/packages/compass-aggregations/src/plugin.tsx b/packages/compass-aggregations/src/plugin.tsx index 1b185aeebc0..ce24ba6d5b4 100644 --- a/packages/compass-aggregations/src/plugin.tsx +++ b/packages/compass-aggregations/src/plugin.tsx @@ -7,7 +7,6 @@ import type { ConfigureStoreOptions } from './stores/store'; export const AggregationsPlugin: React.FunctionComponent< ConfigureStoreOptions > = () => { - const showExportButton = usePreference('enableImportExport'); const showRunButton = usePreference('enableAggregationBuilderRunPipeline'); const showExplainButton = usePreference('enableExplainPlan'); const enableSearchActivationProgramP1 = usePreference( @@ -17,7 +16,6 @@ export const AggregationsPlugin: React.FunctionComponent< return ( void; onCollapseAllClicked: () => void; openExportFileDialog: (exportFullCollection?: boolean) => void; + onOpenExportToLanguage: () => void; outdated: boolean; page: number; readonly: boolean; @@ -184,6 +194,7 @@ const CrudToolbar: React.FunctionComponent = ({ onExpandAllClicked, onCollapseAllClicked, openExportFileDialog, + onOpenExportToLanguage, outdated, page, readonly, @@ -359,22 +370,6 @@ const CrudToolbar: React.FunctionComponent = ({ instanceDescription={instanceDescription} /> )} - {isImportExportEnabled && ( - - data-testid="crud-export-collection" - actions={exportDataActions} - onAction={(action: ExportDataOption) => - openExportFileDialog(action === 'export-full-collection') - } - buttonText="Export Data" - buttonProps={{ - className: exportCollectionButtonStyles, - size: 'xsmall', - leftGlyph: , - }} - narrowBreakpoint={DOCUMENT_NARROW_ICON_BREAKPOINT} - /> - )} {!readonly && ( = ({ onClick={onDeleteButtonClicked} > )} + {isImportExportEnabled && ( + + data-testid="crud-export-collection" + actions={exportDataActions} + onAction={(action: ExportDataOption) => + openExportFileDialog(action === 'export-full-collection') + } + buttonText="Export Data" + buttonProps={{ + className: exportCollectionButtonStyles, + size: 'xsmall', + leftGlyph: , + }} + narrowBreakpoint={DOCUMENT_NARROW_ICON_BREAKPOINT} + /> + )} + {insights && }
diff --git a/packages/compass-crud/src/components/document-list.tsx b/packages/compass-crud/src/components/document-list.tsx index f95846263b9..370b81ca7ef 100644 --- a/packages/compass-crud/src/components/document-list.tsx +++ b/packages/compass-crud/src/components/document-list.tsx @@ -578,6 +578,9 @@ const DocumentList: React.FunctionComponent = (props) => { onExpandAllClicked={onExpandAllClicked} onCollapseAllClicked={onCollapseAllClicked} openExportFileDialog={openExportFileDialog} + onOpenExportToLanguage={store.openQueryExportToLanguageDialog.bind( + store + )} outdated={outdated} readonly={!isEditable} viewSwitchHandler={handleViewChanged} diff --git a/packages/compass-crud/src/stores/crud-store.ts b/packages/compass-crud/src/stores/crud-store.ts index 71c4393d5bb..1035af06fb7 100644 --- a/packages/compass-crud/src/stores/crud-store.ts +++ b/packages/compass-crud/src/stores/crud-store.ts @@ -99,6 +99,7 @@ export type CrudActions = { runBulkUpdate(): Promise; closeBulkDeleteDialog(): void; runBulkDelete(): Promise; + openQueryExportToLanguageDialog(): void; openDeleteQueryExportToLanguageDialog(): void; saveUpdateQuery(name: string): Promise; }; @@ -1988,6 +1989,22 @@ class CrudStoreImpl } } + openQueryExportToLanguageDialog(): void { + const query = this.queryBar.getLastAppliedQuery('crud'); + this.localAppRegistry.emit( + 'open-query-export-to-language', + { + filter: toJSString(query.filter) || '{}', + project: query.project ? toJSString(query.project) : undefined, + sort: query.sort ? toJSString(query.sort) : undefined, + collation: query.collation ? toJSString(query.collation) : undefined, + skip: query.skip ? String(query.skip) : undefined, + limit: query.limit ? String(query.limit) : undefined, + }, + 'Query' + ); + } + openDeleteQueryExportToLanguageDialog(): void { const { filter = {} } = this.queryBar.getLastAppliedQuery('crud'); this.localAppRegistry.emit( diff --git a/packages/compass-e2e-tests/helpers/selectors.ts b/packages/compass-e2e-tests/helpers/selectors.ts index 878243c1a25..f8cdded0908 100644 --- a/packages/compass-e2e-tests/helpers/selectors.ts +++ b/packages/compass-e2e-tests/helpers/selectors.ts @@ -843,7 +843,7 @@ export const AggregationSettingsApplyButton = '[data-testid="aggregation-settings-apply"]'; export const AddStageButton = '[data-testid="add-stage"]'; export const ExportAggregationToLanguage = - '[data-testid="pipeline-toolbar-export-button"]'; + '[data-testid="pipeline-toolbar-export-code-button"]'; export const CreateNewPipelineButton = '[data-testid="pipeline-toolbar-create-new-button"]'; export const NewPipelineActions = '#new-pipeline-actions'; @@ -863,7 +863,7 @@ export const AggregationErrorDetailsBtn = export const RunPipelineButton = `[data-testid="pipeline-toolbar-run-button"]`; export const EditPipelineButton = `[data-testid="pipeline-toolbar-edit-button"]`; export const GoToCollectionButton = `[data-testid="pipeline-results-go-to-collection"]`; -export const ExportAggregationResultsButton = `[data-testid="pipeline-toolbar-export-aggregation-button"]`; +export const ExportAggregationResultsButton = `[data-testid="pipeline-toolbar-export-data-button"]`; export const AggregationOpenSavedPipelinesButton = `[data-testid="pipeline-toolbar-open-pipelines-button"]`; export const AggregationSavedPipelinesPopover = `[data-testid="saved-pipelines"]`; @@ -1232,7 +1232,7 @@ export const queryBarResetFilterButton = (tabName: string): string => { }; export const queryBarExportToLanguageButton = (tabName: string): string => { const tabSelector = collectionContent(tabName); - return `${tabSelector} [data-testid="query-bar-open-export-to-language-button"]`; + return `${tabSelector} [data-testid="crud-export-to-language-button"]`; }; export const GenAIEntryButton = '[data-testid="open-ai-query-entry-button"]'; export const GenAITextInput = '[data-testid="ai-user-text-input"]'; diff --git a/packages/compass-e2e-tests/tests/collection-aggregations-tab.test.ts b/packages/compass-e2e-tests/tests/collection-aggregations-tab.test.ts index fa9c346f181..75875058e36 100644 --- a/packages/compass-e2e-tests/tests/collection-aggregations-tab.test.ts +++ b/packages/compass-e2e-tests/tests/collection-aggregations-tab.test.ts @@ -979,7 +979,19 @@ describe('Collection aggregations tab', function () { '{ i: 5 }' ); - // Open the modal. + // Wait for the pipeline to be validated before trying to export + await browser.waitUntil( + async function () { + const textElement = browser.$(Selectors.stagePreviewToolbarTooltip(0)); + const text = await textElement.getText(); + return text === '(Sample of 1 document)'; + }, + { + timeoutMsg: 'Expected stage preview to show "(Sample of 1 document)"', + } + ); + + // Click the export data button to open the modal. await browser.clickVisible(Selectors.ExportAggregationResultsButton); const exportModal = browser.$(Selectors.ExportModal); await exportModal.waitForDisplayed(); diff --git a/packages/compass-query-bar/src/components/query-bar.spec.tsx b/packages/compass-query-bar/src/components/query-bar.spec.tsx index 340b236a1cd..d27cf6b9147 100644 --- a/packages/compass-query-bar/src/components/query-bar.spec.tsx +++ b/packages/compass-query-bar/src/components/query-bar.spec.tsx @@ -36,7 +36,6 @@ const noop = () => { /* no op */ }; -const exportToLanguageButtonId = 'query-bar-open-export-to-language-button'; const queryHistoryButtonId = 'query-history-button'; const queryHistoryComponentTestId = 'query-history'; @@ -87,7 +86,6 @@ describe('QueryBar Component', function () { onApply={noop} onReset={noop} resultId="123" - showExportToLanguageButton {...props} /> @@ -120,7 +118,6 @@ describe('QueryBar Component', function () { renderQueryBar({ onApply: onApplySpy, onReset: onResetSpy, - showExportToLanguageButton: true, }); }); @@ -207,26 +204,11 @@ describe('QueryBar Component', function () { }); it('query controls are enabled', function () { - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('false'); expect( screen .getByTestId('query-bar-apply-filter-button') .getAttribute('aria-disabled') ).to.equal('false'); - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('false'); - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('false'); }); it('editors are not disabled', function () { @@ -253,26 +235,11 @@ describe('QueryBar Component', function () { }); rerender(); - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('true'); expect( screen .getByTestId('query-bar-apply-filter-button') .getAttribute('aria-disabled') ).to.equal('true'); - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('true'); - expect( - screen - .getByTestId('query-bar-open-export-to-language-button') - .getAttribute('aria-disabled') - ).to.equal('true'); }); it('editors are disabled', function () { @@ -368,21 +335,6 @@ describe('QueryBar Component', function () { }); }); - describe('when showExportToLanguageButton is false', function () { - beforeEach(function () { - renderQueryBar({ - showExportToLanguageButton: false, - }); - }); - - it('does not render the exportToLanguage button', function () { - const exportToLanguageButton = screen.queryByTestId( - exportToLanguageButtonId - ); - expect(exportToLanguageButton).to.not.exist; - }); - }); - describe('with three query options', function () { beforeEach(function () { renderQueryBar({ diff --git a/packages/compass-query-bar/src/components/query-bar.tsx b/packages/compass-query-bar/src/components/query-bar.tsx index 585d1af6bca..b6c5e201447 100644 --- a/packages/compass-query-bar/src/components/query-bar.tsx +++ b/packages/compass-query-bar/src/components/query-bar.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useMemo } from 'react'; import { Button, - Icon, OptionsToggle, css, cx, @@ -118,11 +117,6 @@ type QueryBarProps = { applyId: number; filterHasContent: boolean; showExplainButton?: boolean; - /** - * Used by Cloud only to hide the export to language functionality - * as it isn't supported. - */ - showExportToLanguageButton?: boolean; valid: boolean; expanded: boolean; placeholders?: Record; @@ -137,7 +131,6 @@ export const QueryBar: React.FunctionComponent = ({ buttonLabel = 'Apply', onApply, onReset, - onOpenExportToLanguage, // Used to specify which query options to show and where they are positioned. queryOptionsLayout = [ 'project', @@ -150,7 +143,6 @@ export const QueryBar: React.FunctionComponent = ({ applyId, filterHasContent, showExplainButton = false, - showExportToLanguageButton = true, valid: isQueryValid, expanded: isQueryOptionsExpanded, placeholders, @@ -281,19 +273,6 @@ export const QueryBar: React.FunctionComponent = ({ > {buttonLabel} - {showExportToLanguageButton && ( - - )} {queryOptionsLayout && queryOptionsLayout.length > 0 && (