Remove legacyIcon from visualizations (#28981)

This commit is contained in:
Tim Roes 2019-01-21 09:07:17 +01:00 committed by GitHub
parent b2f1cc4d25
commit 6c47f10a3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 25 deletions

View file

@ -55,7 +55,6 @@ The list of common parameters:
- *title*: title of your visualization as displayed in kibana
- *icon*: <string> the https://elastic.github.io/eui/#/display/icons[EUI icon] type to use for this visualization
- *image*: instead of an icon you can provide a SVG image (imported)
- *legacyIcon*: (DEPRECATED) <string> provide a class name (e.g. for a font awesome icon)
- *description*: description of your visualization as shown in kibana
- *hidden*: <bool> if set to true, will hide the type from showing up in the visualization wizard
- *visConfig*: object holding visualization parameters

View file

@ -153,20 +153,12 @@ class VisualizeListingTableUi extends Component {
src={item.type.image}
/>
);
} else if (!item.type.image && !item.type.icon) {
icon = (
// Allowing legacyIcon to hold a CSS name, will be removed in 7.0
<span
aria-hidden="true"
className={`kuiStatusText__icon kuiIcon ${item.type.legacyIcon}`}
/>
);
} else {
icon = (
<EuiIcon
className="visListingTable__typeIcon"
aria-hidden="true"
type={item.icon}
type={item.icon || 'empty'}
size="m"
/>
);

View file

@ -66,11 +66,6 @@
pointer-events: none;
}
.visNewVisDialog__typeLegacyIcon {
font-size: $euiSizeL;
color: $euiColorSecondary;
}
.visNewVisDialog__typeImage {
@include size($euiSizeL);
}

View file

@ -18,7 +18,6 @@
*/
import { EuiIcon } from '@elastic/eui';
import classnames from 'classnames';
import React from 'react';
import { VisType } from 'ui/vis';
@ -30,15 +29,9 @@ interface VisTypeIconProps {
* This renders the icon for a specific visualization type.
* This currently checks the following:
* - If visType.image is set, use that as the `src` of an image
* - If legacyIcon is set, use that as a classname for a span with kuiIcon (to be removed in 7.0)
* - Otherwise use the visType.icon as an EuiIcon or the 'empty' icon if that's not set
*/
export const VisTypeIcon = ({ visType }: VisTypeIconProps) => {
const legacyIconClass = classnames(
'kuiIcon',
'visNewVisDialog__typeLegacyIcon',
visType.legacyIcon
);
return (
<React.Fragment>
{visType.image && (
@ -50,8 +43,7 @@ export const VisTypeIcon = ({ visType }: VisTypeIconProps) => {
className="visNewVisDialog__typeImage"
/>
)}
{!visType.image && visType.legacyIcon && <span className={legacyIconClass} />}
{!visType.image && !visType.legacyIcon && (
{!visType.image && (
<EuiIcon type={visType.icon || 'empty'} size="l" color="secondary" aria-hidden="true" />
)}
</React.Fragment>

View file

@ -35,7 +35,7 @@ export function BaseVisTypeProvider(Private) {
if (!opts.description) {
throw('vis_type must define its description');
}
if (!opts.icon && !opts.image && !opts.legacyIcon) {
if (!opts.icon && !opts.image) {
throw('vis_type must define its icon or image');
}
if (!opts.visualization) {