[Logs Explorer] Naming convention: Follow the plural form of logs explorer (#175908)

Renames all instances outside of `observability_logs_explorer` plugin.
---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Giorgos Bamparopoulos 2024-02-05 10:41:22 +00:00 committed by GitHub
parent 441ed1b662
commit 65291c6493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
107 changed files with 476 additions and 470 deletions

View file

@ -648,7 +648,7 @@ using the CURL scripts in the scripts folder.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/logs_explorer/README.md[logsExplorer]
|This plugin is home to the <LogExplorer /> component and related types. It implements several of the underlying concepts that the Observability Logs Explorer app builds upon.
|This plugin is home to the <LogsExplorer /> component and related types. It implements several of the underlying concepts that the Observability Logs Explorer app builds upon.
|{kib-repo}blob/{branch}/x-pack/plugins/logs_shared/README.md[logsShared]

View file

@ -17,7 +17,7 @@ import {
} from './constants';
type LogsApp = typeof LOGS_APP_ID;
type ObservabilityLogExplorerApp = typeof OBSERVABILITY_LOGS_EXPLORER_APP_ID;
type ObservabilityLogsExplorerApp = typeof OBSERVABILITY_LOGS_EXPLORER_APP_ID;
type ObservabilityOverviewApp = typeof OBSERVABILITY_OVERVIEW_APP_ID;
type MetricsApp = typeof METRICS_APP_ID;
type ApmApp = typeof APM_APP_ID;
@ -26,7 +26,7 @@ type ObservabilityOnboardingApp = typeof OBSERVABILITY_ONBOARDING_APP_ID;
export type AppId =
| LogsApp
| ObservabilityLogExplorerApp
| ObservabilityLogsExplorerApp
| ObservabilityOverviewApp
| ObservabilityOnboardingApp
| ApmApp

View file

@ -6,6 +6,6 @@
* Side Public License, v 1.
*/
export * from './log_explorer';
export * from './observability_log_explorer';
export * from './logs_explorer';
export * from './observability_logs_explorer';
export * from './observability_onboarding';

View file

@ -25,9 +25,9 @@ export type ListFilterControl = {
values: string[];
};
export const LOG_EXPLORER_LOCATOR_ID = 'LOG_EXPLORER_LOCATOR';
export const LOGS_EXPLORER_LOCATOR_ID = 'LOGS_EXPLORER_LOCATOR';
export interface LogExplorerNavigationParams extends SerializableRecord {
export interface LogsExplorerNavigationParams extends SerializableRecord {
/**
* Optionally set the time range in the time picker.
*/
@ -54,7 +54,7 @@ export interface LogExplorerNavigationParams extends SerializableRecord {
filterControls?: FilterControls;
}
export interface LogExplorerLocatorParams extends LogExplorerNavigationParams {
export interface LogsExplorerLocatorParams extends LogsExplorerNavigationParams {
/**
* Dataset name to be selected.
*/

View file

@ -7,17 +7,17 @@
*/
import { SerializableRecord } from '@kbn/utility-types';
import { LogExplorerNavigationParams } from './log_explorer';
import { LogsExplorerNavigationParams } from './logs_explorer';
// Will become a union once we have more origins
export interface ObservabilityLogExplorerLocationState extends SerializableRecord {
export interface ObservabilityLogsExplorerLocationState extends SerializableRecord {
origin?: {
id: 'application-log-onboarding';
};
}
export type DatasetLocatorParams = LogExplorerNavigationParams &
ObservabilityLogExplorerLocationState;
export type DatasetLocatorParams = LogsExplorerNavigationParams &
ObservabilityLogsExplorerLocationState;
// All datasets locator
export const ALL_DATASETS_LOCATOR_ID = 'ALL_DATASETS_LOCATOR';

View file

@ -25,7 +25,7 @@ export function getDiscoverStateMock({
history,
customizationContext: {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
},
});
container.savedSearchState.set(

View file

@ -51,7 +51,7 @@ const gatherRoutes = (wrapper: ShallowWrapper) => {
const customizationContext: DiscoverCustomizationContext = {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
};
const props: DiscoverRoutesProps = {

View file

@ -126,7 +126,7 @@ function getSavedSearch(dataView: DataView) {
const customizationContext: DiscoverCustomizationContext = {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
};
export function getDocumentsLayoutProps(dataView: DataView) {

View file

@ -139,7 +139,7 @@ describe('DiscoverTopNavServerless', () => {
},
});
const props = getProps();
props.stateContainer.customizationContext.showLogExplorerTabs = true;
props.stateContainer.customizationContext.showLogsExplorerTabs = true;
render(
<DiscoverMainProvider value={props.stateContainer}>
<DiscoverTopNavServerless {...props} />
@ -148,8 +148,8 @@ describe('DiscoverTopNavServerless', () => {
const topNav = screen.queryByTestId('discoverTopNavServerless');
expect(topNav).not.toBeNull();
await waitFor(() => {
const logExplorerTabs = screen.queryByTestId('logsExplorerTabs');
expect(logExplorerTabs).not.toBeNull();
const logsExplorerTabs = screen.queryByTestId('logsExplorerTabs');
expect(logsExplorerTabs).not.toBeNull();
});
});
@ -169,8 +169,8 @@ describe('DiscoverTopNavServerless', () => {
const topNav = screen.queryByTestId('discoverTopNavServerless');
expect(topNav).not.toBeNull();
await waitFor(() => {
const logExplorerTabs = screen.queryByTestId('logsExplorerTabs');
expect(logExplorerTabs).toBeNull();
const logsExplorerTabs = screen.queryByTestId('logsExplorerTabs');
expect(logsExplorerTabs).toBeNull();
});
});
});

View file

@ -9,7 +9,7 @@
import React from 'react';
import { EuiHeader, EuiHeaderSection, EuiHeaderSectionItem } from '@elastic/eui';
import { TopNavMenuBadges, TopNavMenuItems } from '@kbn/navigation-plugin/public';
import { LogExplorerTabs } from '../../../../components/log_explorer_tabs';
import { LogsExplorerTabs } from '../../../../components/logs_explorer_tabs';
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
import { useDiscoverTopNav } from './use_discover_topnav';
import type { DiscoverStateContainer } from '../../services/discover_state';
@ -31,10 +31,10 @@ export const DiscoverTopNavServerless = ({
return (
<EuiHeader css={{ boxShadow: 'none' }} data-test-subj="discoverTopNavServerless">
{customizationContext.showLogExplorerTabs && (
{customizationContext.showLogsExplorerTabs && (
<EuiHeaderSection>
<EuiHeaderSectionItem>
<LogExplorerTabs services={services} selectedTab="discover" />
<LogsExplorerTabs services={services} selectedTab="discover" />
</EuiHeaderSectionItem>
</EuiHeaderSection>
)}

View file

@ -27,7 +27,7 @@ function getStateContainer({ dataView }: { dataView?: DataView } = {}) {
history,
customizationContext: {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
},
});
stateContainer.savedSearchState.set(savedSearch);

View file

@ -117,7 +117,7 @@ const mountComponent = (hasESData = true, hasUserDataView = true) => {
customizationCallbacks: [],
customizationContext: {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
},
};

View file

@ -38,7 +38,7 @@ const startSync = (appState: DiscoverAppStateContainer) => {
const customizationContext: DiscoverCustomizationContext = {
displayMode: 'standalone',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
};
async function getState(

View file

@ -29,7 +29,7 @@ export interface DiscoverCustomizationContext {
/**
* Whether or not to show the Log Explorer tabs
*/
showLogExplorerTabs: boolean;
showLogsExplorerTabs: boolean;
}
export interface RecordsFetchResponse {

View file

@ -48,7 +48,7 @@ const discoverContainerWrapperCss = css`
const customizationContext: DiscoverCustomizationContext = {
displayMode: 'embedded',
showLogExplorerTabs: false,
showLogsExplorerTabs: false,
};
export const DiscoverContainerInternal = ({

View file

@ -9,6 +9,6 @@
import { withSuspense } from '@kbn/shared-ux-utility';
import { lazy } from 'react';
export type { LogExplorerTabsProps } from './log_explorer_tabs';
export type { LogsExplorerTabsProps } from './logs_explorer_tabs';
export const LogExplorerTabs = withSuspense(lazy(() => import('./log_explorer_tabs')));
export const LogsExplorerTabs = withSuspense(lazy(() => import('./logs_explorer_tabs')));

View file

@ -10,7 +10,7 @@ import userEvent from '@testing-library/user-event';
import { render, screen } from '@testing-library/react';
import React from 'react';
import { discoverServiceMock } from '../../__mocks__/services';
import { LogExplorerTabs, LogExplorerTabsProps } from './log_explorer_tabs';
import { LogsExplorerTabs, LogsExplorerTabsProps } from './logs_explorer_tabs';
import { DISCOVER_APP_LOCATOR } from '../../../common';
import { ALL_DATASETS_LOCATOR_ID } from '@kbn/deeplinks-observability';
@ -19,10 +19,10 @@ const createMockLocator = (id: string) => ({
getRedirectUrl: jest.fn().mockReturnValue(id),
});
describe('LogExplorerTabs', () => {
const renderTabs = (selectedTab: LogExplorerTabsProps['selectedTab'] = 'discover') => {
describe('LogsExplorerTabs', () => {
const renderTabs = (selectedTab: LogsExplorerTabsProps['selectedTab'] = 'discover') => {
const mockDiscoverLocator = createMockLocator(DISCOVER_APP_LOCATOR);
const mockLogExplorerLocator = createMockLocator(ALL_DATASETS_LOCATOR_ID);
const mockLogsExplorerLocator = createMockLocator(ALL_DATASETS_LOCATOR_ID);
const services = {
...discoverServiceMock,
share: {
@ -35,7 +35,7 @@ describe('LogExplorerTabs', () => {
case DISCOVER_APP_LOCATOR:
return mockDiscoverLocator;
case ALL_DATASETS_LOCATOR_ID:
return mockLogExplorerLocator;
return mockLogsExplorerLocator;
default:
throw new Error(`Unknown locator id: ${id}`);
}
@ -45,42 +45,42 @@ describe('LogExplorerTabs', () => {
},
} as unknown as typeof discoverServiceMock;
render(<LogExplorerTabs services={services} selectedTab={selectedTab} />);
render(<LogsExplorerTabs services={services} selectedTab={selectedTab} />);
return {
mockDiscoverLocator,
mockLogExplorerLocator,
mockLogsExplorerLocator,
};
};
const getDiscoverTab = () => screen.getByText('Discover').closest('a')!;
const getLogExplorerTab = () => screen.getByText('Logs Explorer').closest('a')!;
const getLogsExplorerTab = () => screen.getByText('Logs Explorer').closest('a')!;
it('should render properly', () => {
const { mockDiscoverLocator, mockLogExplorerLocator } = renderTabs();
const { mockDiscoverLocator, mockLogsExplorerLocator } = renderTabs();
expect(getDiscoverTab()).toBeInTheDocument();
expect(mockDiscoverLocator.getRedirectUrl).toHaveBeenCalledWith({});
expect(getDiscoverTab()).toHaveAttribute('href', DISCOVER_APP_LOCATOR);
expect(getLogExplorerTab()).toBeInTheDocument();
expect(mockLogExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({});
expect(getLogExplorerTab()).toHaveAttribute('href', ALL_DATASETS_LOCATOR_ID);
expect(getLogsExplorerTab()).toBeInTheDocument();
expect(mockLogsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({});
expect(getLogsExplorerTab()).toHaveAttribute('href', ALL_DATASETS_LOCATOR_ID);
});
it('should render Discover as the selected tab', () => {
const { mockDiscoverLocator, mockLogExplorerLocator } = renderTabs();
const { mockDiscoverLocator, mockLogsExplorerLocator } = renderTabs();
expect(getDiscoverTab()).toHaveAttribute('aria-selected', 'true');
userEvent.click(getDiscoverTab());
expect(mockDiscoverLocator.navigate).not.toHaveBeenCalled();
expect(getLogExplorerTab()).toHaveAttribute('aria-selected', 'false');
userEvent.click(getLogExplorerTab());
expect(mockLogExplorerLocator.navigate).toHaveBeenCalledWith({});
expect(getLogsExplorerTab()).toHaveAttribute('aria-selected', 'false');
userEvent.click(getLogsExplorerTab());
expect(mockLogsExplorerLocator.navigate).toHaveBeenCalledWith({});
});
it('should render Log Explorer as the selected tab', () => {
const { mockDiscoverLocator, mockLogExplorerLocator } = renderTabs('log-explorer');
expect(getLogExplorerTab()).toHaveAttribute('aria-selected', 'true');
userEvent.click(getLogExplorerTab());
expect(mockLogExplorerLocator.navigate).not.toHaveBeenCalled();
const { mockDiscoverLocator, mockLogsExplorerLocator } = renderTabs('logs-explorer');
expect(getLogsExplorerTab()).toHaveAttribute('aria-selected', 'true');
userEvent.click(getLogsExplorerTab());
expect(mockLogsExplorerLocator.navigate).not.toHaveBeenCalled();
expect(getDiscoverTab()).toHaveAttribute('aria-selected', 'false');
userEvent.click(getDiscoverTab());
expect(mockDiscoverLocator.navigate).toHaveBeenCalledWith({});

View file

@ -13,20 +13,20 @@ import React, { MouseEvent } from 'react';
import { DiscoverAppLocatorParams, DISCOVER_APP_LOCATOR } from '../../../common';
import type { DiscoverServices } from '../../build_services';
export interface LogExplorerTabsProps {
export interface LogsExplorerTabsProps {
services: Pick<DiscoverServices, 'share'>;
selectedTab: 'discover' | 'log-explorer';
selectedTab: 'discover' | 'logs-explorer';
}
const emptyParams = {};
export const LogExplorerTabs = ({ services, selectedTab }: LogExplorerTabsProps) => {
export const LogsExplorerTabs = ({ services, selectedTab }: LogsExplorerTabsProps) => {
const { euiTheme } = useEuiTheme();
const locators = services.share?.url.locators;
const discoverLocator = locators?.get<DiscoverAppLocatorParams>(DISCOVER_APP_LOCATOR);
const logExplorerLocator = locators?.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID);
const logsExplorerLocator = locators?.get<AllDatasetsLocatorParams>(ALL_DATASETS_LOCATOR_ID);
const discoverUrl = discoverLocator?.getRedirectUrl(emptyParams);
const logExplorerUrl = logExplorerLocator?.getRedirectUrl(emptyParams);
const logsExplorerUrl = logsExplorerLocator?.getRedirectUrl(emptyParams);
const navigateToDiscover = createNavigateHandler(() => {
if (selectedTab !== 'discover') {
@ -34,9 +34,9 @@ export const LogExplorerTabs = ({ services, selectedTab }: LogExplorerTabsProps)
}
});
const navigateToLogExplorer = createNavigateHandler(() => {
if (selectedTab !== 'log-explorer') {
logExplorerLocator?.navigate(emptyParams);
const navigateToLogsExplorer = createNavigateHandler(() => {
if (selectedTab !== 'logs-explorer') {
logsExplorerLocator?.navigate(emptyParams);
}
});
@ -54,9 +54,9 @@ export const LogExplorerTabs = ({ services, selectedTab }: LogExplorerTabsProps)
})}
</EuiTab>
<EuiTab
isSelected={selectedTab === 'log-explorer'}
href={logExplorerUrl}
onClick={navigateToLogExplorer}
isSelected={selectedTab === 'logs-explorer'}
href={logsExplorerUrl}
onClick={navigateToLogsExplorer}
css={{ '.euiTab__content': { lineHeight: euiTheme.size.xxxl } }}
data-test-subj="logsExplorerTab"
>
@ -69,7 +69,7 @@ export const LogExplorerTabs = ({ services, selectedTab }: LogExplorerTabsProps)
};
// eslint-disable-next-line import/no-default-export
export default LogExplorerTabs;
export default LogsExplorerTabs;
const isModifiedEvent = (event: MouseEvent) =>
event.metaKey || event.altKey || event.ctrlKey || event.shiftKey;

View file

@ -33,4 +33,4 @@ export type {
} from './customizations';
export { SEARCH_EMBEDDABLE_TYPE, SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER_ID } from './embeddable';
export { loadSharingDataHelpers } from './utils';
export { LogExplorerTabs, type LogExplorerTabsProps } from './components/log_explorer_tabs';
export { LogsExplorerTabs, type LogsExplorerTabsProps } from './components/logs_explorer_tabs';

View file

@ -17,7 +17,7 @@ export type Start = jest.Mocked<DiscoverStart>;
const createSetupContract = (): Setup => {
const setupContract: Setup = {
locator: sharePluginMock.createLocator(),
showLogExplorerTabs: jest.fn(),
showLogsExplorerTabs: jest.fn(),
};
return setupContract;
};

View file

@ -116,7 +116,7 @@ export interface DiscoverSetup {
* ```
*/
readonly locator: undefined | DiscoverAppLocator;
readonly showLogExplorerTabs: () => void;
readonly showLogsExplorerTabs: () => void;
}
export interface DiscoverStart {
@ -215,7 +215,7 @@ export class DiscoverPlugin
private locator?: DiscoverAppLocator;
private contextLocator?: DiscoverContextAppLocator;
private singleDocLocator?: DiscoverSingleDocLocator;
private showLogExplorerTabs = false;
private showLogsExplorerTabs = false;
setup(core: CoreSetup<DiscoverStartPlugins, DiscoverStart>, plugins: DiscoverSetupPlugins) {
const baseUrl = core.http.basePath.prepend('/app/discover');
@ -333,7 +333,7 @@ export class DiscoverPlugin
profileRegistry: this.profileRegistry,
customizationContext: {
displayMode: 'standalone',
showLogExplorerTabs: this.showLogExplorerTabs,
showLogsExplorerTabs: this.showLogsExplorerTabs,
},
isDev,
});
@ -376,8 +376,8 @@ export class DiscoverPlugin
return {
locator: this.locator,
showLogExplorerTabs: () => {
this.showLogExplorerTabs = true;
showLogsExplorerTabs: () => {
this.showLogsExplorerTabs = true;
},
};
}

View file

@ -15,7 +15,7 @@ import {
} from '../../routing/apm_route_config';
import {
logsLocatorsMock,
observabilityLogExplorerLocatorsMock,
observabilityLogsExplorerLocatorsMock,
} from '../../../context/apm_plugin/mock_apm_plugin_context';
const apmRouter = {
@ -24,7 +24,7 @@ const apmRouter = {
`some-basepath/app/apm${apmRouterBase.link(...args)}`,
} as ApmRouter;
const { allDatasetsLocator } = observabilityLogExplorerLocatorsMock;
const { allDatasetsLocator } = observabilityLogsExplorerLocatorsMock;
const { nodeLogsLocator, traceLogsLocator } = logsLocatorsMock;
const expectLogsLocatorsToBeCalled = () => {

View file

@ -132,7 +132,7 @@ const mockPlugin = {
},
};
export const observabilityLogExplorerLocatorsMock = {
export const observabilityLogsExplorerLocatorsMock = {
allDatasetsLocator: sharePluginMock.createLocator(),
singleDatasetLocator: sharePluginMock.createLocator(),
};

View file

@ -35,8 +35,8 @@ export const flyoutCancelText = i18n.translate('xpack.datasetQuality.flyoutCance
defaultMessage: 'Cancel',
});
export const flyoutOpenInLogExplorerText = i18n.translate(
'xpack.datasetQuality.flyoutOpenInLogExplorerText',
export const flyoutOpenInLogsExplorerText = i18n.translate(
'xpack.datasetQuality.flyoutOpenInLogsExplorerText',
{
defaultMessage: 'Open in Logs Explorer',
}

View file

@ -31,7 +31,7 @@ import {
import { DataStreamStat } from '../../../common/data_streams_stats/data_stream_stat';
import { QualityIndicator, QualityPercentageIndicator } from '../quality_indicator';
import { IntegrationIcon } from '../common';
import { useLinkToLogExplorer } from '../../hooks';
import { useLinkToLogsExplorer } from '../../hooks';
import { FlyoutDataset } from '../../state_machines/dataset_quality_controller';
const expandDatasetAriaLabel = i18n.translate('xpack.datasetQuality.expandLabel', {
@ -208,21 +208,21 @@ export const getDatasetQualityTableColumns = ({
{
name: actionsColumnName,
render: (dataStreamStat: DataStreamStat) => (
<LogExplorerLink dataStreamStat={dataStreamStat} title={openActionName} />
<LogsExplorerLink dataStreamStat={dataStreamStat} title={openActionName} />
),
width: '100px',
},
];
};
const LogExplorerLink = ({
const LogsExplorerLink = ({
dataStreamStat,
title,
}: {
dataStreamStat: DataStreamStat;
title: string;
}) => {
const logExplorerLinkProps = useLinkToLogExplorer({ dataStreamStat });
const logsExplorerLinkProps = useLinkToLogsExplorer({ dataStreamStat });
return <EuiLink {...logExplorerLinkProps}>{title}</EuiLink>;
return <EuiLink {...logsExplorerLinkProps}>{title}</EuiLink>;
};

View file

@ -16,8 +16,8 @@ import {
} from '@elastic/eui';
import { css } from '@emotion/react';
import React from 'react';
import { flyoutOpenInLogExplorerText } from '../../../common/translations';
import { useLinkToLogExplorer } from '../../hooks';
import { flyoutOpenInLogsExplorerText } from '../../../common/translations';
import { useLinkToLogsExplorer } from '../../hooks';
import { FlyoutDataset } from '../../state_machines/dataset_quality_controller';
import { IntegrationIcon } from '../common';
@ -25,7 +25,7 @@ export function Header({ dataStreamStat }: { dataStreamStat: FlyoutDataset }) {
const { integration, title } = dataStreamStat;
const euiShadow = useEuiShadow('s');
const { euiTheme } = useEuiTheme();
const logExplorerLinkProps = useLinkToLogExplorer({ dataStreamStat });
const logsExplorerLinkProps = useLinkToLogsExplorer({ dataStreamStat });
return (
<EuiFlyoutHeader hasBorder>
@ -55,8 +55,8 @@ export function Header({ dataStreamStat }: { dataStreamStat: FlyoutDataset }) {
justifyContent="flexEnd"
alignItems="center"
>
<EuiButton size="s" {...logExplorerLinkProps} iconType="logoObservability">
{flyoutOpenInLogExplorerText}
<EuiButton size="s" {...logsExplorerLinkProps} iconType="logoObservability">
{flyoutOpenInLogsExplorerText}
</EuiButton>
</EuiFlexGroup>
</EuiFlexItem>

View file

@ -7,4 +7,4 @@
export * from './use_dataset_quality_table';
export * from './use_dataset_quality_flyout';
export * from './use_link_to_log_explorer';
export * from './use_link_to_logs_explorer';

View file

@ -14,7 +14,7 @@ import { DataStreamStat } from '../../common/data_streams_stats/data_stream_stat
import { FlyoutDataset } from '../state_machines/dataset_quality_controller';
import { useKibanaContextForPlugin } from '../utils';
export const useLinkToLogExplorer = ({
export const useLinkToLogsExplorer = ({
dataStreamStat,
}: {
dataStreamStat: DataStreamStat | FlyoutDataset;
@ -41,16 +41,16 @@ export const useLinkToLogExplorer = ({
const singleDatasetLocator =
share.url.locators.get<SingleDatasetLocatorParams>(SINGLE_DATASET_LOCATOR_ID);
const urlToLogExplorer = singleDatasetLocator?.getRedirectUrl(params);
const urlToLogsExplorer = singleDatasetLocator?.getRedirectUrl(params);
const navigateToLogExplorer = () => {
const navigateToLogsExplorer = () => {
singleDatasetLocator?.navigate(params) as Promise<void>;
};
const logExplorerLinkProps = getRouterLinkProps({
href: urlToLogExplorer,
onClick: navigateToLogExplorer,
const logsExplorerLinkProps = getRouterLinkProps({
href: urlToLogsExplorer,
onClick: navigateToLogsExplorer,
});
return logExplorerLinkProps;
return logsExplorerLinkProps;
};

View file

@ -11,7 +11,7 @@ import { LocatorPublic } from '@kbn/share-plugin/common';
import { getViewInAppUrl, GetViewInAppUrlArgs } from './get_view_in_app_url';
describe('getViewInAppUrl', () => {
const logExplorerLocator = {
const logsExplorerLocator = {
getRedirectUrl: jest.fn(() => 'mockedGetRedirectUrl'),
} as unknown as LocatorPublic<DiscoverAppLocatorParams>;
const startedAt = '2023-12-07T16:30:15.403Z';
@ -26,7 +26,7 @@ describe('getViewInAppUrl', () => {
jest.clearAllMocks();
});
it('Should return empty string if logExplorerLocator is not provided', () => {
it('Should return empty string if logsExplorerLocator is not provided', () => {
const args: GetViewInAppUrlArgs = {
metrics: [],
startedAt,
@ -45,7 +45,7 @@ describe('getViewInAppUrl', () => {
filter: 'mockedCountFilter',
},
],
logExplorerLocator,
logsExplorerLocator,
startedAt,
endedAt,
filter: 'mockedFilter',
@ -53,7 +53,7 @@ describe('getViewInAppUrl', () => {
};
expect(getViewInAppUrl(args)).toBe('mockedGetRedirectUrl');
expect(logExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
expect(logsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
dataset: args.dataViewId,
timeRange: returnedTimeRange,
query: {
@ -72,13 +72,13 @@ describe('getViewInAppUrl', () => {
filter: 'mockedCountFilter',
},
],
logExplorerLocator,
logsExplorerLocator,
startedAt,
endedAt,
};
expect(getViewInAppUrl(args)).toBe('mockedGetRedirectUrl');
expect(logExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
expect(logsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
dataset: undefined,
timeRange: returnedTimeRange,
query: {
@ -90,14 +90,14 @@ describe('getViewInAppUrl', () => {
it('should call getRedirectUrl with only filter', () => {
const args: GetViewInAppUrlArgs = {
logExplorerLocator,
logsExplorerLocator,
startedAt,
endedAt,
filter: 'mockedFilter',
};
expect(getViewInAppUrl(args)).toBe('mockedGetRedirectUrl');
expect(logExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
expect(logsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
dataset: undefined,
timeRange: returnedTimeRange,
query: {
@ -109,13 +109,13 @@ describe('getViewInAppUrl', () => {
it('should call getRedirectUrl with empty query if metrics and filter are not not provided', () => {
const args: GetViewInAppUrlArgs = {
logExplorerLocator,
logsExplorerLocator,
startedAt,
endedAt,
};
expect(getViewInAppUrl(args)).toBe('mockedGetRedirectUrl');
expect(logExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
expect(logsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
dataset: undefined,
timeRange: returnedTimeRange,
query: {
@ -139,13 +139,13 @@ describe('getViewInAppUrl', () => {
field: 'mockedAvgField',
},
],
logExplorerLocator,
logsExplorerLocator,
startedAt,
endedAt,
};
expect(getViewInAppUrl(args)).toBe('mockedGetRedirectUrl');
expect(logExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
expect(logsExplorerLocator.getRedirectUrl).toHaveBeenCalledWith({
dataset: undefined,
timeRange: returnedTimeRange,
query: {

View file

@ -16,7 +16,7 @@ export interface GetViewInAppUrlArgs {
endedAt?: string;
startedAt?: string;
filter?: string;
logExplorerLocator?: LocatorPublic<DiscoverAppLocatorParams>;
logsExplorerLocator?: LocatorPublic<DiscoverAppLocatorParams>;
metrics?: CustomThresholdExpressionMetric[];
}
@ -25,10 +25,10 @@ export const getViewInAppUrl = ({
endedAt,
startedAt = new Date().toISOString(),
filter,
logExplorerLocator,
logsExplorerLocator,
metrics = [],
}: GetViewInAppUrlArgs) => {
if (!logExplorerLocator) return '';
if (!logsExplorerLocator) return '';
const timeRange: TimeRange | undefined = getPaddedAlertTimeRange(startedAt, endedAt);
timeRange.to = endedAt ? timeRange.to : 'now';
@ -47,7 +47,7 @@ export const getViewInAppUrl = ({
query.query = filter;
}
return logExplorerLocator?.getRedirectUrl({
return logsExplorerLocator?.getRedirectUrl({
dataset: dataViewId,
timeRange,
query,

View file

@ -25,7 +25,7 @@ import {
import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public';
import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import { LOG_EXPLORER_LOCATOR_ID, LogExplorerLocatorParams } from '@kbn/deeplinks-observability';
import { LOGS_EXPLORER_LOCATOR_ID, LogsExplorerLocatorParams } from '@kbn/deeplinks-observability';
import type { DiscoverStart } from '@kbn/discover-plugin/public';
import type { EmbeddableStart } from '@kbn/embeddable-plugin/public';
import type { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/public';
@ -263,8 +263,8 @@ export class Plugin
const sloEditLocator = pluginsSetup.share.url.locators.create(new SloEditLocatorDefinition());
const sloListLocator = pluginsSetup.share.url.locators.create(new SloListLocatorDefinition());
const logExplorerLocator =
pluginsSetup.share.url.locators.get<LogExplorerLocatorParams>(LOG_EXPLORER_LOCATOR_ID);
const logsExplorerLocator =
pluginsSetup.share.url.locators.get<LogsExplorerLocatorParams>(LOGS_EXPLORER_LOCATOR_ID);
const mount = async (params: AppMountParameters<unknown>) => {
// Load application bundle
@ -320,7 +320,7 @@ export class Plugin
coreSetup.application.register(app);
registerObservabilityRuleTypes(config, this.observabilityRuleTypeRegistry, logExplorerLocator);
registerObservabilityRuleTypes(config, this.observabilityRuleTypeRegistry, logsExplorerLocator);
const assertPlatinumLicense = async () => {
const licensing = await pluginsSetup.licensing;

View file

@ -88,7 +88,7 @@ const getDataViewId = (searchConfiguration?: SerializedSearchSourceFields) =>
export const registerObservabilityRuleTypes = async (
config: ConfigSchema,
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry,
logExplorerLocator?: LocatorPublic<DiscoverAppLocatorParams>
logsExplorerLocator?: LocatorPublic<DiscoverAppLocatorParams>
) => {
observabilityRuleTypeRegistry.register({
id: SLO_BURN_RATE_RULE_TYPE_ID,
@ -151,7 +151,7 @@ export const registerObservabilityRuleTypes = async (
link: getViewInAppUrl({
metrics,
startedAt: fields[ALERT_START],
logExplorerLocator,
logsExplorerLocator,
filter: (searchConfiguration?.query as { query: string }).query,
dataViewId,
}),

View file

@ -1249,7 +1249,7 @@ describe('The custom threshold alert type', () => {
expect(getViewInAppUrl).toBeCalledWith({
dataViewId: 'c34a7c79-a88b-4b4a-ad19-72f6d24104e4',
filter: mockQuery,
logExplorerLocator: undefined,
logsExplorerLocator: undefined,
metrics: customThresholdCountCriterion.metrics,
startedAt: expect.stringMatching(ISO_DATE_REGEX),
});

View file

@ -6,7 +6,7 @@
*/
import { isEqual } from 'lodash';
import { LogExplorerLocatorParams } from '@kbn/deeplinks-observability';
import { LogsExplorerLocatorParams } from '@kbn/deeplinks-observability';
import {
ALERT_ACTION_GROUP,
ALERT_EVALUATION_VALUES,
@ -52,14 +52,14 @@ import { convertStringsToMissingGroupsRecord } from './lib/convert_strings_to_mi
export interface CustomThresholdLocators {
alertsLocator?: LocatorPublic<AlertsLocatorParams>;
logExplorerLocator?: LocatorPublic<LogExplorerLocatorParams>;
logsExplorerLocator?: LocatorPublic<LogsExplorerLocatorParams>;
}
export const createCustomThresholdExecutor = ({
basePath,
logger,
config,
locators: { alertsLocator, logExplorerLocator },
locators: { alertsLocator, logsExplorerLocator },
}: {
basePath: IBasePath;
logger: Logger;
@ -298,7 +298,7 @@ export const createCustomThresholdExecutor = ({
viewInAppUrl: getViewInAppUrl({
dataViewId: params.searchConfiguration?.index?.title ?? dataViewId,
filter: params.searchConfiguration.query.query,
logExplorerLocator,
logsExplorerLocator,
metrics: alertResults.length === 1 ? alertResults[0][group].metrics : [],
startedAt: indexedStartedAt,
}),
@ -339,7 +339,7 @@ export const createCustomThresholdExecutor = ({
viewInAppUrl: getViewInAppUrl({
dataViewId: params.searchConfiguration?.index?.title ?? dataViewId,
filter: params.searchConfiguration.query.query,
logExplorerLocator,
logsExplorerLocator,
metrics: params.criteria[0]?.metrics,
startedAt: indexedStartedAt,
}),

View file

@ -20,7 +20,7 @@ import {
PluginInitializerContext,
SavedObjectsClient,
} from '@kbn/core/server';
import { LogExplorerLocatorParams, LOG_EXPLORER_LOCATOR_ID } from '@kbn/deeplinks-observability';
import { LogsExplorerLocatorParams, LOGS_EXPLORER_LOCATOR_ID } from '@kbn/deeplinks-observability';
import { PluginSetupContract as FeaturesSetup } from '@kbn/features-plugin/server';
import { hiddenTypes as filesSavedObjectTypes } from '@kbn/files-plugin/server/saved_objects';
import type { GuidedOnboardingPluginSetup } from '@kbn/guided-onboarding-plugin/server';
@ -111,8 +111,8 @@ export class ObservabilityPlugin implements Plugin<ObservabilityPluginSetup> {
const config = this.initContext.config.get<ObservabilityConfig>();
const alertsLocator = plugins.share.url.locators.create(new AlertsLocatorDefinition());
const logExplorerLocator =
plugins.share.url.locators.get<LogExplorerLocatorParams>(LOG_EXPLORER_LOCATOR_ID);
const logsExplorerLocator =
plugins.share.url.locators.get<LogsExplorerLocatorParams>(LOGS_EXPLORER_LOCATOR_ID);
plugins.features.registerKibanaFeature({
id: casesFeatureId,
@ -346,7 +346,7 @@ export class ObservabilityPlugin implements Plugin<ObservabilityPluginSetup> {
registerRuleTypes(plugins.alerting, core.http.basePath, config, this.logger, ruleDataService, {
alertsLocator,
logExplorerLocator,
logsExplorerLocator,
});
registerSloUsageCollector(plugins.usageCollection);

View file

@ -139,4 +139,4 @@ export { ObservabilityTriggerId } from './trigger_ids';
export { getInspectResponse } from './utils/get_inspect_response';
export const LOGS_ONBOARDING_FEEDBACK_LINK = 'https://ela.st/logs-onboarding-feedback';
export const LOG_EXPLORER_FEEDBACK_LINK = 'https://ela.st/explorer-feedback';
export const LOGS_EXPLORER_FEEDBACK_LINK = 'https://ela.st/explorer-feedback';

View file

@ -1,8 +1,8 @@
# Logs Explorer
This plugin is home to the `<LogExplorer />` component and related types. It implements several of the underlying concepts that the [Observability Logs Explorer app](../observability_solution/observability_logs_explorer) builds upon.
This plugin is home to the `<LogsExplorer />` component and related types. It implements several of the underlying concepts that the [Observability Logs Explorer app](../observability_solution/observability_logs_explorer) builds upon.
## Developing the `<LogExplorer />` component
## Developing the `<LogsExplorer />` component
⚠ The Logs Explorer is in early stages of development, so the following partly describes the current situation and partly the intended future scenario.
@ -24,18 +24,18 @@ obs_log_explorer_app(Observability Logs Explorer app)
obs_apps(Other Observability apps)
obs_log_explorer_component(Observability Logs Explorer component)
other_apps(Other non-Observability apps)
log_explorer_component(Logs Explorer component)
logs_explorer_component(Logs Explorer component)
platform(Kibana Platform)
discover(Discover Main container)
fleet(Fleet / EPM)
obs_log_explorer_app --> obs_log_explorer_component
obs_apps --> obs_log_explorer_component
obs_log_explorer_component --> log_explorer_component
other_apps --> log_explorer_component
log_explorer_component --> discover
log_explorer_component --> platform
log_explorer_component --> fleet
obs_log_explorer_component --> logs_explorer_component
other_apps --> logs_explorer_component
logs_explorer_component --> discover
logs_explorer_component --> platform
logs_explorer_component --> fleet
discover --> platform
fleet --> platform
```
@ -49,7 +49,7 @@ When designing the API we face two conflicting goals:
- it should not perform any page-wide changes that could interfere with consuming app's page state (such as URL changes).
- It should be extensible so the Observability Logs Explorer can build on top of this.
In its current state the `<LogExplorer />` achieves neither goal. To resolve the tension in the future we could export two variants with different sets of properties.
In its current state the `<LogsExplorer />` achieves neither goal. To resolve the tension in the future we could export two variants with different sets of properties.
### Principles

View file

@ -5,7 +5,7 @@
* 2.0.
*/
export const LOG_EXPLORER_PROFILE_ID = 'logs-explorer';
export const LOGS_EXPLORER_PROFILE_ID = 'logs-explorer';
// Fields constants
export const TIMESTAMP_FIELD = '@timestamp';

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import { LogExplorerLocator } from './log_explorer/log_explorer_locator';
import { LogsExplorerLocator } from './logs_explorer/logs_explorer_locator';
export * from './log_explorer';
export * from './logs_explorer';
export interface LogExplorerLocators {
logExplorerLocator: LogExplorerLocator;
export interface LogsExplorerLocators {
logsExplorerLocator: LogsExplorerLocator;
}

View file

@ -6,33 +6,33 @@
*/
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import { LogExplorerLocatorDefinition } from './log_explorer_locator';
import { LogExplorerLocatorDependencies } from './types';
import { LogsExplorerLocatorDefinition } from './logs_explorer_locator';
import { LogsExplorerLocatorDependencies } from './types';
const setup = async () => {
const logExplorerLocatorDependencies: LogExplorerLocatorDependencies = {
const logsExplorerLocatorDependencies: LogsExplorerLocatorDependencies = {
discoverAppLocator: sharePluginMock.createLocator(),
};
const logExplorerLocator = new LogExplorerLocatorDefinition(logExplorerLocatorDependencies);
const logsExplorerLocator = new LogsExplorerLocatorDefinition(logsExplorerLocatorDependencies);
return {
logExplorerLocator,
discoverGetLocation: logExplorerLocatorDependencies.discoverAppLocator?.getLocation,
logsExplorerLocator,
discoverGetLocation: logsExplorerLocatorDependencies.discoverAppLocator?.getLocation,
};
};
describe('Logs Explorer Locators', () => {
const dataset = 'logs-*-*';
it('should call discover locator with empty params', async () => {
const { logExplorerLocator, discoverGetLocation } = await setup();
await logExplorerLocator.getLocation({});
const { logsExplorerLocator, discoverGetLocation } = await setup();
await logsExplorerLocator.getLocation({});
expect(discoverGetLocation).toBeCalledWith({});
});
it('should call discover locator with correct dataViewId if dataset is sent', async () => {
const { logExplorerLocator, discoverGetLocation } = await setup();
await logExplorerLocator.getLocation({ dataset });
const { logsExplorerLocator, discoverGetLocation } = await setup();
await logsExplorerLocator.getLocation({ dataset });
expect(discoverGetLocation).toBeCalledWith(
expect.objectContaining({
@ -42,8 +42,8 @@ describe('Logs Explorer Locators', () => {
});
it('should call discover locator with correct dataViewSpec if dataset is sent', async () => {
const { logExplorerLocator, discoverGetLocation } = await setup();
await logExplorerLocator.getLocation({ dataset });
const { logsExplorerLocator, discoverGetLocation } = await setup();
await logsExplorerLocator.getLocation({ dataset });
expect(discoverGetLocation).toBeCalledWith(
expect.objectContaining({

View file

@ -8,19 +8,19 @@
import type { DataViewSpec } from '@kbn/data-views-plugin/common';
import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
import {
LogExplorerLocatorParams,
LOG_EXPLORER_LOCATOR_ID,
LogsExplorerLocatorParams,
LOGS_EXPLORER_LOCATOR_ID,
} from '@kbn/deeplinks-observability/locators';
import { LogExplorerLocatorDependencies } from './types';
import { LogsExplorerLocatorDependencies } from './types';
export type LogExplorerLocator = LocatorPublic<LogExplorerLocatorParams>;
export type LogsExplorerLocator = LocatorPublic<LogsExplorerLocatorParams>;
export class LogExplorerLocatorDefinition implements LocatorDefinition<LogExplorerLocatorParams> {
public readonly id = LOG_EXPLORER_LOCATOR_ID;
export class LogsExplorerLocatorDefinition implements LocatorDefinition<LogsExplorerLocatorParams> {
public readonly id = LOGS_EXPLORER_LOCATOR_ID;
constructor(protected readonly deps: LogExplorerLocatorDependencies) {}
constructor(protected readonly deps: LogsExplorerLocatorDependencies) {}
public readonly getLocation = (params: LogExplorerLocatorParams) => {
public readonly getLocation = (params: LogsExplorerLocatorParams) => {
const { dataset } = params;
const dataViewSpec: DataViewSpec | undefined = dataset
? {

View file

@ -8,6 +8,6 @@
import { DiscoverAppLocatorParams } from '@kbn/discover-plugin/common';
import { LocatorPublic } from '@kbn/share-plugin/common';
export interface LogExplorerLocatorDependencies {
export interface LogsExplorerLocatorDependencies {
discoverAppLocator?: LocatorPublic<DiscoverAppLocatorParams>;
}

View file

@ -6,4 +6,4 @@
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface LogExplorerConfig {}
export interface LogsExplorerConfig {}

View file

@ -2,7 +2,7 @@
"type": "plugin",
"id": "@kbn/logs-explorer-plugin",
"owner": "@elastic/obs-ux-logs-team",
"description": "This plugin provides a LogExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption.",
"description": "This plugin provides a LogsExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption.",
"plugin": {
"id": "logsExplorer",
"server": true,

View file

@ -23,7 +23,7 @@ import { DatasetSelectorProps, DatasetsSelectorSearchParams } from './types';
const meta: Meta<typeof DatasetSelector> = {
component: DatasetSelector,
title: 'log_explorer/DatasetSelector',
title: 'logs_explorer/DatasetSelector',
decorators: [(wrappedStory) => <I18nProvider>{wrappedStory()}</I18nProvider>],
argTypes: {
datasetsError: {

View file

@ -6,13 +6,13 @@
*/
import React from 'react';
import { LogExplorerFlyoutContentProps } from '../../customizations/types';
import { LogsExplorerFlyoutContentProps } from '../../customizations/types';
import { useDocDetail } from '../../hooks/use_doc_detail';
import { FlyoutHeader } from './flyout_header';
import { FlyoutHighlights } from './flyout_highlights';
import { DiscoverActionsProvider } from '../../hooks/use_discover_action';
export function FlyoutDetail({ dataView, doc, actions }: LogExplorerFlyoutContentProps) {
export function FlyoutDetail({ dataView, doc, actions }: LogsExplorerFlyoutContentProps) {
const parsedDoc = useDocDetail(doc, { dataView });
return (

View file

@ -8,28 +8,28 @@
import type { ScopedHistory } from '@kbn/core-application-browser';
import type { CoreStart } from '@kbn/core/public';
import React, { useMemo } from 'react';
import type { LogExplorerController } from '../../controller';
import { createLogExplorerProfileCustomizations } from '../../customizations/log_explorer_profile';
import { LogExplorerStartDeps } from '../../types';
import type { LogsExplorerController } from '../../controller';
import { createLogsExplorerProfileCustomizations } from '../../customizations/logs_explorer_profile';
import { LogsExplorerStartDeps } from '../../types';
export interface CreateLogExplorerArgs {
export interface CreateLogsExplorerArgs {
core: CoreStart;
plugins: LogExplorerStartDeps;
plugins: LogsExplorerStartDeps;
}
export interface LogExplorerProps {
export interface LogsExplorerProps {
scopedHistory: ScopedHistory;
controller: LogExplorerController;
controller: LogsExplorerController;
}
export const createLogExplorer = ({ core, plugins }: CreateLogExplorerArgs) => {
export const createLogsExplorer = ({ core, plugins }: CreateLogsExplorerArgs) => {
const {
discover: { DiscoverContainer },
} = plugins;
return ({ scopedHistory, controller }: LogExplorerProps) => {
const logExplorerCustomizations = useMemo(
() => [createLogExplorerProfileCustomizations({ controller, core, plugins })],
return ({ scopedHistory, controller }: LogsExplorerProps) => {
const logsExplorerCustomizations = useMemo(
() => [createLogsExplorerProfileCustomizations({ controller, core, plugins })],
[controller]
);
@ -37,7 +37,7 @@ export const createLogExplorer = ({ core, plugins }: CreateLogExplorerArgs) => {
return (
<DiscoverContainer
customizationCallbacks={logExplorerCustomizations}
customizationCallbacks={logsExplorerCustomizations}
overrideServices={overrideServices}
scopedHistory={scopedHistory}
stateStorageContainer={urlStateStorage}

View file

@ -7,14 +7,14 @@
import React from 'react';
import type { DataGridCellValueElementProps } from '@kbn/unified-data-table';
import { LogExplorerDiscoverServices } from '../../controller';
import { LogsExplorerDiscoverServices } from '../../controller';
import { VirtualColumnServiceProvider } from '../../hooks/use_virtual_column_services';
import { CONTENT_FIELD, RESOURCE_FIELD } from '../../../common/constants';
import { Content } from './content';
import { Resource } from './resource';
export const renderCell =
(type: string, { data }: { data: LogExplorerDiscoverServices['data'] }) =>
(type: string, { data }: { data: LogsExplorerDiscoverServices['data'] }) =>
(props: DataGridCellValueElementProps) => {
const { dataView } = props;
const virtualColumnServices = {

View file

@ -11,9 +11,9 @@ import equal from 'fast-deep-equal';
import { distinctUntilChanged, EMPTY, from, map, shareReplay } from 'rxjs';
import { interpret } from 'xstate';
import { DatasetsService } from '../services/datasets';
import { createLogExplorerControllerStateMachine } from '../state_machines/log_explorer_controller';
import { LogExplorerStartDeps } from '../types';
import { LogExplorerCustomizations } from '../customizations/types';
import { createLogsExplorerControllerStateMachine } from '../state_machines/logs_explorer_controller';
import { LogsExplorerStartDeps } from '../types';
import { LogsExplorerCustomizations } from '../customizations/types';
import { createDataServiceProxy } from './custom_data_service';
import { createUiSettingsServiceProxy } from './custom_ui_settings_service';
import {
@ -22,27 +22,27 @@ import {
} from './custom_url_state_storage';
import { getContextFromPublicState, getPublicStateFromContext } from './public_state';
import {
LogExplorerController,
LogExplorerDiscoverServices,
LogExplorerPublicStateUpdate,
LogsExplorerController,
LogsExplorerDiscoverServices,
LogsExplorerPublicStateUpdate,
} from './types';
interface Dependencies {
core: CoreStart;
plugins: LogExplorerStartDeps;
plugins: LogsExplorerStartDeps;
}
type InitialState = LogExplorerPublicStateUpdate;
type InitialState = LogsExplorerPublicStateUpdate;
export const createLogExplorerControllerFactory =
export const createLogsExplorerControllerFactory =
({ core, plugins: { data } }: Dependencies) =>
async ({
customizations = {},
initialState,
}: {
customizations?: LogExplorerCustomizations;
customizations?: LogsExplorerCustomizations;
initialState?: InitialState;
}): Promise<LogExplorerController> => {
}): Promise<LogsExplorerController> => {
const datasetsClient = new DatasetsService().start({
http: core.http,
}).client;
@ -55,7 +55,7 @@ export const createLogExplorerControllerFactory =
http: core.http,
uiSettings: customUiSettings,
});
const discoverServices: LogExplorerDiscoverServices = {
const discoverServices: LogsExplorerDiscoverServices = {
data: customData,
history: () => customMemoryHistory,
uiSettings: customUiSettings,
@ -66,7 +66,7 @@ export const createLogExplorerControllerFactory =
const initialContext = getContextFromPublicState(initialState ?? {});
const machine = createLogExplorerControllerStateMachine({
const machine = createLogsExplorerControllerStateMachine({
datasetsClient,
initialContext,
query: discoverServices.data.query,
@ -77,7 +77,7 @@ export const createLogExplorerControllerFactory =
devTools: getDevToolsOptions(),
});
const logExplorerState$ = from(service).pipe(
const logsExplorerState$ = from(service).pipe(
map(({ context }) => getPublicStateFromContext(context)),
distinctUntilChanged(equal),
shareReplay(1)
@ -90,10 +90,10 @@ export const createLogExplorerControllerFactory =
discoverServices,
event$: EMPTY,
service,
state$: logExplorerState$,
state$: logsExplorerState$,
stateMachine: machine,
};
};
export type CreateLogExplorerControllerFactory = typeof createLogExplorerControllerFactory;
export type CreateLogExplorerController = ReturnType<typeof createLogExplorerControllerFactory>;
export type CreateLogsExplorerControllerFactory = typeof createLogsExplorerControllerFactory;
export type CreateLogsExplorerController = ReturnType<typeof createLogsExplorerControllerFactory>;

View file

@ -7,9 +7,9 @@
import { createKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import { createMemoryHistory } from 'history';
import { LogExplorerDiscoverServices } from './types';
import { LogsExplorerDiscoverServices } from './types';
type DiscoverHistory = ReturnType<LogExplorerDiscoverServices['history']>;
type DiscoverHistory = ReturnType<LogsExplorerDiscoverServices['history']>;
/**
* Create a MemoryHistory instance. It is initialized with an application state

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import type { CreateLogExplorerControllerFactory } from './create_controller';
import type { CreateLogsExplorerControllerFactory } from './create_controller';
export const createLogExplorerControllerLazyFactory: CreateLogExplorerControllerFactory =
export const createLogsExplorerControllerLazyFactory: CreateLogsExplorerControllerFactory =
(dependencies) => async (args) => {
const { createLogExplorerControllerFactory } = await import('./create_controller');
const { createLogsExplorerControllerFactory } = await import('./create_controller');
return createLogExplorerControllerFactory(dependencies)(args);
return createLogsExplorerControllerFactory(dependencies)(args);
};

View file

@ -6,10 +6,10 @@
*/
import createContainer from 'constate';
import type { LogExplorerController } from './types';
import type { LogsExplorerController } from './types';
const useLogExplorerController = ({ controller }: { controller: LogExplorerController }) =>
const useLogsExplorerController = ({ controller }: { controller: LogsExplorerController }) =>
controller;
export const [LogExplorerControllerProvider, useLogExplorerControllerContext] =
createContainer(useLogExplorerController);
export const [LogsExplorerControllerProvider, useLogsExplorerControllerContext] =
createContainer(useLogsExplorerController);

View file

@ -13,13 +13,17 @@ import {
} from '../../common';
import {
DEFAULT_CONTEXT,
LogExplorerControllerContext,
} from '../state_machines/log_explorer_controller';
import { LogExplorerPublicState, LogExplorerPublicStateUpdate, OptionsListControl } from './types';
LogsExplorerControllerContext,
} from '../state_machines/logs_explorer_controller';
import {
LogsExplorerPublicState,
LogsExplorerPublicStateUpdate,
OptionsListControl,
} from './types';
export const getPublicStateFromContext = (
context: LogExplorerControllerContext
): LogExplorerPublicState => {
context: LogsExplorerControllerContext
): LogsExplorerPublicState => {
return {
chart: context.chart,
datasetSelection: context.datasetSelection.toPlainSelection(),
@ -33,8 +37,8 @@ export const getPublicStateFromContext = (
};
export const getContextFromPublicState = (
publicState: LogExplorerPublicStateUpdate
): LogExplorerControllerContext => ({
publicState: LogsExplorerPublicStateUpdate
): LogsExplorerControllerContext => ({
...DEFAULT_CONTEXT,
chart: {
...DEFAULT_CONTEXT.chart,
@ -61,7 +65,7 @@ export const getContextFromPublicState = (
const getPublicControlsStateFromControlPanels = (
controlPanels: ControlPanels | undefined
): LogExplorerPublicState['controls'] =>
): LogsExplorerPublicState['controls'] =>
controlPanels != null
? {
...(availableControlsPanels.NAMESPACE in controlPanels
@ -87,7 +91,7 @@ const getOptionsListPublicControlStateFromControlPanel = (
});
const getControlPanelsFromPublicControlsState = (
publicControlsState: LogExplorerPublicStateUpdate['controls']
publicControlsState: LogsExplorerPublicStateUpdate['controls']
): ControlPanels => {
if (publicControlsState == null) {
return {};

View file

@ -17,23 +17,23 @@ import {
} from '../../common';
import { IDatasetsClient } from '../services/datasets';
import {
LogExplorerControllerStateMachine,
LogExplorerControllerStateService,
} from '../state_machines/log_explorer_controller';
import { LogExplorerCustomizations } from '../customizations/types';
LogsExplorerControllerStateMachine,
LogsExplorerControllerStateService,
} from '../state_machines/logs_explorer_controller';
import { LogsExplorerCustomizations } from '../customizations/types';
export interface LogExplorerController {
export interface LogsExplorerController {
actions: {};
customizations: LogExplorerCustomizations;
customizations: LogsExplorerCustomizations;
datasetsClient: IDatasetsClient;
discoverServices: LogExplorerDiscoverServices;
event$: Observable<LogExplorerPublicEvent>;
service: LogExplorerControllerStateService;
state$: Observable<LogExplorerPublicState>;
stateMachine: LogExplorerControllerStateMachine;
discoverServices: LogsExplorerDiscoverServices;
event$: Observable<LogsExplorerPublicEvent>;
service: LogsExplorerControllerStateService;
state$: Observable<LogsExplorerPublicState>;
stateMachine: LogsExplorerControllerStateMachine;
}
export type LogExplorerDiscoverServices = Pick<
export type LogsExplorerDiscoverServices = Pick<
Required<DiscoverContainerProps['overrideServices']>,
'data' | 'filterManager' | 'timefilter' | 'uiSettings' | 'history'
> & {
@ -59,17 +59,17 @@ export interface ControlOptions {
}
// we might want to wrap this into an object that has a "state value" laster
export type LogExplorerPublicState = QueryState &
export type LogsExplorerPublicState = QueryState &
DisplayOptions & {
controls: ControlOptions;
datasetSelection: DatasetSelectionPlain;
};
export type LogExplorerPublicStateUpdate = QueryState &
export type LogsExplorerPublicStateUpdate = QueryState &
PartialDisplayOptions & {
controls?: ControlOptions;
datasetSelection?: DatasetSelectionPlain;
};
// a placeholder for now
export type LogExplorerPublicEvent = never;
export type LogsExplorerPublicEvent = never;

View file

@ -10,21 +10,21 @@ import { Query } from '@kbn/es-query';
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import { useControlPanels } from '../hooks/use_control_panels';
import { LogExplorerControllerStateService } from '../state_machines/log_explorer_controller';
import { LogsExplorerControllerStateService } from '../state_machines/logs_explorer_controller';
const DATASET_FILTERS_CUSTOMIZATION_ID = 'datasetFiltersCustomization';
interface CustomDatasetFiltersProps {
logExplorerControllerStateService: LogExplorerControllerStateService;
logsExplorerControllerStateService: LogsExplorerControllerStateService;
data: DataPublicPluginStart;
}
const CustomDatasetFilters = ({
logExplorerControllerStateService,
logsExplorerControllerStateService,
data,
}: CustomDatasetFiltersProps) => {
const { getInitialInput, setControlGroupAPI, query, filters, timeRange } = useControlPanels(
logExplorerControllerStateService,
logsExplorerControllerStateService,
data
);

View file

@ -15,15 +15,15 @@ import { DataViewsProvider, useDataViewsContext } from '../hooks/use_data_views'
import { useEsql } from '../hooks/use_esql';
import { IntegrationsProvider, useIntegrationsContext } from '../hooks/use_integrations';
import { IDatasetsClient } from '../services/datasets';
import { LogExplorerControllerStateService } from '../state_machines/log_explorer_controller';
import { LogsExplorerControllerStateService } from '../state_machines/logs_explorer_controller';
interface CustomDatasetSelectorProps {
logExplorerControllerStateService: LogExplorerControllerStateService;
logsExplorerControllerStateService: LogsExplorerControllerStateService;
}
export const CustomDatasetSelector = withProviders(({ logExplorerControllerStateService }) => {
export const CustomDatasetSelector = withProviders(({ logsExplorerControllerStateService }) => {
const { datasetSelection, handleDatasetSelectionChange } = useDatasetSelection(
logExplorerControllerStateService
logsExplorerControllerStateService
);
const {
@ -111,13 +111,13 @@ function withProviders(Component: React.FunctionComponent<CustomDatasetSelectorP
datasetsClient,
dataViews,
discover,
logExplorerControllerStateService,
logsExplorerControllerStateService,
}: CustomDatasetSelectorBuilderProps) {
return (
<IntegrationsProvider datasetsClient={datasetsClient}>
<DatasetsProvider datasetsClient={datasetsClient}>
<DataViewsProvider dataViewsService={dataViews} discoverService={discover}>
<Component logExplorerControllerStateService={logExplorerControllerStateService} />
<Component logsExplorerControllerStateService={logsExplorerControllerStateService} />
</DataViewsProvider>
</DatasetsProvider>
</IntegrationsProvider>

View file

@ -9,8 +9,8 @@ import React, { useMemo } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { DocViewRenderProps } from '@kbn/unified-doc-viewer/types';
import { FlyoutDetail } from '../components/flyout_detail/flyout_detail';
import { LogExplorerFlyoutContentProps } from './types';
import { useLogExplorerControllerContext } from '../controller';
import { LogsExplorerFlyoutContentProps } from './types';
import { useLogsExplorerControllerContext } from '../controller';
import { LogDocument } from '../../common/document';
const CustomFlyoutContent = ({
@ -22,9 +22,9 @@ const CustomFlyoutContent = ({
}: DocViewRenderProps) => {
const {
customizations: { flyout },
} = useLogExplorerControllerContext();
} = useLogsExplorerControllerContext();
const flyoutContentProps: LogExplorerFlyoutContentProps = useMemo(
const flyoutContentProps: LogsExplorerFlyoutContentProps = useMemo(
() => ({
actions: {
addFilter: filter,
@ -53,7 +53,7 @@ const CustomFlyoutContent = ({
);
};
const renderContent = ({ actions, dataView, doc }: LogExplorerFlyoutContentProps) => (
const renderContent = ({ actions, dataView, doc }: LogsExplorerFlyoutContentProps) => (
<EuiFlexItem>
<FlyoutDetail actions={actions} dataView={dataView} doc={doc} />
</EuiFlexItem>

View file

@ -13,9 +13,9 @@ import type { CustomizationCallback } from '@kbn/discover-plugin/public';
import { i18n } from '@kbn/i18n';
import { waitFor } from 'xstate/lib/waitFor';
import { dynamic } from '@kbn/shared-ux-utility';
import type { LogExplorerController } from '../controller';
import { LogExplorerControllerProvider } from '../controller/provider';
import type { LogExplorerStartDeps } from '../types';
import type { LogsExplorerController } from '../controller';
import { LogsExplorerControllerProvider } from '../controller/provider';
import type { LogsExplorerStartDeps } from '../types';
import { useKibanaContextForPluginProvider } from '../utils/use_kibana';
import { createCustomSearchBar } from './custom_search_bar';
import { createCustomCellRenderer } from './custom_cell_renderer';
@ -25,18 +25,18 @@ const LazyCustomDatasetFilters = dynamic(() => import('./custom_dataset_filters'
const LazyCustomDatasetSelector = dynamic(() => import('./custom_dataset_selector'));
const LazyCustomFlyoutContent = dynamic(() => import('./custom_flyout_content'));
export interface CreateLogExplorerProfileCustomizationsDeps {
export interface CreateLogsExplorerProfileCustomizationsDeps {
core: CoreStart;
plugins: LogExplorerStartDeps;
controller: LogExplorerController;
plugins: LogsExplorerStartDeps;
controller: LogsExplorerController;
}
export const createLogExplorerProfileCustomizations =
export const createLogsExplorerProfileCustomizations =
({
core,
plugins,
controller,
}: CreateLogExplorerProfileCustomizationsDeps): CustomizationCallback =>
}: CreateLogsExplorerProfileCustomizationsDeps): CustomizationCallback =>
async ({ customizations, stateContainer }) => {
const { discoverServices, service } = controller;
const pluginsWithOverrides = {
@ -68,13 +68,13 @@ export const createLogExplorerProfileCustomizations =
datasetsClient={controller.datasetsClient}
dataViews={dataViews}
discover={discover}
logExplorerControllerStateService={service}
logsExplorerControllerStateService={service}
/>
</KibanaContextProviderForPlugin>
);
},
PrependFilterBar: () => (
<LazyCustomDatasetFilters logExplorerControllerStateService={service} data={data} />
<LazyCustomDatasetFilters logsExplorerControllerStateService={service} data={data} />
),
CustomSearchBar: createCustomSearchBar({
data,
@ -131,9 +131,9 @@ export const createLogExplorerProfileCustomizations =
return (
<KibanaContextProviderForPlugin>
<LogExplorerControllerProvider controller={controller}>
<LogsExplorerControllerProvider controller={controller}>
<LazyCustomFlyoutContent {...props} />
</LogExplorerControllerProvider>
</LogsExplorerControllerProvider>
</KibanaContextProviderForPlugin>
);
},

View file

@ -15,7 +15,7 @@ export type RenderContentCustomization<Props> = (
renderPreviousContent: RenderPreviousContent<Props>
) => (props: Props) => React.ReactNode;
export interface LogExplorerFlyoutContentProps {
export interface LogsExplorerFlyoutContentProps {
actions: {
addFilter: DocViewRenderProps['filter'];
addColumn: DocViewRenderProps['onAddColumn'];
@ -25,8 +25,8 @@ export interface LogExplorerFlyoutContentProps {
doc: LogDocument;
}
export interface LogExplorerCustomizations {
export interface LogsExplorerCustomizations {
flyout?: {
renderContent?: RenderContentCustomization<LogExplorerFlyoutContentProps>;
renderContent?: RenderContentCustomization<LogsExplorerFlyoutContentProps>;
};
}

View file

@ -13,16 +13,16 @@ import { Query, TimeRange } from '@kbn/es-query';
import { useQuerySubscriber } from '@kbn/unified-field-list';
import { useSelector } from '@xstate/react';
import { useCallback } from 'react';
import { LogExplorerControllerStateService } from '../state_machines/log_explorer_controller';
import { LogsExplorerControllerStateService } from '../state_machines/logs_explorer_controller';
export const useControlPanels = (
logExplorerControllerStateService: LogExplorerControllerStateService,
logsExplorerControllerStateService: LogsExplorerControllerStateService,
data: DataPublicPluginStart
) => {
const { query, filters, fromDate, toDate } = useQuerySubscriber({ data });
const timeRange: TimeRange = { from: fromDate!, to: toDate! };
const controlPanels = useSelector(logExplorerControllerStateService, (state) => {
const controlPanels = useSelector(logsExplorerControllerStateService, (state) => {
if (!('controlPanels' in state.context)) return;
return state.context.controlPanels;
});
@ -45,12 +45,12 @@ export const useControlPanels = (
const setControlGroupAPI = useCallback(
(controlGroupAPI: ControlGroupAPI) => {
logExplorerControllerStateService.send({
logsExplorerControllerStateService.send({
type: 'INITIALIZE_CONTROL_GROUP_API',
controlGroupAPI,
});
},
[logExplorerControllerStateService]
[logsExplorerControllerStateService]
);
return { getInitialInput, setControlGroupAPI, query, filters, timeRange };

View file

@ -8,20 +8,20 @@
import { useSelector } from '@xstate/react';
import { useCallback } from 'react';
import { DatasetSelectionChange } from '../../common/dataset_selection';
import { LogExplorerControllerStateService } from '../state_machines/log_explorer_controller';
import { LogsExplorerControllerStateService } from '../state_machines/logs_explorer_controller';
export const useDatasetSelection = (
logExplorerControllerStateService: LogExplorerControllerStateService
logsExplorerControllerStateService: LogsExplorerControllerStateService
) => {
const datasetSelection = useSelector(logExplorerControllerStateService, (state) => {
const datasetSelection = useSelector(logsExplorerControllerStateService, (state) => {
return state.context.datasetSelection;
});
const handleDatasetSelectionChange: DatasetSelectionChange = useCallback(
(data) => {
logExplorerControllerStateService.send({ type: 'UPDATE_DATASET_SELECTION', data });
logsExplorerControllerStateService.send({ type: 'UPDATE_DATASET_SELECTION', data });
},
[logExplorerControllerStateService]
[logsExplorerControllerStateService]
);
return { datasetSelection, handleDatasetSelectionChange };

View file

@ -5,10 +5,10 @@
* 2.0.
*/
import createContainer from 'constate';
import type { LogExplorerFlyoutContentProps } from '../customizations/types';
import type { LogsExplorerFlyoutContentProps } from '../customizations/types';
interface UseFlyoutActionsDeps {
value: LogExplorerFlyoutContentProps['actions'];
value: LogsExplorerFlyoutContentProps['actions'];
}
const useDiscoverActions = ({ value }: UseFlyoutActionsDeps) => value;

View file

@ -7,12 +7,12 @@
import { formatFieldValue } from '@kbn/discover-utils';
import * as constants from '../../common/constants';
import { useKibanaContextForPlugin } from '../utils/use_kibana';
import { LogExplorerFlyoutContentProps } from '../customizations/types';
import { LogsExplorerFlyoutContentProps } from '../customizations/types';
import { FlyoutDoc, LogDocument } from '../../common/document';
export function useDocDetail(
doc: LogDocument,
{ dataView }: Pick<LogExplorerFlyoutContentProps, 'dataView'>
{ dataView }: Pick<LogsExplorerFlyoutContentProps, 'dataView'>
): FlyoutDoc {
const { services } = useKibanaContextForPlugin();

View file

@ -6,11 +6,11 @@
*/
import createContainer from 'constate';
import type { DataView } from '@kbn/data-views-plugin/common';
import { LogExplorerDiscoverServices } from '../controller';
import { LogsExplorerDiscoverServices } from '../controller';
export interface UseVirtualColumnServices {
services: {
data: LogExplorerDiscoverServices['data'];
data: LogsExplorerDiscoverServices['data'];
dataView: DataView;
};
}

View file

@ -6,27 +6,27 @@
*/
import type { PluginInitializerContext } from '@kbn/core/public';
import type { LogExplorerConfig } from '../common/plugin_config';
import { LogExplorerPlugin } from './plugin';
import type { LogsExplorerConfig } from '../common/plugin_config';
import { LogsExplorerPlugin } from './plugin';
export type {
CreateLogExplorerController,
LogExplorerController,
LogExplorerPublicState,
LogExplorerPublicStateUpdate,
CreateLogsExplorerController,
LogsExplorerController,
LogsExplorerPublicState,
LogsExplorerPublicStateUpdate,
} from './controller';
export type {
LogExplorerCustomizations,
LogExplorerFlyoutContentProps,
LogsExplorerCustomizations,
LogsExplorerFlyoutContentProps,
} from './customizations/types';
export type { LogExplorerControllerContext } from './state_machines/log_explorer_controller';
export type { LogExplorerPluginSetup, LogExplorerPluginStart } from './types';
export type { LogsExplorerControllerContext } from './state_machines/logs_explorer_controller';
export type { LogsExplorerPluginSetup, LogsExplorerPluginStart } from './types';
export {
getDiscoverColumnsFromDisplayOptions,
getDiscoverGridFromDisplayOptions,
getDiscoverFiltersFromState,
} from './utils/convert_discover_app_state';
export function plugin(context: PluginInitializerContext<LogExplorerConfig>) {
return new LogExplorerPlugin(context);
export function plugin(context: PluginInitializerContext<LogsExplorerConfig>) {
return new LogsExplorerPlugin(context);
}

View file

@ -7,35 +7,37 @@
import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
import { DISCOVER_APP_LOCATOR, DiscoverAppLocatorParams } from '@kbn/discover-plugin/common';
import { LogExplorerLocatorDefinition, LogExplorerLocators } from '../common/locators';
import { createLogExplorer } from './components/log_explorer';
import { createLogExplorerControllerLazyFactory } from './controller/lazy_create_controller';
import { LogsExplorerLocatorDefinition, LogsExplorerLocators } from '../common/locators';
import { createLogsExplorer } from './components/logs_explorer';
import { createLogsExplorerControllerLazyFactory } from './controller/lazy_create_controller';
import type {
LogExplorerPluginSetup,
LogExplorerPluginStart,
LogExplorerSetupDeps,
LogExplorerStartDeps,
LogsExplorerPluginSetup,
LogsExplorerPluginStart,
LogsExplorerSetupDeps,
LogsExplorerStartDeps,
} from './types';
export class LogExplorerPlugin implements Plugin<LogExplorerPluginSetup, LogExplorerPluginStart> {
private locators?: LogExplorerLocators;
export class LogsExplorerPlugin
implements Plugin<LogsExplorerPluginSetup, LogsExplorerPluginStart>
{
private locators?: LogsExplorerLocators;
constructor(context: PluginInitializerContext) {}
public setup(core: CoreSetup, plugins: LogExplorerSetupDeps) {
public setup(core: CoreSetup, plugins: LogsExplorerSetupDeps) {
const { share } = plugins;
const discoverAppLocator =
share.url.locators.get<DiscoverAppLocatorParams>(DISCOVER_APP_LOCATOR);
// Register Locators
const logExplorerLocator = share.url.locators.create(
new LogExplorerLocatorDefinition({
const logsExplorerLocator = share.url.locators.create(
new LogsExplorerLocatorDefinition({
discoverAppLocator,
})
);
this.locators = {
logExplorerLocator,
logsExplorerLocator,
};
return {
@ -43,20 +45,20 @@ export class LogExplorerPlugin implements Plugin<LogExplorerPluginSetup, LogExpl
};
}
public start(core: CoreStart, plugins: LogExplorerStartDeps) {
const LogExplorer = createLogExplorer({
public start(core: CoreStart, plugins: LogsExplorerStartDeps) {
const LogsExplorer = createLogsExplorer({
core,
plugins,
});
const createLogExplorerController = createLogExplorerControllerLazyFactory({
const createLogsExplorerController = createLogsExplorerControllerLazyFactory({
core,
plugins,
});
return {
LogExplorer,
createLogExplorerController,
LogsExplorer,
createLogsExplorerController,
};
}
}

View file

@ -12,9 +12,9 @@ import {
LOG_LEVEL_FIELD,
} from '../../../../common/constants';
import { AllDatasetSelection } from '../../../../common/dataset_selection';
import { DefaultLogExplorerControllerState } from './types';
import { DefaultLogsExplorerControllerState } from './types';
export const DEFAULT_CONTEXT: DefaultLogExplorerControllerState = {
export const DEFAULT_CONTEXT: DefaultLogsExplorerControllerState = {
datasetSelection: AllDatasetSelection.create(),
grid: {
columns: DEFAULT_COLUMNS,

View file

@ -16,10 +16,10 @@ import {
ControlPanelRT,
ControlPanels,
} from '../../../../../common';
import { LogExplorerControllerContext, LogExplorerControllerEvent } from '../types';
import { LogsExplorerControllerContext, LogsExplorerControllerEvent } from '../types';
export const initializeControlPanels =
(): InvokeCreator<LogExplorerControllerContext, LogExplorerControllerEvent> =>
(): InvokeCreator<LogsExplorerControllerContext, LogsExplorerControllerEvent> =>
async (context) => {
if (!('discoverStateContainer' in context)) return;
return context.controlPanels
@ -28,7 +28,7 @@ export const initializeControlPanels =
};
export const subscribeControlGroup =
(): InvokeCreator<LogExplorerControllerContext, LogExplorerControllerEvent> =>
(): InvokeCreator<LogsExplorerControllerContext, LogsExplorerControllerEvent> =>
(context) =>
(send) => {
if (!('controlGroupAPI' in context)) return;
@ -55,7 +55,7 @@ export const subscribeControlGroup =
};
export const updateControlPanels =
(): InvokeCreator<LogExplorerControllerContext, LogExplorerControllerEvent> =>
(): InvokeCreator<LogsExplorerControllerContext, LogsExplorerControllerEvent> =>
async (context, event) => {
if (!('controlGroupAPI' in context)) return;
if (!('discoverStateContainer' in context)) return;

View file

@ -6,10 +6,10 @@
*/
import { InvokeCreator } from 'xstate';
import { LogExplorerControllerContext, LogExplorerControllerEvent } from '../types';
import { LogsExplorerControllerContext, LogsExplorerControllerEvent } from '../types';
export const createAndSetDataView =
(): InvokeCreator<LogExplorerControllerContext, LogExplorerControllerEvent> =>
(): InvokeCreator<LogsExplorerControllerContext, LogsExplorerControllerEvent> =>
async (context) => {
if (!('discoverStateContainer' in context)) return;
const { discoverStateContainer } = context;

View file

@ -14,13 +14,13 @@ import {
getGridRowsDisplayOptionsFromDiscoverAppState,
getQueryStateFromDiscoverAppState,
} from '../../../../utils/convert_discover_app_state';
import { LogExplorerControllerContext, LogExplorerControllerEvent } from '../types';
import { LogsExplorerControllerContext, LogsExplorerControllerEvent } from '../types';
export const subscribeToDiscoverState =
() =>
(
context: LogExplorerControllerContext
): InvokeCallback<LogExplorerControllerEvent, LogExplorerControllerEvent> =>
context: LogsExplorerControllerContext
): InvokeCallback<LogsExplorerControllerEvent, LogsExplorerControllerEvent> =>
(send, onEvent) => {
if (!('discoverStateContainer' in context)) {
throw new Error('Failed to subscribe to the Discover state: no state container in context.');
@ -47,8 +47,8 @@ export const subscribeToDiscoverState =
};
export const updateContextFromDiscoverAppState = actions.assign<
LogExplorerControllerContext,
LogExplorerControllerEvent
LogsExplorerControllerContext,
LogsExplorerControllerEvent
>((context, event) => {
if ('appState' in event && event.type === 'RECEIVE_DISCOVER_APP_STATE') {
return {
@ -72,8 +72,8 @@ export const updateContextFromDiscoverAppState = actions.assign<
});
export const updateDiscoverAppStateFromContext: ActionFunction<
LogExplorerControllerContext,
LogExplorerControllerEvent
LogsExplorerControllerContext,
LogsExplorerControllerEvent
> = (context, _event) => {
if (!('discoverStateContainer' in context)) {
return;

View file

@ -9,18 +9,18 @@ import { InvokeCreator } from 'xstate';
import { Dataset } from '../../../../../common/datasets';
import { SingleDatasetSelection } from '../../../../../common/dataset_selection';
import { IDatasetsClient } from '../../../../services/datasets';
import { LogExplorerControllerContext, LogExplorerControllerEvent } from '../types';
import { LogsExplorerControllerContext, LogsExplorerControllerEvent } from '../types';
interface LogExplorerControllerUrlStateDependencies {
interface LogsExplorerControllerUrlStateDependencies {
datasetsClient: IDatasetsClient;
}
export const validateSelection =
({
datasetsClient,
}: LogExplorerControllerUrlStateDependencies): InvokeCreator<
LogExplorerControllerContext,
LogExplorerControllerEvent
}: LogsExplorerControllerUrlStateDependencies): InvokeCreator<
LogsExplorerControllerContext,
LogsExplorerControllerEvent
> =>
(context) =>
async (send) => {

View file

@ -8,17 +8,17 @@
import type { QueryStart } from '@kbn/data-plugin/public';
import { map, merge, Observable } from 'rxjs';
import { ActionFunction, actions } from 'xstate';
import type { LogExplorerControllerContext, LogExplorerControllerEvent } from '../types';
import type { LogsExplorerControllerContext, LogsExplorerControllerEvent } from '../types';
export const subscribeToTimefilterService =
(query: QueryStart) => (): Observable<LogExplorerControllerEvent> => {
(query: QueryStart) => (): Observable<LogsExplorerControllerEvent> => {
const {
timefilter: { timefilter },
} = query;
const time$ = timefilter.getTimeUpdate$().pipe(
map(
(): LogExplorerControllerEvent => ({
(): LogsExplorerControllerEvent => ({
type: 'RECEIVE_TIMEFILTER_TIME',
time: timefilter.getTime(),
})
@ -27,7 +27,7 @@ export const subscribeToTimefilterService =
const refreshInterval$ = timefilter.getRefreshIntervalUpdate$().pipe(
map(
(): LogExplorerControllerEvent => ({
(): LogsExplorerControllerEvent => ({
type: 'RECEIVE_TIMEFILTER_REFRESH_INTERVAL',
refreshInterval: timefilter.getRefreshInterval(),
})
@ -38,8 +38,8 @@ export const subscribeToTimefilterService =
};
export const updateContextFromTimefilter = actions.assign<
LogExplorerControllerContext,
LogExplorerControllerEvent
LogsExplorerControllerContext,
LogsExplorerControllerEvent
>((context, event) => {
if (event.type === 'RECEIVE_TIMEFILTER_TIME' && 'time' in event) {
return {
@ -57,7 +57,7 @@ export const updateContextFromTimefilter = actions.assign<
});
export const updateTimefilterFromContext =
(query: QueryStart): ActionFunction<LogExplorerControllerContext, LogExplorerControllerEvent> =>
(query: QueryStart): ActionFunction<LogsExplorerControllerContext, LogsExplorerControllerEvent> =>
(context, _event) => {
if (context.time != null) {
query.timefilter.timefilter.setTime(context.time);

View file

@ -34,24 +34,24 @@ import {
updateTimefilterFromContext,
} from './services/timefilter_service';
import {
LogExplorerControllerContext,
LogExplorerControllerEvent,
LogExplorerControllerTypeState,
LogsExplorerControllerContext,
LogsExplorerControllerEvent,
LogsExplorerControllerTypeState,
} from './types';
export const createPureLogExplorerControllerStateMachine = (
initialContext: LogExplorerControllerContext
export const createPureLogsExplorerControllerStateMachine = (
initialContext: LogsExplorerControllerContext
) =>
/** @xstate-layout N4IgpgJg5mDOIC5QBkD2UCiAPADgG1QCcxCBhVAOwBdDU88SA6AVwoEt2q2BDPNgL0gBiAEoZSGAJIA1DABEA+gGUAKgEEVGBaQDyAOXWS9GEQG0ADAF1EoHKlhsulGyCyIAtACYAbIwDsAIzmAJwAzH4ArAA0IACeiJ5+AByMwZ6hnokALD6e5kneAL6FMWiYuATEZJQ0dAyEjByOPHz8HFBy3FTc0mxgAO5CEJRgjRQAbqgA1qNl2PhEJOTUtPRMTVy8Au2d3b0DCByTAMZdbJQWlpcudg5OFC5uCAGejObentFxiBHBwYyeLIBX5JfLeX7BCLFUroeaVJY1Vb1MbNLZtCgdLo9PqDEi0Br4LoAMyIAFtGHMKotqis6utOC1thjdtiDkdUKd7pdrkgQLdms5eU9sowAqEkn8IuLIUDvN4YvEEFksqE3hFQaEglkperPNCQJSFlVlrU1g0Noz0VATasAArcChgPCwIYjMaTGYU2FU42Iunmhlo9o2uj2x3Ow4TDlnC5WHm2ewCh5Cjy+YLeJJ+cGfTMS96fBWIJJJAKMULa8wZbzmPyfbxZfWG+E003Ii1BjEhvBhp0uvFERiEqgkwjkpvUrttwOtYN+7sO3uRk4xijcqw3RP3R4JPyqgJZDM14sygJywsIXf-TV+LLBEIFXc5Rveo0I2lmlGbVrCMQSGRaORJCUXRZBEBQ1FtW1lHUTR4z5TdzmTUBhVCdNRX3QEQmSbUknPCJAn8IJawiTxgm1dIoRKA0X2bSd6VRb8IFEcQpFkBQAEUAFUTAATWgjQMDg-ktxTBBMIiRhiyzcUpSzSJz0fRhvACPws0rEsIgietn3KV8WyReivwESBGAgLFYDAKglCdMBjnuRhxi2MyuAxayGDsxChGQIDND0BQVB0bQAAk1D0ABxDAlCEhDBWQxAyN8W8wkCJIfDSIFzzlLJ0KyfIwmVAIklCUIdLhCc5ynBjjIgUzzMstzbPsxy+Gc9oGo8yghE4205AEhRevUJQMBUZQMGQcQVEkfRoruRDtwQB9RXBVCIn3cwQnBc8S1VcEVQ0yIPgCAJSp9N9W0My0TOc7gLKsmyOooBynLOVz7vuIQBrUIaRqG8bSEm-QFDEVQdDEBQADE1EkZBOLEGak3m8FS1COUAmCNS5Wvc80hSYtPFS4rvDvJJNJOvS6IDKrBBq67bva+y2AgBgup6vrPu+0a-oBvR4ZEuLnh8FJCaK6t8drcstrFJSIj24EDs8I6ydoiqLrRK66ru9yGaZsAPo0L7hs5iapr84GArByHodhwT115YS5tE4FwUYFUifMdJlQid2sklnaZfFOWtIV46qPHX130qozqdq7o6bexCWBwVrmSxfZBmGR13WmWYaPKiPVcYmObvq+PKET5PMT2HEl2jLk41thNZti1xEEK4qlKBPIUfVHJQmxtCIVS9MvewopQ9z8PzspqP1djkutYT5gk5eyvWVxQh8UHPBiTJL1dOV-Pp8ummNfpxfl5c1e05rzlELXaw7ZipCW+edMUi9kIwh77xNXPIJITeGkfKy0ayniVnnKen5j6MGOHOMKtAl6wBYOwac1UhBGEkJNNQ3kABaWhdAGBEDoZACgwpEO6uBW0kheYO35nmAEgI0afGVAHXC3xnjlgkrlSUwQmHuzHjCfeECDJHzVjVWB754GoEQY0HWet1AKGkJIDAAB1BQ3UBryBoc3J4LwDwAk1Ojcih5wh-ylNlIqljEj4wopRQRZVJ4iKgWImBcCEE4CQYzZmGi+oEJUEQkhtpQpjSig3eCTdn66JRn4VImRqx+DCLwzIAQzFkRdvuDMqk-D5FvHY6iQjHH+mcYXCRpopEyKXhXLsPZnSukzuyT0YczpOPbCUtx0iPHlxXtUhcEZ2S31jFcMJ9sdGt3RuYN4GRAShG-r-dhKkMzSzvFpXcRNEgh3sadfSRTWnVVcZI9xSDKndLnDUvsG8BxDhHGOCezSdmoOjqU1Y5TOnHMvj08MsAb4rnvhuCJ80VJpKSNqLIoJ+FpBvH-QIEl1rlhJumImaRKJUQoKgCAcAXBNO2WaP5CNRLuBvIREI4QviKgSf4CUwQSYkQPOkMi4DCkflYLs6muK+YvxyH-bwMT8Z-D5fyv4Aj8kOLuR+FlOxU44jZbQl+7hSye01AWdhyoJnYV+DM7UMzUoMtFZHS0s53xnOlaMhAXgJlZCzEHJK-KCgKX3GWFSt57zcvLHqceBTdUF2qsayJPwSKpA+JWBWvwgTanPKhV4CteEkTlCEHIwQdXYr1S42m89GoypGb6hA1ZVQo2UujasmMVJ4QIoENIGZgS5MSImimxS9mps1umsuzVGYrzPs3TN81Ah7hybC3aeQ-CZV+ACJhqUf5BoKDWlWojC4NvbY9LxYAfUAu1DyksCSSb1nMAeNhioso5TyuWIERUSrupFUmr10c52l0em8iVVcBjLsdqeGJwJULig3WRIq-dspVgjcCI8B4p2HzrY89piCn382rBM9MXdg1kX3KS1unxX0oyBO+9U6M8lYtrSykyTy6AvKOSgqmkBIMv3rCkWDQbgQIbDfMlGKQxTZlPGkfhwHIF4fEeBzpi7yO6KlP8UiylbzZLyPjP+R6lLdwVms9jZ6tm4YefhnjRyL4GtNEax+-zHZYQBH8EInxNLrsHfMt2bxKygt+HKP4nxijFCAA */
createMachine<
LogExplorerControllerContext,
LogExplorerControllerEvent,
LogExplorerControllerTypeState
LogsExplorerControllerContext,
LogsExplorerControllerEvent,
LogsExplorerControllerTypeState
>(
{
context: initialContext,
predictableActionArguments: true,
id: 'LogExplorerController',
id: 'LogsExplorerController',
initial: 'uninitialized',
states: {
uninitialized: {
@ -252,20 +252,20 @@ export const createPureLogExplorerControllerStateMachine = (
}
);
export interface LogExplorerControllerStateMachineDependencies {
export interface LogsExplorerControllerStateMachineDependencies {
datasetsClient: IDatasetsClient;
initialContext?: LogExplorerControllerContext;
initialContext?: LogsExplorerControllerContext;
query: QueryStart;
toasts: IToasts;
}
export const createLogExplorerControllerStateMachine = ({
export const createLogsExplorerControllerStateMachine = ({
datasetsClient,
initialContext = DEFAULT_CONTEXT,
query,
toasts,
}: LogExplorerControllerStateMachineDependencies) =>
createPureLogExplorerControllerStateMachine(initialContext).withConfig({
}: LogsExplorerControllerStateMachineDependencies) =>
createPureLogsExplorerControllerStateMachine(initialContext).withConfig({
actions: {
notifyCreateDataViewFailed: createCreateDataViewFailedNotifier(toasts),
notifyDatasetSelectionRestoreFailed: createDatasetSelectionRestoreFailedNotifier(toasts),
@ -282,17 +282,17 @@ export const createLogExplorerControllerStateMachine = ({
},
});
export const initializeLogExplorerControllerStateService = (
deps: LogExplorerControllerStateMachineDependencies
export const initializeLogsExplorerControllerStateService = (
deps: LogsExplorerControllerStateMachineDependencies
) => {
const machine = createLogExplorerControllerStateMachine(deps);
const machine = createLogsExplorerControllerStateMachine(deps);
return interpret(machine).start();
};
export type LogExplorerControllerStateService = InterpreterFrom<
typeof createLogExplorerControllerStateMachine
export type LogsExplorerControllerStateService = InterpreterFrom<
typeof createLogsExplorerControllerStateMachine
>;
export type LogExplorerControllerStateMachine = ReturnType<
typeof createLogExplorerControllerStateMachine
export type LogsExplorerControllerStateMachine = ReturnType<
typeof createLogsExplorerControllerStateMachine
>;

View file

@ -32,11 +32,11 @@ export interface WithDiscoverStateContainer {
discoverStateContainer: DiscoverStateContainer;
}
export type DefaultLogExplorerControllerState = WithDatasetSelection &
export type DefaultLogsExplorerControllerState = WithDatasetSelection &
WithQueryState &
WithDisplayOptions;
export type LogExplorerControllerTypeState =
export type LogsExplorerControllerTypeState =
| {
value: 'uninitialized';
context: WithDatasetSelection & WithControlPanels & WithQueryState & WithDisplayOptions;
@ -120,11 +120,11 @@ export type LogExplorerControllerTypeState =
WithDiscoverStateContainer;
};
export type LogExplorerControllerContext = LogExplorerControllerTypeState['context'];
export type LogsExplorerControllerContext = LogsExplorerControllerTypeState['context'];
export type LogExplorerControllerStateValue = LogExplorerControllerTypeState['value'];
export type LogsExplorerControllerStateValue = LogsExplorerControllerTypeState['value'];
export type LogExplorerControllerEvent =
export type LogsExplorerControllerEvent =
| {
type: 'RECEIVED_STATE_CONTAINER';
discoverStateContainer: DiscoverStateContainer;

View file

@ -12,24 +12,24 @@ import type { SharePluginSetup } from '@kbn/share-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import type { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public';
import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { LogExplorerLocators } from '../common/locators';
import type { LogExplorerProps } from './components/log_explorer';
import type { CreateLogExplorerController } from './controller';
import type { LogsExplorerLocators } from '../common/locators';
import type { LogsExplorerProps } from './components/logs_explorer';
import type { CreateLogsExplorerController } from './controller';
export interface LogExplorerPluginSetup {
locators: LogExplorerLocators;
export interface LogsExplorerPluginSetup {
locators: LogsExplorerLocators;
}
export interface LogExplorerPluginStart {
LogExplorer: ComponentType<LogExplorerProps>;
createLogExplorerController: CreateLogExplorerController;
export interface LogsExplorerPluginStart {
LogsExplorer: ComponentType<LogsExplorerProps>;
createLogsExplorerController: CreateLogsExplorerController;
}
export interface LogExplorerSetupDeps {
export interface LogsExplorerSetupDeps {
share: SharePluginSetup;
discover: DiscoverSetup;
}
export interface LogExplorerStartDeps {
export interface LogsExplorerStartDeps {
data: DataPublicPluginStart;
dataViews: DataViewsPublicPluginStart;
discover: DiscoverStart;

View file

@ -12,11 +12,11 @@ import {
useKibana,
} from '@kbn/kibana-react-plugin/public';
import { useMemo } from 'react';
import { LogExplorerStartDeps } from '../types';
import { LogsExplorerStartDeps } from '../types';
export type PluginKibanaContextValue = CoreStart & LogExplorerStartDeps;
export type PluginKibanaContextValue = CoreStart & LogsExplorerStartDeps;
export const createKibanaContextForPlugin = (core: CoreStart, plugins: LogExplorerStartDeps) =>
export const createKibanaContextForPlugin = (core: CoreStart, plugins: LogsExplorerStartDeps) =>
createKibanaReactContext<PluginKibanaContextValue>({
...core,
...plugins,
@ -27,7 +27,7 @@ export const useKibanaContextForPlugin =
export const useKibanaContextForPluginProvider = (
core: CoreStart,
plugins: LogExplorerStartDeps
plugins: LogsExplorerStartDeps
) => {
const { Provider } = useMemo(() => createKibanaContextForPlugin(core, plugins), [core, plugins]);

View file

@ -6,6 +6,6 @@
*/
export const plugin = async () => {
const { LogExplorerServerPlugin } = await import('./plugin');
return new LogExplorerServerPlugin();
const { LogsExplorerServerPlugin } = await import('./plugin');
return new LogsExplorerServerPlugin();
};

View file

@ -7,26 +7,26 @@
import { Plugin, CoreSetup } from '@kbn/core/server';
import { DISCOVER_APP_LOCATOR, DiscoverAppLocatorParams } from '@kbn/discover-plugin/common';
import { LogExplorerLocatorDefinition, LogExplorerLocators } from '../common/locators';
import type { LogExplorerSetupDeps } from './types';
import { LogsExplorerLocatorDefinition, LogsExplorerLocators } from '../common/locators';
import type { LogsExplorerSetupDeps } from './types';
export class LogExplorerServerPlugin implements Plugin {
private locators?: LogExplorerLocators;
export class LogsExplorerServerPlugin implements Plugin {
private locators?: LogsExplorerLocators;
setup(core: CoreSetup, plugins: LogExplorerSetupDeps) {
setup(core: CoreSetup, plugins: LogsExplorerSetupDeps) {
const { share } = plugins;
const discoverAppLocator =
share.url.locators.get<DiscoverAppLocatorParams>(DISCOVER_APP_LOCATOR);
// Register Locators
const logExplorerLocator = share.url.locators.create(
new LogExplorerLocatorDefinition({
const logsExplorerLocator = share.url.locators.create(
new LogsExplorerLocatorDefinition({
discoverAppLocator,
})
);
this.locators = {
logExplorerLocator,
logsExplorerLocator,
};
return {

View file

@ -7,6 +7,6 @@
import type { SharePluginSetup } from '@kbn/share-plugin/server';
export interface LogExplorerSetupDeps {
export interface LogsExplorerSetupDeps {
share: SharePluginSetup;
}

View file

@ -6,14 +6,14 @@
*/
export {
type ObservabilityLogExplorerLocators,
type ObservabilityLogsExplorerLocators,
SingleDatasetLocatorDefinition,
AllDatasetsLocatorDefinition,
} from './locators';
export {
OBSERVABILITY_LOGS_EXPLORER_URL_STATE_KEY,
OBSERVABILITY_DATASET_QUALITY_URL_STATE_KEY,
logExplorerUrlSchemaV1,
logsExplorerUrlSchemaV1,
datasetQualityUrlSchemaV1,
} from './url_schema';
export { deepCompactObject } from './utils/deep_compact_object';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
export type { ObservabilityLogExplorerLocationState } from '@kbn/deeplinks-observability/locators';
export type { ObservabilityLogsExplorerLocationState } from '@kbn/deeplinks-observability/locators';
import { AllDatasetsLocator } from './all_datasets';
import { SingleDatasetLocator } from './single_dataset';
@ -13,7 +13,7 @@ export * from './single_dataset';
export * from './all_datasets';
export * from './utils';
export interface ObservabilityLogExplorerLocators {
export interface ObservabilityLogsExplorerLocators {
allDatasetsLocator: AllDatasetsLocator;
singleDatasetLocator: SingleDatasetLocator;
}

View file

@ -19,11 +19,11 @@ import {
import { OBSERVABILITY_LOGS_EXPLORER_APP_ID } from '@kbn/deeplinks-observability';
import {
OBSERVABILITY_LOGS_EXPLORER_URL_STATE_KEY,
logExplorerUrlSchemaV1,
logsExplorerUrlSchemaV1,
} from '../../url_schema';
import { deepCompactObject } from '../../utils/deep_compact_object';
type ControlsPageState = NonNullable<logExplorerUrlSchemaV1.UrlSchema['controls']>;
type ControlsPageState = NonNullable<logsExplorerUrlSchemaV1.UrlSchema['controls']>;
interface LocatorPathConstructionParams {
datasetSelection: DatasetSelectionPlain;
@ -38,7 +38,7 @@ export const constructLocatorPath = async (params: LocatorPathConstructionParams
useHash,
} = params;
const pageState = logExplorerUrlSchemaV1.urlSchemaRT.encode(
const pageState = logsExplorerUrlSchemaV1.urlSchemaRT.encode(
deepCompactObject({
v: 1,
datasetSelection,

View file

@ -9,5 +9,5 @@ export {
OBSERVABILITY_LOGS_EXPLORER_URL_STATE_KEY,
OBSERVABILITY_DATASET_QUALITY_URL_STATE_KEY,
} from './common';
export * as logExplorerUrlSchemaV1 from './url_schema_v1';
export * as logsExplorerUrlSchemaV1 from './url_schema_v1';
export * as datasetQualityUrlSchemaV1 from './dataset_quality/url_schema_v1';

View file

@ -6,7 +6,7 @@
*/
import { EuiHeaderLink } from '@elastic/eui';
import { LOG_EXPLORER_FEEDBACK_LINK } from '@kbn/observability-shared-plugin/common';
import { LOGS_EXPLORER_FEEDBACK_LINK } from '@kbn/observability-shared-plugin/common';
import React from 'react';
import { feedbackLinkTitle } from '../../common/translations';
@ -14,7 +14,7 @@ export const FeedbackLink = React.memo(() => {
return (
<EuiHeaderLink
color="primary"
href={LOG_EXPLORER_FEEDBACK_LINK}
href={LOGS_EXPLORER_FEEDBACK_LINK}
iconType="popout"
iconSide="right"
iconSize="s"

View file

@ -17,7 +17,7 @@ import styled from '@emotion/styled';
import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { euiThemeVars } from '@kbn/ui-theme';
import { LogExplorerTabs } from '@kbn/discover-plugin/public';
import { LogsExplorerTabs } from '@kbn/discover-plugin/public';
import React, { useEffect, useState } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { filter, take } from 'rxjs';
@ -43,7 +43,7 @@ const ServerlessTopNav = () => {
<EuiHeader data-test-subj="logsExplorerHeaderMenu" css={{ boxShadow: 'none' }}>
<EuiHeaderSection>
<EuiHeaderSectionItem>
<LogExplorerTabs services={services} selectedTab="log-explorer" />
<LogsExplorerTabs services={services} selectedTab="logs-explorer" />
</EuiHeaderSectionItem>
</EuiHeaderSection>
<EuiHeaderSection

View file

@ -6,17 +6,17 @@
*/
import { EuiFlexItem } from '@elastic/eui';
import {
LogExplorerCustomizations,
LogExplorerFlyoutContentProps,
LogsExplorerCustomizations,
LogsExplorerFlyoutContentProps,
} from '@kbn/logs-explorer-plugin/public';
import type { LogAIAssistantDocument } from '@kbn/logs-shared-plugin/public';
import React, { useMemo } from 'react';
import { useKibanaContextForPlugin } from '../utils/use_kibana';
type RenderFlyoutContentCustomization =
Required<LogExplorerCustomizations>['flyout']['renderContent'];
Required<LogsExplorerCustomizations>['flyout']['renderContent'];
const ObservabilityLogAIAssistant = ({ doc }: LogExplorerFlyoutContentProps) => {
const ObservabilityLogAIAssistant = ({ doc }: LogsExplorerFlyoutContentProps) => {
const { services } = useKibanaContextForPlugin();
const { LogAIAssistant } = services.logsShared;
@ -40,7 +40,7 @@ export const renderFlyoutContent: RenderFlyoutContentCustomization =
/**
* Utils
*/
const mapDocToAIAssistantFormat = (doc: LogExplorerFlyoutContentProps['doc']) => {
const mapDocToAIAssistantFormat = (doc: LogsExplorerFlyoutContentProps['doc']) => {
if (!doc) return;
return {

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import { CreateLogExplorerController } from '@kbn/logs-explorer-plugin/public';
import { CreateLogsExplorerController } from '@kbn/logs-explorer-plugin/public';
import { renderFlyoutContent } from './flyout_content';
export const createLogExplorerControllerWithCustomizations =
(createLogExplorerController: CreateLogExplorerController): CreateLogExplorerController =>
(createLogExplorerController: CreateLogsExplorerController): CreateLogsExplorerController =>
(args) =>
createLogExplorerController({
...args,

View file

@ -17,7 +17,7 @@ import {
import { OBSERVABILITY_LOGS_EXPLORER_APP_ID } from '@kbn/deeplinks-observability';
import {
AllDatasetsLocatorDefinition,
ObservabilityLogExplorerLocators,
ObservabilityLogsExplorerLocators,
SingleDatasetLocatorDefinition,
} from '../common/locators';
import { type ObservabilityLogExplorerConfig } from '../common/plugin_config';
@ -33,7 +33,7 @@ export class ObservabilityLogExplorerPlugin
implements Plugin<ObservabilityLogExplorerPluginSetup, ObservabilityLogExplorerPluginStart>
{
private config: ObservabilityLogExplorerConfig;
private locators?: ObservabilityLogExplorerLocators;
private locators?: ObservabilityLogsExplorerLocators;
constructor(context: PluginInitializerContext<ObservabilityLogExplorerConfig>) {
this.config = context.config.get();
@ -87,7 +87,7 @@ export class ObservabilityLogExplorerPlugin
});
if (serverless) {
discover.showLogExplorerTabs();
discover.showLogsExplorerTabs();
}
// Register Locators

View file

@ -7,8 +7,8 @@
import { EuiEmptyPrompt, EuiLoadingLogo } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import type {
LogExplorerController,
LogExplorerPluginStart,
LogsExplorerController,
LogsExplorerPluginStart,
} from '@kbn/logs-explorer-plugin/public';
import { useActor } from '@xstate/react';
import React, { useMemo } from 'react';
@ -35,8 +35,8 @@ export const ObservabilityLogExplorerMainRoute = () => {
const urlStateStorageContainer = useKbnUrlStateStorageFromRouterContext();
const createLogExplorerController = useMemo(
() => createLogExplorerControllerWithCustomizations(logsExplorer.createLogExplorerController),
[logsExplorer.createLogExplorerController]
() => createLogExplorerControllerWithCustomizations(logsExplorer.createLogsExplorerController),
[logsExplorer.createLogsExplorerController]
);
return (
@ -97,12 +97,12 @@ const InitializedContent = React.memo(
logExplorerController,
}: {
history: ObservabilityLogExplorerHistory;
logExplorer: LogExplorerPluginStart;
logExplorerController: LogExplorerController;
logExplorer: LogsExplorerPluginStart;
logExplorerController: LogsExplorerController;
}) => {
return (
<ObservabilityLogExplorerPageTemplate>
<logExplorer.LogExplorer controller={logExplorerController} scopedHistory={history} />
<logExplorer.LogsExplorer controller={logExplorerController} scopedHistory={history} />
</ObservabilityLogExplorerPageTemplate>
);
}

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import type { CreateLogExplorerController } from '@kbn/logs-explorer-plugin/public';
import type { CreateLogsExplorerController } from '@kbn/logs-explorer-plugin/public';
import type { InvokeCreator } from 'xstate';
import type { ObservabilityLogExplorerContext, ObservabilityLogExplorerEvent } from './types';
@ -13,7 +13,7 @@ export const createController =
({
createLogExplorerController,
}: {
createLogExplorerController: CreateLogExplorerController;
createLogExplorerController: CreateLogsExplorerController;
}): InvokeCreator<ObservabilityLogExplorerContext, ObservabilityLogExplorerEvent> =>
(context, event) =>
(send) => {

View file

@ -7,7 +7,7 @@
import { IToasts } from '@kbn/core-notifications-browser';
import { IKbnUrlStateStorage } from '@kbn/kibana-utils-plugin/public';
import { CreateLogExplorerController } from '@kbn/logs-explorer-plugin/public';
import { CreateLogsExplorerController } from '@kbn/logs-explorer-plugin/public';
import { actions, createMachine, InterpreterFrom } from 'xstate';
import { TimefilterContract } from '@kbn/data-plugin/public';
import { DEFAULT_CONTEXT } from './defaults';
@ -142,7 +142,7 @@ export const createPureObservabilityLogExplorerStateMachine = (
);
export interface ObservabilityLogExplorerStateMachineDependencies {
createLogExplorerController: CreateLogExplorerController;
createLogExplorerController: CreateLogsExplorerController;
initialContext?: ObservabilityLogExplorerContext;
timeFilterService: TimefilterContract;
toasts: IToasts;

View file

@ -7,29 +7,29 @@
import { QueryState } from '@kbn/data-plugin/common';
import {
LogExplorerController,
LogExplorerPublicState,
LogExplorerPublicStateUpdate,
LogsExplorerController,
LogsExplorerPublicState,
LogsExplorerPublicStateUpdate,
} from '@kbn/logs-explorer-plugin/public';
export type ObservabilityLogExplorerContext = ObservabilityLogExplorerTypeState['context'];
export interface CommonObservabilityLogExplorerContext {
initialLogExplorerState: LogExplorerPublicStateUpdate;
initialLogExplorerState: LogsExplorerPublicStateUpdate;
}
export interface WithLogExplorerState {
logExplorerState: LogExplorerPublicState;
logExplorerState: LogsExplorerPublicState;
}
export interface WithController {
controller: LogExplorerController;
controller: LogsExplorerController;
}
export type ObservabilityLogExplorerEvent =
| {
type: 'INITIALIZED_FROM_URL';
stateFromUrl?: LogExplorerPublicStateUpdate;
stateFromUrl?: LogsExplorerPublicStateUpdate;
}
| {
type: 'INITIALIZED_FROM_TIME_FILTER_SERVICE';
@ -38,11 +38,11 @@ export type ObservabilityLogExplorerEvent =
}
| {
type: 'CONTROLLER_CREATED';
controller: LogExplorerController;
controller: LogsExplorerController;
}
| {
type: 'LOG_EXPLORER_STATE_CHANGED';
state: LogExplorerPublicState;
state: LogsExplorerPublicState;
};
export type ObservabilityLogExplorerTypeState =

View file

@ -5,14 +5,14 @@
* 2.0.
*/
import { LogExplorerPublicStateUpdate } from '@kbn/logs-explorer-plugin/public';
import { LogsExplorerPublicStateUpdate } from '@kbn/logs-explorer-plugin/public';
import * as rt from 'io-ts';
import { deepCompactObject, logExplorerUrlSchemaV1 } from '../../../../common';
import { deepCompactObject, logsExplorerUrlSchemaV1 } from '../../../../common';
export const getStateFromUrlValue = (
urlValue: logExplorerUrlSchemaV1.UrlSchema
): LogExplorerPublicStateUpdate =>
deepCompactObject<LogExplorerPublicStateUpdate>({
urlValue: logsExplorerUrlSchemaV1.UrlSchema
): LogsExplorerPublicStateUpdate =>
deepCompactObject<LogsExplorerPublicStateUpdate>({
chart: {
breakdownField: urlValue.breakdownField,
},
@ -32,9 +32,9 @@ export const getStateFromUrlValue = (
});
export const getUrlValueFromState = (
state: LogExplorerPublicStateUpdate
): logExplorerUrlSchemaV1.UrlSchema =>
deepCompactObject<logExplorerUrlSchemaV1.UrlSchema>({
state: LogsExplorerPublicStateUpdate
): logsExplorerUrlSchemaV1.UrlSchema =>
deepCompactObject<logsExplorerUrlSchemaV1.UrlSchema>({
breakdownField: state.chart?.breakdownField,
columns: state.grid?.columns,
controls: state.controls,
@ -49,9 +49,9 @@ export const getUrlValueFromState = (
});
const stateFromUrlSchemaRT = new rt.Type<
LogExplorerPublicStateUpdate,
logExplorerUrlSchemaV1.UrlSchema,
logExplorerUrlSchemaV1.UrlSchema
LogsExplorerPublicStateUpdate,
logsExplorerUrlSchemaV1.UrlSchema,
logsExplorerUrlSchemaV1.UrlSchema
>(
'stateFromUrlSchemaRT',
rt.never.is,
@ -60,4 +60,4 @@ const stateFromUrlSchemaRT = new rt.Type<
);
export const stateFromUntrustedUrlRT =
logExplorerUrlSchemaV1.urlSchemaRT.pipe(stateFromUrlSchemaRT);
logsExplorerUrlSchemaV1.urlSchemaRT.pipe(stateFromUrlSchemaRT);

View file

@ -6,7 +6,7 @@
*/
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { LogExplorerPluginStart } from '@kbn/logs-explorer-plugin/public';
import { LogsExplorerPluginStart } from '@kbn/logs-explorer-plugin/public';
import { DiscoverSetup, DiscoverStart } from '@kbn/discover-plugin/public';
import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public';
import { ServerlessPluginStart } from '@kbn/serverless/public';
@ -16,12 +16,12 @@ import { LogsSharedClientStartExports } from '@kbn/logs-shared-plugin/public';
import { DatasetQualityPluginStart } from '@kbn/dataset-quality-plugin/public';
import { ObservabilityAIAssistantPluginStart } from '@kbn/observability-ai-assistant-plugin/public';
import {
ObservabilityLogExplorerLocators,
ObservabilityLogExplorerLocationState,
ObservabilityLogsExplorerLocators,
ObservabilityLogsExplorerLocationState,
} from '../common/locators';
export interface ObservabilityLogExplorerPluginSetup {
locators: ObservabilityLogExplorerLocators;
locators: ObservabilityLogsExplorerLocators;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@ -36,7 +36,7 @@ export interface ObservabilityLogExplorerSetupDeps {
export interface ObservabilityLogExplorerStartDeps {
data: DataPublicPluginStart;
discover: DiscoverStart;
logsExplorer: LogExplorerPluginStart;
logsExplorer: LogsExplorerPluginStart;
logsShared: LogsSharedClientStartExports;
observabilityAIAssistant: ObservabilityAIAssistantPluginStart;
observabilityShared: ObservabilitySharedPluginStart;
@ -45,6 +45,6 @@ export interface ObservabilityLogExplorerStartDeps {
datasetQuality: DatasetQualityPluginStart;
}
export type ObservabilityLogExplorerHistory = ScopedHistory<ObservabilityLogExplorerLocationState>;
export type ObservabilityLogExplorerHistory = ScopedHistory<ObservabilityLogsExplorerLocationState>;
export type ObservabilityLogExplorerAppMountParameters =
AppMountParameters<ObservabilityLogExplorerLocationState>;
AppMountParameters<ObservabilityLogsExplorerLocationState>;

View file

@ -23,7 +23,7 @@ import {
waitForRuleStatus,
} from '../helpers/alerting_wait_for_helpers';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { ActionDocument, LogExplorerLocatorParsedParams } from './typings';
import { ActionDocument, LogsExplorerLocatorParsedParams } from './typings';
import { ISO_DATE_REGEX } from './constants';
// eslint-disable-next-line import/no-default-export
@ -247,11 +247,11 @@ export default function ({ getService }: FtrProviderContext) {
);
expect(resp.hits.hits[0]._source?.value).eql('250%');
const parsedViewInAppUrl = parseSearchParams<LogExplorerLocatorParsedParams>(
const parsedViewInAppUrl = parseSearchParams<LogsExplorerLocatorParsedParams>(
new URL(resp.hits.hits[0]._source?.viewInAppUrl || '').search
);
expect(resp.hits.hits[0]._source?.viewInAppUrl).contain('LOG_EXPLORER_LOCATOR');
expect(resp.hits.hits[0]._source?.viewInAppUrl).contain('LOGS_EXPLORER_LOCATOR');
expect(omit(parsedViewInAppUrl.params, 'timeRange.from')).eql({
dataset: DATA_VIEW_TITLE,
timeRange: { to: 'now' },

Some files were not shown because too many files have changed in this diff Show more