Skip to content

Commit

Permalink
Closes #85549 by always rendering the datepicker regardless of data (#…
Browse files Browse the repository at this point in the history
…87393)

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
ogupte and kibanamachine authored Jan 6, 2021
1 parent 450d297 commit a9820a5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { render } from '@testing-library/react';
import { createMemoryHistory } from 'history';
import { CoreStart } from 'kibana/public';
import React, { ReactNode } from 'react';
import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
Expand All @@ -15,6 +16,10 @@ import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_ap
import { LicenseContext } from '../../../context/license/license_context';
import * as useFetcherModule from '../../../hooks/use_fetcher';
import { ServiceMap } from './';
import { UrlParamsProvider } from '../../../context/url_params_context/url_params_context';
import { Router } from 'react-router-dom';

const history = createMemoryHistory();

const KibanaReactContext = createKibanaReactContext({
usageCollection: { reportUiCounter: () => {} },
Expand Down Expand Up @@ -49,7 +54,9 @@ function createWrapper(license: License | null) {
<KibanaReactContext.Provider>
<LicenseContext.Provider value={license || undefined}>
<MockApmPluginContextWrapper>
{children}
<Router history={history}>
<UrlParamsProvider>{children}</UrlParamsProvider>
</Router>
</MockApmPluginContextWrapper>
</LicenseContext.Provider>
</KibanaReactContext.Provider>
Expand Down
43 changes: 26 additions & 17 deletions x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,34 @@ const ServiceMapDatePickerFlexGroup = styled(EuiFlexGroup)`
margin: 0;
`;

function DatePickerSection() {
return (
<ServiceMapDatePickerFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<DatePicker />
</EuiFlexItem>
</ServiceMapDatePickerFlexGroup>
);
}

function PromptContainer({ children }: { children: ReactNode }) {
return (
<EuiFlexGroup
alignItems="center"
justifyContent="spaceAround"
// Set the height to give it some top margin
style={{ height: '60vh' }}
>
<EuiFlexItem
grow={false}
style={{ width: 600, textAlign: 'center' as const }}
<>
<DatePickerSection />
<EuiFlexGroup
alignItems="center"
justifyContent="spaceAround"
// Set the height to give it some top margin
style={{ height: '60vh' }}
>
{children}
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexItem
grow={false}
style={{ width: 600, textAlign: 'center' as const }}
>
{children}
</EuiFlexItem>
</EuiFlexGroup>
</>
);
}

Expand Down Expand Up @@ -137,11 +150,7 @@ export function ServiceMap({

return (
<>
<ServiceMapDatePickerFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<DatePicker />
</EuiFlexItem>
</ServiceMapDatePickerFlexGroup>
<DatePickerSection />
<div data-test-subj="ServiceMap" style={{ height }} ref={ref}>
<Cytoscape
elements={data.elements}
Expand Down

0 comments on commit a9820a5

Please sign in to comment.