99 * by the Apache License, Version 2.0
1010 */
1111
12- import type { SortingState } from '@tanstack/react-table' ;
1312import type React from 'react' ;
1413import { create } from 'zustand' ;
1514
1615import { api } from './backend-api' ;
1716import { createTopicDetailsSettings , type TopicDetailsSettings as TopicSettings , useUISettingsStore } from './ui' ;
1817
19- // Minimal route definition type for currentRoute tracking (legacy, may be removed)
20- type RouteInfo = {
21- title : string ;
22- path : string ;
23- icon ?: ( props : React . ComponentProps < 'svg' > ) => JSX . Element ;
24- } | null ;
25-
2618export type BreadcrumbOptions = {
2719 canBeTruncated ?: boolean ;
2820 canBeCopied ?: boolean ;
@@ -48,52 +40,39 @@ type UIStateStore = {
4840 _pageTitle : string | React . ReactElement ;
4941 pageBreadcrumbs : BreadcrumbEntry [ ] ;
5042 shouldHidePageHeader : boolean ;
51- currentRoute : RouteInfo ;
5243 pathName : string ;
5344 _currentTopicName : string | undefined ;
5445 loginError : string | null ;
5546 isUsingDebugUserLogin : boolean ;
5647 serverBuildTimestamp : number | undefined ;
57- remoteMcpDetails : {
58- logsQuickSearch : string ;
59- sorting : SortingState ;
60- } ;
6148
6249 // Computed getters (accessed as properties on the store)
6350 get pageTitle ( ) : string | React . ReactElement ;
6451 get selectedClusterName ( ) : string | null ;
65- get selectedMenuKeys ( ) : string [ ] | undefined ;
6652 get currentTopicName ( ) : string | undefined ;
6753 get topicSettings ( ) : TopicSettings ;
6854
6955 // Actions (setters)
7056 setPageTitle : ( title : string | React . ReactElement ) => void ;
7157 setPageBreadcrumbs : ( breadcrumbs : BreadcrumbEntry [ ] ) => void ;
7258 setShouldHidePageHeader : ( hide : boolean ) => void ;
73- setCurrentRoute : ( route : RouteInfo ) => void ;
7459 setPathName : ( path : string ) => void ;
7560 setCurrentTopicName : ( topicName : string | undefined ) => void ;
7661 setLoginError : ( error : string | null ) => void ;
7762 setIsUsingDebugUserLogin : ( isUsing : boolean ) => void ;
7863 setServerBuildTimestamp : ( timestamp : number | undefined ) => void ;
79- setRemoteMcpDetails : ( details : { logsQuickSearch ?: string ; sorting ?: SortingState } ) => void ;
8064} ;
8165
8266export const useUIStateStore = create < UIStateStore > ( ( set , get ) => ( {
8367 // Initial state
8468 _pageTitle : ' ' ,
8569 pageBreadcrumbs : [ ] ,
8670 shouldHidePageHeader : false ,
87- currentRoute : null ,
8871 pathName : '' ,
8972 _currentTopicName : undefined ,
9073 loginError : null ,
9174 isUsingDebugUserLogin : false ,
9275 serverBuildTimestamp : undefined ,
93- remoteMcpDetails : {
94- logsQuickSearch : '' ,
95- sorting : [ ] ,
96- } ,
9776
9877 // Computed getters
9978 get pageTitle ( ) {
@@ -113,17 +92,6 @@ export const useUIStateStore = create<UIStateStore>((set, get) => ({
11392 }
11493 } ,
11594
116- get selectedMenuKeys ( ) {
117- let path = get ( ) . pathName ;
118-
119- const i = path . indexOf ( '/' , 1 ) ;
120- if ( i > - 1 ) {
121- path = path . slice ( 0 , i ) ;
122- }
123-
124- return [ path ] ;
125- } ,
126-
12795 get currentTopicName ( ) {
12896 return get ( ) . _currentTopicName ;
12997 } ,
@@ -167,10 +135,6 @@ export const useUIStateStore = create<UIStateStore>((set, get) => ({
167135 set ( { shouldHidePageHeader : hide } ) ;
168136 } ,
169137
170- setCurrentRoute : ( route : RouteInfo ) => {
171- set ( { currentRoute : route } ) ;
172- } ,
173-
174138 setPathName : ( path : string ) => {
175139 set ( { pathName : path } ) ;
176140 } ,
@@ -201,15 +165,6 @@ export const useUIStateStore = create<UIStateStore>((set, get) => ({
201165 setServerBuildTimestamp : ( timestamp : number | undefined ) => {
202166 set ( { serverBuildTimestamp : timestamp } ) ;
203167 } ,
204-
205- setRemoteMcpDetails : ( details : { logsQuickSearch ?: string ; sorting ?: SortingState } ) => {
206- set ( ( state ) => ( {
207- remoteMcpDetails : {
208- ...state . remoteMcpDetails ,
209- ...details ,
210- } ,
211- } ) ) ;
212- } ,
213168} ) ) ;
214169
215170// Legacy export with Proxy for backward compatibility
@@ -220,18 +175,12 @@ export const uiState = new Proxy(
220175 pageBreadcrumbs : BreadcrumbEntry [ ] ;
221176 shouldHidePageHeader : boolean ;
222177 selectedClusterName : string | null ;
223- currentRoute : RouteInfo ;
224178 pathName : string ;
225- selectedMenuKeys : string [ ] | undefined ;
226179 currentTopicName : string | undefined ;
227180 topicSettings : TopicSettings ;
228181 loginError : string | null ;
229182 isUsingDebugUserLogin : boolean ;
230183 serverBuildTimestamp : number | undefined ;
231- remoteMcpDetails : {
232- logsQuickSearch : string ;
233- sorting : SortingState ;
234- } ;
235184 } ,
236185 {
237186 get ( _target , prop : string ) {
@@ -240,7 +189,6 @@ export const uiState = new Proxy(
240189 // Handle computed properties
241190 if ( prop === 'pageTitle' ) return store . pageTitle ;
242191 if ( prop === 'selectedClusterName' ) return store . selectedClusterName ;
243- if ( prop === 'selectedMenuKeys' ) return store . selectedMenuKeys ;
244192 if ( prop === 'currentTopicName' ) return store . currentTopicName ;
245193 if ( prop === 'topicSettings' ) return store . topicSettings ;
246194
@@ -263,10 +211,6 @@ export const uiState = new Proxy(
263211 store . setShouldHidePageHeader ( value as boolean ) ;
264212 return true ;
265213 }
266- if ( prop === 'currentRoute' ) {
267- store . setCurrentRoute ( value as RouteInfo ) ;
268- return true ;
269- }
270214 if ( prop === 'pathName' ) {
271215 store . setPathName ( value as string ) ;
272216 return true ;
@@ -287,10 +231,6 @@ export const uiState = new Proxy(
287231 store . setServerBuildTimestamp ( value as number | undefined ) ;
288232 return true ;
289233 }
290- if ( prop === 'remoteMcpDetails' ) {
291- store . setRemoteMcpDetails ( value as { logsQuickSearch ?: string ; sorting ?: SortingState } ) ;
292- return true ;
293- }
294234
295235 return true ;
296236 } ,
0 commit comments