Revision 48972
Added by Konstantina Galouni over 6 years ago
compatibleDataProviders.component.ts | ||
---|---|---|
9 | 9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
10 | 10 |
import {SearchPageComponent } from '../searchUtils/searchPage.component'; |
11 | 11 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
12 |
import {ExportCSVComponent} from '../../utils/exportCSV.class'; |
|
13 | 12 |
|
14 | 13 |
@Component({ |
15 | 14 |
selector: 'search-content-providers', |
... | ... | |
21 | 20 |
[(results)] = "results" [(searchUtils)] = "searchUtils" |
22 | 21 |
[baseUrl] = "baseUrl" [showResultCount]=false |
23 | 22 |
(queryChange)="queryChanged($event)" |
24 |
(downloadClick)="downloadClicked($event)" |
|
25 | 23 |
[csvParams]="csvParams" csvPath="resources" |
26 | 24 |
[disableForms]="disableForms" |
27 | 25 |
[tableViewLink]="'/search/content-providers-table'" |
... | ... | |
176 | 174 |
} |
177 | 175 |
return filters; |
178 | 176 |
} |
179 |
|
|
180 |
public downloadClicked($event) { |
|
181 |
if(!this.CSVDownloaded) { |
|
182 |
this.CSVDownloaded = false; |
|
183 |
|
|
184 |
var parameters = $event.value; |
|
185 |
|
|
186 |
//this.getResultsCSV(parameters, false, 1, 1000); |
|
187 |
|
|
188 |
this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( |
|
189 |
data => { |
|
190 |
this.CSV.export = data; |
|
191 |
ExportCSVComponent.downloadCSV(this.CSV, "compatibleDataproviders.csv"); |
|
192 |
|
|
193 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
194 |
this.searchUtils.status = errorCodes.DONE; |
|
195 |
}, |
|
196 |
err => { |
|
197 |
console.log(err); |
|
198 |
//TODO check erros (service not available, bad request) |
|
199 |
// if( ){ |
|
200 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
201 |
// } |
|
202 |
var errorCodes:ErrorCodes = new ErrorCodes(); |
|
203 |
this.searchUtils.status = errorCodes.ERROR; |
|
204 |
} |
|
205 |
); |
|
206 |
} |
|
207 |
} |
|
208 |
|
|
209 | 177 |
} |
Also available in: Unified diff
Remove unnecessary functions for csv download in search services and components -- currently 'exportCSV.class.ts' file not used and will be deleted soon