Skip to content

Commit 0b741bc

Browse files
Merge pull request #114 from RedisInsight/feature/bugfix
#RI-2169, #RI-2135
2 parents be97a69 + f92933f commit 0b741bc

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

redisinsight/main.dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const bootstrap = async () => {
136136

137137
export const windows = new Set<BrowserWindow>();
138138

139-
const titleSplash = 'splash';
139+
const titleSplash = 'RedisInsight';
140140
export const createSplashScreen = async () => {
141141
const splash = new BrowserWindow({
142142
width: 500,
@@ -153,7 +153,7 @@ export const createSplashScreen = async () => {
153153
return splash;
154154
};
155155

156-
export const createWindow = async (splash: BrowserWindow | null) => {
156+
export const createWindow = async (splash: BrowserWindow | null = null) => {
157157
const RESOURCES_PATH = app.isPackaged
158158
? path.join(process.resourcesPath, 'resources')
159159
: path.join(__dirname, '../resources');

redisinsight/ui/src/components/cli/components/cli-helper/CliHelper/styles.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
border-top: 1px solid var(--euiColorLightShade);
1818

1919
z-index: 10;
20+
overflow: hidden;
2021
}
2122

2223
.searchWrapper {

redisinsight/ui/src/pages/workbench/components/wb-view/WBView/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
display: flex;
1010
flex: 1;
1111
padding: 0 16px 0;
12-
height: 100%;
12+
height: calc(100% - 70px);
1313
}
1414

1515
.sidebar {

redisinsight/ui/src/pages/workbench/components/wb-view/WBViewWrapper.spec.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import {
1111
waitFor,
1212
} from 'uiSrc/utils/test-utils'
1313
import QueryWrapper, { Props as QueryProps } from 'uiSrc/components/query'
14-
import { BrowserStorageItem } from 'uiSrc/constants'
15-
import { localStorageService } from 'uiSrc/services'
1614
import { connectedInstanceSelector } from 'uiSrc/slices/instances'
1715
import { processWBClient } from 'uiSrc/slices/workbench/wb-settings'
1816
import { sendWBCommandClusterAction } from 'uiSrc/slices/workbench/wb-results'
@@ -101,15 +99,6 @@ describe('WBViewWrapper', () => {
10199
expect(render(<WBViewWrapper />)).toBeTruthy()
102100
})
103101

104-
it('should localStorage be called', () => {
105-
const mockUuid = 'test-uuid'
106-
localStorageService.get = jest.fn().mockReturnValue(mockUuid)
107-
108-
render(<WBViewWrapper />)
109-
110-
expect(localStorageService.get).toBeCalledWith(BrowserStorageItem.wbClientUuid)
111-
})
112-
113102
it('should render with SessionStorage', () => {
114103
render(<WBViewWrapper />)
115104

redisinsight/ui/src/pages/workbench/components/wb-view/WBViewWrapper.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ import {
1919
workbenchResultsSelector,
2020
sendWBCommandClusterAction,
2121
} from 'uiSrc/slices/workbench/wb-results'
22-
import { localStorageService } from 'uiSrc/services'
23-
import { BrowserStorageItem } from 'uiSrc/constants'
2422
import { ConnectionType, Instance, IPluginVisualization, RedisDefaultModules } from 'uiSrc/slices/interfaces'
2523
import { initialState as instanceInitState, connectedInstanceSelector } from 'uiSrc/slices/instances'
2624
import HistoryContainer from 'uiSrc/services/queryHistory'
2725
import { ClusterNodeRole, CommandExecutionStatus } from 'uiSrc/slices/interfaces/cli'
2826

29-
import { createWBClientAction, updateWBClientAction } from 'uiSrc/slices/workbench/wb-settings'
27+
import { createWBClientAction, updateWBClientAction, workbenchSettingsSelector } from 'uiSrc/slices/workbench/wb-settings'
3028
import { cliSettingsSelector, fetchBlockingCliCommandsAction } from 'uiSrc/slices/cli/cli-settings'
3129
import { appContextWorkbench, setWorkbenchScript } from 'uiSrc/slices/app/context'
3230
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
@@ -68,14 +66,13 @@ const WBViewWrapper = () => {
6866
const { unsupportedCommands, blockingCommands } = useSelector(cliSettingsSelector)
6967
const { script: scriptContext } = useSelector(appContextWorkbench)
7068

71-
const wbClientUuid = localStorageService.get(BrowserStorageItem.wbClientUuid) ?? ''
72-
7369
const [historyItems, setHistoryItems] = useState<Array<WBHistoryObject>>([])
7470
const [script, setScript] = useState(scriptContext)
7571
const [multiCommands, setMultiCommands] = useState('')
7672
const [scriptEl, setScriptEl] = useState<Nullable<monacoEditor.editor.IStandaloneCodeEditor>>(null)
7773

7874
const instance = useSelector(connectedInstanceSelector)
75+
const { wbClientUuid = '' } = useSelector(workbenchSettingsSelector)
7976
const { visualizations = [] } = useSelector(appPluginsSelector)
8077
state = {
8178
scriptEl,
@@ -186,7 +183,18 @@ const WBViewWrapper = () => {
186183
return
187184
}
188185

189-
sendCommand(commandLine, historyId || Date.now())
186+
checkClient(commandLine, historyId || Date.now())
187+
}
188+
189+
const checkClient = (
190+
command: string,
191+
historyId = Date.now()
192+
) => {
193+
if (!wbClientUuid) {
194+
dispatch(createWBClientAction(instanceId, () => sendCommand(command, historyId || Date.now())))
195+
} else {
196+
sendCommand(command, historyId || Date.now())
197+
}
190198
}
191199

192200
const sendCommand = (

redisinsight/ui/src/slices/workbench/wb-settings.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createSlice } from '@reduxjs/toolkit'
2-
import { apiService } from 'uiSrc/services'
2+
import { apiService, localStorageService } from 'uiSrc/services'
33
import { ApiEndpoints, BrowserStorageItem } from 'uiSrc/constants'
44
import { getApiErrorMessage, getUrl, isStatusSuccessful } from 'uiSrc/utils'
55

@@ -12,7 +12,7 @@ export const initialState: StateWorkbenchSettings = {
1212
loading: false,
1313
error: '',
1414
errorClient: '',
15-
wbClientUuid: '',
15+
wbClientUuid: localStorageService.get(BrowserStorageItem.wbClientUuid) ?? '',
1616
unsupportedCommands: [],
1717
}
1818

@@ -43,9 +43,6 @@ const workbenchSettingsSlice = createSlice({
4343
// Actions generated from the slice
4444
export const {
4545
setWBSettingsInitialState,
46-
// isModuleLoaded,
47-
// isModuleLoadedSuccess,
48-
// isModuleLoadedFailure,
4946
processWBClient,
5047
processWBClientSuccess,
5148
processWBClientFailure,
@@ -91,7 +88,7 @@ export function updateWBClientAction(
9188
instanceId: string = '',
9289
uuid: string,
9390
onSuccessAction?: () => void,
94-
onFailAction?: (message: string) => void
91+
onFailAction?: (message: string) => void,
9592
) {
9693
return async (dispatch: AppDispatch) => {
9794
dispatch(processWBClient())

0 commit comments

Comments
 (0)