Skip to content

Commit 606ebf6

Browse files
Merge pull request #2638 from RedisInsight/fe/bugfix/regression_2.34.0
#RI-4983, #RI-4991, #RI-4993
2 parents 02ca5dd + a6b57c8 commit 606ebf6

File tree

5 files changed

+41
-11
lines changed

5 files changed

+41
-11
lines changed

redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const INFINITE_MESSAGES = {
104104
<EuiButton
105105
size="s"
106106
color="secondary"
107+
className="infiniteMessage__btn"
107108
onClick={() => onClose?.()}
108109
data-testid="cancel-import-db-sso-btn"
109110
>
@@ -144,6 +145,7 @@ export const INFINITE_MESSAGES = {
144145
<EuiButton
145146
size="s"
146147
color="secondary"
148+
className="infiniteMessage__btn"
147149
onClick={() => onClose?.()}
148150
data-testid="cancel-create-subscription-sso-btn"
149151
>

redisinsight/ui/src/components/notifications/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,9 @@
6262
margin-right: 8px;
6363
margin-top: 2px;
6464
}
65+
66+
.infiniteMessage__btn .euiButton__text {
67+
color: var(--euiColorSecondaryText) !important;
68+
}
6569
}
6670
}

redisinsight/ui/src/slices/instances/instances.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -436,17 +436,26 @@ function autoCreateAndConnectToInstanceActionSuccess(
436436
onSuccess?: (id: string) => void,
437437
onFail?: () => void,
438438
) {
439-
return async (dispatch: AppDispatch) => {
440-
dispatch(setAppContextInitialState())
441-
dispatch(setConnectedInstanceId(id ?? ''))
442-
443-
dispatch(checkConnectToInstanceAction(id, (id) => {
444-
setTimeout(() => {
445-
dispatch(removeInfiniteNotification(InfiniteMessagesIds.autoCreateDb))
446-
dispatch(addMessageNotification(message))
447-
onSuccess?.(id)
448-
}, HIDE_CREATING_DB_DELAY_MS)
449-
}, onFail))
439+
return async (dispatch: AppDispatch, stateInit: () => RootState) => {
440+
try {
441+
const state = stateInit()
442+
const isConnectedId = state.app?.context?.contextInstanceId === id
443+
if (!isConnectedId) {
444+
dispatch(setAppContextInitialState())
445+
dispatch(setConnectedInstanceId(id ?? ''))
446+
}
447+
dispatch(checkConnectToInstanceAction(id, (id) => {
448+
setTimeout(() => {
449+
dispatch(removeInfiniteNotification(InfiniteMessagesIds.autoCreateDb))
450+
dispatch(addMessageNotification(message))
451+
onSuccess?.(id)
452+
}, HIDE_CREATING_DB_DELAY_MS)
453+
},
454+
onFail,
455+
!isConnectedId))
456+
} catch (error) {
457+
// process error if needed
458+
}
450459
}
451460
}
452461

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { get } from 'lodash'
2+
import { store } from 'uiSrc/slices/store'
3+
4+
// Check is user give access to collect his events
5+
export const checkIsAnalyticsGranted = (): boolean =>
6+
!!get(store.getState(), 'user.settings.config.agreements.analytics', false)

redisinsight/ui/src/telemetry/telemetryUtils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ import {
1717
RedisModules,
1818
} from './interfaces'
1919
import { TelemetryEvent } from './events'
20+
import { checkIsAnalyticsGranted } from './checkAnalytics'
2021

2122
const sendEventTelemetry = async ({ event, eventData = {} }: ITelemetrySendEvent) => {
2223
try {
24+
const isAnalyticsGranted = checkIsAnalyticsGranted()
25+
if (!isAnalyticsGranted) {
26+
return
27+
}
2328
await apiService.post(`${ApiEndpoints.ANALYTICS_SEND_EVENT}`, { event, eventData })
2429
} catch (e) {
2530
// continue regardless of error
@@ -28,6 +33,10 @@ const sendEventTelemetry = async ({ event, eventData = {} }: ITelemetrySendEvent
2833

2934
const sendPageViewTelemetry = async ({ name }: ITelemetrySendPageView) => {
3035
try {
36+
const isAnalyticsGranted = checkIsAnalyticsGranted()
37+
if (!isAnalyticsGranted) {
38+
return
39+
}
3140
await apiService.post(`${ApiEndpoints.ANALYTICS_SEND_PAGE}`, { event: name })
3241
} catch (e) {
3342
// continue regardless of error

0 commit comments

Comments
 (0)