Skip to content

Commit e693118

Browse files
Merge pull request #155 from RedisInsight/main
a new release candidate
2 parents 274302c + cd791a8 commit e693118

File tree

76 files changed

+971
-354
lines changed

Some content is hidden

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

76 files changed

+971
-354
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@
167167
"cross-env": "^7.0.2",
168168
"css-loader": "^5.0.1",
169169
"css-minimizer-webpack-plugin": "^1.2.0",
170-
"electron": "^15.3.1",
171-
"electron-builder": "^22.14.5",
170+
"electron": "^16.0.5",
171+
"electron-builder": "^22.14.10",
172172
"electron-builder-notarize": "^1.2.0",
173173
"electron-debug": "^3.1.0",
174174
"electron-devtools-installer": "^3.2.0",
@@ -236,7 +236,7 @@
236236
"electron-context-menu": "^3.1.0",
237237
"electron-log": "^4.2.4",
238238
"electron-store": "^8.0.0",
239-
"electron-updater": "4.6.1",
239+
"electron-updater": "4.6.5",
240240
"formik": "^2.2.9",
241241
"html-entities": "^2.3.2",
242242
"html-react-parser": "^1.2.4",
@@ -245,14 +245,14 @@
245245
"react-contenteditable": "^3.3.5",
246246
"react-dom": "^17.0.1",
247247
"react-hotkeys-hook": "^3.3.1",
248+
"react-jsx-parser": "^1.28.4",
248249
"react-monaco-editor": "^0.44.0",
249250
"react-redux": "^7.2.2",
250-
"react-jsx-parser": "^1.28.4",
251251
"react-router-dom": "^5.2.0",
252252
"react-virtualized": "^9.22.2",
253+
"rehype-stringify": "^9.0.2",
253254
"remark-parse": "^10.0.1",
254255
"remark-rehype": "^10.0.1",
255-
"rehype-stringify": "^9.0.2",
256256
"unified": "^10.1.1",
257257
"unist-util-visit": "^4.1.0"
258258
},

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default {
4848
migrationsRun: process.env.DB_MIGRATIONS ? process.env.DB_MIGRATIONS === 'true' : true,
4949
},
5050
redis_cloud: {
51-
url: process.env.REDIS_CLOUD_URL || 'https://qa-api.redislabs.com/v1/',
51+
url: process.env.REDIS_CLOUD_URL || 'https://api.qa.redislabs.com/v1',
5252
},
5353
redis_clients: {
5454
idleSyncInterval: parseInt(process.env.CLIENTS_IDLE_SYNC_INTERVAL, 10) || 1000 * 60 * 60, // 1hr

redisinsight/api/config/production.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export default {
1818
database: join(homedir, 'redisinsight.db'),
1919
},
2020
redis_cloud: {
21-
url: process.env.REDIS_CLOUD_URL || 'https://api.redislabs.com/v1/',
21+
url: process.env.REDIS_CLOUD_URL || 'https://api.redislabs.com/v1',
2222
},
2323
};

redisinsight/api/src/dto/server.dto.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ export class GetServerInfoResponse {
4242
example: ['PLAIN', 'KEYTAR'],
4343
})
4444
encryptionStrategies: string[];
45+
46+
@ApiProperty({
47+
description: 'Server session id.',
48+
type: Number,
49+
})
50+
sessionId: number;
4551
}

redisinsight/api/src/modules/cli/services/cli-business/cli-business.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ export class CliBusinessService {
149149
const replyEncoding = checkHumanReadableCommands(`${command} ${args[0]}`) ? 'utf8' : undefined;
150150
this.checkUnsupportedCommands(`${command} ${args[0]}`);
151151

152-
const reply = await this.cliTool.execCommand(clientOptions, command, args, replyEncoding);
153152
namespace = this.cliTool.getRedisClientNamespace(clientOptions);
153+
const reply = await this.cliTool.execCommand(clientOptions, command, args, replyEncoding);
154154

155155
this.logger.log('Succeed to execute redis CLI command.');
156156
this.cliAnalyticsService.sendCommandExecutedEvent(
@@ -225,6 +225,8 @@ export class CliBusinessService {
225225
const [command, ...args] = splitCliCommandLine(commandLine);
226226
const replyEncoding = checkHumanReadableCommands(`${command} ${args[0]}`) ? 'utf8' : undefined;
227227
this.checkUnsupportedCommands(`${command} ${args[0]}`);
228+
namespace = this.cliTool.getRedisClientNamespace(clientOptions);
229+
228230
const result = await this.cliTool.execCommandForNodes(
229231
clientOptions,
230232
command,
@@ -233,7 +235,6 @@ export class CliBusinessService {
233235
replyEncoding,
234236
);
235237

236-
namespace = this.cliTool.getRedisClientNamespace(clientOptions);
237238
return result.map((nodeExecReply) => {
238239
this.cliAnalyticsService.sendClusterCommandExecutedEvent(
239240
clientOptions.instanceId,

redisinsight/api/src/modules/core/providers/server-on-premise/server-on-premise.service.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe('ServerOnPremiseService', () => {
3939
let serverRepository: MockType<Repository<ServerEntity>>;
4040
let eventEmitter: EventEmitter2;
4141
let encryptionService: MockType<EncryptionService>;
42+
const sessionId = new Date().getTime();
4243

4344
beforeEach(async () => {
4445
const module: TestingModule = await Test.createTestingModule({
@@ -88,12 +89,12 @@ describe('ServerOnPremiseService', () => {
8889
serverRepository.findOne.mockResolvedValue(null);
8990
serverRepository.create.mockReturnValue(mockServerEntity);
9091

91-
await service.onApplicationBootstrap();
92+
await service.onApplicationBootstrap(sessionId);
9293

9394
expect(eventEmitter.emit).toHaveBeenNthCalledWith(
9495
1,
9596
AppAnalyticsEvents.Initialize,
96-
mockServerEntity.id,
97+
{ anonymousId: mockServerEntity.id, sessionId },
9798
);
9899
expect(eventEmitter.emit).toHaveBeenNthCalledWith(
99100
2,
@@ -107,12 +108,12 @@ describe('ServerOnPremiseService', () => {
107108
it('should emit APPLICATION_STARTED on second application launch', async () => {
108109
serverRepository.findOne.mockResolvedValue(mockServerEntity);
109110

110-
await service.onApplicationBootstrap();
111+
await service.onApplicationBootstrap(sessionId);
111112

112113
expect(eventEmitter.emit).toHaveBeenNthCalledWith(
113114
1,
114115
AppAnalyticsEvents.Initialize,
115-
mockServerEntity.id,
116+
{ anonymousId: mockServerEntity.id, sessionId },
116117
);
117118
expect(eventEmitter.emit).toHaveBeenNthCalledWith(
118119
2,

redisinsight/api/src/modules/core/providers/server-on-premise/server-on-premise.service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ implements OnApplicationBootstrap, IServerProvider {
2727

2828
private encryptionService: EncryptionService;
2929

30+
private sessionId: number;
31+
3032
constructor(repository, eventEmitter, encryptionService) {
3133
this.repository = repository;
3234
this.eventEmitter = eventEmitter;
3335
this.encryptionService = encryptionService;
3436
}
3537

36-
async onApplicationBootstrap() {
38+
async onApplicationBootstrap(sessionId: number = new Date().getTime()) {
39+
this.sessionId = sessionId;
3740
await this.upsertServerInfo();
3841
}
3942

@@ -45,7 +48,7 @@ implements OnApplicationBootstrap, IServerProvider {
4548
// Create default server info on first application launch
4649
serverInfo = this.repository.create({});
4750
await this.repository.save(serverInfo);
48-
this.eventEmitter.emit(AppAnalyticsEvents.Initialize, serverInfo.id);
51+
this.eventEmitter.emit(AppAnalyticsEvents.Initialize, { anonymousId: serverInfo.id, sessionId: this.sessionId });
4952
this.eventEmitter.emit(AppAnalyticsEvents.Track, {
5053
event: TelemetryEvents.ApplicationFirstStart,
5154
eventData: {
@@ -57,7 +60,7 @@ implements OnApplicationBootstrap, IServerProvider {
5760
});
5861
} else {
5962
this.logger.log('Application started.');
60-
this.eventEmitter.emit(AppAnalyticsEvents.Initialize, serverInfo.id);
63+
this.eventEmitter.emit(AppAnalyticsEvents.Initialize, { anonymousId: serverInfo.id, sessionId: this.sessionId });
6164
this.eventEmitter.emit(AppAnalyticsEvents.Track, {
6265
event: TelemetryEvents.ApplicationStarted,
6366
eventData: {
@@ -82,6 +85,7 @@ implements OnApplicationBootstrap, IServerProvider {
8285
}
8386
const result = {
8487
...info,
88+
sessionId: this.sessionId,
8589
appVersion: SERVER_CONFIG.appVersion,
8690
osPlatform: process.platform,
8791
buildType: SERVER_CONFIG.buildType,

redisinsight/api/src/modules/core/services/analytics/analytics.service.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const mockSettingsWithoutPermission = {
3333
describe('AnalyticsService', () => {
3434
let service: AnalyticsService;
3535
let settingsService: ISettingsProvider;
36+
const sessionId = new Date().getTime();
3637

3738
beforeEach(async () => {
3839
const module: TestingModule = await Test.createTestingModule({
@@ -58,7 +59,7 @@ describe('AnalyticsService', () => {
5859

5960
describe('initialize', () => {
6061
it('should set anonymousId', () => {
61-
service.initialize(mockAnonymousId);
62+
service.initialize({ anonymousId: mockAnonymousId, sessionId });
6263

6364
const anonymousId = service.getAnonymousId();
6465

@@ -69,7 +70,7 @@ describe('AnalyticsService', () => {
6970
describe('sendEvent', () => {
7071
beforeEach(() => {
7172
mockAnalyticsTrack = jest.fn();
72-
service.initialize(mockAnonymousId);
73+
service.initialize({ anonymousId: mockAnonymousId, sessionId });
7374
});
7475
it('should send event with anonymousId if permission are granted', async () => {
7576
settingsService.getSettings = jest
@@ -84,6 +85,7 @@ describe('AnalyticsService', () => {
8485

8586
expect(mockAnalyticsTrack).toHaveBeenCalledWith({
8687
anonymousId: mockAnonymousId,
88+
integrations: { Amplitude: { session_id: sessionId } },
8789
event: TelemetryEvents.ApplicationStarted,
8890
properties: {},
8991
});
@@ -114,6 +116,7 @@ describe('AnalyticsService', () => {
114116

115117
expect(mockAnalyticsTrack).toHaveBeenCalledWith({
116118
anonymousId: NON_TRACKING_ANONYMOUS_ID,
119+
integrations: { Amplitude: { session_id: sessionId } },
117120
event: TelemetryEvents.ApplicationStarted,
118121
properties: {},
119122
});

redisinsight/api/src/modules/core/services/analytics/analytics.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ export interface ITelemetryEvent {
1515
nonTracking: boolean;
1616
}
1717

18+
export interface ITelemetryInitEvent {
19+
anonymousId: string;
20+
sessionId: number;
21+
}
22+
1823
@Injectable()
1924
export class AnalyticsService {
2025
private anonymousId: string = NON_TRACKING_ANONYMOUS_ID;
2126

27+
private sessionId: number = -1;
28+
2229
private analytics;
2330

2431
constructor(
@@ -31,7 +38,9 @@ export class AnalyticsService {
3138
}
3239

3340
@OnEvent(AppAnalyticsEvents.Initialize)
34-
public initialize(anonymousId: string) {
41+
public initialize(payload: ITelemetryInitEvent) {
42+
const { anonymousId, sessionId } = payload;
43+
this.sessionId = sessionId;
3544
this.anonymousId = anonymousId;
3645
this.analytics = new Analytics(ANALYTICS_CONFIG.writeKey);
3746
}
@@ -55,6 +64,7 @@ export class AnalyticsService {
5564
if (isAnalyticsGranted) {
5665
this.analytics.track({
5766
anonymousId: this.anonymousId,
67+
integrations: { Amplitude: { session_id: this.sessionId } },
5868
event,
5969
properties: {
6070
...eventData,
@@ -63,6 +73,7 @@ export class AnalyticsService {
6373
} else if (nonTracking) {
6474
this.analytics.track({
6575
anonymousId: NON_TRACKING_ANONYMOUS_ID,
76+
integrations: { Amplitude: { session_id: this.sessionId } },
6677
event,
6778
properties: {
6879
...eventData,

redisinsight/api/src/modules/shared/services/redis-cloud-business/redis-cloud-business.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class RedisCloudBusinessService {
5050
try {
5151
const {
5252
data: { account },
53-
}: AxiosResponse = await this.api.get(`${this.config.url}`, {
53+
}: AxiosResponse = await this.api.get(`${this.config.url}/`, {
5454
headers: this.getAuthHeaders(apiKey, apiSecretKey),
5555
});
5656
this.logger.log('Succeed to get RE cloud account.');

0 commit comments

Comments
 (0)