diff --git a/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.html b/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.html index c5a6af85..919b9e77 100644 --- a/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.html @@ -21,7 +21,7 @@
Show - @@ -83,8 +83,7 @@ {{claim.date}} - - + diff --git a/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts b/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts index 5a607c17..ef5fea12 100644 --- a/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -165,9 +165,7 @@ export class DisplayClaimsComponent { } } - goToClaim(claimId: number){ - this._router.navigate( ['Claim', { id: claimId}] ); - } + goTo(page:number = 1){ this.page = page; @@ -205,8 +203,7 @@ export class DisplayClaimsComponent { return params; } changeSize(size: number ){ - this.size = size; - this.goTo(); + this.goTo(); } clearFilters(){ @@ -219,6 +216,7 @@ export class DisplayClaimsComponent { this.entityTypes = []; this.goTo(); } + changeOrderby(sortby:string){ if(sortby==this.sortby){ this.descending = !this.descending; diff --git a/portal-2/src/app/claims/claim-utils/service/claims.service.ts b/portal-2/src/app/claims/claim-utils/service/claims.service.ts index 26655d2e..01f35f78 100644 --- a/portal-2/src/app/claims/claim-utils/service/claims.service.ts +++ b/portal-2/src/app/claims/claim-utils/service/claims.service.ts @@ -121,7 +121,7 @@ export class ClaimsService { let options = new RequestOptions({ headers: headers }); return this.http.post(url, body, options) .map(res => res.json()) - .do(request => console.info("Insert Response:"+request.status) ) + .do(request => console.info("Insert Response:"+request) ) .catch(this.handleError); } diff --git a/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts b/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts index 1066eb24..75190374 100644 --- a/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts +++ b/portal-2/src/app/claims/linking/bulkClaim/bulkClaim.component.ts @@ -32,7 +32,7 @@ import {Dates, DOI} from '../../../utils/string-utils.class';
- + @@ -95,6 +95,8 @@ export class BulkClaimComponent { this.errorMessage = "There is no selected file to upload."; return ; } + this.loading.open(); + this.makeFileRequest("http://localhost:8000/upload", [], this.filesToUpload).then((result) => { var rows = (result as any).split('\n'); // I have used space, you can use any thing. var i = 0; @@ -131,7 +133,7 @@ export class BulkClaimComponent { }, (error) => { this.enableUpload = true; console.log(error); - // this.loading.close(); + this.loading.close(); this.errorMessage = "An error occured while uploading..."; }); } @@ -208,6 +210,8 @@ export class BulkClaimComponent { if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length+this.noValidIds.length ){ this.showReport = true; this.enableUpload = true; + this.loading.close(); + } } diff --git a/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts b/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts index b7b23aea..49f4ad03 100644 --- a/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts +++ b/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts @@ -13,9 +13,8 @@ import {ErrorCodes} from '../../../login/utils/guardHelper.class'; @Component({ selector: 'claim-insert', template: ` -
- +
@@ -52,7 +51,6 @@ export class ClaimInsertComponent { public warningMessage = ""; public claimsTODO:number = 0; public claims:number = 0; - public errorclaims:number = 0; private servicesRespond:number = 0; private insertedClaims=[]; @@ -122,58 +120,41 @@ private insert(){ } } - // var created =[]; - // var failed =[]; console.info("\n\ndirectclaims: "+directclaims.length+"\n\n"); - // for(var i = 0; i { - // console.log("AAA" + data); - // created.push(directclaims[i].originalId) - // }, - // err => { - // console.log(err); - // failed.push(directclaims[i].originalId) - // if(failed.length + created.length == directclaims.length){ - // console.log("failed:"+failed); - // console.log("created:"+created); - // - // } - // } - // ); - // } - this.claimService.insertDirectRecords(directclaims,token).subscribe( data => { this.insertedRecords = data.insertedIds; - this.errorInRecords = data.insertedIds; + this.errorInRecords = data.errorInClaims; this.afterclaimsInsertion(); }, err => { - console.log(err); - this.insertedRecords = err.insertedIds; - - this.errorInRecords = err.insertedIds; - this.errorsInClaimsInsertion(); + err=err.json(); + if(err.insertedIds && err.insertedIds.length >0){ + this.insertedRecords = err.insertedIds; + } + if(err.errorInClaims && err.errorInClaims.length >0){ + this.errorInRecords = err.errorInClaims; + } + this.afterclaimsInsertion(); } ); console.info("try to insert "+claims.length+" claims"); this.claimService.insertBulkClaims(claims,token).subscribe( data => { - this.insertedClaims = data.insertedIds; - - this.errorclaims = data.insertedIds; + this.insertedClaims = data.insertedIds; + this.errorInClaims = data.errorInClaims; this.afterclaimsInsertion(); }, err => { - console.log(err); - this.insertedClaims = err.insertedIds; - - this.errorclaims = err.insertedIds; - this.errorsInClaimsInsertion(); + err=err.json(); + if(err.insertedIds && err.insertedIds.length >0){ + this.insertedClaims = err.insertedIds; + } + if(err.errorInClaims && err.errorInClaims.length >0){ + this.errorInClaims = err.errorInClaims; + } + this.afterclaimsInsertion(); } ); } @@ -231,16 +212,15 @@ private validateDates(){ return true; } private afterclaimsInsertion(){ + this.servicesRespond++; if(this.servicesRespond == 2){ this.loading.close(); this.claiming = false; + if(this.errorInClaims.length == 0 && this.insertedClaims.length > 0 && this.errorInRecords.length == 0){ - // if(this.inline){ - // this.show = "end"; - // }else{ + this._router.navigate( ['/myclaims'] ); - // } this.showChange.emit({ value: this.show }); @@ -250,30 +230,37 @@ private afterclaimsInsertion(){ } } private errorsInClaimsInsertion(){ - this.errorMessage = "An Error Occured."; + this.errorMessage = ""; this.loading.close(); this.error = true; this.claiming = false; this.showButton = true; var text ="" + console.log("Errors: this.errorInRecords.length: "+this.errorInRecords.length+" - this.errorInClaims.length: "+this.errorInClaims.length); if(this.errorInRecords.length>0){ - text+="The following records couldn't automatically inserted to the Openaire Info space:
"; + text+="
The following records couldn't automatically inserted to the Openaire Info space:
    "; for(var i=0; i< this.errorInRecords.length ; i++){ for(var k=0; k< this.results.length ; k++){ if(this.results[k].id == this.errorInRecords[i]){ - text+=""+this.results[i].title+" url:"+this.results[i].url+" from "+this.results[i].source; + text+="
  • "+this.results[i].title+" from "+this.results[i].source+"
  • "; } } } + text+="
"; } - if(this.errorsInClaimsInsertion.length > 0){ - text+="The following couldn't be saved:
"; - for(var i=0; i< this.errorsInClaimsInsertion.length ; i++){ - text+="The following couldn't be saved:
"; + if(this.errorInClaims.length > 0){ + text+="
The following links couldn't be saved:
    "; + for(var i=0; i< this.errorInClaims.length ; i++){ + // var claim = { claimedBy : user, sourceId : context.concept.id, sourceType : "context", sourceCollectedFrom:"openaire", sourceAccessRights:"OPEN", sourceEmbargoEndDate:"no", targetId : result.id , targetType : result.type, targetCollectedFrom: result.source, targetAccessRights:result.accessRights, targetEmbargoEndDate: (result.embargoEndDate == null?"":result.embargoEndDate)}; + + text+="
  • "+this.errorInClaims[i].sourceType+": "+this.errorInClaims[i].sourceId +"(from"+this.errorInClaims[i].sourceCollectedFrom+") link to "+this.errorInClaims[i].targetType+": "+this.errorInClaims[i].targetId +"(from"+this.errorInClaims[i].targetCollectedFrom+")
  • "; } + text+="
"; } + this.errorMessage+="
An error occured:
"+text; + console.log(text); // if(this.inline){ // this.show = "error"; // this.showChange.emit({ @@ -359,43 +346,7 @@ createDirectClaim(result, projects, contexts){ console.log("\nJSON:\n"+json); return entity; -/* -{ - "originalId": "ORIG_ID_12345", - "title": "TEST TITLE", - "authors": [ - "Michele Artini", - "Claudio Atzori", - "Alessia Bardi" - ], - "publisher": "Test publisher", - "description": "DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION", - "language": "ita", - "pids": [ - { - "type": "doi", - "value": "10.000/xyz-123" - }, - { - "type": "oai", - "value": "oai:1234" - } - ], - "licenseCode": "OPEN", - "resourceType": "0001", - "url": "http://test.it/xyz", - "collectedFromId": "opendoar____::2659", - "hostedById": "opendoar____::2367", - "linksToProjects": [ - "info:eu-repo/grantAgreement/EC/FP7/283595/EU//OpenAIREplus", - "info:eu-repo/grantAgreement/EC/FP7/244909/EU/Making Capabilities Work/WorkAble" - ], - "contexts": [ - "egi::classification::natsc::math::pure", - "egi::classification::natsc::math::stats" - ] -} -*/ + } confirmOpen(){ diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts index f596725a..416219eb 100644 --- a/portal-2/src/app/utils/properties/openaireProperties.ts +++ b/portal-2/src/app/utils/properties/openaireProperties.ts @@ -34,7 +34,7 @@ export class OpenaireProperties { private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates"; // public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/" - private static claimsAPIURL = "https://scoobydoo.di.uoa.gr:8443/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"; + private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"; // private static searchAPIURL = " https://beta.services.openaire.eu/search/v2/api/"; // private searchAPIURL = "http://beta.services.openaire.eu/search/v2.0/api/"; diff --git a/portal-2/src/assets/favicon.ico b/portal-2/src/assets/favicon.ico new file mode 100644 index 00000000..151eca1b Binary files /dev/null and b/portal-2/src/assets/favicon.ico differ diff --git a/portal-2/src/index.html b/portal-2/src/index.html index 3d357c99..0e7fdda8 100644 --- a/portal-2/src/index.html +++ b/portal-2/src/index.html @@ -11,6 +11,7 @@ + Search OpenAIRE