File tree 3 files changed +24
-15
lines changed
client/packages/lowcoder/src/pages/setting/idSource
3 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export const DeleteConfig = (props: {
15
15
id : string ,
16
16
allowDelete ?: boolean ,
17
17
allowDisable ?: boolean ,
18
+ isLastEnabledConfig ?: boolean ,
18
19
} ) => {
19
20
const [ disableLoading , setDisableLoading ] = useState ( false ) ;
20
21
const [ deleteLoading , setDeleteLoading ] = useState ( false ) ;
@@ -50,12 +51,22 @@ export const DeleteConfig = (props: {
50
51
type = "warning"
51
52
showIcon
52
53
/>
54
+ { props . isLastEnabledConfig && (
55
+ < Alert
56
+ className = "danger-tip"
57
+ description = { trans ( "idSource.lastEnabledConfig" ) }
58
+ type = "warning"
59
+ showIcon
60
+ />
61
+ ) }
53
62
< Flex gap = { 8 } >
54
- < Button danger disabled = { props . allowDisable } loading = { disableLoading } onClick = { ( ) => handleDelete ( ) } >
55
- { trans ( "idSource.disable" ) }
56
- </ Button >
63
+ { props . allowDisable && (
64
+ < Button danger disabled = { props . isLastEnabledConfig } loading = { disableLoading } onClick = { ( ) => handleDelete ( ) } >
65
+ { trans ( "idSource.disable" ) }
66
+ </ Button >
67
+ ) }
57
68
{ props . allowDelete && (
58
- < Button type = "primary" danger disabled = { props . allowDisable } loading = { deleteLoading } onClick = { ( ) => handleDelete ( true ) } >
69
+ < Button type = "primary" danger disabled = { props . isLastEnabledConfig } loading = { deleteLoading } onClick = { ( ) => handleDelete ( true ) } >
59
70
{ trans ( "delete" ) }
60
71
</ Button >
61
72
) }
Original file line number Diff line number Diff line change @@ -324,16 +324,15 @@ export const IdSourceDetail = (props: IdSourceDetailProps) => {
324
324
< Manual type = { configDetail . authType } />
325
325
</ >
326
326
) }
327
- { configDetail . enable && (
328
- < >
329
- < Divider />
330
- < DeleteConfig
331
- id = { configDetail . id }
332
- allowDelete = { configDetail . authType !== AuthType . Form }
333
- allowDisable = { ! Boolean ( totalEnabledConfigs ) }
334
- />
335
- </ >
336
- ) }
327
+ < >
328
+ < Divider />
329
+ < DeleteConfig
330
+ id = { configDetail . id }
331
+ allowDelete = { configDetail . authType !== AuthType . Form }
332
+ allowDisable = { configDetail . enable }
333
+ isLastEnabledConfig = { totalEnabledConfigs === 1 && configDetail . enable }
334
+ />
335
+ </ >
337
336
</ Content >
338
337
</ DetailContainer >
339
338
) ;
Original file line number Diff line number Diff line change @@ -262,7 +262,6 @@ export const DeleteWrapper = styled.div`
262
262
padding: 8px 16px;
263
263
margin: 5px 0 12px 0;
264
264
border-radius: 4px;
265
- display: inline-flex;
266
265
align-items: center;
267
266
268
267
svg {
You can’t perform that action at this time.
0 commit comments