From 4b426979121b889cbfac8c26c60f84f6893e4b2b Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Thu, 23 Apr 2020 09:56:56 +0200 Subject: [PATCH] Transformations: debug mode tweaks (#23802) --- .../TransformationEditor.tsx | 149 +++++++++--------- 1 file changed, 78 insertions(+), 71 deletions(-) diff --git a/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx b/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx index 4f7e6b00ba8..63ce7de782c 100644 --- a/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx +++ b/public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx @@ -22,7 +22,7 @@ export const TransformationEditor = ({ editor, input, output, debugMode }: Trans {debugMode && (
-
Input
+
Transformation input data
@@ -31,7 +31,7 @@ export const TransformationEditor = ({ editor, input, output, debugMode }: Trans
-
Output
+
Transformation output data
@@ -42,73 +42,80 @@ export const TransformationEditor = ({ editor, input, output, debugMode }: Trans ); }; -const getStyles = (theme: GrafanaTheme) => ({ - title: css` - display: flex; - padding: 4px 8px 4px 8px; - position: relative; - height: 35px; - border-radius: 4px 4px 0 0; - flex-wrap: nowrap; - justify-content: space-between; - align-items: center; - `, - name: css` - font-weight: ${theme.typography.weight.semibold}; - color: ${theme.colors.textBlue}; - `, - iconRow: css` - display: flex; - `, - icon: css` - background: transparent; - border: none; - box-shadow: none; - cursor: pointer; - color: ${theme.colors.textWeak}; - margin-left: ${theme.spacing.sm}; - &:hover { - color: ${theme.colors.text}; - } - `, - editor: css``, - debugWrapper: css` - display: flex; - flex-direction: row; - `, - debugSeparator: css` - width: 48px; - height: 300px; - display: flex; - align-items: center; - justify-content: center; - margin: 0 ${theme.spacing.xs}; - `, - debugTitle: css` - padding: ${theme.spacing.xxs}; - text-align: center; - font-family: ${theme.typography.fontFamily.monospace}; - font-size: ${theme.typography.size.sm}; - color: ${theme.palette.blue80}; - border-bottom: 1px dashed ${theme.palette.gray15}; - flex-grow: 0; - flex-shrink: 1; - `, +const getStyles = (theme: GrafanaTheme) => { + const debugBorder = theme.isLight ? theme.palette.gray85 : theme.palette.gray15; - debug: css` - margin-top: ${theme.spacing.md}; - padding: 0 ${theme.spacing.sm} ${theme.spacing.sm} ${theme.spacing.sm}; - border: 1px dashed ${theme.palette.gray15}; - background: ${theme.palette.gray05}; - border-radius: ${theme.border.radius.sm}; - width: 100%; - height: 300px; - display: flex; - flex-direction: column; - `, - debugJson: css` - flex-grow: 1; - height: 100%; - overflow: hidden; - `, -}); + return { + title: css` + display: flex; + padding: 4px 8px 4px 8px; + position: relative; + height: 35px; + border-radius: 4px 4px 0 0; + flex-wrap: nowrap; + justify-content: space-between; + align-items: center; + `, + name: css` + font-weight: ${theme.typography.weight.semibold}; + color: ${theme.colors.textBlue}; + `, + iconRow: css` + display: flex; + `, + icon: css` + background: transparent; + border: none; + box-shadow: none; + cursor: pointer; + color: ${theme.colors.textWeak}; + margin-left: ${theme.spacing.sm}; + &:hover { + color: ${theme.colors.text}; + } + `, + editor: css``, + debugWrapper: css` + display: flex; + flex-direction: row; + `, + debugSeparator: css` + width: 48px; + min-height: 300px; + display: flex; + align-items: center; + align-self: stretch; + justify-content: center; + margin: 0 ${theme.spacing.xs}; + color: ${theme.colors.textBlue}; + `, + debugTitle: css` + padding: ${theme.spacing.sm} ${theme.spacing.xxs}; + font-family: ${theme.typography.fontFamily.monospace}; + font-size: ${theme.typography.size.sm}; + color: ${theme.colors.text}; + border-bottom: 1px solid ${debugBorder}; + flex-grow: 0; + flex-shrink: 1; + `, + + debug: css` + margin-top: ${theme.spacing.sm}; + padding: 0 ${theme.spacing.sm} ${theme.spacing.sm} ${theme.spacing.sm}; + border: 1px solid ${debugBorder}; + background: ${theme.isLight ? theme.palette.white : theme.palette.gray05}; + border-radius: ${theme.border.radius.sm}; + width: 100%; + min-height: 300px; + display: flex; + flex-direction: column; + align-self: stretch; + `, + debugJson: css` + flex-grow: 1; + height: 100%; + overflow: hidden; + padding: ${theme.spacing.xs}; + `, + }; +};