rushitote commented on a change in pull request #2290: URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r804353504
########## File path: web/src/components/Plugin/locales/en-US.ts ########## @@ -145,4 +145,16 @@ export default { 'component.pluginForm.limit-count.redis_cluster_name.tooltip': 'When using redis-cluster policy, this property is the name of Redis cluster service nodes.', 'component.pluginForm.limit-count.atLeast2Characters.rule': 'Please enter at least 2 characters', + // authz-casbin + 'component.pauginForm.authz-casbin.model_path.tooltip':'The path of the Casbin model configuration file.', + 'compoenet.pauginForm.authz-casbin.policy_path.tooltip': 'The path of the Casbin model configuration file.', + 'compoenet.pauginForm.authz-casbin.model.tooltip':'The Casbin model configuration in text format.', + 'compoenet.pauginForm.authz-casbin.policy.tooltip': 'The Casbin model configuration in text format.', + 'compoenet.pauginForm.authz-casbin.username.tooltip': 'The header you will be using in request to pass the username (subject).', Review comment: ```suggestion 'component.pluginForm.authz-casbin.model_path.tooltip':'The path of the Casbin model configuration file.', 'component.pluginForm.authz-casbin.policy_path.tooltip': 'The path of the Casbin model configuration file.', 'component.pluginForm.authz-casbin.model.tooltip':'The Casbin model configuration in text format.', 'component.pluginForm.authz-casbin.policy.tooltip': 'The Casbin model configuration in text format.', 'component.pluginForm.authz-casbin.username.tooltip': 'The header you will be using in request to pass the username (subject).', ``` ########## File path: web/src/components/Plugin/UI/authz-casbin.tsx ########## @@ -0,0 +1,76 @@ +import { useIntl } from "umi"; +import Form, { FormInstance } from "antd/es/form"; +import React from "react"; +import { Input } from "antd"; + +type Props = { + form: FormInstance; + schema: Record<string, any> | undefined; + ref?: any; +} + +const FORM_ITEM_LAYOUT = { + labelCol: { + span: 7, + }, + wrapperCol: { + span: 8, + }, +}; + +const AuthzCasbin: React.FC<Props> = ({ form, schema }) => { + const { formatMessage } = useIntl(); + const properties = schema?.properties + + 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.pauginForm.authz-casbin.model_path.tooltip' })} Review comment: ```suggestion tooltip={formatMessage({ id: 'component.pluginForm.authz-casbin.model_path.tooltip' })} ``` ########## File path: web/src/components/Plugin/UI/authz-casbin.tsx ########## @@ -0,0 +1,76 @@ +import { useIntl } from "umi"; +import Form, { FormInstance } from "antd/es/form"; +import React from "react"; +import { Input } from "antd"; + +type Props = { + form: FormInstance; + schema: Record<string, any> | undefined; + ref?: any; +} + +const FORM_ITEM_LAYOUT = { + labelCol: { + span: 7, + }, + wrapperCol: { + span: 8, + }, +}; + +const AuthzCasbin: React.FC<Props> = ({ form, schema }) => { + const { formatMessage } = useIntl(); + const properties = schema?.properties + + 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.pauginForm.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: 'compoenet.pauginForm.authz-casbin.policy_path.tooltip'})} Review comment: ```suggestion tooltip={formatMessage({ id: 'component.pluginForm.authz-casbin.policy_path.tooltip'})} ``` ########## File path: web/src/components/Plugin/UI/authz-casbin.tsx ########## @@ -0,0 +1,76 @@ +import { useIntl } from "umi"; +import Form, { FormInstance } from "antd/es/form"; +import React from "react"; +import { Input } from "antd"; + +type Props = { + form: FormInstance; + schema: Record<string, any> | undefined; + ref?: any; +} + +const FORM_ITEM_LAYOUT = { + labelCol: { + span: 7, + }, + wrapperCol: { + span: 8, + }, +}; + +const AuthzCasbin: React.FC<Props> = ({ form, schema }) => { + const { formatMessage } = useIntl(); + const properties = schema?.properties + + 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.pauginForm.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: 'compoenet.pauginForm.authz-casbin.policy_path.tooltip'})} + > + <Input /> + </Form.Item> + + <Form.Item + name="username" + label="username" + rules={[ + { + required: true, + message: `${formatMessage({ id: 'component.global.pleaseEnter' })} username`, + }, + ]} + initialValue={properties.username.defalt} + tooltip={formatMessage({ id:'compoenet.pauginForm.authz-casbin.username.tooltip'})} Review comment: ```suggestion tooltip={formatMessage({ id:'component.pluginForm.authz-casbin.username.tooltip'})} ``` -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org