mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix to geomap editor crash (#48786)
This commit is contained in:
@@ -16,7 +16,7 @@ type LayerDragDropListProps<T extends LayerElement> = {
|
||||
onSelect: (element: T) => any;
|
||||
onDelete: (element: T) => any;
|
||||
onDuplicate?: (element: T) => any;
|
||||
isFrame?: (element: T) => boolean;
|
||||
isFrame: (element: T) => boolean;
|
||||
selection?: string[]; // list of unique ids (names)
|
||||
excludeBaseLayer?: boolean;
|
||||
onNameChange: (element: T, newName: string) => any;
|
||||
@@ -74,7 +74,7 @@ export const LayerDragDropList = <T extends LayerElement>({
|
||||
/>
|
||||
<div className={style.textWrapper}> {getLayerInfo(element)}</div>
|
||||
|
||||
{!isFrame!(element) && (
|
||||
{isFrame(element) && (
|
||||
<>
|
||||
{onDuplicate ? (
|
||||
<IconButton
|
||||
|
||||
@@ -5,6 +5,7 @@ import { StandardEditorProps } from '@grafana/data';
|
||||
import { Container } from '@grafana/ui';
|
||||
import { AddLayerButton } from 'app/core/components/Layers/AddLayerButton';
|
||||
import { LayerDragDropList } from 'app/core/components/Layers/LayerDragDropList';
|
||||
import { FrameState } from 'app/features/canvas/runtime/frame';
|
||||
|
||||
import { GeomapInstanceState } from '../GeomapPanel';
|
||||
import { geomapLayerRegistry } from '../layers/registry';
|
||||
@@ -54,6 +55,10 @@ export const LayersEditor = (props: LayersEditorProps) => {
|
||||
element.onChange({ ...element.options, name });
|
||||
};
|
||||
|
||||
const isFrame = (element: MapLayerState<any>) => {
|
||||
return element instanceof FrameState;
|
||||
};
|
||||
|
||||
const selection = selected ? [layers[selected]?.getName()] : [];
|
||||
|
||||
return (
|
||||
@@ -74,6 +79,7 @@ export const LayersEditor = (props: LayersEditorProps) => {
|
||||
onSelect={onSelect}
|
||||
onDelete={onDelete}
|
||||
selection={selection}
|
||||
isFrame={isFrame}
|
||||
excludeBaseLayer
|
||||
onNameChange={onNameChange}
|
||||
verifyLayerNameUniqueness={actions.canRename}
|
||||
|
||||
Reference in New Issue
Block a user