Skip to content

Commit fd15627

Browse files
Merge pull request #3840 from RedisInsight/fe/bugfix/RI-5187
#RI-5187 - fix connection form
2 parents aec1ac1 + 42bd8dc commit fd15627

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

redisinsight/api/src/modules/database-import/database-import.service.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,23 @@ describe('DatabaseImportService', () => {
231231
false,
232232
);
233233
});
234-
it('should create standalone with compressor', async () => {
234+
it('should create standalone with compressor and tlsServername', async () => {
235235
await service['createDatabase'](
236236
mockSessionMetadata,
237237
{
238238
...mockDatabase,
239239
compressor: Compressor.GZIP,
240+
tlsServername: 'redis-insight',
240241
},
241242
0,
242243
);
243244

244245
expect(databaseRepository.create).toHaveBeenCalledWith(
245246
mockSessionMetadata,
246247
{
247-
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'compressor', 'modules']),
248+
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'compressor', 'modules', 'tlsServername']),
248249
compressor: Compressor.GZIP,
250+
tlsServername: 'redis-insight',
249251
new: true,
250252
},
251253
false,

redisinsight/api/src/modules/database-import/dto/import.database.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { UseClientCertificateDto } from 'src/modules/certificate/dto/use.client-
1414
export class ImportDatabaseDto extends PickType(Database, [
1515
'host', 'port', 'name', 'db', 'username', 'password',
1616
'connectionType', 'tls', 'verifyServerCert', 'sentinelMaster', 'nodes',
17-
'new', 'ssh', 'sshOptions', 'provider', 'compressor', 'modules',
17+
'new', 'ssh', 'sshOptions', 'provider', 'compressor', 'modules', 'tlsServername',
1818
] as const) {
1919
@Expose()
2020
@IsNotEmpty()

redisinsight/ui/src/pages/home/components/manual-connection/ManualConnectionWrapper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ const ManualConnectionWrapper = (props: Props) => {
174174
sentinelMasterName,
175175
sentinelMasterUsername,
176176
sentinelMasterPassword,
177+
ssh,
178+
tls
177179
} = values
178180

179181
const database: any = {
@@ -186,6 +188,8 @@ const ManualConnectionWrapper = (props: Props) => {
186188
password,
187189
compressor,
188190
timeout: timeout ? toNumber(timeout) * 1_000 : toNumber(DEFAULT_TIMEOUT),
191+
ssh,
192+
tls
189193
}
190194

191195
// add tls & ssh for database (modifies database object)

redisinsight/ui/src/pages/home/utils/form.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const applyTlSDatabase = (database: any, tlsSettings: any) => {
5555
database.tls = useTls
5656
database.tlsServername = servername
5757
database.verifyServerCert = !!verifyServerCert
58+
database.clientCert = clientCert
5859

5960
if (!isUndefined(caCert?.new)) {
6061
database.caCert = {
@@ -68,15 +69,15 @@ export const applyTlSDatabase = (database: any, tlsSettings: any) => {
6869
}
6970

7071
if (clientAuth) {
71-
if (!isUndefined(clientCert.new)) {
72+
if (!isUndefined(clientCert?.new)) {
7273
database.clientCert = {
7374
name: clientCert.new.name,
7475
certificate: clientCert.new.certificate,
7576
key: clientCert.new.key,
7677
}
7778
}
7879

79-
if (!isUndefined(clientCert.id)) {
80+
if (!isUndefined(clientCert?.id)) {
8081
database.clientCert = { id: clientCert.id }
8182
}
8283
}
@@ -284,8 +285,8 @@ export const getFormValues = (instance?: Nullable<Record<string, any>>) => ({
284285
modules: instance?.modules,
285286
showDb: !!instance?.db,
286287
showCompressor: instance && instance.compressor && instance.compressor !== NONE,
287-
sni: !!instance?.servername,
288-
servername: instance?.servername,
288+
sni: !!instance?.tlsServername,
289+
servername: instance?.tlsServername,
289290
newCaCert: '',
290291
newCaCertName: '',
291292
selectedCaCertName: instance?.caCert?.id ?? NO_CA_CERT,

redisinsight/ui/src/utils/comparisons/diff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getFormUpdates = (obj1: UnknownObject = {}, obj2: UnknownObject = {
2929
result[key] = diff
3030
}
3131
} else if (value !== obj2[key] && !(!value && !obj2[key])) {
32-
result[key] = value || null
32+
result[key] = value ?? null
3333
}
3434

3535
return result

redisinsight/ui/src/utils/tests/comparisons/diff.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('getDiffKeysOfObjectValues', () => {
1818

1919
const getFormUpdatesTests: any[] = [
2020
[{ name: 'name' }, { name: 'name' }, {}],
21-
[{ name: '' }, { name: 'name' }, { name: null }],
21+
[{ name: '' }, { name: 'name' }, { name: '' }],
2222
[{ name: 'name' }, { name: '' }, { name: 'name' }],
2323
[{ name: 'name', port: 123 }, { name: '', port: 123 }, { name: 'name' }],
2424
[{ name: 'name', port: 123 }, { name: '', port: 1 }, { name: 'name', port: 123 }],

0 commit comments

Comments
 (0)