mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[search] remove logstream component, no longer used (#206804)
## Summary Removing LogStream component from `enterprise_search` plugin and it is no longer used with the removal of App Search & Workplace Search. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
a133dc57a7
commit
67458e629c
3 changed files with 0 additions and 135 deletions
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { EntSearchLogStream } from './log_stream';
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { LogStream } from '@kbn/logs-shared-plugin/public';
|
||||
|
||||
import { EntSearchLogStream } from '.';
|
||||
|
||||
const fakeSourceId = 'fake-source-id';
|
||||
|
||||
describe('EntSearchLogStream', () => {
|
||||
const mockDateNow = jest.spyOn(global.Date, 'now').mockReturnValue(160000000);
|
||||
|
||||
describe('renders with default props', () => {
|
||||
const wrapper = shallow(
|
||||
<EntSearchLogStream logView={{ type: 'log-view-reference', logViewId: 'default' }} />
|
||||
);
|
||||
|
||||
it('renders a LogStream (wrapped in React.Suspense) component', () => {
|
||||
expect(wrapper.type()).toEqual(LogStream);
|
||||
});
|
||||
|
||||
it('renders with the empty sourceId', () => {
|
||||
expect(wrapper.prop('sourceId')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('renders with a default last-24-hours timestamp if no timestamp is passed', () => {
|
||||
expect(wrapper.prop('startTimestamp')).toEqual(73600000);
|
||||
expect(wrapper.prop('endTimestamp')).toEqual(160000000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('renders custom props', () => {
|
||||
it('overrides the default props', () => {
|
||||
const wrapper = shallow(
|
||||
<EntSearchLogStream
|
||||
logView={{ type: 'log-view-reference', logViewId: 'test' }}
|
||||
startTimestamp={1}
|
||||
endTimestamp={2}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(wrapper.prop('logView')).toEqual({ type: 'log-view-reference', logViewId: 'test' });
|
||||
expect(wrapper.prop('startTimestamp')).toEqual(1);
|
||||
expect(wrapper.prop('endTimestamp')).toEqual(2);
|
||||
});
|
||||
|
||||
it('allows passing a custom hoursAgo that modifies the default start timestamp', () => {
|
||||
const wrapper = shallow(
|
||||
<EntSearchLogStream
|
||||
logView={{ type: 'log-view-reference', logViewId: fakeSourceId }}
|
||||
hoursAgo={1}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(wrapper.prop('startTimestamp')).toEqual(156400000);
|
||||
expect(wrapper.prop('endTimestamp')).toEqual(160000000);
|
||||
});
|
||||
|
||||
it('allows passing any prop that the LogStream component takes', () => {
|
||||
const wrapper = shallow(
|
||||
<EntSearchLogStream
|
||||
logView={{ type: 'log-view-reference', logViewId: fakeSourceId }}
|
||||
height={500}
|
||||
highlight="some-log-id"
|
||||
columns={[
|
||||
{ type: 'timestamp', header: 'Timestamp' },
|
||||
{ type: 'field', field: 'log.level', header: 'Log level', width: 300 },
|
||||
]}
|
||||
filters={[]}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(wrapper.prop('height')).toEqual(500);
|
||||
expect(wrapper.prop('highlight')).toEqual('some-log-id');
|
||||
expect(wrapper.prop('columns')).toBeTruthy();
|
||||
expect(wrapper.prop('filters')).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(() => mockDateNow.mockRestore());
|
||||
});
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { LogStream, LogStreamProps } from '@kbn/logs-shared-plugin/public';
|
||||
|
||||
/*
|
||||
* EnterpriseSearchLogStream is a light wrapper on top of logsShared's embeddable LogStream component.
|
||||
* It prepopulates our log source ID (set in server/plugin.ts) and sets a basic 24-hours-ago
|
||||
* default for timestamps. All other props get passed as-is to the underlying LogStream.
|
||||
*
|
||||
* Documentation links for reference:
|
||||
* - https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability_solution/logs_shared/public/components/log_stream/log_stream.stories.mdx
|
||||
* - Run `yarn storybook logsShared` for live docs
|
||||
*/
|
||||
|
||||
interface Props extends Omit<LogStreamProps, 'startTimestamp' | 'endTimestamp'> {
|
||||
startTimestamp?: LogStreamProps['startTimestamp'];
|
||||
endTimestamp?: LogStreamProps['endTimestamp'];
|
||||
hoursAgo?: number;
|
||||
}
|
||||
|
||||
export const EntSearchLogStream: React.FC<Props> = ({
|
||||
startTimestamp,
|
||||
endTimestamp,
|
||||
hoursAgo = 24,
|
||||
...props
|
||||
}) => {
|
||||
if (!endTimestamp) endTimestamp = Date.now();
|
||||
if (!startTimestamp) startTimestamp = endTimestamp - hoursAgo * 60 * 60 * 1000;
|
||||
|
||||
return <LogStream startTimestamp={startTimestamp} endTimestamp={endTimestamp} {...props} />;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue