Logs: Move button to load logs volume to logs options header (#40578)

* Move button to load logs volume to logs options header

* Update snapshot

* Do not show load logs volume button when data source does not support it
This commit is contained in:
Piotr Jamróz
2021-10-20 13:58:04 +02:00
committed by GitHub
parent 1e471a6f76
commit bd97c79454
7 changed files with 52 additions and 53 deletions

View File

@@ -6,7 +6,6 @@ import { SecondaryActions } from './SecondaryActions';
const addQueryRowButtonSelector = '[aria-label="Add row button"]';
const richHistoryButtonSelector = '[aria-label="Rich history button"]';
const queryInspectorButtonSelector = '[aria-label="Query inspector button"]';
const onClickLoadLogsVolumeSelector = '[aria-label="Load logs volume button"]';
describe('SecondaryActions', () => {
it('should render component two buttons', () => {
@@ -15,7 +14,6 @@ describe('SecondaryActions', () => {
onClickAddQueryRowButton={noop}
onClickRichHistoryButton={noop}
onClickQueryInspectorButton={noop}
onClickLoadLogsVolume={noop}
/>
);
expect(wrapper.find(addQueryRowButtonSelector)).toHaveLength(1);
@@ -29,7 +27,6 @@ describe('SecondaryActions', () => {
onClickAddQueryRowButton={noop}
onClickRichHistoryButton={noop}
onClickQueryInspectorButton={noop}
onClickLoadLogsVolume={noop}
/>
);
expect(wrapper.find(addQueryRowButtonSelector)).toHaveLength(0);
@@ -43,7 +40,6 @@ describe('SecondaryActions', () => {
onClickAddQueryRowButton={noop}
onClickRichHistoryButton={noop}
onClickQueryInspectorButton={noop}
onClickLoadLogsVolume={noop}
/>
);
expect(wrapper.find(addQueryRowButtonSelector).props().disabled).toBe(true);
@@ -53,14 +49,11 @@ describe('SecondaryActions', () => {
const onClickAddRow = jest.fn();
const onClickHistory = jest.fn();
const onClickQueryInspector = jest.fn();
const onClickLoadLogsVolumeInspector = jest.fn();
const wrapper = shallow(
<SecondaryActions
onClickAddQueryRowButton={onClickAddRow}
onClickRichHistoryButton={onClickHistory}
onClickQueryInspectorButton={onClickQueryInspector}
loadingLogsVolumeAvailable={true}
onClickLoadLogsVolume={onClickLoadLogsVolumeInspector}
/>
);
@@ -72,8 +65,5 @@ describe('SecondaryActions', () => {
wrapper.find(queryInspectorButtonSelector).simulate('click');
expect(onClickQueryInspector).toBeCalled();
wrapper.find(onClickLoadLogsVolumeSelector).simulate('click');
expect(onClickQueryInspector).toBeCalled();
});
});