@parallelworks/tandem-web 0.155.2 → 0.156.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.
@@ -0,0 +1,152 @@
1
+ import { api as e, unwrap as t } from "../../../api/client.js";
2
+ import { sentryProjectsQuery as n, sentryQuery as r, teamsQuery as i } from "../../../api/queries.js";
3
+ import { AlertIcon as a } from "../../../components/icons.js";
4
+ import { usePeople as o } from "../../../lib/people.js";
5
+ import { useCan as s } from "../../../lib/roles.js";
6
+ import { AdminOnly as c, SettingsPage as l, useFormError as u } from "../../../components/settings.js";
7
+ import { Route as d } from "./sentry.js";
8
+ import { ConnectionCard as f } from "../../../components/ConnectionCard.js";
9
+ import { Combobox as p, SettingRow as m, SettingsCard as h, StatusLabel as g, Switch as _, Tag as v, buttonClasses as y } from "@parallelworks/ui";
10
+ import { useFormatter as b, useTranslations as x } from "use-intl";
11
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
12
+ import { useMutation as T, useQuery as E, useQueryClient as D, useSuspenseQuery as O } from "@tanstack/react-query";
13
+ // src/routes/$workspace/settings/sentry.tsx?tsr-split=component
14
+ function k() {
15
+ let { workspace: n } = d.useParams(), { data: p } = O(r(n)), { data: v } = O(i(n)), E = s(n, "manage_workspace"), k = x("settingsNav"), j = x("sentry"), M = b(), { person: N } = o(n), P = D(), F = u(), I = T({
16
+ mutationFn: async ({ teamId: r, on: i }) => t(await e.PUT("/api/v1/workspaces/{workspace}/sentry/teams/{teamId}", {
17
+ params: { path: {
18
+ workspace: n,
19
+ teamId: r
20
+ } },
21
+ body: { resolve: i }
22
+ })),
23
+ onMutate: F.clear,
24
+ onSuccess: () => P.invalidateQueries({ queryKey: r(n).queryKey }),
25
+ onError: F.set
26
+ }), L = new Set(p.teams.filter((e) => e.resolve).map((e) => e.teamId));
27
+ return /* @__PURE__ */ w(l, {
28
+ title: k("sentry"),
29
+ description: j("pageDescription"),
30
+ children: [/* @__PURE__ */ C(c, { workspace: n }), p.enabled ? /* @__PURE__ */ w("div", {
31
+ className: "space-y-6",
32
+ children: [
33
+ /* @__PURE__ */ C("p", {
34
+ className: "text-sm text-muted-foreground",
35
+ children: j("managedByHost")
36
+ }),
37
+ /* @__PURE__ */ C(f, {
38
+ icon: /* @__PURE__ */ C(a, { className: "size-6" }),
39
+ name: k("sentry"),
40
+ status: p.connected ? j("connectedTo", {
41
+ organization: p.organizationName || p.organization || "",
42
+ person: N(p.connectedBy ?? "").name,
43
+ date: M.dateTime(new Date(p.connectedAt ?? ""), { dateStyle: "medium" })
44
+ }) : j("description"),
45
+ action: /* @__PURE__ */ w(S, { children: [!p.connected && /* @__PURE__ */ C(g, {
46
+ off: !0,
47
+ children: j("notConnected")
48
+ }), E && p.settingsUrl && /* @__PURE__ */ C("a", {
49
+ href: p.settingsUrl,
50
+ className: y({
51
+ variant: "outline",
52
+ size: "sm"
53
+ }),
54
+ children: j("openSettings")
55
+ })] })
56
+ }),
57
+ v.length > 0 && /* @__PURE__ */ C(h, {
58
+ title: j("resolveTitle"),
59
+ description: j("resolveDescription"),
60
+ children: v.map((e) => /* @__PURE__ */ C(m, {
61
+ label: `${e.name} (${e.key})`,
62
+ error: I.variables?.teamId === e.id ? F.error : null,
63
+ children: /* @__PURE__ */ C(_, {
64
+ "aria-label": j("resolveTeam", { team: e.name }),
65
+ checked: L.has(e.id),
66
+ disabled: !E || I.isPending,
67
+ onCheckedChange: (t) => I.mutate({
68
+ teamId: e.id,
69
+ on: t
70
+ })
71
+ })
72
+ }, e.id))
73
+ }),
74
+ p.connected && E && /* @__PURE__ */ C(A, { workspace: n }),
75
+ /* @__PURE__ */ w("section", {
76
+ className: "space-y-2 text-sm",
77
+ children: [/* @__PURE__ */ C("h2", {
78
+ className: "font-medium",
79
+ children: j("howTitle")
80
+ }), /* @__PURE__ */ w("ol", {
81
+ className: "list-decimal space-y-1.5 pl-5 text-muted-foreground",
82
+ children: [
83
+ /* @__PURE__ */ C("li", { children: j("howFile") }),
84
+ /* @__PURE__ */ C("li", { children: j("howAlert") }),
85
+ /* @__PURE__ */ C("li", { children: j("howIssue") }),
86
+ /* @__PURE__ */ C("li", { children: j("howRegress") })
87
+ ]
88
+ })]
89
+ })
90
+ ]
91
+ }) : /* @__PURE__ */ C(h, { children: /* @__PURE__ */ C("p", {
92
+ className: "px-3 py-2 text-sm text-muted-foreground",
93
+ children: j("notConfigured")
94
+ }) })]
95
+ });
96
+ }
97
+ function A({ workspace: r }) {
98
+ let i = x("sentry"), a = D(), o = u(), { data: s, isError: c } = E(n(r)), l = T({
99
+ mutationFn: async ({ projectId: n, ids: i }) => t(await e.PUT("/api/v1/workspaces/{workspace}/sentry/projects/{projectId}/repositories", {
100
+ params: { path: {
101
+ workspace: r,
102
+ projectId: n
103
+ } },
104
+ body: { repositoryIds: i }
105
+ })),
106
+ onMutate: o.clear,
107
+ onSettled: () => a.invalidateQueries({ queryKey: n(r).queryKey }),
108
+ onError: o.set
109
+ }), d = (s?.repositories ?? []).map((e) => ({
110
+ value: e.id,
111
+ label: `${e.owner}/${e.name}`,
112
+ hint: e.teamKey
113
+ }));
114
+ return /* @__PURE__ */ C(h, {
115
+ title: i("projectsTitle"),
116
+ description: i("projectsDescription"),
117
+ children: c ? /* @__PURE__ */ C("p", {
118
+ className: "px-3 py-2 text-sm text-muted-foreground",
119
+ children: i("projectsUnavailable")
120
+ }) : s ? s.projects.length === 0 ? /* @__PURE__ */ C("p", {
121
+ className: "px-3 py-2 text-sm text-muted-foreground",
122
+ children: i("noProjects")
123
+ }) : s.projects.map((e) => /* @__PURE__ */ C(m, {
124
+ label: e.name,
125
+ fill: !0,
126
+ helpText: /* @__PURE__ */ w("span", {
127
+ className: "flex flex-wrap items-center gap-1.5",
128
+ children: [/* @__PURE__ */ C("span", { children: e.slug }), /* @__PURE__ */ C(v, {
129
+ mono: !0,
130
+ children: e.platform || i("unknownPlatform")
131
+ })]
132
+ }),
133
+ error: l.variables?.projectId === e.id ? o.error : null,
134
+ children: /* @__PURE__ */ C(p, {
135
+ multiple: !0,
136
+ "aria-label": i("projectRepositories", { project: e.name }),
137
+ placeholder: d.length ? i("chooseRepositories") : i("noRepositories"),
138
+ disabled: d.length === 0,
139
+ items: d,
140
+ value: l.isPending && l.variables?.projectId === e.id ? l.variables.ids : e.repositories.map((e) => e.id),
141
+ onValueChange: (t) => l.mutate({
142
+ projectId: e.id,
143
+ ids: t
144
+ })
145
+ })
146
+ }, e.id)) : /* @__PURE__ */ C("p", {
147
+ className: "px-3 py-2 text-sm text-muted-foreground",
148
+ children: i("projectsLoading")
149
+ })
150
+ });
151
+ }
152
+ export { k as component };
@@ -0,0 +1,4 @@
1
+ import { sentryQuery as e, teamsQuery as t } from "../../../api/queries.js";
2
+ // src/routes/$workspace/settings/sentry.tsx?tsr-split=loader
3
+ var n = ({ context: { queryClient: n }, params: { workspace: r } }) => Promise.all([n.ensureQueryData(e(r)), n.ensureQueryData(t(r))]);
4
+ export { n as loader };