@skyhook-io/radar-app 1.21.7 → 1.21.8

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/README.md CHANGED
@@ -10,7 +10,7 @@ This package is source-only — it ships TypeScript + TSX files under `src/`. Co
10
10
  npm install @skyhook-io/radar-app
11
11
  ```
12
12
 
13
- Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.21.7`, plus `clsx`, `tailwind-merge`, `lucide-react`, `@xyflow/react`, `elkjs`.
13
+ Peer deps: `react >=19`, `react-dom >=19`, `react-router-dom >=7`, `@tanstack/react-query >=5`, `@skyhook-io/k8s-ui >=1.21.8`, plus `clsx`, `tailwind-merge`, `lucide-react`, `@xyflow/react`, `elkjs`.
14
14
 
15
15
  ## Use
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyhook-io/radar-app",
3
- "version": "1.21.7",
3
+ "version": "1.21.8",
4
4
  "description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  "yaml": "^2.9.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@skyhook-io/k8s-ui": ">=1.21.7",
46
+ "@skyhook-io/k8s-ui": ">=1.21.9",
47
47
  "@tanstack/react-query": ">=5",
48
48
  "@xyflow/react": ">=12.0.0",
49
49
  "clsx": ">=2",
package/src/App.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useState, useEffect, useLayoutEffect, useCallback, useMemo, useRef } from 'react'
2
2
  import { flushSync } from 'react-dom'
3
- import { isRightsizingScanPath } from './utils/page-links'
3
+ import { isRightsizingScanPath, useClearLinkedIssue } from './utils/page-links'
4
4
  import { startViewTransitionSafe } from '@skyhook-io/k8s-ui/utils/view-transition'
5
5
  import { englishPlural } from '@skyhook-io/k8s-ui/utils/pluralize'
6
6
  import { useQueryClient } from '@tanstack/react-query'
@@ -367,6 +367,7 @@ interface AppProps {
367
367
  function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterLoadStateChange }: AppProps) {
368
368
  useLayoutEffect(() => () => resetNavigationMap(), [])
369
369
  const navigate = useNavigate()
370
+ const clearLinkedIssue = useClearLinkedIssue()
370
371
  const location = useLocation()
371
372
  const navigationType = useNavigationType()
372
373
  const [searchParams, setSearchParams] = useSearchParams()
@@ -1923,7 +1924,9 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1923
1924
  scroll sideways at desktop width instead (see PHONE_READY_VIEWS). */}
1924
1925
  <div
1925
1926
  className={`relative flex bg-theme-base ${navCustomization.embedded ? 'h-full min-h-0' : 'h-screen'}`}
1926
- style={{ minWidth: (isMobile ? 360 : 800) + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
1927
+ style={{ minWidth: isMobile && mainView === 'issues'
1928
+ ? 0 // Issue rows adapt to the space beside the rail, even on a 360px phone.
1929
+ : (isMobile ? 360 : 800) + (showNavRail ? (navRailEffectivePinned ? 176 : 56) : 0) }}
1927
1930
  >
1928
1931
  {showNavRail && (
1929
1932
  <PrimaryNavRail
@@ -1964,6 +1967,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
1964
1967
  variant="segment"
1965
1968
  disabled={namespaceFilter.disabled}
1966
1969
  disabledTooltip={namespaceFilter.tooltip}
1970
+ onApply={mainView === 'issues' ? clearLinkedIssue : undefined}
1967
1971
  />
1968
1972
  </ScopePill>
1969
1973
  {/* Connection status — a fixed-size dot (state in the tooltip), an
@@ -2037,7 +2041,11 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2037
2041
  navigate({ pathname: `/resources/${kind}`, search: params.toString() })
2038
2042
  }}
2039
2043
  onSwitchContext={commandSwitch.requestSwitch}
2040
- onSetNamespaces={(ns) => { setNamespaces(ns); setActiveNamespace.mutate({ namespaces: ns }) }}
2044
+ onSetNamespaces={(ns) => {
2045
+ if (mainView === 'issues') clearLinkedIssue()
2046
+ setNamespaces(ns)
2047
+ setActiveNamespace.mutate({ namespaces: ns })
2048
+ }}
2041
2049
  onToggleTheme={toggleTheme}
2042
2050
  onShowDiagnostics={() => setShowDiagnostics(true)}
2043
2051
  onShowWhatsNew={whatsNewStatus.available ? openWhatsNew : undefined}
@@ -2221,6 +2229,7 @@ function AppInner({ manageDocumentTitle = false, documentTitleSuffix, onClusterL
2221
2229
  topology={topology}
2222
2230
  fallbackClusterLoadState={showHomeClusterLoadFallback ? clusterLoadState : undefined}
2223
2231
  onNavigateToView={setMainView}
2232
+ onNavigateToIssue={takeover.issues ? undefined : (id) => setMainView('issues', { issue: id })}
2224
2233
  onNavigateToHelmRelease={navCustomization.embedded ? undefined : navigateToHelmRelease}
2225
2234
  onNavigateToManagerPath={navCustomization.embedded || takeover.gitops ? undefined : navigateToPath}
2226
2235
  // Upgrade impact lives under /checks, which a Cloud host takes
package/src/api/client.ts CHANGED
@@ -859,7 +859,8 @@ export interface IssuesResponse {
859
859
  recent_changes_guidance?: string
860
860
  recent_changes_truncated?: boolean
861
861
  // Present when the recent-changes window starts before the history Radar
862
- // holds; complete_since is sent only to callers who can read every namespace.
862
+ // holds; when events were evicted, complete_since is sent only to callers
863
+ // who can read every namespace.
863
864
  recent_changes_history_coverage?: {
864
865
  incomplete: boolean
865
866
  complete_since?: string
@@ -2877,6 +2878,12 @@ export function useTopology(
2877
2878
  });
2878
2879
  }
2879
2880
 
2881
+ interface ApplicationsResponse {
2882
+ applications: AppRow[];
2883
+ /** Absent when Radar could not establish inventory coverage. */
2884
+ access?: { restricted: boolean };
2885
+ }
2886
+
2880
2887
  export function useApplications(
2881
2888
  namespaces: string[],
2882
2889
  options?: { enabled?: boolean },
@@ -2887,11 +2894,11 @@ export function useApplications(
2887
2894
 
2888
2895
  const enabled = options?.enabled !== false;
2889
2896
  const { guard, gatedKey } = useRadarFeature("applications");
2890
- return useQuery<{ applications: AppRow[] }>({
2897
+ return useQuery<ApplicationsResponse>({
2891
2898
  queryKey: ["applications", namespaces, ...gatedKey],
2892
2899
  queryFn: () =>
2893
2900
  guard(() =>
2894
- fetchJSON<{ applications: AppRow[] }>(
2901
+ fetchJSON<ApplicationsResponse>(
2895
2902
  `/applications${queryString ? `?${queryString}` : ""}`,
2896
2903
  ),
2897
2904
  ),
@@ -10,6 +10,7 @@ interface NamespaceSwitcherProps {
10
10
  className?: string
11
11
  disabled?: boolean
12
12
  disabledTooltip?: string
13
+ onApply?: () => void
13
14
  variant?: 'chip' | 'segment'
14
15
  label?: string
15
16
  }
@@ -20,7 +21,7 @@ interface NamespaceSwitcherProps {
20
21
  * hooks; Radar Hub supplies its own container over the per-cluster apiBase.
21
22
  */
22
23
  export const NamespaceSwitcher = forwardRef<NamespaceSwitcherHandle, NamespaceSwitcherProps>(function NamespaceSwitcher(
23
- { className, disabled, disabledTooltip, variant, label },
24
+ { className, disabled, disabledTooltip, onApply, variant, label },
24
25
  ref,
25
26
  ) {
26
27
  const { data: scope, isLoading } = useNamespaceScope()
@@ -47,7 +48,10 @@ export const NamespaceSwitcher = forwardRef<NamespaceSwitcherHandle, NamespaceSw
47
48
  scope={scope}
48
49
  loading={isLoading}
49
50
  pending={setActive.isPending}
50
- onApply={namespaces => setActive.mutate({ namespaces })}
51
+ onApply={namespaces => {
52
+ onApply?.()
53
+ setActive.mutate({ namespaces })
54
+ }}
51
55
  disabled={disabled}
52
56
  disabledTooltip={disabledTooltip}
53
57
  className={className}
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest'
2
2
 
3
- import type { AppWorkload, Issue } from '@skyhook-io/k8s-ui'
4
- import { appIssuesForWorkloads } from './ApplicationsView'
3
+ import type { AppRow, AppWorkload, Issue } from '@skyhook-io/k8s-ui'
4
+ import { appIssuesForApplication } from './ApplicationsView'
5
5
 
6
6
  function workload(group: string): AppWorkload {
7
7
  return { kind: 'Job', group, namespace: 'ml', name: 'train', health: 'healthy', ready: 1, desired: 1, restarts: 0 }
@@ -24,16 +24,44 @@ function issue(id: string, group?: string): Issue {
24
24
  }
25
25
  }
26
26
 
27
- describe('appIssuesForWorkloads identity', () => {
27
+ function application(key: string, workloads: AppWorkload[]): AppRow {
28
+ return { key, name: key, workloads } as AppRow
29
+ }
30
+
31
+ describe('application issue membership', () => {
28
32
  it('does not share an issue between same-named core and Volcano Jobs', () => {
29
33
  const issues = [issue('core', 'batch'), issue('volcano', 'batch.volcano.sh')]
34
+ const core = application('core', [workload('batch')])
35
+ const volcano = application('volcano', [workload('batch.volcano.sh')])
30
36
 
31
- expect(appIssuesForWorkloads(issues, [workload('batch')]).map(item => item.id)).toEqual(['core'])
32
- expect(appIssuesForWorkloads(issues, [workload('batch.volcano.sh')]).map(item => item.id)).toEqual(['volcano'])
37
+ expect(appIssuesForApplication(issues, core, [core, volcano], true).map(item => item.id)).toEqual(['core'])
38
+ expect(appIssuesForApplication(issues, volcano, [core, volcano], true).map(item => item.id)).toEqual(['volcano'])
33
39
  })
34
40
 
35
41
  it('treats an omitted built-in group as the canonical built-in identity', () => {
36
- expect(appIssuesForWorkloads([issue('legacy')], [workload('batch')]).map(item => item.id)).toEqual(['legacy'])
37
- expect(appIssuesForWorkloads([issue('legacy')], [workload('batch.volcano.sh')])).toEqual([])
42
+ const core = application('core', [workload('batch')])
43
+ const volcano = application('volcano', [workload('batch.volcano.sh')])
44
+
45
+ expect(appIssuesForApplication([issue('legacy')], core, [core, volcano], true).map(item => item.id)).toEqual(['legacy'])
46
+ expect(appIssuesForApplication([issue('legacy')], volcano, [core, volcano], true)).toEqual([])
47
+ })
48
+
49
+ it('includes an issue on an owned Service alongside affected workloads, without duplicates', () => {
50
+ const app = application('checkout', [workload('batch')])
51
+ const service = { kind: 'Service', group: '', namespace: 'ml', name: 'checkout' }
52
+ app.relationships = { serviceRefs: [service] }
53
+ const endpoints = { ...issue('no-endpoints'), ...service, grouping_scope: 'service' }
54
+ const running = issue('workload', 'batch')
55
+ const affected = { ...issue('affected'), kind: 'Pod', name: 'pod-123', owner: workload('batch') }
56
+ const issues = [endpoints, running, running, affected]
57
+
58
+ expect(appIssuesForApplication(issues, app, [app], true).map(item => item.id))
59
+ .toEqual(['no-endpoints', 'workload', 'affected'])
60
+ expect(appIssuesForApplication(issues, app, [app], false).map(item => item.id))
61
+ .toEqual(['workload', 'affected'])
62
+
63
+ const other = { ...application('worker', []), relationships: { serviceRefs: [service] } }
64
+ expect(appIssuesForApplication(issues, app, [app, other], true).map(item => item.id))
65
+ .toEqual(['workload', 'affected'])
38
66
  })
39
67
  })
@@ -15,8 +15,8 @@ import {
15
15
  radarUpgradeDetail,
16
16
  radarUpgradeHeadline,
17
17
  FreshnessControl,
18
- IssueRow,
19
- ISSUE_SEVERITY_RANK,
18
+ IssuesView,
19
+ appRelationshipFields,
20
20
  useToast,
21
21
  orderEnvs,
22
22
  matchWorkloadAcrossInstances,
@@ -32,7 +32,6 @@ import {
32
32
  eventsForApplication,
33
33
  memberRef,
34
34
  subjectRef,
35
- compareIssueSortAnchors,
36
35
  canonicalResourceGroup,
37
36
  type AppRow,
38
37
  type AppWorkload,
@@ -45,6 +44,7 @@ import {
45
44
  type SelectedAppWorkload,
46
45
  type SelectedResource,
47
46
  } from "@skyhook-io/k8s-ui";
47
+ import { buildIssueAppIndex } from "@skyhook-io/k8s-ui/components/issues";
48
48
  import { AlertTriangle, Boxes } from "lucide-react";
49
49
  import { SEVERITY_TEXT } from "@skyhook-io/k8s-ui/utils/badge-colors";
50
50
  import {
@@ -156,6 +156,7 @@ export function ApplicationsView({
156
156
  <AppDetailRoute
157
157
  app={selected}
158
158
  apps={apps}
159
+ completeInventory={namespaces.length === 0 && query.data?.access?.restricted === false}
159
160
  onBack={() => selectApp(null)}
160
161
  onOpenResource={onOpenResource}
161
162
  />
@@ -226,11 +227,13 @@ export function ApplicationsView({
226
227
  function AppDetailRoute({
227
228
  app,
228
229
  apps,
230
+ completeInventory,
229
231
  onBack,
230
232
  onOpenResource,
231
233
  }: {
232
234
  app: AppRow;
233
235
  apps: AppRow[];
236
+ completeInventory: boolean;
234
237
  onBack: () => void;
235
238
  onOpenResource: (resource: SelectedResource) => void;
236
239
  }) {
@@ -257,14 +260,21 @@ function AppDetailRoute({
257
260
  refetchInterval: 10_000,
258
261
  },
259
262
  );
260
- const issuesQuery = useIssues(appNamespaces);
263
+ const issueNamespaces = useMemo(() => {
264
+ if (!completeInventory) return appNamespaces;
265
+ const namespaces = new Set(appNamespaces);
266
+ for (const [field] of appRelationshipFields) {
267
+ for (const ref of app.relationships?.[field] ?? []) {
268
+ if (ref.namespace && !ref.state) namespaces.add(ref.namespace);
269
+ }
270
+ }
271
+ return [...namespaces].sort();
272
+ }, [appNamespaces, app.relationships, completeInventory]);
273
+ const issuesQuery = useIssues(issueNamespaces);
274
+ const issueData = issuesQuery.data;
261
275
  const appIssues = useMemo(
262
- () =>
263
- appIssuesForWorkloads(
264
- issuesQuery.data?.issues ?? [],
265
- app.workloads ?? [],
266
- ),
267
- [issuesQuery.data?.issues, app.workloads],
276
+ () => appIssuesForApplication(issueData?.issues ?? [], app, apps, completeInventory),
277
+ [issueData?.issues, app, apps, completeInventory],
268
278
  );
269
279
 
270
280
  // The selected workload (?workload=<key>) is the scope switch and wins over
@@ -739,10 +749,13 @@ function AppDetailRoute({
739
749
  }
740
750
  renderOverviewIssues={() => (
741
751
  <AppOverviewIssues
752
+ key={app.key}
753
+ application={app}
742
754
  issues={appIssues}
743
755
  error={issuesQuery.error}
744
- hasData={Boolean(issuesQuery.data)}
745
- visibility={issuesQuery.data?.visibility}
756
+ hasData={Boolean(issueData)}
757
+ visibility={issueData?.visibility}
758
+ truncated={!!issueData && (issueData.total_matched ?? issueData.issues.length) > issueData.issues.length}
746
759
  onOpenResource={onOpenResource}
747
760
  />
748
761
  )}
@@ -787,28 +800,26 @@ function applicationHistoryRangeOptions(
787
800
  }
788
801
 
789
802
  function AppOverviewIssues({
803
+ application,
790
804
  issues,
791
805
  error,
792
806
  hasData,
793
807
  visibility,
808
+ truncated,
794
809
  onOpenResource,
795
810
  }: {
811
+ application: Pick<AppRow, "key" | "name">;
796
812
  issues: Issue[];
797
813
  error: unknown;
798
814
  hasData: boolean;
799
815
  visibility?: IssuesResponse["visibility"];
816
+ truncated: boolean;
800
817
  onOpenResource: (resource: SelectedResource) => void;
801
818
  }) {
802
- const [openId, setOpenId] = useState<string | null>(null);
803
- const sorted = useMemo(
804
- () => [...issues].sort(compareAppOverviewIssues),
805
- [issues],
806
- );
807
-
808
819
  if (error && !hasData) {
809
820
  return (
810
821
  <AppOverviewIssuesState
811
- headline="Operational issues unavailable"
822
+ headline="Issues unavailable"
812
823
  body={
813
824
  error instanceof Error
814
825
  ? error.message
@@ -818,57 +829,40 @@ function AppOverviewIssues({
818
829
  );
819
830
  }
820
831
 
821
- if (error) {
822
- return (
823
- <section className="space-y-2">
832
+ if (!error && !visibility?.impact && !truncated && issues.length === 0) return null;
833
+
834
+ const navigate = (ref: IssueResourceRef) => {
835
+ onOpenResource({
836
+ kind: kindToPluralWithGroup(ref.kind, ref.group ?? ""),
837
+ namespace: ref.namespace ?? "",
838
+ name: ref.name,
839
+ group: ref.group ?? "",
840
+ });
841
+ };
842
+
843
+ return (
844
+ <section className="space-y-2">
845
+ {error ? (
824
846
  <AppOverviewIssuesState
825
- headline="Operational issue refresh failed"
847
+ headline="Issue refresh failed"
826
848
  body="Showing the last successful result for this application."
827
849
  />
828
- {sorted.length > 0 && (
829
- <AppOverviewIssueRows
830
- issues={sorted}
831
- openId={openId}
832
- setOpenId={setOpenId}
833
- onOpenResource={onOpenResource}
834
- />
835
- )}
836
- </section>
837
- );
838
- }
839
-
840
- if (visibility?.impact) {
841
- return (
842
- <section className="space-y-2">
850
+ ) : visibility?.impact && (
843
851
  <AppOverviewIssuesState
844
- headline={
845
- sorted.length === 0
846
- ? "No visible operational issues"
847
- : "Operational issue visibility is limited"
848
- }
852
+ headline={issues.length ? "Issue visibility is limited" : "No visible issues"}
849
853
  body={`${visibility.impact} Results may be incomplete.`}
850
854
  />
851
- {sorted.length > 0 && (
852
- <AppOverviewIssueRows
853
- issues={sorted}
854
- openId={openId}
855
- setOpenId={setOpenId}
856
- onOpenResource={onOpenResource}
857
- />
858
- )}
859
- </section>
860
- );
861
- }
862
-
863
- if (sorted.length === 0) return null;
864
-
865
- return (
866
- <AppOverviewIssueRows
867
- issues={sorted}
868
- openId={openId}
869
- setOpenId={setOpenId}
870
- onOpenResource={onOpenResource}
871
- />
855
+ )}
856
+ {truncated && (
857
+ <AppOverviewIssuesState
858
+ headline="Issue results are incomplete"
859
+ body="Radar reached the issue limit for these namespaces. Some issues for this application may be missing."
860
+ />
861
+ )}
862
+ {issues.length > 0 && (
863
+ <IssuesView application={application} anyData issues={issues} onResourceClick={navigate} />
864
+ )}
865
+ </section>
872
866
  );
873
867
  }
874
868
 
@@ -897,90 +891,25 @@ function AppOverviewIssuesState({
897
891
  );
898
892
  }
899
893
 
900
- function AppOverviewIssueRows({
901
- issues: sorted,
902
- openId,
903
- setOpenId,
904
- onOpenResource,
905
- }: {
906
- issues: Issue[];
907
- openId: string | null;
908
- setOpenId: (value: string | null) => void;
909
- onOpenResource: (resource: SelectedResource) => void;
910
- }) {
911
- const navigate = (ref: IssueResourceRef) => {
912
- onOpenResource({
913
- kind: kindToPluralWithGroup(ref.kind, ref.group ?? ""),
914
- namespace: ref.namespace ?? "",
915
- name: ref.name,
916
- group: ref.group ?? "",
917
- });
918
- };
919
-
920
- return (
921
- <section className="space-y-2">
922
- <div className="flex items-center justify-between gap-3">
923
- <div className="flex min-w-0 items-center gap-2 text-sm font-semibold text-theme-text-primary">
924
- <AlertTriangle
925
- className="h-4 w-4 shrink-0 text-theme-text-secondary"
926
- aria-hidden
927
- />
928
- <span>Operational Issues</span>
929
- <span className="badge-sm text-[10px] text-theme-text-secondary">
930
- {sorted.length}
931
- </span>
932
- </div>
933
- <span className="text-xs text-theme-text-tertiary">
934
- Scoped to this application
935
- </span>
936
- </div>
937
- <ol className="flex flex-col gap-1.5">
938
- {sorted.slice(0, 4).map((issue) => {
939
- const rowKey = `${issue.cluster_id ?? ""}:${issue.id}`;
940
- return (
941
- <IssueRow
942
- key={rowKey}
943
- issue={issue}
944
- open={openId === rowKey}
945
- onToggle={() => setOpenId(openId === rowKey ? null : rowKey)}
946
- onResourceClick={navigate}
947
- />
948
- );
949
- })}
950
- </ol>
951
- {sorted.length > 4 ? (
952
- <div className="text-xs text-theme-text-tertiary">
953
- Showing 4 of {sorted.length} issues. Open Issues for the full queue.
954
- </div>
955
- ) : null}
956
- </section>
957
- );
958
- }
959
-
960
- function compareAppOverviewIssues(a: Issue, b: Issue): number {
961
- const severity =
962
- ISSUE_SEVERITY_RANK[b.severity] - ISSUE_SEVERITY_RANK[a.severity];
963
- if (severity !== 0) return severity;
964
- const onset = compareIssueSortAnchors(a, b);
965
- if (onset !== 0) return onset;
966
- const ns = (a.namespace ?? "").localeCompare(b.namespace ?? "");
967
- if (ns !== 0) return ns;
968
- const name = a.name.localeCompare(b.name);
969
- if (name !== 0) return name;
970
- return a.id.localeCompare(b.id);
971
- }
972
-
973
- export function appIssuesForWorkloads(
894
+ export function appIssuesForApplication(
974
895
  issues: Issue[],
975
- workloads: AppWorkload[],
896
+ app: Pick<AppRow, "key" | "workloads">,
897
+ inventory: AppRow[],
898
+ completeInventory: boolean,
976
899
  ): Issue[] {
977
- if (issues.length === 0 || workloads.length === 0) return [];
900
+ if (issues.length === 0) return [];
901
+ const ownerForIssue = buildIssueAppIndex(inventory, { complete: completeInventory });
902
+ const workloads = app.workloads;
978
903
  const workloadKeys = new Set(workloads.map(workloadIssueKey));
979
904
  const out: Issue[] = [];
980
905
  const seen = new Set<string>();
981
906
  for (const issue of issues) {
982
- if (!issueRefs(issue).some((ref) => workloadKeys.has(issueRefKey(ref))))
983
- continue;
907
+ // Diagnostic evidence can show that an issue affects this app even when
908
+ // the queue cannot attribute ownership to a single application.
909
+ if (
910
+ ownerForIssue(issue)?.key !== app.key &&
911
+ !issueRefs(issue).some((ref) => workloadKeys.has(issueRefKey(ref)))
912
+ ) continue;
984
913
  if (seen.has(issue.id)) continue;
985
914
  seen.add(issue.id);
986
915
  out.push(issue);
@@ -41,5 +41,8 @@ it('states that conditions have not been reported', () => {
41
41
  act(() => root.render(<CNPGOperatorConditions conditions={[]} />))
42
42
  expect(host.textContent).toContain('No conditions reported')
43
43
  expect(host.querySelector('button')!.getAttribute('aria-expanded')).toBe('false')
44
+ act(() => host.querySelector('button')!.click())
45
+ expect(host.textContent).toContain('The operator has not reported status.conditions.')
46
+ expect(host.querySelector('section')!.className.split(' ').sort()).toEqual('mx-4 mb-4 rounded-xl border border-theme-border bg-theme-surface px-4 py-3 shadow-theme-sm'.split(' ').sort())
44
47
  act(() => root.unmount())
45
48
  })
@@ -1,16 +1,6 @@
1
- import { Badge, FactGrid, FactRow, FoldSection, Tooltip, formatAge } from '@skyhook-io/k8s-ui'
1
+ import { WorkspaceConditions } from '../workspace/WorkspaceConditions'
2
+ import type { ComponentProps } from 'react'
2
3
 
3
- export function CNPGOperatorConditions({ conditions }: { conditions: { type: string; status: string; reason?: string; message?: string; lastTransitionTime?: string }[] }) {
4
- return (
5
- <section className="mx-4 mb-4 rounded-xl border border-theme-border bg-theme-surface px-4 py-3 shadow-theme-sm">
6
- <FoldSection title="Operator conditions" summary={conditions.length > 0 ? `${conditions.length} reported · status.conditions` : 'No conditions reported'} attention={false}>
7
- <FactGrid>{conditions.map((c) => <FactRow key={c.type} label={<span className="inline-flex flex-wrap items-center gap-2">{c.type}<Badge severity="neutral" size="sm">{c.status}</Badge></span>}>
8
- <div className="text-xs text-theme-text-secondary">Reason: {c.reason || 'Not reported'}</div>
9
- <div className="break-words text-xs text-theme-text-secondary">{c.message || 'No message reported'}</div>
10
- <div className="text-xs text-theme-text-tertiary">Last transition: {c.lastTransitionTime ? <Tooltip content={c.lastTransitionTime}><time dateTime={c.lastTransitionTime}>{formatAge(c.lastTransitionTime)} ago</time></Tooltip> : 'Not reported'}</div>
11
- </FactRow>)}</FactGrid>
12
- {conditions.length === 0 && <p className="text-sm text-theme-text-tertiary">The operator has not reported status.conditions.</p>}
13
- </FoldSection>
14
- </section>
15
- )
4
+ export function CNPGOperatorConditions(props: Pick<ComponentProps<typeof WorkspaceConditions>, 'conditions'>) {
5
+ return <WorkspaceConditions {...props} title="Operator conditions" className="mx-4 mb-4" emptyMessage="The operator has not reported status.conditions." />
16
6
  }
@@ -46,6 +46,7 @@ interface HomeViewProps {
46
46
  namespaces: string[]
47
47
  topology: Topology | null
48
48
  onNavigateToView: (view: ExtendedMainView, params?: Record<string, string>) => void
49
+ onNavigateToIssue?: (id: string) => void
49
50
  onNavigateToResourceKind: (kind: string, group?: string, filters?: Record<string, string[]>) => void
50
51
  onNavigateToResource: (resource: SelectedResource) => void
51
52
  fallbackClusterLoadState?: ClusterLoadState
@@ -62,7 +63,7 @@ interface HomeViewProps {
62
63
  onNavigateToManagerPath?: (path: string) => void
63
64
  }
64
65
 
65
- export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNavigateToView, onNavigateToResourceKind, onNavigateToResource, onNavigateToCerts, onNavigateToUpgradeImpact, onNavigateToHelmRelease, onNavigateToManagerPath }: HomeViewProps) {
66
+ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNavigateToView, onNavigateToIssue, onNavigateToResourceKind, onNavigateToResource, onNavigateToCerts, onNavigateToUpgradeImpact, onNavigateToHelmRelease, onNavigateToManagerPath }: HomeViewProps) {
66
67
  // The card itself decides whether the cluster has a capacity story
67
68
  // (available, softened-denied, or karpenterless-with-managers/groups) and
68
69
  // returns null otherwise — the outer gate only excludes states with nothing
@@ -290,6 +291,7 @@ export function HomeView({ namespaces, topology, fallbackClusterLoadState, onNav
290
291
  error={issuesError}
291
292
  totalReturned={issues.length}
292
293
  onNavigateToIssues={() => onNavigateToView('issues')}
294
+ onNavigateToIssue={onNavigateToIssue}
293
295
  onResourceClick={onNavigateToResource}
294
296
  />
295
297
  </div>
@@ -343,6 +345,7 @@ interface ProblemsPanelProps {
343
345
  error: unknown
344
346
  totalReturned: number
345
347
  onNavigateToIssues: () => void
348
+ onNavigateToIssue?: (id: string) => void
346
349
  onResourceClick: (resource: SelectedResource) => void
347
350
  }
348
351
 
@@ -358,6 +361,7 @@ export function ProblemsPanel({
358
361
  error,
359
362
  totalReturned,
360
363
  onNavigateToIssues,
364
+ onNavigateToIssue,
361
365
  onResourceClick,
362
366
  }: ProblemsPanelProps) {
363
367
  const unchecked = uncheckedLines.length > 0
@@ -475,6 +479,10 @@ export function ProblemsPanel({
475
479
  className="w-full flex items-center gap-2 px-3 py-1.5 group-hover:bg-theme-hover group-has-[:focus-visible]:bg-theme-hover transition-colors text-left"
476
480
  onClick={() => {
477
481
  recordUsageEvent({ type: 'ui', name: 'issue_action:open' })
482
+ if (onNavigateToIssue) {
483
+ onNavigateToIssue(issue.id)
484
+ return
485
+ }
478
486
  onResourceClick({
479
487
  kind: ref.kind,
480
488
  namespace: ref.namespace ?? '',
@@ -42,7 +42,7 @@ let root: Root
42
42
  let container: HTMLDivElement
43
43
  const onResourceClick = vi.fn()
44
44
 
45
- function render(rowIssue: Issue = issue) {
45
+ function render(rowIssue: Issue = issue, onNavigateToIssue?: (id: string) => void) {
46
46
  act(() => {
47
47
  root.render(
48
48
  <ProblemsPanel
@@ -55,6 +55,7 @@ function render(rowIssue: Issue = issue) {
55
55
  error={null}
56
56
  totalReturned={1}
57
57
  onNavigateToIssues={() => {}}
58
+ onNavigateToIssue={onNavigateToIssue}
58
59
  onResourceClick={onResourceClick}
59
60
  />,
60
61
  )
@@ -89,7 +90,16 @@ describe('Home Active Issues Investigate action', () => {
89
90
  expect(onResourceClick).not.toHaveBeenCalled()
90
91
  })
91
92
 
92
- it('still opens the resource from the rest of the row', () => {
93
+ it('opens the issue from the row when the Issues page handles links', () => {
94
+ const onNavigateToIssue = vi.fn()
95
+ render(issue, onNavigateToIssue)
96
+ const row = buttons().find((b) => b.textContent?.includes('checkout'))
97
+ act(() => row!.click())
98
+ expect(onNavigateToIssue).toHaveBeenCalledWith(issue.id)
99
+ expect(onResourceClick).not.toHaveBeenCalled()
100
+ })
101
+
102
+ it('still opens the resource from the row when the host takes over Issues', () => {
93
103
  render()
94
104
  const row = buttons().find((b) => b.textContent?.includes('checkout'))
95
105
  act(() => row!.click())