Merge remote-tracking branch 'origin/new-theme' into new-theme
This commit is contained in:
commit
a76954cbbc
|
@ -89,7 +89,11 @@ const routes: Routes = [
|
||||||
path: 'project-report',
|
path: 'project-report',
|
||||||
loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule)
|
loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'reload',
|
||||||
|
loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule),
|
||||||
|
data: {hasSidebar: false}
|
||||||
|
},
|
||||||
{path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)},
|
{path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)},
|
||||||
{path: 'error', component: OpenaireErrorPageComponent},
|
{path: 'error', component: OpenaireErrorPageComponent},
|
||||||
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
|
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
|
||||||
|
|
|
@ -1,24 +1,34 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
import {HttpClient} from "@angular/common/http";
|
import {HttpClient, HttpHeaders} from "@angular/common/http";
|
||||||
import {Validators} from "@angular/forms";
|
import {Validators} from "@angular/forms";
|
||||||
|
import {Location} from '@angular/common';
|
||||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||||
|
import {COOKIE} from "../openaireLibrary/login/utils/helper.class";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'egi-transfer-data',
|
selector: 'egi-transfer-data',
|
||||||
template: `
|
template: `
|
||||||
<a (click)="open()"> Transfer data to EGI storage</a>
|
<a (click)="open()"
|
||||||
|
[title]="'Transfer Data'"
|
||||||
|
[attr.uk-tooltip]="'pos: right; cls: uk-active landing-action-tooltip landing-action-tooltip-portal uk-text-small uk-padding-small'"
|
||||||
|
> <span icon="cloud-upload"></span>
|
||||||
|
<span class="uk-icon-button uk-icon landing-action-button landing-action-button-portal">
|
||||||
|
<span uk-icon="cloud-upload"></span>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
<!-- This is the modal -->
|
<!-- This is the modal -->
|
||||||
<div id="modal-example" class="uk-modal uk-open " style="display: block" [class.uk-invisible]="!isOpen">
|
<div id="modal-example" class="uk-modal uk-open " style="display: block" [class.uk-invisible]="!isOpen">
|
||||||
<div class="uk-modal-dialog uk-modal-body uk-width-expand">
|
<div class="uk-modal-dialog uk-modal-body uk-width-expand uk-text-left">
|
||||||
<button class="uk-modal-close-default" type="button" uk-close (click)="close()"></button>
|
<button class="uk-modal-close-default" type="button" uk-close (click)="close()"></button>
|
||||||
<div class="uk-padding">
|
<div class="uk-padding">
|
||||||
<div *ngIf="!loggedIn" class="">
|
<div *ngIf="!accessToken" class="">
|
||||||
<div class="uk-width-1-1 uk-text-center">
|
<div class="uk-width-1-1 uk-text-center">
|
||||||
<h2 class="uk-modal-title">Title</h2>
|
<h2 class="uk-modal-title">EOSC data transfer service</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom">
|
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom">
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
@ -26,14 +36,13 @@ declare var UIkit;
|
||||||
laboris nisi ut aliquip ex ea commodo consequat.
|
laboris nisi ut aliquip ex ea commodo consequat.
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-text-center">
|
<div class="uk-text-center">
|
||||||
<button *ngIf="!loggedIn" class="uk-button uk-button-default" (click)="checkin()">EGI
|
<button *ngIf="!accessToken" class="uk-button uk-button-default" (click)="checkin()">Login
|
||||||
checkin
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="loggedIn" class="">
|
<div *ngIf="accessToken" class="">
|
||||||
<div class="uk-width-1-1 uk-text-center">
|
<div class="uk-width-1-1 uk-text-center">
|
||||||
<h2 class="uk-modal-title">Title</h2>
|
<h2 class="uk-modal-title">EOSC data transfer service</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom">
|
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom">
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
@ -43,18 +52,27 @@ declare var UIkit;
|
||||||
<div class="uk-grid uk-child-width-1-2 uk-grid-divider">
|
<div class="uk-grid uk-child-width-1-2 uk-grid-divider">
|
||||||
<div class="uk-first-column">
|
<div class="uk-first-column">
|
||||||
<p class="uk-text-meta">Lorem ipsum ....</p>
|
<p class="uk-text-meta">Lorem ipsum ....</p>
|
||||||
<div input [(value)]="sourceUrl" placeholder="Give a Zenodo DOI url..." type="URL"
|
<div input type="select" [(value)]="selectedSourceUrl" placeholder="Zenodo DOI URL" hint="Select..."
|
||||||
label="URL" [validators]="validators"></div>
|
[options]="sourceUrls" (valueChange)="this.parse()"></div>
|
||||||
<!-- <button *ngIf="!downloadElements" (click)="parse()" class="uk-button uk-button-default uk-margin-top" [class.uk-disabled]="sourceUrl.length == 0">Parse</button>-->
|
<div class="uk-margin-top">
|
||||||
|
<div>Files to be transfered:</div>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li *ngFor=" let element of this.downloadElements">{{ element.filename}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p class="uk-text-meta">Lorem ipsum ....</p>
|
<p class="uk-text-meta">Lorem ipsum ....</p>
|
||||||
|
<div input type="select" [(value)]="selectedDestination" placeholder="Storage" hint="Select..."
|
||||||
|
[options]="destinationOptions"></div>
|
||||||
<div input [(value)]="destinationPath" placeholder="Give a destination path..."
|
<div input [(value)]="destinationPath" placeholder="Give a destination path..."
|
||||||
[validators]="validators[0]"></div>
|
[validators]="validators[0]" class="uk-margin-top"></div>
|
||||||
<button (click)="parse()"
|
<button (click)="transfer()"
|
||||||
class="uk-button uk-button-primary uk-margin-top"
|
class="uk-button uk-button-primary uk-margin-top"
|
||||||
[class.uk-disabled]="destinationPath.length == 0 || status == 'success' ||status == 'loading' ">
|
[class.uk-disabled]="destinationPath.length == 0 || status == 'success' ||status == 'loading' ">
|
||||||
>> Transfer to EGI Storage
|
>> Transfer to Storage
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,24 +104,41 @@ declare var UIkit;
|
||||||
|
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class EGIDataTransfer {
|
export class EGIDataTransferComponent {
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
loggedIn = false;
|
accessToken = null;
|
||||||
sourceUrl = "https://doi.org/10.5281/zenodo.6507535";
|
@Input() dois;
|
||||||
|
loginURL = "http://rudie.di.uoa.gr:8580/openid_connect_login"
|
||||||
|
sourceUrls = []
|
||||||
|
selectedSourceUrl = null;
|
||||||
destinationPath = "";
|
destinationPath = "";
|
||||||
destinationURL = "https://egi.storage.eu";
|
destinationOptions = [{label: "EGI storage", value: { url: "https://egi.storage.eu", id: "egi" } }];
|
||||||
|
selectedDestination = null;
|
||||||
|
|
||||||
downloadElements = null;
|
downloadElements = null;
|
||||||
isOpen = false;
|
@Input() isOpen = false;
|
||||||
APIURL = "https://virtserver.swaggerhub.com/thebe14/eosc-future-data-transfer/1.0.0";
|
APIURL = "https://virtserver.swaggerhub.com/thebe14/eosc-future-data-transfer/1.0.0";
|
||||||
status: "loading" | "success" | "errorParser" | "errorUser" | "errorTransfer" | "init" = "init";
|
status: "loading" | "success" | "errorParser" | "errorUser" | "errorTransfer" | "init" = "init";
|
||||||
message;
|
message;
|
||||||
validators = [Validators.required, StringUtils.urlValidator()];
|
validators = [Validators.required, StringUtils.urlValidator()];
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient, private location: Location, private _router: Router) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
console.log(COOKIE.getCookie("EGIAccessToken"))
|
||||||
|
this.accessToken = COOKIE.getCookie("EGIAccessToken");
|
||||||
|
for(let doi of this.dois){
|
||||||
|
console.log(doi)
|
||||||
|
if(doi.indexOf("zenodo.")!=-1){
|
||||||
|
this.sourceUrls.push("https://doi.org/" + doi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
this.selectedSourceUrl = this.sourceUrls[0];
|
||||||
|
this.selectedDestination = this.destinationOptions[0].value;
|
||||||
|
this.parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -119,24 +154,24 @@ export class EGIDataTransfer {
|
||||||
}
|
}
|
||||||
close(){
|
close(){
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.downloadElements = null;
|
// this.downloadElements = [];
|
||||||
this.destinationPath = "";
|
this.destinationPath = "";
|
||||||
|
this.selectedDestination = this.destinationOptions[0].value;
|
||||||
|
this.selectedSourceUrl = this.sourceUrls[0];
|
||||||
this.message = null;
|
this.message = null;
|
||||||
this.status = "init";
|
this.status = "init";
|
||||||
|
if(this._router.url.indexOf("&egiTransfer")){
|
||||||
|
this.location.go(this._router.url.split("&egiTransfer")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
checkin(){
|
checkin(){
|
||||||
this.loggedIn = true;
|
window.location.href = this.loginURL+"?redirect="+ encodeURIComponent("http://scoobydoo.di.uoa.gr:4400"+this._router.url+"&egiTransfer=t");
|
||||||
|
|
||||||
}
|
}
|
||||||
parse(){
|
parse(){
|
||||||
// check get user info
|
|
||||||
// .pipe(catch(error: any) => {
|
this.subscriptions.push(this.http.get(this.APIURL + "/parser/zenodo?source=" + this.selectedSourceUrl ).subscribe(
|
||||||
// return Observable.throw(new Error(error.status));
|
|
||||||
// }))
|
|
||||||
this.status = "loading";
|
|
||||||
this.subscriptions.push(this.http.get(this.APIURL + "/user/info").subscribe(
|
|
||||||
res => {
|
|
||||||
console.log(res)
|
|
||||||
this.subscriptions.push(this.http.get(this.APIURL + "/parser/zenodo?source=" + this.sourceUrl ).subscribe(
|
|
||||||
res => {
|
res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
this.downloadElements = [];
|
this.downloadElements = [];
|
||||||
|
@ -150,7 +185,7 @@ export class EGIDataTransfer {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.downloadElements)
|
console.log(this.downloadElements)
|
||||||
this.transfer();
|
// this.transfer();
|
||||||
|
|
||||||
}, error => {
|
}, error => {
|
||||||
this.status = "errorParser";
|
this.status = "errorParser";
|
||||||
|
@ -163,21 +198,16 @@ export class EGIDataTransfer {
|
||||||
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}, error => {
|
|
||||||
this.status = "errorUser";
|
|
||||||
this.message = "User can't be authenticated!";
|
|
||||||
UIkit.notification("User can't be authenticated!", {
|
|
||||||
status: 'error',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transfer() {
|
transfer() {
|
||||||
|
console.log(this.selectedDestination)
|
||||||
|
this.status = "loading";
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||||
|
this.subscriptions.push(this.http.get(this.APIURL + "/user/info", {headers: headers}).subscribe(
|
||||||
|
res => {
|
||||||
|
console.log(res)
|
||||||
let body = {
|
let body = {
|
||||||
"files": [],
|
"files": [],
|
||||||
"params": {
|
"params": {
|
||||||
|
@ -186,6 +216,7 @@ export class EGIDataTransfer {
|
||||||
"retry": 3
|
"retry": 3
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
console.log(this.selectedDestination)
|
||||||
for (let element of this.downloadElements) {
|
for (let element of this.downloadElements) {
|
||||||
|
|
||||||
let file = {
|
let file = {
|
||||||
|
@ -196,7 +227,7 @@ export class EGIDataTransfer {
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
{
|
||||||
"url": this.destinationURL + this.destinationPath + element.filename
|
"url": this.selectedDestination.url + this.destinationPath + element.filename
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"filesize": element['size']
|
"filesize": element['size']
|
||||||
|
@ -205,9 +236,8 @@ export class EGIDataTransfer {
|
||||||
body.files.push(file);
|
body.files.push(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||||
|
this.subscriptions.push(this.http.post(this.APIURL + "/transfer" ,body, {headers: headers}).subscribe(
|
||||||
this.subscriptions.push(this.http.post(this.APIURL + "/transfer" ,body ).subscribe(
|
|
||||||
res => {
|
res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
UIkit.notification('Data transfer has began! ', {
|
UIkit.notification('Data transfer has began! ', {
|
||||||
|
@ -219,8 +249,8 @@ export class EGIDataTransfer {
|
||||||
this.status = "success"
|
this.status = "success"
|
||||||
this.message = `
|
this.message = `
|
||||||
<div class="uk-text-large uk-margin-bottom">Data transfer has began!</div>
|
<div class="uk-text-large uk-margin-bottom">Data transfer has began!</div>
|
||||||
<div>Transfering ` + this.downloadElements.length + ` files to <a href="`+ this.destinationURL + this.destinationPath + `" target=_blank> EGI Storage</a>:
|
<div>Transfering ` + this.downloadElements.length + ` files to <a href="`+ this.selectedDestination.url + this.destinationPath + `" target=_blank> EGI Storage</a>:
|
||||||
<ul>
|
<ul>
|
||||||
`;
|
`;
|
||||||
// TODO LATER we can call status for each file and see if the transfer has been complete
|
// TODO LATER we can call status for each file and see if the transfer has been complete
|
||||||
for(let element of this.downloadElements){
|
for(let element of this.downloadElements){
|
||||||
|
@ -243,7 +273,17 @@ export class EGIDataTransfer {
|
||||||
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
}, error => {
|
||||||
|
this.status = "errorUser";
|
||||||
|
this.message = "User can't be authenticated!";
|
||||||
|
UIkit.notification("User can't be authenticated!", {
|
||||||
|
status: 'error',
|
||||||
|
timeout: 6000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
private parseFilename(url){
|
private parseFilename(url){
|
||||||
let filename = url.split("/")[url.split("/").length - 1];
|
let filename = url.split("/")[url.split("/").length - 1];
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
import {FormsModule} from '@angular/forms';
|
||||||
|
import {EGIDataTransferComponent} from "./transferData.component";
|
||||||
|
import {InputModule} from "../openaireLibrary/sharedComponents/input/input.module";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule, FormsModule, InputModule
|
||||||
|
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
EGIDataTransferComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
EGIDataTransferComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EGIDataTransferModule { }
|
|
@ -8,6 +8,7 @@ export let properties: EnvProperties = {
|
||||||
useCache: false,
|
useCache: false,
|
||||||
useLongCache: true,
|
useLongCache: true,
|
||||||
showAddThis: true,
|
showAddThis: true,
|
||||||
|
enableEoscDataTransfer: true,
|
||||||
metricsAPIURL: "https://services.openaire.eu/usagestats/",
|
metricsAPIURL: "https://services.openaire.eu/usagestats/",
|
||||||
framesAPIURL: "https://www.openaire.eu/stats3/",
|
framesAPIURL: "https://www.openaire.eu/stats3/",
|
||||||
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
|
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
|
||||||
|
@ -47,7 +48,7 @@ export let properties: EnvProperties = {
|
||||||
vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/",
|
vocabulariesAPI: "https://services.openaire.eu/provision/mvc/vocabularies/",
|
||||||
|
|
||||||
piwikBaseUrl: "https://analytics.openaire.eu/piwik.php?idsite=",
|
piwikBaseUrl: "https://analytics.openaire.eu/piwik.php?idsite=",
|
||||||
piwikSiteId: "582",
|
piwikSiteId: "594",
|
||||||
|
|
||||||
loginUrl: "https://services.openaire.eu/login-service/openid_connect_login",
|
loginUrl: "https://services.openaire.eu/login-service/openid_connect_login",
|
||||||
userInfoUrl: "https://services.openaire.eu/login-service/userInfo",
|
userInfoUrl: "https://services.openaire.eu/login-service/userInfo",
|
||||||
|
|
|
@ -13,6 +13,7 @@ export let properties: EnvProperties = {
|
||||||
useCache: true,
|
useCache: true,
|
||||||
useLongCache: true,
|
useLongCache: true,
|
||||||
showAddThis: true,
|
showAddThis: true,
|
||||||
|
enableEoscDataTransfer: true,
|
||||||
metricsAPIURL: "https://beta.services.openaire.eu/usagestats/",
|
metricsAPIURL: "https://beta.services.openaire.eu/usagestats/",
|
||||||
framesAPIURL: "https://beta.openaire.eu/stats3/",
|
framesAPIURL: "https://beta.openaire.eu/stats3/",
|
||||||
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
|
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
|
||||||
|
|
Loading…
Reference in New Issue