|
1 | 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
2 | 2 | import { cloneDeep, remove, get, isUndefined } from 'lodash'
|
3 | 3 | import axios, { AxiosError, CancelTokenSource } from 'axios'
|
| 4 | +import { useSelector } from 'react-redux' |
4 | 5 | import { apiService, localStorageService } from 'uiSrc/services'
|
5 | 6 | import {
|
6 | 7 | ApiEndpoints,
|
@@ -31,7 +32,7 @@ import { DEFAULT_SEARCH_MATCH, SCAN_COUNT_DEFAULT } from 'uiSrc/constants/api'
|
31 | 32 | import { getBasedOnViewTypeEvent, sendEventTelemetry, TelemetryEvent, getAdditionalAddedEventData, getMatchType } from 'uiSrc/telemetry'
|
32 | 33 | import successMessages from 'uiSrc/components/notifications/success-messages'
|
33 | 34 | import { IFetchKeyArgs, IKeyPropTypes } from 'uiSrc/constants/prop-types/keys'
|
34 |
| -import { resetBrowserTree } from 'uiSrc/slices/app/context' |
| 35 | +import { appContextDbConfig, resetBrowserTree } from 'uiSrc/slices/app/context' |
35 | 36 |
|
36 | 37 | import { CreateListWithExpireDto, } from 'apiSrc/modules/browser/list/dto'
|
37 | 38 | import { SetStringWithExpireDto } from 'apiSrc/modules/browser/string/dto'
|
@@ -656,13 +657,11 @@ export function fetchMorePatternKeysAction(oldKeys: IKeyPropTypes[] = [], cursor
|
656 | 657 | // Asynchronous thunk action
|
657 | 658 | export function fetchKeyInfo(
|
658 | 659 | key: RedisResponseBuffer,
|
659 |
| - shownColumns: BrowserColumns[] = [BrowserColumns.Size, BrowserColumns.TTL], |
660 | 660 | resetData?: boolean,
|
661 | 661 | onSuccess?: (data: Nullable<IKeyPropTypes>) => void
|
662 | 662 | ) {
|
663 | 663 | return async (dispatch: AppDispatch, stateInit: () => RootState) => {
|
664 |
| - dispatch(defaultSelectedKeyAction()) |
665 |
| - |
| 664 | + const { shownColumns } = stateInit()?.app?.context?.dbConfig |
666 | 665 | try {
|
667 | 666 | const state = stateInit()
|
668 | 667 | const { encoding } = state.app.info
|
@@ -729,11 +728,9 @@ export function fetchKeyInfo(
|
729 | 728 | }
|
730 | 729 |
|
731 | 730 | // Asynchronous thunk action
|
732 |
| -export function refreshKeyInfoAction( |
733 |
| - key: RedisResponseBuffer, |
734 |
| - shownColumns: BrowserColumns[] = [BrowserColumns.Size, BrowserColumns.TTL] |
735 |
| -) { |
| 731 | +export function refreshKeyInfoAction(key: RedisResponseBuffer) { |
736 | 732 | return async (dispatch: AppDispatch, stateInit: () => RootState) => {
|
| 733 | + const { shownColumns } = stateInit()?.app?.context?.dbConfig |
737 | 734 | dispatch(refreshKeyInfo())
|
738 | 735 | try {
|
739 | 736 | const state = stateInit()
|
@@ -1040,12 +1037,12 @@ export function editKeyTTL(key: RedisResponseBuffer, ttl: number) {
|
1040 | 1037 | export function fetchKeysMetadata(
|
1041 | 1038 | keys: RedisString[],
|
1042 | 1039 | filter: Nullable<KeyTypes>,
|
1043 |
| - shownColumns: BrowserColumns[] = [BrowserColumns.Size, BrowserColumns.TTL], |
1044 | 1040 | signal?: AbortSignal,
|
1045 | 1041 | onSuccessAction?: (data: GetKeyInfoResponse[]) => void,
|
1046 | 1042 | onFailAction?: () => void
|
1047 | 1043 | ) {
|
1048 | 1044 | return async (_dispatch: AppDispatch, stateInit: () => RootState) => {
|
| 1045 | + const { shownColumns } = stateInit()?.app?.context?.dbConfig |
1049 | 1046 | try {
|
1050 | 1047 | const state = stateInit()
|
1051 | 1048 | const { data } = await apiService.post<GetKeyInfoResponse[]>(
|
@@ -1077,12 +1074,12 @@ export function fetchKeysMetadata(
|
1077 | 1074 | export function fetchKeysMetadataTree(
|
1078 | 1075 | keys: RedisString[],
|
1079 | 1076 | filter: Nullable<KeyTypes>,
|
1080 |
| - shownColumns: BrowserColumns[] = [BrowserColumns.Size, BrowserColumns.TTL], |
1081 | 1077 | signal?: AbortSignal,
|
1082 | 1078 | onSuccessAction?: (data: GetKeyInfoResponse[]) => void,
|
1083 | 1079 | onFailAction?: () => void
|
1084 | 1080 | ) {
|
1085 | 1081 | return async (_dispatch: AppDispatch, stateInit: () => RootState) => {
|
| 1082 | + const { shownColumns } = stateInit()?.app?.context?.dbConfig |
1086 | 1083 | try {
|
1087 | 1084 | const state = stateInit()
|
1088 | 1085 | const { data } = await apiService.post<GetKeyInfoResponse[]>(
|
|
0 commit comments