@skyhook-io/radar-app 1.22.0 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/App.tsx +2 -1
- package/src/api/client.ts +12 -0
- package/src/api/cnpg-history.ts +3 -3
- package/src/api/cnpg-storage.ts +3 -3
- package/src/api/diagnose.test.ts +34 -0
- package/src/api/diagnose.ts +17 -4
- package/src/api/radarFeatures.test.ts +13 -1
- package/src/api/radarFeatures.ts +2 -0
- package/src/api/resourceActions.test.ts +829 -0
- package/src/api/resourceActions.ts +584 -0
- package/src/api/resourceActions.ui.test.tsx +1882 -0
- package/src/api/reviewedActionMutation.ts +56 -28
- package/src/api/substrateHealth.ts +2 -3
- package/src/api/traffic.ts +13 -5
- package/src/api/workloadMetrics.test.ts +11 -2
- package/src/api/workloadMetrics.ts +2 -2
- package/src/components/diagnose/AnalysisStory.test.tsx +12 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +34 -1
- package/src/components/diagnose/DiagnoseContext.tsx +28 -3
- package/src/components/diagnose/DiagnoseSurface.tsx +5 -4
- package/src/components/diagnose/Home.tsx +3 -0
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +61 -0
- package/src/components/diagnose/InvestigationView.followupFailure.test.tsx +122 -0
- package/src/components/diagnose/InvestigationView.tsx +10 -2
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +1 -1
- package/src/components/diagnose/LocalDiagnoseAction.tsx +2 -2
- package/src/components/diagnose/QuestionComposer.test.tsx +16 -2
- package/src/components/diagnose/QuestionComposer.tsx +13 -8
- package/src/components/diagnose/diagnoseEvidenceTypes.ts +47 -8
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.test.ts +153 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +9 -13
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +21 -5
- package/src/components/diagnose/investigationEvidence/bodies/network.tsx +63 -26
- package/src/components/diagnose/launch.ts +1 -1
- package/src/components/dock/PodDebugSession.test.tsx +66 -0
- package/src/components/dock/PodDebugSession.tsx +3 -1
- package/src/components/dock/TerminalTab.test.tsx +43 -3
- package/src/components/dock/TerminalTab.tsx +10 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +1 -1
- package/src/components/helm/InstallWizard.tsx +1 -1
- package/src/components/home/mcpToolCatalog.ts +1 -1
- package/src/components/resources/PodEvictAction.test.tsx +951 -0
- package/src/components/resources/PodEvictAction.tsx +167 -0
- package/src/components/resources/ResourcesView.tsx +3 -0
- package/src/components/resources/renderers/WorkloadRenderer.tsx +3 -0
- package/src/components/settings/LocalConnectionSettings.tsx +4 -4
- package/src/components/settings/SettingsDialog.tsx +23 -18
- package/src/components/settings/integrationQueries.test.ts +98 -0
- package/src/components/settings/integrationQueries.ts +36 -0
- package/src/components/traffic/TrafficView.reconnect.test.tsx +229 -0
- package/src/components/traffic/TrafficView.tsx +91 -35
- package/src/components/ui/Markdown.test.tsx +37 -0
- package/src/components/ui/Markdown.tsx +15 -2
- package/src/components/useContextSwitchFlow.test.tsx +27 -2
- package/src/components/useContextSwitchFlow.tsx +20 -22
- package/src/components/workload/WorkloadView.tsx +16 -3
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
1
2
|
import { renderToString } from 'react-dom/server'
|
|
3
|
+
import { act } from 'react'
|
|
4
|
+
import { createRoot } from 'react-dom/client'
|
|
2
5
|
import { beforeEach, expect, it, vi } from 'vitest'
|
|
3
6
|
import type { TerminalTabProps } from '@skyhook-io/k8s-ui'
|
|
4
7
|
import { TerminalTab } from './TerminalTab'
|
|
@@ -23,24 +26,61 @@ it.each([undefined, '/bin/custom+command'])('forwards the executable and context
|
|
|
23
26
|
expect(new URL(retry.wsUrl).searchParams.get('uid')).toBe('reviewed-pod')
|
|
24
27
|
})
|
|
25
28
|
|
|
26
|
-
it('reconnects on the connection the tab was opened on,
|
|
29
|
+
it('reconnects on the connection the tab was opened on, and says so once that connection has closed', async () => {
|
|
27
30
|
const { observeConnectionStatus, resetConnectionBindingForTest } = await import('../../api/connectionBinding')
|
|
28
31
|
resetConnectionBindingForTest()
|
|
29
32
|
observeConnectionStatus({ connectionId: 'n-1' })
|
|
30
33
|
renderToString(<TerminalTab namespace="app" podName="worker" containerName="app" containers={['app']} />)
|
|
31
|
-
observeConnectionStatus({ connectionId: 'n-2' }) // switched since the tab opened
|
|
32
34
|
const { wsUrl } = await captured.props!.createSession('app')
|
|
33
35
|
expect(new URL(wsUrl).searchParams.get('connection')).toBe('n-1')
|
|
36
|
+
observeConnectionStatus({ connectionId: 'n-2' }) // switched since the tab opened
|
|
37
|
+
await expect(captured.props!.createSession('app')).rejects.toThrow('the cluster connection it ran on closed')
|
|
38
|
+
resetConnectionBindingForTest()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('shows the ended state with Close once the connection the tab opened on is replaced', async () => {
|
|
42
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
43
|
+
const { observeConnectionStatus, resetConnectionBindingForTest } = await import('../../api/connectionBinding')
|
|
34
44
|
resetConnectionBindingForTest()
|
|
45
|
+
observeConnectionStatus({ connectionId: 'n-1' })
|
|
46
|
+
const onLeaveTerminal = vi.fn()
|
|
47
|
+
const root = createRoot(document.createElement('div'))
|
|
48
|
+
await act(async () => root.render(<TerminalTab namespace="app" podName="worker" containerName="app" containers={['app']} onLeaveTerminal={onLeaveTerminal} />))
|
|
49
|
+
expect(captured.props!.endedNotice).toBeUndefined()
|
|
50
|
+
await act(async () => observeConnectionStatus({ connectionId: 'n-2' }))
|
|
51
|
+
expect(captured.props!.endedNotice).toContain('the cluster connection it ran on closed')
|
|
52
|
+
captured.props!.onClose!()
|
|
53
|
+
expect(onLeaveTerminal).toHaveBeenCalledTimes(1)
|
|
54
|
+
await act(async () => root.unmount())
|
|
55
|
+
resetConnectionBindingForTest()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('treats a changed API base as a closed connection', async () => {
|
|
59
|
+
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true })
|
|
60
|
+
const config = await import('../../api/config')
|
|
61
|
+
const original = config.getApiBase()
|
|
62
|
+
const root = createRoot(document.createElement('div'))
|
|
63
|
+
await act(async () => root.render(<TerminalTab namespace="app" podName="worker" containerName="app" containers={['app']} />))
|
|
64
|
+
expect(captured.props!.endedNotice).toBeUndefined()
|
|
65
|
+
try {
|
|
66
|
+
config.setApiBase('/clusters/other/api')
|
|
67
|
+
await act(async () => root.render(<TerminalTab namespace="app" podName="worker" containerName="app" containers={['app']} />))
|
|
68
|
+
expect(captured.props!.endedNotice).toContain('closed')
|
|
69
|
+
} finally {
|
|
70
|
+
config.setApiBase(original)
|
|
71
|
+
await act(async () => root.unmount())
|
|
72
|
+
}
|
|
35
73
|
})
|
|
36
74
|
|
|
37
75
|
it('reconnects an existing debug session to its reviewed connection without offering another container', async () => {
|
|
38
76
|
const { observeConnectionStatus, resetConnectionBindingForTest } = await import('../../api/connectionBinding')
|
|
39
|
-
observeConnectionStatus({ connectionId: '
|
|
77
|
+
observeConnectionStatus({ connectionId: 'reviewed-cluster' })
|
|
40
78
|
renderToString(<TerminalTab namespace="demo" podName="api" containerName="debug-1" containers={['debug-1']} debugSession={{ connectionId: 'reviewed-cluster', apiBase: '/api', podUID: 'reviewed', image: 'mirror.example/debug' }} />)
|
|
41
79
|
const { wsUrl } = await captured.props!.createSession('debug-1')
|
|
42
80
|
expect(new URL(wsUrl).searchParams.get('connection')).toBe('reviewed-cluster')
|
|
43
81
|
expect(new URL(wsUrl).searchParams.get('uid')).toBe('reviewed')
|
|
82
|
+
observeConnectionStatus({ connectionId: 'next-cluster' })
|
|
83
|
+
await expect(captured.props!.createSession('debug-1')).rejects.toThrow('the cluster connection it ran on closed')
|
|
44
84
|
expect(renderToString(captured.props!.renderDebugAction!('debug-1', 'reviewed'))).toContain('different image')
|
|
45
85
|
resetConnectionBindingForTest()
|
|
46
86
|
})
|
|
@@ -7,7 +7,9 @@ import { useResource } from '../../api/client'
|
|
|
7
7
|
import type { PodDebugTarget } from '../resources/PodDebugAction'
|
|
8
8
|
import { MissingShellDebug } from './MissingShellDebug'
|
|
9
9
|
import { PodDebugSession } from './PodDebugSession'
|
|
10
|
-
import { useCurrentConnectionId, useOpenedConnection, withConnectionParam } from '../../api/connectionBinding'
|
|
10
|
+
import { connectionHeaderValue, useCurrentConnectionId, useOpenedConnection, withConnectionParam } from '../../api/connectionBinding'
|
|
11
|
+
|
|
12
|
+
const connectionClosedNotice = 'This terminal ended because the cluster connection it ran on closed (a cluster switch, a retry or a sign-in refresh). Open the Pod again to start a new terminal.'
|
|
11
13
|
|
|
12
14
|
interface TerminalTabProps {
|
|
13
15
|
namespace: string
|
|
@@ -30,6 +32,7 @@ export function TerminalTab({ namespace, podName, podUID, containerName, contain
|
|
|
30
32
|
const base = debugSession?.apiBase ?? openedBase
|
|
31
33
|
const currentConnection = useCurrentConnectionId()
|
|
32
34
|
const sameConnection = currentConnection === connection && getApiBase() === base
|
|
35
|
+
const connectionClosed = getApiBase() !== base || (!!connection && !!currentConnection && currentConnection !== connection)
|
|
33
36
|
const checkTargets = !!podUID && !shell && !debugSession && containers.length > 1
|
|
34
37
|
const pod = useResource<PodDebugTarget>('pods', namespace, podName, undefined, { enabled: checkTargets && sameConnection && isActive !== false })
|
|
35
38
|
const currentPod = sameConnection && !pod.error && pod.data?.metadata.uid === podUID ? pod.data : undefined
|
|
@@ -43,6 +46,10 @@ export function TerminalTab({ namespace, podName, podUID, containerName, contain
|
|
|
43
46
|
const createSession = async (container: string, failedPodUID?: string) => {
|
|
44
47
|
const uid = debugSession?.podUID ?? podUID ?? failedPodUID
|
|
45
48
|
if (getApiBase() !== base) throw new Error('The cluster connection changed. Reopen the Pod to start a terminal.')
|
|
49
|
+
// The server refuses a terminal on a connection that has closed, but a browser
|
|
50
|
+
// can't read why a WebSocket upgrade failed, so say it here.
|
|
51
|
+
const current = connectionHeaderValue(base)
|
|
52
|
+
if (connection && current && current !== connection) throw new Error(connectionClosedNotice)
|
|
46
53
|
return {
|
|
47
54
|
wsUrl: withConnectionParam(getWsUrl(`/pods/${namespace}/${podName}/exec?container=${encodeURIComponent(container)}${uid ? `&uid=${encodeURIComponent(uid)}` : ''}${shell ? `&shell=${encodeURIComponent(shell)}` : ''}`), connection),
|
|
48
55
|
}
|
|
@@ -64,6 +71,8 @@ export function TerminalTab({ namespace, podName, podUID, containerName, contain
|
|
|
64
71
|
<MissingShellDebug key={JSON.stringify([uid,target])} namespace={namespace} name={podName} target={target} uid={uid} connection={connection} base={base} podDetailsLink={podDetailsLink} />}
|
|
65
72
|
note={note}
|
|
66
73
|
command={shell}
|
|
74
|
+
endedNotice={connectionClosed ? connectionClosedNotice : undefined}
|
|
75
|
+
onClose={onLeaveTerminal}
|
|
67
76
|
/>
|
|
68
77
|
)
|
|
69
78
|
return debugSession ? <PodDebugSession namespace={namespace} podName={podName} containerName={containerName} session={debugSession} isActive={isActive} podDetailsLink={podDetailsLink}>
|
|
@@ -1556,7 +1556,7 @@ function OverviewTab({ release, onCopy, copied }: OverviewTabProps) {
|
|
|
1556
1556
|
</button>
|
|
1557
1557
|
</div>
|
|
1558
1558
|
<div className="text-xs bg-theme-base/50 rounded p-3 max-h-96 overflow-auto">
|
|
1559
|
-
<Markdown>{release.readme}</Markdown>
|
|
1559
|
+
<Markdown allowImages>{release.readme}</Markdown>
|
|
1560
1560
|
</div>
|
|
1561
1561
|
</div>
|
|
1562
1562
|
)}
|
|
@@ -640,7 +640,7 @@ function InfoStep({
|
|
|
640
640
|
</button>
|
|
641
641
|
{showReadme && (
|
|
642
642
|
<div className="mt-3 p-4 bg-theme-base/50 rounded-lg text-xs overflow-auto max-h-96">
|
|
643
|
-
<Markdown>{readme}</Markdown>
|
|
643
|
+
<Markdown allowImages>{readme}</Markdown>
|
|
644
644
|
</div>
|
|
645
645
|
)}
|
|
646
646
|
</div>
|
|
@@ -59,7 +59,7 @@ export const MCP_TOOL_CATALOG: MCPToolInfo[] = [
|
|
|
59
59
|
{ arg: 'name', required: true, desc: 'resource name' },
|
|
60
60
|
{ arg: 'namespace', desc: 'omit for cluster-scoped kinds (Node, ClusterRole, IngressClass, etc.)' },
|
|
61
61
|
{ arg: 'group', desc: 'API group when the kind is ambiguous (e.g. serving.knative.dev for Knative Service vs core Service)' },
|
|
62
|
-
{ arg: 'include', desc: 'events, metrics, changes, issues, drain-plan (Node pod/PDB estimate), revisions (rollback targets for Deployment/StatefulSet/DaemonSet/Rollout)' },
|
|
62
|
+
{ arg: 'include', desc: 'identity (observed UID and resourceVersion), events, metrics, changes, issues, drain-plan (Node pod/PDB estimate), revisions (rollback targets for Deployment/StatefulSet/DaemonSet/Rollout)' },
|
|
63
63
|
{ arg: 'context', desc: 'resourceContext tier: basic (default) or none' },
|
|
64
64
|
{ arg: 'relationship', desc: 'one relationship field a partial-preview warning named (e.g. dependents), returned with up to 200 entries' },
|
|
65
65
|
],
|