Skip to content

Commit f96dbc9

Browse files
committed
Set the form value to no_ca_cert for CA certificate and add_new for
TLS certificate to fix the UI issue
1 parent cab4dbf commit f96dbc9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

redisinsight/ui/src/pages/home/components/form/TlsDetails.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import PopoverDelete from 'uiSrc/pages/browser/components/popover-delete/Popover
1919

2020
import {
2121
ADD_NEW_CA_CERT,
22-
NO_CA_CERT
22+
NO_CA_CERT,
23+
ADD_NEW,
2324
} from 'uiSrc/pages/home/constants'
2425
import { DbConnectionInfo } from 'uiSrc/pages/home/interfaces'
2526
import { TelemetryEvent, sendEventTelemetry } from 'uiSrc/telemetry'
@@ -43,11 +44,27 @@ const TlsDetails = (props: Props) => {
4344
const [activeCertId, setActiveCertId] = useState<Nullable<string>>(null)
4445

4546
const handleDeleteCaCert = (id: string) => {
46-
dispatch(deleteCaCertificateAction(id, () => handleClickDeleteCert('CA')))
47+
dispatch(deleteCaCertificateAction(id, () => {
48+
if (formik.values.selectedCaCertName === id) {
49+
formik.setFieldValue(
50+
'selectedCaCertName',
51+
NO_CA_CERT,
52+
)
53+
}
54+
handleClickDeleteCert('CA')
55+
}))
4756
}
4857

4958
const handleDeleteClientCert = (id: string) => {
50-
dispatch(deleteClientCertAction(id, () => handleClickDeleteCert('Client')))
59+
dispatch(deleteClientCertAction(id, () => {
60+
if (formik.values.selectedTlsClientCertId === id) {
61+
formik.setFieldValue(
62+
'selectedTlsClientCertId',
63+
ADD_NEW,
64+
)
65+
}
66+
handleClickDeleteCert('Client')
67+
}))
5168
}
5269

5370
const handleClickDeleteCert = (certificateType: 'Client' | 'CA') => {

0 commit comments

Comments
 (0)