Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions src/plugins/vis_type_table/public/table_vis_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { tableVisResponseHandler } from './table_vis_response_handler';
import tableVisTemplate from './table_vis.html';
import { TableOptions } from './components/table_vis_options_lazy';
import { getTableVisualizationControllerClass } from './vis_controller';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export function getTableVisTypeDefinition(core: CoreSetup, context: PluginInitializerContext) {
return {
Expand All @@ -39,6 +40,9 @@ export function getTableVisTypeDefinition(core: CoreSetup, context: PluginInitia
defaultMessage: 'Display values in a table',
}),
visualization: getTableVisualizationControllerClass(core, context),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter];
},
visConfig: {
defaults: {
perPage: 10,
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { i18n } from '@kbn/i18n';
import { Schemas } from '../../vis_default_editor/public';

import { TagCloudOptions } from './components/tag_cloud_options';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

// @ts-ignore
import { createTagCloudVisualization } from './components/tag_cloud_visualization';
Expand All @@ -31,6 +32,9 @@ export const createTagCloudVisTypeDefinition = (deps: TagCloudVisDependencies) =
name: 'tagcloud',
title: i18n.translate('visTypeTagCloud.vis.tagCloudTitle', { defaultMessage: 'Tag Cloud' }),
icon: 'visTagCloud',
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter];
},
description: i18n.translate('visTypeTagCloud.vis.tagCloudDescription', {
defaultMessage: 'A group of words, sized according to their importance',
}),
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { getAreaOptionTabs, countLabel } from './utils/common_config';
import { createVislibVisController } from './vis_controller';
import { VisTypeVislibDependencies } from './plugin';
import { Rotates } from '../../charts/public';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export const createAreaVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({
name: 'area',
Expand All @@ -49,6 +50,9 @@ export const createAreaVisTypeDefinition = (deps: VisTypeVislibDependencies) =>
defaultMessage: 'Emphasize the quantity beneath a line chart',
}),
visualization: createVislibVisController(deps),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
},
visConfig: {
defaults: {
type: 'area',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { TimeMarker } from './vislib/visualizations/time_marker';
import { CommonVislibParams, ValueAxis } from './types';
import { VisTypeVislibDependencies } from './plugin';
import { ColorSchemas, ColorSchemaParams } from '../../charts/public';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaParams {
type: 'heatmap';
Expand All @@ -48,6 +49,9 @@ export const createHeatmapVisTypeDefinition = (deps: VisTypeVislibDependencies)
description: i18n.translate('visTypeVislib.heatmap.heatmapDescription', {
defaultMessage: 'Shade cells within a matrix',
}),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter];
},
visualization: createVislibVisController(deps),
visConfig: {
defaults: {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { getAreaOptionTabs, countLabel } from './utils/common_config';
import { createVislibVisController } from './vis_controller';
import { VisTypeVislibDependencies } from './plugin';
import { Rotates } from '../../charts/public';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export const createHistogramVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({
name: 'histogram',
Expand All @@ -50,6 +51,9 @@ export const createHistogramVisTypeDefinition = (deps: VisTypeVislibDependencies
defaultMessage: 'Assign a continuous variable to each axis',
}),
visualization: createVislibVisController(deps),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
},
visConfig: {
defaults: {
type: 'histogram',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/horizontal_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { getAreaOptionTabs, countLabel } from './utils/common_config';
import { createVislibVisController } from './vis_controller';
import { VisTypeVislibDependencies } from './plugin';
import { Rotates } from '../../charts/public';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export const createHorizontalBarVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({
name: 'horizontal_bar',
Expand All @@ -48,6 +49,9 @@ export const createHorizontalBarVisTypeDefinition = (deps: VisTypeVislibDependen
defaultMessage: 'Assign a continuous variable to each axis',
}),
visualization: createVislibVisController(deps),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
},
visConfig: {
defaults: {
type: 'histogram',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { getAreaOptionTabs, countLabel } from './utils/common_config';
import { createVislibVisController } from './vis_controller';
import { VisTypeVislibDependencies } from './plugin';
import { Rotates } from '../../charts/public';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export const createLineVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({
name: 'line',
Expand All @@ -47,6 +48,9 @@ export const createLineVisTypeDefinition = (deps: VisTypeVislibDependencies) =>
defaultMessage: 'Emphasize trends',
}),
visualization: createVislibVisController(deps),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter, VIS_EVENT_TO_TRIGGER.brush];
},
visConfig: {
defaults: {
type: 'line',
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/vis_type_vislib/public/pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getPositions, Positions } from './utils/collections';
import { createVislibVisController } from './vis_controller';
import { CommonVislibParams } from './types';
import { VisTypeVislibDependencies } from './plugin';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';

export interface PieVisParams extends CommonVislibParams {
type: 'pie';
Expand All @@ -47,6 +48,9 @@ export const createPieVisTypeDefinition = (deps: VisTypeVislibDependencies) => (
defaultMessage: 'Compare parts of a whole',
}),
visualization: createVislibVisController(deps),
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.filter];
},
visConfig: {
defaults: {
type: 'pie',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,29 +377,6 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
};

public supportedTriggers() {
// TODO: Report a correct list of triggers for each vis_type.
switch (this.vis.type.name) {
case 'area':
case 'heatmap':
case 'histogram':
case 'horizontal_bar':
case 'line':
case 'pie':
case 'table':
case 'tagcloud':
return [VIS_EVENT_TO_TRIGGER.filter];
case 'gauge':
case 'goal':
case 'input_control_vis':
case 'markdown':
case 'metric':
case 'metrics':
case 'region_map':
case 'tile_map':
case 'timelion':
case 'vega':
default:
return [];
}
return this.vis.type.getSupportedTriggers?.() ?? [];
}
}
4 changes: 4 additions & 0 deletions src/plugins/visualizations/public/vis_types/base_vis_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

import _ from 'lodash';
import { VisualizationControllerConstructor } from '../types';
import { TriggerContextMapping } from '../../../ui_actions/public';

export interface BaseVisTypeOptions {
name: string;
title: string;
description?: string;
getSupportedTriggers?: () => Array<keyof TriggerContextMapping>;
icon?: string;
image?: string;
stage?: 'experimental' | 'beta' | 'production';
Expand All @@ -44,6 +46,7 @@ export class BaseVisType {
name: string;
title: string;
description: string;
getSupportedTriggers?: () => Array<keyof TriggerContextMapping>;
icon?: string;
image?: string;
stage: 'experimental' | 'beta' | 'production';
Expand Down Expand Up @@ -77,6 +80,7 @@ export class BaseVisType {

this.name = opts.name;
this.description = opts.description || '';
this.getSupportedTriggers = opts.getSupportedTriggers;
this.title = opts.title;
this.icon = opts.icon;
this.image = opts.image;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualizations/public/vis_types/types_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import { visTypeAliasRegistry, VisTypeAlias } from './vis_type_alias_registry';
import { BaseVisType } from './base_vis_type';
// @ts-ignore
import { ReactVisType } from './react_vis_type';
import { TriggerContextMapping } from '../../../ui_actions/public';

export interface VisType {
name: string;
title: string;
description?: string;
getSupportedTriggers?: () => Array<keyof TriggerContextMapping>;
visualization: any;
isAccessible?: boolean;
requestHandler: string | unknown;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { TriggerContextMapping } from '../../../ui_actions/public';

export interface VisualizationListItem {
editUrl: string;
Expand All @@ -26,6 +27,7 @@ export interface VisualizationListItem {
savedObjectType: string;
title: string;
description?: string;
getSupportedTriggers?: () => Array<keyof TriggerContextMapping>;
typeTitle: string;
image?: string;
}
Expand Down Expand Up @@ -53,6 +55,7 @@ export interface VisTypeAlias {
icon: string;
promotion?: VisTypeAliasPromotion;
description: string;
getSupportedTriggers?: () => Array<keyof TriggerContextMapping>;
stage: 'experimental' | 'beta' | 'production';

appExtensions?: {
Expand Down