Merge remote-tracking branch 'origin/angular-12' into angular-13
This commit is contained in:
commit
918e78d83c
|
@ -6,13 +6,11 @@ import {Session} from "./login/utils/helper.class";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {LoginErrorCodes} from "./login/utils/guardHelper.class";
|
import {LoginErrorCodes} from "./login/utils/guardHelper.class";
|
||||||
import {properties} from "../../environments/environment";
|
import {properties} from "../../environments/environment";
|
||||||
import {isArray} from "util";
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ErrorInterceptorService implements HttpInterceptor {
|
export class ErrorInterceptorService implements HttpInterceptor {
|
||||||
|
|
||||||
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL, properties.registryUrl + 'verification/'];
|
private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL, properties.registryUrl? (properties.registryUrl + 'verification/'):null, properties.eoscDataTransferAPI].filter(value => !!value);
|
||||||
|
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
<a (click)="open()"
|
||||||
|
[title]="'Send data to cloud storage [demo]'"
|
||||||
|
[attr.uk-tooltip]="'pos: right; cls: uk-active 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 -->
|
||||||
|
<modal-alert #egiTransferModal large="true" >
|
||||||
|
|
||||||
|
<div *ngIf="selectedSourceUrl" class="">
|
||||||
|
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom uk-text-center">
|
||||||
|
You have requested to send the data corresponding to the DOI <a [href]="selectedSourceUrl" target="_blank">{{selectedSourceUrl.split(doiPrefix)[1]}}</a> to a cloud storage using the EOSC Data Transfer service
|
||||||
|
</div>
|
||||||
|
<div class="uk-grid uk-child-width-1-2 uk-grid-divider">
|
||||||
|
<!-- Source -->
|
||||||
|
<div class="uk-first-column">
|
||||||
|
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top">Available Zenodo DOI URLs:</p>
|
||||||
|
<div input type="select" [(value)]="selectedSourceUrl" placeholder="Zenodo DOI URL" hint="Select..."
|
||||||
|
[options]="sourceUrls" (valueChange)="this.parse()"></div>
|
||||||
|
<div *ngIf="status!='loading'" class="uk-margin-top">
|
||||||
|
<div>{{this.downloadElements.length}} files found:</div>
|
||||||
|
<div class="uk-overflow-auto" style="max-height: 135px">
|
||||||
|
<ul>
|
||||||
|
<li *ngFor=" let element of this.downloadElements">{{ element.name}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!this.downloadElements || this.downloadElements.length == 0"> - </div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Destination -->
|
||||||
|
<div>
|
||||||
|
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top">Please select the Destination Storage type:</p>
|
||||||
|
<div input type="select" [(value)]="selectedDestination" placeholder="Destination Storage" hint="Select..."
|
||||||
|
[options]="destinationOptions"></div>
|
||||||
|
<div *ngIf=" selectedDestination.id == 'dcache' && !accessToken[selectedDestination.id] else showDestinationOptions" class="">
|
||||||
|
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom uk-text-center">
|
||||||
|
In order to send data to a Cloud Storage, you would need to be authenticated, please login via EGI check-in.
|
||||||
|
</div>
|
||||||
|
<div class="uk-text-center">
|
||||||
|
<button *ngIf="!accessToken[selectedDestination.id]" class="uk-button uk-button-default" (click)="checkin()">Login
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ng-template #showDestinationOptions>
|
||||||
|
<ng-container *ngIf="selectedDestination.id == 'dcache'">
|
||||||
|
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top">Provide the corresponding storage destination path:</p>
|
||||||
|
<div input [(value)]="destinationPath" placeholder="Give a destination path..."
|
||||||
|
[validators]="validators" class=""></div>
|
||||||
|
<div *ngIf="selectedDestination.hasBrowse">
|
||||||
|
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top"> or <a class="uk-text-primary" (click)="browseFolder(selectedDestination.defaultFolder)">browse</a> and select the folder</p>
|
||||||
|
<div *ngIf="folders[selectedDestination.defaultFolder]" class="uk-height-max-large uk-panel-scrollable">
|
||||||
|
<ng-container *ngTemplateOutlet="folderListTmpl; context: { folder : folders[selectedDestination.defaultFolder], folderPath: selectedDestination.defaultFolder}"></ng-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="selectedDestination.id == 'ftp'">
|
||||||
|
<p>Comming soon!</p>
|
||||||
|
</ng-container>
|
||||||
|
</ng-template>
|
||||||
|
<button (click)="transfer()"
|
||||||
|
class="uk-button uk-button-primary uk-margin-top"
|
||||||
|
[class.uk-disabled]="destinationPath.length == 0 || status == 'success' ||status == 'loading' || !validatePath() || (!this.downloadElements || this.downloadElements.length == 0)">
|
||||||
|
>> Transfer
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="status == 'loading'" class="uk-flex uk-flex-center uk-text-muted">
|
||||||
|
<div>
|
||||||
|
<span class="uk-icon uk-spinner">
|
||||||
|
<svg width="60" height="60" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
data-svg="spinner"><circle
|
||||||
|
fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 2px;"></circle></svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="message" class="uk-width-1-1 uk-alert"
|
||||||
|
[class.uk-alert-success]="status && status.indexOf('error')==-1"
|
||||||
|
[class.uk-alert-error]="status && status.indexOf('error')!=-1"
|
||||||
|
[innerHTML]="message">
|
||||||
|
</div>
|
||||||
|
<!-- <div *ngIf="jobId || status == 'canceled'">
|
||||||
|
<button *ngIf=" status != 'canceled'" class="uk-button uk-button-default" (click)="getStatus()">Check status</button>
|
||||||
|
<button *ngIf=" status != 'canceled'" class="uk-button uk-button-default" (click)="cancel()">Cancel</button>
|
||||||
|
<div>{{statusMessage}}</div>
|
||||||
|
</div>-->
|
||||||
|
<div *ngIf=" status != 'canceled'" class="uk-width-1-1 uk-text-right "
|
||||||
|
[class.uk-invisible]="!(status == 'success' || status.indexOf('error')!=-1)">
|
||||||
|
<button class="uk-button uk-button-default uk-margin-top " (click)="close()">Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TESTS -->
|
||||||
|
<!-- <button (click)="hasBrowse()"
|
||||||
|
class="uk-button uk-button-primary uk-margin-top"
|
||||||
|
>
|
||||||
|
has Browse
|
||||||
|
</button>
|
||||||
|
<button (click)="createFolder()"
|
||||||
|
class="uk-button uk-button-primary uk-margin-top"
|
||||||
|
>
|
||||||
|
Create folder new
|
||||||
|
</button>
|
||||||
|
<button (click)="deleteFolder()"
|
||||||
|
class="uk-button uk-button-primary uk-margin-top"
|
||||||
|
>
|
||||||
|
delete folder new
|
||||||
|
</button>-->
|
||||||
|
<!-- End of TESTS-->
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
|
||||||
|
<!-- Browse Templates -->
|
||||||
|
<ng-template #folderListTmpl let-folder="folder" let-folderPath="folderPath" >
|
||||||
|
<ng-container *ngTemplateOutlet="folderTmpl; context: { folder: folder, folderPath:folderPath}"></ng-container>
|
||||||
|
<ul *ngIf="folders[folderPath] && folders[folderPath].isOpen" class="uk-list uk-list-divider uk-margin-small-left folder " style="border-left: 1px solid #e3e3e3; padding-left: 5px;">
|
||||||
|
<li *ngFor=" let file of files[folderPath]">
|
||||||
|
<ng-container *ngIf="file.isFolder else itsFile">
|
||||||
|
<ng-container *ngTemplateOutlet = "folderListTmpl; context:{ folder: file, folderPath:file.accessUrl.split(selectedDestination.url)[1]}"></ng-container>
|
||||||
|
</ng-container>
|
||||||
|
<ng-template #itsFile>
|
||||||
|
<ng-container *ngTemplateOutlet="fileTmpl; context: { file: file}"></ng-container>
|
||||||
|
</ng-template>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #fileTmpl let-file="file">
|
||||||
|
<div class="uk-grid uk-grid-small uk-flex uk-flex-middle">
|
||||||
|
<span uk-icon="file"></span>
|
||||||
|
<span class="uk-width-expand uk-text-truncate">{{file['name']}}</span>
|
||||||
|
<span class="uk-width-auto uk-text-truncate">{{(file.createdAt?file.createdAt:file.modifiedAt) |date : 'medium'}}</span>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #folderTmpl let-folder="folder" let-folderPath="folderPath">
|
||||||
|
<div *ngIf="folder" [class.uk-background-muted]="destinationPath == folderPath">
|
||||||
|
<div class="uk-grid uk-grid-small uk-flex uk-flex-middle">
|
||||||
|
<a (click)="browseFolder(folderPath)">
|
||||||
|
<div class="uk-grid uk-grid-small">
|
||||||
|
<span uk-icon="triangle-down"></span> <span uk-icon="folder"></span>
|
||||||
|
<span
|
||||||
|
class="uk-width-expand uk-text-truncate">{{folder.name?folder.name:folder.accessUrl.split(selectedDestination.url)[1]}}</span>
|
||||||
|
<span class="uk-width-auto uk-text-truncate">{{(folder.createdAt?folder.createdAt:folder.modifiedAt) |date : 'medium'}}</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a *ngIf="destinationPath != folderPath" (click)="destinationPath = folderPath" class="uk-button uk-button-default uk-button-small">select</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
|
@ -11,110 +11,25 @@ declare var UIkit;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'egi-transfer-data',
|
selector: 'egi-transfer-data',
|
||||||
template: `
|
templateUrl:'./transferData.component.html'
|
||||||
<a (click)="open()"
|
|
||||||
[title]="'Send data to cloud storage [demo]'"
|
|
||||||
[attr.uk-tooltip]="'pos: right; cls: uk-active 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 -->
|
|
||||||
<modal-alert #egiTransferModal large="true" >
|
|
||||||
<div *ngIf="!accessToken" class="">
|
|
||||||
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom uk-text-center">
|
|
||||||
In order to send data to a Cloud Storage, you would need to be authenticated, please login via EGI check-in.
|
|
||||||
</div>
|
|
||||||
<div class="uk-text-center">
|
|
||||||
<button *ngIf="!accessToken" class="uk-button uk-button-default" (click)="checkin()">Login
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="accessToken" class="">
|
|
||||||
<div class="uk-width-1-1 uk-margin-top uk-margin-bottom uk-text-center">
|
|
||||||
You have requested to send the data corresponding to the DOI <a [href]="selectedSourceUrl" target="_blank">{{selectedSourceUrl.split(doiPrefix)[1]}}</a> to a cloud storage using the EOSC Data Transfer service
|
|
||||||
</div>
|
|
||||||
<div class="uk-grid uk-child-width-1-2 uk-grid-divider">
|
|
||||||
<div class="uk-first-column">
|
|
||||||
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top">Available Zenodo DOI URLs:</p>
|
|
||||||
<div input type="select" [(value)]="selectedSourceUrl" placeholder="Zenodo DOI URL" hint="Select..."
|
|
||||||
[options]="sourceUrls" (valueChange)="this.parse()"></div>
|
|
||||||
<div *ngIf="status!='loading'" class="uk-margin-top">
|
|
||||||
<div>{{this.downloadElements.length}} files found:</div>
|
|
||||||
<div class="uk-overflow-auto" style="max-height: 135px">
|
|
||||||
<ul>
|
|
||||||
<li *ngFor=" let element of this.downloadElements">{{ element.name}}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="!this.downloadElements || this.downloadElements.length == 0"> - </div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p class="uk-text-meta uk-text-xsmall uk-margin-remove-bottom uk-margin-top">Please select the Destination Storage type and provide the corresponding storage destination path.</p>
|
|
||||||
<div input type="select" [(value)]="selectedDestination" placeholder="Destination Storage" hint="Select..."
|
|
||||||
[options]="destinationOptions"></div>
|
|
||||||
<div input [(value)]="destinationPath" placeholder="Give a destination path..."
|
|
||||||
[validators]="validators" class="uk-margin-top"></div>
|
|
||||||
<!--<button (click)="browse()"
|
|
||||||
class="uk-button uk-button-primary uk-margin-top"
|
|
||||||
>
|
|
||||||
Browse
|
|
||||||
</button>-->
|
|
||||||
<button (click)="transfer()"
|
|
||||||
class="uk-button uk-button-primary uk-margin-top"
|
|
||||||
[class.uk-disabled]="destinationPath.length == 0 || status == 'success' ||status == 'loading' || !validatePath() || (!this.downloadElements || this.downloadElements.length == 0)">
|
|
||||||
>> Transfer
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="status == 'loading'" class="uk-flex uk-flex-center uk-text-muted">
|
|
||||||
<div>
|
|
||||||
<span class="uk-icon uk-spinner">
|
|
||||||
<svg width="60" height="60" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
|
|
||||||
data-svg="spinner"><circle
|
|
||||||
fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 2px;"></circle></svg>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="message" class="uk-width-1-1 uk-alert"
|
|
||||||
[class.uk-alert-success]="status && status.indexOf('error')==-1"
|
|
||||||
[class.uk-alert-error]="status && status.indexOf('error')!=-1"
|
|
||||||
[innerHTML]="message">
|
|
||||||
</div>
|
|
||||||
<!--<div *ngIf="jobId || status == 'canceled'">
|
|
||||||
<button *ngIf=" status != 'canceled'" class="uk-button uk-button-default" (click)="getStatus()">Check status</button>
|
|
||||||
<button *ngIf=" status != 'canceled'" class="uk-button uk-button-default" (click)="cancel()">Cancel</button>
|
|
||||||
<div>{{statusMessage}}</div>
|
|
||||||
</div>-->
|
|
||||||
<div *ngIf=" status != 'canceled'" class="uk-width-1-1 uk-text-right "
|
|
||||||
[class.uk-invisible]="!(status == 'success' || status.indexOf('error')!=-1)">
|
|
||||||
<button class="uk-button uk-button-default uk-margin-top " (click)="close()">Close</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
||||||
|
|
||||||
`
|
|
||||||
})
|
})
|
||||||
export class EGIDataTransferComponent {
|
export class EGIDataTransferComponent {
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
accessToken = null;
|
accessToken = {};
|
||||||
@Input() dois;
|
@Input() dois;
|
||||||
loginURL = properties.environment == "development"? "http://rudie.di.uoa.gr:8580/openid_connect_login":"https://explore.eosc-portal.eu/egi-login-service/openid_connect_login"
|
loginURL = properties.environment == "development"? "http://rudie.di.uoa.gr:8580/openid_connect_login":"https://explore.eosc-portal.eu/egi-login-service/openid_connect_login"
|
||||||
sourceUrls = []
|
sourceUrls = [];
|
||||||
selectedSourceUrl = null;
|
selectedSourceUrl = null;
|
||||||
destinationPath = "";
|
destinationPath = "";
|
||||||
destinationOptions = [{label: "EGI dCache (dcache-demo.desy.de)", value: {label: "EGI dCache (dcache-demo.desy.de)", url: "https://dcache-demo.desy.de:2443", id: "dcache" , webpage:"https://dcache-demo.desy.de"} }];
|
destinationOptions = properties.eoscDataTransferDestinations;
|
||||||
selectedDestination = null;
|
selectedDestination = null;
|
||||||
|
folders = {};
|
||||||
|
files = {};
|
||||||
downloadElements = null;
|
downloadElements = null;
|
||||||
@Input() isOpen = false;
|
@Input() isOpen = false;
|
||||||
|
@Input() selectedDestinationId = "dcache";
|
||||||
@ViewChild('egiTransferModal') egiTransferModal;
|
@ViewChild('egiTransferModal') egiTransferModal;
|
||||||
APIURL = "https://eosc-data-transfer.vm.fedcloud.eu"
|
APIURL = properties.eoscDataTransferAPI;
|
||||||
// APIURL = "https://virtserver.swaggerhub.com/thebe14/eosc-future-data-transfer/1.0.0";
|
|
||||||
status: "loading" | "success" | "errorParser" | "errorUser" | "errorTransfer" | "init" | "canceled" = "init";
|
status: "loading" | "success" | "errorParser" | "errorUser" | "errorTransfer" | "init" | "canceled" = "init";
|
||||||
message;
|
message;
|
||||||
doiPrefix = properties.doiURL;
|
doiPrefix = properties.doiURL;
|
||||||
|
@ -141,8 +56,18 @@ export class EGIDataTransferComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
open(){
|
open(){
|
||||||
this.accessToken = COOKIE.getCookie("EGIAccessToken");
|
if(this.selectedDestinationId){
|
||||||
if(this.accessToken) {
|
for( let option of this.destinationOptions){
|
||||||
|
if(this.selectedDestinationId == option.value.id){
|
||||||
|
this.selectedDestination = option.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.selectedDestination = this.destinationOptions[0].value;
|
||||||
|
}
|
||||||
|
if(this.selectedDestination.cookieName && COOKIE.getCookie(this.selectedDestination.cookieName)) {
|
||||||
|
this.accessToken[this.selectedDestination.id] = COOKIE.getCookie(this.selectedDestination.cookieName);
|
||||||
|
}
|
||||||
for (let doi of this.dois) {
|
for (let doi of this.dois) {
|
||||||
if (doi.indexOf("zenodo.") != -1) {
|
if (doi.indexOf("zenodo.") != -1) {
|
||||||
this.sourceUrls.push(this.doiPrefix + doi);
|
this.sourceUrls.push(this.doiPrefix + doi);
|
||||||
|
@ -155,9 +80,9 @@ export class EGIDataTransferComponent {
|
||||||
}catch (e){}
|
}catch (e){}
|
||||||
|
|
||||||
this.selectedSourceUrl = this.sourceUrls[0];
|
this.selectedSourceUrl = this.sourceUrls[0];
|
||||||
this.selectedDestination = this.destinationOptions[0].value;
|
|
||||||
this.parse();
|
this.parse();
|
||||||
}
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
this.egiTransferModal.cancelButton = false;
|
this.egiTransferModal.cancelButton = false;
|
||||||
this.egiTransferModal.okButton = false;
|
this.egiTransferModal.okButton = false;
|
||||||
|
@ -216,7 +141,7 @@ export class EGIDataTransferComponent {
|
||||||
transfer() {
|
transfer() {
|
||||||
// console.log(this.selectedDestination)
|
// console.log(this.selectedDestination)
|
||||||
this.status = "loading";
|
this.status = "loading";
|
||||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
this.subscriptions.push(this.http.get(this.APIURL + "/user/info?dest="+this.selectedDestination.id, {headers: headers}).subscribe(
|
this.subscriptions.push(this.http.get(this.APIURL + "/user/info?dest="+this.selectedDestination.id, {headers: headers}).subscribe(
|
||||||
res => {
|
res => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
|
@ -242,7 +167,7 @@ export class EGIDataTransferComponent {
|
||||||
body.files.push(file);
|
body.files.push(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
this.subscriptions.push(this.http.post(this.APIURL + "/transfers" ,body, {headers: headers}).subscribe(
|
this.subscriptions.push(this.http.post(this.APIURL + "/transfers" ,body, {headers: headers}).subscribe(
|
||||||
res => {
|
res => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
|
@ -302,7 +227,7 @@ export class EGIDataTransferComponent {
|
||||||
if(this.jobId){
|
if(this.jobId){
|
||||||
|
|
||||||
|
|
||||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
let source = this.http.get(this.APIURL + "/transfer/" +this.jobId , {headers: headers}).pipe(delay(5000));
|
let source = this.http.get(this.APIURL + "/transfer/" +this.jobId , {headers: headers}).pipe(delay(5000));
|
||||||
this.subscriptions.push(source.pipe(repeat(3)).subscribe(
|
this.subscriptions.push(source.pipe(repeat(3)).subscribe(
|
||||||
res => {
|
res => {
|
||||||
|
@ -353,9 +278,7 @@ export class EGIDataTransferComponent {
|
||||||
|
|
||||||
cancel(){
|
cancel(){
|
||||||
if(this.jobId){
|
if(this.jobId){
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
|
||||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
|
||||||
this.subscriptions.push(this.http.delete(this.APIURL + "/transfer/" +this.jobId , {headers: headers}).subscribe(
|
this.subscriptions.push(this.http.delete(this.APIURL + "/transfer/" +this.jobId , {headers: headers}).subscribe(
|
||||||
res => {
|
res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
@ -367,18 +290,55 @@ export class EGIDataTransferComponent {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
browse(){
|
hasBrowse(){
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
this.subscriptions.push(this.http.get(this.APIURL + "/storage/info?dest="+this.selectedDestination.id+"&seUrl="+encodeURIComponent(this.selectedDestination.url + this.destinationPath) , {headers: headers}).subscribe(
|
||||||
|
res => {
|
||||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
console.log(res);
|
||||||
this.subscriptions.push(this.http.get(this.APIURL + "/storage/folder?dest="+this.selectedDestination.id+"&seUrl="+encodeURIComponent(this.destinationPath) , {headers: headers}).subscribe(
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
getFolder(folderPath){
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
this.subscriptions.push(this.http.get(this.APIURL + "/storage/folder?dest="+this.selectedDestination.id+"&seUrl="+encodeURIComponent(this.selectedDestination.url + folderPath) , {headers: headers}).subscribe(
|
||||||
|
res => {
|
||||||
|
this.folders[folderPath]= res;
|
||||||
|
this.folders[folderPath]['isOpen'] = true;
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
browseFolder(folderPath){
|
||||||
|
if(this.folders[folderPath]){
|
||||||
|
this.folders[folderPath].isOpen = !this.folders[folderPath].isOpen;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.getFolder(folderPath);
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
this.subscriptions.push(this.http.get(this.APIURL + "/storage/folder/list?dest="+this.selectedDestination.id+"&folderUrl="+encodeURIComponent(this.selectedDestination.url + folderPath) , {headers: headers}).subscribe(
|
||||||
|
res => {
|
||||||
|
this.files[folderPath]= res['elements'];
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
createFolder(){
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
this.subscriptions.push(this.http.post(this.APIURL + "/storage/folder?dest="+this.selectedDestination.id+"&seUrl="+
|
||||||
|
encodeURIComponent(this.selectedDestination.url + this.destinationPath + "test1/") , {headers: headers}).subscribe(
|
||||||
|
res => {
|
||||||
|
console.log(res);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
deleteFolder(){
|
||||||
|
|
||||||
|
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||||
|
this.subscriptions.push(this.http.delete(this.APIURL + "/storage/folder?dest="+this.selectedDestination.id+"&seUrl="+encodeURIComponent(this.selectedDestination.url + this.destinationPath + "test1/") , {headers: headers}).subscribe(
|
||||||
res => {
|
res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
this.jobStatus = res;
|
|
||||||
this.statusMessage = res['jobState'] + (res['reason']?(" :" + res['reason']):"");
|
|
||||||
this.jobId = null;
|
|
||||||
this.status = "canceled";
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -142,4 +142,6 @@ export interface EnvProperties {
|
||||||
footerGrantText?: string;
|
footerGrantText?: string;
|
||||||
egiNotebookLink?: string;
|
egiNotebookLink?: string;
|
||||||
connectPortalUrl?;
|
connectPortalUrl?;
|
||||||
|
eoscDataTransferAPI?;
|
||||||
|
eoscDataTransferDestinations?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue