Commit 8445ed7 1 parent 967844d commit 8445ed7 Copy full SHA for 8445ed7
File tree 4 files changed +744
-629
lines changed
4 files changed +744
-629
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ export default {
165
165
this .client .options .clientId ,
166
166
);
167
167
this .doSubscribe ([" openWB/system/usage_terms_acknowledged" ]); // required for route guard
168
+ this .doSubscribe ([" openWB/system/installWizard" ]);
168
169
});
169
170
this .client .on (" error" , (error ) => {
170
171
console .error (" Connection failed" , error);
Original file line number Diff line number Diff line change @@ -209,6 +209,13 @@ router.beforeEach(async (to) => {
209
209
return { name : "LegalSettings" } ;
210
210
}
211
211
}
212
+ if ( to . name !== "InstallAssistant" ) {
213
+ const wizardDone =
214
+ await store . getters . installWizard ;
215
+ if ( ! wizardDone ) {
216
+ return { name : "InstallAssistant" } ;
217
+ }
218
+ }
212
219
} ) ;
213
220
214
221
router . afterEach ( ( to ) => {
Original file line number Diff line number Diff line change @@ -172,5 +172,32 @@ export default createStore({
172
172
}
173
173
} ) ;
174
174
} ,
175
+ installWizard ( state ) {
176
+ return new Promise ( ( resolve ) => {
177
+
178
+ if ( state . mqtt [ "openWB/system/installWizard" ] !== undefined ) {
179
+ resolve ( state . mqtt [ "openWB/system/installWizard" ] ,
180
+ ) ;
181
+ } else {
182
+ var timer , interval ;
183
+ // add general timeout if topic not set
184
+ timer = setTimeout ( ( ) => {
185
+ clearInterval ( interval ) ;
186
+ resolve ( false ) ;
187
+ } , 5000 ) ;
188
+ // check until we received valid data
189
+ interval = setInterval ( ( ) => {
190
+ if (
191
+ state . mqtt [ "openWB/system/installWizard" ] !==
192
+ undefined
193
+ ) {
194
+ clearTimeout ( timer ) ;
195
+ clearInterval ( interval ) ;
196
+ resolve ( state . mqtt [ "openWB/system/installWizard" ] ) ;
197
+ }
198
+ } , 100 ) ;
199
+ }
200
+ } ) ;
201
+ } ,
175
202
} ,
176
203
} ) ;
You can’t perform that action at this time.
0 commit comments