enable loading while upload bulk records | show first draft of error report in case insert fail | add favicon | small bug fixes
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47042 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
bf6c47a309
commit
e7f4859e84
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
<div *ngIf="resultsNum>0" class="">
|
<div *ngIf="resultsNum>0" class="">
|
||||||
<span > Show
|
<span > Show
|
||||||
<select *ngIf="resultsNum>10" [(ngModel)]="size" name="select_size" >
|
<select *ngIf="resultsNum>10" [(ngModel)]="size" name="select_size" (ngModelChange)="changeSize(size)" >
|
||||||
<option *ngFor="let size of sizes" [value]="size">{{size}}</option>
|
<option *ngFor="let size of sizes" [value]="size">{{size}}</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
|
@ -84,7 +84,6 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<modal-alert (alertOutput)="confirmClose($event)">
|
<modal-alert (alertOutput)="confirmClose($event)">
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
||||||
|
|
|
@ -165,9 +165,7 @@ export class DisplayClaimsComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goToClaim(claimId: number){
|
|
||||||
this._router.navigate( ['Claim', { id: claimId}] );
|
|
||||||
}
|
|
||||||
goTo(page:number = 1){
|
goTo(page:number = 1){
|
||||||
|
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
@ -205,8 +203,7 @@ export class DisplayClaimsComponent {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
changeSize(size: number ){
|
changeSize(size: number ){
|
||||||
this.size = size;
|
this.goTo();
|
||||||
this.goTo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearFilters(){
|
clearFilters(){
|
||||||
|
@ -219,6 +216,7 @@ export class DisplayClaimsComponent {
|
||||||
this.entityTypes = [];
|
this.entityTypes = [];
|
||||||
this.goTo();
|
this.goTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
changeOrderby(sortby:string){
|
changeOrderby(sortby:string){
|
||||||
if(sortby==this.sortby){
|
if(sortby==this.sortby){
|
||||||
this.descending = !this.descending;
|
this.descending = !this.descending;
|
||||||
|
|
|
@ -121,7 +121,7 @@ export class ClaimsService {
|
||||||
let options = new RequestOptions({ headers: headers });
|
let options = new RequestOptions({ headers: headers });
|
||||||
return this.http.post(url, body, options)
|
return this.http.post(url, body, options)
|
||||||
.map(res => res.json())
|
.map(res => res.json())
|
||||||
.do(request => console.info("Insert Response:"+request.status) )
|
.do(request => console.info("Insert Response:"+request) )
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import {Dates, DOI} from '../../../utils/string-utils.class';
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="errorMessage.length > 0 " class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
<div *ngIf="errorMessage.length > 0 " class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
||||||
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
<modal-loading [message]= "'Uploading, reading and fetching results from your document. Please give us a moment..'"></modal-loading>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +95,8 @@ export class BulkClaimComponent {
|
||||||
this.errorMessage = "There is no selected file to upload.";
|
this.errorMessage = "There is no selected file to upload.";
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
this.loading.open();
|
||||||
|
|
||||||
this.makeFileRequest("http://localhost:8000/upload", [], this.filesToUpload).then((result) => {
|
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 rows = (result as any).split('\n'); // I have used space, you can use any thing.
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
@ -131,7 +133,7 @@ export class BulkClaimComponent {
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.enableUpload = true;
|
this.enableUpload = true;
|
||||||
console.log(error);
|
console.log(error);
|
||||||
// this.loading.close();
|
this.loading.close();
|
||||||
this.errorMessage = "An error occured while uploading...";
|
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 ){
|
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length+ this.duplicateIds.length+this.noValidIds.length ){
|
||||||
this.showReport = true;
|
this.showReport = true;
|
||||||
this.enableUpload = true;
|
this.enableUpload = true;
|
||||||
|
this.loading.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,8 @@ import {ErrorCodes} from '../../../login/utils/guardHelper.class';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'claim-insert',
|
selector: 'claim-insert',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div *ngIf="errorMessage.length > 0">
|
<div *ngIf="errorMessage.length > 0">
|
||||||
<div class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
<div class="uk-alert uk-alert-danger" role="alert" [innerHTML]="errorMessage"></div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="warningMessage.length > 0">
|
<div *ngIf="warningMessage.length > 0">
|
||||||
<div class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
|
<div class="uk-alert uk-alert-warning" role="alert">{{warningMessage}}</div>
|
||||||
|
@ -52,7 +51,6 @@ export class ClaimInsertComponent {
|
||||||
public warningMessage = "";
|
public warningMessage = "";
|
||||||
public claimsTODO:number = 0;
|
public claimsTODO:number = 0;
|
||||||
public claims:number = 0;
|
public claims:number = 0;
|
||||||
public errorclaims:number = 0;
|
|
||||||
|
|
||||||
private servicesRespond:number = 0;
|
private servicesRespond:number = 0;
|
||||||
private insertedClaims=[];
|
private insertedClaims=[];
|
||||||
|
@ -122,58 +120,41 @@ private insert(){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// var created =[];
|
|
||||||
// var failed =[];
|
|
||||||
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
|
console.info("\n\ndirectclaims: "+directclaims.length+"\n\n");
|
||||||
// for(var i = 0; i<directclaims.length; i++){
|
|
||||||
// // console.info("\n\ntry to direct insert: "+JSON.stringify(directclaims[i])+"\n\n");
|
|
||||||
//
|
|
||||||
// this.directIndexClaimService.directClaim(directclaims[i]).subscribe(
|
|
||||||
// data => {
|
|
||||||
// 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(
|
this.claimService.insertDirectRecords(directclaims,token).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.insertedRecords = data.insertedIds;
|
this.insertedRecords = data.insertedIds;
|
||||||
|
|
||||||
this.errorInRecords = data.insertedIds;
|
this.errorInRecords = data.errorInClaims;
|
||||||
this.afterclaimsInsertion();
|
this.afterclaimsInsertion();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.log(err);
|
err=err.json();
|
||||||
this.insertedRecords = err.insertedIds;
|
if(err.insertedIds && err.insertedIds.length >0){
|
||||||
|
this.insertedRecords = err.insertedIds;
|
||||||
this.errorInRecords = err.insertedIds;
|
}
|
||||||
this.errorsInClaimsInsertion();
|
if(err.errorInClaims && err.errorInClaims.length >0){
|
||||||
|
this.errorInRecords = err.errorInClaims;
|
||||||
|
}
|
||||||
|
this.afterclaimsInsertion();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.info("try to insert "+claims.length+" claims");
|
console.info("try to insert "+claims.length+" claims");
|
||||||
this.claimService.insertBulkClaims(claims,token).subscribe(
|
this.claimService.insertBulkClaims(claims,token).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.insertedClaims = data.insertedIds;
|
this.insertedClaims = data.insertedIds;
|
||||||
|
this.errorInClaims = data.errorInClaims;
|
||||||
this.errorclaims = data.insertedIds;
|
|
||||||
this.afterclaimsInsertion();
|
this.afterclaimsInsertion();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.log(err);
|
err=err.json();
|
||||||
this.insertedClaims = err.insertedIds;
|
if(err.insertedIds && err.insertedIds.length >0){
|
||||||
|
this.insertedClaims = err.insertedIds;
|
||||||
this.errorclaims = err.insertedIds;
|
}
|
||||||
this.errorsInClaimsInsertion();
|
if(err.errorInClaims && err.errorInClaims.length >0){
|
||||||
|
this.errorInClaims = err.errorInClaims;
|
||||||
|
}
|
||||||
|
this.afterclaimsInsertion();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -231,16 +212,15 @@ private validateDates(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
private afterclaimsInsertion(){
|
private afterclaimsInsertion(){
|
||||||
|
|
||||||
this.servicesRespond++;
|
this.servicesRespond++;
|
||||||
if(this.servicesRespond == 2){
|
if(this.servicesRespond == 2){
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
this.claiming = false;
|
this.claiming = false;
|
||||||
|
|
||||||
if(this.errorInClaims.length == 0 && this.insertedClaims.length > 0 && this.errorInRecords.length == 0){
|
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._router.navigate( ['/myclaims'] );
|
||||||
// }
|
|
||||||
this.showChange.emit({
|
this.showChange.emit({
|
||||||
value: this.show
|
value: this.show
|
||||||
});
|
});
|
||||||
|
@ -250,30 +230,37 @@ private afterclaimsInsertion(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private errorsInClaimsInsertion(){
|
private errorsInClaimsInsertion(){
|
||||||
this.errorMessage = "An Error Occured.";
|
this.errorMessage = "";
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
this.error = true;
|
this.error = true;
|
||||||
this.claiming = false;
|
this.claiming = false;
|
||||||
this.showButton = true;
|
this.showButton = true;
|
||||||
var text =""
|
var text =""
|
||||||
|
console.log("Errors: this.errorInRecords.length: "+this.errorInRecords.length+" - this.errorInClaims.length: "+this.errorInClaims.length);
|
||||||
if(this.errorInRecords.length>0){
|
if(this.errorInRecords.length>0){
|
||||||
text+="The following records couldn't automatically inserted to the Openaire Info space: <br>";
|
text+="<div>The following records couldn't automatically inserted to the Openaire Info space: <ul>";
|
||||||
for(var i=0; i< this.errorInRecords.length ; i++){
|
for(var i=0; i< this.errorInRecords.length ; i++){
|
||||||
for(var k=0; k< this.results.length ; k++){
|
for(var k=0; k< this.results.length ; k++){
|
||||||
if(this.results[k].id == this.errorInRecords[i]){
|
if(this.results[k].id == this.errorInRecords[i]){
|
||||||
text+=""+this.results[i].title+" url:"+this.results[i].url+" from "+this.results[i].source;
|
text+="<li>"+this.results[i].title+" from "+this.results[i].source+"</li>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
text+="</ul></div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
if(this.errorsInClaimsInsertion.length > 0){
|
if(this.errorInClaims.length > 0){
|
||||||
text+="The following couldn't be saved: <br>";
|
text+="<div>The following links couldn't be saved: <ul>";
|
||||||
for(var i=0; i< this.errorsInClaimsInsertion.length ; i++){
|
for(var i=0; i< this.errorInClaims.length ; i++){
|
||||||
text+="The following couldn't be saved: <br>";
|
// 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+="<li>"+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+") </li>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
text+="</ul></div>";
|
||||||
}
|
}
|
||||||
|
this.errorMessage+="<div>An error occured:</div>"+text;
|
||||||
|
console.log(text);
|
||||||
// if(this.inline){
|
// if(this.inline){
|
||||||
// this.show = "error";
|
// this.show = "error";
|
||||||
// this.showChange.emit({
|
// this.showChange.emit({
|
||||||
|
@ -359,43 +346,7 @@ createDirectClaim(result, projects, contexts){
|
||||||
console.log("\nJSON:\n"+json);
|
console.log("\nJSON:\n"+json);
|
||||||
return entity;
|
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(){
|
confirmOpen(){
|
||||||
|
|
|
@ -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";
|
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/"
|
// 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 static searchAPIURL = " https://beta.services.openaire.eu/search/v2/api/";
|
||||||
// private searchAPIURL = "http://beta.services.openaire.eu/search/v2.0/api/";
|
// private searchAPIURL = "http://beta.services.openaire.eu/search/v2.0/api/";
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
|
@ -11,6 +11,7 @@
|
||||||
<meta property="og:description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ">
|
<meta property="og:description" content="open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ">
|
||||||
<meta property="og:title" content="Search OpenAIRE">
|
<meta property="og:title" content="Search OpenAIRE">
|
||||||
<meta name="og:image" content="assets/newlogo.png">
|
<meta name="og:image" content="assets/newlogo.png">
|
||||||
|
<link href="assets/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
|
||||||
<title>Search OpenAIRE</title>
|
<title>Search OpenAIRE</title>
|
||||||
<script src="assets/jquery/jquery.min.js" type="text/javascript"></script>
|
<script src="assets/jquery/jquery.min.js" type="text/javascript"></script>
|
||||||
<!--uikit-->
|
<!--uikit-->
|
||||||
|
|
Loading…
Reference in New Issue