You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/28 01:21:15 UTC
[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: feat: added form function to authz-casbin plugin
guoqqqi commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r835996913
##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -37,54 +38,122 @@ const FORM_ITEM_LAYOUT = {
const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
const { formatMessage } = useIntl();
const properties = schema?.properties
+ const [value, setValue] = useState(1);
+ const onChange = (e:any) => {
+ setValue(e.target.value);
+ };
+
+ const [dian, setDian] = useState('houmian')
+ const aa = () => {
+ setDian('houmian')
+ }
+
+ const bb = () => {
+ setDian('qianmian')
+ }
return (
<Form form={form} {...FORM_ITEM_LAYOUT}>
- <Form.Item
- name="model_path"
- label="model_path"
- rules={[
- {
- required: true,
- message: `${formatMessage({ id: 'component.global.pleaseEnter' })} model_path`,
- },
- ]}
- initialValue={properties.model_path.default}
- tooltip={formatMessage({ id: 'component.plugForm.authz-casbin.model_path.tooltip' })}
- >
- <Input />
- </Form.Item>
- <Form.Item
- name="policy_path"
- label="policy_path"
- rules={[
- {
- required: true,
- message: `${formatMessage({ id: 'component.global.pleaseEnter' })} policy_path`,
- },
- ]}
- initialValue={properties.policy_path.default}
- tooltip={formatMessage({ id: 'component.pluginForm.authz-casbin.policy_path.tooltip' })}
- >
- <Input />
- </Form.Item>
+ <Radio.Group onChange={onChange} value={value}>
+ <Radio value={1} onClick={aa}>A</Radio>
+ <Radio value={2} onClick={bb}>B</Radio>
+ </Radio.Group>
+ {dian === 'houmian' ?
Review comment:
```suggestion
{dian === 'houmian' ?
```
Bad variable names, and we can use `value` instead of `dian` to make a judgement
##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -37,54 +38,122 @@ const FORM_ITEM_LAYOUT = {
const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
const { formatMessage } = useIntl();
const properties = schema?.properties
+ const [value, setValue] = useState(1);
+ const onChange = (e:any) => {
+ setValue(e.target.value);
+ };
+
+ const [dian, setDian] = useState('houmian')
+ const aa = () => {
+ setDian('houmian')
+ }
+
+ const bb = () => {
+ setDian('qianmian')
+ }
Review comment:
Hi, these variable names, are not particularly friendly, we can change the variable names
--
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@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org