-
Notifications
You must be signed in to change notification settings - Fork 53
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
Wizard: LOCALE - Add Keyboard drop down (HMS-5096) #2651
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #2651 +/- ##
==========================================
+ Coverage 84.26% 84.80% +0.54%
==========================================
Files 170 172 +2
Lines 18874 19601 +727
Branches 1905 1922 +17
==========================================
+ Hits 15904 16623 +719
- Misses 2948 2956 +8
Partials 22 22
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
6ea4ac2
to
d4fc638
Compare
I like it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [filterValue]); | ||
|
||
const sortfn = (a: string, b: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about maybe writing all the condtion shorter? something like -
const sortfn = (a: string, b: string) => { | |
const sortfn = (a: string, b: string) => { | |
const aKeyboard = a.toLowerCase(); | |
const bKeyboard = b.toLowerCase(); | |
if (aKeyboard === filterValue || aKeyboard < bKeyboard) return -1; | |
if (bKeyboard === filterValue || bKeyboard < aKeyboard) return 1; | |
const aStartsWithFilter = aKeyboard.startsWith(filterValue); | |
const bStartsWithFilter = bKeyboard.startsWith(filterValue); | |
if (aStartsWithFilter && !bStartsWithFilter) return -1; | |
if (bStartsWithFilter && !aStartsWithFilter) return 1; | |
return aKeyboard.localeCompare(bKeyboard); | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this have the same behavior? 🤔
This adds a drop down for keyboard selection. The options are populated with an output of `localectl list-keymaps`.
This adds tests checking functionality of keyboard drop down and blueprint request with locale.
d4fc638
to
4079228
Compare
I went ahead and rebased on main and resolved the conflicts. |
src/Components/CreateImageWizard/steps/Locale/components/KeyboardDropDown.tsx
Outdated
Show resolved
Hide resolved
Noticed a weird bug where if you hit "enter" while using the dropdown and you haven't made a selection it causes the wizard to refresh. This bug affects other fields, too, such as the OpenSCAP step. |
Extracts the function used to sort packages as a utility function so it can be reused for sorting locales as well.
5f72555
to
afed99a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Since the bug I noticed (hitting enter while the typeahead is focused can cause a refresh) is also present in other typeaheads, I'm going to say we defer the responsibility to fixing that to another PR that fixes all typeahead behavior.
Failing on unit tests in pr_check. Dev checks are passing, so I'm merging. |
This adds a drop down for keyboard selection. The options are populated with an output of
localectl list-keymaps
and sorted in the order of:New tests are also added.