Skip to content
Snippets Groups Projects
Commit adfc2e65 authored by Xiao Gui's avatar Xiao Gui
Browse files

feat: coord edit dialog, on paste, auto parse

maint: remove jsc in ci/cd
parent 7192b06b
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ jobs:
- run: |
if [[ "$GITHUB_REF" = *hotfix* ]] || [[ "$GITHUB_REF" = refs/heads/staging ]]
then
export SIIBRA_API_ENDPOINTS=https://siibra-api-rc.apps.hbp.eu/v2_0,https://siibra-api-rc.apps.jsc.hbp.eu/v2_0
export SIIBRA_API_ENDPOINTS=https://siibra-api-rc.apps.hbp.eu/v3_0
node src/environments/parseEnv.js ./environment.ts
fi
npm run test-ci
......
......@@ -21,7 +21,7 @@ jobs:
PRODUCTION: 'true'
DOCKER_REGISTRY: 'docker-registry.ebrains.eu/siibra/'
SIIBRA_API_STABLE: 'https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-stable.apps.jsc.hbp.eu/v3_0'
SIIBRA_API_STABLE: 'https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-prod.apps.tc.humanbrainproject.eu/v3_0'
SIIBRA_API_RC: 'https://siibra-api-rc.apps.hbp.eu/v3_0'
SIIBRA_API_LATEST: 'https://siibra-api-latest.apps-dev.hbp.eu/v3_0'
......@@ -162,17 +162,20 @@ jobs:
OKD_PROJECT: interactive-viewer
secrets:
okd_token: ${{ secrets.OKD_PROD_SECRET }}
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 }}
# 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
......@@ -4,7 +4,7 @@ ARG BACKEND_URL
ENV BACKEND_URL=${BACKEND_URL}
ARG SIIBRA_API_ENDPOINTS
ENV SIIBRA_API_ENDPOINTS=${SIIBRA_API_ENDPOINTS:-https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-stable.apps.jsc.hbp.eu/v3_0}
ENV SIIBRA_API_ENDPOINTS=${SIIBRA_API_ENDPOINTS:-https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-prod.apps.tc.humanbrainproject.eu/v3_0}
ARG STRICT_LOCAL
ENV STRICT_LOCAL=${STRICT_LOCAL:-false}
......
......@@ -8,7 +8,7 @@ As siibra-explorer uses [webpack define plugin](https://webpack.js.org/plugins/d
| `VERSION` | Used to coarsely identify siibra-explorer version | | |
| `PRODUCTION` | if the build is for production, toggles optimisations such as minification | `undefined` | true |
| `BACKEND_URL` | backend that the viewer calls to fetch available template spaces, parcellations, plugins, datasets | `null` | https://interactive-viewer.apps.hbp.eu/ |
| `SIIBRA_API_ENDPOINTS` | Comma separated endpoints of [siibra-api](https://github.com/FZJ-INM1-BDA/siibra-api) used to fetch different resources | `https://siibra-api-stable.apps.hbp.eu/v2_0,https://siibra-api-stable-ns.apps.hbp.eu/v2_0,https://siibra-api-stable.apps.jsc.hbp.eu/v2_0` |
| `SIIBRA_API_ENDPOINTS` | Comma separated endpoints of [siibra-api](https://github.com/FZJ-INM1-BDA/siibra-api) used to fetch different resources | `https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-prod.apps.tc.humanbrainproject.eu/v3_0` |
| `MATOMO_URL` | base url for matomo analytics | `null` | https://example.com/matomo/ |
| `MATOMO_ID` | application id for matomo analytics | `null` | 6 |
| `STRICT_LOCAL` | hides **Explore** and **Download** buttons. Useful for offline demo's | `false` | `true` |
......
......@@ -9,4 +9,5 @@
## Behind the Scenes
- Removed dependency on connectivity-component
\ No newline at end of file
- Removed dependency on connectivity-component
- Removed reference to JSC OKD instance, as the instance is no longer available
import { Directive, HostListener, Input, TemplateRef } from "@angular/core";
import { Directive, EventEmitter, HostListener, Input, Output, TemplateRef } from "@angular/core";
import { MatDialog, MatDialogConfig, MatDialogRef } from 'src/sharedModules/angularMaterial.exports'
import { DialogFallbackCmp } from "./tmpl/tmpl.component"
......@@ -40,6 +40,12 @@ export class DialogDirective{
@Input('sxplr-dialog-data')
data: any = {}
@Input('sxplr-dialog-config')
config: Partial<MatDialogConfig> = {}
@Output('sxplr-dialog-closed')
closed = new EventEmitter()
#dialogRef: MatDialogRef<unknown>
constructor(private matDialog: MatDialog){}
......@@ -53,7 +59,12 @@ export class DialogDirective{
this.#dialogRef = this.matDialog.open(tmpl, {
autoFocus: null,
data: {...this.data, ...data},
...(sizeDict[this.size] || {})
...(sizeDict[this.size] || {}),
...this.config
})
this.#dialogRef.afterClosed().subscribe(val => {
this.closed.next(val)
})
}
......
......@@ -8,9 +8,9 @@ import {
import { select, Store } from "@ngrx/store";
import { LoggingService } from "src/logging";
import { NehubaViewerUnit } from "../nehubaViewer/nehubaViewer.component";
import { Observable, concat, of } from "rxjs";
import { Observable, Subject, concat, of } from "rxjs";
import { map, filter, takeUntil, switchMap, shareReplay, debounceTime } from "rxjs/operators";
import { Clipboard, MatBottomSheet, MatDialog, MatSnackBar } from "src/sharedModules/angularMaterial.exports"
import { Clipboard, MatBottomSheet, MatSnackBar } from "src/sharedModules/angularMaterial.exports"
import { ARIA_LABELS, QUICKTOUR_DESC } from 'common/constants'
import { FormControl, FormGroup } from "@angular/forms";
......@@ -47,6 +47,9 @@ export class StatusCardComponent {
z: new FormControl<string>(null),
})
#pasted$ = new Subject<string>()
#coordEditDialogClosed = new Subject()
private selectedTemplate: SxplrTemplate
private currentNavigation: {
position: number[]
......@@ -113,7 +116,6 @@ export class StatusCardComponent {
private store$: Store<any>,
private log: LoggingService,
private bottomSheet: MatBottomSheet,
private dialog: MatDialog,
private clipboard: Clipboard,
private snackbar: MatSnackBar,
@Inject(NEHUBA_CONFIG_SERVICE_TOKEN) private nehubaConfigSvc: NehubaConfigSvc,
......@@ -132,9 +134,15 @@ export class StatusCardComponent {
this.nehubaViewer$.pipe(
filter(nv => !!nv),
switchMap(nv => nv.viewerPosInReal$.pipe(
filter(pos => !!pos),
debounceTime(120),
switchMap(nv => concat(
of(null),
this.#coordEditDialogClosed,
).pipe(
switchMap(() => nv.viewerPosInReal$.pipe(
filter(pos => !!pos),
debounceTime(120),
shareReplay(1)
))
)),
takeUntil(this.#destroy$)
).subscribe(val => {
......@@ -152,11 +160,14 @@ export class StatusCardComponent {
takeUntil(this.#destroy$)
).subscribe()
this.dialogForm.valueChanges.pipe(
map(({ x, y, z }) => [x, y, z].map(v => this.#parseString(v))),
map(allEntries => allEntries.find(val => val.length === 3)),
this.#pasted$.pipe(
filter(v => !!v), // '' is falsy, so filters out null, undefined, '' etc
map(v => this.#parseString(v)),
filter(fullEntry => !!fullEntry && fullEntry.every(entry => !Number.isNaN(entry))),
takeUntil(this.#destroy$)
takeUntil(this.#destroy$),
debounceTime(0),
// need to update value on the separate frame to paste action
// otherwise, dialogForm.setValue will have no effect
).subscribe(fullEntry => {
this.dialogForm.setValue({
x: `${fullEntry[0]}`,
......@@ -164,7 +175,6 @@ export class StatusCardComponent {
z: `${fullEntry[2]}`,
})
})
}
#parseString(input: string): number[]{
......@@ -257,17 +267,19 @@ export class StatusCardComponent {
)
}
openDialog(tmpl: TemplateRef<any>, options: { ariaLabel: string }): void {
const { ariaLabel } = options
this.dialog.open(tmpl, {
ariaLabel
})
}
copyString(value: string){
this.clipboard.copy(value)
this.snackbar.open(`Copied to clipboard!`, null, {
duration: 1000
})
}
onPaste(ev: ClipboardEvent) {
const text = ev.clipboardData.getData('text/plain')
this.#pasted$.next(text)
}
onCoordEditDialogClose(){
this.#coordEditDialogClosed.next(null)
}
}
......@@ -106,7 +106,9 @@
<button mat-icon-button
[sxplr-dialog-size]="null"
[sxplr-dialog]="pointTmpl">
[sxplr-dialog]="pointTmpl"
[sxplr-dialog-config]="{autoFocus: 'input'}"
(sxplr-dialog-closed)="onCoordEditDialogClose()">
<i class="fas fa-pen"></i>
</button>
......@@ -119,11 +121,12 @@
</ng-template>
<ng-template #pointTmpl>
<h1 mat-dialog-title>
Navigation Coordinate
</h1>
<div mat-dialog-content>
<form [formGroup]="dialogForm">
<form [formGroup]="dialogForm" cdkTrapFocus
(paste)="onPaste($event)">
<h1 mat-dialog-title>
Navigation Coordinate
</h1>
<div mat-dialog-content>
<ng-template ngFor [ngForOf]="['x', 'y', 'z']" let-pos>
<mat-form-field>
......@@ -131,32 +134,23 @@
<input type="text" matInput [formControlName]="pos">
</mat-form-field>
</ng-template>
</form>
</div>
</div>
<div mat-dialog-actions align="end">
<ng-template [ngIf]="dialogInputState$ | async" let-state>
<div mat-dialog-actions align="end">
<ng-template [ngIf]="dialogInputState$ | async" let-state>
<button mat-raised-button color="primary"
(click)="selectPoint(state.valueNm)"
[disabled]="!state.validated"
mat-dialog-close>
select point
</button>
<button mat-button color="primary"
[attr.aria-label]="COPY_NAVIGATION_STRING"
(click)="copyString(state.string)"
[disabled]="!state.validated"
mat-dialog-close>
copy point
<button mat-raised-button color="primary"
(click)="selectPoint(state.valueNm)"
[disabled]="!state.validated"
mat-dialog-close>
select point
</button>
</ng-template>
<button mat-button mat-dialog-close>
cancel
</button>
</ng-template>
<button mat-button mat-dialog-close>
cancel
</button>
</div>
</div>
</form>
</ng-template>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment