Loading messages added when building CSV files in search result pages | component for search results separated for search pages and tabs (tab result component was created - no headers in tab results)

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46413 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-03-22 10:19:57 +00:00
parent edbe69bf51
commit 19df55c77c
19 changed files with 76 additions and 63 deletions

View File

@ -5,7 +5,7 @@ import { RouterModule } from '@angular/router';
import {IFrameModule} from '../../utils/iframe.module';
// import { ResultLandingModule } from '../resultLanding.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {MetricsModule} from '../metrics.module';
import { LandingModule } from '../landing.module';
@ -33,7 +33,7 @@ import { DataProviderRoutingModule } from './dataProvider-routing.module';
imports: [
CommonModule, FormsModule, RouterModule,
DataProviderRoutingModule,
SearchResultsModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule
TabResultModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule
],
declarations: [

View File

@ -22,10 +22,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
View all {{fetchDatasets.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDatasets.results"
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.searchUtils.status"
type="dataset" urlParam="datasetId">
</search-result>
</tab-result>
</div>
`
})

View File

@ -22,11 +22,11 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
View all {{fetchDataproviders.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDataproviders.results"
<tab-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.status"
type="dataprovider" urlParam="datasourceId"
lazy=false>
</search-result>
</tab-result>
</div>
`
})

View File

@ -23,10 +23,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
View all {{fetchProjects.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchProjects.results"
<tab-result [(results)]="fetchProjects.results"
[(status)]= "fetchProjects.status"
type="project" urlParam="projectId">
</search-result>
</tab-result>
</div>
`
})

View File

@ -25,10 +25,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
View all {{fetchPublications.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchPublications.results"
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.status"
type="publication" urlParam="articleId">
</search-result>
</tab-result>
</div>
`
})

View File

@ -136,10 +136,10 @@
View all {{fetchDataproviders.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDataproviders.results"
<tab-result [(results)]="fetchDataproviders.results"
[(status)]= "fetchDataproviders.status"
type="dataprovider" urlParam="datasourceId">
</search-result>
</tab-result>
</div>
</li>
<!--li id="metricsTab">

View File

@ -12,7 +12,7 @@ import { OrganizationComponent } from './organization.component';
import { OrganizationRoutingModule } from './organization-routing.module';
import { LandingModule } from '../landing.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.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';
@ -26,7 +26,7 @@ import { SearchingProjectsTabModule} from '../searchingProjectsInTab.module';
LoadingModalModule, AlertModalModule,
LandingModule,
OrganizationRoutingModule,
SearchResultsModule,
TabResultModule,
DataProvidersServiceModule,
ReportsServiceModule,
OrganizationServiceModule,

View File

@ -53,10 +53,11 @@
View all {{fetchPublications.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.searchUtils.status"
type="publication" urlParam="articleId">
</search-result>
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.searchUtils.status"
type="publication" urlParam="articleId"
from="person">
</tab-result>
</div>
</li>
@ -77,10 +78,11 @@
View all {{fetchDatasets.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.status"
type="dataset" urlParam="datasetId">
</search-result>
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.status"
type="dataset" urlParam="datasetId"
from="person">
</tab-result>
</div>
</li>
</ul>

View File

@ -8,7 +8,7 @@ import { PersonComponent } from './person.component';
import { PersonRoutingModule } from './person-routing.module';
import { LandingModule } from '../landing.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
@ -17,7 +17,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
CommonModule, FormsModule, RouterModule,
LandingModule,
PersonRoutingModule,
SearchResultsModule,
TabResultModule,
DatasetsServiceModule, PublicationsServiceModule
],
declarations: [

View File

@ -108,10 +108,10 @@
View all {{fetchPublications.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchPublications.results"
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.searchUtils.status"
type="publication" urlParam="articleId">
</search-result>
</tab-result>
</div>
</li>
@ -132,10 +132,10 @@
View all {{fetchDatasets.searchUtils.totalResults}} results
</a>
</div>
<search-result [(results)]="fetchDatasets.results"
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.searchUtils.status"
type="dataset" urlParam="datasetId">
</search-result>
</tab-result>
</div>
</li>
<li class="uk-animation-fade">

View File

@ -15,14 +15,14 @@ import {MetricsModule} from '../metrics.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing.module';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, LandingModule,
ProjectRoutingModule, LoadingModalModule,
SearchResultsModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule
],
declarations: [
ProjectComponent

View File

@ -255,7 +255,9 @@ export class PublicationService {
if(relation.country) {
organization.country = relation.country.classname;
}
organization.trust = Math.round(relation.trust*100)+"%";
if(relation.trust) {
organization.trust = Math.round(relation.trust*100)+"%";
}
this.publicationInfo.organizations.push(organization);
}

View File

@ -45,9 +45,9 @@ import {RouterHelper} from '../utils/routerHelper.class';
<li></li>
</ul>
<search-result [(results)]="fetchProjects.results" [(status)]= "fetchProjects.searchUtils.status"
<tab-result [(results)]="fetchProjects.results" [(status)]= "fetchProjects.searchUtils.status"
type="project" urlParam="projectId" showLoading = true>
</search-result>
</tab-result>
</div>
`
})

View File

@ -6,7 +6,7 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { ProjectsServiceModule} from '../services/projectsService.module';
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
import { TabResultModule } from '../searchPages/searchUtils/tabResult.module';
import { SearchingProjectsTabComponent} from './searchingProjectsInTab.component';
import {PagingModule } from '../utils/paging.module';
@ -15,7 +15,7 @@ import {PagingModule } from '../utils/paging.module';
@NgModule({
imports: [
RouterModule, CommonModule, FormsModule,
ProjectsServiceModule, SearchResultsModule, PagingModule
ProjectsServiceModule, TabResultModule, PagingModule
],
declarations: [
SearchingProjectsTabComponent

View File

@ -32,7 +32,6 @@ import {StringUtils, Dates} from '../../utils/string-utils.class';
<div>
<search-result [results]="results"
[status]=searchUtils.status
[page]="searchUtils.page"
[type]="entityType" [urlParam]="urlParam">
</search-result>
</div>

View File

@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable';
import {AlertModal} from '../../utils/modal/alert';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {ReportsService} from '../../services/reports.service';
import {ModalLoading} from '../../utils/modal/loading.component';
@Component({
selector: 'search-download',
@ -10,14 +11,14 @@ import {ReportsService} from '../../services/reports.service';
<div class= "searchDownload" *ngIf="totalResults > 0">
<p class="uk-text-right" *ngIf="totalResults <= 10000">
<!--a (click)="download()" href="{{downloadURLAPI}}{{type}}?format=csv&page=0&size={{totalResults}}{{csvParams}}" -->
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type='-report-'+totalResults)">
<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-download"> Results (CSV)</span>
</span>
</p>
</div>
<!--modal-alert></modal-alert-->
<modal-loading></modal-loading>
`
})
@ -29,6 +30,8 @@ export class SearchDownloadComponent {
@Output() downloadClick = new EventEmitter();
private downloadURLAPI: string;
@ViewChild (ModalLoading) loading : ModalLoading ;
constructor ( private _reportsService: ReportsService) {}
ngOnInit() {
@ -57,9 +60,34 @@ export class SearchDownloadComponent {
}
downloadfile(url:string,filename:string){
console.log("Downloading file: "+ url);
this._reportsService.downloadCSVFile(url)
.subscribe(data => window.open(window.URL.createObjectURL(data),"reports.csv"),
error => console.log("Error downloading the file."),
() => console.log('Completed file download.'));
this.openLoading();
this.setMessageLoading("Downloading CSV file");
this._reportsService.downloadCSVFile(url).subscribe(
data => {
this.closeLoading();
window.open(window.URL.createObjectURL(data),filename+".csv")
},
error => console.log("Error downloading the file."),
() => console.log('Completed file download.')
);
}
public openLoading(){
if(this.loading){
this.loading.open();
}
}
public closeLoading(){
if(this.loading){
this.loading.close();
}
}
public setMessageLoading(message: string){
if(this.loading){
this.loading.message = message;
}
}
}

View File

@ -3,10 +3,11 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchDownloadComponent} from './searchDownload.component';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
@NgModule({
imports: [
CommonModule, FormsModule
CommonModule, FormsModule, LoadingModalModule
],
declarations: [
SearchDownloadComponent

View File

@ -43,9 +43,7 @@ import {ModalLoading} from '../../utils/modal/loading.component';
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results"
[totalResults]="searchUtils.totalResults"
[status]=searchUtils.status
[page]="searchUtils.page"
[type]="entityType" [urlParam]="urlParam">
</search-result>
</div>
@ -58,9 +56,7 @@ import {ModalLoading} from '../../utils/modal/loading.component';
<search-paging [type]="type" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"></search-paging>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results"
[totalResults]="searchUtils.totalResults"
[status]=searchUtils.status
[page]="searchUtils.page"
[type]="entityType" [urlParam]="urlParam">
</search-result>
</div>

View File

@ -17,19 +17,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
<!--a href="{{result['title'].url}}"-->
<!--a [queryParams]="{articleId: 'od_______908::3a5b2885656a91307156325644e73b92'}" routerLinkActive="router-link-active" routerLink="search/publication"-->
<a *ngIf="lazy=='true'" [queryParams]="routerHelper.createQueryParam(urlParam,result.id)" routerLinkActive="router-link-active" routerLink="/search/{{type}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
<!--p *ngIf="result['title'].name == undefined || result['title'].name == ''">
{{result['title'].url}}
</p-->
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
[no title available]
</p>
</a>
<a *ngIf="lazy=='false'" href="/search/{{type}}?{{urlParam}}={{result.id}}">
<a href="/search/{{type}}?{{urlParam}}={{result.id}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
[innerHTML]="result['title'].name">
</p>
@ -142,14 +130,11 @@ import {RouterHelper} from '../../utils/routerHelper.class';
})
export class SearchResultComponent {
@Input() page: number;
@Input() totalResults: number;
@Input() results: SearchResult[];
@Input() status: number;
@Input() type: string;
@Input() urlParam: string;
@Input() showLoading: boolean = false;
@Input() lazy: string = "true";
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();