-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display errors in SUSE Manager settings form (#2455)
* Display errors in suse manager settings form * Add a Jest test for the modal * Remove a useless jest.fn() from a test * Clear errors on canceling
- Loading branch information
1 parent
5f48538
commit 6f651ec
Showing
6 changed files
with
189 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import { get } from 'lodash'; | ||
import { flow, first } from 'lodash'; | ||
import { get, filter } from 'lodash/fp'; | ||
|
||
export const hasError = (keyword, errors) => | ||
errors.some((error) => { | ||
const pointer = get(error, ['source', 'pointer']); | ||
|
||
if (!pointer) { | ||
return false; | ||
} | ||
const pointer = get(['source', 'pointer'], error); | ||
|
||
return pointer === `/${keyword}`; | ||
}); | ||
|
||
export const getError = (keyword, errors) => | ||
flow([ | ||
filter((error) => { | ||
const pointer = get(['source', 'pointer'], error); | ||
|
||
return pointer === `/${keyword}`; | ||
}), | ||
first, | ||
get('detail'), | ||
])(errors); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters