Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Presentation] Deprecate Solution Toolbar Button in favor of Shared UX Component #126916

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6164988
deprecate
rshen91 Mar 4, 2022
a1b8b49
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 4, 2022
ce333b0
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 7, 2022
5c6cd01
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 9, 2022
cd0b90f
replace the solution toolbar buttons in presentation utils
rshen91 Mar 9, 2022
ed176d8
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
997b379
fix imports for storybook to run
rshen91 Mar 9, 2022
a75f4b9
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 9, 2022
c1755c7
fix errors
rshen91 Mar 9, 2022
5e4ea0c
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
8959416
update requiredPlugins
rshen91 Mar 9, 2022
7054dee
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 9, 2022
a78e943
props in public
rshen91 Mar 9, 2022
a6975c5
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 9, 2022
d565815
fix kibana json
rshen91 Mar 10, 2022
6983822
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 10, 2022
18688d1
clean up
rshen91 Mar 14, 2022
0d32c06
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 14, 2022
52081d2
remove deprecated from public index
rshen91 Mar 14, 2022
46c79b0
remove icon side
rshen91 Mar 15, 2022
93b5a22
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 15, 2022
e414da2
refactor
rshen91 Mar 15, 2022
17d8b8e
change tsconfig
rshen91 Mar 15, 2022
d4e7ea9
fix spelling
rshen91 Mar 15, 2022
ccdfdb5
remove icon side
rshen91 Mar 15, 2022
8678625
Merge branch 'main' into deprecate-solution-toolbar-button
rshen91 Mar 15, 2022
49b35eb
Merge remote-tracking branch 'upstream/main' into deprecate-solution-…
rshen91 Mar 16, 2022
b60cb4d
Merge remote-tracking branch 'origin/deprecate-solution-toolbar-butto…
rshen91 Mar 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/plugins/presentation_util/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"extraPublicDirs": ["common/lib"],
"requiredPlugins": ["savedObjects", "kibanaReact", "embeddable", "expressions", "dataViews"],
"extraPublicDirs": [
"common/lib"
],
"requiredPlugins": [
"savedObjects",
"kibanaReact",
"embeddable",
"expressions",
"dataViews",
"sharedUx"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin's name is sharedUX; I think that's why the build went crazy.

],
"optionalPlugins": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import React from 'react';
import { ComponentStrings } from '../../../i18n/components';
import { SolutionToolbarButton, Props as SolutionToolbarButtonProps } from './button';
import { SolutionToolbarButton, SolutionToolbarButtonProps } from '../../../../../shared_ux/public';

const { SolutionToolbar: strings } = ComponentStrings;

export type Props = Omit<SolutionToolbarButtonProps, 'iconType' | 'label'>;
export type Props = Omit<typeof SolutionToolbarButtonProps, 'iconType' | 'label'>;

export const AddFromLibraryButton = ({ onClick, ...rest }: Props) => (
<SolutionToolbarButton
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
* Side Public License, v 1.
*/

export { SolutionToolbarButton } from './button';
export { SolutionToolbarPopover } from './popover';
export { AddFromLibraryButton } from './add_from_library';
export type { QuickButtonProps } from './quick_group';
export { QuickButtonGroup } from './quick_group';
export { PrimaryActionButton } from './primary_button';
export { PrimaryActionPopover } from './primary_popover';
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import React, { useState } from 'react';
import { EuiPopover } from '@elastic/eui';
import { Props as EuiPopoverProps } from '@elastic/eui/src/components/popover/popover';
import {
SolutionToolbarButton,
SolutionToolbarButtonProps as ButtonProps,
} from '../../../../../shared_ux/public/index';
rshen91 marked this conversation as resolved.
Show resolved Hide resolved

import { SolutionToolbarButton, Props as ButtonProps } from './button';

type AllowedButtonProps = Omit<ButtonProps, 'onClick' | 'fill'>;
type AllowedButtonProps = Omit<typeof ButtonProps, 'onClick' | 'fill'>;
type AllowedPopoverProps = Omit<
EuiPopoverProps,
'button' | 'isOpen' | 'closePopover' | 'anchorPosition'
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { Story } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { EuiContextMenu } from '@elastic/eui';

import { SolutionToolbarButton as PrimaryActionButton } from '../../../../shared_ux/public';
import { SolutionToolbar } from './solution_toolbar';
import { SolutionToolbarPopover } from './items';
import { AddFromLibraryButton, PrimaryActionButton, QuickButtonGroup } from './items';
import { AddFromLibraryButton, QuickButtonGroup } from './items';

const quickButtons = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

import React, { ReactElement } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { SolutionToolbarButton } from 'src/plugins/shared_ux/public';
spalger marked this conversation as resolved.
Show resolved Hide resolved

import { SolutionToolbarButton as PrimaryActionButton } from '../../../../shared_ux/public';

import {
AddFromLibraryButton,
QuickButtonGroup,
PrimaryActionButton,
SolutionToolbarButton,
PrimaryActionPopover,
SolutionToolbarPopover,
} from './items';
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/presentation_util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
{ "path": "../saved_objects/tsconfig.json" },
{ "path": "../embeddable/tsconfig.json" },
{ "path": "../kibana_react/tsconfig.json" },
{ "path": "../data/tsconfig.json" }
{ "path": "../data/tsconfig.json" },
{ "path": "../shared_ux/tsconfig.json" }
rshen91 marked this conversation as resolved.
Show resolved Hide resolved
]
}
8 changes: 8 additions & 0 deletions src/plugins/shared_ux/public/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export const LazySolutionToolbarButton = React.lazy(() =>
}))
);

export const LazySolutionToolbarButtonProps = React.lazy(() =>
import('./toolbar/index').then(({ SolutionToolbarButtonProps }: any) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things: first, this should exist.

LazySolutionToolbarButtonProps is a Typescript interface, so there's no lazy load necessary-- types are removed at compile time.

Second, as @majagrubic pointed out: no need to tack /index onto this import.

default: SolutionToolbarButtonProps,
}))
);

/**
* A `ExitFullScreenButton` component that is wrapped by the `withSuspense` HOC. This component can
* be used directly by consumers and will load the `LazyExitFullScreenButton` component lazily with
Expand All @@ -39,6 +45,8 @@ export const ExitFullScreenButton = withSuspense(LazyExitFullScreenButton);
*/
export const SolutionToolbarButton = withSuspense(LazySolutionToolbarButton);

export const SolutionToolbarButtonProps = withSuspense(LazySolutionToolbarButtonProps);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const SolutionToolbarButtonProps = withSuspense(LazySolutionToolbarButtonProps);


/**
* The Lazily-loaded `NoDataViews` component. Consumers should use `React.Suspennse` or the
* `withSuspense` HOC to load this component.
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/shared_ux/public/components/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
* Side Public License, v 1.
*/

export { SolutionToolbarButton } from './solution_toolbar/button/primary';
export {
SolutionToolbarButton,
SolutionToolbarButtonProps,
} from './solution_toolbar/button/primary';
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import React from 'react';
import { EuiButton } from '@elastic/eui';
import { EuiButtonPropsForButton } from '@elastic/eui/src/components/button/button';

export interface Props extends Pick<EuiButtonPropsForButton, 'onClick' | 'iconType'> {
export interface SolutionToolbarButtonProps
extends Pick<EuiButtonPropsForButton, 'onClick' | 'iconType'> {
label: string;
}

export const SolutionToolbarButton = ({ label, ...rest }: Props) => {
export const SolutionToolbarButton = ({ label, ...rest }: SolutionToolbarButtonProps) => {
return (
<EuiButton size="m" color="primary" fill={true} {...rest}>
{label}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/shared_ux/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export function plugin() {
export type { SharedUXPluginSetup, SharedUXPluginStart } from './types';
export { ExitFullScreenButton, LazyExitFullScreenButton } from './components';
export { NoDataViewsPage, LazyNoDataViewsPage } from './components';
export { SolutionToolbarButton, SolutionToolbarButtonProps } from './components';