File tree Expand file tree Collapse file tree 3 files changed +24
-15
lines changed
client/packages/lowcoder/src/pages/setting/idSource Expand file tree Collapse file tree 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: {
1515 id : string ,
1616 allowDelete ?: boolean ,
1717 allowDisable ?: boolean ,
18+ isLastEnabledConfig ?: boolean ,
1819} ) => {
1920 const [ disableLoading , setDisableLoading ] = useState ( false ) ;
2021 const [ deleteLoading , setDeleteLoading ] = useState ( false ) ;
@@ -50,12 +51,22 @@ export const DeleteConfig = (props: {
5051 type = "warning"
5152 showIcon
5253 />
54+ { props . isLastEnabledConfig && (
55+ < Alert
56+ className = "danger-tip"
57+ description = { trans ( "idSource.lastEnabledConfig" ) }
58+ type = "warning"
59+ showIcon
60+ />
61+ ) }
5362 < 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+ ) }
5768 { 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 ) } >
5970 { trans ( "delete" ) }
6071 </ Button >
6172 ) }
Original file line number Diff line number Diff line change @@ -324,16 +324,15 @@ export const IdSourceDetail = (props: IdSourceDetailProps) => {
324324 < Manual type = { configDetail . authType } />
325325 </ >
326326 ) }
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+ </ >
337336 </ Content >
338337 </ DetailContainer >
339338 ) ;
Original file line number Diff line number Diff line change @@ -262,7 +262,6 @@ export const DeleteWrapper = styled.div`
262262 padding: 8px 16px;
263263 margin: 5px 0 12px 0;
264264 border-radius: 4px;
265- display: inline-flex;
266265 align-items: center;
267266
268267 svg {
You can’t perform that action at this time.
0 commit comments