mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Canvas: Hide background image size editor options for SVG based elements (#85419)
This commit is contained in:
parent
a360cf0c85
commit
b47f8b429e
@ -20,7 +20,7 @@ import { Scene } from './scene';
|
||||
|
||||
let counter = 0;
|
||||
|
||||
const SVGElements = new Set<string>(['parallelogram', 'triangle', 'cloud', 'ellipse']);
|
||||
export const SVGElements = new Set<string>(['parallelogram', 'triangle', 'cloud', 'ellipse']);
|
||||
|
||||
export class ElementState implements LayerElement {
|
||||
// UID necessary for moveable to work (for now)
|
||||
|
@ -2,6 +2,7 @@ import { capitalize } from 'lodash';
|
||||
|
||||
import { PanelOptionsSupplier } from '@grafana/data/src/panel/PanelPlugin';
|
||||
import { CanvasConnection, CanvasElementOptions, ConnectionDirection } from 'app/features/canvas';
|
||||
import { SVGElements } from 'app/features/canvas/runtime/element';
|
||||
import { ColorDimensionEditor, ResourceDimensionEditor, ScaleDimensionEditor } from 'app/features/dimensions/editors';
|
||||
import { BackgroundSizeEditor } from 'app/features/dimensions/editors/BackgroundSizeEditor';
|
||||
|
||||
@ -61,6 +62,15 @@ export const optionBuilder: OptionSuppliers = {
|
||||
settings: {
|
||||
resourceType: 'image',
|
||||
},
|
||||
showIf: () => {
|
||||
// Do not show image size editor for SVG based elements
|
||||
// See https://github.com/grafana/grafana/issues/84843#issuecomment-2010921066 for additional context
|
||||
if (context.options?.type) {
|
||||
return !SVGElements.has(context.options.type);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user