Skip to content

Commit

Permalink
fix(ui): IOChaos containerNames field (chaos-mesh#3533)
Browse files Browse the repository at this point in the history
* fix(ui): IOChaos `containerNames` field

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* chore: update CHANGELOG

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>
  • Loading branch information
g1eny0ung committed Aug 11, 2022
1 parent 3bde609 commit 620593e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 46 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For more information and how-to, see [RFC: Keep A Changelog](https://github.com/
- Respect flag `enableProfiling` and do not register profiler endpoints when it's false [#3474](https://github.com/chaos-mesh/chaos-mesh/pull/3474)
- Fix the blank screen after creating chaos experiment with "By YAML" [#3489](https://github.com/chaos-mesh/chaos-mesh/pull/3489)
- Update hint text about the manual token generating process for Kubernetes 1.24+ [#3505](https://github.com/chaos-mesh/chaos-mesh/pull/3505)
- Fix IOChaos `containerNames` field in UI [#3533](https://github.com/chaos-mesh/chaos-mesh/pull/3533)
- Fix BlockChaos can't show Chinese name. [#3536](https://github.com/chaos-mesh/chaos-mesh/pull/3536)

### Security
Expand Down
12 changes: 10 additions & 2 deletions ui/app/src/components/NewExperimentNext/Step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,16 @@ const Step2: React.FC<Step2Props> = ({ inWorkflow = false, inSchedule = false })
))}
</SelectField>
)}
<LabelField name="metadata.labels" label={i18n('k8s.labels')} />
<LabelField name="metadata.annotations" label={i18n('k8s.annotations')} />
<LabelField
name="metadata.labels"
label={i18n('k8s.labels')}
helperText={i18n('common.isKVHelperText')}
/>
<LabelField
name="metadata.annotations"
label={i18n('k8s.annotations')}
helperText={i18n('common.isKVHelperText')}
/>
</MoreOptions>
{!inWorkflow && (
<>
Expand Down
53 changes: 16 additions & 37 deletions ui/app/src/components/NewExperimentNext/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*
*/

import * as Yup from 'yup'

import { ExperimentKind } from 'components/NewExperiment/types'
Expand Down Expand Up @@ -47,6 +46,14 @@ export interface Definition {
spec?: Spec
}

const containerNames = {
field: 'label' as FieldType,
label: 'Container names',
value: [],
helperText:
"Optional. Type and end with Enter to generate the container names. If it's empty, the first container will be injected.",
}

const awsCommon: Spec = {
secretName: {
field: 'text',
Expand All @@ -69,13 +76,7 @@ const awsCommon: Spec = {
}

const blockCommon: Spec = {
containerNames: {
field: 'label',
label: 'Affected container names',
value: [],
helperText:
"Optional. Type string and end with a TAB to generate the container names. If it's empty, the first container will be injected",
},
containerNames,
volumeName: {
field: 'text',
label: 'Volume name',
Expand All @@ -91,13 +92,7 @@ const dnsCommon: Spec = {
value: [],
helperText: 'Specify the DNS patterns. For example, type google.com and then press TAB to add it.',
},
containerNames: {
field: 'label',
label: 'Affected container names',
value: [],
helperText:
"Optional. Type string and end with a TAB to generate the container names. If it's empty, the first container will be injected",
},
containerNames,
}

const gcpCommon: Spec = {
Expand Down Expand Up @@ -140,12 +135,7 @@ const ioCommon: Spec = {
value: '',
helperText: "Optional. The path of files for injecting. If it's empty, the action will inject into all files.",
},
containerName: {
field: 'text',
label: 'Container name',
value: '',
helperText: 'Optional. The target container to inject in',
},
containerNames,
percent: {
field: 'number',
label: 'Percent',
Expand Down Expand Up @@ -296,7 +286,7 @@ const networkCommon: Spec = {
field: 'label',
label: 'External targets',
value: [],
helperText: 'Type string and end with a TAB to generate the network targets outside k8s',
helperText: 'Type and end with Enter to generate the network targets outside k8s',
},
target: undefined as any,
}
Expand Down Expand Up @@ -437,7 +427,7 @@ const data: Record<Kind, Definition> = {
field: 'label',
label: 'Device names',
value: [],
helperText: 'Type string and end with a TAB to generate the device names',
helperText: 'Type and end with Enter to generate the device names',
},
},
},
Expand Down Expand Up @@ -771,12 +761,7 @@ const data: Record<Kind, Definition> = {
key: 'container-kill',
spec: {
action: 'container-kill' as any,
containerNames: {
field: 'label',
label: 'Container names',
value: [],
helperText: 'Type string and end with a TAB to generate the container names.',
},
containerNames,
},
},
],
Expand Down Expand Up @@ -814,15 +799,9 @@ const data: Record<Kind, Definition> = {
label: 'Clock ids',
value: [],
helperText:
"Optional. Type string and end with a TAB to generate the clock ids. If it's empty, it will be set to ['CLOCK_REALTIME']",
},
containerNames: {
field: 'label',
label: 'Affected container names',
value: [],
helperText:
"Optional. Type string and end with a TAB to generate the container names. If it's empty, the first container will be injected",
"Optional. Type and end with Enter to generate the clock ids. If it's empty, it will be set to ['CLOCK_REALTIME']",
},
containerNames,
},
},
JVMChaos: {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/src/components/NewExperimentNext/form/Kernel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const Kernel: React.FC<KernelProps> = ({ onSubmit }) => {
<LabelField
name="failKernRequest.headers"
label="Headers"
helperText="Type string and end with a space to generate the appropriate kernel headers"
helperText="Type and end with Enter to generate the appropriate kernel headers"
/>
<TextField
type="number"
Expand Down
6 changes: 3 additions & 3 deletions ui/app/src/components/NewExperimentNext/form/Stress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Stress: React.FC<StressProps> = ({ onSubmit }) => {
<LabelField
name="stressors.cpu.options"
label="Options of CPU stressors"
helperText="Type string and end with a space to generate the stress-ng options"
helperText="Type and end with Enter to generate the stress-ng options"
/>

<Typography>Memory</Typography>
Expand All @@ -111,7 +111,7 @@ const Stress: React.FC<StressProps> = ({ onSubmit }) => {
<LabelField
name="stressors.memory.options"
label="Options of Memory stressors"
helperText="Type string and end with a space to generate the memStress options"
helperText="Type and end with Enter to generate the memStress options"
/>
</Space>

Expand All @@ -124,7 +124,7 @@ const Stress: React.FC<StressProps> = ({ onSubmit }) => {
<LabelField
name="containerNames"
label="Container Name"
helperText="Optional. Type string and end with a space to generate the container names. If it's empty, the first container will be injected"
helperText="Optional. Type and end with Enter to generate the container names. If it's empty, the first container will be injected"
/>
</MoreOptions>

Expand Down
4 changes: 2 additions & 2 deletions ui/app/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
"durationHelper": "Supported formats of the duration are: ms / s / m / h.",
"edit": "Edit",
"ip": "IP address",
"isKVHelperText": "Type key:value and end with Enter to generate a key/value pair",
"isKVHelperText": "Type key:value and end with Enter to generate a key/value pair.",
"logout": "Logout",
"logoutDesc": "You need to re-enter the token after logging out",
"multiOptions": "Support mutiple options",
Expand Down Expand Up @@ -397,6 +397,6 @@
},
"physic": {
"address": "Address",
"addressHelper": "Type and end with Enter to add one or more chaosd addresses"
"addressHelper": "Type and end with Enter to add one or more chaosd addresses."
}
}
2 changes: 1 addition & 1 deletion ui/app/src/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"durationHelper": "持续时间支持的格式有:ms / s / m / h。",
"edit": "修改",
"ip": "IP 地址",
"isKVHelperText": "键入 key:value 并以 TAB 结尾来创建一个键值对",
"isKVHelperText": "键入 key:value 并以回车结束来创建一个键值对。",
"logout": "登出",
"logoutDesc": "登出后需要重新输入令牌",
"multiOptions": "支持多选",
Expand Down

0 comments on commit 620593e

Please sign in to comment.