From 5fbcfa197190d376f0a4d5685caaa078d1743187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20B=C3=BChler?= Date: Mon, 22 Jul 2024 14:26:44 +0200 Subject: [PATCH] Fix ui not loading if etcd is not reachable --- .../qc-atlas-ui-repository-configuration.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/directives/qc-atlas-ui-repository-configuration.service.ts b/src/app/directives/qc-atlas-ui-repository-configuration.service.ts index 11fd7116..40c2079b 100644 --- a/src/app/directives/qc-atlas-ui-repository-configuration.service.ts +++ b/src/app/directives/qc-atlas-ui-repository-configuration.service.ts @@ -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 { @@ -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); }) ); } @@ -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 {