File tree Expand file tree Collapse file tree 3 files changed +31
-15
lines changed
web/src/polaris/administration/breaker/faultDetect Expand file tree Collapse file tree 3 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,12 @@ import { TAB } from '@src/polaris/service/detail/types'
21
21
import CreateDuck from './CreateDuck'
22
22
23
23
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'
25
30
import { BreakerType } from '../../types'
26
31
27
32
const addArrayFieldValue = ( field , defaultValue ) => {
@@ -289,16 +294,18 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
289
294
> </ Button >
290
295
) }
291
296
</ 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
+ ) }
302
309
</ >
303
310
) }
304
311
{ protocol . getValue ( ) === FaultDetectProtocol . TCP && (
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { delay } from 'redux-saga'
10
10
import router from '@src/polaris/common/util/router'
11
11
import { TAB } from '@src/polaris/service/detail/types'
12
12
import { createFaultDetect , DescribeFaultDetects , modifyFaultDetect } from '../model'
13
- import { FaultDetectProtocol , FaultDetectRule } from '../types'
13
+ import { BlockHttpBodyMethod , FaultDetectProtocol , FaultDetectRule } from '../types'
14
14
import { BreakerType } from '../../types'
15
15
16
16
interface ComposedId {
@@ -118,10 +118,14 @@ export default class CircuitBreakerCreatePageDuck extends DetailPage {
118
118
const values = ducks . form . selectors . values ( yield select ( ) )
119
119
const { id, namespace, service } = yield select ( selectors . composedId )
120
120
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
+ }
121
125
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
125
129
result = yield modifyFaultDetect ( [ values ] )
126
130
} else {
127
131
result = yield createFaultDetect ( [ values ] )
Original file line number Diff line number Diff line change @@ -55,3 +55,8 @@ export const FaultDetectHttpMethodOptions = Object.keys(FaultDetectHttpMethod).m
55
55
text : item ,
56
56
value : item ,
57
57
} ) )
58
+ export const BlockHttpBodyMethod = [
59
+ FaultDetectHttpMethod . GET ,
60
+ FaultDetectHttpMethod . DELETE ,
61
+ FaultDetectHttpMethod . HEAD ,
62
+ ] as string [ ]
You can’t perform that action at this time.
0 commit comments