Skip to content

Commit

Permalink
Update filtering dialog results exceed count message (#418)
Browse files Browse the repository at this point in the history
* Update results count exceeded message

* change

* Update filter dialog message

* Remove unused strings

* Fix localized string

---------

Co-authored-by: Grigas <[email protected]>
  • Loading branch information
saskliutas and grigasp authored Feb 19, 2024
1 parent 75263ff commit 5e531ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-poets-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@itwin/presentation-components": patch
---

Updated message shown in hierarchy level filtering dialog when built filter still produces too many results.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
}
},
"general": {
"display-label": "Label",
"error": "Error",
"generic-error-description": "An unexpected error was encountered."
},
"property-grid": {
"too-many-elements-selected": "Too many elements selected"
},
"instance-key-value-renderer": {
"select-instance": "Select element"
},
Expand Down Expand Up @@ -43,7 +39,7 @@
"clear-hierarchy-level-filter": "Clear active filter",
"filter-dialog": {
"results-count": "Matching items",
"result-limit-exceeded": "Exceeded matching item limit of"
"result-limit-exceeded": "There are too many results to display. Please adjust your filters to limit the results count to {{itemCount}} items."
}
},
"navigation-property-editor": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { LegacyRef, MutableRefObject, RefCallback, useCallback, useEffect, useRe
import { Primitives, PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract";
import { IPropertyValueRenderer, PropertyValueRendererManager } from "@itwin/components-react";
import { assert, Guid, GuidString, IDisposable } from "@itwin/core-bentley";
import { TranslationOptions } from "@itwin/core-common";
import { Descriptor, Field, LabelCompositeValue, LabelDefinition, parseCombinedFieldNames, Ruleset, Value } from "@itwin/presentation-common";
import { Presentation } from "@itwin/presentation-frontend";
import { InstanceKeyValueRenderer } from "../properties/InstanceKeyValueRenderer";
Expand Down Expand Up @@ -51,9 +52,9 @@ export const initializePropertyValueRenderers = async () => {
*
* @internal
*/
export const translate = (stringId: string): string => {
export const translate = (stringId: string, options?: TranslationOptions): string => {
stringId = `${localizationNamespaceName}:${stringId}`;
return Presentation.localization.getLocalizedString(stringId);
return Presentation.localization.getLocalizedString(stringId, options);
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ function MatchingInstancesCount({ filter, dataProvider, parentKey }: MatchingIns
} catch (e) {
if (e instanceof PresentationError && e.errorNumber === PresentationStatus.ResultSetTooLarge) {
// ResultSetTooLarge error can't occur if sizeLimit is undefined.
return `${translate("tree.filter-dialog.result-limit-exceeded")} ${requestOptions.sizeLimit!}. ${translate("tree.please-provide")} ${translate(
"tree.additional-filtering",
)}.`;
return translate("tree.filter-dialog.result-limit-exceeded", { itemCount: requestOptions.sizeLimit!.toString() });
}
}

Expand Down

0 comments on commit 5e531ed

Please sign in to comment.