Skip to content

Commit

Permalink
Remove isDeprecated flag on visType (elastic#78820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Roes authored and timroes committed Sep 30, 2020
1 parent 25587f4 commit db413cf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/plugins/region_map/public/region_map_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export function createRegionMapTypeDefinition(dependencies) {

return {
name: 'region_map',
isDeprecated: true,
getDeprecationMessage,
title: i18n.translate('regionMap.mapVis.regionMapTitle', { defaultMessage: 'Region Map' }),
description: i18n.translate('regionMap.mapVis.regionMapDescription', {
Expand Down
1 change: 0 additions & 1 deletion src/plugins/tile_map/public/tile_map_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function createTileMapTypeDefinition(dependencies) {

return {
name: 'tile_map',
isDeprecated: true,
getDeprecationMessage,
title: i18n.translate('tileMap.vis.mapTitle', {
defaultMessage: 'Coordinate Map',
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/visualizations/public/vis_types/base_vis_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface CommonBaseVisTypeOptions {
useCustomNoDataScreen?: boolean;
inspectorAdapters?: Adapters | (() => Adapters);
isDeprecated?: boolean;
getDeprecationMessage?: (vis: Vis) => ReactElement<any>;
getDeprecationMessage?: (vis: Vis) => ReactElement<{}>;
}

interface ExpressionBaseVisTypeOptions<TVisParams> extends CommonBaseVisTypeOptions {
Expand Down Expand Up @@ -84,8 +84,7 @@ export class BaseVisType<TVisParams = VisParams> {
useCustomNoDataScreen: boolean;
inspectorAdapters?: Adapters | (() => Adapters);
toExpressionAst?: VisToExpressionAst<TVisParams>;
isDeprecated: boolean;
getDeprecationMessage?: (vis: Vis) => ReactElement<any>;
getDeprecationMessage?: (vis: Vis) => ReactElement<{}>;

constructor(opts: BaseVisTypeOptions<TVisParams>) {
if (!opts.icon && !opts.image) {
Expand Down Expand Up @@ -123,7 +122,6 @@ export class BaseVisType<TVisParams = VisParams> {
this.useCustomNoDataScreen = opts.useCustomNoDataScreen || false;
this.inspectorAdapters = opts.inspectorAdapters;
this.toExpressionAst = opts.toExpressionAst;
this.isDeprecated = opts.isDeprecated || false;
this.getDeprecationMessage = opts.getDeprecationMessage;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,29 @@ export const VisualizeEditorCommon = ({
/>
)}
{visInstance?.vis?.type?.isExperimental && <ExperimentalVisInfo />}
{visInstance?.vis?.type?.isDeprecated &&
visInstance?.vis?.type?.getDeprecationMessage &&
visInstance.vis.type.getDeprecationMessage(visInstance?.vis)}
{visInstance?.vis?.type?.getDeprecationMessage?.(visInstance.vis)}
{visInstance && (
<EuiScreenReaderOnly>
<h1>
{
// @ts-expect-error
'savedVis' in visInstance && visInstance.savedVis.id ? (
<FormattedMessage
id="visualize.pageHeading"
defaultMessage="{chartName} {chartType} visualization"
values={{
chartName: (visInstance as SavedVisInstance).savedVis.title,
chartType: (visInstance as SavedVisInstance).vis.type.title,
}}
/>
) : (
<FormattedMessage
id="visualize.byValue_pageHeading"
defaultMessage="Visualization of type {chartType} embedded into {originatingApp} app"
values={{
chartType: visInstance.vis.type.title,
originatingApp: originatingApp || 'dashboards',
}}
/>
)
}
{'savedVis' in visInstance && visInstance.savedVis.id ? (
<FormattedMessage
id="visualize.pageHeading"
defaultMessage="{chartName} {chartType} visualization"
values={{
chartName: (visInstance as SavedVisInstance).savedVis.title,
chartType: (visInstance as SavedVisInstance).vis.type.title,
}}
/>
) : (
<FormattedMessage
id="visualize.byValue_pageHeading"
defaultMessage="Visualization of type {chartType} embedded into {originatingApp} app"
values={{
chartType: visInstance.vis.type.title,
originatingApp: originatingApp || 'dashboards',
}}
/>
)}
</h1>
</EuiScreenReaderOnly>
)}
Expand Down

0 comments on commit db413cf

Please sign in to comment.