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
12 changes: 11 additions & 1 deletion redisinsight/ui/src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@
MOUNT_PATH = RIPROXYPATH
}

export const history = createBrowserHistory({ basename: MOUNT_PATH })
const history = createBrowserHistory({ basename: MOUNT_PATH })

export const navigate = (path: string) => {

Check warning on line 19 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
if (window.location.hash) {
// Electron (HashRouter)
window.location.hash = `#${path}`

Check warning on line 22 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
} else {
// Web (BrowserRouter)
history.push(path)

Check warning on line 25 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 26 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 26 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 26 in redisinsight/ui/src/Router.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

const Router = ({ children }: Props) => (
<ReactRouter history={history}>{children}</ReactRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jest.mock('uiSrc/slices/app/context', () => ({

const mockHistoryPush = jest.fn()
jest.mock('uiSrc/Router', () => ({
history: { push: jest.fn((...args) => mockHistoryPush(...args)) },
navigate: jest.fn((...args) => mockHistoryPush(...args)),
}))

const mockLocalStorageSet = jest.fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { appContextSelector, resetRdiContext } from 'uiSrc/slices/app/context'
import { BrowserStorageItem, Pages } from 'uiSrc/constants'
import { store, dispatch } from 'uiSrc/slices/store'
import { SortingState } from 'uiSrc/components/base/layout/table'
import { history } from 'uiSrc/Router'
import { navigate } from 'uiSrc/Router'
import { localStorageService } from 'uiSrc/services'

const connectToInstance = (id: string) => {
dispatch(resetRdiContext())
dispatch(setConnectedInstanceId(id))

history.push(Pages.browser(id))
navigate(Pages.browser(id))
}

export const handleCheckConnectToInstance = async (instance: Instance) => {
Expand Down
Loading