@stapel/alerts-react 0.1.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/CHANGELOG.md +109 -0
- package/LICENSE +21 -0
- package/MODULE.md +140 -0
- package/README.md +147 -0
- package/dist/analytics/events.d.ts +29 -0
- package/dist/analytics/events.d.ts.map +1 -0
- package/dist/analytics/events.js +28 -0
- package/dist/analytics/events.js.map +1 -0
- package/dist/api/alertsApi.d.ts +84 -0
- package/dist/api/alertsApi.d.ts.map +1 -0
- package/dist/api/alertsApi.js +127 -0
- package/dist/api/alertsApi.js.map +1 -0
- package/dist/api/generated/schema.d.ts +453 -0
- package/dist/api/generated/schema.d.ts.map +1 -0
- package/dist/api/generated/schema.js +2 -0
- package/dist/api/generated/schema.js.map +1 -0
- package/dist/api/types.d.ts +78 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +44 -0
- package/dist/api/types.js.map +1 -0
- package/dist/default/FixIssueDialog.d.ts +15 -0
- package/dist/default/FixIssueDialog.d.ts.map +1 -0
- package/dist/default/FixIssueDialog.js +67 -0
- package/dist/default/FixIssueDialog.js.map +1 -0
- package/dist/default/IssueDetail.d.ts +10 -0
- package/dist/default/IssueDetail.d.ts.map +1 -0
- package/dist/default/IssueDetail.js +83 -0
- package/dist/default/IssueDetail.js.map +1 -0
- package/dist/default/IssueFilterBar.d.ts +21 -0
- package/dist/default/IssueFilterBar.d.ts.map +1 -0
- package/dist/default/IssueFilterBar.js +86 -0
- package/dist/default/IssueFilterBar.js.map +1 -0
- package/dist/default/IssuesFeed.d.ts +10 -0
- package/dist/default/IssuesFeed.d.ts.map +1 -0
- package/dist/default/IssuesFeed.js +137 -0
- package/dist/default/IssuesFeed.js.map +1 -0
- package/dist/default/MuteIssueDialog.d.ts +19 -0
- package/dist/default/MuteIssueDialog.d.ts.map +1 -0
- package/dist/default/MuteIssueDialog.js +72 -0
- package/dist/default/MuteIssueDialog.js.map +1 -0
- package/dist/default/index.d.ts +32 -0
- package/dist/default/index.d.ts.map +1 -0
- package/dist/default/index.js +26 -0
- package/dist/default/index.js.map +1 -0
- package/dist/default/labels.d.ts +40 -0
- package/dist/default/labels.d.ts.map +1 -0
- package/dist/default/labels.js +94 -0
- package/dist/default/labels.js.map +1 -0
- package/dist/default/layout.d.ts +32 -0
- package/dist/default/layout.d.ts.map +1 -0
- package/dist/default/layout.js +44 -0
- package/dist/default/layout.js.map +1 -0
- package/dist/default/types.d.ts +27 -0
- package/dist/default/types.d.ts.map +1 -0
- package/dist/default/types.js +2 -0
- package/dist/default/types.js.map +1 -0
- package/dist/flows/errors.d.ts +12 -0
- package/dist/flows/errors.d.ts.map +1 -0
- package/dist/flows/errors.js +13 -0
- package/dist/flows/errors.js.map +1 -0
- package/dist/flows/registry.d.ts +22 -0
- package/dist/flows/registry.d.ts.map +1 -0
- package/dist/flows/registry.js +20 -0
- package/dist/flows/registry.js.map +1 -0
- package/dist/headless/AlertsProvider.d.ts +19 -0
- package/dist/headless/AlertsProvider.d.ts.map +1 -0
- package/dist/headless/AlertsProvider.js +15 -0
- package/dist/headless/AlertsProvider.js.map +1 -0
- package/dist/i18n/errorsMap.d.ts +10 -0
- package/dist/i18n/errorsMap.d.ts.map +1 -0
- package/dist/i18n/errorsMap.js +20 -0
- package/dist/i18n/errorsMap.js.map +1 -0
- package/dist/i18n/es.d.ts +20 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/es.js +152 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/generated/errors.es.gen.d.ts +9 -0
- package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.es.gen.js +57 -0
- package/dist/i18n/generated/errors.es.gen.js.map +1 -0
- package/dist/i18n/generated/errors.gen.d.ts +323 -0
- package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.gen.js +165 -0
- package/dist/i18n/generated/errors.gen.js.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts +9 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.js +57 -0
- package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
- package/dist/i18n/keys.d.ts +164 -0
- package/dist/i18n/keys.d.ts.map +1 -0
- package/dist/i18n/keys.js +300 -0
- package/dist/i18n/keys.js.map +1 -0
- package/dist/i18n/ru.d.ts +27 -0
- package/dist/i18n/ru.d.ts.map +1 -0
- package/dist/i18n/ru.js +159 -0
- package/dist/i18n/ru.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/model/context.d.ts +11 -0
- package/dist/model/context.d.ts.map +1 -0
- package/dist/model/context.js +16 -0
- package/dist/model/context.js.map +1 -0
- package/dist/model/issues.d.ts +103 -0
- package/dist/model/issues.d.ts.map +1 -0
- package/dist/model/issues.js +230 -0
- package/dist/model/issues.js.map +1 -0
- package/dist/model/queryKeys.d.ts +11 -0
- package/dist/model/queryKeys.d.ts.map +1 -0
- package/dist/model/queryKeys.js +32 -0
- package/dist/model/queryKeys.js.map +1 -0
- package/dist/model/refusals.d.ts +25 -0
- package/dist/model/refusals.d.ts.map +1 -0
- package/dist/model/refusals.js +73 -0
- package/dist/model/refusals.js.map +1 -0
- package/dist/model/runtime.d.ts +51 -0
- package/dist/model/runtime.d.ts.map +1 -0
- package/dist/model/runtime.js +29 -0
- package/dist/model/runtime.js.map +1 -0
- package/dist/model/status.d.ts +60 -0
- package/dist/model/status.d.ts.map +1 -0
- package/dist/model/status.js +116 -0
- package/dist/model/status.js.map +1 -0
- package/dist/nav/manifest.d.ts +43 -0
- package/dist/nav/manifest.d.ts.map +1 -0
- package/dist/nav/manifest.js +36 -0
- package/dist/nav/manifest.js.map +1 -0
- package/llms.txt +84 -0
- package/manifest.json +694 -0
- package/nav-manifest.json +46 -0
- package/package.json +119 -0
- package/src/analytics/events.ts +29 -0
- package/src/analytics/generated/events.json +7 -0
- package/src/api/alertsApi.ts +259 -0
- package/src/api/generated/schema.ts +455 -0
- package/src/api/types.ts +113 -0
- package/src/default/FixIssueDialog.tsx +158 -0
- package/src/default/IssueDetail.tsx +431 -0
- package/src/default/IssueFilterBar.tsx +197 -0
- package/src/default/IssuesFeed.tsx +343 -0
- package/src/default/MuteIssueDialog.tsx +186 -0
- package/src/default/index.ts +37 -0
- package/src/default/labels.ts +113 -0
- package/src/default/layout.ts +52 -0
- package/src/default/types.ts +27 -0
- package/src/flows/errors.ts +16 -0
- package/src/flows/registry.ts +32 -0
- package/src/headless/AlertsProvider.tsx +20 -0
- package/src/i18n/errorsMap.ts +31 -0
- package/src/i18n/es.ts +181 -0
- package/src/i18n/generated/errors.es.gen.ts +63 -0
- package/src/i18n/generated/errors.gen.ts +196 -0
- package/src/i18n/generated/errors.json +370 -0
- package/src/i18n/generated/errors.ru.gen.ts +63 -0
- package/src/i18n/keys.ts +341 -0
- package/src/i18n/ru.ts +188 -0
- package/src/index.ts +152 -0
- package/src/model/context.tsx +28 -0
- package/src/model/issues.ts +311 -0
- package/src/model/queryKeys.ts +41 -0
- package/src/model/refusals.ts +82 -0
- package/src/model/runtime.ts +80 -0
- package/src/model/status.ts +179 -0
- package/src/nav/manifest.ts +76 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<FixIssueDialog>` — close an issue with the release that claims the fix.
|
|
3
|
+
*
|
|
4
|
+
* ── Both fields are optional, and the dialog says what that costs ─────────
|
|
5
|
+
*
|
|
6
|
+
* `POST /issues/{id}/fix` takes `version` and `sha`, both optional, both
|
|
7
|
+
* recorded. An issue closed with neither is still closed — just useless the
|
|
8
|
+
* day it regresses and somebody asks which deploy was supposed to have
|
|
9
|
+
* stopped it. So the submit is never blocked; the consequence is stated in one
|
|
10
|
+
* line under the fields, and only while both are empty.
|
|
11
|
+
*
|
|
12
|
+
* That is the difference between a form that refuses and a form that informs.
|
|
13
|
+
* A CI caller has a sha, a person closing a hotfix by hand may have only a
|
|
14
|
+
* version, and a person closing a duplicate has neither — refusing the third
|
|
15
|
+
* would make the tracker lie about what is still open, which is the one thing
|
|
16
|
+
* it exists not to do.
|
|
17
|
+
*
|
|
18
|
+
* ── The endpoint is `/fix`, not `PATCH {status: "fixed"}` ─────────────────
|
|
19
|
+
*
|
|
20
|
+
* Only the POST records the release AND zeroes `count_since_fix`, and that
|
|
21
|
+
* counter is the entire answer to "did it come back?". See `model/status.ts`.
|
|
22
|
+
*
|
|
23
|
+
* ── The body only exists while the dialog is open ─────────────────────────
|
|
24
|
+
*
|
|
25
|
+
* The form is a separate component rendered under `open`, so closing it drops
|
|
26
|
+
* the typed version, the typed sha AND the mutation's error together. The
|
|
27
|
+
* alternative — an effect that resets three pieces of state — is a render loop
|
|
28
|
+
* waiting for a dependency array to be wrong, and a half-filled form that
|
|
29
|
+
* survives off-screen is the bug that shape produces when it does not loop.
|
|
30
|
+
*/
|
|
31
|
+
import { useState } from "react";
|
|
32
|
+
import type { ReactElement } from "react";
|
|
33
|
+
import { Flex, Input, Typography } from "antd";
|
|
34
|
+
import { spacing } from "@stapel/tokens";
|
|
35
|
+
import { ErrorAlert, SkinButton, SkinDialog } from "@stapel/tokens-antd/skin";
|
|
36
|
+
import { useT } from "@stapel/core";
|
|
37
|
+
import type { IssueLevel } from "../api/types.js";
|
|
38
|
+
import { useIssueStatus } from "../model/status.js";
|
|
39
|
+
import { ALERTS_I18N_KEYS } from "../i18n/keys.js";
|
|
40
|
+
import { DIALOG_ACTION_BAR_STYLE } from "./layout.js";
|
|
41
|
+
import type { ThemeModeProp } from "./types.js";
|
|
42
|
+
|
|
43
|
+
export interface FixIssueDialogProps extends ThemeModeProp {
|
|
44
|
+
readonly open: boolean;
|
|
45
|
+
readonly onClose: () => void;
|
|
46
|
+
readonly issueId: string;
|
|
47
|
+
/** The row's level — the analytics prop only; it never reaches the wire. */
|
|
48
|
+
readonly level?: IssueLevel;
|
|
49
|
+
/** Called after the store has saved the close. */
|
|
50
|
+
readonly onFixed?: () => void;
|
|
51
|
+
readonly testId?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function FixIssueDialog(props: FixIssueDialogProps): ReactElement {
|
|
55
|
+
const t = useT();
|
|
56
|
+
const testId = props.testId ?? "alerts-fix";
|
|
57
|
+
return (
|
|
58
|
+
<SkinDialog
|
|
59
|
+
open={props.open}
|
|
60
|
+
onClose={props.onClose}
|
|
61
|
+
title={t(ALERTS_I18N_KEYS.fixTitle)}
|
|
62
|
+
dismissLabel={t(ALERTS_I18N_KEYS.dismiss)}
|
|
63
|
+
data-testid={testId}
|
|
64
|
+
>
|
|
65
|
+
{props.open ? <FixIssueForm {...props} testId={testId} /> : null}
|
|
66
|
+
</SkinDialog>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function FixIssueForm(
|
|
71
|
+
props: FixIssueDialogProps & { readonly testId: string }
|
|
72
|
+
): ReactElement {
|
|
73
|
+
const t = useT();
|
|
74
|
+
const { testId } = props;
|
|
75
|
+
const { fix } = useIssueStatus();
|
|
76
|
+
const [version, setVersion] = useState("");
|
|
77
|
+
const [sha, setSha] = useState("");
|
|
78
|
+
|
|
79
|
+
const blank = version.trim().length === 0 && sha.trim().length === 0;
|
|
80
|
+
|
|
81
|
+
const submit = (): void => {
|
|
82
|
+
fix.mutate(
|
|
83
|
+
{
|
|
84
|
+
issueId: props.issueId,
|
|
85
|
+
version: version.trim(),
|
|
86
|
+
sha: sha.trim(),
|
|
87
|
+
...(props.level !== undefined ? { level: props.level } : {}),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
onSuccess: () => {
|
|
91
|
+
props.onFixed?.();
|
|
92
|
+
props.onClose();
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Flex vertical gap={spacing[3]}>
|
|
100
|
+
<Typography.Text type="secondary">
|
|
101
|
+
{t(ALERTS_I18N_KEYS.fixBody)}
|
|
102
|
+
</Typography.Text>
|
|
103
|
+
|
|
104
|
+
<Flex vertical gap={spacing[1]}>
|
|
105
|
+
<Typography.Text strong>{t(ALERTS_I18N_KEYS.fixVersion)}</Typography.Text>
|
|
106
|
+
<Input
|
|
107
|
+
value={version}
|
|
108
|
+
aria-label={t(ALERTS_I18N_KEYS.fixVersion)}
|
|
109
|
+
placeholder={t(ALERTS_I18N_KEYS.fixVersionHint)}
|
|
110
|
+
data-testid={`${testId}-version`}
|
|
111
|
+
maxLength={64}
|
|
112
|
+
onChange={(event) => setVersion(event.target.value)}
|
|
113
|
+
/>
|
|
114
|
+
</Flex>
|
|
115
|
+
|
|
116
|
+
<Flex vertical gap={spacing[1]}>
|
|
117
|
+
<Typography.Text strong>{t(ALERTS_I18N_KEYS.fixSha)}</Typography.Text>
|
|
118
|
+
<Input
|
|
119
|
+
value={sha}
|
|
120
|
+
aria-label={t(ALERTS_I18N_KEYS.fixSha)}
|
|
121
|
+
placeholder={t(ALERTS_I18N_KEYS.fixShaHint)}
|
|
122
|
+
data-testid={`${testId}-sha`}
|
|
123
|
+
maxLength={64}
|
|
124
|
+
onChange={(event) => setSha(event.target.value)}
|
|
125
|
+
/>
|
|
126
|
+
</Flex>
|
|
127
|
+
|
|
128
|
+
{blank ? (
|
|
129
|
+
<Typography.Text type="warning" data-testid={`${testId}-blank`}>
|
|
130
|
+
{t(ALERTS_I18N_KEYS.fixBlank)}
|
|
131
|
+
</Typography.Text>
|
|
132
|
+
) : null}
|
|
133
|
+
|
|
134
|
+
<ErrorAlert testId={`${testId}-failed`} thrown={fix.error} variant="inline" />
|
|
135
|
+
|
|
136
|
+
<Flex gap={spacing[2]} justify="end" style={DIALOG_ACTION_BAR_STYLE}>
|
|
137
|
+
<SkinButton
|
|
138
|
+
data-testid={`${testId}-cancel`}
|
|
139
|
+
data-analytics="none"
|
|
140
|
+
data-analytics-reason="dismissing a dialog decides nothing about the issue"
|
|
141
|
+
onClick={props.onClose}
|
|
142
|
+
>
|
|
143
|
+
{t(ALERTS_I18N_KEYS.cancel)}
|
|
144
|
+
</SkinButton>
|
|
145
|
+
<SkinButton
|
|
146
|
+
type="primary"
|
|
147
|
+
loading={fix.isPending}
|
|
148
|
+
data-testid={`${testId}-submit`}
|
|
149
|
+
data-analytics="none"
|
|
150
|
+
data-analytics-reason="alerts.issue.fixed is emitted by the model layer on success"
|
|
151
|
+
onClick={submit}
|
|
152
|
+
>
|
|
153
|
+
{t(ALERTS_I18N_KEYS.fixSubmit)}
|
|
154
|
+
</SkinButton>
|
|
155
|
+
</Flex>
|
|
156
|
+
</Flex>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<IssueDetail>` — one bug, everything the store knows about it, and the
|
|
3
|
+
* three judgements an operator can record.
|
|
4
|
+
*
|
|
5
|
+
* ── The events are a SAMPLE, and the screen says so ───────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The detail carries the last 20 occurrences; `count` carries all of them, and
|
|
8
|
+
* retention sweeps events long before it would touch an open issue. A list of
|
|
9
|
+
* twenty with a count of forty thousand beside it is not a contradiction and
|
|
10
|
+
* must not read as one, so the heading states the relationship in words.
|
|
11
|
+
*
|
|
12
|
+
* ── The traceback is behind an expander, not in the page ──────────────────
|
|
13
|
+
*
|
|
14
|
+
* A Django traceback is routinely sixty frames. Three of them inline and every
|
|
15
|
+
* control on this screen is below the fold, which on the screen somebody opened
|
|
16
|
+
* to CLOSE a bug is the whole point missed. Each occurrence is a collapsed row
|
|
17
|
+
* carrying its own trace and its own context.
|
|
18
|
+
*
|
|
19
|
+
* ── `regressed` is reported, never offered ───────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* The store sets it when a fixed issue receives a new event. The notice names
|
|
22
|
+
* the release that was supposed to have stopped it, because that — and not the
|
|
23
|
+
* status word — is what somebody needs in order to act.
|
|
24
|
+
*
|
|
25
|
+
* ── Three refusals, three sentences ───────────────────────────────────────
|
|
26
|
+
*
|
|
27
|
+
* 403 is "wrong account", 401 is "sign in again", 404 is "no such issue, and
|
|
28
|
+
* here is why that can happen": a closed issue with no events left IS swept,
|
|
29
|
+
* while an open one never is. Anything else is a read failure with a retry.
|
|
30
|
+
*/
|
|
31
|
+
import { useState } from "react";
|
|
32
|
+
import type { ReactElement, ReactNode } from "react";
|
|
33
|
+
import { Card, Collapse, Flex, Typography } from "antd";
|
|
34
|
+
import { spacing } from "@stapel/tokens";
|
|
35
|
+
import {
|
|
36
|
+
EmptyState,
|
|
37
|
+
ErrorAlert,
|
|
38
|
+
LoadBoundary,
|
|
39
|
+
Page,
|
|
40
|
+
SkinButton,
|
|
41
|
+
SkinConfirm,
|
|
42
|
+
StatusTag,
|
|
43
|
+
} from "@stapel/tokens-antd/skin";
|
|
44
|
+
import { useFormat, useT } from "@stapel/core";
|
|
45
|
+
import type { ErrorEvent, IssueDetail as IssueDetailRow } from "../api/types.js";
|
|
46
|
+
import { useIssue } from "../model/issues.js";
|
|
47
|
+
import { useIssueStatus } from "../model/status.js";
|
|
48
|
+
import {
|
|
49
|
+
isAlertsStaffOnly,
|
|
50
|
+
isAlertsUnauthorized,
|
|
51
|
+
isIssueNotFound,
|
|
52
|
+
} from "../model/refusals.js";
|
|
53
|
+
import { useAlertsRuntime } from "../model/context.js";
|
|
54
|
+
import { ALERTS_I18N_KEYS } from "../i18n/keys.js";
|
|
55
|
+
import { FixIssueDialog } from "./FixIssueDialog.js";
|
|
56
|
+
import { MuteIssueDialog } from "./MuteIssueDialog.js";
|
|
57
|
+
import { kindKey, levelFamily, levelKey, statusFamily, statusKey } from "./labels.js";
|
|
58
|
+
import { TRACE_BLOCK_STYLE } from "./layout.js";
|
|
59
|
+
import type { ThemeModeProp } from "./types.js";
|
|
60
|
+
|
|
61
|
+
export interface IssueDetailProps extends ThemeModeProp {
|
|
62
|
+
readonly issueId: string;
|
|
63
|
+
/** The way back to the feed, if the host has one. */
|
|
64
|
+
readonly onBack?: () => void;
|
|
65
|
+
readonly testId?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** One label/value pair of the meta block. Absent values render the dash. */
|
|
69
|
+
function Field(props: {
|
|
70
|
+
label: string;
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
testId?: string;
|
|
73
|
+
}): ReactElement {
|
|
74
|
+
return (
|
|
75
|
+
<Flex vertical style={{ minWidth: "12rem" }} data-testid={props.testId}>
|
|
76
|
+
<Typography.Text type="secondary">{props.label}</Typography.Text>
|
|
77
|
+
<Typography.Text>{props.children}</Typography.Text>
|
|
78
|
+
</Flex>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function IssueDetail(props: IssueDetailProps): ReactElement {
|
|
83
|
+
const t = useT();
|
|
84
|
+
const fmt = useFormat();
|
|
85
|
+
const runtime = useAlertsRuntime();
|
|
86
|
+
const testId = props.testId ?? "alerts-issue";
|
|
87
|
+
const bag = useIssue(props.issueId);
|
|
88
|
+
const { reopen } = useIssueStatus();
|
|
89
|
+
const [fixing, setFixing] = useState(false);
|
|
90
|
+
const [muting, setMuting] = useState(false);
|
|
91
|
+
const [reopening, setReopening] = useState(false);
|
|
92
|
+
|
|
93
|
+
const absent = t(ALERTS_I18N_KEYS.none);
|
|
94
|
+
const text = (value: string): string => (value.length > 0 ? value : absent);
|
|
95
|
+
|
|
96
|
+
const meta = (issue: IssueDetailRow): ReactElement => (
|
|
97
|
+
<Card size="small" data-testid={`${testId}-meta`}>
|
|
98
|
+
<Flex gap={spacing[4]} wrap>
|
|
99
|
+
<Field label={t(ALERTS_I18N_KEYS.detailService)}>{issue.service}</Field>
|
|
100
|
+
<Field label={t(ALERTS_I18N_KEYS.detailEnvironment)}>
|
|
101
|
+
{text(issue.environment)}
|
|
102
|
+
</Field>
|
|
103
|
+
<Field label={t(ALERTS_I18N_KEYS.detailKind)}>
|
|
104
|
+
{t(kindKey(issue.kind), { kind: issue.kind })}
|
|
105
|
+
</Field>
|
|
106
|
+
<Field label={t(ALERTS_I18N_KEYS.detailCount)} testId={`${testId}-count`}>
|
|
107
|
+
{String(issue.count)}
|
|
108
|
+
</Field>
|
|
109
|
+
<Field label={t(ALERTS_I18N_KEYS.detailSinceFix)}>
|
|
110
|
+
{String(issue.count_since_fix)}
|
|
111
|
+
</Field>
|
|
112
|
+
<Field label={t(ALERTS_I18N_KEYS.detailFirstSeen)}>
|
|
113
|
+
{fmt.timestamp(issue.first_seen) ?? absent}
|
|
114
|
+
</Field>
|
|
115
|
+
<Field label={t(ALERTS_I18N_KEYS.detailLastSeen)}>
|
|
116
|
+
{fmt.timestamp(issue.last_seen) ?? absent}
|
|
117
|
+
</Field>
|
|
118
|
+
<Field label={t(ALERTS_I18N_KEYS.detailFingerprint)}>
|
|
119
|
+
{text(issue.fingerprint)}
|
|
120
|
+
</Field>
|
|
121
|
+
{issue.fixed_in_version.length > 0 ? (
|
|
122
|
+
<Field
|
|
123
|
+
label={t(ALERTS_I18N_KEYS.detailFixedIn)}
|
|
124
|
+
testId={`${testId}-fixed-version`}
|
|
125
|
+
>
|
|
126
|
+
{issue.fixed_in_version}
|
|
127
|
+
</Field>
|
|
128
|
+
) : null}
|
|
129
|
+
{issue.fixed_in_sha.length > 0 ? (
|
|
130
|
+
<Field
|
|
131
|
+
label={t(ALERTS_I18N_KEYS.detailFixedSha)}
|
|
132
|
+
testId={`${testId}-fixed-sha`}
|
|
133
|
+
>
|
|
134
|
+
{runtime.commitRefUrl === undefined ? (
|
|
135
|
+
issue.fixed_in_sha
|
|
136
|
+
) : (
|
|
137
|
+
<Typography.Link
|
|
138
|
+
href={runtime.commitRefUrl(issue.fixed_in_sha)}
|
|
139
|
+
target="_blank"
|
|
140
|
+
rel="noreferrer"
|
|
141
|
+
>
|
|
142
|
+
{issue.fixed_in_sha}
|
|
143
|
+
</Typography.Link>
|
|
144
|
+
)}
|
|
145
|
+
</Field>
|
|
146
|
+
) : null}
|
|
147
|
+
{issue.fixed_at !== null ? (
|
|
148
|
+
<Field label={t(ALERTS_I18N_KEYS.detailFixedAt)}>
|
|
149
|
+
{fmt.timestamp(issue.fixed_at) ?? absent}
|
|
150
|
+
</Field>
|
|
151
|
+
) : null}
|
|
152
|
+
{/* A deadline belongs to the muted status: `null` while muted means
|
|
153
|
+
"no deadline", and any other status has none — the store clears
|
|
154
|
+
the field on every transition out of `muted`. */}
|
|
155
|
+
{issue.status === "muted" ? (
|
|
156
|
+
<Field
|
|
157
|
+
label={t(ALERTS_I18N_KEYS.detailMutedUntil)}
|
|
158
|
+
testId={`${testId}-muted-until`}
|
|
159
|
+
>
|
|
160
|
+
{issue.muted_until === null
|
|
161
|
+
? t(ALERTS_I18N_KEYS.detailMutedForever)
|
|
162
|
+
: (fmt.timestamp(issue.muted_until) ?? absent)}
|
|
163
|
+
</Field>
|
|
164
|
+
) : null}
|
|
165
|
+
{issue.sentry_event_id.length > 0 ? (
|
|
166
|
+
<Field label={t(ALERTS_I18N_KEYS.detailSentry)}>
|
|
167
|
+
{issue.sentry_event_id}
|
|
168
|
+
</Field>
|
|
169
|
+
) : null}
|
|
170
|
+
</Flex>
|
|
171
|
+
{issue.note.length > 0 ? (
|
|
172
|
+
<Flex vertical style={{ marginBlockStart: spacing[3] }}>
|
|
173
|
+
<Typography.Text type="secondary">
|
|
174
|
+
{t(ALERTS_I18N_KEYS.detailNote)}
|
|
175
|
+
</Typography.Text>
|
|
176
|
+
<Typography.Paragraph data-testid={`${testId}-note`}>
|
|
177
|
+
{issue.note}
|
|
178
|
+
</Typography.Paragraph>
|
|
179
|
+
</Flex>
|
|
180
|
+
) : null}
|
|
181
|
+
</Card>
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const event = (row: ErrorEvent): ReactElement => (
|
|
185
|
+
<Flex vertical gap={spacing[2]}>
|
|
186
|
+
<Flex gap={spacing[4]} wrap>
|
|
187
|
+
<Field label={t(ALERTS_I18N_KEYS.detailReceivedAt)}>
|
|
188
|
+
{fmt.timestamp(row.received_at) ?? absent}
|
|
189
|
+
</Field>
|
|
190
|
+
<Field label={t(ALERTS_I18N_KEYS.detailRelease)}>
|
|
191
|
+
{text(row.release)}
|
|
192
|
+
</Field>
|
|
193
|
+
<Field label={t(ALERTS_I18N_KEYS.detailRequestPath)}>
|
|
194
|
+
{text(row.request_path)}
|
|
195
|
+
</Field>
|
|
196
|
+
<Field label={t(ALERTS_I18N_KEYS.detailTraceId)}>
|
|
197
|
+
{text(row.trace_id)}
|
|
198
|
+
</Field>
|
|
199
|
+
<Field label={t(ALERTS_I18N_KEYS.detailOccurrences)}>
|
|
200
|
+
{String(row.occurrences)}
|
|
201
|
+
</Field>
|
|
202
|
+
</Flex>
|
|
203
|
+
|
|
204
|
+
<Typography.Text strong>{t(ALERTS_I18N_KEYS.detailTrace)}</Typography.Text>
|
|
205
|
+
{row.trace.length > 0 ? (
|
|
206
|
+
<pre style={TRACE_BLOCK_STYLE} data-testid={`${testId}-trace-${row.id}`}>
|
|
207
|
+
{row.trace}
|
|
208
|
+
</pre>
|
|
209
|
+
) : (
|
|
210
|
+
<Typography.Text type="secondary">
|
|
211
|
+
{t(ALERTS_I18N_KEYS.detailNoTrace)}
|
|
212
|
+
</Typography.Text>
|
|
213
|
+
)}
|
|
214
|
+
|
|
215
|
+
<Typography.Text strong>{t(ALERTS_I18N_KEYS.detailContext)}</Typography.Text>
|
|
216
|
+
{row.context === null || row.context === undefined ? (
|
|
217
|
+
<Typography.Text type="secondary">
|
|
218
|
+
{t(ALERTS_I18N_KEYS.detailNoContext)}
|
|
219
|
+
</Typography.Text>
|
|
220
|
+
) : (
|
|
221
|
+
<pre style={TRACE_BLOCK_STYLE} data-testid={`${testId}-context-${row.id}`}>
|
|
222
|
+
{JSON.stringify(row.context, null, 2)}
|
|
223
|
+
</pre>
|
|
224
|
+
)}
|
|
225
|
+
<Typography.Text type="secondary">
|
|
226
|
+
{t(ALERTS_I18N_KEYS.detailRedacted)}
|
|
227
|
+
</Typography.Text>
|
|
228
|
+
</Flex>
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<Page
|
|
233
|
+
title={t(ALERTS_I18N_KEYS.detailTitle)}
|
|
234
|
+
data-testid={testId}
|
|
235
|
+
{...(props.mode !== undefined ? { mode: props.mode } : {})}
|
|
236
|
+
{...(props.onBack !== undefined
|
|
237
|
+
? {
|
|
238
|
+
actions: (
|
|
239
|
+
<SkinButton
|
|
240
|
+
size="small"
|
|
241
|
+
data-testid={`${testId}-back`}
|
|
242
|
+
data-analytics="none"
|
|
243
|
+
data-analytics-reason="navigation back to the board decides nothing"
|
|
244
|
+
onClick={props.onBack}
|
|
245
|
+
>
|
|
246
|
+
{t(ALERTS_I18N_KEYS.feedTitle)}
|
|
247
|
+
</SkinButton>
|
|
248
|
+
),
|
|
249
|
+
}
|
|
250
|
+
: {})}
|
|
251
|
+
>
|
|
252
|
+
<LoadBoundary
|
|
253
|
+
state={bag.state}
|
|
254
|
+
testId={testId}
|
|
255
|
+
onRetry={bag.refetch}
|
|
256
|
+
failed={(error) =>
|
|
257
|
+
isAlertsStaffOnly(error) ? (
|
|
258
|
+
<EmptyState
|
|
259
|
+
testId={`${testId}-staff-only`}
|
|
260
|
+
title={t(ALERTS_I18N_KEYS.feedStaffOnly)}
|
|
261
|
+
hint={t(ALERTS_I18N_KEYS.feedStaffOnlyHint)}
|
|
262
|
+
/>
|
|
263
|
+
) : isAlertsUnauthorized(error) ? (
|
|
264
|
+
<EmptyState
|
|
265
|
+
testId={`${testId}-signed-out`}
|
|
266
|
+
title={t(ALERTS_I18N_KEYS.feedSignedOut)}
|
|
267
|
+
hint={t(ALERTS_I18N_KEYS.feedSignedOutHint)}
|
|
268
|
+
/>
|
|
269
|
+
) : isIssueNotFound(error) ? (
|
|
270
|
+
<EmptyState
|
|
271
|
+
testId={`${testId}-not-found`}
|
|
272
|
+
title={t(ALERTS_I18N_KEYS.detailNotFound)}
|
|
273
|
+
hint={t(ALERTS_I18N_KEYS.detailNotFoundHint)}
|
|
274
|
+
/>
|
|
275
|
+
) : (
|
|
276
|
+
<ErrorAlert
|
|
277
|
+
testId={`${testId}-failed`}
|
|
278
|
+
thrown={error}
|
|
279
|
+
message={t(ALERTS_I18N_KEYS.detailFailed)}
|
|
280
|
+
onRetry={bag.refetch}
|
|
281
|
+
/>
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
>
|
|
285
|
+
{(issue) => (
|
|
286
|
+
<Flex vertical gap={spacing[4]}>
|
|
287
|
+
<Flex vertical gap={spacing[2]}>
|
|
288
|
+
<Flex gap={spacing[2]} wrap align="center">
|
|
289
|
+
<StatusTag
|
|
290
|
+
status={levelFamily(issue.level)}
|
|
291
|
+
testId={`${testId}-level`}
|
|
292
|
+
>
|
|
293
|
+
{t(levelKey(issue.level), { level: issue.level })}
|
|
294
|
+
</StatusTag>
|
|
295
|
+
<StatusTag
|
|
296
|
+
status={statusFamily(issue.status)}
|
|
297
|
+
testId={`${testId}-status`}
|
|
298
|
+
>
|
|
299
|
+
{t(statusKey(issue.status), { status: issue.status })}
|
|
300
|
+
</StatusTag>
|
|
301
|
+
</Flex>
|
|
302
|
+
<Typography.Title level={4} data-testid={`${testId}-title`}>
|
|
303
|
+
{issue.title}
|
|
304
|
+
</Typography.Title>
|
|
305
|
+
<Typography.Text type="secondary" data-testid={`${testId}-culprit`}>
|
|
306
|
+
{text(issue.culprit)}
|
|
307
|
+
</Typography.Text>
|
|
308
|
+
</Flex>
|
|
309
|
+
|
|
310
|
+
{issue.status === "regressed" ? (
|
|
311
|
+
<ErrorAlert
|
|
312
|
+
testId={`${testId}-regressed`}
|
|
313
|
+
message={t(ALERTS_I18N_KEYS.detailRegressed)}
|
|
314
|
+
detail={t(ALERTS_I18N_KEYS.detailRegressedHint, {
|
|
315
|
+
version:
|
|
316
|
+
issue.fixed_in_version.length > 0
|
|
317
|
+
? issue.fixed_in_version
|
|
318
|
+
: absent,
|
|
319
|
+
})}
|
|
320
|
+
/>
|
|
321
|
+
) : null}
|
|
322
|
+
|
|
323
|
+
{meta(issue)}
|
|
324
|
+
|
|
325
|
+
<Flex gap={spacing[2]} wrap>
|
|
326
|
+
<SkinButton
|
|
327
|
+
type="primary"
|
|
328
|
+
data-testid={`${testId}-mark-fixed`}
|
|
329
|
+
data-analytics="none"
|
|
330
|
+
data-analytics-reason="opens the fix dialog; the event is emitted when the store saves"
|
|
331
|
+
onClick={() => setFixing(true)}
|
|
332
|
+
>
|
|
333
|
+
{t(ALERTS_I18N_KEYS.detailMarkFixed)}
|
|
334
|
+
</SkinButton>
|
|
335
|
+
<SkinButton
|
|
336
|
+
data-testid={`${testId}-mute`}
|
|
337
|
+
data-analytics="none"
|
|
338
|
+
data-analytics-reason="opens the mute dialog; the event is emitted when the store saves"
|
|
339
|
+
onClick={() => setMuting(true)}
|
|
340
|
+
>
|
|
341
|
+
{t(ALERTS_I18N_KEYS.detailMute)}
|
|
342
|
+
</SkinButton>
|
|
343
|
+
{issue.status === "new" ? null : (
|
|
344
|
+
<SkinButton
|
|
345
|
+
data-testid={`${testId}-reopen`}
|
|
346
|
+
data-analytics="none"
|
|
347
|
+
data-analytics-reason="opens a confirm; the event is emitted when the store saves"
|
|
348
|
+
onClick={() => setReopening(true)}
|
|
349
|
+
>
|
|
350
|
+
{t(ALERTS_I18N_KEYS.detailReopen)}
|
|
351
|
+
</SkinButton>
|
|
352
|
+
)}
|
|
353
|
+
</Flex>
|
|
354
|
+
|
|
355
|
+
<ErrorAlert
|
|
356
|
+
testId={`${testId}-reopen-failed`}
|
|
357
|
+
thrown={reopen.error}
|
|
358
|
+
variant="inline"
|
|
359
|
+
/>
|
|
360
|
+
|
|
361
|
+
<Card
|
|
362
|
+
size="small"
|
|
363
|
+
title={t(ALERTS_I18N_KEYS.detailEvents)}
|
|
364
|
+
data-testid={`${testId}-events`}
|
|
365
|
+
extra={
|
|
366
|
+
<Typography.Text type="secondary">
|
|
367
|
+
{t(ALERTS_I18N_KEYS.detailEventsHint, {
|
|
368
|
+
shown: issue.events.length,
|
|
369
|
+
count: issue.count,
|
|
370
|
+
})}
|
|
371
|
+
</Typography.Text>
|
|
372
|
+
}
|
|
373
|
+
>
|
|
374
|
+
{issue.events.length === 0 ? (
|
|
375
|
+
<EmptyState
|
|
376
|
+
compact
|
|
377
|
+
testId={`${testId}-events-empty`}
|
|
378
|
+
title={t(ALERTS_I18N_KEYS.detailEventsEmpty)}
|
|
379
|
+
hint={t(ALERTS_I18N_KEYS.detailEventsEmptyHint)}
|
|
380
|
+
/>
|
|
381
|
+
) : (
|
|
382
|
+
<Collapse
|
|
383
|
+
size="small"
|
|
384
|
+
ghost
|
|
385
|
+
items={issue.events.map((row) => ({
|
|
386
|
+
key: row.id,
|
|
387
|
+
label: `${fmt.relative(row.received_at) ?? absent} · ${text(row.message)}`,
|
|
388
|
+
children: event(row),
|
|
389
|
+
}))}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
</Card>
|
|
393
|
+
|
|
394
|
+
<FixIssueDialog
|
|
395
|
+
open={fixing}
|
|
396
|
+
onClose={() => setFixing(false)}
|
|
397
|
+
issueId={issue.id}
|
|
398
|
+
level={issue.level}
|
|
399
|
+
testId={`${testId}-fix`}
|
|
400
|
+
{...(props.mode !== undefined ? { mode: props.mode } : {})}
|
|
401
|
+
/>
|
|
402
|
+
<MuteIssueDialog
|
|
403
|
+
open={muting}
|
|
404
|
+
onClose={() => setMuting(false)}
|
|
405
|
+
issueId={issue.id}
|
|
406
|
+
level={issue.level}
|
|
407
|
+
testId={`${testId}-mute-dialog`}
|
|
408
|
+
{...(props.mode !== undefined ? { mode: props.mode } : {})}
|
|
409
|
+
/>
|
|
410
|
+
<SkinConfirm
|
|
411
|
+
open={reopening}
|
|
412
|
+
onCancel={() => setReopening(false)}
|
|
413
|
+
onConfirm={() =>
|
|
414
|
+
reopen.mutate(
|
|
415
|
+
{ issueId: issue.id, level: issue.level },
|
|
416
|
+
{ onSuccess: () => setReopening(false) }
|
|
417
|
+
)
|
|
418
|
+
}
|
|
419
|
+
title={t(ALERTS_I18N_KEYS.detailReopen)}
|
|
420
|
+
body={t(ALERTS_I18N_KEYS.detailReopenConfirm)}
|
|
421
|
+
confirmLabel={t(ALERTS_I18N_KEYS.detailReopen)}
|
|
422
|
+
cancelLabel={t(ALERTS_I18N_KEYS.cancel)}
|
|
423
|
+
confirming={reopen.isPending}
|
|
424
|
+
data-testid={`${testId}-reopen-confirm`}
|
|
425
|
+
/>
|
|
426
|
+
</Flex>
|
|
427
|
+
)}
|
|
428
|
+
</LoadBoundary>
|
|
429
|
+
</Page>
|
|
430
|
+
);
|
|
431
|
+
}
|