ShawnSiao commented on a change in pull request #148: URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148#discussion_r744074910
##########
File path: src/routes/Plugin/Common/Selector.js
##########
@@ -977,11 +987,159 @@ class AddModal extends Component {
})(<Switch />)}
</FormItem>
</div>
+
+ {(pluginHandleList && pluginHandleList.length > 0) && (
+ <div className={styles.handleWrap}>
+ <div className={styles.header}>
+ <h3
style={{width:100}}>{getIntlContent("SHENYU.COMMON.DEAL")}: </h3>
+ </div>
+ <div>
+ {
+ pluginHandleList.map((handleList,index) =>{
+ return (
+ <div key={index}
style={{display:"flex",justifyContent:"space-between",flexDirection:"row"}}>
+ <ul
+ className={classnames({
+ [styles.handleUl]: true,
+ [styles.handleSelectorUl]: true,
+ [styles.springUl]: true
+ })}
+ style={{width:"100%"}}
+ >
+ {handleList&&handleList.map(item=> {
+ let required = item.required === "1";
+ let defaultValue = (item.value === 0 ||
item.value === false) ? item.value:
+ (item.value ||
+ (item.defaultValue ===
"true"?true:(item.defaultValue === "false" ? false : item.defaultValue))
+ );
+ let placeholder = item.placeholder || item.label;
+ let checkRule = item.checkRule;
+ let fieldName = item.field+index;
+ let rules = [];
+ if(required){
+ rules.push({ required: {required}, message:
getIntlContent("SHENYU.COMMON.PLEASEINPUT") + item.label});
+ }
+ if(checkRule){
+ rules.push({
+ // eslint-disable-next-line no-eval
+ pattern: eval(checkRule),
+ message:
`${getIntlContent("SHENYU.PLUGIN.RULE.INVALID")}:(${checkRule})`
+ })
+ }
+ if (item.dataType === 1) {
+ return (
+ <li key={fieldName}>
+ <Tooltip title={placeholder}>
+ <FormItem>
+ {getFieldDecorator(fieldName, {
+ rules,
+ initialValue: defaultValue,
+ })(
+ <Input
+ addonBefore={<div style={{width:
labelWidth}}>{item.label}</div>}
+ placeholder={placeholder}
+ key={fieldName}
+ type="number"
+ />)
+ }
+ </FormItem>
+ </Tooltip>
+ </li>
+ )
+ } else if (item.dataType === 3 &&
item.dictOptions) {
+ return (
+ <li key={fieldName}>
+ <Tooltip title={placeholder}>
+ <FormItem>
+ {getFieldDecorator(fieldName, {
+ rules,
+ initialValue: defaultValue,
+ })(
+ <Select
+ placeholder={placeholder}
+ style={{ width: "100%"}}
+ >
+ {item.dictOptions.map(option => {
+ return (
+ <Option key={option.dictValue}
value={option.dictValue==="true"?true:(option.dictValue==="false"?false:option.dictValue)}>
+ {option.dictName}
({item.label})
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ </Tooltip>
+ </li>
+ )
+ } else {
+ return (
+ <li key={fieldName}>
+ <Tooltip title={item.value}>
+ <FormItem>
+ {getFieldDecorator(fieldName, {
+ rules,
+ initialValue: defaultValue,
+ })(
+ <Input
+ addonBefore={<div style={{width:
labelWidth}}>{item.label}</div>}
+ placeholder={placeholder}
+ key={fieldName}
+ onChange={e=> {
+ this.onDealChange(
Review comment:
Thanks,i have created a new pull request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
