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

feat: added explore in KG if doi is missing

parent 05caf97a
No related branches found
No related tags found
No related merge requests found
...@@ -29,13 +29,23 @@ ...@@ -29,13 +29,23 @@
<a *ngFor="let kgRef of kgReference" <a *ngFor="let kgRef of kgReference"
[href]="kgRef | doiParserPipe" [href]="kgRef | doiParserPipe"
class="color-inherit" class="color-inherit"
mat-icon-button
[matTooltip]="EXPLORE_DATASET_IN_KG_ARIA_LABEL"
target="_blank"> target="_blank">
<button mat-icon-button <i class="fas fa-external-link-alt"></i>
[matTooltip]="EXPLORE_DATASET_IN_KG_ARIA_LABEL">
<i class="fas fa-external-link-alt"></i>
</button>
</a> </a>
<!-- in case no doi is available, directly link to KG -->
<ng-template [ngIf]="kgReference.length === 0">
<a [href]="directLinkToKg"
class="color-inherit"
mat-icon-button
[matTooltip]="EXPLORE_DATASET_IN_KG_ARIA_LABEL"
target="_blank">
<i class="fas fa-external-link-alt"></i>
</a>
</ng-template>
<!-- fav btn --> <!-- fav btn -->
<ng-container *ngTemplateOutlet="favDatasetBtn"> <ng-container *ngTemplateOutlet="favDatasetBtn">
</ng-container> </ng-container>
......
...@@ -13,6 +13,12 @@ import { ARIA_LABELS } from 'common/constants' ...@@ -13,6 +13,12 @@ import { ARIA_LABELS } from 'common/constants'
import { switchMap, distinctUntilChanged, filter } from "rxjs/operators"; import { switchMap, distinctUntilChanged, filter } from "rxjs/operators";
import { IContributor } from "../contributor"; import { IContributor } from "../contributor";
const getDirectLinkToKg = (dataset: { fullId: string, id: string }) => {
const { id } = dataset
if (id) return `https://kg.ebrains.eu/search/instances/Dataset/${encodeURIComponent(id)}`
return null
}
export { export {
DatabrowserService, DatabrowserService,
KgSingleDatasetService, KgSingleDatasetService,
...@@ -94,6 +100,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy { ...@@ -94,6 +100,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy {
* sic! * sic!
*/ */
public kgReference: string[] = [] public kgReference: string[] = []
public directLinkToKg: string
public files: IFile[] = [] public files: IFile[] = []
private methods: string[] = [] private methods: string[] = []
...@@ -146,6 +153,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy { ...@@ -146,6 +153,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy {
this.fullId = fullId this.fullId = fullId
this.kgReference = kgReference this.kgReference = kgReference
this.directLinkToKg = getDirectLinkToKg(dataset)
this.dlFromKgHref = this.singleDatasetService.getDownloadZipFromKgHref({ kgSchema, kgId }) this.dlFromKgHref = this.singleDatasetService.getDownloadZipFromKgHref({ kgSchema, kgId })
......
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