From 826807eeedea593cdca24053513f74d04d0be891 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Mon, 1 Aug 2022 09:54:49 +0200
Subject: [PATCH] hotfix: sapi endpoint fallback

---
 docs/releases/v2.7.4.md                       |  6 +++++
 mkdocs.yml                                    |  1 +
 package.json                                  |  2 +-
 src/atlasComponents/sapi/sapi.service.ts      | 22 +++++++++++--------
 .../parcellation.smartChip.template.html      |  2 +-
 5 files changed, 22 insertions(+), 11 deletions(-)
 create mode 100644 docs/releases/v2.7.4.md

diff --git a/docs/releases/v2.7.4.md b/docs/releases/v2.7.4.md
new file mode 100644
index 000000000..d214b2f11
--- /dev/null
+++ b/docs/releases/v2.7.4.md
@@ -0,0 +1,6 @@
+# v2.7.4
+
+## Bugfix
+
+- Properly use fallback when detecting fault
+- Minor wording/cosmetic change
diff --git a/mkdocs.yml b/mkdocs.yml
index 645c24839..7fce47cfb 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -33,6 +33,7 @@ nav:
     - Fetching datasets: 'advanced/datasets.md'
     - Display non-atlas volumes: 'advanced/otherVolumes.md'
   - Release notes:
+    - v2.7.4: 'releases/v2.7.4.md'
     - v2.7.3: 'releases/v2.7.3.md'
     - v2.7.2: 'releases/v2.7.2.md'
     - v2.7.1: 'releases/v2.7.1.md'
diff --git a/package.json b/package.json
index dd637a495..0890653e9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "interactive-viewer",
-  "version": "2.7.3",
+  "version": "2.7.4",
   "description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular",
   "scripts": {
     "lint": "eslint src --ext .ts",
diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts
index 394acc033..b2b4cb332 100644
--- a/src/atlasComponents/sapi/sapi.service.ts
+++ b/src/atlasComponents/sapi/sapi.service.ts
@@ -1,6 +1,6 @@
 import { Injectable } from "@angular/core";
 import { HttpClient } from '@angular/common/http';
-import { map, shareReplay } from "rxjs/operators";
+import { filter, map, shareReplay, switchMap, take } from "rxjs/operators";
 import { SAPIAtlas, SAPISpace } from './core'
 import {
   SapiAtlasModel,
@@ -20,7 +20,7 @@ import { MatSnackBar } from "@angular/material/snack-bar";
 import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service";
 import { EnumColorMapName } from "src/util/colorMaps";
 import { PRIORITY_HEADER } from "src/util/priority";
-import { Observable } from "rxjs";
+import { interval, Observable } from "rxjs";
 import { SAPIFeature } from "./features";
 import { environment } from "src/environments/environment"
 
@@ -52,7 +52,7 @@ export class SAPI{
   }
 
   static ErrorMessage = null
-  static BsEndpoint = `https://siibra-api-rc.apps.hbp.eu/v2_0`
+  static BsEndpoint = null
 
   get bsEndpoint() {
     return SAPI.BsEndpoint
@@ -133,12 +133,16 @@ export class SAPI{
     )
   }
 
-  public atlases$ = this.http.get<SapiAtlasModel[]>(
-    `${this.bsEndpoint}/atlases`,
-    {
-      observe: "response"
-    }
-  ).pipe(
+  public atlases$ = interval(160).pipe(
+    map(() => this.bsEndpoint),
+    filter(v => !!v),
+    take(1),
+    switchMap(endpt => this.http.get<SapiAtlasModel[]>(
+      `${endpt}/atlases`,
+      {
+        observe: "response"
+      }
+    )),
     map(resp => {
       const respVersion = resp.headers.get(SIIBRA_API_VERSION_HEADER_KEY)
       if (respVersion !== SIIBRA_API_VERSION) {
diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html
index c15b1d11c..05899973a 100644
--- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html
+++ b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html
@@ -126,7 +126,7 @@
       color="primary">
       <div class="fas fa-external-link-alt"></div>
       <span>
-        Explore
+        Dataset Detail
       </span>
     </a>
 
-- 
GitLab