Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[adoptium.net-1508] Release notes should initially be sorted by priority & component #2181

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ReleaseNotesRender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useRef, MutableRefObject } from 'react';
import { DataGrid, GridColDef, GridToolbarContainer, GridToolbarFilterButton, gridClasses } from '@mui/x-data-grid';
import { useLocation } from '@gatsbyjs/reach-router';
import queryString from 'query-string';

import { fetchReleaseNotesForVersion, useOnScreen } from '../../hooks';
import './ReleaseNotesRender.scss';

Expand Down Expand Up @@ -153,6 +152,7 @@ const ReleaseNotesRender = (): null | JSX.Element => {
sortModel: [{ field: 'priority', sort: 'asc' }],
},
}}
sortingOrder={['desc', 'asc']}
pageSizeOptions={[20, 50, 75]}
pagination
isRowSelectable={() => false}
Expand Down
16 changes: 15 additions & 1 deletion src/hooks/fetchReleaseNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@
useEffect(() => {
if (isVisible) {
(async () => {
setReleaseNotes(await fetchReleaseNote(version));
let result = await fetchReleaseNote(version);
if(result && Array.isArray(result.release_notes)) {
// issues/1508: Should initially be by (a) priority then (b) component.
result.release_notes = result.release_notes.sort((v1: ReleaseNote, v2: ReleaseNote) => {
let c = 0;
xavierfacq marked this conversation as resolved.
Show resolved Hide resolved
if(v1.priority && v2.priority) {
c = v1.priority.localeCompare(v2.priority);
}
if(c === 0 && v1.component && v2.component) {
c = v1.component.localeCompare(v2.component);
}
return c;

Check warning on line 29 in src/hooks/fetchReleaseNotes.tsx

View check run for this annotation

Codecov / codecov/patch

src/hooks/fetchReleaseNotes.tsx#L22-L29

Added lines #L22 - L29 were not covered by tests
});
}
setReleaseNotes(result);
})();
}
}, [isVisible]);
Expand Down