@@ -82,6 +82,14 @@ class TestHarness extends LitElement {
8282 this . _createDatabase ( dbname , computeName , true ) ;
8383 break ;
8484
85+ case 'cloneDBBtn' :
86+ dbname = root . getElementById ( 'cloneSourceDBInput' ) . value ;
87+ const cloneName = root . getElementById ( 'cloneDestDBInput' ) . value ;
88+ computeName = root . getElementById ( 'cloneDBComputeInput' ) . value ;
89+ computeName = computeName ?? ( computeName . length > 0 ? computeName : null ) ;
90+ this . _cloneDatabase ( cloneName , dbname , computeName , true ) ;
91+ break ;
92+
8593 case 'runQueryBtn' :
8694 dbname = root . getElementById ( 'queryDBInput' ) . value ;
8795 computeName = root . getElementById ( 'queryComputeInput' ) . value ;
@@ -210,7 +218,14 @@ class TestHarness extends LitElement {
210218 < div class ="test-section-title "> Create database</ div >
211219 < input type ="text " id ="createDBInput " placeholder ="Database name " />
212220 < input type ="text " id ="createDBComputeInput " placeholder ="Compute name " />
213- < button id ="createDBBtn "> Create new database</ button >
221+ < button id ="createDBBtn "> Create/overwrite new database</ button >
222+ </ div >
223+ < div class ="test-section ">
224+ < div class ="test-section-title "> Clone database</ div >
225+ < input type ="text " id ="cloneSourceDBInput " placeholder ="Source database name " />
226+ < input type ="text " id ="cloneDestDBInput " placeholder ="Destination clone name " />
227+ < input type ="text " id ="cloneDBComputeInput " placeholder ="Compute name " />
228+ < button id ="cloneDBBtn "> Clone with overwrite</ button >
214229 </ div >
215230 < div class ="test-section ">
216231 < div class ="test-section-title "> Query</ div >
@@ -317,6 +332,20 @@ class TestHarness extends LitElement {
317332 }
318333 }
319334
335+ async _cloneDatabase ( cloneName , dbname , compute , overwrite ) {
336+ try {
337+ const response = await this . _raiConnection . cloneDatabase ( cloneName , dbname , compute , overwrite ) ;
338+ console . log ( 'Clone database: ' , response ) ;
339+
340+ if ( response . result ) {
341+ this . _listDatabases ( ) ;
342+ }
343+ }
344+ catch ( error ) {
345+ console . error ( error ) ;
346+ }
347+ }
348+
320349 async _runQuery ( dbname , computeName , query ) {
321350 try {
322351 const response = await this . _raiConnection . query ( dbname , computeName , query ) ;
0 commit comments