1- import { href , redirect } from 'react-router' ;
1+ import { Breadcrumb , Breadcrumbs , Button } from 'react-aria-components' ;
2+ import { Panel , PanelGroup , PanelResizeHandle } from 'react-resizable-panels' ;
3+ import { href , NavLink , redirect , useParams } from 'react-router' ;
24
5+ import { Icon } from '~/basic-components/icon' ;
36import * as models from '~/models' ;
7+ import { WorkspaceSyncDropdown } from '~/ui/components/dropdowns/workspace-sync-dropdown' ;
8+ import { Pane , PaneBody , PaneHeader } from '~/ui/components/panes/pane' ;
49import { showResourceNotFoundToast } from '~/ui/components/toast-notification' ;
510
611import type { Route } from './+types/organization.$organizationId.project.$projectId.workspace.$workspaceId.mcp' ;
12+ import { useWorkspaceLoaderData } from './organization.$organizationId.project.$projectId.workspace.$workspaceId' ;
713
814export async function clientLoader ( { params } : Route . ClientLoaderArgs ) {
915 const { projectId, workspaceId, organizationId } = params ;
@@ -19,11 +25,12 @@ export async function clientLoader({ params }: Route.ClientLoaderArgs) {
1925 showResourceNotFoundToast ( `MCP Client not found: ${ workspaceId } ` ) ;
2026 throw redirect ( href ( '/organization/:organizationId/project/:projectId' , { organizationId, projectId } ) ) ;
2127 }
28+
2229 // MCP collection only have one request
2330 const activeRequest = await models . mcpRequest . getByParentId ( workspaceId ) ;
2431 if ( ! activeRequest ) {
25- showResourceNotFoundToast ( `MCP Request not found: ${ workspaceId } ` ) ;
26- throw redirect ( href ( '/organization/:organizationId/project/:projectId' , { organizationId , projectId } ) ) ;
32+ // INS-1972 when no mcp request is found in the workspace, do nothing here
33+ return null ;
2734 }
2835 // Redirect to the debug page of the only request in the MCP workspace
2936 return redirect (
@@ -35,3 +42,75 @@ export async function clientLoader({ params }: Route.ClientLoaderArgs) {
3542 } ) ,
3643 ) ;
3744}
45+
46+ // This page is used for INS-1972 when no mcp request is found in the workspace
47+ const McpWorkspace = ( ) => {
48+ const { activeWorkspace } = useWorkspaceLoaderData ( ) ! ;
49+
50+ const { organizationId, projectId } = useParams ( ) as {
51+ organizationId : string ;
52+ projectId : string ;
53+ workspaceId : string ;
54+ } ;
55+
56+ return (
57+ < PanelGroup
58+ autoSaveId = "insomnia-sidebar"
59+ id = "wrapper"
60+ className = "new-sidebar h-full w-full text-(--color-font)"
61+ direction = "horizontal"
62+ >
63+ < Panel id = "sidebar" className = "sidebar theme--sidebar" maxSize = { 40 } minSize = { 10 } collapsible >
64+ < div className = "flex flex-1 flex-col divide-y divide-solid divide-(--hl-md) overflow-hidden" >
65+ < div className = "flex flex-col items-start divide-y divide-solid divide-(--hl-md)" >
66+ < div className = { `flex w-full` } >
67+ < Breadcrumbs className = "m-0 flex h-(--line-height-sm) w-full list-none items-center gap-2 px-(--padding-sm) font-bold" >
68+ < Breadcrumb className = "flex h-full items-center gap-2 text-(--color-font) outline-hidden select-none data-focused:outline-hidden" >
69+ < NavLink
70+ data-testid = "project"
71+ className = "flex aspect-square h-7 shrink-0 items-center justify-center gap-2 rounded-xs px-1 py-1 text-sm text-(--color-font) ring-1 ring-transparent outline-hidden transition-all hover:bg-(--hl-xs) focus:ring-(--hl-md) focus:ring-inset aria-pressed:bg-(--hl-sm) data-focused:outline-hidden"
72+ to = { `/organization/${ organizationId } /project/${ projectId } ` }
73+ >
74+ < Icon className = "text-xs" icon = "chevron-left" />
75+ </ NavLink >
76+ < span aria-hidden role = "separator" className = "h-4 text-(--hl-lg) outline-1 outline-solid" />
77+ </ Breadcrumb >
78+ < Breadcrumb className = "flex h-full items-center gap-2 truncate text-(--color-font) outline-hidden select-none data-focused:outline-hidden" >
79+ < Button
80+ aria-label = "Workspace actions"
81+ data-testid = "workspace-context-dropdown"
82+ className = "flex h-7 flex-1 items-center justify-center gap-2 truncate rounded-xs px-3 py-1 text-sm text-(--color-font) ring-1 ring-transparent transition-all hover:bg-(--hl-xs) focus:ring-(--hl-md) focus:ring-inset aria-pressed:bg-(--hl-sm)"
83+ >
84+ < span className = "truncate" title = { activeWorkspace . name } >
85+ { activeWorkspace . name }
86+ </ span >
87+ </ Button >
88+ </ Breadcrumb >
89+ </ Breadcrumbs >
90+ </ div >
91+ </ div >
92+
93+ < div className = "flex flex-1 flex-col overflow-hidden" >
94+ < div className = "flex justify-between gap-1 p-(--padding-sm)" />
95+ </ div >
96+ < WorkspaceSyncDropdown />
97+ </ div >
98+ </ Panel >
99+ < PanelResizeHandle className = "h-full w-px bg-(--hl-md)" />
100+
101+ < Panel className = "flex flex-col" >
102+ < Pane type = "request" >
103+ < PaneHeader />
104+ < PaneBody placeholder >
105+ < div className = "pane__body--placeholder__cta text-center" >
106+ < p className = "font-bold" > Your local version of this MCP Client contains errors and cannot be opened.</ p >
107+ < p > Pull to see if there is a newer version on the Cloud, or create a new MCP Client.</ p >
108+ </ div >
109+ </ PaneBody >
110+ </ Pane >
111+ </ Panel >
112+ </ PanelGroup >
113+ ) ;
114+ } ;
115+
116+ export default McpWorkspace ;
0 commit comments