From 19df55c77c94639efa6d54c985e94eb150706b5d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 22 Mar 2017 10:19:57 +0000 Subject: [PATCH] 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 --- .../dataProvider/dataProvider.module.ts | 4 +- .../dataProvider/datasetsTab.component.ts | 4 +- .../dataProvider/datasourcesTab.component.ts | 4 +- .../dataProvider/projectsTab.component.ts | 4 +- .../dataProvider/publicationsTab.component.ts | 4 +- .../organization/organization.component.html | 4 +- .../organization/organization.module.ts | 4 +- .../landingPages/person/person.component.html | 18 +++++---- .../app/landingPages/person/person.module.ts | 4 +- .../project/project.component.html | 8 ++-- .../landingPages/project/project.module.ts | 4 +- .../publication/publication.service.ts | 4 +- .../searchingProjectsInTab.component.ts | 4 +- .../searchingProjectsInTab.module.ts | 4 +- .../advancedSearchPage.component.ts | 1 - .../searchUtils/searchDownload.component.ts | 40 ++++++++++++++++--- .../searchUtils/searchDownload.module.ts | 3 +- .../searchUtils/searchPage.component.ts | 4 -- .../searchUtils/searchResult.component.ts | 17 +------- 19 files changed, 76 insertions(+), 63 deletions(-) diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.module.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.module.ts index 22fa2073..13e5a818 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.module.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.module.ts @@ -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: [ diff --git a/portal-2/src/app/landingPages/dataProvider/datasetsTab.component.ts b/portal-2/src/app/landingPages/dataProvider/datasetsTab.component.ts index 733aab97..d2912f68 100644 --- a/portal-2/src/app/landingPages/dataProvider/datasetsTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/datasetsTab.component.ts @@ -22,10 +22,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; View all {{fetchDatasets.searchUtils.totalResults}} results - - + ` }) diff --git a/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts b/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts index 20be0b80..a08e9f3e 100644 --- a/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/datasourcesTab.component.ts @@ -22,11 +22,11 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; View all {{fetchDataproviders.searchUtils.totalResults}} results - - + ` }) diff --git a/portal-2/src/app/landingPages/dataProvider/projectsTab.component.ts b/portal-2/src/app/landingPages/dataProvider/projectsTab.component.ts index 828a7cf8..990d06ac 100644 --- a/portal-2/src/app/landingPages/dataProvider/projectsTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/projectsTab.component.ts @@ -23,10 +23,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; View all {{fetchProjects.searchUtils.totalResults}} results - - + ` }) diff --git a/portal-2/src/app/landingPages/dataProvider/publicationsTab.component.ts b/portal-2/src/app/landingPages/dataProvider/publicationsTab.component.ts index 158e93db..55fec3fe 100644 --- a/portal-2/src/app/landingPages/dataProvider/publicationsTab.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/publicationsTab.component.ts @@ -25,10 +25,10 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; View all {{fetchPublications.searchUtils.totalResults}} results - - + ` }) diff --git a/portal-2/src/app/landingPages/organization/organization.component.html b/portal-2/src/app/landingPages/organization/organization.component.html index c3ddf4b4..cb04c035 100644 --- a/portal-2/src/app/landingPages/organization/organization.component.html +++ b/portal-2/src/app/landingPages/organization/organization.component.html @@ -136,10 +136,10 @@ View all {{fetchDataproviders.searchUtils.totalResults}} results - - + - + Results (CSV)

- + ` }) @@ -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; + } + } + } diff --git a/portal-2/src/app/searchPages/searchUtils/searchDownload.module.ts b/portal-2/src/app/searchPages/searchUtils/searchDownload.module.ts index ad327a33..2fd947e4 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchDownload.module.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchDownload.module.ts @@ -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 diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 5bcfd9f5..a0cb0cd8 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -43,9 +43,7 @@ import {ModalLoading} from '../../utils/modal/loading.component'; @@ -58,9 +56,7 @@ import {ModalLoading} from '../../utils/modal/loading.component'; diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts index dc1216bb..1655a28a 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts @@ -17,19 +17,7 @@ import {RouterHelper} from '../../utils/routerHelper.class'; - -

-

- -

- [no title available] -

-
- - +

@@ -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();