Skip to content

Commit

Permalink
[Logs Explorer] Rename logsExplorer instances in the observability_lo…
Browse files Browse the repository at this point in the history
…gs_explorer plugin (elastic#176213)

Renames logsExplorer instances in the `observability_logs_explorer`
plugin.

Related to elastic#171991
  • Loading branch information
gbamparop authored Feb 5, 2024
1 parent 3b88a0c commit bceeea8
Show file tree
Hide file tree
Showing 36 changed files with 253 additions and 248 deletions.
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ Elastic.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/observability_logs_explorer/README.md[observabilityLogsExplorer]
|This plugin provides an app based on the LogExplorer component from the logs_explorer plugin, but adds observability-specific affordances.
|This plugin provides an app based on the LogsExplorer component from the logs_explorer plugin, but adds observability-specific affordances.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_onboarding/README.md[observabilityOnboarding]
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/observability_solution/logs_explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ While not fully realized yet, the dependency graph would roughly resemble the fo
```mermaid
flowchart TD
obs_log_explorer_app(Observability Logs Explorer app)
obs_logs_explorer_app(Observability Logs Explorer app)
obs_apps(Other Observability apps)
obs_log_explorer_component(Observability Logs Explorer component)
obs_logs_explorer_component(Observability Logs Explorer component)
other_apps(Other non-Observability apps)
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 --> logs_explorer_component
obs_logs_explorer_app --> obs_logs_explorer_component
obs_apps --> obs_logs_explorer_component
obs_logs_explorer_component --> logs_explorer_component
other_apps --> logs_explorer_component
logs_explorer_component --> discover
logs_explorer_component --> platform
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Observability Logs Explorer

This plugin provides an app based on the `LogExplorer` component from the `logs_explorer` plugin, but adds observability-specific affordances.
This plugin provides an app based on the `LogsExplorer` component from the `logs_explorer` plugin, but adds observability-specific affordances.

## Testing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

export interface ObservabilityLogExplorerConfig {
export interface ObservabilityLogsExplorerConfig {
navigation: {
showAppLink: boolean;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';

export const logExplorerAppTitle = i18n.translate('xpack.observabilityLogsExplorer.appTitle', {
export const logsExplorerAppTitle = i18n.translate('xpack.observabilityLogsExplorer.appTitle', {
defaultMessage: 'Logs Explorer',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { Route, Router, Routes } from '@kbn/shared-ux-router';
import React from 'react';
import ReactDOM from 'react-dom';
import { DatasetQualityRoute, ObservabilityLogExplorerMainRoute } from '../routes/main';
import { DatasetQualityRoute, ObservabilityLogsExplorerMainRoute } from '../routes/main';
import {
ObservabilityLogExplorerAppMountParameters,
ObservabilityLogExplorerPluginStart,
ObservabilityLogExplorerStartDeps,
ObservabilityLogsExplorerAppMountParameters,
ObservabilityLogsExplorerPluginStart,
ObservabilityLogsExplorerStartDeps,
} from '../types';
import { KbnUrlStateStorageFromRouterProvider } from '../utils/kbn_url_state_context';
import { useKibanaContextForPluginProvider } from '../utils/use_kibana';

export const renderObservabilityLogExplorer = (
export const renderObservabilityLogsExplorer = (
core: CoreStart,
pluginsStart: ObservabilityLogExplorerStartDeps,
ownPluginStart: ObservabilityLogExplorerPluginStart,
appParams: ObservabilityLogExplorerAppMountParameters
pluginsStart: ObservabilityLogsExplorerStartDeps,
ownPluginStart: ObservabilityLogsExplorerPluginStart,
appParams: ObservabilityLogsExplorerAppMountParameters
) => {
ReactDOM.render(
<ObservabilityLogExplorerApp
<ObservabilityLogsExplorerApp
appParams={appParams}
core={core}
plugins={pluginsStart}
Expand All @@ -44,19 +44,19 @@ export const renderObservabilityLogExplorer = (
};
};

export interface ObservabilityLogExplorerAppProps {
appParams: ObservabilityLogExplorerAppMountParameters;
export interface ObservabilityLogsExplorerAppProps {
appParams: ObservabilityLogsExplorerAppMountParameters;
core: CoreStart;
plugins: ObservabilityLogExplorerStartDeps;
pluginStart: ObservabilityLogExplorerPluginStart;
plugins: ObservabilityLogsExplorerStartDeps;
pluginStart: ObservabilityLogsExplorerPluginStart;
}

export const ObservabilityLogExplorerApp = ({
export const ObservabilityLogsExplorerApp = ({
appParams,
core,
plugins,
pluginStart,
}: ObservabilityLogExplorerAppProps) => {
}: ObservabilityLogsExplorerAppProps) => {
const KibanaContextProviderForPlugin = useKibanaContextForPluginProvider(
core,
plugins,
Expand All @@ -70,7 +70,7 @@ export const ObservabilityLogExplorerApp = ({
<KbnUrlStateStorageFromRouterProvider>
<Router history={appParams.history}>
<Routes>
<Route path="/" exact={true} render={() => <ObservabilityLogExplorerMainRoute />} />
<Route path="/" exact={true} render={() => <ObservabilityLogsExplorerMainRoute />} />
<Route path="/dataset-quality" exact={true} render={() => <DatasetQualityRoute />} />
</Routes>
</Router>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { Router } from '@kbn/shared-ux-router';
import { OBSERVABILITY_LOGS_EXPLORER_APP_ID } from '@kbn/deeplinks-observability';
import { AppMountParameters, CoreStart } from '@kbn/core/public';

export const renderObservabilityLogExplorerRedirect = (
export const renderObservabilityLogsExplorerRedirect = (
core: CoreStart,
appParams: AppMountParameters
) => {
ReactDOM.render(
<Router history={appParams.history}>
<ObservabilityLogExplorerRedirect core={core} />
<ObservabilityLogsExplorerRedirect core={core} />
</Router>,
appParams.element
);
Expand All @@ -28,7 +28,7 @@ export const renderObservabilityLogExplorerRedirect = (
};
};

export const ObservabilityLogExplorerRedirect = ({ core }: { core: CoreStart }) => {
export const ObservabilityLogsExplorerRedirect = ({ core }: { core: CoreStart }) => {
const location = useLocation();
const path = `${location.pathname}${location.search}`;
core.application.navigateToApp(OBSERVABILITY_LOGS_EXPLORER_APP_ID, { replace: true, path });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,51 @@ import { useActor } from '@xstate/react';
import React, { useMemo } from 'react';
import { discoverLinkTitle } from '../../common/translations';
import {
ObservabilityLogExplorerService,
useObservabilityLogExplorerPageStateContext,
} from '../state_machines/observability_log_explorer/src';
ObservabilityLogsExplorerService,
useObservabilityLogsExplorerPageStateContext,
} from '../state_machines/observability_logs_explorer/src';
import { useKibanaContextForPlugin } from '../utils/use_kibana';

export const ConnectedDiscoverLink = React.memo(() => {
const {
services: { discover },
} = useKibanaContextForPlugin();

const [pageState] = useActor(useObservabilityLogExplorerPageStateContext());
const [pageState] = useActor(useObservabilityLogsExplorerPageStateContext());

if (pageState.matches({ initialized: 'validLogExplorerState' })) {
if (pageState.matches({ initialized: 'validLogsExplorerState' })) {
return <DiscoverLinkForValidState discover={discover} pageState={pageState} />;
} else {
return <DiscoverLinkForUnknownState />;
}
});

type InitializedPageState = MatchedStateFromActor<
ObservabilityLogExplorerService,
{ initialized: 'validLogExplorerState' }
ObservabilityLogsExplorerService,
{ initialized: 'validLogsExplorerState' }
>;

export const DiscoverLinkForValidState = React.memo(
({
discover,
pageState: {
context: { logExplorerState },
context: { logsExplorerState },
},
}: {
discover: DiscoverStart;
pageState: InitializedPageState;
}) => {
const discoverLinkParams = useMemo<DiscoverAppLocatorParams>(
() => ({
breakdownField: logExplorerState.chart.breakdownField ?? undefined,
columns: getDiscoverColumnsFromDisplayOptions(logExplorerState),
filters: getDiscoverFiltersFromState(logExplorerState.filters, logExplorerState.controls),
query: logExplorerState.query,
refreshInterval: logExplorerState.refreshInterval,
timeRange: logExplorerState.time,
dataViewSpec: hydrateDatasetSelection(logExplorerState.datasetSelection).toDataviewSpec(),
breakdownField: logsExplorerState.chart.breakdownField ?? undefined,
columns: getDiscoverColumnsFromDisplayOptions(logsExplorerState),
filters: getDiscoverFiltersFromState(logsExplorerState.filters, logsExplorerState.controls),
query: logsExplorerState.query,
refreshInterval: logsExplorerState.refreshInterval,
timeRange: logsExplorerState.time,
dataViewSpec: hydrateDatasetSelection(logsExplorerState.datasetSelection).toDataviewSpec(),
}),
[logExplorerState]
[logsExplorerState]
);

return <DiscoverLink discover={discover} discoverLinkParams={discoverLinkParams} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ConnectedDiscoverLink } from './discover_link';
import { FeedbackLink } from './feedback_link';
import { ConnectedOnboardingLink } from './onboarding_link';

export const LogExplorerTopNavMenu = () => {
export const LogsExplorerTopNavMenu = () => {
const {
services: { serverless },
} = useKibanaContextForPlugin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { css } from '@emotion/react';
import React from 'react';
import { useKibanaContextForPlugin } from '../utils/use_kibana';

export const ObservabilityLogExplorerPageTemplate = ({
export const ObservabilityLogsExplorerPageTemplate = ({
children,
pageProps,
}: React.PropsWithChildren<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import { PluginInitializerContext } from '@kbn/core/public';
import { ObservabilityLogExplorerConfig } from '../common/plugin_config';
import { ObservabilityLogExplorerPlugin } from './plugin';
import { ObservabilityLogsExplorerConfig } from '../common/plugin_config';
import { ObservabilityLogsExplorerPlugin } from './plugin';

export function plugin(context: PluginInitializerContext<ObservabilityLogExplorerConfig>) {
return new ObservabilityLogExplorerPlugin(context);
export function plugin(context: PluginInitializerContext<ObservabilityLogsExplorerConfig>) {
return new ObservabilityLogsExplorerPlugin(context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import { CreateLogsExplorerController } from '@kbn/logs-explorer-plugin/public';
import { renderFlyoutContent } from './flyout_content';

export const createLogExplorerControllerWithCustomizations =
(createLogExplorerController: CreateLogsExplorerController): CreateLogsExplorerController =>
export const createLogsExplorerControllerWithCustomizations =
(createLogsExplorerController: CreateLogsExplorerController): CreateLogsExplorerController =>
(args) =>
createLogExplorerController({
createLogsExplorerController({
...args,
customizations: {
...args.customizations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,49 @@ import {
ObservabilityLogsExplorerLocators,
SingleDatasetLocatorDefinition,
} from '../common/locators';
import { type ObservabilityLogExplorerConfig } from '../common/plugin_config';
import { logExplorerAppTitle } from '../common/translations';
import { type ObservabilityLogsExplorerConfig } from '../common/plugin_config';
import { logsExplorerAppTitle } from '../common/translations';
import type {
ObservabilityLogExplorerAppMountParameters,
ObservabilityLogExplorerPluginSetup,
ObservabilityLogExplorerPluginStart,
ObservabilityLogExplorerSetupDeps,
ObservabilityLogExplorerStartDeps,
ObservabilityLogsExplorerAppMountParameters,
ObservabilityLogsExplorerPluginSetup,
ObservabilityLogsExplorerPluginStart,
ObservabilityLogsExplorerSetupDeps,
ObservabilityLogsExplorerStartDeps,
} from './types';
export class ObservabilityLogExplorerPlugin
implements Plugin<ObservabilityLogExplorerPluginSetup, ObservabilityLogExplorerPluginStart>
export class ObservabilityLogsExplorerPlugin
implements Plugin<ObservabilityLogsExplorerPluginSetup, ObservabilityLogsExplorerPluginStart>
{
private config: ObservabilityLogExplorerConfig;
private config: ObservabilityLogsExplorerConfig;
private locators?: ObservabilityLogsExplorerLocators;

constructor(context: PluginInitializerContext<ObservabilityLogExplorerConfig>) {
constructor(context: PluginInitializerContext<ObservabilityLogsExplorerConfig>) {
this.config = context.config.get();
}

public setup(
core: CoreSetup<ObservabilityLogExplorerStartDeps, ObservabilityLogExplorerPluginStart>,
_pluginsSetup: ObservabilityLogExplorerSetupDeps
core: CoreSetup<ObservabilityLogsExplorerStartDeps, ObservabilityLogsExplorerPluginStart>,
_pluginsSetup: ObservabilityLogsExplorerSetupDeps
) {
const { share, serverless, discover } = _pluginsSetup;
const useHash = core.uiSettings.get('state:storeInSessionStorage');

core.application.register({
id: OBSERVABILITY_LOGS_EXPLORER_APP_ID,
title: logExplorerAppTitle,
title: logsExplorerAppTitle,
category: DEFAULT_APP_CATEGORIES.observability,
euiIconType: 'logoLogging',
navLinkStatus: this.config.navigation.showAppLink
? AppNavLinkStatus.visible
: AppNavLinkStatus.hidden,
searchable: true,
keywords: ['logs', 'log', 'explorer', 'logs explorer'],
mount: async (appMountParams: ObservabilityLogExplorerAppMountParameters) => {
mount: async (appMountParams: ObservabilityLogsExplorerAppMountParameters) => {
const [coreStart, pluginsStart, ownPluginStart] = await core.getStartServices();
const { renderObservabilityLogExplorer } = await import(
'./applications/observability_log_explorer'
const { renderObservabilityLogsExplorer } = await import(
'./applications/observability_logs_explorer'
);

return renderObservabilityLogExplorer(
return renderObservabilityLogsExplorer(
coreStart,
pluginsStart,
ownPluginStart,
Expand All @@ -74,15 +74,15 @@ export class ObservabilityLogExplorerPlugin
// App used solely to redirect from "/app/observability-log-explorer" to "/app/observability-logs-explorer"
core.application.register({
id: 'observability-log-explorer',
title: logExplorerAppTitle,
title: logsExplorerAppTitle,
navLinkStatus: AppNavLinkStatus.hidden,
mount: async (appMountParams: AppMountParameters) => {
const [coreStart] = await core.getStartServices();
const { renderObservabilityLogExplorerRedirect } = await import(
const { renderObservabilityLogsExplorerRedirect } = await import(
'./applications/redirect_to_observability_logs_explorer'
);

return renderObservabilityLogExplorerRedirect(coreStart, appMountParams);
return renderObservabilityLogsExplorerRedirect(coreStart, appMountParams);
},
});

Expand Down Expand Up @@ -112,7 +112,7 @@ export class ObservabilityLogExplorerPlugin
};
}

public start(_core: CoreStart, _pluginsStart: ObservabilityLogExplorerStartDeps) {
public start(_core: CoreStart, _pluginsStart: ObservabilityLogsExplorerStartDeps) {
return {};
}
}
Loading

0 comments on commit bceeea8

Please sign in to comment.