Skip to content

Commit d2a22b0

Browse files
committed
#RIVS-231 - Rename application
1 parent 9cb3dbc commit d2a22b0

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/webviews/src/modules/key-details/KeyDetails.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { useShallow } from 'zustand/react/shallow'
55
import { KeyTypes, SelectedKeyActionType, StorageItem, VscodeMessageAction } from 'uiSrc/constants'
66
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/utils'
77
import { RedisString } from 'uiSrc/interfaces'
8-
import { useSelectedKeyStore } from 'uiSrc/store'
8+
import { useDatabasesStore, useSelectedKeyStore } from 'uiSrc/store'
99
import { sessionStorageService, vscodeApi } from 'uiSrc/services'
1010
import { DynamicTypeDetails } from './components/dynamic-type-details'
1111

12-
import { useKeysApi, useKeysInContext } from '../keys-tree/hooks/useKeys'
12+
import { useKeysApi } from '../keys-tree/hooks/useKeys'
1313
import styles from './styles.module.scss'
1414

1515
export interface Props {}
@@ -21,7 +21,8 @@ const KeyDetails = () => {
2121
loading: state.loading,
2222
})))
2323

24-
const databaseId = useKeysInContext((state) => state.databaseId)
24+
const database = useDatabasesStore((state) => state.connectedDatabase)
25+
const databaseId = database?.id
2526

2627
const keysApi = useKeysApi()
2728

@@ -54,14 +55,14 @@ const KeyDetails = () => {
5455
const onRemoveKey = () => {
5556
vscodeApi.postMessage({
5657
action: VscodeMessageAction.CloseKeyAndRefresh,
57-
data: { key: keyName, type: SelectedKeyActionType.Removed, databaseId: databaseId! },
58+
data: { key: keyName, type: SelectedKeyActionType.Removed, database: database! },
5859
})
5960
}
6061

6162
const onEditKey = (key: RedisString, newKey: RedisString) => {
6263
vscodeApi.postMessage({
6364
action: VscodeMessageAction.EditKeyName,
64-
data: { key, newKey, type: SelectedKeyActionType.Renamed, databaseId: databaseId! },
65+
data: { key, newKey, type: SelectedKeyActionType.Renamed, database: database! },
6566
})
6667
}
6768

src/webviews/src/modules/keys-tree/components/database-wrapper/DatabaseWrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export const DatabaseWrapper = ({ children, database }: Props) => {
4343
const keysApi = useKeysApi()
4444

4545
useEffect(() => {
46-
const { type, key, keyType, databaseId, newKey } = selectedKeyAction || {}
46+
const { type, key, keyType, database: databaseAction, newKey } = selectedKeyAction || {}
47+
const { id: databaseId } = databaseAction || {}
4748

4849
if (!type || databaseId !== database.id) {
4950
return

src/webviews/src/store/hooks/use-selected-key-store/interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { KeyTypes, KeyValueCompressor, SelectedKeyActionType } from 'uiSrc/constants'
22
import { KeyInfo, Nullable, RedisString } from 'uiSrc/interfaces'
3+
import { Database } from '../use-databases-store/interface'
34

45
export interface SelectedKeyStore {
56
loading: boolean
@@ -13,7 +14,7 @@ export interface SelectedKeyStore {
1314
}
1415

1516
interface SelectedKeyAction {
16-
databaseId: string
17+
database: Database
1718
key?: RedisString
1819
newKey?: RedisString
1920
type: SelectedKeyActionType

0 commit comments

Comments
 (0)