@@ -38,9 +38,10 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
38
38
private readonly sqlInputRef = FSComponent . createRef < Input > ( )
39
39
private readonly executeSqlButtonRef = FSComponent . createRef < HTMLButtonElement > ( )
40
40
private readonly outputRef = FSComponent . createRef < HTMLPreElement > ( )
41
+ private readonly loadingRef = FSComponent . createRef < HTMLDivElement > ( )
42
+ private readonly authContainerRef = FSComponent . createRef < HTMLDivElement > ( )
41
43
42
44
private readonly navigationDataStatus = Subject . create < NavigationDataStatus | null > ( null )
43
- private readonly interfaceInitialized = Subject . create ( false )
44
45
45
46
private cancelSource = CancelToken . source ( )
46
47
@@ -51,18 +52,6 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
51
52
52
53
this . navigationDataInterface = new NavigraphNavigationDataInterface ( )
53
54
54
- // Populate status when ready
55
- this . navigationDataInterface . onReady ( ( ) => {
56
- this . navigationDataInterface
57
- . get_navigation_data_install_status ( )
58
- . then ( status => {
59
- this . navigationDataStatus . set ( status )
60
- } )
61
- . catch ( e => console . error ( e ) )
62
-
63
- this . interfaceInitialized . set ( true )
64
- } )
65
-
66
55
this . navigationDataInterface . onEvent ( NavigraphEventType . DownloadProgress , data => {
67
56
switch ( data . phase ) {
68
57
case DownloadProgressPhase . Downloading :
@@ -116,11 +105,11 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
116
105
public render ( ) : VNode {
117
106
return (
118
107
< >
119
- < div class = "loading-container" hidden = { this . interfaceInitialized } >
108
+ < div class = "loading-container" ref = { this . loadingRef } >
120
109
Waiting for navigation data interface to initialize... If building for the first time, this may take a few
121
110
minutes
122
111
</ div >
123
- < div class = "auth-container" hidden = { this . interfaceInitialized . map ( SubscribableMapFunctions . not ( ) ) } >
112
+ < div class = "auth-container" ref = { this . authContainerRef } style = { { display : "none" } } >
124
113
< div class = "horizontal" >
125
114
< div class = "vertical" >
126
115
< h4 > Step 1 - Sign in</ h4 >
@@ -169,6 +158,20 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
169
158
public onAfterRender ( node : VNode ) : void {
170
159
super . onAfterRender ( node )
171
160
161
+ // Populate status when ready
162
+ this . navigationDataInterface . onReady ( ( ) => {
163
+ this . navigationDataInterface
164
+ . get_navigation_data_install_status ( )
165
+ . then ( status => {
166
+ this . navigationDataStatus . set ( status )
167
+ } )
168
+ . catch ( e => console . error ( e ) )
169
+
170
+ // show the auth container
171
+ this . authContainerRef . instance . style . display = "block"
172
+ this . loadingRef . instance . style . display = "none"
173
+ } )
174
+
172
175
this . loginButtonRef . instance . addEventListener ( "click" , ( ) => this . handleClick ( ) )
173
176
this . downloadButtonRef . instance . addEventListener ( "click" , ( ) => this . handleDownloadClick ( ) )
174
177
0 commit comments