diff --git a/src/app/utils/transferData.component.ts b/src/app/utils/transferData.component.ts
index c78ae54..6a21c7e 100644
--- a/src/app/utils/transferData.component.ts
+++ b/src/app/utils/transferData.component.ts
@@ -1,14 +1,25 @@
-import {Component} from '@angular/core';
+import {Component, Input} from '@angular/core';
import {Subscriber} from "rxjs";
import {HttpClient} from "@angular/common/http";
import {Validators} from "@angular/forms";
+import {Location} from '@angular/common';
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
+import {COOKIE, Session} from "../openaireLibrary/login/utils/helper.class";
+import {UserManagementService} from "../openaireLibrary/services/user-management.service";
+import {Router} from "@angular/router";
declare var UIkit;
@Component({
selector: 'egi-transfer-data',
template: `
- Transfer data to EGI storage
+
+
+
+
+
@@ -16,7 +27,7 @@ declare var UIkit;
-
+
Title
@@ -26,12 +37,12 @@ declare var UIkit;
laboris nisi ut aliquip ex ea commodo consequat.
-
-
+
Title
@@ -50,7 +61,7 @@ declare var UIkit;
Lorem ipsum ....
+ [validators]="validators[0]">
@@ -86,24 +97,36 @@ declare var UIkit;
`
})
-export class EGIDataTransfer {
+export class EGIDataTransferComponent {
subscriptions = [];
- loggedIn = false;
- sourceUrl = "https://doi.org/10.5281/zenodo.6507535";
+ accessToken = null;
+ @Input() dois;
+ loginURL = "http://rudie.di.uoa.gr:8580/openid_connect_login"
+ sourceUrl = null;
destinationPath = "";
destinationURL = "https://egi.storage.eu";
downloadElements = null;
- isOpen = false;
+ @Input() isOpen = false;
APIURL = "https://virtserver.swaggerhub.com/thebe14/eosc-future-data-transfer/1.0.0";
status: "loading" | "success" | "errorParser" | "errorUser" | "errorTransfer" | "init" = "init";
message;
validators = [Validators.required, StringUtils.urlValidator()];
- constructor(private http: HttpClient) {
+ constructor(private http: HttpClient, private location: Location, private userManagementsService: UserManagementService, private _router: Router) {
}
ngOnInit() {
+ console.log(COOKIE.getCookie("EGISession"))
+ this.accessToken = COOKIE.getCookie("EGISession");
+ for(let doi of this.dois){
+ console.log(doi)
+ if(doi.indexOf("zenodo.")!=-1){
+ this.sourceUrl = "https://doi.org/" + doi;
+ break;
+ }
+
+ }
}
ngOnDestroy() {
@@ -123,16 +146,25 @@ export class EGIDataTransfer {
this.destinationPath = "";
this.message = null;
this.status = "init";
+ if(this._router.url.indexOf("&egiTransfer")){
+ this.location.go(this._router.url.split("&egiTransfer")[0]);
+ }
+
}
checkin(){
- this.loggedIn = true;
+ // this.loggedIn = true;
+
+ console.log(COOKIE.getCookie("EGISession"))
+ // this.accessToken = COOKIE.getCookie("EGISession");
+ COOKIE.setCookie("EGISession", "test!!!!!!",10,"/" );
+ this.userManagementsService.setRedirectUrl(this._router.url+"&egiTransfer=t");
+ // this.location.go("/reload");
+ window.location.href = "/reload";
+ // window.location.href = this.loginURL;
+
}
parse(){
- // check get user info
- // .pipe(catch(error: any) => {
- // return Observable.throw(new Error(error.status));
- // }))
- this.status = "loading";
+ this.status = "loading";
this.subscriptions.push(this.http.get(this.APIURL + "/user/info").subscribe(
res => {
console.log(res)
diff --git a/src/app/utils/transferData.module.ts b/src/app/utils/transferData.module.ts
new file mode 100644
index 0000000..621ebf6
--- /dev/null
+++ b/src/app/utils/transferData.module.ts
@@ -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 { }