Skip to content

Commit

Permalink
Merge branch 'fix-ux-app' into ux-performance
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jul 19, 2022
2 parents 162dbdc + 32cd8b1 commit 6b29571
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import { i18n } from '@kbn/i18n';
import React from 'react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { CoreStart } from '@kbn/core/public';
import { ObservabilityPublicPluginsStart } from '../../../..';
import type { AppDataType } from '../../../shared/exploratory_view/types';
import { SectionContainer } from '..';
import { getDataHandler } from '../../../../data_handler';
Expand All @@ -22,24 +24,21 @@ import {
SERVICE_NAME,
TRANSACTION_DURATION,
} from '../../../shared/exploratory_view/configurations/constants/elasticsearch_fieldnames';
import { ObservabilityAppServices } from '../../../../application/types';

interface Props {
bucketSize: BucketSize;
}

export function UXSection({ bucketSize }: Props) {
const { forceUpdate, hasDataMap } = useHasData();
const { services } = useKibana<ObservabilityAppServices>();
const { services } = useKibana<ObservabilityPublicPluginsStart>();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd, lastUpdated } =
useDatePickerContext();
const uxHasDataResponse = hasDataMap.ux;
const serviceName = uxHasDataResponse?.serviceName as string;

const ExploratoryViewEmbeddable = getExploratoryViewEmbeddable(
services.uiSettings,
services.dataViews,
services.lens
services as ObservabilityPublicPluginsStart & CoreStart
);

const seriesList: AllSeries = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ function ExploratoryViewEmbeddable(props: ExploratoryEmbeddableComponentProps) {
}

export function getExploratoryViewEmbeddable(
coreStart: CoreStart,
pluginsStart: ObservabilityPublicPluginsStart
services: CoreStart & ObservabilityPublicPluginsStart
) {
const { lens, dataViews } = pluginsStart;
const { uiSettings } = coreStart;
const { lens, dataViews, uiSettings } = services;

return (props: ExploratoryEmbeddableProps) => {
if (!dataViews || !lens) {
Expand Down Expand Up @@ -84,7 +82,7 @@ export function getExploratoryViewEmbeddable(
return (
<EuiErrorBoundary>
<EuiThemeProvider darkMode={isDarkMode}>
<KibanaContextProvider services={{ ...coreStart, ...pluginsStart }}>
<KibanaContextProvider services={services}>
<ExploratoryViewEmbeddable
{...props}
indexPatterns={indexPatterns}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export class Plugin
},
createExploratoryViewUrl,
getAppDataView: getAppDataView(pluginsStart.dataViews),
ExploratoryViewEmbeddable: getExploratoryViewEmbeddable(coreStart, pluginsStart),
ExploratoryViewEmbeddable: getExploratoryViewEmbeddable({ ...coreStart, ...pluginsStart }),
useRulesLink: createUseRulesLink(),
};
}
Expand Down

0 comments on commit 6b29571

Please sign in to comment.