fix(xo-web/JSON schema object input): clear when un-use (#4076)

This commit is contained in:
Julien Fontanet 2019-03-28 10:05:15 +01:00 committed by GitHub
parent d06c3e3dd8
commit ecfed30e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -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')}