diff --git a/public/app/plugins/datasource/elasticsearch/components/AddRemove.test.tsx b/public/app/plugins/datasource/elasticsearch/components/AddRemove.test.tsx index ac04cec7aca..d968f58eb72 100644 --- a/public/app/plugins/datasource/elasticsearch/components/AddRemove.test.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/AddRemove.test.tsx @@ -18,8 +18,8 @@ describe('AddRemove Button', () => { it('Should only show the add button', () => { render(); - expect(screen.getByText('add')).toBeInTheDocument(); - expect(screen.queryByText('remove')).not.toBeInTheDocument(); + expect(screen.getByLabelText('Add')).toBeInTheDocument(); + expect(screen.queryByLabelText('Remove')).not.toBeInTheDocument(); }); }); @@ -29,7 +29,7 @@ describe('AddRemove Button', () => { render(); - expect(screen.getAllByText('remove')).toHaveLength(items.length); + expect(screen.getAllByLabelText('Remove')).toHaveLength(items.length); }); it('Should show the add button only once', () => { @@ -37,7 +37,7 @@ describe('AddRemove Button', () => { render(); - expect(screen.getAllByText('add')).toHaveLength(1); + expect(screen.getAllByLabelText('Add')).toHaveLength(1); }); }); }); diff --git a/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx b/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx index 935167f9ae0..f2765277cd2 100644 --- a/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import React from 'react'; -import { IconButton } from './IconButton'; +import { Button } from '@grafana/ui'; interface Props { index: number; @@ -21,9 +21,13 @@ export const AddRemove = ({ index, onAdd, onRemove, elements }: Props) => { display: flex; `} > - {index === 0 && } + {index === 0 && ( + -); diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/index.tsx b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/index.tsx index 01ae496ea67..dfd631f3c59 100644 --- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/index.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/index.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { Button } from '@grafana/ui'; + import { useDispatch } from '../../../hooks/useStatelessReducer'; -import { IconButton } from '../../IconButton'; import { useQuery } from '../ElasticsearchQueryContext'; import { QueryEditorRow } from '../QueryEditorRow'; @@ -29,7 +30,14 @@ export const BucketAggregationsEditor = ({ nextId }: Props) => { {index === 0 && ( - dispatch(addBucketAggregation(nextId))} label="add" /> +