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
8 changes: 4 additions & 4 deletions apps/frontend/src/components/ui/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export function AppSidebar() {
<div className="mt-10 flex flex-col items-stretch w-full">
<ul className="space-y-2">
{[
// Always show connect
{ to: "/connect", title: "Connections", icon: HousePlug },
// Rest of the menu items only if connected
...(isConnected
? [
{ to: (clusterId ? `/${clusterId}/${id}/connect` : `${id}/connect`),
title: "Connections",
icon: HousePlug },
{
to: (clusterId ? `/${clusterId}/${id}/dashboard` : `${id}/dashboard`),
title: "Dashboard",
Expand All @@ -75,7 +75,7 @@ export function AppSidebar() {
: []),

]
: []),
: [{ to: "/connect", title: "Connections", icon: HousePlug }]),
].map(({ to, title, icon: Icon }) => (
<li key={to}>
<Link
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const AppWithHistory = () => {

{/* Routes with clusterId */}
<Route element={<RequireConnection />}>
<Route element={<Connection />} path="/:clusterId/:id/connect" />
<Route element={<Dashboard />} path="/:clusterId/:id/dashboard" />
<Route element={<SendCommand />} path="/:clusterId/:id/sendcommand" />
<Route element={<KeyBrowser />} path="/:clusterId/:id/browse" />
Expand All @@ -49,6 +50,7 @@ const AppWithHistory = () => {
{/* Routes without clusterId */}
<Route element={<RequireConnection />}>
<Route element={<ValkeyReconnect />} path="/:id/valkey-reconnect" />
<Route element={<Connection />} path="/:id/connect" />
<Route element={<Dashboard />} path="/:id/dashboard" />
<Route element={<SendCommand />} path="/:id/sendcommand" />
<Route element={<KeyBrowser />} path="/:id/browse" />
Expand Down
10 changes: 9 additions & 1 deletion apps/frontend/src/state/epics/valkeyEpics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setData } from "../valkey-features/info/infoSlice"
import { action$, select } from "../middleware/rxjsMiddleware/rxjsMiddlware"
import { setClusterData } from "../valkey-features/cluster/clusterSlice"
import { connectFulfilled as wsConnectFulfilled } from "../wsconnection/wsConnectionSlice"
import history from "../../history.ts"
import type { Store } from "@reduxjs/toolkit"
import { atId } from "@/state/valkey-features/connection/connectionSelectors.ts"

Expand Down Expand Up @@ -190,7 +191,14 @@ export const setDataEpic = () =>
tap((action) => {
const socket = getSocket()
const { clusterId, connectionId } = action.payload
if (clusterId) socket.next({ type: setClusterData.type, payload: { clusterId, connectionId } })
if (clusterId) {
socket.next({ type: setClusterData.type, payload: { clusterId, connectionId } })
}
socket.next({ type: setData.type, payload: { connectionId } })
const dashboardPath = clusterId
? `/${clusterId}/${connectionId}/dashboard`
: `/${connectionId}/dashboard`

history.navigate(dashboardPath)
}),
)
Empty file.
Loading