Skip to content

Commit 7ad1d1b

Browse files
author
yidafu
committed
Merge branch 'main' into feature/i18n
2 parents 12f7605 + 7d76c6e commit 7ad1d1b

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

web/src/polaris/administration/breaker/faultDetect/operations/Create.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ import { TAB } from '@src/polaris/service/detail/types'
2121
import CreateDuck from './CreateDuck'
2222

2323
import { LimitMethodType, LimitMethodTypeOptions } from '@src/polaris/administration/accessLimiting/types'
24-
import { FaultDetectHttpMethodOptions, FaultDetectProtocol, FaultDetectProtocolOptions } from '../types'
24+
import {
25+
BlockHttpBodyMethod,
26+
FaultDetectHttpMethodOptions,
27+
FaultDetectProtocol,
28+
FaultDetectProtocolOptions,
29+
} from '../types'
2530
import { BreakerType } from '../../types'
2631

2732
const addArrayFieldValue = (field, defaultValue) => {
@@ -289,16 +294,18 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
289294
></Button>
290295
)}
291296
</FormItem>
292-
<FormField field={body} label={'Body'}>
293-
<TeaInput.TextArea
294-
value={body.getValue()}
295-
onChange={v => {
296-
body.setValue(v)
297-
}}
298-
size={'m'}
299-
rows={4}
300-
/>
301-
</FormField>
297+
{!BlockHttpBodyMethod.includes(method.getValue()) && (
298+
<FormField field={body} label={'Body'}>
299+
<TeaInput.TextArea
300+
value={body.getValue()}
301+
onChange={v => {
302+
body.setValue(v)
303+
}}
304+
size={'m'}
305+
rows={4}
306+
/>
307+
</FormField>
308+
)}
302309
</>
303310
)}
304311
{protocol.getValue() === FaultDetectProtocol.TCP && (

web/src/polaris/administration/breaker/faultDetect/operations/CreateDuck.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { delay } from 'redux-saga'
1010
import router from '@src/polaris/common/util/router'
1111
import { TAB } from '@src/polaris/service/detail/types'
1212
import { createFaultDetect, DescribeFaultDetects, modifyFaultDetect } from '../model'
13-
import { FaultDetectProtocol, FaultDetectRule } from '../types'
13+
import { BlockHttpBodyMethod, FaultDetectProtocol, FaultDetectRule } from '../types'
1414
import { BreakerType } from '../../types'
1515

1616
interface ComposedId {
@@ -118,10 +118,14 @@ export default class CircuitBreakerCreatePageDuck extends DetailPage {
118118
const values = ducks.form.selectors.values(yield select())
119119
const { id, namespace, service } = yield select(selectors.composedId)
120120
let result
121+
const cloneValues = JSON.parse(JSON.stringify(values))
122+
if (BlockHttpBodyMethod.includes(values.httpConfig.method as any)) {
123+
delete cloneValues.httpConfig.body
124+
}
121125
if (id) {
122-
delete values['@type']
123-
delete values.ctime
124-
delete values.mtime
126+
delete cloneValues['@type']
127+
delete cloneValues.ctime
128+
delete cloneValues.mtime
125129
result = yield modifyFaultDetect([values])
126130
} else {
127131
result = yield createFaultDetect([values])

web/src/polaris/administration/breaker/faultDetect/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ export const FaultDetectHttpMethodOptions = Object.keys(FaultDetectHttpMethod).m
5555
text: item,
5656
value: item,
5757
}))
58+
export const BlockHttpBodyMethod = [
59+
FaultDetectHttpMethod.GET,
60+
FaultDetectHttpMethod.DELETE,
61+
FaultDetectHttpMethod.HEAD,
62+
] as string[]

0 commit comments

Comments
 (0)