From b841d20f00ec619becb8cc15af9fc307eda62597 Mon Sep 17 00:00:00 2001 From: Shaun Patterson Date: Fri, 12 Jun 2026 10:36:18 -0400 Subject: [PATCH] feat: add DQL format button to the query editor Co-Authored-By: Claude Fable 5 --- client/src/components/EditorPanel.js | 16 ++ client/src/lib/formatDql.js | 358 +++++++++++++++++++++++++++ client/src/lib/formatDql.test.js | 211 ++++++++++++++++ 3 files changed, 585 insertions(+) create mode 100644 client/src/lib/formatDql.js create mode 100644 client/src/lib/formatDql.test.js diff --git a/client/src/components/EditorPanel.js b/client/src/components/EditorPanel.js index ddcb2cee..77239257 100644 --- a/client/src/components/EditorPanel.js +++ b/client/src/components/EditorPanel.js @@ -20,6 +20,7 @@ import { import QueryVarsEditor from 'components/QueryVarsEditor' import Editor from 'containers/Editor' +import { formatDql } from 'lib/formatDql' import '../assets/css/EditorPanel.scss' @@ -39,6 +40,13 @@ export default function EditorPanel() { const onUpdateQuery = (query) => dispatch(updateQuery(query)) const onUpdateAction = (action) => dispatch(updateAction(action)) + const onFormatQuery = () => { + if (query.trim() === '') { + return + } + dispatch(updateQuery(formatDql(query))) + } + const onRunCurrentQuery = () => dispatch( runQuery(query, action, { @@ -101,6 +109,14 @@ export default function EditorPanel() { {queryOptions}
+