Skip to content

Commit 32511b0

Browse files
author
Jens Vannerum
committed
119612: Check if a warning should be shown on changes to the total elements of the search, default to 500 if no value for the configuration property was returned
(cherry picked from commit e1b773c)
1 parent 17e58ae commit 32511b0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/app/shared/search/search-export-csv/search-export-csv.component.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ConfigurationProperty } from '../../../core/shared/configuration-proper
2525
/**
2626
* Display a button to export the current search results as csv
2727
*/
28-
export class SearchExportCsvComponent implements OnInit {
28+
export class SearchExportCsvComponent implements OnInit, OnChanges {
2929

3030
/**
3131
* The current configuration of the search
@@ -71,16 +71,22 @@ export class SearchExportCsvComponent implements OnInit {
7171
this.shouldShowWarning$ = this.itemExceeds();
7272
}
7373

74+
ngOnChanges(changes: SimpleChanges): void {
75+
if (changes.total) {
76+
this.shouldShowWarning$ = this.itemExceeds();
77+
}
78+
}
79+
7480
/**
7581
* Checks if the export limit has been exceeded and updates the tooltip accordingly
7682
*/
7783
private itemExceeds(): Observable<boolean> {
78-
return this.configurationService.findByPropertyName('metadataexport.max.items').pipe(
84+
return this.configurationService.findByPropertyName('bulkedit.export.max.items').pipe(
7985
getFirstCompletedRemoteData(),
8086
map((response: RemoteData<ConfigurationProperty>) => {
81-
const limit = Number(response.payload?.values?.[0]);
82-
if (response.hasSucceeded && limit < this.total) {
83-
this.exportLimitExceededMsg = this.translateService.instant(this.exportLimitExceededKey, { limit: response.payload?.values?.[0] });
87+
const limit = Number(response.payload?.values?.[0]) || 500;
88+
if (limit < this.total) {
89+
this.exportLimitExceededMsg = this.translateService.instant(this.exportLimitExceededKey, { limit: String(limit) });
8490
return true;
8591
} else {
8692
return false;

0 commit comments

Comments
 (0)