Commit d81a86f9 authored by cazenave's avatar cazenave
Browse files

qq modifs

parent 642bcd21
import { Injectable } from "@angular/core";
import { HttpClient } from '@angular/common/http';
@Injectable()
export class AppConfiguration {
fdpurl: string;
fdpemail: string;
fdppassword: string;
constructor(private httpClient: HttpClient){};
public ensureInit(): Promise<any> {
return new Promise((r, e) => {
this.httpClient.get("assets/conf/fdpsetting.json")
.subscribe(
(content: AppConfiguration) => {
Object.assign(this, content);
r(this);
},
reason => e(reason));
});
};
}
import { TestBed } from '@angular/core/testing';
import { ApiService } from './api.service';
describe('ApiService', () => {
let service: ApiService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ApiService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ApiService {
constructor() { }
}
...@@ -25,8 +25,6 @@ const routes: Routes = [ ...@@ -25,8 +25,6 @@ const routes: Routes = [
{path: 'settingfdp', component : SettingfdpComponent}, {path: 'settingfdp', component : SettingfdpComponent},
{path: 'settingsmartapi', component : SettingsmartapiComponent}, {path: 'settingsmartapi', component : SettingsmartapiComponent},
{path: 'swaggerapi', component : SwaggereditorComponent} {path: 'swaggerapi', component : SwaggereditorComponent}
]; ];
@NgModule({ @NgModule({
......
...@@ -147,14 +147,12 @@ ...@@ -147,14 +147,12 @@
<button mat-menu-item [matMenuTriggerFor]="subMenuDataset">Describe access to datasets</button> <button mat-menu-item [matMenuTriggerFor]="subMenuDataset">Describe access to datasets</button>
<mat-menu #subMenuDataset="matMenu"> <mat-menu #subMenuDataset="matMenu">
<button mat-menu-item routerLink="/swaggerapi" routerLinkActive="active">Swagger API editor</button> <button mat-menu-item routerLink="/swaggerapi" routerLinkActive="active">Swagger OpenAPI editor</button>
<button mat-menu-item routerLink="/datasets" routerLinkActive="active">Select your datasets to publish</button> <button mat-menu-item routerLink="/datasets" routerLinkActive="active">Select your datasets to publish</button>
</mat-menu> </mat-menu>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item routerLink="/ontologie" routerLinkActive="active">Ontologie mapping</button> <button mat-menu-item routerLink="/ontologie" routerLinkActive="active">Metadata mapping</button>
<mat-divider></mat-divider>
<button mat-menu-item routerLink="/publish" routerLinkActive="active">Publish in FFDS</button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<button mat-menu-item routerLink="/settingfdp" routerLinkActive="active">FDP setting</button> <button mat-menu-item routerLink="/settingfdp" routerLinkActive="active">FDP setting</button>
<button mat-menu-item routerLink="/settingsmartapi" routerLinkActive="active">SmartAPI setting</button> <button mat-menu-item routerLink="/settingsmartapi" routerLinkActive="active">SmartAPI setting</button>
......
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule, APP_INITIALIZER } from '@angular/core';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
...@@ -27,9 +27,12 @@ import {FormsModule} from '@angular/forms'; ...@@ -27,9 +27,12 @@ import {FormsModule} from '@angular/forms';
import { RepositoryinfoComponent } from './repositoryinfo/repositoryinfo.component'; import { RepositoryinfoComponent } from './repositoryinfo/repositoryinfo.component';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule, HttpClient } from '@angular/common/http';
import { FileSaverModule } from 'ngx-filesaver'; import { FileSaverModule } from 'ngx-filesaver';
import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component'; import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component';
import { AppConfiguration } from './AppConfiguration'
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -45,7 +48,7 @@ import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component' ...@@ -45,7 +48,7 @@ import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component'
UserComponent, UserComponent,
RepositoryinfoComponent, RepositoryinfoComponent,
SwaggereditorComponent SwaggereditorComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
AppRoutingModule, AppRoutingModule,
...@@ -62,7 +65,17 @@ import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component' ...@@ -62,7 +65,17 @@ import { SwaggereditorComponent } from './swaggereditor/swaggereditor.component'
FileSaverModule FileSaverModule
], ],
providers: [], providers: [
AppConfiguration,
{
provide: APP_INITIALIZER,
useFactory: AppConfigurationFactory,
deps: [AppConfiguration, HttpClient], multi: true },
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }
export function AppConfigurationFactory(appConfig: AppConfiguration) {
return () => appConfig.ensureInit();
}
\ No newline at end of file
<p>datasets works!</p> <h3>Here list of datasets directly from the openapi GET</h3>
<h3>where you can choose what to publish in FDP</h3>
<h3>AAI EOSC-Pillar (to integrate)</h3>
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<mat-card-title>Login</mat-card-title> <mat-card-title>Login</mat-card-title>
...@@ -15,7 +17,7 @@ ...@@ -15,7 +17,7 @@
</tr> </tr>
<tr> <tr>
<td><mat-form-field class="example-full-width"> <td><mat-form-field class="example-full-width">
<input matInput placeholder="Password" [(ngModel)]="password"type="password" name="password" required> <input matInput placeholder="Password" [(ngModel)]="password" type="password" name="password" required>
</mat-form-field></td> </mat-form-field></td>
</tr> </tr>
<tr> <tr>
......
<p>ontologie works!</p> <h2>FAIRify your data: </h2>
<h3>1 - map your metadata schema with FDP schema</h3>
<h3>2 - add missing informations</h3>
<h3>3 - and align with ontologies</h3>
...@@ -34,5 +34,9 @@ ...@@ -34,5 +34,9 @@
<br> <br>
<button type="submit" (click)="repositorytoyaml('submit')" class="btn btn-primary">Save repository description file</button> <button type="submit" (click)="repositorytoyaml('submit')" class="btn btn-primary">Save repository description file</button>
</div> </div>
<div>
<br>
<button type="submit" (click)="repositorytoyaml('publish')" class="btn btn-success">Publish catalog description in FDP</button>
</div>
</form> </form>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Validators } from '@angular/forms'; import { Validators } from '@angular/forms';
import { FormArray } from '@angular/forms'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { FileSaverService } from 'ngx-filesaver'; import { FileSaverService } from 'ngx-filesaver';
import { FormControl} from '@angular/forms'; import { FormControl} from '@angular/forms';
import { FormGroup} from '@angular/forms'; import { FormGroup} from '@angular/forms';
import { AppConfiguration } from '../AppConfiguration';
@Component({ @Component({
...@@ -30,7 +30,8 @@ export class RepositoryComponent implements OnInit { ...@@ -30,7 +30,8 @@ export class RepositoryComponent implements OnInit {
constructor( constructor(
private _httpClient: HttpClient, private appConfig: AppConfiguration,
private http: HttpClient,
private _FileSaverService: FileSaverService, private _FileSaverService: FileSaverService,
) { } ) { }
...@@ -42,13 +43,13 @@ if (buttonType == 'submit') { ...@@ -42,13 +43,13 @@ if (buttonType == 'submit') {
let data: string; let data: string;
data ='\ data ='\
repository: \n\ repository:\n\
title: '+ this.Form.value.reponame +' \n\ title: '+ this.Form.value.reponame +'\n\
description: '+ this.Form.value.repodescription +' \n\ description: '+ this.Form.value.repodescription +'\n\
url: '+ this.Form.value.repourl +' \n\ url: '+ this.Form.value.repourl +'\n\
version: '+ this.Form.value.repoversion +' \n\ version: '+ this.Form.value.repoversion +' \n\
licence: '+ this.Form.value.repolicence +' \n\ licence: '+ this.Form.value.repolicence +'\n\
language: '+ this.Form.value.repolanguage + '\n\ language: '+ this.Form.value.repolanguage +'\n\
' '
const fileName = `repository.yaml`; const fileName = `repository.yaml`;
...@@ -88,9 +89,36 @@ repository: \n\ ...@@ -88,9 +89,36 @@ repository: \n\
} }
fileReader.readAsText(this.importFile); fileReader.readAsText(this.importFile);
}
if (buttonType == 'publish') {
let data: string;
data ='\
@prefix dcat: <http://www.w3.org/ns/dcat#>.\n\
@prefix dct: <http://purl.org/dc/terms/>.\n\
@prefix fdp: <http://fdp-api.default.svc.cluster.local/>.\n\nfdp:new \n\
a dcat:Catalog, dcat:Resource;\n\
dct:description "'+ this.Form.value.repodescription + '";\n\
dct:hasVersion "'+ this.Form.value.repoversion + '";\n\
dct:isPartOf <http://fdp-api.default.svc.cluster.local>;\n\
dct:title "'+ this.Form.value.reponame + '".\n'
const httpOptions = {
headers: new HttpHeaders({
'Accept': 'text/turtle',
'Content-Type': 'text/turtle',
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwOGY4YjNiNC01Nzc1LTQyYmQtYjlmMy0zMTFhZDVkNGFiODgiLCJpYXQiOjE1OTQxOTQwMzYsImV4cCI6MTU5NTQwMzYzNn0.p2ygh7D36NziWOSTpBplcyn4jLp_vKKoUUcg27M3hIo'
})
};
return this.http
.post(this.appConfig.fdpurl+"/catalog", data, httpOptions )
.subscribe( (r)=>{console.log('got r', r)}) ;
}
}
} }
......
<p>repositoryinfo works!</p> <h3>Filling the SDT for publishing your repository in the national registry</h3>
<p>settingfdp works!</p>
<form [formGroup]="Form" (ngSubmit)="SaveFdpSetting()">
<div class="form-group">
<label>FAIR data point Url
<input matInput placeholder="fdp url http://" type="text" class="form-control" formControlName="fdpurl" required>
</label>
</div>
<div class="form-group">
<label>Email
<input matInput placeholder="fdp email" type="text" class="form-control" formControlName="fdpemail" required>
</label>
</div>
<div class="form-group">
<label>Password
<input matInput placeholder="fdp password" type="password" class="form-control" formControlName="fdppassword" required>
</label>
</div>
<div>
<br>
<button type="submit" class="btn btn-primary">Save fdp setting</button>
</div>
</form>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AppConfiguration } from '../AppConfiguration';
import { HttpClient } from '@angular/common/http';
import { FileSaverService } from 'ngx-filesaver';
import { FormControl} from '@angular/forms';
import { FormGroup} from '@angular/forms';
@Component({ @Component({
selector: 'app-settingfdp', selector: 'app-settingfdp',
templateUrl: './settingfdp.component.html', templateUrl: './settingfdp.component.html',
styleUrls: ['./settingfdp.component.scss'] styleUrls: ['./settingfdp.component.scss']
}) })
export class SettingfdpComponent implements OnInit { export class SettingfdpComponent implements OnInit {
Form = new FormGroup({
fdpurl: new FormControl(),
fdpemail: new FormControl(),
fdppassword: new FormControl(),
});
constructor() { } constructor(
private appConfig: AppConfiguration,
private http: HttpClient,
private _FileSaverService: FileSaverService
) {}
ngOnInit() { ngOnInit() {
this.Form.setValue({
fdpurl: this.appConfig.fdpurl ,
fdpemail: this.appConfig.fdpemail ,
fdppassword: this.appConfig.fdppassword
});
} }
}
SaveFdpSetting() {
let data: string;
data ='\
{\n\
fdpurl: "'+ this.appConfig.fdpurl +'" \n\
fdpemail: "'+ this.appConfig.fdpemail +'" \n\
fdppassword: "'+ this.appConfig.fdppassword +'" \n\
}'
console.log(data);
return this.http.post("/api/fdpsetting", data).subscribe( (r)=>{console.log('got r', r)}) ;
};
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SwaggereditorComponent } from './swaggereditor.component';
describe('SwaggereditorComponent', () => {
let component: SwaggereditorComponent;
let fixture: ComponentFixture<SwaggereditorComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SwaggereditorComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SwaggereditorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
declare const SwaggerEditorBundle: any;
declare const SwaggerEditorStandalonePreset: any;
@Component({
selector: 'app-swaggereditor',
templateUrl: './swaggereditor.component.html',
styleUrls: ['./swaggereditor.component.scss']
})
export class SwaggereditorComponent implements OnInit {
constructor() { }
ngOnInit(): void {
const editor = SwaggerEditorBundle({
dom_id: '#swagger-editor',
layout: 'StandaloneLayout',
presets: [
SwaggerEditorStandalonePreset
],
url: 'http://rackerlabs.github.io/wadl2swagger/openstack/swagger/dbaas.json'
});
}
}
{
"fdpurl": "http://6ddrvi64oo.lb.c1.gra7.k8s.ovh.net",
"fdpemail": "admin@cines-lab.fr",
"fdppassword": "adminadmin",
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwOGY4YjNiNC01Nzc1LTQyYmQtYjlmMy0zMTFhZDVkNGFiODgiLCJpYXQiOjE1OTQyNzY2MjEsImV4cCI6MTU5NTQ4NjIyMX0.pxCJO_yCK01uLAtlScVMHStTwFE34Ic2CxOijP8Ubcw"
}
\ No newline at end of file
{ {
"compileOnSave": false, "compileOnSave": true,
"compilerOptions": { "compilerOptions": {
"baseUrl": "./", "baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
......
Markdown is supported
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