🐛 Rule.js a besoin de parsedRule pas flatRule

pull/188/head
Mael 2018-04-12 14:30:12 +02:00
parent a2bbe69cf4
commit 4a44653b7e
1 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import { Namespace } from './rule/Rule'
@connect(state => ({
situationGate: state.situationGate,
flatRules: state.flatRules,
parsedRules: state.parsedRules,
analysis: state.analysis
}))
@translate()
@ -37,23 +37,23 @@ export default class RulePage extends Component {
}
}
setRule(name) {
let { flatRules, situationGate } = this.props,
let { parsedRules, situationGate } = this.props,
decodedRuleName = decodeRuleName(name)
if (decodedRuleName.includes(' . ')) {
let rule = findRuleByDottedName(flatRules, decodedRuleName)
let rule = findRuleByDottedName(parsedRules, decodedRuleName)
this.rule =
rule &&
head(analyse(flatRules, rule.dottedName)(situationGate).targets)
head(analyse(parsedRules, rule.dottedName)(situationGate).targets)
this.multipleMatchingRules = false
return
}
let ruleName = nameLeaf(decodeRuleName(name)),
rules = findRulesByName(flatRules, ruleName)
rules = findRulesByName(parsedRules, ruleName)
if (!rules.length) return null
if (rules.length > 1) this.multipleMatchingRules = rules
this.rule = head(
analyse(flatRules, head(rules).dottedName)(situationGate).targets
analyse(parsedRules, head(rules).dottedName)(situationGate).targets
)
}
render() {