-
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.
- Loading branch information
Showing
11 changed files
with
329 additions
and
176 deletions.
There are no files selected for viewing
55 changes: 0 additions & 55 deletions
55
x-pack/plugins/apm/public/components/app/error_group_overview/List/List.test.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
100 changes: 100 additions & 0 deletions
100
.../public/components/app/error_group_overview/error_group_list/error_group_list.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,100 @@ | ||
/* | ||
* 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 { Meta, Story } from '@storybook/react'; | ||
import React, { ComponentProps } from 'react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; | ||
import { MockUrlParamsContextProvider } from '../../../../context/url_params_context/mock_url_params_context_provider'; | ||
|
||
import { ErrorGroupList } from '.'; | ||
|
||
type Args = ComponentProps<typeof ErrorGroupList>; | ||
|
||
const stories: Meta<Args> = { | ||
title: 'app/ErrorGroupOverview/ErrorGroupList', | ||
component: ErrorGroupList, | ||
decorators: [ | ||
(StoryComponent) => { | ||
return ( | ||
<MemoryRouter> | ||
<MockApmPluginContextWrapper> | ||
<MockUrlParamsContextProvider> | ||
<StoryComponent /> | ||
</MockUrlParamsContextProvider> | ||
</MockApmPluginContextWrapper> | ||
</MemoryRouter> | ||
); | ||
}, | ||
], | ||
}; | ||
export default stories; | ||
|
||
export const Example: Story<Args> = (args) => { | ||
return <ErrorGroupList {...args} />; | ||
}; | ||
Example.args = { | ||
items: [ | ||
{ | ||
message: 'net/http: abort Handler', | ||
occurrenceCount: 14, | ||
culprit: 'Main.func2', | ||
groupId: '83a653297ec29afed264d7b60d5cda7b', | ||
latestOccurrenceAt: '2021-10-21T16:18:41.434Z', | ||
handled: false, | ||
type: 'errorString', | ||
}, | ||
{ | ||
message: 'POST /api/orders (500)', | ||
occurrenceCount: 5, | ||
culprit: 'logrusMiddleware', | ||
groupId: '7a640436a9be648fd708703d1ac84650', | ||
latestOccurrenceAt: '2021-10-21T16:18:40.162Z', | ||
handled: false, | ||
type: 'OpError', | ||
}, | ||
{ | ||
message: | ||
'write tcp 10.36.2.24:3000->10.36.1.14:34232: write: connection reset by peer', | ||
occurrenceCount: 4, | ||
culprit: 'apiHandlers.getProductCustomers', | ||
groupId: '95ca0e312c109aa11e298bcf07f1445b', | ||
latestOccurrenceAt: '2021-10-21T16:18:42.650Z', | ||
handled: false, | ||
type: 'OpError', | ||
}, | ||
{ | ||
message: | ||
'write tcp 10.36.0.21:3000->10.36.1.252:57070: write: connection reset by peer', | ||
occurrenceCount: 3, | ||
culprit: 'apiHandlers.getCustomers', | ||
groupId: '4053d7e33d2b716c819bd96d9d6121a2', | ||
latestOccurrenceAt: '2021-10-21T16:07:44.078Z', | ||
handled: false, | ||
type: 'OpError', | ||
}, | ||
{ | ||
message: | ||
'write tcp 10.36.0.21:3000->10.36.0.88:33926: write: broken pipe', | ||
occurrenceCount: 2, | ||
culprit: 'apiHandlers.getOrders', | ||
groupId: '94f4ca8ec8c02e5318cf03f46ae4c1f3', | ||
latestOccurrenceAt: '2021-10-21T16:13:45.742Z', | ||
handled: false, | ||
type: 'OpError', | ||
}, | ||
], | ||
serviceName: 'test service', | ||
}; | ||
|
||
export const EmptyState: Story<Args> = (args) => { | ||
return <ErrorGroupList {...args} />; | ||
}; | ||
EmptyState.args = { | ||
items: [], | ||
serviceName: 'test service', | ||
}; |
19 changes: 19 additions & 0 deletions
19
...apm/public/components/app/error_group_overview/error_group_list/error_group_list.test.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,19 @@ | ||
/* | ||
* 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 { composeStories } from '@storybook/testing-react'; | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import * as stories from './error_group_list.stories'; | ||
|
||
const { Example } = composeStories(stories); | ||
|
||
describe('ErrorGroupList', () => { | ||
it('renders', () => { | ||
expect(() => render(<Example />)).not.toThrowError(); | ||
}); | ||
}); |
File renamed without changes.
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
70 changes: 70 additions & 0 deletions
70
...plugins/apm/public/components/app/service_inventory/service_list/service_list.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,70 @@ | ||
/* | ||
* 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 { Meta, Story } from '@storybook/react'; | ||
import React, { ComponentProps } from 'react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import { CoreStart } from '../../../../../../../../src/core/public'; | ||
import { createKibanaReactContext } from '../../../../../../../../src/plugins/kibana_react/public'; | ||
import { ServiceHealthStatus } from '../../../../../common/service_health_status'; | ||
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context'; | ||
import { items } from './__fixtures__/service_api_mock_data'; | ||
import { ServiceList } from './'; | ||
|
||
type Args = ComponentProps<typeof ServiceList>; | ||
|
||
const KibanaReactContext = createKibanaReactContext({ | ||
notifications: { toasts: { add: () => {} } }, | ||
} as unknown as Partial<CoreStart>); | ||
|
||
const stories: Meta<Args> = { | ||
title: 'app/ServiceInventory/ServiceList', | ||
component: ServiceList, | ||
decorators: [ | ||
(StoryComponent) => { | ||
return ( | ||
<KibanaReactContext.Provider> | ||
<MemoryRouter | ||
initialEntries={['/services?rangeFrom=now-15m&rangeTo=now']} | ||
> | ||
<MockApmPluginContextWrapper> | ||
<StoryComponent />; | ||
</MockApmPluginContextWrapper> | ||
</MemoryRouter> | ||
</KibanaReactContext.Provider> | ||
); | ||
}, | ||
], | ||
}; | ||
export default stories; | ||
|
||
export const Example: Story<Args> = (args) => { | ||
return <ServiceList {...args} />; | ||
}; | ||
Example.args = { | ||
isLoading: false, | ||
items, | ||
}; | ||
|
||
export const EmptyState: Story<Args> = (args) => { | ||
return <ServiceList {...args} />; | ||
}; | ||
EmptyState.args = { | ||
isLoading: false, | ||
items: [], | ||
}; | ||
|
||
export const WithHealthWarnings: Story<Args> = (args) => { | ||
return <ServiceList {...args} />; | ||
}; | ||
WithHealthWarnings.args = { | ||
isLoading: false, | ||
items: items.map((item) => ({ | ||
...item, | ||
healthStatus: ServiceHealthStatus.warning, | ||
})), | ||
}; |
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
Oops, something went wrong.