Skip to content

Commit 002197d

Browse files
committed
Merge branch 'main' into feature/RI-4717-import_existing_free_cloud_database
# Conflicts: # redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.spec.tsx # redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.tsx
2 parents a35dbcd + 6d6b4db commit 002197d

File tree

111 files changed

+1404
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1404
-600
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"start:web:public": "cross-env PUBLIC_DEV=true NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./configs/webpack.config.web.dev.ts",
4343
"test": "jest ./redisinsight/ui -w 1",
4444
"test:watch": "jest ./redisinsight/ui --watch -w 1",
45-
"test:cov": "jest ./redisinsight/ui --coverage -w 1",
45+
"test:cov": "jest ./redisinsight/ui --coverage --runInBand",
4646
"test:cov:unit": "jest ./redisinsight/ui --group=-component --coverage -w 1",
4747
"test:cov:component": "jest ./redisinsight/ui --group=component --coverage -w 1",
4848
"type-check:ui": "tsc --project redisinsight/ui --noEmit"

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export default {
212212
url: process.env.RI_FEATURES_CONFIG_URL
213213
// eslint-disable-next-line max-len
214214
|| 'https://raw.githubusercontent.com/RedisInsight/RedisInsight/main/redisinsight/api/config/features-config.json',
215-
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 4, // 4h
215+
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 24, // 24h
216216
},
217217
cloud: {
218218
apiUrl: process.env.RI_CLOUD_API_URL || 'https://app-sm.k8s-cloudapi.sm-qa.qa.redislabs.com/api/v1',

redisinsight/api/src/constants/telemetry-events.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export enum TelemetryEvents {
1313
RedisInstanceDeleted = 'CONFIG_DATABASES_DATABASE_DELETED',
1414
RedisInstanceEditedByUser = 'CONFIG_DATABASES_DATABASE_EDITED_BY_USER',
1515
RedisInstanceConnectionFailed = 'DATABASE_CONNECTION_FAILED',
16-
RedisInstanceListReceived = 'CONFIG_DATABASES_DATABASE_LIST_DISPLAYED',
1716

1817
// Databases import
1918
DatabaseImportParseFailed = 'CONFIG_DATABASES_REDIS_IMPORT_PARSE_FAILED',

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe('DatabaseImportService', () => {
165165
}, 0);
166166

167167
expect(databaseRepository.create).toHaveBeenCalledWith({
168-
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor']),
168+
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor', 'modules']),
169169
provider: 'RE_CLOUD',
170170
new: true,
171171
});
@@ -177,7 +177,7 @@ describe('DatabaseImportService', () => {
177177
}, 0);
178178

179179
expect(databaseRepository.create).toHaveBeenCalledWith({
180-
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor']),
180+
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor', 'modules']),
181181
name: `${mockDatabase.host}:${mockDatabase.port}`,
182182
new: true,
183183
});
@@ -189,7 +189,7 @@ describe('DatabaseImportService', () => {
189189
}, 0);
190190

191191
expect(databaseRepository.create).toHaveBeenCalledWith({
192-
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor']),
192+
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor', 'modules']),
193193
compressor: Compressor.NONE,
194194
new: true,
195195
});
@@ -201,7 +201,7 @@ describe('DatabaseImportService', () => {
201201
}, 0);
202202

203203
expect(databaseRepository.create).toHaveBeenCalledWith({
204-
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor']),
204+
...pick(mockDatabase, ['host', 'port', 'name', 'connectionType', 'timeout', 'compressor', 'modules']),
205205
compressor: Compressor.GZIP,
206206
new: true,
207207
});
@@ -214,7 +214,7 @@ describe('DatabaseImportService', () => {
214214
}, 0);
215215

216216
expect(databaseRepository.create).toHaveBeenCalledWith({
217-
...pick(mockDatabase, ['host', 'port', 'name', 'timeout', 'compressor']),
217+
...pick(mockDatabase, ['host', 'port', 'name', 'timeout', 'compressor', 'modules']),
218218
connectionType: ConnectionType.CLUSTER,
219219
new: true,
220220
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class DatabaseImportService {
6262
['sshPassphrase', ['sshOptions.passphrase', 'sshKeyPassphrase']],
6363
['sshAgentPath', ['ssh_agent_path']],
6464
['compressor', ['compressor']],
65+
['modules', ['modules']],
6566
];
6667

6768
constructor(

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',
17+
'new', 'ssh', 'sshOptions', 'provider', 'compressor', 'modules',
1818
] as const) {
1919
@Expose()
2020
@IsNotEmpty()

redisinsight/api/src/modules/database/database.analytics.spec.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,54 +30,6 @@ describe('DatabaseAnalytics', () => {
3030
sendFailedEventSpy = jest.spyOn(service as any, 'sendFailedEvent');
3131
});
3232

33-
describe('sendInstanceListReceivedEvent', () => {
34-
it('should emit event with one db in the list', () => {
35-
service.sendInstanceListReceivedEvent([mockDatabaseWithTlsAuth]);
36-
37-
expect(sendEventSpy).toHaveBeenCalledWith(
38-
TelemetryEvents.RedisInstanceListReceived,
39-
{
40-
numberOfDatabases: 1,
41-
},
42-
);
43-
});
44-
it('should emit event with several dbs in the list', () => {
45-
service.sendInstanceListReceivedEvent([
46-
mockDatabaseWithTlsAuth,
47-
mockDatabaseWithTlsAuth,
48-
mockDatabaseWithTlsAuth,
49-
]);
50-
51-
expect(sendEventSpy).toHaveBeenCalledWith(
52-
TelemetryEvents.RedisInstanceListReceived,
53-
{
54-
numberOfDatabases: 3,
55-
},
56-
);
57-
});
58-
it('should emit event with several empty in the list', () => {
59-
service.sendInstanceListReceivedEvent([]);
60-
61-
expect(sendEventSpy).toHaveBeenCalledWith(
62-
TelemetryEvents.RedisInstanceListReceived,
63-
{
64-
numberOfDatabases: 0,
65-
},
66-
);
67-
});
68-
it('should emit event with additional data', () => {
69-
service.sendInstanceListReceivedEvent([], { data: 'data' });
70-
71-
expect(sendEventSpy).toHaveBeenCalledWith(
72-
TelemetryEvents.RedisInstanceListReceived,
73-
{
74-
numberOfDatabases: 0,
75-
data: 'data',
76-
},
77-
);
78-
});
79-
});
80-
8133
describe('sendInstanceAddedEvent', () => {
8234
it('should emit event with enabled tls and sni, and ssh', () => {
8335
service.sendInstanceAddedEvent({

redisinsight/api/src/modules/database/database.analytics.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ export class DatabaseAnalytics extends TelemetryBaseService {
1313
super(eventEmitter);
1414
}
1515

16-
sendInstanceListReceivedEvent(
17-
databases: Database[],
18-
additionalData: object = {},
19-
): void {
20-
try {
21-
this.sendEvent(
22-
TelemetryEvents.RedisInstanceListReceived,
23-
{
24-
numberOfDatabases: databases.length,
25-
...additionalData,
26-
},
27-
);
28-
} catch (e) {
29-
// continue regardless of error
30-
}
31-
}
32-
3316
sendConnectionFailedEvent(instance: Database, exception: HttpException): void {
3417
this.sendFailedEvent(
3518
TelemetryEvents.RedisInstanceConnectionFailed,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ describe('DatabaseService', () => {
9797
it('should return databases and send analytics event', async () => {
9898
databaseRepository.list.mockResolvedValue([mockDatabase, mockDatabase]);
9999
expect(await service.list()).toEqual([mockDatabase, mockDatabase]);
100-
expect(analytics.sendInstanceListReceivedEvent).toHaveBeenCalledWith([mockDatabase, mockDatabase]);
101100
});
102101
it('should throw InternalServerErrorException?', async () => {
103102
databaseRepository.list.mockRejectedValueOnce(new Error());
104103
await expect(service.list()).rejects.toThrow(InternalServerErrorException);
105-
expect(analytics.sendInstanceListReceivedEvent).not.toHaveBeenCalled();
106104
});
107105
});
108106

redisinsight/api/src/modules/database/database.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export class DatabaseService {
6363
async list(): Promise<Database[]> {
6464
try {
6565
this.logger.log('Getting databases list');
66-
const result = await this.repository.list();
67-
this.analytics.sendInstanceListReceivedEvent(result);
68-
return result;
66+
return await this.repository.list();
6967
} catch (e) {
7068
this.logger.error('Failed to get database instance list.', e);
7169
throw new InternalServerErrorException();

0 commit comments

Comments
 (0)