Skip to content

Commit

Permalink
search list: fix export urls
Browse files Browse the repository at this point in the history
* Fixes the export urls by adding the search query parameter to filter
  the exported results.
* Disables export buttons when the list of result is empty.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed Jul 28, 2020
1 parent a3fd00b commit a6e5351
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ <h5 *ngIf="types.length == 1 && showLabel">
<span class="d-none d-sm-inline">{{ 'Add' | translate }}</span>
</a>
<a role="button" class="btn btn-outline-primary ml-2" *ngIf="exportFormats && exportFormats.length == 1"
[class.disabled]="total === 0"
[href]="getExportFormatUrl(exportFormats[0].format)" >
<i class="fa fa-download mr-1"></i> {{ 'Export as' | translate }} {{ exportFormats[0].label }}
</a>
<div class="btn-group ml-2" dropdown *ngIf="exportFormats && exportFormats.length > 1">
<button
id="button-export-basic"
dropdownToggle
[disabled]="total === 0"
type="button"
class="btn btn-outline-primary dropdown-toggle"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy {
*/
getExportFormatUrl(format: string) {
const baseUrl = this._apiService.getEndpointByType(this.currentType);
let url = `${baseUrl}?&format=${format}&size=${RecordService.MAX_REST_RESULTS_SIZE}`;
let url = `${baseUrl}?q=${this.q}&format=${format}&size=${RecordService.MAX_REST_RESULTS_SIZE}`;
if (this.aggregationsFilters) {
this.aggregationsFilters.map(filter => {
filter.values.map(v => {
Expand Down

0 comments on commit a6e5351

Please sign in to comment.