Skip to content
/ kibana Public
forked from elastic/kibana

Commit

Permalink
[APM] Storybook theme fixes (elastic#69730)
Browse files Browse the repository at this point in the history
* [APM] Storybook theme fixes

The changes adding theme support in elastic#69362 broke some of the Storybook stories.

Add decorators to wrap some of the stories in the theme context.

This should be done in a global decorator, but our current storybook setup doesn't support this. It also would be nice to be able to switch between light/dark mode, but that's something we can add in the future.

* Remove unused import

* Adds missing decorator to cytoscape examples + adds a new real-world example

Co-authored-by: Oliver Gupte <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
3 people committed Jun 24, 2020
1 parent 94e1b57 commit fbab7af
Show file tree
Hide file tree
Showing 4 changed files with 2,434 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,63 @@ import cytoscape from 'cytoscape';
import React from 'react';
import { Cytoscape } from '../Cytoscape';
import { iconForNode } from '../icons';
import { EuiThemeProvider } from '../../../../../../observability/public';

storiesOf('app/ServiceMap/Cytoscape', module).add(
'example',
() => {
const elements: cytoscape.ElementDefinition[] = [
{
data: {
id: 'opbeans-python',
'service.name': 'opbeans-python',
'agent.name': 'python',
},
},
{
data: {
id: 'opbeans-node',
'service.name': 'opbeans-node',
'agent.name': 'nodejs',
},
},
{
data: {
id: 'opbeans-ruby',
'service.name': 'opbeans-ruby',
'agent.name': 'ruby',
},
},
{ data: { source: 'opbeans-python', target: 'opbeans-node' } },
{
data: {
bidirectional: true,
source: 'opbeans-python',
target: 'opbeans-ruby',
},
},
];
const height = 300;
const width = 1340;
const serviceName = 'opbeans-python';
return (
<Cytoscape
elements={elements}
height={height}
width={width}
serviceName={serviceName}
/>
);
},
{
info: {
propTables: false,
source: false,
storiesOf('app/ServiceMap/Cytoscape', module)
.addDecorator((storyFn) => <EuiThemeProvider>{storyFn()}</EuiThemeProvider>)
.add(
'example',
() => {
const elements: cytoscape.ElementDefinition[] = [
{
data: {
id: 'opbeans-python',
'service.name': 'opbeans-python',
'agent.name': 'python',
},
},
{
data: {
id: 'opbeans-node',
'service.name': 'opbeans-node',
'agent.name': 'nodejs',
},
},
{
data: {
id: 'opbeans-ruby',
'service.name': 'opbeans-ruby',
'agent.name': 'ruby',
},
},
{ data: { source: 'opbeans-python', target: 'opbeans-node' } },
{
data: {
bidirectional: true,
source: 'opbeans-python',
target: 'opbeans-ruby',
},
},
];
const height = 300;
const width = 1340;
const serviceName = 'opbeans-python';
return (
<Cytoscape
elements={elements}
height={height}
width={width}
serviceName={serviceName}
/>
);
},
}
);
{
info: {
propTables: false,
source: false,
},
}
);

storiesOf('app/ServiceMap/Cytoscape', module).add(
'node icons',
Expand Down
Loading

0 comments on commit fbab7af

Please sign in to comment.