@@ -401,6 +401,11 @@ function updateDatabases(callback, preferSelected) {
401401 $ ( "#studioPanel" ) . show ( ) ;
402402 console . log ( "UI updated - login page hidden, studio panel shown" ) ;
403403
404+ if ( databases . length === 0 )
405+ showQuickStart ( ) ;
406+ else
407+ hideQuickStart ( ) ;
408+
404409 // These operations should not block login completion
405410 try {
406411 displaySchema ( ) ;
@@ -504,6 +509,79 @@ function createDatabase() {
504509 } ) ;
505510}
506511
512+ // ===== Quick Start Panel (shown when no databases exist) =====
513+
514+ var sampleDatasets = [
515+ { name : "OpenBeer" , desc : "Beers, breweries, categories and styles" , icon : "fa-beer-mug-empty" } ,
516+ { name : "GratefulDeadConcerts" , desc : "Grateful Dead concerts and songs" , icon : "fa-music" } ,
517+ { name : "MovieRatings" , desc : "Movies with viewer ratings" , icon : "fa-film" } ,
518+ { name : "Tolkien-Arda" , desc : "Tolkien's Middle-earth universe" , icon : "fa-hat-wizard" } ,
519+ { name : "Whisky" , desc : "Whisky distilleries and brands" , icon : "fa-whiskey-glass" } ,
520+ { name : "demodb" , desc : "General-purpose demo database" , icon : "fa-database" }
521+ ] ;
522+
523+ function showQuickStart ( ) {
524+ var html = "" ;
525+ for ( var i = 0 ; i < sampleDatasets . length ; i ++ ) {
526+ var ds = sampleDatasets [ i ] ;
527+ html += '<div class="col-md-4">' +
528+ '<div class="card quick-start-card" onclick="importSampleDatabase(\'' + ds . name + '\')">' +
529+ '<div class="card-body text-center" style="padding: 20px 16px;">' +
530+ '<i class="fa ' + ds . icon + '" style="font-size: 2rem; color: #00aeee; margin-bottom: 10px; display: block;"></i>' +
531+ '<div style="font-weight: 600; font-size: 0.95rem; margin-bottom: 4px;">' + ds . name + '</div>' +
532+ '<div class="text-muted" style="font-size: 0.8rem;">' + ds . desc + '</div>' +
533+ '</div>' +
534+ '</div>' +
535+ '</div>' ;
536+ }
537+ $ ( "#quickStartDatasets" ) . html ( html ) ;
538+ $ ( "#quickStartOverlay" ) . hide ( ) ;
539+ $ ( "#quickStartPanel" ) . show ( ) ;
540+ $ ( "#mainTabContent" ) . hide ( ) ;
541+ }
542+
543+ function hideQuickStart ( ) {
544+ $ ( "#quickStartOverlay" ) . hide ( ) ;
545+ $ ( "#quickStartPanel" ) . hide ( ) ;
546+ $ ( "#mainTabContent" ) . show ( ) ;
547+ }
548+
549+ function importSampleDatabase ( name ) {
550+ var url = "https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/" + name + ".gz" ;
551+
552+ $ ( "#quickStartOverlay" ) . html (
553+ '<div class="spinner-border text-primary" style="width: 3rem; height: 3rem;"></div>' +
554+ '<h5 style="margin-top: 16px; font-weight: 600;">Importing ' + escapeHtml ( name ) + '...</h5>' +
555+ '<p style="color: var(--text-secondary, #888);">Creating database and downloading dataset. This may take a moment.</p>'
556+ ) . css ( "display" , "flex" ) ;
557+
558+ jQuery . ajax ( {
559+ type : "POST" ,
560+ url : "api/v1/server" ,
561+ data : JSON . stringify ( { command : "create database " + name } ) ,
562+ contentType : "application/json" ,
563+ beforeSend : function ( xhr ) { xhr . setRequestHeader ( "Authorization" , globalCredentials ) ; }
564+ } ) . done ( function ( ) {
565+ jQuery . ajax ( {
566+ type : "POST" ,
567+ url : "api/v1/command/" + encodeURIComponent ( name ) ,
568+ data : JSON . stringify ( { language : "sql" , command : "IMPORT DATABASE " + url } ) ,
569+ contentType : "application/json" ,
570+ timeout : 300000 ,
571+ beforeSend : function ( xhr ) { xhr . setRequestHeader ( "Authorization" , globalCredentials ) ; }
572+ } ) . done ( function ( ) {
573+ globalNotify ( "Success" , name + " imported successfully!" , "success" ) ;
574+ updateDatabases ( null , name ) ;
575+ } ) . fail ( function ( jqXHR ) {
576+ globalNotifyError ( jqXHR . responseText ) ;
577+ $ ( "#quickStartOverlay" ) . hide ( ) ;
578+ } ) ;
579+ } ) . fail ( function ( jqXHR ) {
580+ globalNotifyError ( jqXHR . responseText ) ;
581+ $ ( "#quickStartOverlay" ) . hide ( ) ;
582+ } ) ;
583+ }
584+
507585function dropDatabase ( ) {
508586 let database = escapeHtml ( getCurrentDatabase ( ) ) ;
509587 if ( database == "" ) {
0 commit comments