import { css, cx } from '@emotion/css'; import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Icon, useStyles2 } from '@grafana/ui'; import { sceneGraph } from '../core/sceneGraph'; import { SceneObject, isSceneObject, SceneLayoutChild } from '../core/types'; export interface Props { node: SceneObject; selectedObject?: SceneObject; } export function SceneObjectTree({ node, selectedObject }: Props) { const styles = useStyles2(getStyles); const state = node.useState(); let children: SceneLayoutChild[] = []; for (const propKey of Object.keys(state)) { const propValue = (state as any)[propKey]; if (isSceneObject(propValue)) { children.push(propValue); } } if ('children' in state) { for (const child of state.children) { children.push(child); } } const name = node.constructor.name; const isSelected = selectedObject === node; const onSelectNode = () => sceneGraph.getSceneEditor(node).onSelectObject(node); return (