Query Library: Rename "Query Library"to "Saved Queries" in Explore components (#109891)

* rename query library user interface text with "saved queries"

* add missing replacement on "Query history"

* fix unit test

* Fix test and apply PR feedback
This commit is contained in:
Alexa Vargas
2025-08-21 10:19:07 +02:00
committed by GitHub
parent f82586f654
commit f4f406cc64
9 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -244,7 +244,7 @@ describe('Explore', () => {
});
});
describe('Query Library Integration', () => {
describe('Saved Queries Integration', () => {
it('should enable add query buttons when queryLibraryRef is undefined', async () => {
setup({ queryLibraryRef: undefined });
@@ -290,7 +290,7 @@ describe('Explore', () => {
await screen.findByTestId(selectors.components.DataSourcePicker.container);
const addQueryButton = screen.getByRole('button', { name: /Add query$/i });
const addFromLibraryButton = screen.getByRole('button', { name: /Add query from library/i });
const addFromLibraryButton = screen.getByRole('button', { name: /Add from saved queries/i });
expect(addQueryButton).toBeDisabled();
expect(addFromLibraryButton).toBeDisabled();
@@ -94,7 +94,7 @@ describe('Explore QueryRows', () => {
expect(await screen.findByLabelText('Query editor row title B')).toBeInTheDocument();
});
it('Should contain a select query from library button when query library is enabled', async () => {
it('Should contain a select query from library button when saved queries is enabled', async () => {
const { store } = setup([{ refId: 'A' }]);
render(
@@ -108,10 +108,10 @@ describe('Explore QueryRows', () => {
// waiting for the component to fully render.
await screen.findAllByText('someDs query editor');
expect(screen.getByLabelText(/Replace with query from library/i)).toBeInTheDocument();
expect(screen.getByLabelText(/Replace with saved query/i)).toBeInTheDocument();
});
it('Should not contain a select query from library button when query library is disabled', async () => {
it('Should not contain a select query from library button when saved queries is disabled', async () => {
const { store } = setup([{ refId: 'A' }]);
render(
@@ -28,7 +28,7 @@ export const RichHistoryAddToLibrary = ({ query }: Props) => {
}
};
const buttonLabel = t('explore.rich-history-card.add-to-library', 'Add to library');
const buttonLabel = t('explore.rich-history-card.add-to-library', 'Save query');
return queryLibraryEnabled && !hasBeenSaved ? (
<>
@@ -64,7 +64,7 @@ describe('SecondaryActions', () => {
expect(screen.getByRole('button', { name: /Query inspector/i })).toBeInTheDocument();
});
it('should disable both add query buttons when addQueryRowButtonDisabled=true and query library is enabled', () => {
it('should disable both add query buttons when addQueryRowButtonDisabled=true and saved queries is enabled', () => {
render(
<QueryLibraryContextProviderMock queryLibraryEnabled={true}>
<SecondaryActions
@@ -77,7 +77,7 @@ describe('SecondaryActions', () => {
);
expect(screen.getByRole('button', { name: /Add query$/i })).toBeDisabled();
expect(screen.getByRole('button', { name: /Add query from library/i })).toBeDisabled();
expect(screen.getByRole('button', { name: /Add from saved queries/i })).toBeDisabled();
expect(screen.getByRole('button', { name: /Query inspector/i })).toBeInTheDocument();
});
@@ -74,7 +74,7 @@ export function SecondaryActions({
{queryLibraryEnabled && (
<ToolbarButton
data-testid={selectors.pages.Explore.General.addFromQueryLibrary}
aria-label={t('explore.secondary-actions.add-from-query-library', 'Add query from library')}
aria-label={t('explore.secondary-actions.add-from-query-library', 'Add from saved queries')}
variant="canvas"
onClick={() =>
openQueryLibraryDrawer({
@@ -86,7 +86,7 @@ export function SecondaryActions({
icon="plus"
disabled={addQueryRowButtonDisabled}
>
<Trans i18nKey="explore.secondary-actions.add-from-query-library">Add query from library</Trans>
<Trans i18nKey="explore.secondary-actions.add-from-query-library">Add from saved queries</Trans>
</ToolbarButton>
)}
</>
@@ -50,9 +50,9 @@ export const assertAddToQueryLibraryButtonExists = async (value = true) => {
expect(withinQueryHistory().getByRole('button', { name: /run query/i })).toBeInTheDocument();
if (value) {
expect(withinQueryHistory().queryByRole('button', { name: /add to library/i })).toBeInTheDocument();
expect(withinQueryHistory().queryByRole('button', { name: /Save query/i })).toBeInTheDocument();
} else {
expect(withinQueryHistory().queryByRole('button', { name: /add to library/i })).not.toBeInTheDocument();
expect(withinQueryHistory().queryByRole('button', { name: /Save query/i })).not.toBeInTheDocument();
}
});
};
@@ -40,18 +40,18 @@ export const openQueryHistory = async () => {
};
export const openQueryLibrary = async () => {
const button = screen.getByRole('button', { name: 'Add query from library' });
const button = screen.getByRole('button', { name: 'Add from saved queries' });
await userEvent.click(button);
await waitFor(async () => {
const container = screen.getByRole('dialog', {
name: /Drawer title/,
});
within(container).getByText('Query library');
within(container).getByText('Saved queries');
});
};
export const addQueryHistoryToQueryLibrary = async () => {
const button = withinQueryHistory().getByRole('button', { name: /add to library/i });
const button = withinQueryHistory().getByRole('button', { name: /Save query/i });
await userEvent.click(button);
};
@@ -637,7 +637,7 @@ function ReplaceQueryFromLibrary<TQuery extends DataQuery>({
return queryLibraryEnabled ? (
<QueryOperationAction
title={t('query-operation.header.replace-query-from-library', 'Replace with query from library')}
title={t('query-operation.header.replace-query-from-library', 'Replace with saved query')}
icon="book"
onClick={onReplaceQueryFromLibrary}
isGroupEnd
+3 -3
View File
@@ -7130,7 +7130,7 @@
"rich-history-card": {
"add-comment-form": "Add comment form",
"add-comment-tooltip": "Add comment",
"add-to-library": "Add to library",
"add-to-library": "Save query",
"cancel": "Cancel",
"confirm-delete": "Delete",
"copy-query-tooltip": "Copy query to clipboard",
@@ -7242,7 +7242,7 @@
}
},
"secondary-actions": {
"add-from-query-library": "Add query from library",
"add-from-query-library": "Add from saved queries",
"query-add-button": "Add query",
"query-add-button-aria-label": "Add query",
"query-history-button": "Query history",
@@ -11892,7 +11892,7 @@
"expand-row": "Expand query row",
"hide-response": "Hide response",
"remove-query": "Remove query",
"replace-query-from-library": "Replace with query from library",
"replace-query-from-library": "Replace with saved query",
"show-response": "Show response"
},
"query-editor-not-exported": "Data source plugin does not export any Query Editor component"