Utils of landing pages moved to 'landing-utils' folder | errorMessages.component created to centralize errorMessages according to ErrorCodes in openaireProperties.ts file | http service returning errorCodes and proper display fixed in search and fetch subscriptions (claims, home component, html project report page, csv files, basic info in landing pages, helper component, staticAutocomplete do not return errorCodes yet) | simple searchPages: paging remains when page changes while results load, filters on the left do not change position according to paging

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@49174 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-09-29 13:58:35 +00:00
parent 40029fae3e
commit 4bb3dc98fb
70 changed files with 1384 additions and 703 deletions

View File

@ -51,7 +51,7 @@ import {PiwikService} from '../utils/piwik/piwik.service';
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">
<h2 *ngIf="organization != undefined">
<h2 *ngIf="organization">
<span>content providers for institution: </span>
<a *ngIf="organization['url']!=''" href="{{organization.url}}" target="_blank">
<span>{{organization['name']}} (<i class="custom-external"></i>)</span>
@ -86,8 +86,8 @@ import {PiwikService} from '../utils/piwik/piwik.service';
<div *ngIf="(fetchDataproviders.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|| status == errorCodes.NONE || status == errorCodes.ERROR" class = "alert alert-warning">
<div *ngIf="organization != undefined">
|| status == errorCodes.NOT_FOUND || status == errorCodes.ERROR || status == errorCodes.NOT_AVAILABLE" class = "alert alert-warning">
<div *ngIf="organization">
<span *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR">
An error occured.
</span>
@ -98,12 +98,15 @@ import {PiwikService} from '../utils/piwik/piwik.service';
<span *ngIf="organization['url']==''">{{organization['name']}}</span>
.
</div>
<div *ngIf="status == errorCodes.NONE && organizationId != ''">
<div *ngIf="status == errorCodes.NOT_FOUND && organizationId != ''">
No organization with ID: {{organizationId}} found.
</div>
<div *ngIf="status == errorCodes.ERROR && organizationId != ''">
An error occured.
</div>
<span *ngIf="status == errorCodes.NOT_AVAILABLE && organizationId != ''">
Service temprorarily unavailable. Please try again later.
</span>
<div *ngIf="organizationId == ''">
No ID for organization.
</div>
@ -123,6 +126,7 @@ import {PiwikService} from '../utils/piwik/piwik.service';
</div>
</div>
</div>
`
})
@ -211,19 +215,26 @@ export class DepositResultComponent {
this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
data => {
this.organization = (data && data.title)?data.title:"";
this.status = this.errorCodes.DONE;
this.searchDataproviders();
if(data == null) {
this.status = this.errorCodes.NOT_FOUND;
} else {
this.organization = data.title;
this.status = this.errorCodes.DONE;
this.searchDataproviders();
}
},
err => {
//console.log(err)
if(err.status == '404') {
this.status = this.errorCodes.NONE;
console.info("none");
this.status = this.errorCodes.NOT_FOUND;
console.info("not found");
} else if(err.status == '500') {
this.status = this.errorCodes.ERROR;
console.info("error");
} else {
this.status = this.errorCodes.ERROR;
console.info("error");
this.status = this.errorCodes.NOT_AVAILABLE;
console.info("not available");
}
}
);

View File

@ -165,15 +165,16 @@
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
No statistics available
</div-->
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR || fetchDatasets.searchUtils.status == errorCodes.ERROR"
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE || fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'statistics'"></errorMessages>
<div *ngIf="(fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">
<p class="uk-text-bold">Latest Research Result Timeline</p>

View File

@ -160,7 +160,7 @@ export class DataProviderComponent {
}
},
err => {
console.log(err)
console.log(err);
// console.info("error");
this.errorMessage = 'No dataProvider found';
this.showLoading = false;
@ -271,11 +271,9 @@ export class DataProviderComponent {
}
private searchPublications(page: number, size: number) {
if(this.fetchPublications.searchUtils.status == this.errorCodes.NONE) {
this.reloadPublications = false;
}
if(this.reloadPublications) {
if( this.reloadPublications &&
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
}
this.reloadPublications = false;
@ -286,11 +284,9 @@ export class DataProviderComponent {
}
private searchDatasets(page: number, size: number) {
if(this.fetchDatasets.searchUtils.status == this.errorCodes.NONE) {
this.reloadDatasets = false;
}
if(this.reloadDatasets) {
if( this.reloadDatasets &&
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size);
}
this.reloadDatasets = false;
@ -301,11 +297,9 @@ export class DataProviderComponent {
}
private searchProjects(page: number, size: number) {
if(this.fetchProjects.searchUtils.status == this.errorCodes.NONE) {
this.reloadProjects = false;
}
if(this.reloadProjects) {
if( this.reloadProjects &&
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
this.fetchProjects.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size);
}
this.reloadProjects = false;
@ -316,11 +310,9 @@ export class DataProviderComponent {
}
private searchDatasources(page: number, size: number) {
if(this.fetchDataproviders.searchUtils.status == this.errorCodes.NONE) {
this.reloadDataproviders = false;
}
if(this.reloadDataproviders) {
if( this.reloadDataproviders &&
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size);
}
this.reloadDataproviders = false;
@ -332,13 +324,13 @@ export class DataProviderComponent {
private searchRelatedDatasources(page: number, size: number) {
// Currently no counting is done for this tab. Following condition is always false
if(this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.NONE
&& this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.NONE) {
this.reloadRelatedDatasources = false;
this.loadingRelatedDatasources = false;
}
if(this.reloadRelatedDatasources) {
if( this.reloadRelatedDatasources &&
( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE )
&&
( this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
this.relatedDatasourcesSub = Observable.merge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete)
.subscribe(
data => {},
@ -348,7 +340,9 @@ export class DataProviderComponent {
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size);
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size);
}
} else {
this.loadingRelatedDatasources = false;
}
this.reloadRelatedDatasources = false;
@ -361,7 +355,8 @@ export class DataProviderComponent {
private preprocessRelatedDatasources() {
if(this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE || this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE) {
if( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE ||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) {
this.dataProviderInfo.relatedDatasources = new Map<string, {"name": string, "countPublications": string, "countDatasets": string}>();
}
for(let result of this.fetchAggregatorsPublications.results) {
@ -379,7 +374,6 @@ export class DataProviderComponent {
this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count)+"";
}
}
this.loadingRelatedDatasources = false;
}

View File

@ -4,10 +4,11 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {IFrameModule} from '../../utils/iframe.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
// import { ResultLandingModule } from '../resultLanding.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {MetricsModule} from '../metrics.module';
import { LandingModule } from '../landing.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {LandingModule} from '../landing-utils/landing.module';
import {PagingModule} from '../../utils/paging.module';
import {PublicationsTabComponent} from './publicationsTab.component';
@ -20,7 +21,7 @@ import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component'
// import {TabsComponent} from './tabs.component';
import {DataProviderComponent} from './dataProvider.component';
import { DataProviderService} from './dataProvider.service';
import {DataProviderService} from './dataProvider.service';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
@ -32,7 +33,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports:
[CommonModule, FormsModule, RouterModule,DataProviderRoutingModule,
TabResultModule, IFrameModule, MetricsModule, LandingModule,
TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule,
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule,
PagingModule],
declarations:

View File

@ -17,7 +17,7 @@ export class DataProviderService {
getDataproviderInfo (id: string):any {
console.info("getDataProviderInfo in service");
let url = OpenaireProperties.getSearchAPIURLLast() + 'datasources/' +id +"?format=json";
let url = OpenaireProperties.getSearchAPIURLLast() + 'datasources/' +id +"?formatt=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parseDataProviderInfo(res));

View File

@ -6,9 +6,12 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
@Component({
selector: 'datasetsTab',
template: `
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div> <div *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<!--div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service temprorarily unavailable. Please try again later.</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No research data found</div-->
<errorMessages [status]="[fetchDatasets.searchUtils.status]" [type]="'research data'"></errorMessages>
<!--div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert">
No research data available

View File

@ -6,10 +6,12 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
@Component({
selector: 'datasourcesTab',
template: `
<!--div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No content providers available</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service temprorarily unavailable. Please try again later.</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">No content providers found</div-->
<errorMessages [status]="[fetchDataproviders.searchUtils.status]" [type]="'content providers'"></errorMessages>
<!--div *ngIf="fetchDataproviders.searchUtils.totalResults == 0" class = "uk-alert">
No content providers available

View File

@ -7,10 +7,11 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
@Component({
selector: 'projectsTab',
template: `
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
<!--div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'"></errorMessages>
<!--div *ngIf="fetchProjects.searchUtils.totalResults == 0" class = "uk-alert">
No projects available

View File

@ -10,7 +10,8 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<!--errorMessages [status]="[fetchPublications.searchUtils.status]" [type]="'publications'"></errorMessages>
{{fetchPublications.searchUtils.status}}-->
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert">
No publications available
</div-->

View File

@ -10,21 +10,23 @@ import { Observable } from 'rxjs/Observable';
@Component({
selector: 'relatedDatasourcesTab',
template: `
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">
No related content providers available
</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR && fetchDatasets.searchUtils.status == errorCodes.ERROR"
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">
An Error Occured
</div>
</div-->
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE && fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">
Service not available
</div-->
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING || loading"
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING || loading"
class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
</div>
</div-->
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'related content providers'"></errorMessages>
<div *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE || fetchDatasets.searchUtils.status == errorCodes.DONE) && !loading">
<div *ngIf="results && results.size > pageSize" class="uk-margin">

View File

@ -7,14 +7,15 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
selector: 'statisticsTab',
template: `
<div *ngIf="show">
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NONE && DatasetsComponent.searchUtils.status == errorCodes.NONE"
<!--div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NONE && DatasetsComponent.searchUtils.status == errorCodes.NONE"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.ERROR || DatasetsComponent.searchUtils.status == errorCodes.ERROR"
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE || DatasetsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE"
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.LOADING || DatasetsComponent.searchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
class="uk-animation-fade uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[searchPublicationsComponent.searchUtils.status, DatasetsComponent.searchUtils.status]" [type]="'statistics'"></errorMessages>
<!--div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0 && searchDatasetsComponent.searchUtils.totalResults == 0" class = "uk-alert">
No statistics available

View File

@ -8,13 +8,13 @@ import { RouterModule } from '@angular/router';
import { DatasetService} from './dataset.service';
import { DatasetComponent } from './dataset.component';
import { DatasetRoutingModule } from './dataset-routing.module';
import {MetricsModule} from '../metrics.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ResultLandingModule } from '../resultLanding.module';
import { LandingModule } from '../landing.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({

View File

@ -8,8 +8,8 @@ import { RouterModule } from '@angular/router';
import {TabPagingComponent} from './tabPaging.component';
import {ShowTitleComponent} from './showTitle.component';
import {AddThisComponent} from './addThis.component';
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from'../utils/piwik/previousRouteRecorder.guard';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [

View File

@ -1,7 +1,7 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Metrics} from '../utils/entities/metrics';
import {MetricsService } from '../services/metrics.service';
import {ErrorCodes} from '../utils/properties/openaireProperties';
import {Metrics} from '../../utils/entities/metrics';
import {MetricsService } from '../../services/metrics.service';
import {ErrorCodes} from '../../utils/properties/openaireProperties';
import { Subscription } from 'rxjs/Subscription';
@ -26,10 +26,12 @@ import { Subscription } from 'rxjs/Subscription';
Metrics are currently unavailable
</div-->
<div *ngIf="status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<!--div *ngIf="status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary" role="alert">No Results found</div>
<div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning" role="alert">An Error Occured</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service not available</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service temprorarily unavailable. Please try again later.</div>
<div *ngIf="status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger" role="alert">No metrics found</div-->
<errorMessages [status]="[status]" [type]="'metrics'"></errorMessages>
<div *ngIf="metrics != undefined" class="uk-child-width-1-3@m uk-grid-small uk-grid-match uk-grid" uk-grid="">
<div *ngIf="entityType == 'projects'" class="uk-width-1-1 uk-text-center uk-text-meta uk-margin">Project metrics are derived from aggregating individual research results metrics.</div>
<div class="metrics-openaire uk-first-column">
@ -196,6 +198,7 @@ export class MetricsComponent {
data => {
this.metrics = data;
this.status = this.errorCodes.DONE;
this.metricsResults.emit({
totalViews: this.metrics.totalViews,
totalDownloads: this.metrics.totalDownloads,
@ -204,9 +207,12 @@ export class MetricsComponent {
},
err => {
console.log(err);
this.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.status = this.errorCodes.NOT_AVAILABLE;
this.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
}
this.metricsResults.emit({
totalViews: 0,

View File

@ -5,22 +5,22 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {MetricsComponent} from './metrics.component';
import { MetricsService } from '../services/metrics.service';
import { MetricsService } from '../../services/metrics.service';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
CommonModule, FormsModule
],
CommonModule, FormsModule, ErrorMessagesModule
],
declarations: [
MetricsComponent
MetricsComponent
],
providers:[
MetricsService
],
exports: [
MetricsComponent
]
]
})
export class MetricsModule { }

View File

@ -3,7 +3,7 @@ import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {PagingModule} from '../utils/paging.module';
import {PagingModule} from '../../utils/paging.module';
import {ShowAuthorsComponent} from './showAuthors.component';
import {ShowIdentifiersComponent} from './showIdentifiers.component';

View File

@ -1,12 +1,12 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class';
import { SearchProjectsService } from '../services/searchProjects.service';
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import { SearchProjectsService } from '../../services/searchProjects.service';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import {StringUtils} from '../utils/string-utils.class';
import {RouterHelper} from '../utils/routerHelper.class';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {StringUtils} from '../../utils/string-utils.class';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'searchingProjectsTab',
@ -14,10 +14,11 @@ import {RouterHelper} from '../utils/routerHelper.class';
<!--div *ngIf="fetchProjects.searchUtils.totalResults == 0" class = "uk-alert">
No projects available
</div-->
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
<!--div *ngIf="fetchProjects.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No projects available</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'"></errorMessages>
<div *ngIf="fetchProjects.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResultsNoFilters > 10">

View File

@ -5,17 +5,18 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { ProjectsServiceModule} from '../services/projectsService.module';
import { TabResultModule } from '../searchPages/searchUtils/tabResult.module';
import { ProjectsServiceModule} from '../../services/projectsService.module';
import { TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { SearchingProjectsTabComponent} from './searchingProjectsInTab.component';
import {PagingModule } from '../utils/paging.module';
import {PagingModule } from '../../utils/paging.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
RouterModule, CommonModule, FormsModule,
ProjectsServiceModule, TabResultModule, PagingModule
ProjectsServiceModule, TabResultModule,
PagingModule, ErrorMessagesModule
],
declarations: [
SearchingProjectsTabComponent

View File

@ -1,5 +1,5 @@
import {Component, Input, ElementRef} from '@angular/core';
import {RouterHelper} from '../utils/routerHelper.class';
import {RouterHelper} from '../../utils/routerHelper.class';
@Component({
selector: 'showAuthors',

View File

@ -1,5 +1,5 @@
import {Component, Input, ElementRef} from '@angular/core';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'showIdentifiers',

View File

@ -1,6 +1,6 @@
import {Component, Input} from '@angular/core';
import {RouterHelper} from '../utils/routerHelper.class';
import {OpenaireProperties} from '../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
//import {PagingModule} from '../utils/paging.module';
@Component({

View File

@ -87,10 +87,11 @@
<div class="uk-margin custom-tab-content">
<div *ngIf="activeTab=='Publications'" class="uk-animation-fade">
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchPublications.searchUtils.status]" [type]="'publications'"></errorMessages>
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10">
@ -115,10 +116,11 @@
No content providers available
</div-->
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No content providers available</div>
<!--div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No content providers available</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDataproviders.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchDataproviders.searchUtils.status]" [type]="'content providers'"></errorMessages>
<div *ngIf="fetchDataproviders.searchUtils.totalResults > 0">

View File

@ -14,7 +14,7 @@ import {SearchDataprovidersService} from '../../services/searchDataproviders.ser
import {SearchProjectsService} from '../../services/searchProjects.service';
import { Meta} from '../../../angular2-meta';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchingProjectsTabComponent} from '../searchingProjectsInTab.component';
import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component';
import {RouterHelper} from '../../utils/routerHelper.class';
import {ModalLoading} from '../../utils/modal/loading.component';
@ -296,7 +296,7 @@ export class OrganizationComponent {
this.downloadFilePiwikSub = this._piwikService.trackDownload(url).subscribe();
}
},
error => {
err => {
console.log("Error downloading the file.");
this.closeLoading();
this.confirmOpenCsvError();
@ -369,7 +369,7 @@ export class OrganizationComponent {
// }
}
},
error => {
err => {
console.log("Error downloading the file.");
this.closeLoading();
this.confirmOpenCsvError();
@ -378,11 +378,11 @@ export class OrganizationComponent {
);
}
},
error => console.log("Error getting number of publications for project."));
err => console.log("Error getting number of publications for project."));
}//);
},
error => {
err => {
console.log("Error getting projects project.");
this.closeLoading();
this.confirmOpenCsvError();

View File

@ -5,26 +5,27 @@ import { RouterModule } from '@angular/router';
import {LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import { OrganizationServiceModule} from '../../services/organizationService.module';
// import { ProjectsServiceModule} from '../../services/projectsService.module';
import { OrganizationComponent } from './organization.component';
import { OrganizationRoutingModule } from './organization-routing.module';
import { LandingModule } from '../landing.module';
import { LandingModule } from '../landing-utils/landing.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import { SearchingProjectsTabModule} from '../searchingProjectsInTab.module';
import { SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
LoadingModalModule, AlertModalModule,
LoadingModalModule, AlertModalModule, ErrorMessagesModule,
LandingModule,
OrganizationRoutingModule,
TabResultModule,

View File

@ -158,11 +158,11 @@
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary" >
No publications available
</div-->
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No publications available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div*ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchPublications.searchUtils.status]" [type]="'publications'"></errorMessages>
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10" >
@ -182,11 +182,11 @@
<!--div *ngIf="fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
No research data available
</div-->
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div>
<!--div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No research data available</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="fetchDatasets.searchUtils.status == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchDatasets.searchUtils.status]" [type]="'research data'"></errorMessages>
<div *ngIf="fetchDatasets.searchUtils.totalResults > 0">
@ -206,14 +206,15 @@
<!--div *ngIf="fetchPublications.searchUtils.totalResults == 0 && fetchDatasets.searchUtils.totalResults == 0" class = "uk-alert uk-alert-primary">
No statistics available
</div-->
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
<!--div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE && fetchDatasets.searchUtils.status == errorCodes.NONE"
class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR || fetchDatasets.searchUtils.status == errorCodes.ERROR"
class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE || fetchDatasets.searchUtils.status == errorCodes.NOT_AVAILABLE"
class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING || fetchDatasets.searchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status]" [type]="'statistics'"></errorMessages>
<div *ngIf="statsClicked && (fetchPublications.searchUtils.totalResults != 0 || fetchDatasets.searchUtils.totalResults != 0)">

View File

@ -7,22 +7,23 @@ import { RouterModule } from '@angular/router';
import { ProjectServiceModule} from './projectService.module';
// import {HtmlProgressReportService} from './htmlProgressReport.service';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import { ProjectComponent } from './project.component';
import { ProjectRoutingModule } from './project-routing.module';
import {IFrameModule} from '../../utils/iframe.module';
import {MetricsModule} from '../metrics.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, LandingModule,
ProjectRoutingModule, LoadingModalModule,
ProjectRoutingModule, LoadingModalModule, ErrorMessagesModule,
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule,
PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule
],

View File

@ -8,14 +8,14 @@ import { RouterModule } from '@angular/router';
import { PublicationService} from './publication.service';
import { PublicationComponent } from './publication.component';
import { PublicationRoutingModule } from './publication-routing.module';
import {MetricsModule} from '../metrics.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import {PagingModule} from '../../utils/paging.module';
import { ResultLandingModule } from '../resultLanding.module';
import { LandingModule } from '../landing.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({

View File

@ -21,13 +21,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(searchUtils)] = "searchUtils"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/dataproviders"
[disableForms]="disableForms">
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults">
</advanced-search-page>
`
})
export class AdvancedSearchDataProvidersComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -41,27 +45,32 @@ export class AdvancedSearchDataProvidersComponent {
public resourcesQuery = "(oaftype exact datasource)";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDataProviders;
console.info("Con -base url:"+this.searchUtils.baseUrl );
}
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
@ -75,37 +84,37 @@ export class AdvancedSearchDataProvidersComponent {
this.csvParams ="&type=datasources&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
console.info("Advanced Search for Publications: Execute search query "+parameters);
console.info("Advanced Search for Content Providers: Execute search query "+parameters);
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("Adv Search Content Providers total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
// Page out of limit!!!
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -116,8 +125,15 @@ export class AdvancedSearchDataProvidersComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -125,6 +141,8 @@ export class AdvancedSearchDataProvidersComponent {
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);

View File

@ -20,44 +20,52 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/datasets"
[disableForms]="disableForms">
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults">
</advanced-search-page>
`
})
export class AdvancedSearchDatasetsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "( (oaftype exact result) and (resulttypeid exact dataset) )";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDatasets;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@ -80,8 +88,8 @@ export class AdvancedSearchDatasetsComponent {
this.csvParams ="&type=datasets&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -94,15 +102,15 @@ export class AdvancedSearchDatasetsComponent {
console.info("search Research Data total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -110,7 +118,7 @@ export class AdvancedSearchDatasetsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -121,8 +129,16 @@ export class AdvancedSearchDatasetsComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -133,6 +149,8 @@ export class AdvancedSearchDatasetsComponent {
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);

View File

@ -20,13 +20,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/organizations"
[disableForms]="disableForms">
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults">
</advanced-search-page>
`
})
export class AdvancedSearchOrganizationsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -37,25 +41,31 @@ export class AdvancedSearchOrganizationsComponent {
public selectedFields:AdvancedField[] = [];
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
public resourcesQuery = "(oaftype exact organization)";
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedOrganizations;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@ -78,8 +88,8 @@ public resourcesQuery = "(oaftype exact organization)";
this.csvParams ="&type=organizations&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -92,15 +102,15 @@ public resourcesQuery = "(oaftype exact organization)";
console.info("search Organizations total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -108,7 +118,7 @@ public resourcesQuery = "(oaftype exact organization)";
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -119,8 +129,16 @@ public resourcesQuery = "(oaftype exact organization)";
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -131,6 +149,8 @@ public resourcesQuery = "(oaftype exact organization)";
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);

View File

@ -19,19 +19,22 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/projects"
[disableForms]="disableForms">
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults">
</advanced-search-page>
`
})
export class AdvancedSearchProjectsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap = this.searchFields.PROJECT_FIELDS;
@ -41,21 +44,28 @@ export class AdvancedSearchProjectsComponent {
public resourcesQuery = "(oaftype exact project)";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedProjects;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@ -78,8 +88,8 @@ export class AdvancedSearchProjectsComponent {
this.csvParams ="&type=projects&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -92,15 +102,15 @@ export class AdvancedSearchProjectsComponent {
console.info("Advanced Search for Projects total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -108,7 +118,7 @@ export class AdvancedSearchProjectsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -119,8 +129,16 @@ export class AdvancedSearchProjectsComponent {
// if( ){
// this.searchUtils.status = errorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -132,6 +150,8 @@ export class AdvancedSearchProjectsComponent {
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);

View File

@ -20,24 +20,30 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/publications"
[disableForms]="disableForms">
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults">
</advanced-search-page>
`
})
export class AdvancedSearchPublicationsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact publication))";
public csvParams: string;
public disableForms: boolean = false;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact publication))";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -45,17 +51,22 @@ export class AdvancedSearchPublicationsComponent {
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPublications;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
@ -64,8 +75,7 @@ export class AdvancedSearchPublicationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
});
}
ngOnDestroy() {
@ -79,8 +89,8 @@ export class AdvancedSearchPublicationsComponent {
this.csvParams ="&type=publications&query="+this.resourcesQuery;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -93,15 +103,15 @@ export class AdvancedSearchPublicationsComponent {
console.info("searchPubl total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -109,7 +119,7 @@ export class AdvancedSearchPublicationsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -120,8 +130,16 @@ export class AdvancedSearchPublicationsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NOT_AVAILABLE;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -130,6 +148,8 @@ export class AdvancedSearchPublicationsComponent {
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
console.info("queryChanged: Execute search query "+parameters);

View File

@ -31,6 +31,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchCompatibleDataprovidersComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -55,8 +56,8 @@ export class SearchCompatibleDataprovidersComponent {
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProviders();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -91,8 +92,8 @@ export class SearchCompatibleDataprovidersComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -105,10 +106,10 @@ export class SearchCompatibleDataprovidersComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -120,8 +121,16 @@ export class SearchCompatibleDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;

View File

@ -27,6 +27,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchCompatibleDataprovidersTableComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -48,8 +50,8 @@ export class SearchCompatibleDataprovidersTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProvidersTable();
}
@ -74,8 +76,8 @@ export class SearchCompatibleDataprovidersTableComponent {
private _getResults(){
//this.csvParams = this.resourcesQuery+"&type=datasources";
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@ -93,10 +95,10 @@ export class SearchCompatibleDataprovidersTableComponent {
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
},
@ -106,8 +108,16 @@ export class SearchCompatibleDataprovidersTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
}
@ -115,8 +125,8 @@ export class SearchCompatibleDataprovidersTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@ -126,8 +136,15 @@ export class SearchCompatibleDataprovidersTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);

View File

@ -30,6 +30,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchEntityRegistriesComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -55,8 +57,8 @@ export class SearchEntityRegistriesComponent {
public csvParams: string;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchEntityRegistries();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -91,8 +93,8 @@ export class SearchEntityRegistriesComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -105,10 +107,10 @@ export class SearchEntityRegistriesComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -120,8 +122,16 @@ export class SearchEntityRegistriesComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;

View File

@ -28,6 +28,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchEntityRegistriesTableComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -41,8 +43,8 @@ export class SearchEntityRegistriesTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
@ -65,8 +67,8 @@ export class SearchEntityRegistriesTableComponent {
this.subResults.unsubscribe();
} }
private _getResults(parameters:string,refine:boolean, page: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@ -83,10 +85,10 @@ export class SearchEntityRegistriesTableComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
@ -97,8 +99,16 @@ export class SearchEntityRegistriesTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
}
@ -106,8 +116,8 @@ export class SearchEntityRegistriesTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@ -117,8 +127,15 @@ export class SearchEntityRegistriesTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
/*

View File

@ -29,6 +29,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchJournalsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -54,8 +56,8 @@ export class SearchJournalsComponent {
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchJournals();
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
@ -90,8 +92,8 @@ export class SearchJournalsComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.csvParams = parameters+this.resourcesQuery+"&type=datasources";
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -104,10 +106,10 @@ export class SearchJournalsComponent {
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -119,8 +121,16 @@ export class SearchJournalsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;

View File

@ -27,6 +27,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchJournalsTableComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -48,8 +50,8 @@ export class SearchJournalsTableComponent {
@ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchJournalsTable();
}
@ -74,8 +76,8 @@ export class SearchJournalsTableComponent {
private _getResults(){
//this.csvParams = this.resourcesQuery+"&type=datasources";
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
@ -93,10 +95,10 @@ export class SearchJournalsTableComponent {
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
},
@ -106,8 +108,16 @@ export class SearchJournalsTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
}
@ -115,8 +125,8 @@ export class SearchJournalsTableComponent {
} else {
this.searchPage.checkSelectedFilters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.NONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.NONE;
this.disableForms = false;
}
},
@ -126,8 +136,15 @@ export class SearchJournalsTableComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);

View File

@ -142,8 +142,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchPublications() {
this.activeTab = "publications";
if( this.reloadPublications &&
this.fetchPublications.searchUtils.status != this.errorCodes.NONE &&
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) {
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE )) {
this.reloadPublications = false;
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications();// + "?keyword=" + this.keyword;
@ -152,8 +152,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDatasets() {
this.activeTab = "research data";
if(this.reloadDatasets &&
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE &&
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) {
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE )) {
this.reloadDatasets = false;
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDatasets = OpenaireProperties.getLinkToSearchDatasets();// + "?keyword=" + this.keyword;
@ -163,8 +163,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this.activeTab = "projects";
console.log("searchProjects");
if(this.reloadProjects &&
this.fetchProjects.searchUtils.status != this.errorCodes.NONE &&
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) {
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
this.fetchProjects.searchUtils.status == this.errorCodes.DONE )) {
this.reloadProjects = false;
console.log("do the search searchProjects");
@ -175,8 +175,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchDataProviders() {
this.activeTab = "content providers";
if( this.reloadDataproviders &&
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE &&
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) {
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE )) {
this.reloadDataproviders = false;
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();// + "?keyword=" + this.keyword;
@ -185,8 +185,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public searchOrganizations() {
this.activeTab = "organizations";
if( this.reloadOrganizations &&
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE &&
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) {
( this.fetchOrganizations.searchUtils.status == this.errorCodes.LOADING ||
this.fetchOrganizations.searchUtils.status == this.errorCodes.DONE )) {
this.reloadOrganizations = false;
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10);
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword;
@ -234,7 +234,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.fetchPublications.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchPublications.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchPublications.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@ -251,7 +258,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchDatasets.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchDatasets.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@ -268,7 +282,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.fetchProjects.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchProjects.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
}
);
}
@ -289,7 +310,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
},
err => {
console.log(err);
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
} else {
this.fetchOrganizations.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
}
);

View File

@ -21,7 +21,7 @@
<div class="uk-width-1-1">
<helper position="top"></helper>
</div>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
<div class="uk-width-1-1 uk-grid helper-grid" >

View File

@ -14,7 +14,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'advanced-search-page',
templateUrl: 'advancedSearchPage.component.html'
templateUrl: 'advancedSearchPage.component.html'
})
export class AdvancedSearchPageComponent {
@Input() pageTitle = "";
@ -31,6 +31,9 @@ export class AdvancedSearchPageComponent {
@Input() csvPath: string;
@Input() simpleSearchLink: string = "";
@Input() disableForms:boolean = false;
@Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0;
piwiksub: any;
public parameterNames:string[] =[];
public parameterValues:string[] =[];

View File

@ -14,10 +14,12 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
selector: 'browse-entities',
template: `
<div>
<div *ngIf="status == errorCodes.LOADING" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<!--div *ngIf="status == errorCodes.LOADING" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
<div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger" role="alert">Service temprorarily unavailable. Please try again later.</div>
<div *ngIf="status == errorCodes.NOT_FOUND" class="uk-alert uk-alert-danger" role="alert">No filters found</div-->
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
<div class ="uk-grid">
<div *ngFor= "let filter of filters" class = "uk-margin-bottom uk-width-1-4@l uk-width-1-3@m uk-width-1-2@s">
@ -81,7 +83,14 @@ private getStats(){
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
this.status = this.errorCodes.ERROR;
//this.status = this.errorCodes.ERROR;
if(err.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}

View File

@ -8,10 +8,11 @@ import {RefineFieldResultsServiceModule} from '../../services/refineFieldResults
import {BrowseEntitiesComponent} from './browseEntities.component';
import {BrowseStatisticComponent} from './browseStatistic.component';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
CommonModule, FormsModule,
CommonModule, FormsModule, ErrorMessagesModule,
RefineFieldResultsServiceModule, RouterModule
],
declarations: [

View File

@ -9,7 +9,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'search-download',
template: `
<span class="uk-margin-large-right" *ngIf="totalResults <= 10000">
<span class="uk-margin-large-right" *ngIf="totalResults > 0 && totalResults <= 10000">
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)">
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download" ratio="1"><polyline fill="none" stroke="#000" points="14,10 9.5,14.5 5,10"></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="13.91" x2="9.5" y2="3"></line></svg></span> (CSV)

View File

@ -1,66 +1,66 @@
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="">
<div [class]="'uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle uk- light '+searchFormClass" >
<div class="uk-width-1-1">
<div class="uk-width-1-1">
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)" [placeholderText]="formPlaceholderText"></search-form>
</div>
<div class="uk-width-1-1 ">
<!--link to advanced search -->
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted uk-light ':'uk-float-right uk-light'" [routerLink]=advancedSearchLink >More search options <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span>
</a>
<div *ngIf="isFiltered()" class = "uk-container uk-width-1-2@m uk-width-1-2@s uk-align-center uk-text-center uk-text-small">
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span><a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span class="uk-icon">
<div [class]="'uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle uk- light '+searchFormClass" >
<div class="uk-width-1-1">
<div class="uk-width-1-1">
<search-form [isDisabled]="disableForms" [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)" [placeholderText]="formPlaceholderText"></search-form>
</div>
<div class="uk-width-1-1 ">
<!--link to advanced search -->
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-float-right uk-disabled uk-link-muted uk-light ':'uk-float-right uk-light'" [routerLink]=advancedSearchLink >More search options <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span>
</a>
<div *ngIf="isFiltered()" class = "uk-container uk-width-1-2@m uk-width-1-2@s uk-align-center uk-text-center uk-text-small">
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <span [innerHtml]="searchUtils.keyword"></span><a (click) = "clearKeywords() " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable " aria-hidden="true"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span></a>
</span>
<span *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " ><span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" title="value.name"></span><a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span></a>
</span>
<span *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}:
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " ><span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" title="value.name"></span><a (click) = "removeFilter(value, filter) " [class]="(disableForms)?'uk-icon-button uk-disabled':'uk-icon-button'"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
</span></span></a>
<span *ngIf="!end">, </span>
</span>
</span></span></a>
<span *ngIf="!end">, </span>
</span>
</span>
</span>
<a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
Clear All
</a>
</div>
<div *ngIf= "showUnknownFilters" class = " uk-text-center ">
<a (click)="clearFilters()" [class]="(disableForms)?'uk-disabled uk-link-muted':''">
Clear All
</a>
</div>
<div *ngIf= "showUnknownFilters" class = " uk-text-center ">
<a (click) = "clearFilters() " >Try new Query</a>
</div>
</div>
</div>
</div>
<div class="uk-container">
<helper position="top"></helper>
<div [class]="(showRefine)?'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s uk-align-center uk-margin-remove-bottom':'uk-width-1-1'">
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m">
<a href="#offcanvas-usage" uk-toggle><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="6" y="4" width="12" height="1"></rect><rect x="6" y="9" width="12" height="1"></rect><rect x="6" y="14" width="12" height="1"></rect><rect x="2" y="4" width="2" height="1"></rect><rect x="2" y="9" width="2" height="1"></rect><rect x="2" y="14" width="2" height="1"></rect></svg></a>
<div id="offcanvas-usage" uk-offcanvas>
<div class="uk-offcanvas-bar">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-text-large">Filter By:</div>
<search-filter *ngFor="let filter of filters " [addShowMore]=false [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
</div>
</div>
</div>
</div>
</div>
<div class="uk-container">
<helper position="top"></helper>
<div [class]="(showRefine)?'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s uk-align-center uk-margin-remove-bottom':'uk-width-1-1'">
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m">
<a href="#offcanvas-usage" uk-toggle><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="6" y="4" width="12" height="1"></rect><rect x="6" y="9" width="12" height="1"></rect><rect x="6" y="14" width="12" height="1"></rect><rect x="2" y="4" width="2" height="1"></rect><rect x="2" y="9" width="2" height="1"></rect><rect x="2" y="14" width="2" height="1"></rect></svg></a>
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<div id="offcanvas-usage" uk-offcanvas>
<div class="uk-offcanvas-bar">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-text-large">Filter By:</div>
<search-filter *ngFor="let filter of filters " [addShowMore]=false [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
</div>
</div>
</div>
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<div class="uk-grid uk-width-1-1 uk-margin">
</div>
<div class="uk-grid uk-width-1-1 uk-margin">
<div *ngIf="showRefine" class=" search-filters uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-visible@m">
<helper position="left"></helper>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
@ -78,30 +78,30 @@
</div>
<div *ngIf="tableViewLink || searchUtils.totalResults <=10000" class=" search-filters uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-visible@m">
<div *ngIf="tableViewLink || searchUtils.totalResults <=10000" class="uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-visible@m">
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
<helper position="right"></helper>
</div>
<div *ngIf="!(tableViewLink || searchUtils.totalResults <=10000)" class=" search-filters uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-visible@m">
<helper position="right"></helper>
<helper position="right"></helper>
</div>
<div [class]="(showRefine)?'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s uk-align-center uk-margin-remove-bottom':'uk-width-1-1'">
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<div class="uk-width-1-1">
<helper position="bottom"></helper>
</div>
</div>
<div [class]="(showRefine)?'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s uk-align-center uk-margin-remove-bottom':'uk-width-1-1'">
<search-paging [loadPaging]="loadPaging" [type]="type" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
</div>
<div class="uk-width-1-1">
<helper position="bottom"></helper>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -40,6 +40,8 @@ export class SearchPageComponent {
@Input() advancedSearchLink: string = "";
@Input() tableViewLink: string;
@Input() disableForms: boolean = false;
@Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0;
@Input() tableView: boolean = false;
@Input() searchFormClass: string = "searchForm";
@ViewChild (ModalLoading) loading : ModalLoading ;
@ -118,12 +120,15 @@ export class SearchPageComponent {
public getQueryParametersFromUrl(params){
// var parameters = "";
var allFqs = "";
this.queryParameters = new Map<string,string>();
for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i];
if(params[filterId] != undefined) {
this.queryParameters[filterId]=StringUtils.URIDecode(params[filterId]);
let values = (StringUtils.URIDecode(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0;
var fq = "";
@ -138,8 +143,6 @@ export class SearchPageComponent {
}
allFqs += fq;
}
}
var keyword = params['keyword'];
var doiQuery = "";

View File

@ -32,12 +32,14 @@
</div>
</div>
<div class="uk-container">
<div *ngIf="searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade uk-margin-top" role="alert">No Results found</div>
<!--div *ngIf="searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade uk-margin-top" role="alert">No Results found</div>
<div *ngIf="searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade uk-margin-top" role="alert">An Error Occured</div>
<div *ngIf="searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade uk-margin-top" role="alert">Service not available</div>
<div *ngIf="searchUtils.status == errorCodes.LOADING" class="uk-alert uk-alert-primary uk-animation-fade uk-margin-top" role="alert"
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading">
</div>
</div-->
<errorMessages [status]="[searchUtils.status]" [type]="'results'"></errorMessages>
<div class="uk-grid uk-width-1-1 uk-margin">
<div class="uk-width-1-1">
<helper position="top"></helper>
@ -55,18 +57,18 @@
</div>
</div>
<div *ngIf="searchUtils.totalResults > 0" class=" search-filters uk-width-1-4@l uk-width-1-4@m uk-width-1-1@s uk-margin-large-top uk-visible@m">
<div *ngIf="searchUtils.totalResults > 0" class=" search-filters uk-width-1-5@l uk-width-1-5@m uk-width-1-1@s uk-margin-large-top uk-visible@m">
<helper position="left"></helper>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
</div>
<div class="uk-width-3-4@m uk-width-3-4@l uk-width-1-1@s uk-first-column" >
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column" >
<div class="uk-overflow-container custom-dataTable-content">
<table class="uk-table uk-table-striped divider-table" #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage"
[mfData]="results | contentProvidersDatatable : [searchUtils, filters, triggerPipe]">
<thead *ngIf="searchUtils.totalResults > 0">
<tr><td colspan="5" class="uk-padding-remove-bottom uk-padding-remove-right">
<tr><td colspan="5" class="uk-padding-remove">
<span class="uk-h6">
{{searchUtils.totalResults}} content providers, page {{searchUtils.page}} of {{(totalPages())}}
</span>
@ -75,16 +77,6 @@
<!--tr><td colspan="5" class="uk-padding-remove">
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
</td></tr-->
<tr *ngIf="searchViewLink"><td colspan="5" class="uk-padding-remove-top uk-padding-remove-right uk-text-right">
<p>
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
</p>
</td></tr>
<tr>
<!-- Name Type Country Institution Compatibility -->
@ -155,9 +147,17 @@
</tbody>
</table>
</div>
</div>
<div *ngIf="searchViewLink" class="uk-margin-large-top uk-padding-remove-top uk-padding-remove-right uk-text-right">
<p>
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</a>
</p>
</div>
</div>
<helper position="bottom"></helper>
</div>

View File

@ -23,11 +23,13 @@ import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {HelperModule} from '../../utils/helper/helper.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
@NgModule({
imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, LoadingModalModule,
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule, PiwikServiceModule, HelperModule
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule,
DataTableModule, SearchFilterModule, PiwikServiceModule, HelperModule, ErrorMessagesModule
],
declarations: [
SearchPageTableViewComponent//,

View File

@ -1,15 +1,22 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ErrorCodes} from '../../utils/properties/openaireProperties';
@Component({
selector: 'search-paging',
template: `
<div class= "searchPaging uk-panel uk-margin-top uk-grid">
<div class="uk-h6 uk-margin-remove uk-width-1-1@s uk-width-1-2@m" *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages())}}
<div class= "searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom uk-padding uk-padding-remove-vertical uk-padding-remove-left">
<div class="uk-h6 uk-width-1-1@s uk-width-1-2@m" *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages(searchUtils.totalResults))}}
</div>
<div class="uk-width-1-1@s uk-width-1-2@m " *ngIf="results && searchUtils.totalResults > searchUtils.size">
<paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" > </paging>
<div class="uk-h6 uk-width-1-1@s uk-width-1-2@m" *ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING">
{{oldTotalResults}} {{type}}, page {{searchUtils.page}} of {{(totalPages(oldTotalResults))}}
</div>
<div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="results && searchUtils.totalResults > searchUtils.size">
<paging class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" > </paging>
</div>
<div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING">
<paging class="uk-float-right" [currentPage]="searchUtils.page" [totalResults]="oldTotalResults" [baseUrl]="baseUrl" [size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" > </paging>
</div>
</div>
`
@ -23,16 +30,24 @@ export class SearchPagingComponent {
@Input() parameterNames:string[];
@Input() parameterValues:string[];
@Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0;
public totalResults: number = 0;
public errorCodes:ErrorCodes = new ErrorCodes();
// @Input() totalResults:number = 0;
constructor () {
}
constructor () {}
ngOnInit() {
// this.totalResults = this.searchUtils.totalResults;
// if(!this.loadPaging && this.totalResults == 0) {
// this.totalResults = this.oldTotalResults;
// }
}
totalPages(): number {
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
totalPages(totalResults: number): number {
let totalPages:any = totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}

View File

@ -1,10 +1,11 @@
<ul [class]="'uk-list uk-list-divider uk-margin '+custom_class">
<div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
<!--div *ngIf="status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No Results found</div>
<div *ngIf="status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
<div *ngIf="status == errorCodes.OUT_OF_BOUND" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">Requested page out of bounds</div>
<div *ngIf="status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
<div *ngIf="status == errorCodes.LOADING && showLoading" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="status == errorCodes.LOADING && showLoading" class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
<li *ngFor="let result of results" class="uk-animation-fade">
<h4 class = "{{result.title.accessMode}} {{result.title.sc39}}" [title] = result.title.accessMode >

View File

@ -1,15 +1,17 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchResultComponent} from './searchResult.component';
import { RouterModule } from '@angular/router';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchResultComponent} from './searchResult.component';
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule
RouterModule, ErrorMessagesModule
],
declarations: [
SearchResultComponent,

View File

@ -20,12 +20,16 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasources" advancedSearchLink="/search/advanced/dataproviders"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
searchFormClass="datasourcesSearchForm">
</search-page>
`
})
export class SearchDataprovidersComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public totalResults:number = 0 ;
@ -35,7 +39,7 @@ export class SearchDataprovidersComponent {
public _location:Location;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
@ -43,12 +47,14 @@ export class SearchDataprovidersComponent {
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
}
@ -59,17 +65,22 @@ export class SearchDataprovidersComponent {
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -83,8 +94,8 @@ export class SearchDataprovidersComponent {
}
public getNumForEntity(entity: string, id:string) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@ -92,10 +103,10 @@ export class SearchDataprovidersComponent {
data => {
this.searchUtils.totalResults = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -104,25 +115,33 @@ export class SearchDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getNumForSearch(keyword: string) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.numOfDataproviders(keyword).subscribe(
data => {
this.searchUtils.totalResults = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -131,8 +150,15 @@ export class SearchDataprovidersComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -148,10 +174,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -160,8 +186,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -181,10 +214,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -193,8 +226,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -208,10 +248,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -220,8 +260,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -239,8 +286,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
@ -258,15 +305,15 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -274,7 +321,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -284,8 +331,16 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -297,6 +352,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
}

View File

@ -22,12 +22,16 @@ import {DOI} from '../../utils/string-utils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="datasets" advancedSearchLink="/search/advanced/datasets"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
searchFormClass="datasetsSearchForm">
</search-page>
`
})
export class SearchDatasetsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters: Filter[] =[];
// public totalResults:number = 0 ;
@ -43,12 +47,14 @@ export class SearchDatasetsComponent {
private _location:Location;
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchDatasets();
@ -60,6 +66,11 @@ export class SearchDatasetsComponent {
this.searchPage.type = "research data";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@ -99,10 +110,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Research Data for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -111,8 +122,15 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -134,10 +152,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -146,8 +164,15 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -175,8 +200,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -192,15 +217,15 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -208,7 +233,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -218,8 +243,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -233,6 +266,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);

View File

@ -20,6 +20,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="organizations" advancedSearchLink="/search/advanced/organizations"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
searchFormClass="organizationsSearchForm">
</search-page>
@ -27,6 +29,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
})
export class SearchOrganizationsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public baseUrl:string;
@ -40,13 +44,15 @@ export class SearchOrganizationsComponent {
public _location:Location;
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchOrganizations();
@ -57,6 +63,11 @@ export class SearchOrganizationsComponent {
this.searchPage.fieldIdsMap = this.fieldIdsMap;
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@ -94,8 +105,8 @@ export class SearchOrganizationsComponent {
// if(!refine && !this.searchPage){
// this.searchPage = new SearchPageComponent(this._location);
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -111,15 +122,15 @@ export class SearchOrganizationsComponent {
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -127,7 +138,7 @@ export class SearchOrganizationsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -137,8 +148,16 @@ export class SearchOrganizationsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -147,6 +166,8 @@ export class SearchOrganizationsComponent {
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);

View File

@ -20,12 +20,16 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)"
[csvParams]="csvParams" csvPath="projects" advancedSearchLink="/search/advanced/projects"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
searchFormClass="projectsSearchForm">
</search-page>
`
})
export class SearchProjectsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters: Filter[] =[];
public baseUrl:string;
@ -39,14 +43,16 @@ export class SearchProjectsComponent {
public _location:Location;
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService) {
console.info(" constructor SearchProjectsComponent "+this.refineFields.length);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
@ -59,19 +65,23 @@ export class SearchProjectsComponent {
//get refine field filters from url parameters
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
//get keyword from url parameters
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
//get keyword from url parameters
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
//get page from url parameters
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
}
firstLoad = false;
//get page from url parameters
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
});
}
@ -98,8 +108,8 @@ export class SearchProjectsComponent {
// this.searchPage = new SearchPageComponent(this._location);
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -116,15 +126,15 @@ export class SearchProjectsComponent {
this.searchPage.checkSelectedFilters(this.filters);
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -132,7 +142,7 @@ export class SearchProjectsComponent {
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -142,8 +152,16 @@ export class SearchProjectsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
}
@ -158,10 +176,10 @@ export class SearchProjectsComponent {
console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -170,14 +188,23 @@ export class SearchProjectsComponent {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public queryChanged($event) {
this.loadPaging = true;
this.urlParams = undefined;
var parameters = $event.value;
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);

View File

@ -25,6 +25,8 @@ import {DOI} from '../../utils/string-utils.class';
[csvParams]="csvParams" csvPath="publications"
advancedSearchLink="/search/advanced/publications"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
searchFormClass="publicationsSearchForm">
</search-page>
@ -32,6 +34,8 @@ import {DOI} from '../../utils/string-utils.class';
})
export class SearchPublicationsComponent {
private errorCodes: ErrorCodes;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -54,10 +58,12 @@ export class SearchPublicationsComponent {
public CSVDownloaded = false;
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
@ -69,6 +75,11 @@ export class SearchPublicationsComponent {
this.searchPage.type = "publications";
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
@ -106,10 +117,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -118,8 +129,15 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -141,10 +159,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -153,8 +171,15 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
@ -185,8 +210,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// this.searchPage = new SearchPageComponent(this._location);
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.results = [];
@ -203,16 +228,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == errorCodes.DONE) {
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -220,7 +245,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = errorCodes.OUT_OF_BOUND;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
@ -230,8 +255,16 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
@ -263,6 +296,8 @@ public getAggregatorResults(id:string, page: number, size: number){
}*/
public queryChanged($event) {
this.loadPaging = true;
var parameters = $event.value;
console.info("queryChanged: Execute search query "+parameters);
console.info("Search Pubs::page "+this.searchUtils.page);

View File

@ -78,7 +78,7 @@ export class SearchDatasetsService {
.do(res => {
this._cache.set(key, res);
})
.map(res => this.parseRefineResults(id, res['refineResults']));
.map(res => this.parseRefineResults(id, res['refineResults']))
}
searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {

View File

@ -0,0 +1,51 @@
import {Component, Input} from '@angular/core';
import {ErrorCodes} from './properties/openaireProperties';
@Component({
selector: 'errorMessages',
template: `
<div *ngIf="status.some(checkErroCode(errorCodes.LOADING))" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div>
<div *ngIf="status.every(checkErroCode(errorCodes.NONE))" class="uk-animation-fade uk-alert uk-alert-primary" role="alert">No {{type}} available</div>
<div *ngIf="status.every(checkErroCode(errorCodes.ERROR)) ||
(status.some(checkErroCode(errorCodes.ERROR)) && (!status.every(checkErroCode(errorCodes.DONE)) || !status.every(checkErroCode(errorCodes.LOADING))))"
class="uk-animation-fade uk-alert uk-alert-warning" role="alert">
An Error Occured
</div>
<div *ngIf="status.every(checkErroCode(errorCodes.NOT_AVAILABLE)) ||
(status.some(checkErroCode(errorCodes.NOT_AVAILABLE)) && (!status.every(checkErroCode(errorCodes.DONE)) || !status.every(checkErroCode(errorCodes.LOADING))))"
class="uk-animation-fade uk-alert uk-alert-warning" role="alert">
Service temprorarily unavailable. Please try again later.
</div>
<div *ngIf="status.every(checkErroCode(errorCodes.NOT_FOUND)) ||
(status.some(checkErroCode(errorCodes.NOT_FOUND)) && (!status.every(checkErroCode(errorCodes.DONE)) || !status.every(checkErroCode(errorCodes.LOADING))))"
class="uk-animation-fade uk-alert uk-alert-warning" role="alert">
No {{type}} found
</div>
<div *ngIf="status.every(checkErroCode(errorCodes.OUT_OF_BOUND))" class="uk-animation-fade uk-alert uk-alert-warning" role="alert">Requested page out of bounds</div>
`
})
export class ErrorMessagesComponent {
@Input() status: Array<number>;
@Input() type: string;
public errorCodes:ErrorCodes;
constructor () {}
ngOnInit() {
this.errorCodes = new ErrorCodes();
console.info("ngOnInit");
if(!this.status) {
this.status = [this.errorCodes.LOADING];
}
}
ngOnDestroy() {}
public checkErroCode(code: number) {
return function(status: number) {
return (status == code);
}
}
}

View File

@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {ErrorMessagesComponent} from './errorMessages.component';
@NgModule({
imports: [
CommonModule, FormsModule
],
declarations: [
ErrorMessagesComponent
],
exports: [
ErrorMessagesComponent
]
})
export class ErrorMessagesModule { }

View File

@ -3,6 +3,8 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchDataproviders {
private errorCodes: ErrorCodes;
public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any; public subResults: any;
@ -14,8 +16,8 @@ export class FetchDataproviders {
constructor ( private _searchDataprovidersService: SearchDataprovidersService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -34,8 +36,8 @@ export class FetchDataproviders {
parameters = "q=" + keyword;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,null, page, size,[]).subscribe(
@ -44,10 +46,10 @@ export class FetchDataproviders {
console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//ar errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -56,15 +58,22 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getNumForEntity(entity: string, id:string) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@ -72,10 +81,10 @@ export class FetchDataproviders {
data => {
this.searchUtils.totalResults = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -84,24 +93,31 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getNumForSearch(keyword: string) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.numOfSearchDataproviders(keyword).subscribe(
data => {
this.searchUtils.totalResults = data;
this.searchUtils.status = errorCodes.DONE;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0) {
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -110,15 +126,22 @@ export class FetchDataproviders {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getResultsForDeposit(id:string, type:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "") {
@ -128,10 +151,10 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -140,25 +163,32 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -167,15 +197,22 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
@ -191,10 +228,10 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -203,16 +240,23 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsForDataproviders(id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size).subscribe(
data => {
@ -220,10 +264,10 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -232,8 +276,15 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}

View File

@ -5,6 +5,8 @@ import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject';
export class FetchDatasets{
private errorCodes: ErrorCodes;
public results =[];
public requestComplete: Subject<void>;
@ -16,8 +18,8 @@ export class FetchDatasets{
constructor ( private _searchDatasetsService: SearchDatasetsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>();
}
@ -50,8 +52,8 @@ export class FetchDatasets{
}
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDatasetsService.searchDatasets(parameters,null, page, size, []).subscribe(
data => {
@ -59,10 +61,10 @@ export class FetchDatasets{
console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -71,15 +73,22 @@ export class FetchDatasets{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getNumForEntity(entity:string, id:string){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@ -87,10 +96,10 @@ public getNumForEntity(entity:string, id:string){
data => {
this.searchUtils.totalResults = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -99,16 +108,23 @@ public getNumForEntity(entity:string, id:string){
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
@ -124,10 +140,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Research Data for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -136,16 +152,23 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var parameters;
if(resultsFrom == "collectedFrom") {
@ -162,10 +185,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -174,39 +197,55 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getAggregatorResults(id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDatasetsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
this.requestComplete.complete();
},
err => {
this.requestComplete.complete();
console.log(err);
console.info("status: "+err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.requestComplete.complete();
}
);
}

View File

@ -3,6 +3,8 @@
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchOrganizations {
private errorCodes: ErrorCodes;
public results =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
@ -13,8 +15,8 @@ export class FetchOrganizations {
constructor ( private _searchOrganizationsService: SearchOrganizationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -35,8 +37,8 @@ export class FetchOrganizations {
parameters = "q=" + keyword;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
data => {
@ -44,10 +46,10 @@ export class FetchOrganizations {
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -56,8 +58,16 @@ export class FetchOrganizations {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}

View File

@ -3,6 +3,8 @@ import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
export class FetchProjects{
private errorCodes: ErrorCodes;
public results =[];
public filters; // for getResultsForOrganizations
@ -14,8 +16,8 @@ export class FetchProjects{
constructor (private _searchProjectsService: SearchProjectsService) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
}
@ -34,8 +36,8 @@ export class FetchProjects{
parameters = "q=" + keyword;
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
data => {
@ -43,10 +45,10 @@ export class FetchProjects{
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -55,15 +57,22 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getResultsForDataproviders(id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchProjectsService.getProjectsforDataProvider(id, page, size).subscribe(
data => {
@ -71,10 +80,10 @@ export class FetchProjects{
console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -83,15 +92,22 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getNumForEntity(entity: string, id:string) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
@ -99,10 +115,10 @@ export class FetchProjects{
data => {
this.searchUtils.totalResults = data;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -111,16 +127,24 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
data => {
@ -156,10 +180,10 @@ export class FetchProjects{
console.log(" this.funders:"+ this.funders);
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -168,8 +192,15 @@ export class FetchProjects{
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}

View File

@ -7,6 +7,8 @@ import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs/Subject';
export class FetchPublications {
private errorCodes: ErrorCodes;
public results =[];
public requestComplete: Subject<void>;
@ -30,8 +32,8 @@ export class FetchPublications {
public csvParams: string;
constructor ( private _searchPublicationsService: SearchPublicationsService ) {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.errorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
// this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
this.requestComplete = new Subject<void>();
@ -64,8 +66,8 @@ export class FetchPublications {
}
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchPublicationsService.searchPublications(parameters,null, page, size, []).subscribe(
data => {
@ -73,10 +75,10 @@ export class FetchPublications {
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -85,16 +87,22 @@ export class FetchPublications {
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
public getResultsForEntity(entity:string, id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
if(entity == "project") {
@ -111,10 +119,10 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -123,16 +131,24 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getResultsForDataproviders(id:string, resultsFrom:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
var parameters;
if(resultsFrom == "collectedFrom") {
@ -149,10 +165,10 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
@ -161,39 +177,54 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
}
}
public getAggregatorResults(id:string, page: number, size: number){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchPublicationsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
this.searchUtils.status = this.errorCodes.NONE;
}
this.requestComplete.complete();
},
err => {
this.requestComplete.complete();
console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.ERROR;
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.requestComplete.complete();
}
);
}

View File

@ -375,4 +375,5 @@ export class ErrorCodes {
public ERROR = 3;
public NOT_AVAILABLE = 4;
public OUT_OF_BOUND = 5;
public NOT_FOUND = 6;
}

View File

@ -86,6 +86,9 @@ h2 .custom-external {
.search-results {
min-height: 1100px;
}
.searchPaging {
min-height: 46px;
}
.other-results {
min-height: 300px;
}