Skip to content

Commit

Permalink
UIIN-1547 sort statistical code types (#1425)
Browse files Browse the repository at this point in the history
Types were retrieved without being sorted. That was not helpful.

Refs UIIN-1547
  • Loading branch information
zburke authored and mkuklis committed Aug 5, 2021
1 parent af6543d commit 221a3ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for ui-inventory

## [7.1.4] IN PROGRESS

* Sort statistical code types on Statistical code settings page. Refs UIIN-1547.

## [7.1.3](https://github.com/folio-org/ui-inventory/tree/v7.1.3) (2021-07-30)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v7.1.2...v7.1.3)

Expand Down
18 changes: 10 additions & 8 deletions src/settings/StatisticalCodeSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ class StatisticalCodeSettings extends React.Component {

render() {
const statisticalCodeTypes = _.get(this.props.resources, ['statisticalCodeTypes', 'records'], []);
const statisticalCodeTypesOptions = (statisticalCodeTypes).map(statisticalCodeType => (
<option
key={statisticalCodeType.id}
value={statisticalCodeType.id}
>
{statisticalCodeType.name}
</option>
));
const statisticalCodeTypesOptions = (statisticalCodeTypes)
.sort((a, b) => a.name.localeCompare(b.name))
.map(statisticalCodeType => (
<option
key={statisticalCodeType.id}
value={statisticalCodeType.id}
>
{statisticalCodeType.name}
</option>
));

const fieldComponents = {
'statisticalCodeTypeId': ({ fieldProps }) => (
Expand Down

0 comments on commit 221a3ba

Please sign in to comment.