diff --git a/utils/dataTransfer/transferData.component.html b/utils/dataTransfer/transferData.component.html index afa70cc0..94f3c27f 100644 --- a/utils/dataTransfer/transferData.component.html +++ b/utils/dataTransfer/transferData.component.html @@ -25,11 +25,11 @@
You have requested to send the data corresponding to the DOI {{selectedSourceUrl.split(doiPrefix)[1]}} to a cloud storage using the EOSC Data Transfer service
-
+

Available DOI URLs:

-
{{this.downloadElements.length}} files found:
@@ -52,13 +52,12 @@

Please select the - Destination Storage technology:

-
+ Destination Storage type:

+
-

Provide the - corresponding storage destination url:

-
Specify the destination system (e.g. hostname:8080):

+
-

Provide the corresponding storage destination path:

-
Specify the destination path (e.g. /folder1/folder2):

+

or ) => { this.destinationOptions = res.map(dest => {return {"label": dest.destination, "value": dest}}); this.selectedDestination = res[0]; - this.sourceUrlValidators(); } )); @@ -138,7 +143,7 @@ export class EGIDataTransferComponent { this.egiTransferModal.cancelButton = false; this.egiTransferModal.okButton = true; this.egiTransferModal.okButtonText = ">> Transfer"; - this.egiTransferModal.alertTitle = "EOSC data transfer service [demo]"; + this.egiTransferModal.alertTitle = "EOSC data transfer [demo]"; this.egiTransferModal.stayOpen = true; this.init(); if(typeof document !== 'undefined') { @@ -208,6 +213,7 @@ export class EGIDataTransferComponent { this.status = "active"; this.message = ""; let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken}); + this.subscriptions.push(this.http.get(this.APIURL + "/user/info?dest="+this.selectedDestination.destination, {headers: headers}).subscribe( res => { // console.log(res) @@ -222,10 +228,9 @@ export class EGIDataTransferComponent { // console.log(this.selectedDestination) for (let element of this.downloadElements) { - let file = { "sources": [element['downloadUrl']], - "destinations": [this.destinationUrl + this.destinationPath + element.name], + "destinations": [(this.selectedDestination.destination == "s3" ? "s3://" : "https://") + this.destinationUrl + this.destinationPath + (this.destinationPath.endsWith("/") ? "" : "/") + element.name], }; //TODO priority? checksum? filesize? @@ -468,32 +473,23 @@ export class EGIDataTransferComponent { pathValidator(): ValidatorFn { return (control: AbstractControl): { [key: string]: string } | null => { if (!this.validatePath()) { - return {'error': 'Path should start and end with "/" e.g /path/'}; + return {'error': 'Path should start with "/" e.g /path'}; } return null; } } validatePath():boolean { - let exp1 = /^\/([A-z0-9-_+]+\/)*$/g; + let exp1 = /^\/([A-z0-9-_+])*$/g; return (this.destinationPath.length > 0 && this.destinationPath.match(exp1) != null) } validateDestinationUrl():boolean { - if(this.selectedDestination.destination == "s3") { - return (this.destinationUrl.length > 0 && new RegExp("("+this.s3UrlRegex+")|("+StringUtils.urlRegex+")").test(this.destinationUrl)); - } - return (this.destinationUrl.length > 0 && StringUtils.isValidUrl(this.destinationUrl)); + return (this.destinationUrl.length > 0 && new RegExp(this.hostnameRegex).test(this.destinationUrl)); } - public sourceUrlValidators() { - this.URLValidators = []; - if(this.selectedDestination.destination == 's3') { - this.URLValidators = [Validators.required, Validators.pattern("("+this.s3UrlRegex+")|("+StringUtils.urlRegex+")")]; - // this.URLValidators = [Validators.required, Validators.pattern(this.s3UrlRegex) || StringUtils.urlValidator]; - // this.URLValidators = [Validators.required, Validators.pattern(this.s3UrlRegex)]; - } else { - this.URLValidators = [Validators.required, StringUtils.urlValidator()]; - } - } + // public sourceUrlValidators() { + // this.URLValidators = []; + // this.URLValidators = [Validators.required, Validators.pattern(this.hostnameRegex)]; + // } }