Skip to content

Commit

Permalink
Fix ui not loading if etcd is not reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
buehlefs committed Jul 22, 2024
1 parent ed55182 commit 5fbcfa1
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { environment } from '../../environments/environment';

export enum UiFeatures {
Expand Down Expand Up @@ -73,6 +73,11 @@ export class QcAtlasUiRepositoryConfigurationService {
this.configuration = initialValues;
this.parseNode(response.node, this.configuration);
return this.configuration;
}),
catchError((err) => {
this.configuration = initialValues;
console.warn('Could not load config from etcd store!', err);
return of(this.configuration);
})
);
}
Expand Down Expand Up @@ -102,7 +107,7 @@ export class QcAtlasUiRepositoryConfigurationService {
*/
private parseNode(node: EtcdNode, obj: QcAtlasUiConfiguration): void {
const slashIndex = node.key.lastIndexOf('/');
const key = node.key.substr(slashIndex + 1);
const key = node.key.substring(slashIndex + 1);
if (node.nodes) {
node.nodes.forEach((child) => this.parseNode(child, obj[key]));
} else {
Expand Down

0 comments on commit 5fbcfa1

Please sign in to comment.