@@ -495,60 +495,46 @@ function createWordRotator() {
495495 } ;
496496}
497497
498- // Owl searching through data — for OpenSearch domain provisioning
499- const OPENSEARCH_FRAMES = [
500- [
501- '' ,
502- " ,___," ,
503- ' {o,o} ◇ searching...' ,
504- ' /)__)' ,
505- ' -"-"- ◇ ◇ ◇' ,
506- null ,
507- '' ,
508- ] ,
509- [
510- '' ,
511- " ,___," ,
512- ' {O,o} ◈ indexing...' ,
513- ' /)__)' ,
514- ' -"-"- ◈ ◈ ◈' ,
515- null ,
516- '' ,
517- ] ,
518- [
519- '' ,
520- " ,___," ,
521- ' {o,O} ◆ mapping...' ,
522- ' /)__)' ,
523- ' -"-"- ◆ ◆ ◆' ,
524- null ,
525- '' ,
526- ] ,
527- [
498+ // Owl eye patterns cycle for animation even when status text is static
499+ const OWL_EYES = [ '{o,o}' , '{O,o}' , '{o,O}' , '{O,O}' ] ;
500+ const OWL_GEMS = [ '◇' , '◈' , '◆' , '★' ] ;
501+
502+ function buildOwlFrame ( frameIdx , statusText ) {
503+ const eyes = OWL_EYES [ frameIdx % OWL_EYES . length ] ;
504+ const gem = OWL_GEMS [ frameIdx % OWL_GEMS . length ] ;
505+ const label = statusText || 'provisioning...' ;
506+ const drift = ( frameIdx % 4 ) * 2 ;
507+ const pad = ' ' . repeat ( drift ) ;
508+ return [
528509 '' ,
529- " ,___," ,
530- ' {O,O} ★ found it!' ,
531- ' /)__)' ,
532- ' -"-"- ★ ★ ★' ,
510+ ` ,___,` ,
511+ ` ${ eyes } ${ pad } ${ gem } ${ label } ` ,
512+ ` /)__)` ,
513+ ` -"-"-${ pad } ${ gem } ${ gem } ${ gem } ` ,
533514 null ,
534515 '' ,
535- ] ,
536- ] ;
516+ ] ;
517+ }
537518
538519// Fish swimming back and forth through the pipeline
539520const FISH_RIGHT = '><(((º>' ;
540521const FISH_LEFT = '<º)))><' ;
541522const PIPE_WIDTH = 36 ;
542523
543- function buildPipelineFrame ( pos , goingRight , caption ) {
524+ function buildPipelineFrame ( pos , goingRight , caption , statusText ) {
544525 const fish = goingRight ? FISH_RIGHT : FISH_LEFT ;
545526 const lane = ' ' . repeat ( PIPE_WIDTH ) ;
546527 const row = lane . slice ( 0 , pos ) + fish + lane . slice ( pos + fish . length ) ;
547528 const pipe = '═' . repeat ( PIPE_WIDTH ) ;
529+ const label = statusText || '' ;
530+ const padded = label . length < PIPE_WIDTH
531+ ? ' ' + label + ' ' . repeat ( PIPE_WIDTH - label . length - 1 )
532+ : ' ' + label . slice ( 0 , PIPE_WIDTH - 1 ) ;
548533 return [
549534 '' ,
550535 ` ${ pipe } ` ,
551536 ` ${ row } ` ,
537+ ` ${ padded } ` ,
552538 ` ${ pipe } ` ,
553539 ` ${ caption } ` ,
554540 '' ,
@@ -575,16 +561,17 @@ export function createAsciiAnimation(type) {
575561
576562 // OpenSearch state
577563 let osFrame = 0 ;
564+ let domainStatus = '' ;
578565
579566 const getWord = createWordRotator ( ) ;
580567
581568 function getFrame ( ) {
582569 const word = getWord ( ) ;
583570 if ( isOpenSearch ) {
584- return OPENSEARCH_FRAMES [ ( osFrame ++ ) % OPENSEARCH_FRAMES . length ]
571+ return buildOwlFrame ( osFrame ++ , domainStatus )
585572 . map ( ( l ) => l === null ? ` ${ word } ` : l ) ;
586573 }
587- const frame = buildPipelineFrame ( fishPos , goingRight , word ) ;
574+ const frame = buildPipelineFrame ( fishPos , goingRight , word , domainStatus ) ;
588575 if ( goingRight ) { fishPos ++ ; if ( fishPos >= maxPos ) goingRight = false ; }
589576 else { fishPos -- ; if ( fishPos <= 0 ) goingRight = true ; }
590577 return frame ;
@@ -624,6 +611,8 @@ export function createAsciiAnimation(type) {
624611 } ,
625612 /** Update the status text shown below the art */
626613 setStatus ( fn ) { statusFn = fn ; } ,
614+ /** Update the domain status label shown next to the owl */
615+ setDomainStatus ( text ) { domainStatus = text ; } ,
627616 stop ( ) { cleanup ( ) ; } ,
628617 } ;
629618}
0 commit comments