:sparkling: Ajout d'un sélecteur pour les contrôles bloquants
parent
0a74d83b72
commit
b1bbb53370
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||
import { connect } from 'react-redux'
|
||||
import {
|
||||
noUserInputSelector,
|
||||
analysisWithDefaultsSelector
|
||||
blockingInputControlsSelector
|
||||
} from 'Selectors/analyseSelectors'
|
||||
import Conversation from './conversation/Conversation'
|
||||
import FoldedSteps, { GoToAnswers } from './conversation/FoldedSteps'
|
||||
|
@ -17,7 +17,7 @@ import withColours from './withColours'
|
|||
@withColours
|
||||
@connect(state => ({
|
||||
noUserInput: noUserInputSelector(state),
|
||||
analysis: analysisWithDefaultsSelector(state),
|
||||
blockingInputControls: blockingInputControlsSelector(state),
|
||||
conversationStarted: state.conversationStarted
|
||||
}))
|
||||
export default class Simu extends Component {
|
||||
|
@ -26,7 +26,7 @@ export default class Simu extends Component {
|
|||
colours,
|
||||
conversationStarted,
|
||||
noUserInput,
|
||||
analysis: { blockingInputControls }
|
||||
blockingInputControls
|
||||
} = this.props
|
||||
|
||||
return (
|
||||
|
|
|
@ -10,7 +10,8 @@ import { change, Field, formValueSelector, reduxForm } from 'redux-form'
|
|||
import {
|
||||
analysisWithDefaultsSelector,
|
||||
flatRulesSelector,
|
||||
noUserInputSelector
|
||||
noUserInputSelector,
|
||||
blockingInputControlsSelector
|
||||
} from 'Selectors/analyseSelectors'
|
||||
import BlueButton from './BlueButton'
|
||||
import CurrencyInput from './CurrencyInput/CurrencyInput'
|
||||
|
@ -42,6 +43,7 @@ export let popularTargetNames = [
|
|||
getTargetValue: dottedName =>
|
||||
formValueSelector('conversation')(state, dottedName),
|
||||
analysis: analysisWithDefaultsSelector(state),
|
||||
blockingInputControls: blockingInputControlsSelector(state),
|
||||
flatRules: flatRulesSelector(state),
|
||||
noUserInput: noUserInputSelector(state),
|
||||
conversationStarted: state.conversationStarted,
|
||||
|
@ -56,7 +58,12 @@ export let popularTargetNames = [
|
|||
)
|
||||
export default class TargetSelection extends Component {
|
||||
render() {
|
||||
let { conversationStarted, colours, noUserInput, analysis } = this.props
|
||||
let {
|
||||
conversationStarted,
|
||||
colours,
|
||||
noUserInput,
|
||||
blockingInputControls
|
||||
} = this.props
|
||||
return (
|
||||
<div id="targetSelection">
|
||||
<section
|
||||
|
@ -73,13 +80,12 @@ export default class TargetSelection extends Component {
|
|||
</p>
|
||||
)}
|
||||
|
||||
{analysis &&
|
||||
analysis.blockingInputControls && (
|
||||
<Controls blockingInputControls={analysis.blockingInputControls} />
|
||||
)}
|
||||
{blockingInputControls && (
|
||||
<Controls blockingInputControls={blockingInputControls} />
|
||||
)}
|
||||
|
||||
{!noUserInput &&
|
||||
!(analysis && analysis.blockingInputControls) &&
|
||||
!blockingInputControls &&
|
||||
!conversationStarted && (
|
||||
<div id="action">
|
||||
<p>
|
||||
|
@ -105,7 +111,8 @@ export default class TargetSelection extends Component {
|
|||
activeInput,
|
||||
setActiveInput,
|
||||
analysis,
|
||||
noUserInput
|
||||
noUserInput,
|
||||
blockingInputControls
|
||||
} = this.props,
|
||||
targets = analysis ? analysis.targets : []
|
||||
|
||||
|
@ -130,8 +137,7 @@ export default class TargetSelection extends Component {
|
|||
setActiveInput,
|
||||
setFormValue: this.props.setFormValue,
|
||||
noUserInput,
|
||||
blockingInputControls:
|
||||
analysis && analysis.blockingInputControls
|
||||
blockingInputControls
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -16,8 +16,7 @@ import {
|
|||
merge,
|
||||
keys,
|
||||
is,
|
||||
T,
|
||||
hasProp
|
||||
T
|
||||
} from 'ramda'
|
||||
import { Node } from './mecanismViews/common'
|
||||
import {
|
||||
|
@ -208,12 +207,14 @@ export let treatRuleRoot = (rules, rule) => {
|
|||
node.category === 'variable' && node.dottedName !== rule.dottedName
|
||||
)
|
||||
|
||||
let isInputControl = !otherVariables.length
|
||||
|
||||
return {
|
||||
level: control['niveau'],
|
||||
test: control['si'],
|
||||
message: control['message'],
|
||||
testExpression,
|
||||
...(!otherVariables.length ? { isInputControl: true } : {})
|
||||
isInputControl
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -130,6 +130,11 @@ let analysisValidatedOnlySelector = makeAnalysisSelector(
|
|||
validatedSituationSelector
|
||||
)
|
||||
|
||||
export let blockingInputControlsSelector = state => {
|
||||
let analysis = analysisWithDefaultsSelector(state)
|
||||
return analysis && analysis.blockingInputControls
|
||||
}
|
||||
|
||||
// TODO this should really not be fired twice in a user session...
|
||||
//
|
||||
// TODO the just input salary should be in the situation so that it is not a missing variable
|
||||
|
|
Loading…
Reference in New Issue