File size: 1,058 Bytes
5710dd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
 * App Services view — the app-scope (server-level) Service reflection as a
 * standalone rail view. Postman-style three-pane layout
 * (`ScopePanelsScrollspy`): the Service list on the left, every Service's
 * methods expanded in one continuously scrolling column in the middle
 * (scroll position and left-side highlight kept in sync), and a
 * request/response call history on the right. The proxies resolve on the
 * `core` route, so this view works before any session is selected.
 */

import { useCallback } from 'react';

import { serviceByName } from '../channel';
import { useConnection } from '../connection';
import type { AnyService } from '../panels';
import { ScopePanelsScrollspy } from './ServicePanels';

export function AppServicesView() {
  const { klient } = useConnection();
  const proxyFor = useCallback(
    (name: string): AnyService | null =>
      serviceByName<AnyService>(klient, name, { scope: 'app' }) ?? null,
    [klient],
  );

  return <ScopePanelsScrollspy scope="app" title="App Services" proxyFor={proxyFor} />;
}