You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2021/11/02 16:08:09 UTC
[GitHub] [incubator-shenyu-dashboard] ShawnSiao opened a new pull request #148: fix#2278
ShawnSiao opened a new pull request #148:
URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148
fix#22
![result](https://user-images.githubusercontent.com/21096533/139896341-1736fcf4-346c-4d7d-8e50-5976d5890ddc.png)
78
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-shenyu-dashboard] ShawnSiao commented on a change in pull request #148: fix#2278
Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-shenyu-dashboard] fengzhenbing commented on a change in pull request #148: fix#2278
Posted by GitBox <gi...@apache.org>.
fengzhenbing commented on a change in pull request #148:
URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148#discussion_r742588015
##########
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:
Maybe you can write more elegant
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-shenyu-dashboard] fengzhenbing commented on a change in pull request #148: fix#2278
Posted by GitBox <gi...@apache.org>.
fengzhenbing commented on a change in pull request #148:
URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148#discussion_r742587146
##########
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:
Why did you put two parameter `item and item.label `
```
onDealChange = (value,label,item) => {
if(label === item.label){
```
Is label === item.label alway right ?
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-shenyu-dashboard] fengzhenbing closed pull request #148: fix#2278
Posted by GitBox <gi...@apache.org>.
fengzhenbing closed pull request #148:
URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-shenyu-dashboard] fengzhenbing commented on pull request #148: fix#2278
Posted by GitBox <gi...@apache.org>.
fengzhenbing commented on pull request #148:
URL: https://github.com/apache/incubator-shenyu-dashboard/pull/148#issuecomment-960508803
This is to fix https://github.com/apache/incubator-shenyu/issues/2278
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org