in src/routes/Plugin/PluginRuleHandle/HystrixRuleHandle.js [133:326]
render() {
const labelWidth = 160
const { form, platform: {hystrixIsolationModeEnums} } = this.props;
const { getFieldDecorator } = form;;
const {
requestVolumeThreshold,
errorThresholdPercentage,
maxConcurrentRequests,
sleepWindowInMilliseconds,
groupKey,
commandKey,
executionIsolationStrategy,
hystrixThreadPoolConfig,
callBackUri
} = this.state;
const formItemLayout = {
labelCol: {
sm: { span: 3 }
},
wrapperCol: {
sm: { span: 21 }
}
};
// eslint-disable-next-line
return (
<Fragment>
<FormItem label={getIntlContent("SHENYU.HYSTRIX.LSOLATION.MODE")} {...formItemLayout}>
{getFieldDecorator("executionIsolationStrategy", {
rules: [{ required: true, message: getIntlContent("SHENYU.HYSTRIX.LSOLATION.SELECT") }],
initialValue: executionIsolationStrategy
})(
<Select
onChange={value => {
this.onHandleChange("executionIsolationStrategy", value);
}}
>
{hystrixIsolationModeEnums.map(item => {
return (
<Option key={item.code} value={item.code}>
{item.name}
</Option>
);
})}
</Select>
)}
</FormItem>
<div className={styles.handleWrap}>
<div className={styles.header}>
<h3>{getIntlContent("SHENYU.COMMON.DEAL")}: </h3>
</div>
<ul
className={classnames({
[styles.handleUl]: true,
[styles.springUl]: true
})}
>
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.TRIPPING.REQUEST.NUMBER")}</div>}
value={requestVolumeThreshold}
placeholder="requestVolumeThreshold"
onChange={e => {
const value = e.target.value;
this.onHandleNumberChange("requestVolumeThreshold", value);
}}
/>
</li>
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.ERROR.PERCENT")}</div>}
value={errorThresholdPercentage}
placeholder="errorThresholdPercentage"
onChange={e => {
const value = e.target.value;
this.onHandleNumberChange(
"errorThresholdPercentage",
value
);
}}
/>
</li>
{
this.state.executionIsolationStrategy === 1&&(
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.MAX.CONCURRENCY")}</div>}
value={maxConcurrentRequests}
placeholder="maxConcurrentRequests"
onChange={e => {
const value = e.target.value;
this.onHandleNumberChange("maxConcurrentRequests", value);
}}
/>
</li>
)
}
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.TRIPPING.SLEEPTIME")}</div>}
value={sleepWindowInMilliseconds}
placeholder="sleepWindowInMilliseconds"
onChange={e => {
const value = e.target.value;
this.onHandleNumberChange(
"sleepWindowInMilliseconds",
value
);
}}
/>
</li>
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.GROUPKEY")}</div>}
value={groupKey}
placeholder="GroupKey"
onChange={e => {
const value = e.target.value;
this.onHandleChange("groupKey", value);
}}
/>
</li>
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.FAILEDDEMOTION")}</div>}
value={callBackUri}
placeholder={getIntlContent("SHENYU.HYSTRIX.FAILEDCALLBACK")}
onChange={e => {
const value = e.target.value;
this.onHandleChange("callBackUri", value);
}}
/>
</li>
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.COMMANDKEY")}</div>}
value={commandKey}
placeholder="CommandKey"
onChange={e => {
const value = e.target.value;
this.onHandleChange("commandKey", value);
}}
/>
</li>
{
this.state.executionIsolationStrategy === 0 && (
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.CORETHREADSIZE")}</div>}
value={hystrixThreadPoolConfig.coreSize}
placeholder={getIntlContent("SHENYU.HYSTRIX.CORENUM")}
onChange={e => {
const value = e.target.value;
hystrixThreadPoolConfig.coreSize = value;
this.setState({hystrixThreadPoolConfig})
}}
/>
</li>
)}
{
this.state.executionIsolationStrategy === 0 && (
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.MAXSIZE")}</div>}
value={hystrixThreadPoolConfig.maximumSize}
placeholder={getIntlContent("SHENYU.HYSTRIX.MAXTHREADNUM")}
onChange={e => {
const value = e.target.value;
hystrixThreadPoolConfig.maximumSize = value;
this.setState({hystrixThreadPoolConfig})
}}
/>
</li>
)}
{
this.state.executionIsolationStrategy === 0&& (
<li>
<Input
addonBefore={<div style={{width: labelWidth}}>{getIntlContent("SHENYU.HYSTRIX.MAXTHREADQUEUE")}</div>}
value={hystrixThreadPoolConfig.maxQueueSize}
placeholder={getIntlContent("SHENYU.HYSTRIX.MAXTHREAD")}
onChange={e => {
const value = e.target.value;
hystrixThreadPoolConfig.maxQueueSize = value;
this.setState({hystrixThreadPoolConfig})
}}
/>
</li>
)}
</ul>
</div>
</Fragment>
);
}