Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const INFINITE_MESSAGES = {
<EuiButton
size="s"
color="secondary"
className="infiniteMessage__btn"
onClick={() => onClose?.()}
data-testid="cancel-import-db-sso-btn"
>
Expand Down Expand Up @@ -144,6 +145,7 @@ export const INFINITE_MESSAGES = {
<EuiButton
size="s"
color="secondary"
className="infiniteMessage__btn"
onClick={() => onClose?.()}
data-testid="cancel-create-subscription-sso-btn"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,9 @@
margin-right: 8px;
margin-top: 2px;
}

.infiniteMessage__btn .euiButton__text {
color: var(--euiColorSecondaryText) !important;
}
}
}
31 changes: 20 additions & 11 deletions redisinsight/ui/src/slices/instances/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,26 @@ function autoCreateAndConnectToInstanceActionSuccess(
onSuccess?: (id: string) => void,
onFail?: () => void,
) {
return async (dispatch: AppDispatch) => {
dispatch(setAppContextInitialState())
dispatch(setConnectedInstanceId(id ?? ''))

dispatch(checkConnectToInstanceAction(id, (id) => {
setTimeout(() => {
dispatch(removeInfiniteNotification(InfiniteMessagesIds.autoCreateDb))
dispatch(addMessageNotification(message))
onSuccess?.(id)
}, HIDE_CREATING_DB_DELAY_MS)
}, onFail))
return async (dispatch: AppDispatch, stateInit: () => RootState) => {
try {
const state = stateInit()
const isConnectedId = state.app?.context?.contextInstanceId === id
if (!isConnectedId) {
dispatch(setAppContextInitialState())
dispatch(setConnectedInstanceId(id ?? ''))
}
dispatch(checkConnectToInstanceAction(id, (id) => {
setTimeout(() => {
dispatch(removeInfiniteNotification(InfiniteMessagesIds.autoCreateDb))
dispatch(addMessageNotification(message))
onSuccess?.(id)
}, HIDE_CREATING_DB_DELAY_MS)
},
onFail,
!isConnectedId))
} catch (error) {
// process error if needed
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions redisinsight/ui/src/telemetry/checkAnalytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { get } from 'lodash'
import { store } from 'uiSrc/slices/store'

// Check is user give access to collect his events
export const checkIsAnalyticsGranted = (): boolean =>
!!get(store.getState(), 'user.settings.config.agreements.analytics', false)
9 changes: 9 additions & 0 deletions redisinsight/ui/src/telemetry/telemetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ import {
RedisModules,
} from './interfaces'
import { TelemetryEvent } from './events'
import { checkIsAnalyticsGranted } from './checkAnalytics'

const sendEventTelemetry = async ({ event, eventData = {} }: ITelemetrySendEvent) => {
try {
const isAnalyticsGranted = checkIsAnalyticsGranted()
if (!isAnalyticsGranted) {
return
}
await apiService.post(`${ApiEndpoints.ANALYTICS_SEND_EVENT}`, { event, eventData })
} catch (e) {
// continue regardless of error
Expand All @@ -28,6 +33,10 @@ const sendEventTelemetry = async ({ event, eventData = {} }: ITelemetrySendEvent

const sendPageViewTelemetry = async ({ name }: ITelemetrySendPageView) => {
try {
const isAnalyticsGranted = checkIsAnalyticsGranted()
if (!isAnalyticsGranted) {
return
}
await apiService.post(`${ApiEndpoints.ANALYTICS_SEND_PAGE}`, { event: name })
} catch (e) {
// continue regardless of error
Expand Down