forked from jaegertracing/jaeger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add popover and prevent submit if duration params are invalid (jaeger…
…tracing#244) (jaegertracing#291) * Add validation for duration fields in SearchForm (jaegertracing#244) Signed-off-by: Everett Ross <reverett@uber.com> * Add tests for redux-form-field-adapter Signed-off-by: Everett Ross <reverett@uber.com> * Fix boolean prop type Signed-off-by: Everett Ross <reverett@uber.com> * Add boolean for input validation, change popover to show when inactive Signed-off-by: Everett Ross <reverett@uber.com> * Add tests for onChangeAdapter Signed-off-by: Everett Ross <reverett@uber.com> * Create separate ValidatedAdaptedInput for duration fields Signed-off-by: Everett Ross <reverett@uber.com> * Remove unnecessary curly braces Signed-off-by: Everett Ross <reverett@uber.com> Signed-off-by: Everett Ross <reverett@uber.com>
- Loading branch information
1 parent
29b340d
commit e0f34e4
Showing
7 changed files
with
329 additions
and
14 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
117 changes: 117 additions & 0 deletions
117
packages/jaeger-ui/src/utils/__snapshots__/redux-form-field-adapter.test.js.snap
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 |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`reduxFormFieldAdapter not validated input should render as expected 1`] = ` | ||
<Input | ||
className="" | ||
disabled={false} | ||
meta={ | ||
Object { | ||
"active": false, | ||
"error": null, | ||
} | ||
} | ||
onBlur={null} | ||
onChange={[Function]} | ||
onFocus={null} | ||
prefixCls="ant-input" | ||
type="text" | ||
value="inputValue" | ||
/> | ||
`; | ||
|
||
exports[`reduxFormFieldAdapter validate input should render Popover as invisible if there is an error but the field is active 1`] = ` | ||
<Popover | ||
content="error content" | ||
mouseEnterDelay={0.1} | ||
mouseLeaveDelay={0.1} | ||
overlayStyle={Object {}} | ||
placement="bottomLeft" | ||
prefixCls="ant-popover" | ||
title="error title" | ||
transitionName="zoom-big" | ||
trigger="hover" | ||
visible={false} | ||
> | ||
<Input | ||
className="AdaptedReduxFormField--isValidatedInput" | ||
disabled={false} | ||
meta={ | ||
Object { | ||
"active": true, | ||
"error": Object { | ||
"content": "error content", | ||
"title": "error title", | ||
}, | ||
} | ||
} | ||
onBlur={[Function]} | ||
onChange={[Function]} | ||
prefixCls="ant-input" | ||
type="text" | ||
value="inputValue" | ||
/> | ||
</Popover> | ||
`; | ||
|
||
exports[`reduxFormFieldAdapter validate input should render Popover as visible if there is an error and the field is not active 1`] = ` | ||
<Popover | ||
content="error content" | ||
mouseEnterDelay={0.1} | ||
mouseLeaveDelay={0.1} | ||
overlayStyle={Object {}} | ||
placement="bottomLeft" | ||
prefixCls="ant-popover" | ||
title="error title" | ||
transitionName="zoom-big" | ||
trigger="hover" | ||
visible={true} | ||
> | ||
<Input | ||
className="is-invalid AdaptedReduxFormField--isValidatedInput" | ||
disabled={false} | ||
meta={ | ||
Object { | ||
"active": false, | ||
"error": Object { | ||
"content": "error content", | ||
"title": "error title", | ||
}, | ||
} | ||
} | ||
onBlur={[Function]} | ||
onChange={[Function]} | ||
prefixCls="ant-input" | ||
type="text" | ||
value="inputValue" | ||
/> | ||
</Popover> | ||
`; | ||
|
||
exports[`reduxFormFieldAdapter validate input should render as expected when there is not an error 1`] = ` | ||
<Popover | ||
mouseEnterDelay={0.1} | ||
mouseLeaveDelay={0.1} | ||
overlayStyle={Object {}} | ||
placement="bottomLeft" | ||
prefixCls="ant-popover" | ||
transitionName="zoom-big" | ||
trigger="hover" | ||
visible={false} | ||
> | ||
<Input | ||
className="AdaptedReduxFormField--isValidatedInput" | ||
disabled={false} | ||
meta={ | ||
Object { | ||
"active": false, | ||
"error": null, | ||
} | ||
} | ||
onBlur={[Function]} | ||
onChange={[Function]} | ||
prefixCls="ant-input" | ||
type="text" | ||
value="inputValue" | ||
/> | ||
</Popover> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright (c) 2018 Uber Technologies, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.AdaptedReduxFormField--isValidatedInput.is-invalid { | ||
background: #fff9f8; | ||
border: 1px solid #c00; | ||
} |
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
Oops, something went wrong.