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/01/20 07:42:52 UTC

[GitHub] [apisix-dashboard] juxianzheng opened a new pull request #2290: chore:Added form function to authz-casbin plugin

juxianzheng opened a new pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290


   Please answer these questions before submitting a pull request, **or your PR will get closed**.
   
   **Why submit this pull request?**
   
   - [ ] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   **What changes will this PR take into?**
   
   Please update this section with detailed description.
   
   **Related issues**
   
   fix/resolve #0001
   
   **Checklist:**
   
   - [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   - [ ] Have you added corresponding test cases?
   - [ ] Have you modified the corresponding document?
   - [ ] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first
   


-- 
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



[GitHub] [apisix-dashboard] juxianzheng edited a comment on pull request #2290: chore:Added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
juxianzheng edited a comment on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1017221909






-- 
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



[GitHub] [apisix-dashboard] Baoyuantop commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
Baoyuantop commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r840453059



##########
File path: README.md
##########
@@ -46,8 +46,9 @@ Note: Currently the Dashboard does not have complete coverage of Apache APISIX f
 
 ## Demo
 
+[Online Playground](https://106.55.144.26/)

Review comment:
       One PR can only complete one issue




-- 
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



[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1046204454


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2290](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (332cdb9) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0db2d464049b0d8ae4dcde1c71a68c7ea10a2a18?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0db2d46) will **decrease** coverage by `1.46%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2290      +/-   ##
   ==========================================
   - Coverage   69.87%   68.41%   -1.47%     
   ==========================================
     Files         184      128      -56     
     Lines        7274     3426    -3848     
     Branches      829      848      +19     
   ==========================================
   - Hits         5083     2344    -2739     
   + Misses       1897     1082     -815     
   + Partials      294        0     -294     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.41% <28.57%> (+0.29%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `84.61% <0.00%> (-7.06%)` | :arrow_down: |
   | [web/src/components/Plugin/UI/authz-casbin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1jYXNiaW4udHN4) | `40.00% <40.00%> (ø)` | |
   | [web/src/components/Upstream/UpstreamForm.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL1Vwc3RyZWFtRm9ybS50c3g=) | `92.37% <0.00%> (-0.04%)` | :arrow_down: |
   | [web/src/pages/Upstream/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9VcHN0cmVhbS9MaXN0LnRzeA==) | `90.00% <0.00%> (ø)` | |
   | [web/src/pages/Route/transform.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS90cmFuc2Zvcm0udHM=) | `77.77% <0.00%> (ø)` | |
   | [web/src/components/Plugin/UI/limit-count.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9saW1pdC1jb3VudC50c3g=) | `88.09% <0.00%> (ø)` | |
   | [web/src/pages/Route/components/Step1/MetaView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL1N0ZXAxL01ldGFWaWV3LnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [...omponents/Upstream/components/UpstreamSelector.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvVXBzdHJlYW1TZWxlY3Rvci50c3g=) | `100.00% <0.00%> (ø)` | |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | | |
   | [api/internal/handler/tool/tool.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdG9vbC90b29sLmdv) | | |
   | ... and [57 more](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0db2d46...332cdb9](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [apisix-dashboard] Baoyuantop commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
Baoyuantop commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r836968395



##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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 [value1, setValue1] = useState('Option1')
+  const aa = () => {
+    setValue1('Option1')
+  }
+
+  const bb = () => {
+    setValue1('Option2')
+  }

Review comment:
       Bad variable names, you can refer to https://developer.mozilla.org/en-US/docs/MDN/Guidelines/Code_guidelines/JavaScript




-- 
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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #2290: chore: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1038022101


   For the License checker CI, please add necessary information to the files.
   
   ![image](https://user-images.githubusercontent.com/2106987/153750323-d13ae898-493c-4f6b-84b5-966fe2abd85a.png)
   


-- 
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



[GitHub] [apisix-dashboard] Baoyuantop commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
Baoyuantop commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1085735018


   Better to run `yarn lint` manually.


-- 
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



[GitHub] [apisix-dashboard] juxianzheng commented on pull request #2290: chore:Added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
juxianzheng commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1017221909


   > > 
   > 
   > 嗨@juxianzheng。请添加描述和相关问题。此外,请按照清单,勾选您认为将通过检查的部分。最好放一些关于您的更改的屏幕截图。
   
   
   
   > 请在提交拉取请求之前回答这些问题,**否则您的 PR 将被关闭**。
   > 
   > **为什么要提交这个拉取请求?**
   > 
   > * [ ]  错误修复
   > * [x]  提供的新功能
   > * [ ]  提高性能
   > * [ ]  反向移植补丁
   > 
   > **此 PR 将带来哪些变化?**
   > 
   > 请使用详细说明更新此部分。
   > 
   > **相关问题**
   > 
   > 修复/解决 #1
   > 
   > **清单:**
   > 
   > * [x] 您是否解释了此 PR 解决了什么问题?或者增加了哪些新功能?
   > * [ ]  有没有添加相应的测试用例?
   > * [ ]  你修改过相应的文件吗?
   > * [ ] 这个 PR 向后兼容吗?如果不向后兼容,请先在邮件列表中讨论
   
   


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r838043706



##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
+  const { formatMessage } = useIntl();
+  const properties = schema?.properties
+  const [radioValue, setRadioValue] = useState('path');
+  const onChange = (e: any) => {
+    setRadioValue(e.target.value);
+  };
+
+  return (
+    <Form form={form} {...FORM_ITEM_LAYOUT}>
+      <Form.Item style={{ margin: '0% 0% 10% 35%' }}>

Review comment:
       Need to confirm display issues for different screen sizes




-- 
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



[GitHub] [apisix-dashboard] hsluoyz commented on pull request #2290: chore: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
hsluoyz commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1035779313


   @rushitote plz review


-- 
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



[GitHub] [apisix-dashboard] bzp2010 commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1055163198


   @juxianzheng I have read the code and I don't think you need to add separate test code for this feature, we already have testing capabilities dedicated to various plugin UI's. You can see it in this file `web/cypress/fixtures/plugin-dataset.json`, just add the corresponding json data to automatically generate the test.


-- 
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



[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1046204454


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2290](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0672346) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0db2d464049b0d8ae4dcde1c71a68c7ea10a2a18?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0db2d46) will **decrease** coverage by `1.64%`.
   > The diff coverage is `11.76%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2290      +/-   ##
   ==========================================
   - Coverage   69.87%   68.23%   -1.65%     
   ==========================================
     Files         184      132      -52     
     Lines        7274     3438    -3836     
     Branches      829      831       +2     
   ==========================================
   - Hits         5083     2346    -2737     
   + Misses       1897     1092     -805     
   + Partials      294        0     -294     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.23% <11.76%> (+0.11%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `84.61% <0.00%> (-7.06%)` | :arrow_down: |
   | [web/src/components/Plugin/UI/authz-casbin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1jYXNiaW4udHN4) | `13.33% <13.33%> (ø)` | |
   | [...omponents/Upstream/components/UpstreamSelector.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvVXBzdHJlYW1TZWxlY3Rvci50c3g=) | `85.71% <0.00%> (-14.29%)` | :arrow_down: |
   | [web/src/helpers.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9oZWxwZXJzLnRzeA==) | `70.49% <0.00%> (-3.28%)` | :arrow_down: |
   | [web/src/components/Upstream/UpstreamForm.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL1Vwc3RyZWFtRm9ybS50c3g=) | `90.12% <0.00%> (-2.29%)` | :arrow_down: |
   | [web/src/pages/PluginTemplate/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9QbHVnaW5UZW1wbGF0ZS9MaXN0LnRzeA==) | `71.42% <0.00%> (-1.08%)` | :arrow_down: |
   | [web/src/pages/Service/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9TZXJ2aWNlL0xpc3QudHN4) | `94.11% <0.00%> (-0.76%)` | :arrow_down: |
   | [web/src/pages/Consumer/Create.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Db25zdW1lci9DcmVhdGUudHN4) | `82.69% <0.00%> (ø)` | |
   | [web/src/pages/Consumer/components/Step1.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Db25zdW1lci9jb21wb25lbnRzL1N0ZXAxLnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [web/src/components/Plugin/UI/limit-count.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9saW1pdC1jb3VudC50c3g=) | `88.09% <0.00%> (ø)` | |
   | ... and [69 more](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0db2d46...0672346](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [apisix-dashboard] rushitote commented on a change in pull request #2290: chore: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: chore: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r804301828



##########
File path: CHANGELOG.md
##########
@@ -50,7 +50,7 @@ This release contains some features and bugfixes, and all the existing functiona
 ### Bugfix
 
 - fix: supports search by name for service options when add router [#2066](https://github.com/apache/apisix-dashboard/pull/2066)
-- fix: gzip plugin schema typo [#2142](https://github.com/apache/apisix-dashboard/pull/2142)
+- fix: gzip schema typo [#2142](https://github.com/apache/apisix-dashboard/pull/2142)

Review comment:
       What is the reason for this change?

##########
File path: web/src/components/Plugin/UI/authz-keycloak.tsx
##########
@@ -0,0 +1,92 @@
+import { FormInstance, Input } from "antd";
+import React from "react";
+import { useIntl } from "umi";
+import Form from "antd/es/form";
+
+type Props = {
+    form: FormInstance;
+    schema: Record<string, any> | undefined;
+    ref?: any;
+}
+
+const FORM_ITEM_LAYOUT = {
+    labelCol: {
+        span: 7,
+    },
+    wrapperCol: {
+        span: 8,
+    },
+};
+
+const AuthzKeycloak: React.FC<Props> = ({ form, schema }) => {
+    const { formatMessage } = useIntl();
+    const properties = schema?.properties
+
+    return (
+        <Form form={form} {...FORM_ITEM_LAYOUT}>
+            <Form.Item
+                name="token_endpoint"
+                label="token_endpoint"
+                rules={[
+                    {
+                        required: true,
+                        message: `${formatMessage({ id: 'component.global.pleaseEnter' })} token_endpoint`,
+                    },
+                ]}
+                initialValue={properties.token_endpoint.default}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.token_endpoint.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="grant_type"
+                label="grant_type"
+                initialValue={"urn:ietf:params:oauth:grant-type:uma-ticket"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.grant_type.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="audience"
+                label="audience"
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.audience.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="permissions"
+                label="permissions"
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.permissions.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="timeout"
+                label="timeout"
+                initialValue={3000}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.timeout.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="ssl_verify"
+                label="ssl_verify"
+                initialValue={"ture"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.ssl_verify.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="policy_enforcement_mode"
+                label="policy_enforcement_mode"
+                initialValue={"ENFORCING"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.policy_enforcement_mode.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+
+        </Form >
+    )
+}
+
+export default AuthzKeycloak

Review comment:
       need a new blank

##########
File path: web/src/components/Plugin/UI/plugin.tsx
##########
@@ -75,6 +79,11 @@ export const PluginForm: React.FC<Props> = ({ name, schema, renderForm, form })
       return <LimitConn form={form} schema={schema} />;
     case 'referer-restriction':
       return <RefererRestriction form={form} schema={schema} />;
+    case 'authz-casbin':
+      return <AuthzCasbin form={form} schema={schema} />;
+      case 'authz-keycloak':
+      return <AuthzKeycloak form={form} schema={schema} />;

Review comment:
       format code the file

##########
File path: web/src/components/Plugin/UI/authz-keycloak.tsx
##########
@@ -0,0 +1,92 @@
+import { FormInstance, Input } from "antd";
+import React from "react";
+import { useIntl } from "umi";
+import Form from "antd/es/form";
+
+type Props = {
+    form: FormInstance;
+    schema: Record<string, any> | undefined;
+    ref?: any;
+}
+
+const FORM_ITEM_LAYOUT = {
+    labelCol: {
+        span: 7,
+    },
+    wrapperCol: {
+        span: 8,
+    },
+};
+
+const AuthzKeycloak: React.FC<Props> = ({ form, schema }) => {
+    const { formatMessage } = useIntl();
+    const properties = schema?.properties
+
+    return (
+        <Form form={form} {...FORM_ITEM_LAYOUT}>
+            <Form.Item
+                name="token_endpoint"
+                label="token_endpoint"
+                rules={[
+                    {
+                        required: true,
+                        message: `${formatMessage({ id: 'component.global.pleaseEnter' })} token_endpoint`,
+                    },
+                ]}
+                initialValue={properties.token_endpoint.default}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.token_endpoint.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="grant_type"
+                label="grant_type"
+                initialValue={"urn:ietf:params:oauth:grant-type:uma-ticket"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.grant_type.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="audience"
+                label="audience"
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.audience.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="permissions"
+                label="permissions"
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.permissions.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="timeout"
+                label="timeout"
+                initialValue={3000}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.timeout.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="ssl_verify"
+                label="ssl_verify"
+                initialValue={"ture"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.ssl_verify.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+            <Form.Item
+                name="policy_enforcement_mode"
+                label="policy_enforcement_mode"
+                initialValue={"ENFORCING"}
+                tooltip={formatMessage({ id: 'component.pauginForm.authz-keycloak.policy_enforcement_mode.tooltip' })}
+            >
+                <Input />
+            </Form.Item>
+
+        </Form >
+    )
+}
+
+export default AuthzKeycloak

Review comment:
       and format the file

##########
File path: yarn.lock
##########
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1

Review comment:
       This file seems to be a redundant file

##########
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 = {

Review comment:
       Please set spaces to 2 and format the code

##########
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'})}
+            >
+              <Input/>
+            </Form.Item>
+        </Form >
+    )
+}
+
+
+
+export default AuthzCasbin

Review comment:
       Usually we need to add a new blank line at the end of the file




-- 
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



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #2290: chore: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1038022101


   For the License checker CI, please add necessary information to the files.
   
   ![image](https://user-images.githubusercontent.com/2106987/153750323-d13ae898-493c-4f6b-84b5-966fe2abd85a.png)
   


-- 
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



[GitHub] [apisix-dashboard] zaunist commented on pull request #2290: chore:Added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
zaunist commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1017210285


   > 
   
   Hi @juxianzheng. Please add description and related issue. In addition follow the checklist, tick the sections that you think will pass the check. And it's better to put some screenshoot about your change.


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on pull request #2290: chore:Added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1018082207


   1. The semantic error is need update the title, such as:
   `feat: added form function to authz-casbin plugin`
   please refer to https://github.com/zeke/semantic-pull-requests#configuration
   2. Please update the descriptive information for this PR, such as what you have done in:
   ![image](https://user-images.githubusercontent.com/72343596/150449599-61bfd684-90b2-4b0f-bec8-69089ffd5a55.png)
   
   


-- 
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



[GitHub] [apisix-dashboard] bzp2010 commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
bzp2010 commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1060000946


   > So do I still need to make changes to the code?
   
   @juxianzheng Yes, I think you'd better change to this model to achieve that.


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1046204454


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2290](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ebd5197) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0db2d464049b0d8ae4dcde1c71a68c7ea10a2a18?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0db2d46) will **decrease** coverage by `1.58%`.
   > The diff coverage is `14.28%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2290      +/-   ##
   ==========================================
   - Coverage   69.87%   68.29%   -1.59%     
   ==========================================
     Files         184      132      -52     
     Lines        7274     3435    -3839     
     Branches      829      831       +2     
   ==========================================
   - Hits         5083     2346    -2737     
   + Misses       1897     1089     -808     
   + Partials      294        0     -294     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.29% <14.28%> (+0.17%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `84.61% <0.00%> (-7.06%)` | :arrow_down: |
   | [web/src/components/Plugin/UI/authz-casbin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1jYXNiaW4udHN4) | `16.66% <16.66%> (ø)` | |
   | [...omponents/Upstream/components/UpstreamSelector.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL2NvbXBvbmVudHMvVXBzdHJlYW1TZWxlY3Rvci50c3g=) | `85.71% <0.00%> (-14.29%)` | :arrow_down: |
   | [web/src/helpers.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9oZWxwZXJzLnRzeA==) | `70.49% <0.00%> (-3.28%)` | :arrow_down: |
   | [web/src/components/Upstream/UpstreamForm.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1Vwc3RyZWFtL1Vwc3RyZWFtRm9ybS50c3g=) | `90.12% <0.00%> (-2.29%)` | :arrow_down: |
   | [web/src/pages/PluginTemplate/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9QbHVnaW5UZW1wbGF0ZS9MaXN0LnRzeA==) | `71.42% <0.00%> (-1.08%)` | :arrow_down: |
   | [web/src/pages/Service/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9TZXJ2aWNlL0xpc3QudHN4) | `94.11% <0.00%> (-0.76%)` | :arrow_down: |
   | [web/src/pages/Consumer/Create.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Db25zdW1lci9DcmVhdGUudHN4) | `82.69% <0.00%> (ø)` | |
   | [web/src/pages/Consumer/components/Step1.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Db25zdW1lci9jb21wb25lbnRzL1N0ZXAxLnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [web/src/components/Plugin/UI/limit-count.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9saW1pdC1jb3VudC50c3g=) | `88.09% <0.00%> (ø)` | |
   | ... and [69 more](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0db2d46...ebd5197](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [apisix-dashboard] codecov-commenter commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1046204454


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2290](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e66004b) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0db2d464049b0d8ae4dcde1c71a68c7ea10a2a18?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0db2d46) will **decrease** coverage by `1.86%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2290      +/-   ##
   ==========================================
   - Coverage   69.87%   68.01%   -1.87%     
   ==========================================
     Files         184      129      -55     
     Lines        7274     3389    -3885     
     Branches      829      832       +3     
   ==========================================
   - Hits         5083     2305    -2778     
   + Misses       1897     1084     -813     
   + Partials      294        0     -294     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.01% <28.57%> (-0.11%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `78.57% <0.00%> (-13.10%)` | :arrow_down: |
   | [web/src/components/Plugin/UI/authz-casbin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1jYXNiaW4udHN4) | `40.00% <40.00%> (ø)` | |
   | [web/src/components/Plugin/UI/authz-keycloak.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1rZXljbG9hay50c3g=) | `40.00% <40.00%> (ø)` | |
   | [web/src/pages/Route/transform.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS90cmFuc2Zvcm0udHM=) | `77.77% <0.00%> (ø)` | |
   | [web/src/pages/Route/components/Step1/MetaView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL1N0ZXAxL01ldGFWaWV3LnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | | |
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | | |
   | [api/internal/log/log.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2xvZy9sb2cuZ28=) | | |
   | [api/internal/handler/stream\_route/stream\_route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3RyZWFtX3JvdXRlL3N0cmVhbV9yb3V0ZS5nbw==) | | |
   | [api/internal/filter/recover.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZWNvdmVyLmdv) | | |
   | ... and [54 more](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0db2d46...e66004b](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1054927400


   cc @Baoyuantop have a look~


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r810590308



##########
File path: web/cypress/integration/plugin/authz-casbin.spec.js
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('text authz casbin plugin', () => {
+  const timeout = 5000;
+
+  const selector = {
+    pluginCardBordered: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    selectDropdown: '.ant-select-dropdown',
+    monacoMode: "[data-cy='monaco-mode']",
+    selectJSON: '.ant-select-dropdown [label=JSON]',
+    drawerFooter: '.ant-drawer-footer',
+    disabledSwitcher: '#disable',
+    checkedSwitcher: '.ant-switch-checked',
+    refresh: '.anticon-reload',
+    empty: '.ant-empty-normal',
+    conmodel_path: '#model_path',
+    conpolicy_path: '#policy_path',

Review comment:
       ```suggestion
       policyPath: '#policy_path',
   ```

##########
File path: web/cypress/integration/plugin/authz-casbin.spec.js
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('text authz casbin plugin', () => {
+  const timeout = 5000;
+
+  const selector = {
+    pluginCardBordered: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    selectDropdown: '.ant-select-dropdown',
+    monacoMode: "[data-cy='monaco-mode']",
+    selectJSON: '.ant-select-dropdown [label=JSON]',
+    drawerFooter: '.ant-drawer-footer',
+    disabledSwitcher: '#disable',
+    checkedSwitcher: '.ant-switch-checked',
+    refresh: '.anticon-reload',
+    empty: '.ant-empty-normal',
+    conmodel_path: '#model_path',

Review comment:
       ```suggestion
       modelPath: '#model_path',
   ```

##########
File path: web/cypress/integration/plugin/authz-casbin.spec.js
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('text authz casbin plugin', () => {
+  const timeout = 5000;
+
+  const selector = {
+    pluginCardBordered: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    selectDropdown: '.ant-select-dropdown',
+    monacoMode: "[data-cy='monaco-mode']",
+    selectJSON: '.ant-select-dropdown [label=JSON]',
+    drawerFooter: '.ant-drawer-footer',
+    disabledSwitcher: '#disable',
+    checkedSwitcher: '.ant-switch-checked',
+    refresh: '.anticon-reload',
+    empty: '.ant-empty-normal',
+    conmodel_path: '#model_path',
+    conpolicy_path: '#policy_path',
+    username: '#username'
+  };
+
+  const data = {
+    authzCasbin: 'authz-casbin',
+    conmodel_path: '#/path/to/model.conf',
+    conpolicy_path: '#/path/to/policy.csv',
+    conusername: '#user',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should visit plugin market and enabl plugin', function () {
+    cy.visit('/');
+    cy.contains('Plugin').click();
+    cy.contains('Enable').click();
+    cy.contains(data.authzCasbin)
+      .parents(selector.pluginCardBordered)
+      .within(() => {
+        cy.get('button').click({
+          force: true,
+        })
+      })
+    cy.get(selector.drawer)
+      .should('be.visible')
+      .within(() => {
+        cy.get(selector.disabledSwitcher).click();
+        cy.get(selector.checkedSwitcher).should('exist');
+      })
+    cy.get(selector.conmodel_path).type(data.conmodel_path);
+    cy.get(selector.conpolicy_path).type(data.conpolicy_path);

Review comment:
       ditto, Please use the small hump nomenclature

##########
File path: web/cypress/integration/plugin/authz-casbin.spec.js
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* eslint-disable no-undef */
+
+context('text authz casbin plugin', () => {
+  const timeout = 5000;
+
+  const selector = {
+    pluginCardBordered: '.ant-card-bordered',
+    drawer: '.ant-drawer-content',
+    selectDropdown: '.ant-select-dropdown',
+    monacoMode: "[data-cy='monaco-mode']",
+    selectJSON: '.ant-select-dropdown [label=JSON]',
+    drawerFooter: '.ant-drawer-footer',
+    disabledSwitcher: '#disable',
+    checkedSwitcher: '.ant-switch-checked',
+    refresh: '.anticon-reload',
+    empty: '.ant-empty-normal',
+    conmodel_path: '#model_path',
+    conpolicy_path: '#policy_path',
+    username: '#username'
+  };
+
+  const data = {
+    authzCasbin: 'authz-casbin',
+    conmodel_path: '#/path/to/model.conf',
+    conpolicy_path: '#/path/to/policy.csv',
+    conusername: '#user',
+  };
+
+  beforeEach(() => {
+    cy.login();
+  });
+
+  it('should visit plugin market and enabl plugin', function () {
+    cy.visit('/');
+    cy.contains('Plugin').click();
+    cy.contains('Enable').click();
+    cy.contains(data.authzCasbin)
+      .parents(selector.pluginCardBordered)
+      .within(() => {
+        cy.get('button').click({
+          force: true,
+        })
+      })
+    cy.get(selector.drawer)
+      .should('be.visible')
+      .within(() => {
+        cy.get(selector.disabledSwitcher).click();
+        cy.get(selector.checkedSwitcher).should('exist');
+      })
+    cy.get(selector.conmodel_path).type(data.conmodel_path);
+    cy.get(selector.conpolicy_path).type(data.conpolicy_path);
+    cy.get(selector.username).type(data.conusername);
+    cy.contains('Button', 'Submit').click();
+    cy.contains('Plugin').click();
+    cy.contains('Button','Delete').click();
+    cy.contains('Confirm').click();
+    cy.contains('Enable').click();

Review comment:
       Why click the enable button again here, please add the assertion: The message Delete this plugin successfully appears




-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1053568443


   ping


-- 
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



[GitHub] [apisix-dashboard] juxianzheng commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
juxianzheng commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1055182300


   > @juxianzheng我已经阅读了代码,我认为您不需要为此功能添加单独的测试代码,我们已经拥有专门针对各种插件 UI 的测试功能。在这个文件中可以看到`web/cypress/fixtures/plugin-dataset.json`,只需添加相应的json数据即可自动生成测试。
   
   So do I still need to make changes to the code?


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r837029530



##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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 [radio, setRadio] = useState('Options with path')

Review comment:
       Excess

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
+  const { formatMessage } = useIntl();
+  const properties = schema?.properties
+  const [value, setValue] = useState(1);

Review comment:
       ```suggestion
     const [radioValue, setRadioValue] = useState('path');
   ```
   

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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 [radio, setRadio] = useState('Options with path')
+  const aa = () => {
+    setRadio('Options with path')
+  }
+
+  const bb = () => {
+    setRadio('Options without path')
+  }
+
+  return (
+    <Form form={form} {...FORM_ITEM_LAYOUT}>
+      <Form.Item style={{ margin: '0% 0% 10% 35%' }}>
+        <Radio.Group onChange={onChange} value={value}>
+          <Radio value={1} onClick={aa}>There is path</Radio>
+          <Radio value={2} onClick={bb}>No path</Radio>

Review comment:
       ```suggestion
             <Radio value='path' onClick={() => set(XXX)}>Config Path</Radio>
             <Radio value='custom' onClick={() => set(XXX)}>Custom text</Radio>
   ```

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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 [radio, setRadio] = useState('Options with path')
+  const aa = () => {
+    setRadio('Options with path')
+  }
+
+  const bb = () => {
+    setRadio('Options without path')
+  }
+
+  return (
+    <Form form={form} {...FORM_ITEM_LAYOUT}>
+      <Form.Item style={{ margin: '0% 0% 10% 35%' }}>
+        <Radio.Group onChange={onChange} value={value}>
+          <Radio value={1} onClick={aa}>There is path</Radio>
+          <Radio value={2} onClick={bb}>No path</Radio>
+        </Radio.Group>
+      </Form.Item>
+      {radio === 'Option1' ?

Review comment:
       ```suggestion
         {radioValue === 'path' ?
   ```
   

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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);

Review comment:
       ```suggestion
       setRadioValue(e.target.value);
   ```

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+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 [radio, setRadio] = useState('Options with path')
+  const aa = () => {
+    setRadio('Options with path')
+  }
+
+  const bb = () => {
+    setRadio('Options without path')
+  }

Review comment:
       We can put that part in the onClick, This way there is no need to define functions




-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1043749386


   Hi, @juxianzheng  You need to add the test cases as well, if you encounter problems, please CC me


-- 
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



[GitHub] [apisix-dashboard] codecov-commenter edited a comment on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1046204454


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2290](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (332cdb9) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/0db2d464049b0d8ae4dcde1c71a68c7ea10a2a18?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0db2d46) will **decrease** coverage by `1.84%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #2290      +/-   ##
   ==========================================
   - Coverage   69.87%   68.03%   -1.85%     
   ==========================================
     Files         184      128      -56     
     Lines        7274     3382    -3892     
     Branches      829      831       +2     
   ==========================================
   - Hits         5083     2301    -2782     
   + Misses       1897     1081     -816     
   + Partials      294        0     -294     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `68.03% <28.57%> (-0.09%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [web/src/components/Plugin/UI/plugin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9wbHVnaW4udHN4) | `84.61% <0.00%> (-7.06%)` | :arrow_down: |
   | [web/src/components/Plugin/UI/authz-casbin.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9hdXRoei1jYXNiaW4udHN4) | `40.00% <40.00%> (ø)` | |
   | [web/src/helpers.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9oZWxwZXJzLnRzeA==) | `70.49% <0.00%> (-3.28%)` | :arrow_down: |
   | [web/src/pages/Upstream/List.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9VcHN0cmVhbS9MaXN0LnRzeA==) | `90.00% <0.00%> (ø)` | |
   | [web/src/pages/Route/transform.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS90cmFuc2Zvcm0udHM=) | `77.77% <0.00%> (ø)` | |
   | [web/src/components/Plugin/UI/limit-count.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9jb21wb25lbnRzL1BsdWdpbi9VSS9saW1pdC1jb3VudC50c3g=) | `88.09% <0.00%> (ø)` | |
   | [web/src/pages/Route/components/Step1/MetaView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL1N0ZXAxL01ldGFWaWV3LnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [api/internal/log/log.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2xvZy9sb2cuZ28=) | | |
   | [api/internal/handler/proto/proto.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcHJvdG8vcHJvdG8uZ28=) | | |
   | [api/main.go](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YXBpL21haW4uZ28=) | | |
   | ... and [56 more](https://codecov.io/gh/apache/apisix-dashboard/pull/2290/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0db2d46...332cdb9](https://codecov.io/gh/apache/apisix-dashboard/pull/2290?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [apisix-dashboard] guoqqqi commented on pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
guoqqqi commented on pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#issuecomment-1080084312


   need to fix the CI


-- 
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



[GitHub] [apisix-dashboard] Baoyuantop commented on a change in pull request #2290: feat: added form function to authz-casbin plugin

Posted by GitBox <gi...@apache.org>.
Baoyuantop commented on a change in pull request #2290:
URL: https://github.com/apache/apisix-dashboard/pull/2290#discussion_r839103419



##########
File path: web/antd-demo/.gitignore
##########
@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

Review comment:
       What is the `antd-demo` folder?

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
+  const { formatMessage } = useIntl();
+  const properties = schema?.properties
+  const [radioValue, setRadioValue] = useState('path');
+  const onChange = (e: any) => {
+    setRadioValue(e.target.value);
+  };
+
+  return (
+    <Form form={form} {...FORM_ITEM_LAYOUT}>
+      <Form.Item
+        name="Select"
+        label="Select"
+        
+      >
+        <Radio.Group onChange={onChange} value={radioValue}  style={{width:'110%'}}>
+          <Radio value={'path'} onClick={() => setRadioValue('path')}>Config Path</Radio>
+          <Radio value={'custom'} onClick={() => setRadioValue('Without path')}>Custom text</Radio>
+        </Radio.Group>
+      </Form.Item>
+      {radioValue === 'path' ?
+        <>
+          < 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' })}
+          >
+            <Input />
+          </Form.Item>
+        </>
+        :
+        <>
+          <Form.Item
+            name="model"
+            label="model"
+            rules={[
+              {
+                required: true,
+                message: `${formatMessage({ id: 'component.global.pleaseEnter' })} model`,
+              },
+            ]}
+            initialValue={properties.model_path.default}
+            tooltip={formatMessage({ id: 'compoenet.pauginForm.authz-casbin.model.tooltip' })}
+          >{ }

Review comment:
       extra

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean

Review comment:
       ```suggestion
     disabled?: boolean;
   ```

##########
File path: web/src/components/Plugin/UI/authz-casbin.tsx
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { useIntl } from "umi";
+import Form, { FormInstance } from "antd/es/form";
+import React, { useState } from "react";
+import { Radio, Input } from "antd";
+
+type Props = {
+  form: FormInstance;
+  schema: Record<string, any> | undefined;
+  ref?: any;
+  disabled?: boolean
+}
+
+const FORM_ITEM_LAYOUT = {
+  labelCol: {
+    span: 7,
+  },
+  wrapperCol: {
+    span: 8,
+  },
+};
+
+const AuthzCasbin: React.FC<Props> = ({ form, schema }) => {
+  const { formatMessage } = useIntl();
+  const properties = schema?.properties
+  const [radioValue, setRadioValue] = useState('path');
+  const onChange = (e: any) => {
+    setRadioValue(e.target.value);
+  };
+
+  return (
+    <Form form={form} {...FORM_ITEM_LAYOUT}>
+      <Form.Item
+        name="Select"
+        label="Select"
+        

Review comment:
       ```suggestion
   ```




-- 
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