Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
a3c908d1
Commit
a3c908d1
authored
4 years ago
by
Derek Schaller
Browse files
Options
Download
Email Patches
Plain Diff
resolver: display error for empty required option fields
parent
90db01f0
resolverRequiredOptions
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/packages/core/src/Resolver/hydrator.tsx
+7
-1
frontend/packages/core/src/Resolver/hydrator.tsx
with
7 additions
and
1 deletion
+7
-1
frontend/packages/core/src/Resolver/hydrator.tsx
+
7
-
1
View file @
a3c908d1
...
...
@@ -88,7 +88,7 @@ const OptionField = (
field
:
clutch
.
resolver
.
v1
.
IField
,
onChange
:
(
e
:
ResolverChangeEvent
)
=>
void
):
React
.
ReactElement
=>
{
cons
t
options
=
field
.
metadata
.
optionField
.
options
.
map
(
option
=>
{
le
t
options
=
field
.
metadata
.
optionField
.
options
.
map
(
option
=>
{
return
option
.
displayName
;
});
const
[
selectedIdx
,
setSelectedIdx
]
=
React
.
useState
(
0
);
...
...
@@ -108,6 +108,11 @@ const OptionField = (
});
},
[]);
const
hasError
=
field
.
metadata
.
required
&&
options
.
length
===
0
;
if
(
hasError
)
{
options
=
[
"
Error: Missing options for required field
"
];
}
return
(
<
FormControl
key
=
{
field
.
metadata
.
displayName
||
field
.
name
}
...
...
@@ -119,6 +124,7 @@ const OptionField = (
onChange
=
{
updateSelectedOption
}
name
=
{
field
.
metadata
.
displayName
||
field
.
name
}
inputProps
=
{
{
style
:
{
minWidth
:
"
100px
"
}
}
}
disabled
=
{
hasError
||
options
.
length
===
0
}
>
{
options
.
map
(
option
=>
(
<
MenuItem
key
=
{
option
}
value
=
{
option
}
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help