@skyhook-io/radar-app 1.23.0 → 1.23.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 +14 -3
- package/src/api/client.ts +29 -3
- package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
- package/src/api/poll.ts +78 -0
- package/src/api/radarFeatures.ts +3 -0
- package/src/components/CloudFunnelButton.tsx +1 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
- package/src/components/helm/HelmView.tsx +4 -3
- package/src/components/helm/ObservedHelmNotice.tsx +39 -17
- package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
- package/src/components/issues/uncheckedSources.test.ts +8 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/nudges/activeNudges.test.ts +39 -0
- package/src/components/nudges/activeNudges.ts +76 -0
- package/src/components/poll/OssPoll.tsx +871 -0
- package/src/components/poll/mount.test.ts +12 -0
- package/src/components/poll/pollCloud.test.ts +23 -0
- package/src/components/poll/pollCloud.ts +6 -0
- package/src/components/poll/pollDefinition.ts +93 -0
- package/src/components/poll/pollFlow.test.ts +140 -0
- package/src/components/poll/pollFlow.ts +137 -0
- package/src/components/poll/pollSender.test.ts +137 -0
- package/src/components/poll/pollSender.ts +76 -0
- package/src/components/poll/pollStorage.test.ts +53 -0
- package/src/components/poll/pollStorage.ts +77 -0
- package/src/components/poll/round.json +350 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
- package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
- package/src/components/resources/ImageFilesystemModal.tsx +42 -3
- package/src/components/resources/ResourcesView.tsx +22 -5
- package/src/components/ui/UpdateNotification.tsx +2 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
- package/src/components/whats-new/WhatsNew.tsx +2 -0
- package/src/components/whats-new/releaseNotes.ts +75 -1
|
@@ -38,6 +38,8 @@ const stampedFact = (value: string | undefined, label: string, whenMissing: stri
|
|
|
38
38
|
|
|
39
39
|
interface ObservedHelmReleaseDrawerProps {
|
|
40
40
|
release: SelectedHelmRelease
|
|
41
|
+
/** Helm's storage went unread because Radar's Secret collection is off, not the caller's access. */
|
|
42
|
+
notCollected?: boolean
|
|
41
43
|
onClose: () => void
|
|
42
44
|
onNavigateToResource?: NavigateToResource
|
|
43
45
|
}
|
|
@@ -47,7 +49,7 @@ interface ObservedHelmReleaseDrawerProps {
|
|
|
47
49
|
* Helm's storage. It issues no read of Helm's release routes, and what only
|
|
48
50
|
* those routes know stays visibly unknown.
|
|
49
51
|
*/
|
|
50
|
-
export function ObservedHelmReleaseDrawer({ release, onClose, onNavigateToResource }: ObservedHelmReleaseDrawerProps) {
|
|
52
|
+
export function ObservedHelmReleaseDrawer({ release, notCollected, onClose, onNavigateToResource }: ObservedHelmReleaseDrawerProps) {
|
|
51
53
|
const navigate = useNavigate()
|
|
52
54
|
const [activeTab, setActiveTab] = useState<TabId>('overview')
|
|
53
55
|
const { data, isLoading, error, refetch: refetchRelease } = useObservedHelmRelease(release.namespace, release.name)
|
|
@@ -131,7 +133,7 @@ export function ObservedHelmReleaseDrawer({ release, onClose, onNavigateToResour
|
|
|
131
133
|
</div>
|
|
132
134
|
|
|
133
135
|
<div className="flex-1 overflow-y-auto">
|
|
134
|
-
<ObservedHelmDrawerNote coverage={data?.objectCoverage} refreshFailed={Boolean(data && error && !isStableClientError(error))} />
|
|
136
|
+
<ObservedHelmDrawerNote coverage={data?.objectCoverage} notCollected={notCollected} refreshFailed={Boolean(data && error && !isStableClientError(error))} />
|
|
135
137
|
{!data || isStableClientError(error) ? (
|
|
136
138
|
<FetchResult loading={isLoading} error={error} notFoundMessage="No release found on the objects you can read" className="h-32" />
|
|
137
139
|
) : shownTab === 'overview' ? (
|
|
@@ -34,6 +34,14 @@ describe('uncheckedSourceLines', () => {
|
|
|
34
34
|
.toEqual(["Helm releases couldn't be checked because Radar's service account isn't allowed to impersonate users, so failed or stuck releases may be missing."])
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
it('says Secret collection is off by policy, not that someone lacks access', () => {
|
|
38
|
+
const lines = uncheckedSourceLines([{ source: 'helm', reason: 'collection_disabled_by_policy' }])
|
|
39
|
+
expect(lines).toEqual([
|
|
40
|
+
"Helm releases weren't checked because Secrets aren't collected on this cluster (rbac.secretAccess: none), so failed or stuck releases may be missing.",
|
|
41
|
+
])
|
|
42
|
+
expect(uncheckedSourceLines([{ source: 'helm', reason: 'caller_access_denied' }])[0]).not.toContain("aren't collected")
|
|
43
|
+
})
|
|
44
|
+
|
|
37
45
|
it('says a Kueue queue check was skipped because the caller cannot read ClusterQueues', () => {
|
|
38
46
|
expect(uncheckedSourceLines([{
|
|
39
47
|
source: 'kueue', reason: 'caller_access_denied', kinds: [{ group: 'kueue.x-k8s.io', kind: 'ClusterQueue' }],
|
|
@@ -34,6 +34,9 @@ function helmLine({ reason, namespaces }: UncheckedSource): string {
|
|
|
34
34
|
if (reason === "collector_access_denied") {
|
|
35
35
|
return `Helm releases ${where}couldn't be checked because Radar's service account isn't allowed to impersonate users, so ${missing}.`;
|
|
36
36
|
}
|
|
37
|
+
if (reason === "collection_disabled_by_policy") {
|
|
38
|
+
return `Helm releases ${where}weren't checked because Secrets aren't collected on this cluster (rbac.secretAccess: none), so ${missing}.`;
|
|
39
|
+
}
|
|
37
40
|
if (reason === "caller_access_denied") {
|
|
38
41
|
return `Radar can't read Helm's release Secrets ${where ? where.trim() : "here"}, so ${missing}.`;
|
|
39
42
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { otherNudgeSeenThisLoad, otherNudgeVisible, releaseNudge, resetNudgesForTest, retainNudge } from './activeNudges'
|
|
3
|
+
|
|
4
|
+
afterEach(resetNudgesForTest)
|
|
5
|
+
|
|
6
|
+
describe('active nudges', () => {
|
|
7
|
+
it('reports other nudges but not the caller', () => {
|
|
8
|
+
retainNudge('oss-poll')
|
|
9
|
+
expect(otherNudgeVisible('oss-poll')).toBe(false)
|
|
10
|
+
retainNudge('update-notice')
|
|
11
|
+
expect(otherNudgeVisible('oss-poll')).toBe(true)
|
|
12
|
+
releaseNudge('update-notice')
|
|
13
|
+
expect(otherNudgeVisible('oss-poll')).toBe(false)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('remembers any other nudge shown this load, after it closes', () => {
|
|
17
|
+
retainNudge('oss-poll')
|
|
18
|
+
expect(otherNudgeSeenThisLoad('oss-poll')).toBe(false)
|
|
19
|
+
retainNudge('whats-new')
|
|
20
|
+
releaseNudge('whats-new')
|
|
21
|
+
expect(otherNudgeVisible('oss-poll')).toBe(false)
|
|
22
|
+
expect(otherNudgeSeenThisLoad('oss-poll')).toBe(true)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('keeps a nudge mounted in two places visible until both hide', () => {
|
|
26
|
+
retainNudge('update-notice')
|
|
27
|
+
retainNudge('update-notice')
|
|
28
|
+
releaseNudge('update-notice')
|
|
29
|
+
expect(otherNudgeVisible('oss-poll')).toBe(true)
|
|
30
|
+
releaseNudge('update-notice')
|
|
31
|
+
expect(otherNudgeVisible('oss-poll')).toBe(false)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('ignores a release with nothing retained', () => {
|
|
35
|
+
releaseNudge('usage-prompt')
|
|
36
|
+
expect(otherNudgeVisible('oss-poll')).toBe(false)
|
|
37
|
+
expect(otherNudgeSeenThisLoad('oss-poll')).toBe(false)
|
|
38
|
+
})
|
|
39
|
+
})
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useEffect, useSyncExternalStore } from 'react'
|
|
2
|
+
|
|
3
|
+
// Nudges (the star callout, the update notice, the usage-stats card, the
|
|
4
|
+
// Product Hunt card, What's New and the poll) each mark
|
|
5
|
+
// themselves visible here. Low-priority nudges read it and stay away while
|
|
6
|
+
// anything else is showing, so a person never gets two asks at once.
|
|
7
|
+
// Counted per id: one nudge can be mounted in two places (the update notice
|
|
8
|
+
// floats in the corner and sits in Settings), and one instance hiding must not
|
|
9
|
+
// clear the other.
|
|
10
|
+
const active = new Map<string, number>()
|
|
11
|
+
// Nudges seen since this page loaded, visible or not now. A low-priority nudge
|
|
12
|
+
// stays away for the rest of a load in which another one appeared.
|
|
13
|
+
const seenThisLoad = new Set<string>()
|
|
14
|
+
const listeners = new Set<() => void>()
|
|
15
|
+
let version = 0
|
|
16
|
+
|
|
17
|
+
function emit() {
|
|
18
|
+
version++
|
|
19
|
+
listeners.forEach((l) => l())
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function subscribe(listener: () => void) {
|
|
23
|
+
listeners.add(listener)
|
|
24
|
+
return () => {
|
|
25
|
+
listeners.delete(listener)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Marks one instance of a nudge visible. Pair every call with releaseNudge. */
|
|
30
|
+
export function retainNudge(id: string) {
|
|
31
|
+
seenThisLoad.add(id)
|
|
32
|
+
const count = active.get(id) ?? 0
|
|
33
|
+
active.set(id, count + 1)
|
|
34
|
+
if (count === 0) emit()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Marks one instance of a nudge hidden again. */
|
|
38
|
+
export function releaseNudge(id: string) {
|
|
39
|
+
const count = active.get(id) ?? 0
|
|
40
|
+
if (count <= 1) {
|
|
41
|
+
if (active.delete(id)) emit()
|
|
42
|
+
} else active.set(id, count - 1)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Marks a nudge visible while `visible` is true, and clears it on unmount. */
|
|
46
|
+
export function useNudgeVisible(id: string, visible: boolean) {
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!visible) return
|
|
49
|
+
retainNudge(id)
|
|
50
|
+
return () => releaseNudge(id)
|
|
51
|
+
}, [id, visible])
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** True when any nudge other than `self` is showing. */
|
|
55
|
+
export function otherNudgeVisible(self?: string): boolean {
|
|
56
|
+
for (const id of active.keys()) if (id !== self) return true
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function useOtherNudgeVisible(self?: string): boolean {
|
|
61
|
+
useSyncExternalStore(subscribe, () => version)
|
|
62
|
+
return otherNudgeVisible(self)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** True when a nudge other than `self` has shown since this page loaded. */
|
|
66
|
+
export function otherNudgeSeenThisLoad(self?: string): boolean {
|
|
67
|
+
for (const id of seenThisLoad) if (id !== self) return true
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Test-only reset. */
|
|
72
|
+
export function resetNudgesForTest() {
|
|
73
|
+
active.clear()
|
|
74
|
+
seenThisLoad.clear()
|
|
75
|
+
emit()
|
|
76
|
+
}
|