diff --git a/portal-2/src/app/deposit/deposit.component.ts b/portal-2/src/app/deposit/deposit.component.ts
index 6e010cc2..04a4de9d 100644
--- a/portal-2/src/app/deposit/deposit.component.ts
+++ b/portal-2/src/app/deposit/deposit.component.ts
@@ -1,7 +1,7 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
-import {OpenaireProperties} from '../utils/properties/openaireProperties';
+import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
@@ -45,7 +45,22 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
@@ -68,6 +83,9 @@ export class DepositComponent {
@Input() compatibility: string = '';
@Input() requestFor: string = "Publications";
+ private status: number;
+ private errorCodes:ErrorCodes = new ErrorCodes();
+
constructor (private _router: Router,
private _searchOrganizationsService: SearchOrganizationsService) {
console.info("constructor deposit");
@@ -82,12 +100,23 @@ export class DepositComponent {
keywordChanged() {
console.info("keywordChanged: "+this.keyword);
+ this.status = this.errorCodes.LOADING;
+ this.organizations = [];
+
this._searchOrganizationsService.searchOrganizationsForDeposit(this.keyword, this.compatibility, 1, 10).subscribe(
data => {
this.organizations = data;
+ this.status = this.errorCodes.DONE;
+
+ if(this.organizations.length == 0) {
+ this.status = this.errorCodes.NONE;
+ }
},
err => {
console.error(err);
+
+ this.status = this.errorCodes.ERROR;
+ console.info("error");
}
);
}
diff --git a/portal-2/src/app/deposit/depositResult.component.ts b/portal-2/src/app/deposit/depositResult.component.ts
index a9e44d3b..16bc5c56 100644
--- a/portal-2/src/app/deposit/depositResult.component.ts
+++ b/portal-2/src/app/deposit/depositResult.component.ts
@@ -17,6 +17,11 @@ import {OrganizationService} from '../services/organization.service';
Deposit {{requestFor}}
+
+ Loading...
+
+
0">
Data providers for institution:
@@ -35,7 +40,8 @@ import {OrganizationService} from '../services/organization.service';
-
+
No data providers found
@@ -63,6 +69,9 @@ export class DepositResultComponent {
private organization: {"name": string, "url": string};
private organizationId: string;
+ private status: number;
+ private errorCodes:ErrorCodes = new ErrorCodes();
+
sub: any;
subDataproviders: any;
@@ -79,6 +88,9 @@ export class DepositResultComponent {
this.zenodo = OpenaireProperties.getZenodoURL();
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
+
+ this.status = this.errorCodes.LOADING;
+ console.info("loading");
}
ngOnInit() {
@@ -115,17 +127,22 @@ export class DepositResultComponent {
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
data => {
this.organization = data.title;
+ this.status = this.errorCodes.DONE;
+ console.info("done");
this.subDataproviders = this.route.queryParams.subscribe(params => {
this.searchDataproviders();
});
- //var errorCodes:ErrorCodes = new ErrorCodes();
- //this.status = errorCodes.DONE;
},
err => {
- console.error(err)
- console.info("error");
- //var errorCodes:ErrorCodes = new ErrorCodes();
- //this.status = errorCodes.ERROR;
+ //console.error(err)
+
+ if(err.status == '404') {
+ this.status = this.errorCodes.NONE;
+ console.info("none");
+ } else {
+ this.status = this.errorCodes.ERROR;
+ console.info("error");
+ }
}
);
}
diff --git a/portal-2/src/app/searchPages/searchDataproviders.component.ts b/portal-2/src/app/searchPages/searchDataproviders.component.ts
index 55c9d744..92a73834 100644
--- a/portal-2/src/app/searchPages/searchDataproviders.component.ts
+++ b/portal-2/src/app/searchPages/searchDataproviders.component.ts
@@ -119,7 +119,8 @@ console.info("PAGE init = "+this.searchUtils.page);
}
public getResultsForDeposit(id:string, type:string, page: number, size: number){
-
+ //var errorCodes:ErrorCodes = new ErrorCodes();
+ //this.status = errorCodes.LOADING;
if(id != "") {
this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size).subscribe(
diff --git a/portal-2/src/app/services/organization.service.ts b/portal-2/src/app/services/organization.service.ts
index 0dd0a6ce..e454abe0 100644
--- a/portal-2/src/app/services/organization.service.ts
+++ b/portal-2/src/app/services/organization.service.ts
@@ -18,10 +18,8 @@ export class OrganizationService {
return this.http.get(url)
.map(res => res.json())
- .do(res => console.info(res['result']['metadata']['oaf:entity']['oaf:organization']))
.map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
.map(res => [res, res['rels']['rel']])
- //.do(res => console.info(res))
.map(res => this.parseOrganizationInfo(res));
}