Data transfer: revert changes to show login in the 1st step
This commit is contained in:
parent
cf1d3984ec
commit
ea935df5b7
|
@ -10,8 +10,16 @@
|
|||
|
||||
<!-- This is the modal -->
|
||||
<modal-alert #egiTransferModal large="true" >
|
||||
|
||||
<div *ngIf="selectedSourceUrl" class="">
|
||||
<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>
|
||||
|
@ -36,35 +44,27 @@
|
|||
<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-small uk-overflow-auto">
|
||||
<ng-container *ngTemplateOutlet="folderListTmpl; context: { folder : folders[selectedDestination.defaultFolder], folderPath: selectedDestination.defaultFolder}"></ng-container>
|
||||
</div>
|
||||
|
||||
[options]="destinationOptions"></div>
|
||||
<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"> or <a
|
||||
class="uk-text-primary" (click)="browseFolder(selectedDestination.defaultFolder)">browse</a> to
|
||||
select a folder.</p>
|
||||
<div *ngIf="folders[selectedDestination.defaultFolder]" class="uk-height-small uk-overflow-auto">
|
||||
<ng-container *ngTemplateOutlet="folderListTmpl; context: { folder : folders[selectedDestination.defaultFolder], folderPath: selectedDestination.defaultFolder}"></ng-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="selectedDestination.id == 'ftp'">
|
||||
<p>Comming soon!</p>
|
||||
</ng-container>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="selectedDestination.id == 'ftp'">
|
||||
<p>Comming soon!</p>
|
||||
</ng-container>
|
||||
|
||||
<button (click)="transfer()"
|
||||
class="uk-button uk-button-primary uk-margin-top"
|
||||
class="uk-button uk-button-primary uk-margin-top uk-float-right"
|
||||
[class.uk-disabled]="destinationPath.length == 0 || status == 'success' ||status == 'loading' || !validatePath() || (!this.downloadElements || this.downloadElements.length == 0)">
|
||||
>> Transfer
|
||||
</button>
|
||||
|
|
|
@ -15,7 +15,7 @@ declare var UIkit;
|
|||
})
|
||||
export class EGIDataTransferComponent {
|
||||
subscriptions = [];
|
||||
accessToken = {};
|
||||
accessToken = null;
|
||||
@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"
|
||||
sourceUrls = [];
|
||||
|
@ -56,33 +56,34 @@ export class EGIDataTransferComponent {
|
|||
|
||||
}
|
||||
open(){
|
||||
if(this.selectedDestinationId){
|
||||
for( let option of this.destinationOptions){
|
||||
if(this.selectedDestinationId == option.value.id){
|
||||
this.selectedDestination = option.value;
|
||||
this.accessToken = COOKIE.getCookie("EGIAccessToken");
|
||||
if(this.accessToken) {
|
||||
if (this.selectedDestinationId) {
|
||||
for (let option of this.destinationOptions) {
|
||||
if (this.selectedDestinationId == option.value.id) {
|
||||
this.selectedDestination = option.value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.selectedDestination = this.destinationOptions[0].value;
|
||||
}
|
||||
|
||||
for (let doi of this.dois) {
|
||||
if (doi.indexOf("zenodo.") != -1) {
|
||||
this.sourceUrls.push(this.doiPrefix + doi);
|
||||
}
|
||||
}
|
||||
}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) {
|
||||
if (doi.indexOf("zenodo.") != -1) {
|
||||
this.sourceUrls.push(this.doiPrefix + doi);
|
||||
try {
|
||||
this.sourceUrls.sort(function (a, b) {
|
||||
return Number(b.split("zenodo.")[1]) - Number(a.split("zenodo.")[1]);
|
||||
});
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
this.selectedSourceUrl = this.sourceUrls[0];
|
||||
|
||||
this.parse();
|
||||
}
|
||||
try {
|
||||
this.sourceUrls.sort(function (a, b) {
|
||||
return Number(b.split("zenodo.")[1]) - Number(a.split("zenodo.")[1]);
|
||||
});
|
||||
}catch (e){}
|
||||
|
||||
this.selectedSourceUrl = this.sourceUrls[0];
|
||||
|
||||
this.parse();
|
||||
|
||||
this.isOpen = true;
|
||||
this.egiTransferModal.cancelButton = false;
|
||||
this.egiTransferModal.okButton = false;
|
||||
|
@ -141,7 +142,7 @@ export class EGIDataTransferComponent {
|
|||
transfer() {
|
||||
// console.log(this.selectedDestination)
|
||||
this.status = "loading";
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
this.subscriptions.push(this.http.get(this.APIURL + "/user/info?dest="+this.selectedDestination.id, {headers: headers}).subscribe(
|
||||
res => {
|
||||
// console.log(res)
|
||||
|
@ -167,7 +168,7 @@ export class EGIDataTransferComponent {
|
|||
body.files.push(file);
|
||||
}
|
||||
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
this.subscriptions.push(this.http.post(this.APIURL + "/transfers" ,body, {headers: headers}).subscribe(
|
||||
res => {
|
||||
// console.log(res)
|
||||
|
@ -227,7 +228,7 @@ export class EGIDataTransferComponent {
|
|||
if(this.jobId){
|
||||
|
||||
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
let source = this.http.get(this.APIURL + "/transfer/" +this.jobId , {headers: headers}).pipe(delay(5000));
|
||||
this.subscriptions.push(source.pipe(repeat(3)).subscribe(
|
||||
res => {
|
||||
|
@ -278,7 +279,7 @@ export class EGIDataTransferComponent {
|
|||
|
||||
cancel(){
|
||||
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(
|
||||
res => {
|
||||
console.log(res);
|
||||
|
@ -291,7 +292,7 @@ export class EGIDataTransferComponent {
|
|||
}
|
||||
}
|
||||
hasBrowse(){
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
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 => {
|
||||
console.log(res);
|
||||
|
@ -300,7 +301,8 @@ export class EGIDataTransferComponent {
|
|||
|
||||
}
|
||||
getFolder(folderPath){
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
//TODO is this necessary?
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
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;
|
||||
|
@ -315,7 +317,7 @@ export class EGIDataTransferComponent {
|
|||
return;
|
||||
}
|
||||
this.getFolder(folderPath);
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
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'];
|
||||
|
@ -324,7 +326,7 @@ export class EGIDataTransferComponent {
|
|||
|
||||
}
|
||||
createFolder(){
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken[this.selectedDestination.id]});
|
||||
let headers = new HttpHeaders({'Authorization': 'Bearer '+this.accessToken});
|
||||
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 => {
|
||||
|
@ -335,7 +337,7 @@ export class EGIDataTransferComponent {
|
|||
}
|
||||
deleteFolder(){
|
||||
|
||||
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 + "/storage/folder?dest="+this.selectedDestination.id+"&seUrl="+encodeURIComponent(this.selectedDestination.url + this.destinationPath + "test1/") , {headers: headers}).subscribe(
|
||||
res => {
|
||||
console.log(res);
|
||||
|
|
Loading…
Reference in New Issue