From 7eb27550de3b59be56a060103232b3e4a2ebb340 Mon Sep 17 00:00:00 2001 From: Hulxv Date: Thu, 25 Jan 2024 18:13:31 +0200 Subject: [PATCH 1/2] feat(playground): add new query button --- web/playground/src/workbench/Workbench.jsx | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/web/playground/src/workbench/Workbench.jsx b/web/playground/src/workbench/Workbench.jsx index ca67ad9ab163..b291ff064cba 100644 --- a/web/playground/src/workbench/Workbench.jsx +++ b/web/playground/src/workbench/Workbench.jsx @@ -95,7 +95,7 @@ class Workbench extends React.Component { this.monaco.editor.setModelMarkers( this.editor.getModel(), "prql", - monacoErrors, + monacoErrors ); return; } @@ -149,6 +149,27 @@ class Workbench extends React.Component { ]); } + new_query() { + let filename = prompt(`Enter a name for your new query`); + if (filename) { + if (!filename.endsWith(".prql")) { + filename += ".prql"; + } + + this.setState({ + filename, + prql: "", + output: null, + outputTab: "arrow", + prqlError: null, + duckdbError: null, + }); + if (this.editor) { + this.editor.setValue(""); + } + } + } + rename() { let filename = prompt(`New name for ${this.state.filename}`); if (filename) { @@ -175,6 +196,9 @@ class Workbench extends React.Component { + Date: Thu, 25 Jan 2024 16:14:24 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- web/playground/src/workbench/Workbench.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/playground/src/workbench/Workbench.jsx b/web/playground/src/workbench/Workbench.jsx index b291ff064cba..d45e9eaf6aa3 100644 --- a/web/playground/src/workbench/Workbench.jsx +++ b/web/playground/src/workbench/Workbench.jsx @@ -155,7 +155,7 @@ class Workbench extends React.Component { if (!filename.endsWith(".prql")) { filename += ".prql"; } - + this.setState({ filename, prql: "",