diff --git a/public/app/features/query/components/QueryEditorRow.test.tsx b/public/app/features/query/components/QueryEditorRow.test.tsx index 80e3ef12919..e87dd718b95 100644 --- a/public/app/features/query/components/QueryEditorRow.test.tsx +++ b/public/app/features/query/components/QueryEditorRow.test.tsx @@ -1,7 +1,7 @@ import { render, screen, waitFor } from '@testing-library/react'; import { PropsWithChildren } from 'react'; -import { DataQueryRequest, dateTime, LoadingState, PanelData, toDataFrame } from '@grafana/data'; +import { CoreApp, DataQueryRequest, dateTime, LoadingState, PanelData, toDataFrame } from '@grafana/data'; import { DataQuery } from '@grafana/schema'; import { mockDataSource } from 'app/features/alerting/unified/mocks'; @@ -455,5 +455,14 @@ describe('QueryEditorRow', () => { expect(mockQueryLibraryContext.renderQueryLibraryEditingHeader).not.toHaveBeenCalled(); }); + + it('should not render saved queries buttons when app is unified alerting', async () => { + render(); + + await waitFor(() => { + expect(screen.queryByText('Save query')).not.toBeInTheDocument(); + expect(screen.queryByText('Replace with saved query')).not.toBeInTheDocument(); + }); + }); }); }); diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index d36d72db9a7..438fd609db0 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -379,29 +379,30 @@ export class QueryEditorRow extends PureComponent { - const { query, hideHideQueryButton: hideHideQueryButton = false, queryLibraryRef } = this.props; + const { query, hideHideQueryButton: hideHideQueryButton = false, queryLibraryRef, app } = this.props; const { datasource, showingHelp } = this.state; const isHidden = !!query.hide; const hasEditorHelp = datasource?.components?.QueryEditorHelp; const isEditingQueryLibrary = queryLibraryRef !== undefined; + const isUnifiedAlerting = app === CoreApp.UnifiedAlerting; return ( <> - {!isEditingQueryLibrary && ( + {!isEditingQueryLibrary && !isUnifiedAlerting && ( )} - {!isEditingQueryLibrary && ( + {!isEditingQueryLibrary && !isUnifiedAlerting && ( )}