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

chore: render dataset card classic UI

parent 2f2a62f9
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ export class ShowDatasetDialogDirective{ ...@@ -59,7 +59,7 @@ export class ShowDatasetDialogDirective{
} }
if (this.name || this.description) { if (this.name || this.description) {
const { name, description, urls } = this const { name, description, urls } = this
return { name, description, urls } return { name, description, urls, useClassicUi: true }
} }
})() })()
...@@ -72,10 +72,11 @@ export class ShowDatasetDialogDirective{ ...@@ -72,10 +72,11 @@ export class ShowDatasetDialogDirective{
} }
if (!this.dialogCmp) throw new Error(`IAV_DATASET_SHOW_DATASET_DIALOG_CMP not provided!`) if (!this.dialogCmp) throw new Error(`IAV_DATASET_SHOW_DATASET_DIALOG_CMP not provided!`)
const { useClassicUi } = data
this.matDialog.open(this.dialogCmp, { this.matDialog.open(this.dialogCmp, {
...ShowDatasetDialogDirective.defaultDialogConfig, ...ShowDatasetDialogDirective.defaultDialogConfig,
panelClass: ['no-padding-dialog'], data,
data ...(useClassicUi ? {} : { panelClass: ['no-padding-dialog'] })
}) })
} }
} }
...@@ -37,6 +37,7 @@ export class KgRegDetailCmp extends BsRegionInputBase implements OnChanges { ...@@ -37,6 +37,7 @@ export class KgRegDetailCmp extends BsRegionInputBase implements OnChanges {
public isGdprProtected = false public isGdprProtected = false
public descriptionFallback = `[This dataset cannot be fetched right now]` public descriptionFallback = `[This dataset cannot be fetched right now]`
public useClassicUi = false
public description: string public description: string
public name: string public name: string
...@@ -51,10 +52,11 @@ export class KgRegDetailCmp extends BsRegionInputBase implements OnChanges { ...@@ -51,10 +52,11 @@ export class KgRegDetailCmp extends BsRegionInputBase implements OnChanges {
){ ){
super(svc) super(svc)
if (data) { if (data) {
const { description, name, urls } = data const { description, name, urls, useClassicUi } = data
this.description = description this.description = description
this.name = name this.name = name
this.urls = urls this.urls = urls
this.useClassicUi = useClassicUi
} }
} }
......
<!-- header -->
<mat-card class="mat-elevation-z4"> <!-- classic UI -->
<ng-template [ngIf]="useClassicUi" [ngIfElse]="modernUi">
<div class="sidenav-cover-header-container bg-50-grey-20"> <mat-card-subtitle>
<mat-card-title> <ng-container *ngTemplateOutlet="nameTmpl">
<ng-content select="[region-of-interest]"></ng-content> </ng-container>
<div *ngIf="!loadingFlag; else isLoadingTmpl"> </mat-card-subtitle>
{{ name || nameFallback }}
</div>
</mat-card-title> <!-- desc -->
<small>
<mat-card-subtitle class="d-inline-flex align-items-center"> <ng-container *ngTemplateOutlet="descTmpl"></ng-container>
<mat-icon fontSet="fas" fontIcon="fa-database"></mat-icon> </small>
<span>
ebrains regional dataset
</span> <!-- footer -->
<mat-card-actions iav-media-query #iavMediaQuery="iavMediaQuery">
<button *ngIf="isGdprProtected" <ng-container *ngTemplateOutlet="actionBtnsTmpl; context: {
[matTooltip]="CONST.GDPR_TEXT" $implicit: (iavMediaQuery.mediaBreakPoint$ | async) > 1
mat-icon-button color="warn"> }" >
<i class="fas fa-exclamation-triangle"></i> </ng-container>
</button> </mat-card-actions>
<mat-divider [vertical]="true" class="ml-2 h-2rem"></mat-divider> <ng-template #actionBtnsTmpl let-useSmallIcon>
<!-- explore -->
<!-- explore btn --> <ng-container>
<a *ngFor="let kgRef of (urls || [])" <a *ngFor="let kgRef of (urls || [])"
[href]="kgRef.doi | doiParserPipe" [href]="kgRef.doi | doiParserPipe"
class="color-inherit" class="color-inherit"
mat-icon-button mat-icon-button
[matTooltip]="ARIA_LABELS.EXPLORE_DATASET_IN_KG" [matTooltip]="ARIA_LABELS.EXPLORE_DATASET_IN_KG"
target="_blank"> target="_blank">
<i class="fas fa-external-link-alt"></i> <iav-dynamic-mat-button
[iav-dynamic-mat-button-style]="useSmallIcon ? 'mat-icon-button' : 'mat-raised-button'"
iav-dynamic-mat-button-color="primary">
<span *ngIf="!useSmallIcon">
Explore
</span>
<i class="fas fa-external-link-alt"></i>
</iav-dynamic-mat-button>
</a> </a>
</ng-container>
</mat-card-subtitle> </ng-template>
</div> </ng-template>
<!-- modern UI -->
<ng-template #modernUi>
<!-- header -->
<mat-card class="mat-elevation-z4">
</mat-card> <div class="sidenav-cover-header-container bg-50-grey-20">
<mat-card-title>
<ng-content select="[region-of-interest]"></ng-content>
<ng-container *ngTemplateOutlet="nameTmpl">
</ng-container>
</mat-card-title>
<!-- description --> <mat-card-subtitle class="d-inline-flex align-items-center">
<mat-icon fontSet="fas" fontIcon="fa-database"></mat-icon>
<span>
ebrains regional dataset
</span>
<markdown-dom class="text-muted d-block mat-body m-4" *ngIf="!loadingFlag" <button *ngIf="isGdprProtected"
[markdown]="description || descriptionFallback"> [matTooltip]="CONST.GDPR_TEXT"
</markdown-dom> mat-icon-button color="warn">
<i class="fas fa-exclamation-triangle"></i>
</button>
<mat-divider [vertical]="true" class="ml-2 h-2rem"></mat-divider>
<!-- explore btn -->
<a *ngFor="let kgRef of (urls || [])"
[href]="kgRef.doi | doiParserPipe"
class="color-inherit"
mat-icon-button
[matTooltip]="ARIA_LABELS.EXPLORE_DATASET_IN_KG"
target="_blank">
<i class="fas fa-external-link-alt"></i>
</a>
</mat-card-subtitle>
</div>
</mat-card>
<!-- description -->
<div class="text-muted d-block mat-body m-4"
*ngIf="!loadingFlag">
<ng-container *ngTemplateOutlet="descTmpl">
</ng-container>
</div>
</ng-template>
<ng-template #nameTmpl>
<span *ngIf="!loadingFlag; else isLoadingTmpl">
{{ name || nameFallback }}
</span>
</ng-template>
<!-- desc -->
<ng-template #descTmpl>
<markdown-dom
[markdown]="description || descriptionFallback">
</markdown-dom>
</ng-template>
<!-- is loading tmpl -->
<ng-template #isLoadingTmpl> <ng-template #isLoadingTmpl>
<spinner-cmp></spinner-cmp> <spinner-cmp></spinner-cmp>
</ng-template> </ng-template>
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, NgModule } from "@angular/core"; import { Component, Inject, NgModule, Optional } from "@angular/core";
import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module"; import { AngularMaterialModule } from "src/ui/sharedModules/angularMaterial.module";
import { KgRegSummaryCmp } from "./kgRegSummary/kgRegSummary.component"; import { KgRegSummaryCmp } from "./kgRegSummary/kgRegSummary.component";
import { KgRegionalFeaturesList } from "./kgRegList/kgRegList.component"; import { KgRegionalFeaturesList } from "./kgRegList/kgRegList.component";
...@@ -10,23 +10,39 @@ import { IAV_DATASET_SHOW_DATASET_DIALOG_CMP } from "../kgDataset/showDataset/sh ...@@ -10,23 +10,39 @@ import { IAV_DATASET_SHOW_DATASET_DIALOG_CMP } from "../kgDataset/showDataset/sh
import { UtilModule } from "src/util"; import { UtilModule } from "src/util";
import { ComponentsModule } from "src/components"; import { ComponentsModule } from "src/components";
import { BsFeatureService } from "../service"; import { BsFeatureService } from "../service";
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
@Component({ @Component({
selector: 'blabla', selector: 'show-ds-dialog-cmp',
template: ` template: `
<mat-dialog-content class="m-0 p-0"> <ng-template [ngIf]="useClassicUi" [ngIfElse]="modernUiTmpl">
<kg-regional-feature-detail></kg-regional-feature-detail> <kg-regional-feature-detail></kg-regional-feature-detail>
</mat-dialog-content> </ng-template>
<mat-dialog-actions align="center"> <ng-template #modernUiTmpl>
<button mat-button mat-dialog-close>
Close <mat-dialog-content class="m-0 p-0">
</button> <kg-regional-feature-detail></kg-regional-feature-detail>
</mat-dialog-actions> </mat-dialog-content>
<mat-dialog-actions align="center">
<button mat-button mat-dialog-close>
Close
</button>
</mat-dialog-actions>
</ng-template>
` `
}) })
export class ShowDsDialogCmp{} export class ShowDsDialogCmp{
public useClassicUi = false
constructor(
@Optional() @Inject(MAT_DIALOG_DATA) data: any
){
this.useClassicUi = data.useClassicUi
}
}
@NgModule({ @NgModule({
imports: [ imports: [
......
...@@ -84,6 +84,7 @@ export type TDatainfos = { ...@@ -84,6 +84,7 @@ export type TDatainfos = {
cite: string cite: string
doi: string doi: string
}[] }[]
useClassicUi: boolean
} }
export type TSpaceFull = { export type TSpaceFull = {
......
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