From 470d879c804f4abe2fd969098548e685a6a82c26 Mon Sep 17 00:00:00 2001 From: Kyle Cunningham Date: Fri, 27 Oct 2023 10:30:31 -0500 Subject: [PATCH] Transformations: Move debug to drawer (#76281) * Move debug to drawer * Prettier * Remove render actions arg * Remove unused import --- .../TransformationEditor.tsx | 44 ++++++++++--------- .../TransformationOperationRow.tsx | 9 ++-- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx b/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx index 83a0fa747a2..671bbdaf5b5 100644 --- a/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx +++ b/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx @@ -13,7 +13,7 @@ import { } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { getTemplateSrv } from '@grafana/runtime'; -import { Icon, JSONFormatter, useStyles2 } from '@grafana/ui'; +import { Icon, JSONFormatter, useStyles2, Drawer } from '@grafana/ui'; import { TransformationsEditorTransformation } from './types'; @@ -24,6 +24,7 @@ interface TransformationEditorProps { uiConfig: TransformerRegistryItem; configs: TransformationsEditorTransformation[]; onChange: (index: number, config: DataTransformerConfig) => void; + toggleShowDebug: () => void; } export const TransformationEditor = ({ @@ -33,6 +34,7 @@ export const TransformationEditor = ({ uiConfig, configs, onChange, + toggleShowDebug, }: TransformationEditorProps) => { const styles = useStyles2(getStyles); const [input, setInput] = useState([]); @@ -84,32 +86,32 @@ export const TransformationEditor = ({
{editor} {debugMode && ( -
-
-
Transformation input data
-
- + +
+
+
Input data
+
+ +
+
+
+ +
+
+
Output data
+
{output && }
-
- -
-
-
Transformation output data
-
{output && }
-
-
+ )}
); }; const getStyles = (theme: GrafanaTheme2) => { - const debugBorder = theme.isLight ? theme.v1.palette.gray85 : theme.v1.palette.gray15; - return { title: css` display: flex; @@ -159,7 +161,7 @@ const getStyles = (theme: GrafanaTheme2) => { font-family: ${theme.typography.fontFamilyMonospace}; font-size: ${theme.typography.bodySmall.fontSize}; color: ${theme.colors.text}; - border-bottom: 1px solid ${debugBorder}; + border-bottom: 1px solid ${theme.colors.border.weak}; flex-grow: 0; flex-shrink: 1; `, @@ -167,7 +169,7 @@ const getStyles = (theme: GrafanaTheme2) => { debug: css` margin-top: ${theme.spacing(1)}; padding: 0 ${theme.spacing(1, 1, 1)}; - border: 1px solid ${debugBorder}; + border: 1px solid ${theme.colors.border.weak}; background: ${theme.isLight ? theme.v1.palette.white : theme.v1.palette.gray05}; border-radius: ${theme.shape.radius.default}; width: 100%; diff --git a/public/app/features/dashboard/components/TransformationsEditor/TransformationOperationRow.tsx b/public/app/features/dashboard/components/TransformationsEditor/TransformationOperationRow.tsx index 9a05c7ce589..15d0410a9f9 100644 --- a/public/app/features/dashboard/components/TransformationsEditor/TransformationOperationRow.tsx +++ b/public/app/features/dashboard/components/TransformationsEditor/TransformationOperationRow.tsx @@ -9,10 +9,7 @@ import { QueryOperationAction, QueryOperationToggleAction, } from 'app/core/components/QueryOperationRow/QueryOperationAction'; -import { - QueryOperationRow, - QueryOperationRowRenderProps, -} from 'app/core/components/QueryOperationRow/QueryOperationRow'; +import { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow'; import config from 'app/core/config'; import { PluginStateInfo } from 'app/features/plugins/components/PluginStateInfo'; @@ -101,7 +98,7 @@ export const TransformationOperationRow = ({ [configs, index] ); - const renderActions = ({ isOpen }: QueryOperationRowRenderProps) => { + const renderActions = () => { return ( <> {uiConfig.state && } @@ -122,7 +119,6 @@ export const TransformationOperationRow = ({ )} );