Files
nxdns/admin/src/features/activity/RelatedActions.tsx
T
mokhtar fa323c7ed4
Gates / test (push) Successful in 1m40s
Gates / package (push) Successful in 3m58s
Gates / container (push) Successful in 14s
CI / gates (push) Successful in 12m51s
Gates / frontend (push) Successful in 1m18s
Gates / test-aarch64 (push) Successful in 6m57s
milestone 29: activity — history, live and policy simulation on one surface
query log, live and lookup merge into /activity. history filters live
in the url, so a pasted link or back/forward reproduces the exact
view; the result column separates servfail and nxdomain from success
in the list. live is follow-by-default with freeze, and a streamed
row opens its in-memory provenance detail — no correlation invented
for rows sqlite has not written. lookup survives as the current
policy simulation under /activity/test. investigation links carry
absolute bounds, and the diagnostics page now honors since/until
instead of ignoring them. the old routes are gone without aliases.
2026-08-22 10:52:56 +02:00

60 lines
2.0 KiB
TypeScript

/**
* The links out of one query's detail, shared by the persisted detail page and
* the in-place detail a streamed row opens.
*
* Both surfaces answer the same four follow-up questions, and both are read
* from an investigation that has a time range. Every link therefore carries
* absolute bounds: a link that said "recently" would show a different set of
* queries every time it was opened, which is the opposite of what linking to an
* incident is for.
*/
import { Link } from "@tanstack/react-router";
import * as stylex from "@stylexjs/stylex";
import { styles as shared } from "@/ui/styles";
import { provenanceRelatedLink } from "./ProvenanceDetail";
import { diagnosticsBounds, relatedBounds } from "./relatedLinks";
import type { ActivitySearch } from "./search";
interface Props {
domain: string;
client: string;
/** The second this query was answered, which every window is centred on. */
ts: number;
/** The Activity search the reader came from; its bounds win over the defaults. */
origin: Pick<ActivitySearch, "since" | "until">;
}
export default function RelatedActions({ domain, client, ts, origin }: Props) {
const bounds = relatedBounds(ts, origin);
const window = diagnosticsBounds(ts);
return (
<>
<Link to="/activity/test" search={{ domain }} {...stylex.props(provenanceRelatedLink, shared.focusRing)}>
Test this domain against current policy
</Link>
<Link
to="/activity"
search={{ mode: "history", domain, client: undefined, blocked: undefined, ...bounds }}
{...stylex.props(provenanceRelatedLink, shared.focusRing)}
>
All activity for this domain
</Link>
<Link
to="/activity"
search={{ mode: "history", client, domain: undefined, blocked: undefined, ...bounds }}
{...stylex.props(provenanceRelatedLink, shared.focusRing)}
>
All activity from this client
</Link>
<Link
to="/diagnostics"
search={{ since: window.since, until: window.until }}
{...stylex.props(provenanceRelatedLink, shared.focusRing)}
>
Diagnostics around this query
</Link>
</>
);
}