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 @@
<a *ngFor="let kgRef of kgReference"
[href]="kgRef | doiParserPipe"
class="color-inherit"
mat-icon-button
[matTooltip]="EXPLORE_DATASET_IN_KG_ARIA_LABEL"
target="_blank">
<button mat-icon-button
[matTooltip]="EXPLORE_DATASET_IN_KG_ARIA_LABEL">
<i class="fas fa-external-link-alt"></i>
</button>
<i class="fas fa-external-link-alt"></i>
</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 -->
<ng-container *ngTemplateOutlet="favDatasetBtn">
</ng-container>
......
......@@ -13,6 +13,12 @@ import { ARIA_LABELS } from 'common/constants'
import { switchMap, distinctUntilChanged, filter } from "rxjs/operators";
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 {
DatabrowserService,
KgSingleDatasetService,
......@@ -94,6 +100,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy {
* sic!
*/
public kgReference: string[] = []
public directLinkToKg: string
public files: IFile[] = []
private methods: string[] = []
......@@ -146,6 +153,7 @@ export class SingleDatasetBase implements OnChanges, OnDestroy {
this.fullId = fullId
this.kgReference = kgReference
this.directLinkToKg = getDirectLinkToKg(dataset)
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