fix(xo-web/JSON schema object input): clear when un-use (#4076)
This commit is contained in:
parent
d06c3e3dd8
commit
ecfed30e6e
@ -13,6 +13,7 @@
|
||||
- [Remotes] Fixes `spawn mount EMFILE` error during backup
|
||||
- Properly redirect to sign in page instead of being stuck in a refresh loop
|
||||
- [Backup-ng] No more false positives when list matching VMs on Home page [#4078](https://github.com/vatesfr/xen-orchestra/issues/4078) (PR [#4085](https://github.com/vatesfr/xen-orchestra/pull/4085))
|
||||
- [Plugins] Properly remove optional settings when unchecking _Fill information_ (PR [#4076](https://github.com/vatesfr/xen-orchestra/pull/4076))
|
||||
|
||||
### Released packages
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { keyBy, map } from 'lodash'
|
||||
|
||||
import _ from '../intl'
|
||||
import Component from '../base-component'
|
||||
import getEventValue from '../get-event-value'
|
||||
import { EMPTY_OBJECT } from '../utils'
|
||||
|
||||
import GenericInput from './generic-input'
|
||||
@ -33,6 +34,14 @@ export default class ObjectInput extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
_onUseChange = event => {
|
||||
const use = getEventValue(event)
|
||||
if (!use) {
|
||||
this.props.onChange()
|
||||
}
|
||||
this.setState({ use })
|
||||
}
|
||||
|
||||
_getRequiredProps = createSelector(
|
||||
() => this.props.schema.required,
|
||||
required => (required ? keyBy(required) : EMPTY_OBJECT)
|
||||
@ -67,7 +76,7 @@ export default class ObjectInput extends Component {
|
||||
<input
|
||||
checked={use}
|
||||
disabled={disabled}
|
||||
onChange={this.linkState('use')}
|
||||
onChange={this._onUseChange}
|
||||
type='checkbox'
|
||||
/>{' '}
|
||||
{_('fillOptionalInformations')}
|
||||
|
Loading…
Reference in New Issue
Block a user