From 802b497c279589f0245c883623d03cb8e14b1ffa Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Tue, 2 Jul 2024 10:14:12 +0200
Subject: [PATCH] maint: move code snippet to experimental, remove legacy
 deployments

---
 .github/workflows/deploy-on-okd.yml           | 85 -------------------
 .github/workflows/docker_img.yml              | 42 ---------
 .../region/rich/region.rich.template.html     |  2 +
 .../feature-view/feature-view.component.html  |  2 +
 src/features/module.ts                        |  2 +
 5 files changed, 6 insertions(+), 127 deletions(-)
 delete mode 100644 .github/workflows/deploy-on-okd.yml

diff --git a/.github/workflows/deploy-on-okd.yml b/.github/workflows/deploy-on-okd.yml
deleted file mode 100644
index d587449ec..000000000
--- a/.github/workflows/deploy-on-okd.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-name: Trigger deploy on OKD
-on:
-  workflow_call:
-
-    inputs:
-      FULL_DEPLOY_ID:
-        required: true
-        type: string
-      OKD_ENDPOINT:
-        required: true
-        type: string
-      OKD_PROJECT:
-        required: true
-        type: string
-
-
-      DEPLOY_ID:
-        required: false
-        type: string
-      BRANCH_NAME:
-        required: false
-        type: string
-      ROUTE_HOST:
-        required: false
-        type: string
-      ROUTE_PATH:
-        required: false
-        type: string
-      BUILD_TEXT:
-        required: false
-        type: string
-
-    secrets:
-      OKD_TOKEN:
-        required: true
-env:
-  OC_TEMPLATE_NAME: 'siibra-explorer-branch-deploy-2'
-jobs:
-  trigger-deploy:
-    runs-on: ubuntu-latest
-    steps:
-    - name: 'Login'
-      run: |
-        oc login ${{ inputs.OKD_ENDPOINT }} --token=${{ secrets.OKD_TOKEN }}
-        oc project ${{ inputs.OKD_PROJECT }}
-    - name: 'Login and import image'
-      run: |
-        if oc get dc ${{ inputs.FULL_DEPLOY_ID }}; then
-          # trigger redeploy if deployconfig exists already
-          echo "dc ${{ inputs.FULL_DEPLOY_ID }} already exist, redeploy..."
-          oc rollout latest dc/${{ inputs.FULL_DEPLOY_ID }}
-        else 
-          # create new app if deployconfig does not yet exist
-          echo "dc ${{ inputs.FULL_DEPLOY_ID }} does not yet exist, create new app..."
-
-          if [[ -z "${{ inputs.ROUTE_HOST }}" ]]
-          then
-            echo "ROUTE_HOST not defined!"
-            exit 1
-          fi
-          
-          if [[ -z "${{ inputs.ROUTE_PATH }}" ]]
-          then
-            echo "ROUTE_PATH not defined!"
-            exit 1
-          fi
-          
-          if [[ -z "${{ inputs.BUILD_TEXT }}" ]]
-          then
-            echo "BUILD_TEXT not defined!"
-            exit 1
-          fi
-          if [[ -z "${{ inputs.BRANCH_NAME }}" ]]
-          then
-            echo "BRANCH_NAME not defined!"
-            exit 1
-          fi
-
-          oc new-app --template ${{ env.OC_TEMPLATE_NAME }} \
-            -p BRANCH_NAME=${{ inputs.BRANCH_NAME }} \
-            -p DEPLOY_ID=${{ inputs.DEPLOY_ID }} \
-            -p ROUTE_HOST=${{ inputs.ROUTE_HOST }} \
-            -p ROUTE_PATH=${{ inputs.ROUTE_PATH }} \
-            -p BUILD_TEXT=${{ inputs.BUILD_TEXT }}
-        fi
diff --git a/.github/workflows/docker_img.yml b/.github/workflows/docker_img.yml
index 9fc356880..77e1c8f70 100644
--- a/.github/workflows/docker_img.yml
+++ b/.github/workflows/docker_img.yml
@@ -141,18 +141,6 @@ jobs:
           echo "SXPLR_VERSION=$SXPLR_VERSION"
           echo "SXPLR_VERSION=$SXPLR_VERSION" >> $GITHUB_OUTPUT
 
-  trigger-deploy-master-prod:
-    if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'master' && success() }}
-    needs:
-      - build-docker-img
-      - setting-vars
-    uses: ./.github/workflows/deploy-on-okd.yml
-    with:
-      FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-prodpathviewer
-      OKD_ENDPOINT: https://okd.hbp.eu:443
-      OKD_PROJECT: interactive-viewer
-    secrets:
-      okd_token: ${{ secrets.OKD_PROD_SECRET }}
 
   trigger-deploy-rc-rancher:
     if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'staging' && success() }}
@@ -192,33 +180,3 @@ jobs:
       IMAGE_DIGEST: ${{ needs.build-docker-img.outputs.GIT_DIGEST }}
     secrets:
       KUBECONFIG: ${{ secrets.KUBECONFIG }}
-
-  trigger-deploy-staging-viewer-validation:
-    if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'staging' && success() }}
-    needs:
-      - build-docker-img
-      - setting-vars
-    uses: ./.github/workflows/deploy-on-okd.yml
-    with:
-      FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-stagingpathed
-      OKD_ENDPOINT: https://okd.hbp.eu:443
-      OKD_PROJECT: interactive-viewer
-    secrets:
-      okd_token: ${{ secrets.OKD_PROD_SECRET }}
-  
-  # cluster offline
-  # TODO need to find new home for data-validation
-
-  # trigger-deploy-staging-data-validation:
-  #   if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'staging' && success() }}
-  #   needs:
-  #     - build-docker-img
-  #     - setting-vars
-  #   uses: ./.github/workflows/deploy-on-okd.yml
-  #   with:
-  #     FULL_DEPLOY_ID: siibra-explorer-rc
-  #     OKD_ENDPOINT: https://okd.jsc.hbp.eu:443
-  #     OKD_PROJECT: siibra-explorer
-  #   secrets:
-  #     okd_token: ${{ secrets.OKD_JSC_TOKEN }}
-  
\ No newline at end of file
diff --git a/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.template.html b/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.template.html
index 33e467679..defb5198f 100644
--- a/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.template.html
+++ b/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.template.html
@@ -38,6 +38,7 @@
 
       <mat-action-list class="overview-container">
 
+        <ng-template sxplrExperimentalFlag [experimental]="true">
         <button mat-list-item
           code-snippet
           [routeParam]="{
@@ -63,6 +64,7 @@
             </ng-template>
           </div>
         </button>
+        </ng-template>
         
         <!-- parcellation button -->
         <button
diff --git a/src/features/feature-view/feature-view.component.html b/src/features/feature-view/feature-view.component.html
index eea4f1017..d076f3938 100644
--- a/src/features/feature-view/feature-view.component.html
+++ b/src/features/feature-view/feature-view.component.html
@@ -64,6 +64,7 @@
         </ng-template>
 
         <!-- code -->
+        <ng-template sxplrExperimentalFlag [experimental]="true">
         <button mat-list-item
           code-snippet
           [routeParam]="{
@@ -86,6 +87,7 @@
             </ng-template>
           </div>
         </button>
+        </ng-template>
 
         <!-- anchor -->
         <ng-template [ngIf]="view.concept">
diff --git a/src/features/module.ts b/src/features/module.ts
index fc440770b..cfd719d63 100644
--- a/src/features/module.ts
+++ b/src/features/module.ts
@@ -25,6 +25,7 @@ import { BehaviorSubject } from "rxjs";
 import { TPBRViewCmp } from "./TPBRView/TPBRView.component";
 import { DialogModule } from "src/ui/dialogInfo";
 import { CodeSnippet } from "src/atlasComponents/sapi/codeSnippets/codeSnippet.directive";
+import { ExperimentalFlagDirective } from "src/experimental/experimental-flag.directive";
 
 @NgModule({
   imports: [
@@ -46,6 +47,7 @@ import { CodeSnippet } from "src/atlasComponents/sapi/codeSnippets/codeSnippet.d
     AtlasColorMapIntents,
     TPBRViewCmp,
     CodeSnippet,
+    ExperimentalFlagDirective,
   ],
   declarations: [
     EntryComponent,
-- 
GitLab