@skyhook-io/k8s-ui 1.8.9 → 1.8.11
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 +5 -4
- package/src/assets/gitops/argocd.png +0 -0
- package/src/assets/gitops/flux.svg +7 -0
- package/src/components/applications/AppChips.tsx +10 -0
- package/src/components/applications/ApplicationDetail.test.tsx +569 -0
- package/src/components/applications/ApplicationDetail.tsx +2517 -450
- package/src/components/applications/ApplicationsList.tsx +4 -1
- package/src/components/applications/ApplicationsView.tsx +101 -18
- package/src/components/applications/applications-view.test.tsx +47 -0
- package/src/components/applications/index.ts +1 -1
- package/src/components/audit/AuditAlerts.tsx +14 -10
- package/src/components/checks/ChecksView.tsx +81 -51
- package/src/components/checks/severity.ts +39 -45
- package/src/components/cluster-switcher/ClusterSwitcher.tsx +2 -2
- package/src/components/compare/CompareResourcePicker.tsx +2 -2
- package/src/components/gitops/GitOpsGraphFilterRail.tsx +2 -1
- package/src/components/gitops/GitOpsTableView.tsx +14 -59
- package/src/components/gitops/ManagedResourcesList.tsx +8 -11
- package/src/components/gitops/SyncCountdown.tsx +26 -17
- package/src/components/gitops/SyncOptionsDialog.tsx +2 -2
- package/src/components/gitops/insights/GitOpsInsightViews.tsx +277 -104
- package/src/components/gitops/insights/insights-helpers.test.ts +86 -1
- package/src/components/gitops/insights/insights-helpers.ts +69 -1
- package/src/components/gitops/tree/GitOpsTreeGraph.tsx +5 -2
- package/src/components/issues/IssuesView.tsx +219 -143
- package/src/components/issues/ResourceIssuesSection.test.tsx +40 -0
- package/src/components/issues/ResourceIssuesSection.tsx +28 -128
- package/src/components/issues/index.ts +3 -2
- package/src/components/issues/issue-timing.ts +53 -0
- package/src/components/issues/issues.test.ts +146 -4
- package/src/components/issues/severity.ts +29 -32
- package/src/components/logs/LogCore.tsx +14 -4
- package/src/components/logs/WorkloadLogsViewer.tsx +31 -6
- package/src/components/logs/useLogStream.ts +8 -1
- package/src/components/namespace-switcher/NamespacePicker.tsx +86 -107
- package/src/components/resources/ResourcesSidebar.test.tsx +107 -0
- package/src/components/resources/ResourcesSidebar.tsx +70 -52
- package/src/components/resources/ResourcesView.selected-kind.test.ts +143 -0
- package/src/components/resources/ResourcesView.tsx +243 -53
- package/src/components/resources/renderers/ClusterComplianceReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/CronWorkflowRenderer.tsx +99 -0
- package/src/components/resources/renderers/JobRenderer.tsx +3 -1
- package/src/components/resources/renderers/MetricsUnavailableNotice.tsx +47 -0
- package/src/components/resources/renderers/NodeRenderer.test.tsx +103 -0
- package/src/components/resources/renderers/NodeRenderer.tsx +20 -12
- package/src/components/resources/renderers/PVCRenderer.test.tsx +23 -0
- package/src/components/resources/renderers/PVCRenderer.tsx +2 -2
- package/src/components/resources/renderers/PodRenderer.test.tsx +101 -0
- package/src/components/resources/renderers/PodRenderer.tsx +81 -70
- package/src/components/resources/renderers/PrometheusRuleRenderer.tsx +2 -2
- package/src/components/resources/renderers/SbomReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/SecretRenderer.tsx +2 -0
- package/src/components/resources/renderers/ServiceRenderer.tsx +58 -40
- package/src/components/resources/renderers/VulnerabilityReportRenderer.tsx +2 -2
- package/src/components/resources/renderers/WorkflowRenderer.test.tsx +43 -0
- package/src/components/resources/renderers/WorkflowRenderer.tsx +60 -78
- package/src/components/resources/renderers/index.ts +1 -0
- package/src/components/resources/resource-utils-capi.ts +1 -1
- package/src/components/resources/resource-utils.ts +31 -0
- package/src/components/shared/DetailShell.tsx +2 -2
- package/src/components/shared/ResourceActionsBar.tsx +140 -108
- package/src/components/shared/ResourceRendererDispatch.tsx +33 -4
- package/src/components/timeline/TimelineList.tsx +371 -354
- package/src/components/timeline/TimelineStrip.test.tsx +194 -0
- package/src/components/timeline/TimelineStrip.tsx +836 -0
- package/src/components/timeline/TimelineSwimlanes.test.tsx +1028 -0
- package/src/components/timeline/TimelineSwimlanes.tsx +2498 -593
- package/src/components/timeline/TimelineToolbar.test.tsx +320 -0
- package/src/components/timeline/TimelineToolbar.tsx +759 -0
- package/src/components/timeline/TimelineToolbarState.test.tsx +64 -0
- package/src/components/timeline/index.ts +23 -0
- package/src/components/timeline/scrubber-math.test.ts +235 -0
- package/src/components/timeline/scrubber-math.ts +249 -0
- package/src/components/timeline/shared.test.tsx +219 -0
- package/src/components/timeline/shared.tsx +232 -447
- package/src/components/timeline/timeline-filters.test.ts +196 -0
- package/src/components/timeline/timeline-filters.ts +180 -0
- package/src/components/timeline/timeline-lane-sort.test.ts +97 -0
- package/src/components/timeline/timeline-lane-sort.ts +77 -0
- package/src/components/timeline/timeline-live.test.ts +131 -0
- package/src/components/timeline/timeline-live.ts +77 -0
- package/src/components/topology/GroupNode.tsx +9 -2
- package/src/components/topology/K8sResourceNode.test.ts +11 -0
- package/src/components/topology/K8sResourceNode.tsx +387 -243
- package/src/components/topology/TopologyFilterSidebar.tsx +9 -0
- package/src/components/topology/TopologyGraph.tsx +89 -16
- package/src/components/topology/TopologySearch.tsx +2 -2
- package/src/components/topology/layout.ts +10 -2
- package/src/components/topology/topology.css +0 -92
- package/src/components/ui/Badge.tsx +5 -0
- package/src/components/ui/BoardSkeleton.tsx +47 -0
- package/src/components/ui/CardSection.tsx +117 -0
- package/src/components/ui/CodeViewer.tsx +2 -2
- package/src/components/ui/Collapse.tsx +59 -0
- package/src/components/ui/ConfirmDialog.tsx +7 -3
- package/src/components/ui/DialogPortal.tsx +31 -9
- package/src/components/ui/Input.tsx +24 -0
- package/src/components/ui/MultiSelectPicker.test.tsx +101 -0
- package/src/components/ui/MultiSelectPicker.tsx +167 -0
- package/src/components/ui/PaneLoader.tsx +10 -2
- package/src/components/ui/ResourceBar.tsx +68 -25
- package/src/components/ui/SearchBox.tsx +18 -4
- package/src/components/ui/SearchPillInput.tsx +2 -2
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/drawer-components.tsx +39 -26
- package/src/components/ui/index.ts +6 -0
- package/src/components/ui/severity-tone.ts +63 -0
- package/src/components/workload/ResourceDetailDrawer.tsx +6 -2
- package/src/components/workload/WorkloadView.tsx +2682 -472
- package/src/components/workload/index.ts +1 -1
- package/src/theme/variables.css +15 -1
- package/src/types/core.ts +57 -4
- package/src/utils/api-resources.test.ts +54 -0
- package/src/utils/api-resources.ts +68 -1
- package/src/utils/application-topology.test.ts +198 -0
- package/src/utils/application-topology.ts +261 -0
- package/src/utils/applications.test.ts +167 -1
- package/src/utils/applications.ts +1157 -393
- package/src/utils/index.ts +2 -0
- package/src/utils/navigation.test.ts +32 -1
- package/src/utils/navigation.ts +70 -0
- package/src/utils/resource-hierarchy.test.ts +990 -1
- package/src/utils/resource-hierarchy.ts +905 -267
- package/src/utils/resource-icons.ts +2 -0
- package/src/utils/topology-neighborhood.test.ts +202 -1
- package/src/utils/topology-neighborhood.ts +194 -13
- package/src/utils/workflow-execution.test.ts +556 -0
- package/src/utils/workflow-execution.ts +814 -0
- package/src/utils/workload-colors.ts +2 -3
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import type { APIResource } from '../../types'
|
|
3
|
+
import {
|
|
4
|
+
canonicalizeSelectedKind,
|
|
5
|
+
deriveSidebarResourceCounts,
|
|
6
|
+
LOADED_RESOURCE_COUNT_TTL_MS,
|
|
7
|
+
resourceQueryMatchesSelectedKind,
|
|
8
|
+
} from './ResourcesView'
|
|
9
|
+
|
|
10
|
+
const endpoints: APIResource = {
|
|
11
|
+
group: '',
|
|
12
|
+
version: 'v1',
|
|
13
|
+
kind: 'Endpoints',
|
|
14
|
+
name: 'endpoints',
|
|
15
|
+
namespaced: true,
|
|
16
|
+
isCrd: false,
|
|
17
|
+
verbs: ['list', 'get', 'watch'],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const httpRoute: APIResource = {
|
|
21
|
+
group: 'gateway.networking.k8s.io',
|
|
22
|
+
version: 'v1',
|
|
23
|
+
kind: 'HTTPRoute',
|
|
24
|
+
name: 'httproutes',
|
|
25
|
+
namespaced: true,
|
|
26
|
+
isCrd: true,
|
|
27
|
+
verbs: ['list', 'get', 'watch'],
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('canonicalizeSelectedKind', () => {
|
|
31
|
+
it('restores the canonical Kind when URL hydration only has the plural resource name', () => {
|
|
32
|
+
expect(
|
|
33
|
+
canonicalizeSelectedKind(
|
|
34
|
+
{ name: 'endpoints', kind: 'endpoints', group: '' },
|
|
35
|
+
[endpoints],
|
|
36
|
+
[endpoints]
|
|
37
|
+
)
|
|
38
|
+
).toEqual({ name: 'endpoints', kind: 'Endpoints', group: '' })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('leaves an already canonical selection alone', () => {
|
|
42
|
+
expect(
|
|
43
|
+
canonicalizeSelectedKind(
|
|
44
|
+
{ name: 'endpoints', kind: 'Endpoints', group: '' },
|
|
45
|
+
[endpoints],
|
|
46
|
+
[endpoints]
|
|
47
|
+
)
|
|
48
|
+
).toBeNull()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('resolves CRD deep links from Kind to plural resource name', () => {
|
|
52
|
+
expect(
|
|
53
|
+
canonicalizeSelectedKind(
|
|
54
|
+
{ name: 'HTTPRoute', kind: 'HTTPRoute', group: 'gateway.networking.k8s.io' },
|
|
55
|
+
[],
|
|
56
|
+
[httpRoute]
|
|
57
|
+
)
|
|
58
|
+
).toEqual({ name: 'httproutes', kind: 'HTTPRoute', group: 'gateway.networking.k8s.io' })
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('deriveSidebarResourceCounts', () => {
|
|
63
|
+
it('keeps recently loaded counts for resources omitted from resource-counts', () => {
|
|
64
|
+
const now = 10_000
|
|
65
|
+
|
|
66
|
+
expect(
|
|
67
|
+
deriveSidebarResourceCounts(
|
|
68
|
+
[endpoints],
|
|
69
|
+
{},
|
|
70
|
+
undefined,
|
|
71
|
+
{ Endpoints: { count: 132, expiresAt: now + LOADED_RESOURCE_COUNT_TTL_MS } },
|
|
72
|
+
now
|
|
73
|
+
)
|
|
74
|
+
).toEqual({ Endpoints: 132 })
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('expires loaded counts after the TTL', () => {
|
|
78
|
+
const now = 10_000
|
|
79
|
+
|
|
80
|
+
expect(
|
|
81
|
+
deriveSidebarResourceCounts(
|
|
82
|
+
[endpoints],
|
|
83
|
+
{},
|
|
84
|
+
undefined,
|
|
85
|
+
{ Endpoints: { count: 132, expiresAt: now } },
|
|
86
|
+
now
|
|
87
|
+
)
|
|
88
|
+
).toEqual({ Endpoints: null })
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('prefers authoritative resource-counts over cached loaded counts', () => {
|
|
92
|
+
const now = 10_000
|
|
93
|
+
|
|
94
|
+
expect(
|
|
95
|
+
deriveSidebarResourceCounts(
|
|
96
|
+
[endpoints],
|
|
97
|
+
{ Endpoints: 7 },
|
|
98
|
+
undefined,
|
|
99
|
+
{ Endpoints: { count: 132, expiresAt: now + LOADED_RESOURCE_COUNT_TTL_MS } },
|
|
100
|
+
now
|
|
101
|
+
)
|
|
102
|
+
).toEqual({ Endpoints: 7 })
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('lets a fresh loaded count override an unavailable count marker', () => {
|
|
106
|
+
const now = 10_000
|
|
107
|
+
|
|
108
|
+
expect(
|
|
109
|
+
deriveSidebarResourceCounts(
|
|
110
|
+
[endpoints],
|
|
111
|
+
{},
|
|
112
|
+
['Endpoints'],
|
|
113
|
+
{ Endpoints: { count: 132, expiresAt: now + LOADED_RESOURCE_COUNT_TTL_MS } },
|
|
114
|
+
now
|
|
115
|
+
)
|
|
116
|
+
).toEqual({ Endpoints: 132 })
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
describe('resourceQueryMatchesSelectedKind', () => {
|
|
121
|
+
it('accepts untagged legacy query results', () => {
|
|
122
|
+
expect(resourceQueryMatchesSelectedKind(undefined, { name: 'endpoints', kind: 'Endpoints', group: '' })).toBe(true)
|
|
123
|
+
expect(resourceQueryMatchesSelectedKind({}, { name: 'endpoints', kind: 'Endpoints', group: '' })).toBe(true)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('rejects stale selected-kind query results from the previous kind', () => {
|
|
127
|
+
expect(
|
|
128
|
+
resourceQueryMatchesSelectedKind(
|
|
129
|
+
{ resourceName: 'pods', group: '' },
|
|
130
|
+
{ name: 'endpoints', kind: 'Endpoints', group: '' }
|
|
131
|
+
)
|
|
132
|
+
).toBe(false)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('matches grouped built-in resources by plural name and group', () => {
|
|
136
|
+
expect(
|
|
137
|
+
resourceQueryMatchesSelectedKind(
|
|
138
|
+
{ resourceName: 'endpointslices', group: 'discovery.k8s.io' },
|
|
139
|
+
{ name: 'endpointslices', kind: 'EndpointSlice', group: 'discovery.k8s.io' }
|
|
140
|
+
)
|
|
141
|
+
).toBe(true)
|
|
142
|
+
})
|
|
143
|
+
})
|