Loading messages added in Deposit Pages
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44614 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
206bc1e73b
commit
6a95445031
|
@ -1,7 +1,7 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||||
|
|
||||||
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
||||||
|
|
||||||
|
@ -45,7 +45,22 @@ import {SearchOrganizationsService} from '../services/searchOrganizations.servic
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul class="list-group" >
|
<ul class="list-group" >
|
||||||
<li class="list-group-item" *ngFor=" let item of organizations">
|
<li class="list-group-item" *ngIf="status == errorCodes.LOADING">
|
||||||
|
<div class="alert alert-info" role="alert">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="status == errorCodes.NONE">
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
No organizations found
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngIf="status == errorCodes.ERROR">
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
Sorry! Organizations are not currently available
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item" *ngFor=" let item of organizations">
|
||||||
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
|
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -68,6 +83,9 @@ export class DepositComponent {
|
||||||
@Input() compatibility: string = '';
|
@Input() compatibility: string = '';
|
||||||
@Input() requestFor: string = "Publications";
|
@Input() requestFor: string = "Publications";
|
||||||
|
|
||||||
|
private status: number;
|
||||||
|
private errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
|
||||||
constructor (private _router: Router,
|
constructor (private _router: Router,
|
||||||
private _searchOrganizationsService: SearchOrganizationsService) {
|
private _searchOrganizationsService: SearchOrganizationsService) {
|
||||||
console.info("constructor deposit");
|
console.info("constructor deposit");
|
||||||
|
@ -82,12 +100,23 @@ export class DepositComponent {
|
||||||
|
|
||||||
keywordChanged() {
|
keywordChanged() {
|
||||||
console.info("keywordChanged: "+this.keyword);
|
console.info("keywordChanged: "+this.keyword);
|
||||||
|
this.status = this.errorCodes.LOADING;
|
||||||
|
this.organizations = [];
|
||||||
|
|
||||||
this._searchOrganizationsService.searchOrganizationsForDeposit(this.keyword, this.compatibility, 1, 10).subscribe(
|
this._searchOrganizationsService.searchOrganizationsForDeposit(this.keyword, this.compatibility, 1, 10).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.organizations = data;
|
this.organizations = data;
|
||||||
|
this.status = this.errorCodes.DONE;
|
||||||
|
|
||||||
|
if(this.organizations.length == 0) {
|
||||||
|
this.status = this.errorCodes.NONE;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
|
this.status = this.errorCodes.ERROR;
|
||||||
|
console.info("error");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,11 @@ import {OrganizationService} from '../services/organization.service';
|
||||||
<h2>Deposit {{requestFor}}</h2>
|
<h2>Deposit {{requestFor}}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="status == errorCodes.LOADING || (status == errorCodes.LOADING && searchDataprovidersComponent.status == errorCodes.LOADING)"
|
||||||
|
class="alert alert-info" role="alert">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
|
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
|
||||||
<h2 *ngIf="organization != undefined">
|
<h2 *ngIf="organization != undefined">
|
||||||
<span>Data providers for institution: </span>
|
<span>Data providers for institution: </span>
|
||||||
|
@ -35,7 +40,8 @@ import {OrganizationService} from '../services/organization.service';
|
||||||
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
|
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="searchDataprovidersComponent.totalResults == 0" class = "alert alert-warning">
|
<div *ngIf="(searchDataprovidersComponent.status == errorCodes.NONE && status == errorCodes.DONE)
|
||||||
|
|| status == errorCodes.NONE" class = "alert alert-warning">
|
||||||
<div *ngIf="organization != undefined">
|
<div *ngIf="organization != undefined">
|
||||||
No data providers found
|
No data providers found
|
||||||
<span *ngIf="organization != undefined">
|
<span *ngIf="organization != undefined">
|
||||||
|
@ -63,6 +69,9 @@ export class DepositResultComponent {
|
||||||
private organization: {"name": string, "url": string};
|
private organization: {"name": string, "url": string};
|
||||||
private organizationId: string;
|
private organizationId: string;
|
||||||
|
|
||||||
|
private status: number;
|
||||||
|
private errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
|
||||||
sub: any;
|
sub: any;
|
||||||
subDataproviders: any;
|
subDataproviders: any;
|
||||||
|
|
||||||
|
@ -79,6 +88,9 @@ export class DepositResultComponent {
|
||||||
|
|
||||||
this.zenodo = OpenaireProperties.getZenodoURL();
|
this.zenodo = OpenaireProperties.getZenodoURL();
|
||||||
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
|
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
|
||||||
|
|
||||||
|
this.status = this.errorCodes.LOADING;
|
||||||
|
console.info("loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -115,17 +127,22 @@ export class DepositResultComponent {
|
||||||
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
|
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.organization = data.title;
|
this.organization = data.title;
|
||||||
|
this.status = this.errorCodes.DONE;
|
||||||
|
console.info("done");
|
||||||
this.subDataproviders = this.route.queryParams.subscribe(params => {
|
this.subDataproviders = this.route.queryParams.subscribe(params => {
|
||||||
this.searchDataproviders();
|
this.searchDataproviders();
|
||||||
});
|
});
|
||||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
|
||||||
//this.status = errorCodes.DONE;
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err)
|
//console.error(err)
|
||||||
console.info("error");
|
|
||||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
if(err.status == '404') {
|
||||||
//this.status = errorCodes.ERROR;
|
this.status = this.errorCodes.NONE;
|
||||||
|
console.info("none");
|
||||||
|
} else {
|
||||||
|
this.status = this.errorCodes.ERROR;
|
||||||
|
console.info("error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,8 @@ console.info("PAGE init = "+this.searchUtils.page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getResultsForDeposit(id:string, type:string, page: number, size: number){
|
public getResultsForDeposit(id:string, type:string, page: number, size: number){
|
||||||
|
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
//this.status = errorCodes.LOADING;
|
||||||
if(id != "") {
|
if(id != "") {
|
||||||
|
|
||||||
this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size).subscribe(
|
this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size).subscribe(
|
||||||
|
|
|
@ -18,10 +18,8 @@ export class OrganizationService {
|
||||||
|
|
||||||
return this.http.get(url)
|
return this.http.get(url)
|
||||||
.map(res => <any> res.json())
|
.map(res => <any> 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['result']['metadata']['oaf:entity']['oaf:organization'])
|
||||||
.map(res => [res, res['rels']['rel']])
|
.map(res => [res, res['rels']['rel']])
|
||||||
//.do(res => console.info(res))
|
|
||||||
.map(res => this.parseOrganizationInfo(res));
|
.map(res => this.parseOrganizationInfo(res));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue