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 {IFrameModule} from '../../utils/iframe.module';
// import { ResultLandingModule } from '../resultLanding.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 {MetricsModule} from '../metrics.module';
import { LandingModule } from '../landing.module'; import { LandingModule } from '../landing.module';
@ -33,7 +33,7 @@ import { DataProviderRoutingModule } from './dataProvider-routing.module';
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
DataProviderRoutingModule, DataProviderRoutingModule,
SearchResultsModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule TabResultModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule
], ],
declarations: [ declarations: [

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ import { PersonComponent } from './person.component';
import { PersonRoutingModule } from './person-routing.module'; import { PersonRoutingModule } from './person-routing.module';
import { LandingModule } from '../landing.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 {DatasetsServiceModule} from '../../services/datasetsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module'; import {PublicationsServiceModule} from '../../services/publicationsService.module';
@ -17,7 +17,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
LandingModule, LandingModule,
PersonRoutingModule, PersonRoutingModule,
SearchResultsModule, TabResultModule,
DatasetsServiceModule, PublicationsServiceModule DatasetsServiceModule, PublicationsServiceModule
], ],
declarations: [ declarations: [

View File

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

View File

@ -15,14 +15,14 @@ import {MetricsModule} from '../metrics.module';
import {ReportsServiceModule} from '../../services/reportsService.module'; import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module'; import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.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'; import { LandingModule } from '../landing.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, LandingModule, CommonModule, FormsModule, RouterModule, LandingModule,
ProjectRoutingModule, LoadingModalModule, ProjectRoutingModule, LoadingModalModule,
SearchResultsModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, ProjectServiceModule
], ],
declarations: [ declarations: [
ProjectComponent ProjectComponent

View File

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

View File

@ -45,9 +45,9 @@ import {RouterHelper} from '../utils/routerHelper.class';
<li></li> <li></li>
</ul> </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> type="project" urlParam="projectId" showLoading = true>
</search-result> </tab-result>
</div> </div>
` `
}) })

View File

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

View File

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

View File

@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable';
import {AlertModal} from '../../utils/modal/alert'; import {AlertModal} from '../../utils/modal/alert';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {ReportsService} from '../../services/reports.service'; import {ReportsService} from '../../services/reports.service';
import {ModalLoading} from '../../utils/modal/loading.component';
@Component({ @Component({
selector: 'search-download', selector: 'search-download',
@ -10,14 +11,14 @@ import {ReportsService} from '../../services/reports.service';
<div class= "searchDownload" *ngIf="totalResults > 0"> <div class= "searchDownload" *ngIf="totalResults > 0">
<p class="uk-text-right" *ngIf="totalResults <= 10000"> <p class="uk-text-right" *ngIf="totalResults <= 10000">
<!--a (click)="download()" href="{{downloadURLAPI}}{{type}}?format=csv&page=0&size={{totalResults}}{{csvParams}}" --> <!--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 aria-hidden="true" class="glyphicon glyphicon-download"></span>
<span class="uk-icon-download"> Results (CSV)</span> <span class="uk-icon-download"> Results (CSV)</span>
</span> </span>
</p> </p>
</div> </div>
<!--modal-alert></modal-alert--> <!--modal-alert></modal-alert-->
<modal-loading></modal-loading>
` `
}) })
@ -29,6 +30,8 @@ export class SearchDownloadComponent {
@Output() downloadClick = new EventEmitter(); @Output() downloadClick = new EventEmitter();
private downloadURLAPI: string; private downloadURLAPI: string;
@ViewChild (ModalLoading) loading : ModalLoading ;
constructor ( private _reportsService: ReportsService) {} constructor ( private _reportsService: ReportsService) {}
ngOnInit() { ngOnInit() {
@ -57,9 +60,34 @@ export class SearchDownloadComponent {
} }
downloadfile(url:string,filename:string){ downloadfile(url:string,filename:string){
console.log("Downloading file: "+ url); console.log("Downloading file: "+ url);
this._reportsService.downloadCSVFile(url) this.openLoading();
.subscribe(data => window.open(window.URL.createObjectURL(data),"reports.csv"), 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."), error => console.log("Error downloading the file."),
() => console.log('Completed file download.')); () => 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 { FormsModule } from '@angular/forms';
import {SearchDownloadComponent} from './searchDownload.component'; import {SearchDownloadComponent} from './searchDownload.component';
import{LoadingModalModule} from '../../utils/modal/loadingModal.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule CommonModule, FormsModule, LoadingModalModule
], ],
declarations: [ declarations: [
SearchDownloadComponent 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-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-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results" <search-result [results]="results"
[totalResults]="searchUtils.totalResults"
[status]=searchUtils.status [status]=searchUtils.status
[page]="searchUtils.page"
[type]="entityType" [urlParam]="urlParam"> [type]="entityType" [urlParam]="urlParam">
</search-result> </search-result>
</div> </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-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-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-result [results]="results" <search-result [results]="results"
[totalResults]="searchUtils.totalResults"
[status]=searchUtils.status [status]=searchUtils.status
[page]="searchUtils.page"
[type]="entityType" [urlParam]="urlParam"> [type]="entityType" [urlParam]="urlParam">
</search-result> </search-result>
</div> </div>

View File

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