File tree Expand file tree Collapse file tree
x-pack/plugins/lens/public
editor_frame_service/editor_frame/config_panel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,21 @@ export function LayerSettings({
2626 return null ;
2727 }
2828
29- const a11yText = i18n . translate ( 'xpack.lens.editLayerSettings' , {
30- defaultMessage : 'Edit layer settings' ,
31- } ) ;
29+ const a11yText = ( chartType ?: string ) => {
30+ if ( chartType ) {
31+ return i18n . translate ( 'xpack.lens.editLayerSettingsChartType' , {
32+ defaultMessage : 'Edit layer settings, {chartType}' ,
33+ values : {
34+ chartType,
35+ } ,
36+ } ) ;
37+ }
38+ return i18n . translate ( 'xpack.lens.editLayerSettings' , {
39+ defaultMessage : 'Edit layer settings' ,
40+ } ) ;
41+ } ;
3242
43+ const contextMenuIcon = activeVisualization . getLayerContextMenuIcon ?.( layerConfigProps ) ;
3344 return (
3445 < EuiPopover
3546 id = { `lnsLayerPopover_${ layerId } ` }
@@ -43,9 +54,9 @@ export function LayerSettings({
4354 >
4455 < ToolbarButton
4556 size = "s"
46- iconType = { activeVisualization . getLayerContextMenuIcon ?. ( layerConfigProps ) || 'gear' }
47- aria-label = { a11yText }
48- title = { a11yText }
57+ iconType = { contextMenuIcon ?. icon || 'gear' }
58+ aria-label = { a11yText ( contextMenuIcon ?. label || '' ) }
59+ title = { a11yText ( contextMenuIcon ?. label || '' ) }
4960 onClick = { ( ) => setIsOpen ( ! isOpen ) }
5061 data-test-subj = "lns_layer_settings"
5162 />
Original file line number Diff line number Diff line change @@ -540,7 +540,10 @@ export interface Visualization<T = unknown> {
540540 * Visualizations can provide a custom icon which will open a layer-specific popover
541541 * If no icon is provided, gear icon is default
542542 */
543- getLayerContextMenuIcon ?: ( opts : { state : T ; layerId : string } ) => IconType | undefined ;
543+ getLayerContextMenuIcon ?: ( opts : {
544+ state : T ;
545+ layerId : string ;
546+ } ) => { icon : IconType | 'gear' ; label : string } | undefined ;
544547
545548 /**
546549 * The frame is telling the visualization to update or set a dimension based on user interaction
Original file line number Diff line number Diff line change @@ -300,7 +300,11 @@ export const getXyVisualization = ({
300300
301301 getLayerContextMenuIcon ( { state, layerId } ) {
302302 const layer = state . layers . find ( ( l ) => l . layerId === layerId ) ;
303- return visualizationTypes . find ( ( t ) => t . id === layer ?. seriesType ) ?. icon ;
303+ const visualizationType = visualizationTypes . find ( ( t ) => t . id === layer ?. seriesType ) ;
304+ return {
305+ icon : visualizationType ?. icon || 'gear' ,
306+ label : visualizationType ?. label || '' ,
307+ } ;
304308 } ,
305309
306310 renderLayerContextMenu ( domElement , props ) {
You can’t perform that action at this time.
0 commit comments