Skip to content

Commit cdfc5cc

Browse files
[Canvas][tech-debt] Refactor Toolbar (completes Kill Recompose.pure) (#73309)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent e9c01e9 commit cdfc5cc

14 files changed

Lines changed: 372 additions & 180 deletions

File tree

x-pack/plugins/canvas/i18n/components.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,13 @@ export const ComponentStrings = {
913913
i18n.translate('xpack.canvas.toolbar.workpadManagerCloseButtonLabel', {
914914
defaultMessage: 'Close',
915915
}),
916+
getErrorMessage: (message: string) =>
917+
i18n.translate('xpack.canvas.toolbar.errorMessage', {
918+
defaultMessage: 'TOOLBAR ERROR: {message}',
919+
values: {
920+
message,
921+
},
922+
}),
916923
},
917924
ToolbarTray: {
918925
getCloseTrayAriaLabel: () =>

x-pack/plugins/canvas/public/components/navbar/navbar.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

x-pack/plugins/canvas/public/components/navbar/navbar.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

x-pack/plugins/canvas/public/components/toolbar/__examples__/__snapshots__/toolbar.stories.storyshot

Lines changed: 229 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/canvas/public/components/toolbar/__examples__/toolbar.stories.tsx

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,30 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
/*
8-
TODO: uncomment and fix this test to address storybook errors as a result of nested component dependencies - https://github.com/elastic/kibana/issues/58289
9-
*/
10-
11-
/*
12-
import { action } from '@storybook/addon-actions';
137
import { storiesOf } from '@storybook/react';
148
import React from 'react';
15-
import { Toolbar } from '../toolbar';
9+
import { Toolbar } from '../toolbar.component';
10+
11+
// @ts-expect-error untyped local
12+
import { getDefaultElement } from '../../../state/defaults';
1613

1714
storiesOf('components/Toolbar', module)
18-
.addDecorator(story => (
19-
<div
20-
style={{
21-
width: '200px',
22-
}}
23-
>
24-
{story()}
25-
</div>
26-
))
27-
.add('with null metric', () => (
15+
.add('no element selected', () => (
2816
<Toolbar
29-
setTray={action('setTray')}
30-
nextPage={action('nextPage')}
31-
previousPage={action('previousPage')}
32-
setShowWorkpadManager={action('setShowWorkpadManager')}
17+
isWriteable={true}
3318
selectedPageNumber={1}
3419
totalPages={1}
35-
showWorkpadManager={false}
20+
workpadId={'abc'}
21+
workpadName={'My Canvas Workpad'}
22+
/>
23+
))
24+
.add('element selected', () => (
25+
<Toolbar
3626
isWriteable={true}
27+
selectedElement={getDefaultElement()}
28+
selectedPageNumber={1}
29+
totalPages={1}
30+
workpadId={'abc'}
31+
workpadName={'My Canvas Workpad'}
3732
/>
3833
));
39-
*/

x-pack/plugins/canvas/public/components/toolbar/index.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

x-pack/plugins/canvas/public/components/navbar/index.js renamed to x-pack/plugins/canvas/public/components/toolbar/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { pure } from 'recompose';
8-
import { Navbar as Component } from './navbar';
9-
10-
export const Navbar = pure(Component);
7+
export { Toolbar } from './toolbar';
8+
export { Toolbar as ToolbarComponent } from './toolbar.component';

0 commit comments

Comments
 (0)