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
4 changes: 2 additions & 2 deletions redisinsight/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const bootstrap = async () => {

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

const titleSplash = 'splash';
const titleSplash = 'RedisInsight';
export const createSplashScreen = async () => {
const splash = new BrowserWindow({
width: 500,
Expand All @@ -153,7 +153,7 @@ export const createSplashScreen = async () => {
return splash;
};

export const createWindow = async (splash: BrowserWindow | null) => {
export const createWindow = async (splash: BrowserWindow | null = null) => {
const RESOURCES_PATH = app.isPackaged
? path.join(process.resourcesPath, 'resources')
: path.join(__dirname, '../resources');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
border-top: 1px solid var(--euiColorLightShade);

z-index: 10;
overflow: hidden;
}

.searchWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
display: flex;
flex: 1;
padding: 0 16px 0;
height: 100%;
height: calc(100% - 70px);
}

.sidebar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
waitFor,
} from 'uiSrc/utils/test-utils'
import QueryWrapper, { Props as QueryProps } from 'uiSrc/components/query'
import { BrowserStorageItem } from 'uiSrc/constants'
import { localStorageService } from 'uiSrc/services'
import { connectedInstanceSelector } from 'uiSrc/slices/instances'
import { processWBClient } from 'uiSrc/slices/workbench/wb-settings'
import { sendWBCommandClusterAction } from 'uiSrc/slices/workbench/wb-results'
Expand Down Expand Up @@ -101,15 +99,6 @@ describe('WBViewWrapper', () => {
expect(render(<WBViewWrapper />)).toBeTruthy()
})

it('should localStorage be called', () => {
const mockUuid = 'test-uuid'
localStorageService.get = jest.fn().mockReturnValue(mockUuid)

render(<WBViewWrapper />)

expect(localStorageService.get).toBeCalledWith(BrowserStorageItem.wbClientUuid)
})

it('should render with SessionStorage', () => {
render(<WBViewWrapper />)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import {
workbenchResultsSelector,
sendWBCommandClusterAction,
} from 'uiSrc/slices/workbench/wb-results'
import { localStorageService } from 'uiSrc/services'
import { BrowserStorageItem } from 'uiSrc/constants'
import { ConnectionType, Instance, IPluginVisualization, RedisDefaultModules } from 'uiSrc/slices/interfaces'
import { initialState as instanceInitState, connectedInstanceSelector } from 'uiSrc/slices/instances'
import HistoryContainer from 'uiSrc/services/queryHistory'
import { ClusterNodeRole, CommandExecutionStatus } from 'uiSrc/slices/interfaces/cli'

import { createWBClientAction, updateWBClientAction } from 'uiSrc/slices/workbench/wb-settings'
import { createWBClientAction, updateWBClientAction, workbenchSettingsSelector } from 'uiSrc/slices/workbench/wb-settings'
import { cliSettingsSelector, fetchBlockingCliCommandsAction } from 'uiSrc/slices/cli/cli-settings'
import { appContextWorkbench, setWorkbenchScript } from 'uiSrc/slices/app/context'
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
Expand Down Expand Up @@ -68,14 +66,13 @@ const WBViewWrapper = () => {
const { unsupportedCommands, blockingCommands } = useSelector(cliSettingsSelector)
const { script: scriptContext } = useSelector(appContextWorkbench)

const wbClientUuid = localStorageService.get(BrowserStorageItem.wbClientUuid) ?? ''

const [historyItems, setHistoryItems] = useState<Array<WBHistoryObject>>([])
const [script, setScript] = useState(scriptContext)
const [multiCommands, setMultiCommands] = useState('')
const [scriptEl, setScriptEl] = useState<Nullable<monacoEditor.editor.IStandaloneCodeEditor>>(null)

const instance = useSelector(connectedInstanceSelector)
const { wbClientUuid = '' } = useSelector(workbenchSettingsSelector)
const { visualizations = [] } = useSelector(appPluginsSelector)
state = {
scriptEl,
Expand Down Expand Up @@ -186,7 +183,18 @@ const WBViewWrapper = () => {
return
}

sendCommand(commandLine, historyId || Date.now())
checkClient(commandLine, historyId || Date.now())
}

const checkClient = (
command: string,
historyId = Date.now()
) => {
if (!wbClientUuid) {
dispatch(createWBClientAction(instanceId, () => sendCommand(command, historyId || Date.now())))
} else {
sendCommand(command, historyId || Date.now())
}
}

const sendCommand = (
Expand Down
9 changes: 3 additions & 6 deletions redisinsight/ui/src/slices/workbench/wb-settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSlice } from '@reduxjs/toolkit'
import { apiService } from 'uiSrc/services'
import { apiService, localStorageService } from 'uiSrc/services'
import { ApiEndpoints, BrowserStorageItem } from 'uiSrc/constants'
import { getApiErrorMessage, getUrl, isStatusSuccessful } from 'uiSrc/utils'

Expand All @@ -12,7 +12,7 @@ export const initialState: StateWorkbenchSettings = {
loading: false,
error: '',
errorClient: '',
wbClientUuid: '',
wbClientUuid: localStorageService.get(BrowserStorageItem.wbClientUuid) ?? '',
unsupportedCommands: [],
}

Expand Down Expand Up @@ -43,9 +43,6 @@ const workbenchSettingsSlice = createSlice({
// Actions generated from the slice
export const {
setWBSettingsInitialState,
// isModuleLoaded,
// isModuleLoadedSuccess,
// isModuleLoadedFailure,
processWBClient,
processWBClientSuccess,
processWBClientFailure,
Expand Down Expand Up @@ -91,7 +88,7 @@ export function updateWBClientAction(
instanceId: string = '',
uuid: string,
onSuccessAction?: () => void,
onFailAction?: (message: string) => void
onFailAction?: (message: string) => void,
) {
return async (dispatch: AppDispatch) => {
dispatch(processWBClient())
Expand Down