From 70cb87380d4aa247c33af3ad3bcc49f149d9d3a9 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:50:18 +0100 Subject: [PATCH] UI: Remove unused ErrorIndicator component (#75185) Closes #75068 --- .../components/PanelChrome/ErrorIndicator.tsx | 48 ------------------- .../PanelChrome/PanelChrome.story.tsx | 20 +------- .../src/components/PanelChrome/index.ts | 8 ---- packages/grafana-ui/src/components/index.ts | 2 - 4 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 packages/grafana-ui/src/components/PanelChrome/ErrorIndicator.tsx diff --git a/packages/grafana-ui/src/components/PanelChrome/ErrorIndicator.tsx b/packages/grafana-ui/src/components/PanelChrome/ErrorIndicator.tsx deleted file mode 100644 index d6881ff6ada..00000000000 --- a/packages/grafana-ui/src/components/PanelChrome/ErrorIndicator.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { css, cx } from '@emotion/css'; -import React from 'react'; - -import { useStyles2 } from '../../themes'; -import { commonColorsPalette } from '../../themes/default'; -import { Icon } from '../Icon/Icon'; -import { Tooltip } from '../Tooltip/Tooltip'; - -/** - * @internal - */ -export type ErrorIndicatorProps = { - error?: string; - onClick?: () => void; -}; - -/** - * @internal - */ -export const ErrorIndicator = ({ error, onClick }: ErrorIndicatorProps) => { - const styles = useStyles2(getStyles); - - if (!error) { - return null; - } - - return ( - - - - ); -}; - -const getStyles = () => { - return { - clickable: css({ - cursor: 'pointer', - }), - icon: css({ - color: `${commonColorsPalette.red88}`, - }), - }; -}; diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx index 2b35367de8a..b0ef4858be1 100644 --- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx +++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.story.tsx @@ -186,16 +186,6 @@ export const Examples = () => { menu, loadingState: LoadingState.Loading, })} - {renderPanel('Deprecated error indicator', { - title: 'Default title', - leftItems: [ - , - ], - })} {renderPanel('No padding, deprecated loading indicator', { padding: 'none', title: 'Default title', @@ -359,15 +349,8 @@ const Default: ReactNode = []; const LoadingIcon = [ , ]; -const ErrorIcon = [ - , -]; -const leftItems = { LoadingIcon, ErrorIcon, Default }; +const leftItems = { LoadingIcon, Default }; const description = 'Description text with very long descriptive words that describe what is going on in the panel and not beyond. Or maybe beyond, not up to us.'; @@ -381,7 +364,6 @@ Basic.argTypes = { type: 'select', labels: { LoadingIcon: 'With loading icon', - ErrorIcon: 'With error icon', Default: 'Default (no elements)', }, }, diff --git a/packages/grafana-ui/src/components/PanelChrome/index.ts b/packages/grafana-ui/src/components/PanelChrome/index.ts index 3f7e8845414..92cdb6bd5a7 100644 --- a/packages/grafana-ui/src/components/PanelChrome/index.ts +++ b/packages/grafana-ui/src/components/PanelChrome/index.ts @@ -1,6 +1,5 @@ import React from 'react'; -import { ErrorIndicator } from './ErrorIndicator'; import { LoadingIndicator } from './LoadingIndicator'; import { PanelChrome as PanelChromeComponent, PanelChromeProps } from './PanelChrome'; import { TitleItem } from './TitleItem'; @@ -15,7 +14,6 @@ export type { PanelChromeProps, PanelPadding } from './PanelChrome'; */ export interface PanelChromeType extends React.FC { LoadingIndicator: typeof LoadingIndicator; - ErrorIndicator: typeof ErrorIndicator; TitleItem: typeof TitleItem; } @@ -24,7 +22,6 @@ export interface PanelChromeType extends React.FC { */ export const PanelChrome = PanelChromeComponent as PanelChromeType; PanelChrome.LoadingIndicator = LoadingIndicator; -PanelChrome.ErrorIndicator = ErrorIndicator; PanelChrome.TitleItem = TitleItem; /** @@ -36,11 +33,6 @@ export { type LoadingIndicatorProps as PanelChromeLoadingIndicatorProps, } from './LoadingIndicator'; -export { - ErrorIndicator as PanelChromeErrorIndicator, - type ErrorIndicatorProps as PanelChromeErrorIndicatorProps, -} from './ErrorIndicator'; - export { PanelDescription } from './PanelDescription'; export { usePanelContext, PanelContextProvider, type PanelContext, PanelContextRoot } from './PanelContext'; diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index 107f56f278b..b87920c87e9 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -138,8 +138,6 @@ export { type PanelChromeType, PanelChromeLoadingIndicator, type PanelChromeLoadingIndicatorProps, - PanelChromeErrorIndicator, - type PanelChromeErrorIndicatorProps, PanelContextProvider, type PanelContext, PanelContextRoot,