@skyhook-io/k8s-ui 1.7.14 → 1.8.0

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.
Files changed (48) hide show
  1. package/package.json +7 -7
  2. package/src/components/applications/ApplicationsList.tsx +131 -115
  3. package/src/components/applications/index.ts +3 -1
  4. package/src/components/audit/AuditCard.tsx +1 -1
  5. package/src/components/charts/AreaChart.tsx +52 -18
  6. package/src/components/charts/MetricsSummary.tsx +12 -3
  7. package/src/components/charts/saturation.test.ts +34 -0
  8. package/src/components/charts/saturation.ts +1 -0
  9. package/src/components/charts/types.ts +5 -4
  10. package/src/components/checks/ChecksView.tsx +12 -23
  11. package/src/components/checks/severity.ts +11 -11
  12. package/src/components/gitops/GitOpsTableView.tsx +298 -274
  13. package/src/components/issues/IssuesView.tsx +4 -6
  14. package/src/components/issues/severity.ts +19 -11
  15. package/src/components/issues/types.ts +22 -2
  16. package/src/components/logs/WorkloadLogsViewer.tsx +16 -7
  17. package/src/components/resources/ResourcesSidebar.tsx +3 -1
  18. package/src/components/resources/ResourcesView.tsx +180 -21
  19. package/src/components/resources/get-pod-problems.test.ts +127 -0
  20. package/src/components/resources/index.ts +1 -0
  21. package/src/components/resources/renderers/HPARenderer.test.tsx +91 -0
  22. package/src/components/resources/renderers/HPARenderer.tsx +93 -86
  23. package/src/components/resources/renderers/PodRenderer.test.tsx +56 -0
  24. package/src/components/resources/renderers/PodRenderer.tsx +1 -1
  25. package/src/components/resources/renderers/WorkloadRenderer.test.tsx +83 -0
  26. package/src/components/resources/renderers/WorkloadRenderer.tsx +73 -4
  27. package/src/components/resources/resource-utils-hpa.test.ts +30 -0
  28. package/src/components/resources/resource-utils-hpa.ts +106 -0
  29. package/src/components/resources/resource-utils.ts +41 -28
  30. package/src/components/shared/ResourceRendererDispatch.tsx +10 -2
  31. package/src/components/ui/DistributionBar.tsx +88 -0
  32. package/src/components/ui/Facet.tsx +130 -0
  33. package/src/components/ui/PageHeader.tsx +43 -0
  34. package/src/components/ui/SearchPillInput.tsx +237 -0
  35. package/src/components/ui/SortableTh.tsx +58 -0
  36. package/src/components/ui/SummaryTile.tsx +60 -0
  37. package/src/components/ui/drawer-components.tsx +56 -17
  38. package/src/components/ui/index.ts +12 -0
  39. package/src/components/workload/WorkloadView.tsx +18 -1
  40. package/src/theme/tailwind-theme.css +1 -0
  41. package/src/theme/variables.css +7 -3
  42. package/src/types/core.ts +64 -2
  43. package/src/utils/bulk-workload-actions.test.ts +78 -0
  44. package/src/utils/bulk-workload-actions.ts +50 -0
  45. package/src/utils/index.ts +1 -0
  46. package/src/utils/rbac-blast-radius.test.ts +48 -3
  47. package/src/utils/rbac-blast-radius.ts +14 -4
  48. package/tsconfig.json +1 -0
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
2
2
  import { createPortal } from 'react-dom'
3
3
  import { ChevronDown, ChevronRight, ExternalLink, EyeOff, MoreHorizontal, Search, ShieldCheck, Wrench, X } from 'lucide-react'
4
- import { ClusterName, EmptyState, FilterPill } from '../ui'
4
+ import { ClusterName, EmptyState, FilterPill, DistributionBar, DistributionLegendChip } from '../ui'
5
5
  import type { CheckMeta, CheckReference } from '../audit'
6
6
  import { CHECK_SEVERITIES, CHECK_SEVERITY_RANK, type Check, type CheckSeverity, type EffectiveCheckFinding, type CheckResourceRef } from './types'
7
7
  import {
@@ -367,35 +367,24 @@ export function ChecksView({ checks, catalog, anyData, resourceHref, onResourceC
367
367
  }
368
368
 
369
369
  export function CheckSeverityBar({ totals }: { totals: Record<CheckSeverity, number> }) {
370
- const sum = CHECK_SEVERITIES.reduce((n, s) => n + totals[s], 0)
371
370
  return (
372
- <div className="flex h-1.5 overflow-hidden rounded-full bg-theme-elevated" role="img" aria-label="Severity distribution">
373
- {sum === 0
374
- ? null
375
- : CHECK_SEVERITIES.map((s) =>
376
- totals[s] > 0 ? (
377
- <div key={s} className={`${SEVERITY_FILL_CLASS[s]} transition-[width] duration-500 ease-out`} style={{ width: `${(totals[s] / sum) * 100}%` }} />
378
- ) : null,
379
- )}
380
- </div>
371
+ <DistributionBar
372
+ ariaLabel="Severity distribution"
373
+ segments={CHECK_SEVERITIES.map((s) => ({ key: s, count: totals[s], fillClass: SEVERITY_FILL_CLASS[s] }))}
374
+ />
381
375
  )
382
376
  }
383
377
 
384
378
  export function CheckSeverityChip({ severity, count, active, onClick }: { severity: CheckSeverity; count: number; active: boolean; onClick: () => void }) {
385
379
  return (
386
- <button
387
- type="button"
380
+ <DistributionLegendChip
381
+ label={SEVERITY_LABEL[severity]}
382
+ count={count}
383
+ fillClass={SEVERITY_FILL_CLASS[severity]}
384
+ textClass={SEVERITY_TEXT_CLASS[severity]}
385
+ active={active}
388
386
  onClick={onClick}
389
- aria-pressed={active}
390
- className={[
391
- 'group inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs transition-colors',
392
- active ? 'border-theme-border bg-theme-elevated text-theme-text-primary' : 'border-transparent text-theme-text-secondary hover:bg-theme-hover/60',
393
- ].join(' ')}
394
- >
395
- <span className={`h-2 w-2 rounded-full ${SEVERITY_FILL_CLASS[severity]} ${count === 0 ? 'opacity-30' : ''}`} />
396
- <span className={`font-semibold tabular-nums ${count > 0 ? SEVERITY_TEXT_CLASS[severity] : 'text-theme-text-tertiary'}`}>{count}</span>
397
- <span>{SEVERITY_LABEL[severity]}</span>
398
- </button>
387
+ />
399
388
  )
400
389
  }
401
390
 
@@ -1,12 +1,9 @@
1
1
  import type { CheckSeverity } from './types'
2
+ import { BADGE_SEVERITY_COLORS as sev } from '../ui/Badge'
2
3
 
3
- // The visual language for the 4-tier Checks severity ladder. Pale-pastel tints
4
- // with hand-rolled dark variants (no theme token covers these). One hue per
5
- // tier: red=critical, orange=high, amber=medium, slate=low read the queue's
6
- // left rail top-to-bottom and severity is obvious without reading a word.
7
- //
8
- // Class strings are literal so each consuming app's Tailwind @source scan emits
9
- // them.
4
+ // The visual language for the 4-tier Checks severity ladder. One hue per tier:
5
+ // red=critical, orange=high, amber=medium, neutral=low read the queue's left
6
+ // rail top-to-bottom and severity is obvious without reading a word.
10
7
 
11
8
  export const SEVERITY_LABEL: Record<CheckSeverity, string> = {
12
9
  critical: 'Critical',
@@ -16,11 +13,14 @@ export const SEVERITY_LABEL: Record<CheckSeverity, string> = {
16
13
  }
17
14
 
18
15
  // Pill badge — the loud, explicit severity signal on rows + drawer header.
16
+ // Uses the canonical Badge severity tones (BADGE_SEVERITY_COLORS) so the queue's
17
+ // severity pills read identically to status badges everywhere else (rendered
18
+ // with `badge-sm`).
19
19
  export const SEVERITY_BADGE_CLASS: Record<CheckSeverity, string> = {
20
- critical: 'bg-red-50 text-red-700 ring-1 ring-red-200 dark:bg-red-950/50 dark:text-red-300 dark:ring-red-900',
21
- high: 'bg-orange-50 text-orange-700 ring-1 ring-orange-200 dark:bg-orange-950/50 dark:text-orange-300 dark:ring-orange-900',
22
- medium: 'bg-amber-50 text-amber-700 ring-1 ring-amber-200 dark:bg-amber-950/50 dark:text-amber-300 dark:ring-amber-900',
23
- low: 'bg-slate-100 text-slate-600 ring-1 ring-slate-200 dark:bg-slate-800/60 dark:text-slate-300 dark:ring-slate-700',
20
+ critical: sev.error,
21
+ high: sev.alert,
22
+ medium: sev.warning,
23
+ low: sev.neutral,
24
24
  }
25
25
 
26
26
  // Solid fill — dots + the proportional distribution bar segments.