File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
web/playground/src/workbench Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ class Workbench extends React.Component {
9595 this . monaco . editor . setModelMarkers (
9696 this . editor . getModel ( ) ,
9797 "prql" ,
98- monacoErrors ,
98+ monacoErrors
9999 ) ;
100100 return ;
101101 }
@@ -149,6 +149,27 @@ class Workbench extends React.Component {
149149 ] ) ;
150150 }
151151
152+ new_query ( ) {
153+ let filename = prompt ( `Enter a name for your new query` ) ;
154+ if ( filename ) {
155+ if ( ! filename . endsWith ( ".prql" ) ) {
156+ filename += ".prql" ;
157+ }
158+
159+ this . setState ( {
160+ filename,
161+ prql : "" ,
162+ output : null ,
163+ outputTab : "arrow" ,
164+ prqlError : null ,
165+ duckdbError : null ,
166+ } ) ;
167+ if ( this . editor ) {
168+ this . editor . setValue ( "" ) ;
169+ }
170+ }
171+ }
172+
152173 rename ( ) {
153174 let filename = prompt ( `New name for ${ this . state . filename } ` ) ;
154175 if ( filename ) {
@@ -175,6 +196,9 @@ class Workbench extends React.Component {
175196 < button className = "action" onClick = { ( ) => this . save ( ) } >
176197 Save
177198 </ button >
199+ < button className = "action" onClick = { ( ) => this . new_query ( ) } >
200+ New Query
201+ </ button >
178202 </ div >
179203 < Editor
180204 height = "10rem"
You can’t perform that action at this time.
0 commit comments