|
5 | 5 | import { |
6 | 6 | Component, |
7 | 7 | Input, |
| 8 | + OnChanges, |
8 | 9 | OnInit, |
| 10 | + SimpleChanges, |
9 | 11 | } from '@angular/core'; |
10 | 12 | import { Router } from '@angular/router'; |
11 | 13 | import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; |
@@ -48,7 +50,7 @@ import { SearchFilter } from '../models/search-filter.model'; |
48 | 50 | /** |
49 | 51 | * Display a button to export the current search results as csv |
50 | 52 | */ |
51 | | -export class SearchExportCsvComponent implements OnInit { |
| 53 | +export class SearchExportCsvComponent implements OnInit, OnChanges { |
52 | 54 |
|
53 | 55 | /** |
54 | 56 | * The current configuration of the search |
@@ -94,16 +96,22 @@ export class SearchExportCsvComponent implements OnInit { |
94 | 96 | this.shouldShowWarning$ = this.itemExceeds(); |
95 | 97 | } |
96 | 98 |
|
| 99 | + ngOnChanges(changes: SimpleChanges): void { |
| 100 | + if (changes.total) { |
| 101 | + this.shouldShowWarning$ = this.itemExceeds(); |
| 102 | + } |
| 103 | + } |
| 104 | + |
97 | 105 | /** |
98 | 106 | * Checks if the export limit has been exceeded and updates the tooltip accordingly |
99 | 107 | */ |
100 | 108 | private itemExceeds(): Observable<boolean> { |
101 | | - return this.configurationService.findByPropertyName('metadataexport.max.items').pipe( |
| 109 | + return this.configurationService.findByPropertyName('bulkedit.export.max.items').pipe( |
102 | 110 | getFirstCompletedRemoteData(), |
103 | 111 | map((response: RemoteData<ConfigurationProperty>) => { |
104 | | - const limit = Number(response.payload?.values?.[0]); |
105 | | - if (response.hasSucceeded && limit < this.total) { |
106 | | - this.exportLimitExceededMsg = this.translateService.instant(this.exportLimitExceededKey, { limit: response.payload?.values?.[0] }); |
| 112 | + const limit = Number(response.payload?.values?.[0]) || 500; |
| 113 | + if (limit < this.total) { |
| 114 | + this.exportLimitExceededMsg = this.translateService.instant(this.exportLimitExceededKey, { limit: String(limit) }); |
107 | 115 | return true; |
108 | 116 | } else { |
109 | 117 | return false; |
|
0 commit comments