From 2e2fb49aee58659485d27f95a6287aaff0b21e2c Mon Sep 17 00:00:00 2001 From: Baptiste Toulemonde <toulemonde@cines.fr> Date: Wed, 22 Dec 2021 12:21:39 +0100 Subject: [PATCH] update with fdp 1.12 --- src/app/repository/repository.component.ts | 1 + .../services/publish-repository.service.ts | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index 8c56129da..a72b69a1f 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -137,6 +137,7 @@ repository:\n\ dct:description "'+ this.Form.value.repodescription + '";\n\ dct:hasVersion "'+ this.Form.value.repoversion + '";\n\ dct:isPartOf <' + this.persistentUrl + '>;\n\ + dct:publisher [ a foaf:Agent; foaf:name " +this.Form.value.reponame + " ]; \n\ dcat:keyword "'+ this.Form.value.repotype + '";\n\ dct:title "'+ this.Form.value.reponame + '";\n\ foaf:homepage <' + this.Form.value.repourl + '>;\n\ diff --git a/src/app/repository/services/publish-repository.service.ts b/src/app/repository/services/publish-repository.service.ts index ad49bad81..8e47736d5 100644 --- a/src/app/repository/services/publish-repository.service.ts +++ b/src/app/repository/services/publish-repository.service.ts @@ -1,4 +1,4 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { AppConfiguration } from 'src/app/AppConfiguration'; @@ -43,15 +43,30 @@ export class PublishRepositoryService { const response = await fetch(myRequest, myInit); const id = await response.headers.get("location"); - + const url = id const catId = id.substring(id.search("catalog/") + 8, id.length); console.log('catalog creaetd with fdp / id = ' + catId); + this.publishMetadata(url); return this.addUserCatalog(catId); } return null; } + async publishMetadata(url: string) { + if (this.fds2Token) { + const httpOptions = { + headers: new HttpHeaders({ + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + this.fds2Token + }) + }; + + return this.http.put(`${url}/meta/state`, { current: 'PUBLISHED' }, httpOptions).toPromise(); + } + } + getPersistentUrl(): Observable<PersistentUrlResponse> { return this.http.get<PersistentUrlResponse>(environment.fdpUrl + '/configs/bootstrap'); } -- GitLab