-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Fix bug when error page is empty (#102940)
- Loading branch information
Showing
2 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { ComponentType } from 'react'; | ||
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public'; | ||
import { | ||
ApmPluginContext, | ||
ApmPluginContextValue, | ||
} from '../../../../context/apm_plugin/apm_plugin_context'; | ||
import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common'; | ||
import { ErrorDistribution } from './'; | ||
|
||
export default { | ||
title: 'app/ErrorGroupDetails/Distribution', | ||
component: ErrorDistribution, | ||
decorators: [ | ||
(Story: ComponentType) => { | ||
const apmPluginContextMock = ({ | ||
observabilityRuleTypeRegistry: { getFormatter: () => undefined }, | ||
} as unknown) as ApmPluginContextValue; | ||
|
||
const kibanaContextServices = { | ||
uiSettings: { get: () => {} }, | ||
}; | ||
|
||
return ( | ||
<EuiThemeProvider> | ||
<ApmPluginContext.Provider value={apmPluginContextMock}> | ||
<KibanaContextProvider services={kibanaContextServices}> | ||
<Story /> | ||
</KibanaContextProvider> | ||
</ApmPluginContext.Provider> | ||
</EuiThemeProvider> | ||
); | ||
}, | ||
], | ||
}; | ||
|
||
export function Example() { | ||
const distribution = { | ||
noHits: false, | ||
bucketSize: 62350, | ||
buckets: [ | ||
{ key: 1624279912350, count: 6 }, | ||
{ key: 1624279974700, count: 1 }, | ||
{ key: 1624280037050, count: 2 }, | ||
{ key: 1624280099400, count: 3 }, | ||
{ key: 1624280161750, count: 13 }, | ||
{ key: 1624280224100, count: 1 }, | ||
{ key: 1624280286450, count: 2 }, | ||
{ key: 1624280348800, count: 0 }, | ||
{ key: 1624280411150, count: 4 }, | ||
{ key: 1624280473500, count: 4 }, | ||
{ key: 1624280535850, count: 1 }, | ||
{ key: 1624280598200, count: 4 }, | ||
{ key: 1624280660550, count: 0 }, | ||
{ key: 1624280722900, count: 2 }, | ||
{ key: 1624280785250, count: 3 }, | ||
{ key: 1624280847600, count: 0 }, | ||
], | ||
}; | ||
|
||
return <ErrorDistribution distribution={distribution} title="Foo title" />; | ||
} | ||
|
||
export function EmptyState() { | ||
return ( | ||
<ErrorDistribution | ||
distribution={{ | ||
bucketSize: 10, | ||
buckets: [], | ||
noHits: true, | ||
}} | ||
title="Foo title" | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters