From 3bd4bef7d18747b06e5aaf0deca4826198d5f182 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Tue, 5 Sep 2023 13:27:39 +0200
Subject: [PATCH] fix link, tests

---
 src/atlasComponents/sapi/sxplrTypes.ts        |   2 -
 .../feature-view/feature-view.component.html  | 172 +++++++++---------
 .../feature-view.component.spec.ts            |  14 +-
 .../feature-view/feature-view.component.ts    |  10 -
 .../ngLayerCtl/ngLayerCtrl.component.ts       |   2 -
 5 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/src/atlasComponents/sapi/sxplrTypes.ts b/src/atlasComponents/sapi/sxplrTypes.ts
index 81e478b29..25ac84c21 100644
--- a/src/atlasComponents/sapi/sxplrTypes.ts
+++ b/src/atlasComponents/sapi/sxplrTypes.ts
@@ -118,8 +118,6 @@ export type CorticalFeature<T extends CorticalDataType, IndexType extends string
   corticalProfile?: T[]
 } & Feature
 
-type TabularDataType = number | string | number[]
-
 
 export type GenericInfo = {
   name: string
diff --git a/src/features/feature-view/feature-view.component.html b/src/features/feature-view/feature-view.component.html
index 3c4be84af..1c31b1e9c 100644
--- a/src/features/feature-view/feature-view.component.html
+++ b/src/features/feature-view/feature-view.component.html
@@ -10,103 +10,107 @@
   </span>
 </mat-card>
 
-<mat-card *ngIf="feature"
-  class="mat-elevation-z4 sxplr-z-4 header-card">
-  
-  <ng-template [ngTemplateOutlet]="headerTmpl"></ng-template>
+<ng-template [ngIf]="feature">
 
-  <mat-card-subtitle>
-    <ng-template [ngIf]="feature.category">
-      <span class="sxplr-m-a sxplr-pr-1">
-        <ng-template [ngIf]="feature.category !== 'Unknown category'" [ngIfElse]="fallbackTmpl">
-          {{ feature.category }} feature
-        </ng-template>
-        <ng-template #fallbackTmpl>
-          Other feature
-        </ng-template>
-      </span>
-    </ng-template>
-  </mat-card-subtitle>
+  <mat-card *ngIf="feature"
+    class="mat-elevation-z4 sxplr-z-4 header-card">
+    
+    <ng-template [ngTemplateOutlet]="headerTmpl"></ng-template>
+
+    <mat-card-subtitle>
+      <ng-template [ngIf]="feature.category">
+        <span class="sxplr-m-a sxplr-pr-1">
+          <ng-template [ngIf]="feature.category !== 'Unknown category'" [ngIfElse]="fallbackTmpl">
+            {{ feature.category }} feature
+          </ng-template>
+          <ng-template #fallbackTmpl>
+            Other feature
+          </ng-template>
+        </span>
+      </ng-template>
+    </mat-card-subtitle>
 
-  <mat-card-title>
-    <div class="feature-title">
-      {{ feature.name }}
-    </div>
-  </mat-card-title>
+    <mat-card-title>
+      <div class="feature-title">
+        {{ feature.name }}
+      </div>
+    </mat-card-title>
 
-</mat-card>
+  </mat-card>
 
-<mat-tab-group>
-  <mat-tab label="Overview">
+  <mat-tab-group>
+    <mat-tab label="Overview">
 
-    <mat-action-list class="overview-container">
+      <mat-action-list class="overview-container">
 
-      <ng-template [ngIf]="warnings$ | async" let-warnings>
-        <ng-template ngFor [ngForOf]="warnings" let-warning>
-          <button mat-list-item>
-            <mat-icon mat-list-icon fontSet="fas" fontIcon="fa-map-marker"></mat-icon>
-            <div mat-line class="overview-content">{{ warning }}</div>
-          </button>
+        <ng-template [ngIf]="warnings$ | async" let-warnings>
+          <ng-template ngFor [ngForOf]="warnings" let-warning>
+            <button mat-list-item>
+              <mat-icon mat-list-icon fontSet="fas" fontIcon="fa-map-marker"></mat-icon>
+              <div mat-line class="overview-content">{{ warning }}</div>
+            </button>
+          </ng-template>
         </ng-template>
-      </ng-template>
 
-      <!-- doi -->
-      <ng-template ngFor [ngForOf]="feature.link" let-url>
-        <a [href]="url.href" mat-list-item target="_blank" class="no-hover">
-          <mat-icon mat-list-icon fontSet="ai" fontIcon="ai-doi"></mat-icon>
-          <div mat-line>{{ url.text || url.href }}</div>
-        </a>
-      </ng-template>
+        <!-- doi -->
+        <ng-template ngFor [ngForOf]="feature.link" let-url>
+          <a [href]="url.href" mat-list-item target="_blank" class="no-hover">
+            <mat-icon mat-list-icon fontSet="ai" fontIcon="ai-doi"></mat-icon>
+            <div mat-line>{{ url.text || url.href }}</div>
+          </a>
+        </ng-template>
+        
+        <!-- additional links -->
+        <ng-template ngFor [ngForOf]="additionalLinks$ | async" let-url>
+          <a [href]="url" mat-list-item target="_blank" class="no-hover">
+            <mat-icon mat-list-icon fontSet="ai" fontIcon="ai-doi"></mat-icon>
+            <div mat-line>{{ url }}</div>
+          </a>
+        </ng-template>
+
+        <ng-template [ngIf]="downloadLink$ | async" let-downloadLink>
+          <a [href]="downloadLink" mat-list-item target="_blank" class="no-hover">
+            <mat-icon mat-list-icon fontSet="fas" fontIcon="fa-download"></mat-icon>
+            <div mat-line>Download</div>
+          </a>
+        </ng-template>
+        
+
+      </mat-action-list>
       
-      <!-- additional links -->
-      <ng-template ngFor [ngForOf]="additionalLinks$ | async" let-url>
-        <a [href]="url" mat-list-item target="_blank" class="no-hover">
-          <mat-icon mat-list-icon fontSet="ai" fontIcon="ai-doi"></mat-icon>
-          <div mat-line>{{ url }}</div>
-        </a>
-      </ng-template>
+      <markdown-dom class="sxplr-m-2 sxplr-muted" [markdown]="feature.desc">
+      </markdown-dom>
+    </mat-tab>
 
-      <ng-template [ngIf]="downloadLink$ | async" let-downloadLink>
-        <a [href]="downloadLink" mat-list-item target="_blank" class="no-hover">
-          <mat-icon mat-list-icon fontSet="fas" fontIcon="fa-download"></mat-icon>
-          <div mat-line>Download</div>
-        </a>
+    <mat-tab *ngIf="busy$ | async">
+      <ng-template matTabLabel="">
+        <spinner-cmp></spinner-cmp>
       </ng-template>
-      
+    </mat-tab>
 
-    </mat-action-list>
-    
-    <markdown-dom class="sxplr-m-2 sxplr-muted" [markdown]="feature.desc">
-    </markdown-dom>
-  </mat-tab>
+    <!-- voi special view -->
+    <ng-template [ngIf]="voi$ | async" let-voi>
+      <mat-tab label="Volume Control">
+        <ng-layer-ctl
+          [ng-layer-ctl-name]="voi.ngVolume.url"
+          [ng-layer-ctl-src]="voi.ngVolume.url"
+          [ng-layer-ctl-transform]="voi.ngVolume.transform"
+          [ng-layer-ctl-info]="voi.ngVolume.info"
+          [ng-layer-ctl-opacity]="1.0"
+          [ng-layer-ctrl-show]="true">
+        </ng-layer-ctl>
+      </mat-tab>
+    </ng-template>
 
-  <mat-tab *ngIf="busy$ | async">
-    <ng-template matTabLabel="">
-      <spinner-cmp></spinner-cmp>
+    <!-- plotly view -->
+    <ng-template [ngIf]="plotly$ | async" let-plotly>
+      <mat-tab label="Visualization">
+        <ng-template matTabContent>
+          <sxplr-plotly-component [plotly-json]="plotly"></sxplr-plotly-component>  
+        </ng-template>
+      </mat-tab>
     </ng-template>
-  </mat-tab>
-
-  <!-- voi special view -->
-  <ng-template [ngIf]="voi$ | async" let-voi>
-    <mat-tab label="Volume Control">
-      <ng-layer-ctl
-        [ng-layer-ctl-name]="voi.ngVolume.url"
-        [ng-layer-ctl-src]="voi.ngVolume.url"
-        [ng-layer-ctl-transform]="voi.ngVolume.transform"
-        [ng-layer-ctl-info]="voi.ngVolume.info"
-        [ng-layer-ctl-opacity]="1.0"
-        [ng-layer-ctrl-show]="true">
-      </ng-layer-ctl>
-    </mat-tab>
-  </ng-template>
 
-  <!-- plotly view -->
-  <ng-template [ngIf]="plotly$ | async" let-plotly>
-    <mat-tab label="Visualization">
-      <ng-template matTabContent>
-        <sxplr-plotly-component [plotly-json]="plotly"></sxplr-plotly-component>  
-      </ng-template>
-    </mat-tab>
-  </ng-template>
+  </mat-tab-group>
 
-</mat-tab-group>
+</ng-template>
diff --git a/src/features/feature-view/feature-view.component.spec.ts b/src/features/feature-view/feature-view.component.spec.ts
index f95a7ce95..9fbd4f5a7 100644
--- a/src/features/feature-view/feature-view.component.spec.ts
+++ b/src/features/feature-view/feature-view.component.spec.ts
@@ -1,7 +1,7 @@
 import { CommonModule } from '@angular/common';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { EMPTY } from 'rxjs';
-import { SAPIModule } from 'src/atlasComponents/sapi';
+import { SAPI } from 'src/atlasComponents/sapi';
 import { DARKTHEME } from 'src/util/injectionTokens';
 
 import { FeatureViewComponent } from './feature-view.component';
@@ -15,7 +15,6 @@ describe('FeatureViewComponent', () => {
   beforeEach(async () => {
     await TestBed.configureTestingModule({
       imports: [
-        SAPIModule,
         CommonModule,
         ExperimentalModule,
       ],
@@ -25,6 +24,17 @@ describe('FeatureViewComponent', () => {
         {
           provide: DARKTHEME,
           useValue: EMPTY
+        },
+        {
+          provide: SAPI,
+          useValue: {
+            getFeaturePlot(...args) {
+              return EMPTY
+            },
+            getV3FeaturewDetailWithId(...args) {
+              return EMPTY
+            }
+          }
         }
       ]
     })
diff --git a/src/features/feature-view/feature-view.component.ts b/src/features/feature-view/feature-view.component.ts
index c640a110b..a27d90af8 100644
--- a/src/features/feature-view/feature-view.component.ts
+++ b/src/features/feature-view/feature-view.component.ts
@@ -6,16 +6,6 @@ import { Feature, VoiFeature } from 'src/atlasComponents/sapi/sxplrTypes';
 import { DARKTHEME } from 'src/util/injectionTokens';
 import { isVoiData, notQuiteRight } from "../guards"
 
-type PolarPlotData = {
-  receptor: {
-    label: string
-  }
-  density: {
-    mean: number
-    sd: number
-    unit: string
-  }
-}
 
 @Component({
   selector: 'sxplr-feature-view',
diff --git a/src/viewerModule/nehuba/ngLayerCtlModule/ngLayerCtl/ngLayerCtrl.component.ts b/src/viewerModule/nehuba/ngLayerCtlModule/ngLayerCtl/ngLayerCtrl.component.ts
index c1bf962bd..396c86af6 100644
--- a/src/viewerModule/nehuba/ngLayerCtlModule/ngLayerCtl/ngLayerCtrl.component.ts
+++ b/src/viewerModule/nehuba/ngLayerCtlModule/ngLayerCtl/ngLayerCtrl.component.ts
@@ -6,8 +6,6 @@ import { Observable } from "rxjs";
 import { atlasAppearance, atlasSelection } from "src/state";
 import { NehubaViewerUnit, NEHUBA_INSTANCE_INJTKN } from "src/viewerModule/nehuba";
 import { getExportNehuba } from "src/util/fn";
-import { getShader } from "src/util/constants";
-import { EnumColorMapName } from "src/util/colorMaps";
 
 type Vec4 = [number, number, number, number]
 type Mat4 = [Vec4, Vec4, Vec4, Vec4]
-- 
GitLab