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 2021/04/10 17:00:02 UTC
[GitHub] [apisix-dashboard] guoqqqi opened a new pull request #1740: feat: Added fault-injection plugin form
guoqqqi opened a new pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740
Please answer these questions before submitting a pull request, **or your PR will get closed**.
**Why submit this pull request?**
added fault-injection plugin form

- [ ] Bugfix
- [x] 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:**
- [x] 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit e3cf82f42567c8555369219969a2ea9c23bbf790
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit 85871771925179b8548be5f77360cff7769312ae
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit d0112ed57eac3cbde38b2ede46f6e746e0871bc3
https://app.netlify.com/sites/apisix-dashboard/deploys/6074f00be7f1670007e2a54d
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit 150639ef922cbdaa34eecd1d238976d3ff8b5403
https://app.netlify.com/sites/apisix-dashboard/deploys/60745a6c5292840007bf52ff
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611354291
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ required
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.http_status.tooltip" })}
+ >
+ <InputNumber min={200} required />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'percentage']}
+ label='abort.percentage'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'body']}
+ label='abort.body'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.body.tooltip" })}
+ >
+ <Input min={200} />
+ </Form.Item>
+
+ <Form.List name={['abort', 'vars']}>
+ {(fields, { add, remove }) => {
+ return (
+ <div>
+ {fields.map((field, index) => (
+ <Form.Item
+ {...(index === 0 ? FORM_LIST_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
+ label={index === 0 && 'abort.vars'}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.vars.tooltip" })}
+ key={field.key}
+ >
+ <Form.Item
+ {...field}
+ validateTrigger={['onChange', 'onBlur']}
+ noStyle
+ >
+ <Select style={{ width: '70%' }}>
+ {['==', '`~=', '>', '<', '~~', '~*', 'in', 'has', '!'].map((item) => {
+ return <Select.Option value={item} key={item}>{item}</Select.Option>
+ })}
+ </Select>
+ </Form.Item>
+ {fields.length > 1 ? (
+ <MinusCircleOutlined
+ className="dynamic-delete-button"
+ style={{ margin: '0 8px' }}
+ onClick={() => {
+ remove(field.name);
+ }}
+ />
+ ) : null}
+ </Form.Item>
+ ))}
+ {
+ <Form.Item {...FORM_ITEM_WITHOUT_LABEL}>
+ <Button
+ type="dashed"
+ onClick={() => {
+ add();
+ }}
+ >
+ <PlusOutlined /> {formatMessage({ id: 'component.global.create' })}
Review comment:
It would be better to
```suggestion
<PlusOutlined /> `$({formatMessage({ id: 'component.global.create' })}) abort.vars`
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611366479
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ required
Review comment:
```suggestion
rules={[{ required: true, message: 'Please input abort.http_status!' }]}
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611735608
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -59,7 +59,7 @@ const FaultInjection: React.FC<Props> = ({ form }) => {
<Form.Item
name={['abort', 'http_status']}
label='abort.http_status'
- required
+ rules={[{ required: true, message: 'Please input abort.http_status!' }]}
Review comment:
add i18n please
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] codecov-io commented on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315895
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=h1) Report
> Merging [#1740](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=desc) (e3cf82f) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/990662a8b2b16bafb11f4c48d243ae72abead0d1?el=desc) (990662a) will **decrease** coverage by `10.29%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1740 +/- ##
===========================================
- Coverage 62.55% 52.25% -10.30%
===========================================
Files 123 38 -85
Lines 5253 2660 -2593
Branches 649 0 -649
===========================================
- Hits 3286 1390 -1896
+ Misses 1779 1082 -697
Partials 188 188
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-unit-test | `52.25% <ø> (-0.04%)` | :arrow_down: |
| frontend-e2e-test | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `81.32% <0.00%> (-0.61%)` | :arrow_down: |
| [web/src/components/RightContent/AvatarDropdown.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9jb21wb25lbnRzL1JpZ2h0Q29udGVudC9BdmF0YXJEcm9wZG93bi50c3g=) | | |
| [web/src/pages/Consumer/components/Preview.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9Db25zdW1lci9jb21wb25lbnRzL1ByZXZpZXcudHN4) | | |
| [...es/Route/components/DebugViews/DebugParamsView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL0RlYnVnVmlld3MvRGVidWdQYXJhbXNWaWV3LnRzeA==) | | |
| [web/src/pages/SSL/service.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9TU0wvc2VydmljZS50cw==) | | |
| [web/src/pages/Service/service.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9TZXJ2aWNlL3NlcnZpY2UudHM=) | | |
| [web/src/pages/SSL/components/Step2/index.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9TU0wvY29tcG9uZW50cy9TdGVwMi9pbmRleC50c3g=) | | |
| [web/src/pages/PluginTemplate/service.ts](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9QbHVnaW5UZW1wbGF0ZS9zZXJ2aWNlLnRz) | | |
| [...ages/Route/components/Step2/RequestRewriteView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL1N0ZXAyL1JlcXVlc3RSZXdyaXRlVmlldy50c3g=) | | |
| [web/src/libs/iconfont.js](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree#diff-d2ViL3NyYy9saWJzL2ljb25mb250Lmpz) | | |
| ... and [75 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1740/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=footer). Last update [990662a...e3cf82f](https://codecov.io/gh/apache/apisix-dashboard/pull/1740?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit 1bb8b879b44362f5a351dabe78255830d3fa6c17
https://app.netlify.com/sites/apisix-dashboard/deploys/6074f24a0c4f6d0007f02d6c
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] LiteSun commented on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
LiteSun commented on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-839341511
> Hello, do we still need this change?
Perhaps not.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] LiteSun commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
LiteSun commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r612871943
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ rules={[{ required: true, message: `${formatMessage({ id: 'component.pluginForm.fault-injection.abort.http_status.rules' })}` }]}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.http_status.tooltip" })}
+ >
+ <InputNumber min={200} required />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'percentage']}
+ label='abort.percentage'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'body']}
+ label='abort.body'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.body.tooltip" })}
+ >
+ <Input min={200} />
+ </Form.Item>
+
+ <Form.List name={['abort', 'vars']}>
Review comment:
We need to convert the var to the following: ` "vars": [
[
[ "arg_name","==","jack" ]
]
]`
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611366813
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ required
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.http_status.tooltip" })}
+ >
+ <InputNumber min={200} required />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'percentage']}
+ label='abort.percentage'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'body']}
+ label='abort.body'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.body.tooltip" })}
+ >
+ <Input min={200} />
+ </Form.Item>
+
+ <Form.List name={['abort', 'vars']}>
+ {(fields, { add, remove }) => {
+ return (
+ <div>
+ {fields.map((field, index) => (
+ <Form.Item
+ {...(index === 0 ? FORM_LIST_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
+ label={index === 0 && 'abort.vars'}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.vars.tooltip" })}
+ key={field.key}
+ >
+ <Form.Item
+ {...field}
+ validateTrigger={['onChange', 'onBlur']}
+ noStyle
+ >
+ <Select style={{ width: '70%' }}>
+ {['==', '`~=', '>', '<', '~~', '~*', 'in', 'has', '!'].map((item) => {
+ return <Select.Option value={item} key={item}>{item}</Select.Option>
+ })}
+ </Select>
+ </Form.Item>
+ {fields.length > 1 ? (
+ <MinusCircleOutlined
+ className="dynamic-delete-button"
+ style={{ margin: '0 8px' }}
+ onClick={() => {
+ remove(field.name);
+ }}
+ />
+ ) : null}
+ </Form.Item>
+ ))}
+ {
+ <Form.Item {...FORM_ITEM_WITHOUT_LABEL}>
+ <Button
+ type="dashed"
+ onClick={() => {
+ add();
+ }}
+ >
+ <PlusOutlined /> {formatMessage({ id: 'component.global.create' })}
+ </Button>
+ </Form.Item>
+ }
+ </div>
+ );
+ }}
+ </Form.List>
+
+ <Form.Item
+ label="delay.duration"
+ name={['delay', 'duration']}
+ required
Review comment:
```suggestion
rules={[{ required: true, message: 'Please input delay.duration!' }]}
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan closed pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
juzhiyuan closed pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315895
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit abe03c6b228aa28909999e551c6605240a46e305
https://app.netlify.com/sites/apisix-dashboard/deploys/607653c373c2d40007f62f13
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit abe03c6b228aa28909999e551c6605240a46e305
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] commented on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] commented on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit e3cf82f42567c8555369219969a2ea9c23bbf790
https://app.netlify.com/sites/apisix-dashboard/deploys/6073057a2a590b0008d1abfb
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit e5ac1ae4c0a4b780517111734aa4ce264b7d68e1
https://app.netlify.com/sites/apisix-dashboard/deploys/60756aeb0eb59a0008430a79
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611354828
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ required
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.http_status.tooltip" })}
+ >
+ <InputNumber min={200} required />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'percentage']}
+ label='abort.percentage'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'body']}
+ label='abort.body'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.body.tooltip" })}
+ >
+ <Input min={200} />
+ </Form.Item>
+
+ <Form.List name={['abort', 'vars']}>
+ {(fields, { add, remove }) => {
+ return (
+ <div>
+ {fields.map((field, index) => (
+ <Form.Item
+ {...(index === 0 ? FORM_LIST_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
+ label={index === 0 && 'abort.vars'}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.vars.tooltip" })}
+ key={field.key}
+ >
+ <Form.Item
+ {...field}
+ validateTrigger={['onChange', 'onBlur']}
+ noStyle
+ >
+ <Select style={{ width: '70%' }}>
+ {['==', '`~=', '>', '<', '~~', '~*', 'in', 'has', '!'].map((item) => {
+ return <Select.Option value={item} key={item}>{item}</Select.Option>
+ })}
+ </Select>
+ </Form.Item>
+ {fields.length > 1 ? (
+ <MinusCircleOutlined
+ className="dynamic-delete-button"
+ style={{ margin: '0 8px' }}
+ onClick={() => {
+ remove(field.name);
+ }}
+ />
+ ) : null}
+ </Form.Item>
+ ))}
+ {
+ <Form.Item {...FORM_ITEM_WITHOUT_LABEL}>
+ <Button
+ type="dashed"
+ onClick={() => {
+ add();
+ }}
+ >
+ <PlusOutlined /> {formatMessage({ id: 'component.global.create' })}
+ </Button>
+ </Form.Item>
+ }
+ </div>
+ );
+ }}
+ </Form.List>
+
+ <Form.Item
+ label="delay.duration"
+ name={['delay', 'duration']}
+ required
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.delay.duration.tooltip" })}
+ >
+ <InputNumber required />
+ </Form.Item>
+ <Form.Item
+ label="delay.percentage"
+ name={['delay', 'percentage']}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.delay.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+
+ <Form.List name={['delay', 'vars']}>
+ {(fields, { add, remove }) => {
+ return (
+ <div>
+ {fields.map((field, index) => (
+ <Form.Item
+ {...(index === 0 ? FORM_LIST_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
+ key={field.key}
+ label={index === 0 && 'delay.vars'}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.delay.vars.tooltip" })}
+ >
+ <Form.Item
+ {...field}
+ validateTrigger={['onChange', 'onBlur']}
+ noStyle
+ >
+ <Select style={{ width: '70%' }}>
+ {['==', '`~=', '>', '<', '~~', '~*', 'in', 'has', '!'].map((item) => {
+ return <Select.Option value={item} key={item}>{item}</Select.Option>
+ })}
+ </Select>
+ </Form.Item>
+ {fields.length > 1 ? (
+ <MinusCircleOutlined
+ className="dynamic-delete-button"
+ style={{ margin: '0 8px' }}
+ onClick={() => {
+ remove(field.name);
+ }}
+ />
+ ) : null}
+ </Form.Item>
+ ))}
+ {
+ <Form.Item {...FORM_ITEM_WITHOUT_LABEL}>
+ <Button
+ type="dashed"
+ onClick={() => {
+ add();
+ }}
+ >
+ <PlusOutlined /> {formatMessage({ id: 'component.global.create' })}
Review comment:
```suggestion
<PlusOutlined /> `${{formatMessage({ id: 'component.global.create' })}} delay.vars`
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit e5ac1ae4c0a4b780517111734aa4ce264b7d68e1
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit 1bb8b879b44362f5a351dabe78255830d3fa6c17
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit d0112ed57eac3cbde38b2ede46f6e746e0871bc3
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* ready!
Built with commit 9fc1848c516b22bfc2a3dab9d823903c03f07ce5
https://deploy-preview-1740--apisix-dashboard.netlify.app
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] netlify[bot] edited a comment on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
netlify[bot] edited a comment on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-817315630
Deploy preview for *apisix-dashboard* processing.
Building with commit 9fc1848c516b22bfc2a3dab9d823903c03f07ce5
https://app.netlify.com/sites/apisix-dashboard/deploys/60768a164f2d570007938af5
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#issuecomment-838206653
Hello, do we still need this 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-dashboard] liuxiran commented on a change in pull request #1740: feat: Added fault-injection plugin form
Posted by GitBox <gi...@apache.org>.
liuxiran commented on a change in pull request #1740:
URL: https://github.com/apache/apisix-dashboard/pull/1740#discussion_r611363377
##########
File path: web/src/components/Plugin/UI/fault-injection.tsx
##########
@@ -0,0 +1,201 @@
+/*
+ * 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 React from 'react';
+import type { FormInstance } from 'antd/es/form';
+import { Button, Form, Input, InputNumber, Select } from 'antd';
+import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
+
+type Props = {
+ form: FormInstance;
+};
+
+const FORM_ITEM_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 7,
+ },
+};
+
+const FORM_LIST_LAYOUT = {
+ labelCol: {
+ span: 6,
+ },
+ wrapperCol: {
+ span: 10,
+ },
+};
+
+const FORM_ITEM_WITHOUT_LABEL = {
+ wrapperCol: {
+ sm: { span: 10, offset: 6 },
+ },
+};
+
+const FaultInjection: React.FC<Props> = ({ form }) => {
+ const { formatMessage } = useIntl()
+
+ return (
+ <Form
+ form={form}
+ {...FORM_ITEM_LAYOUT}
+ >
+ <Form.Item
+ name={['abort', 'http_status']}
+ label='abort.http_status'
+ required
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.http_status.tooltip" })}
+ >
+ <InputNumber min={200} required />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'percentage']}
+ label='abort.percentage'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.percentage.tooltip" })}
+ >
+ <InputNumber min={0} max={100} />
+ </Form.Item>
+ <Form.Item
+ name={['abort', 'body']}
+ label='abort.body'
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.body.tooltip" })}
+ >
+ <Input min={200} />
+ </Form.Item>
+
+ <Form.List name={['abort', 'vars']}>
+ {(fields, { add, remove }) => {
+ return (
+ <div>
+ {fields.map((field, index) => (
+ <Form.Item
+ {...(index === 0 ? FORM_LIST_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
+ label={index === 0 && 'abort.vars'}
+ tooltip={formatMessage({ id: "component.pluginForm.fault-injection.abort.vars.tooltip" })}
+ key={field.key}
+ >
+ <Form.Item
+ {...field}
+ validateTrigger={['onChange', 'onBlur']}
+ noStyle
+ >
+ <Select style={{ width: '70%' }}>
+ {['==', '`~=', '>', '<', '~~', '~*', 'in', 'has', '!'].map((item) => {
Review comment:
It would be better to define a global constant, it would be reuse both here and route vars
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org