@burdenoff/microfe-planmagnet 2026.930.19 → 2026.930.20
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/dist/index.js +2 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +17 -5
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/controls/SyncControls.d.ts +101 -0
- package/dist/planmagnet/controls/SyncControls.d.ts.map +1 -0
- package/dist/planmagnet/controls/SyncControls.js +616 -0
- package/dist/planmagnet/controls/SyncControls.js.map +1 -0
- package/dist/planmagnet/index.d.ts +1 -0
- package/dist/planmagnet/index.d.ts.map +1 -1
- package/dist/planmagnet/index.js +1 -0
- package/dist/planmagnet/integrations/routes.d.ts +13 -0
- package/dist/planmagnet/integrations/routes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/routes.js +9 -0
- package/dist/planmagnet/integrations/routes.js.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts +143 -0
- package/dist/planmagnet/integrations/syncTypes.d.ts.map +1 -0
- package/dist/planmagnet/integrations/syncTypes.js +71 -0
- package/dist/planmagnet/integrations/syncTypes.js.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts +8 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.d.ts.map +1 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js +27 -0
- package/dist/planmagnet/integrations/useSyncProviderCapabilities.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js +411 -0
- package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js +593 -0
- package/dist/planmagnet/pages/IntegrationsSyncDetailPagePage.js.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js +267 -0
- package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import { throwOnError as e } from "../utils/mutationResult.js";
|
|
2
|
+
import { ConfirmButton as t, ErrorLine as n } from "./ConfirmButton.js";
|
|
3
|
+
import { enumLabel as r } from "./WorkItemControls.js";
|
|
4
|
+
import { isForbidden as i, mutationErrorMessage as a } from "../utils/graphqlErrors.js";
|
|
5
|
+
import { useSyncProviderCapabilities as o } from "../integrations/useSyncProviderCapabilities.js";
|
|
6
|
+
import { CONFLICT_RESOLUTIONS as s, GITHUB_FIELD_MAPPING_DEFAULTS as c, SYNC_DIRECTIONS as l, directionLabel as u, directionSupported as d, isValidGithubOwner as f, isValidGithubRepo as p, parseGithubFieldMapping as m } from "../integrations/syncTypes.js";
|
|
7
|
+
import { useState as h } from "react";
|
|
8
|
+
import { AlertTriangle as g, ChevronDown as _, ChevronUp as v, Loader2 as y, Pause as b, Pencil as ee, Play as x, PlugZap as S, X as C } from "lucide-react";
|
|
9
|
+
import { gql as w } from "@apollo/client";
|
|
10
|
+
import { useMutation as T, useQuery as te } from "@apollo/client/react";
|
|
11
|
+
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
12
|
+
import { Badge as k, Button as A, Input as j, ResponsiveDialog as ne, ResponsiveDialogContent as re, ResponsiveDialogDescription as ie, ResponsiveDialogFooter as ae, ResponsiveDialogHeader as oe, ResponsiveDialogTitle as se, ResponsiveDialogTrigger as ce, Textarea as le } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/planmagnet/controls/SyncControls.tsx
|
|
14
|
+
var M = ["SyncsList"], N = [
|
|
15
|
+
"SyncDetail",
|
|
16
|
+
"SyncRuns",
|
|
17
|
+
"SyncConflicts"
|
|
18
|
+
], P = {
|
|
19
|
+
IDLE: "secondary",
|
|
20
|
+
SYNCING: "info",
|
|
21
|
+
SUCCESS: "success",
|
|
22
|
+
FAILED: "destructive",
|
|
23
|
+
PAUSED: "warning",
|
|
24
|
+
DISABLED: "outline"
|
|
25
|
+
};
|
|
26
|
+
function F({ status: e }) {
|
|
27
|
+
return /* @__PURE__ */ D(k, {
|
|
28
|
+
variant: P[e] ?? "outline",
|
|
29
|
+
className: "text-xs",
|
|
30
|
+
children: r(e)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
var I = {
|
|
34
|
+
SUCCEEDED: "success",
|
|
35
|
+
FAILED: "destructive",
|
|
36
|
+
PARTIAL: "warning"
|
|
37
|
+
};
|
|
38
|
+
function L({ status: e }) {
|
|
39
|
+
return /* @__PURE__ */ D(k, {
|
|
40
|
+
variant: I[e] ?? "secondary",
|
|
41
|
+
className: "text-xs",
|
|
42
|
+
children: r(e)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function R({ status: e }) {
|
|
46
|
+
return /* @__PURE__ */ D(k, {
|
|
47
|
+
variant: e === "OPEN" ? "warning" : "secondary",
|
|
48
|
+
className: "text-xs",
|
|
49
|
+
children: r(e)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function z({ text: e, max: t = 140, className: n = "text-muted-foreground", testId: r }) {
|
|
53
|
+
let [i, a] = h(!1);
|
|
54
|
+
return e.length <= t ? /* @__PURE__ */ D("span", {
|
|
55
|
+
className: n,
|
|
56
|
+
children: e
|
|
57
|
+
}) : /* @__PURE__ */ O("span", {
|
|
58
|
+
"data-testid": r,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ D("span", {
|
|
61
|
+
className: n,
|
|
62
|
+
children: i ? e : `${e.slice(0, t)}…`
|
|
63
|
+
}),
|
|
64
|
+
" ",
|
|
65
|
+
/* @__PURE__ */ D("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
className: "inline-flex items-center gap-0.5 text-xs font-medium text-primary hover:underline",
|
|
68
|
+
"aria-expanded": i,
|
|
69
|
+
onClick: () => a((e) => !e),
|
|
70
|
+
children: i ? /* @__PURE__ */ O(E, { children: ["Show less ", /* @__PURE__ */ D(v, {
|
|
71
|
+
className: "h-3 w-3",
|
|
72
|
+
"aria-hidden": "true"
|
|
73
|
+
})] }) : /* @__PURE__ */ O(E, { children: ["Show more ", /* @__PURE__ */ D(_, {
|
|
74
|
+
className: "h-3 w-3",
|
|
75
|
+
"aria-hidden": "true"
|
|
76
|
+
})] })
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function B({ health: e }) {
|
|
82
|
+
return /* @__PURE__ */ O("div", {
|
|
83
|
+
className: "flex flex-wrap items-center gap-2 text-xs",
|
|
84
|
+
"data-testid": "sync-health",
|
|
85
|
+
children: [
|
|
86
|
+
e.lastRunAt ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O("span", {
|
|
87
|
+
className: "text-muted-foreground",
|
|
88
|
+
children: ["Last run ", new Date(e.lastRunAt).toLocaleString()]
|
|
89
|
+
}), e.lastStatus && /* @__PURE__ */ D(L, { status: e.lastStatus })] }) : /* @__PURE__ */ D("span", {
|
|
90
|
+
className: "text-muted-foreground",
|
|
91
|
+
children: "Never run"
|
|
92
|
+
}),
|
|
93
|
+
e.consecutiveFailures > 0 && /* @__PURE__ */ O("span", {
|
|
94
|
+
className: "inline-flex items-center gap-1 font-medium text-status-error-text",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ D(g, {
|
|
97
|
+
className: "h-3 w-3",
|
|
98
|
+
"aria-hidden": "true"
|
|
99
|
+
}),
|
|
100
|
+
e.consecutiveFailures,
|
|
101
|
+
" run",
|
|
102
|
+
e.consecutiveFailures === 1 ? "" : "s",
|
|
103
|
+
" failed in a row"
|
|
104
|
+
]
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ O("span", {
|
|
107
|
+
className: "text-muted-foreground",
|
|
108
|
+
children: [e.runsLast7Days, " run(s) in the last 7 days"]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
var V = w`
|
|
114
|
+
mutation SyncControlsStartSync($id: ID!) {
|
|
115
|
+
planmagnetStartSync(id: $id) {
|
|
116
|
+
syncId
|
|
117
|
+
success
|
|
118
|
+
itemsCreated
|
|
119
|
+
itemsUpdated
|
|
120
|
+
itemsSkipped
|
|
121
|
+
errorCount
|
|
122
|
+
errors
|
|
123
|
+
conflictCount
|
|
124
|
+
durationMs
|
|
125
|
+
syncedAt
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
function H({ syncId: t, onResult: r, size: o = "sm" }) {
|
|
130
|
+
let [s, c] = T(V, { refetchQueries: [...M, ...N] }), [l, u] = h(null), d = async () => {
|
|
131
|
+
u(null);
|
|
132
|
+
try {
|
|
133
|
+
let n = await e(s({ variables: { id: t } }));
|
|
134
|
+
n.data && r?.(n.data.planmagnetStartSync);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
u(i(e) ? "Your role can view integrations but not change them." : a(e, "The sync could not be started."));
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return /* @__PURE__ */ O("div", {
|
|
140
|
+
className: "flex flex-col items-start gap-1",
|
|
141
|
+
children: [/* @__PURE__ */ O(A, {
|
|
142
|
+
size: o,
|
|
143
|
+
variant: "outline",
|
|
144
|
+
disabled: c.loading,
|
|
145
|
+
onClick: () => void d(),
|
|
146
|
+
"data-testid": "sync-run-now",
|
|
147
|
+
children: [c.loading ? /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }) : /* @__PURE__ */ D(S, { className: "mr-1 h-4 w-4" }), "Run now"]
|
|
148
|
+
}), l && /* @__PURE__ */ D(n, { message: l })]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function ue({ result: e }) {
|
|
152
|
+
return /* @__PURE__ */ O("div", {
|
|
153
|
+
role: "status",
|
|
154
|
+
className: `space-y-1 rounded-md border p-3 text-sm ${e.success ? "border-border bg-muted text-status-success-text" : "border-destructive/40 text-status-error-text"}`,
|
|
155
|
+
"data-testid": "sync-run-result",
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ D("p", {
|
|
158
|
+
className: "font-medium",
|
|
159
|
+
children: e.success ? "Sync run succeeded." : "Sync run failed."
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ O("p", {
|
|
162
|
+
className: "text-xs text-muted-foreground",
|
|
163
|
+
children: [
|
|
164
|
+
e.itemsCreated,
|
|
165
|
+
" created · ",
|
|
166
|
+
e.itemsUpdated,
|
|
167
|
+
" updated · ",
|
|
168
|
+
e.itemsSkipped,
|
|
169
|
+
" ",
|
|
170
|
+
"skipped",
|
|
171
|
+
e.conflictCount > 0 ? ` · ${e.conflictCount} conflict${e.conflictCount === 1 ? "" : "s"}` : ""
|
|
172
|
+
]
|
|
173
|
+
}),
|
|
174
|
+
e.errors && e.errors.length > 0 && /* @__PURE__ */ D("ul", {
|
|
175
|
+
className: "list-disc space-y-0.5 pl-4 text-xs",
|
|
176
|
+
children: e.errors.map((e, t) => /* @__PURE__ */ D("li", { children: e }, t))
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
var U = w`
|
|
182
|
+
mutation SyncControlsPause($id: ID!) {
|
|
183
|
+
planmagnetPauseExternalSync(id: $id) {
|
|
184
|
+
id
|
|
185
|
+
status
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`, de = w`
|
|
189
|
+
mutation SyncControlsResume($id: ID!) {
|
|
190
|
+
planmagnetResumeExternalSync(id: $id) {
|
|
191
|
+
id
|
|
192
|
+
status
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
function W({ syncId: t, status: r }) {
|
|
197
|
+
let [o, s] = T(U, { refetchQueries: M }), [c, l] = T(de, { refetchQueries: M }), [u, d] = h(null), f = s.loading || l.loading, p = r === "PAUSED", m = async () => {
|
|
198
|
+
d(null);
|
|
199
|
+
try {
|
|
200
|
+
p ? await e(c({ variables: { id: t } })) : await e(o({ variables: { id: t } }));
|
|
201
|
+
} catch (e) {
|
|
202
|
+
d(i(e) ? "Your role can view integrations but not change them." : a(e, `The sync could not be ${p ? "resumed" : "paused"}.`));
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
return /* @__PURE__ */ O("div", {
|
|
206
|
+
className: "flex flex-col items-start gap-1",
|
|
207
|
+
children: [/* @__PURE__ */ O(A, {
|
|
208
|
+
size: "sm",
|
|
209
|
+
variant: "outline",
|
|
210
|
+
disabled: f,
|
|
211
|
+
onClick: () => void m(),
|
|
212
|
+
"data-testid": p ? "sync-resume" : "sync-pause",
|
|
213
|
+
children: [f ? /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }) : D(p ? x : b, { className: "mr-1 h-4 w-4" }), p ? "Resume" : "Pause"]
|
|
214
|
+
}), u && /* @__PURE__ */ D(n, { message: u })]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
var G = w`
|
|
218
|
+
mutation SyncControlsTest($id: ID!) {
|
|
219
|
+
planmagnetTestExternalSync(id: $id) {
|
|
220
|
+
ok
|
|
221
|
+
message
|
|
222
|
+
rateLimitRemaining
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
function K({ syncId: t }) {
|
|
227
|
+
let [r, o] = T(G), [s, c] = h(null), [l, u] = h(null), d = async () => {
|
|
228
|
+
u(null), c(null);
|
|
229
|
+
try {
|
|
230
|
+
let n = await e(r({ variables: { id: t } }));
|
|
231
|
+
n.data && c(n.data.planmagnetTestExternalSync);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
u(i(e) ? "Your role can view integrations but not change them." : a(e, "The connection could not be tested."));
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
return /* @__PURE__ */ O("div", {
|
|
237
|
+
className: "flex flex-col items-start gap-1",
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ O(A, {
|
|
240
|
+
size: "sm",
|
|
241
|
+
variant: "outline",
|
|
242
|
+
disabled: o.loading,
|
|
243
|
+
onClick: () => void d(),
|
|
244
|
+
"data-testid": "sync-test-connection",
|
|
245
|
+
children: [o.loading ? /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }) : null, "Test connection"]
|
|
246
|
+
}),
|
|
247
|
+
s && /* @__PURE__ */ O("p", {
|
|
248
|
+
className: `text-sm ${s.ok ? "text-status-success-text" : "text-status-error-text"}`,
|
|
249
|
+
"data-testid": "sync-test-result",
|
|
250
|
+
children: [
|
|
251
|
+
s.ok ? "Connected: " : "Failed: ",
|
|
252
|
+
s.message,
|
|
253
|
+
s.rateLimitRemaining !== null && ` (${s.rateLimitRemaining} calls remaining)`
|
|
254
|
+
]
|
|
255
|
+
}),
|
|
256
|
+
l && /* @__PURE__ */ D(n, { message: l })
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
var q = w`
|
|
261
|
+
mutation SyncControlsDelete($id: ID!) {
|
|
262
|
+
planmagnetDeleteExternalSync(id: $id)
|
|
263
|
+
}
|
|
264
|
+
`;
|
|
265
|
+
function J({ syncId: r, label: o, onDeleted: s }) {
|
|
266
|
+
let [c, { loading: l }] = T(q, { refetchQueries: M }), [u, d] = h(null), f = async () => {
|
|
267
|
+
d(null);
|
|
268
|
+
try {
|
|
269
|
+
await e(c({ variables: { id: r } })), s?.();
|
|
270
|
+
} catch (e) {
|
|
271
|
+
d(i(e) ? "Your role can view integrations but not change them." : a(e, "The sync could not be deleted."));
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
return /* @__PURE__ */ O("div", {
|
|
275
|
+
className: "flex flex-col items-end gap-1",
|
|
276
|
+
children: [/* @__PURE__ */ D(t, {
|
|
277
|
+
label: "Delete",
|
|
278
|
+
variant: "outline",
|
|
279
|
+
icon: /* @__PURE__ */ D(C, { className: "mr-1 h-4 w-4" }),
|
|
280
|
+
title: `Delete "${o}"?`,
|
|
281
|
+
description: "This stops the sync and removes its configuration and run/conflict history. Work items already created from it are kept.",
|
|
282
|
+
confirmLabel: "Delete sync",
|
|
283
|
+
destructive: !0,
|
|
284
|
+
disabled: l,
|
|
285
|
+
onConfirm: () => void f(),
|
|
286
|
+
testId: "sync-delete"
|
|
287
|
+
}), u && /* @__PURE__ */ D(n, { message: u })]
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
var fe = w`
|
|
291
|
+
mutation SyncControlsResolveConflict($id: ID!, $resolution: PlanmagnetSyncConflictResolution!) {
|
|
292
|
+
planmagnetResolveSyncConflict(id: $id, resolution: $resolution) {
|
|
293
|
+
id
|
|
294
|
+
status
|
|
295
|
+
resolution
|
|
296
|
+
resolvedAt
|
|
297
|
+
resolvedBy
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
`;
|
|
301
|
+
function Y({ conflictId: t }) {
|
|
302
|
+
let [r, o] = T(fe, { refetchQueries: N }), [s, c] = h(null), [l, u] = h(null), d = async (n) => {
|
|
303
|
+
c(null), u(n);
|
|
304
|
+
try {
|
|
305
|
+
await e(r({ variables: {
|
|
306
|
+
id: t,
|
|
307
|
+
resolution: n
|
|
308
|
+
} }));
|
|
309
|
+
} catch (e) {
|
|
310
|
+
c(i(e) ? "Your role can view integrations but not change them." : a(e, "The conflict could not be resolved."));
|
|
311
|
+
} finally {
|
|
312
|
+
u(null);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
return /* @__PURE__ */ O("div", {
|
|
316
|
+
className: "flex flex-col items-start gap-1",
|
|
317
|
+
"data-testid": "sync-conflict-resolve",
|
|
318
|
+
children: [/* @__PURE__ */ O("div", {
|
|
319
|
+
className: "flex flex-wrap gap-2",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ O(A, {
|
|
322
|
+
size: "sm",
|
|
323
|
+
disabled: o.loading,
|
|
324
|
+
onClick: () => void d("SOURCE_WINS"),
|
|
325
|
+
"data-testid": "sync-conflict-keep-local",
|
|
326
|
+
children: [l === "SOURCE_WINS" && /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }), "Keep PlanMagnet"]
|
|
327
|
+
}),
|
|
328
|
+
/* @__PURE__ */ O(A, {
|
|
329
|
+
size: "sm",
|
|
330
|
+
variant: "outline",
|
|
331
|
+
disabled: o.loading,
|
|
332
|
+
onClick: () => void d("TARGET_WINS"),
|
|
333
|
+
"data-testid": "sync-conflict-take-provider",
|
|
334
|
+
children: [l === "TARGET_WINS" && /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }), "Take provider"]
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ O(A, {
|
|
337
|
+
size: "sm",
|
|
338
|
+
variant: "ghost",
|
|
339
|
+
disabled: o.loading,
|
|
340
|
+
onClick: () => void d("MANUAL"),
|
|
341
|
+
"data-testid": "sync-conflict-dismiss",
|
|
342
|
+
children: [l === "MANUAL" && /* @__PURE__ */ D(y, { className: "mr-1 h-4 w-4 animate-spin" }), "Dismiss (manual)"]
|
|
343
|
+
})
|
|
344
|
+
]
|
|
345
|
+
}), s && /* @__PURE__ */ D(n, { message: s })]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
var pe = {
|
|
349
|
+
SOURCE_WINS: "PlanMagnet wins — the local work item overwrites the provider on a detected conflict.",
|
|
350
|
+
TARGET_WINS: "Provider wins — the external tool overwrites PlanMagnet on a detected conflict.",
|
|
351
|
+
MANUAL: "Flag and skip — a conflict is recorded and left alone until resolved here."
|
|
352
|
+
}, me = "mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm", he = w`
|
|
353
|
+
query SyncControlsConnection($id: ID!) {
|
|
354
|
+
planmagnetExternalSync(id: $id) {
|
|
355
|
+
id
|
|
356
|
+
connectionConfig
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
`, ge = w`
|
|
360
|
+
mutation SyncControlsUpdate($id: ID!, $input: PlanmagnetUpdateExternalSyncInput!) {
|
|
361
|
+
planmagnetUpdateExternalSync(id: $id, input: $input) {
|
|
362
|
+
id
|
|
363
|
+
direction
|
|
364
|
+
conflictStrategy
|
|
365
|
+
fieldMapping
|
|
366
|
+
syncFilters
|
|
367
|
+
externalProjectId
|
|
368
|
+
externalProjectUrl
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
`;
|
|
372
|
+
function X({ sync: t }) {
|
|
373
|
+
let [g, _] = h(!1), v = t.provider === "GITHUB", { capabilities: y } = o(), b = y.find((e) => e.provider === t.provider), x = b ? l.filter((e) => d(b, e)) : l, S = m(t.fieldMapping), C = t.syncFilters ? JSON.stringify(t.syncFilters, null, 2) : "", [w, E] = h(t.direction), [k, P] = h(t.conflictStrategy), [F, I] = h(S.priority), [L, R] = h(S.dueDate), [z, B] = h(C), [V, H] = h(null), [ue, U] = h(""), [de, W] = h(""), [G, K] = h(""), [q, J] = h(null), { data: fe } = te(he, {
|
|
374
|
+
variables: { id: t.id },
|
|
375
|
+
skip: !g || !v
|
|
376
|
+
}), Y = fe?.planmagnetExternalSync?.connectionConfig, X = typeof Y?.owner == "string" ? Y.owner : "", _e = typeof Y?.repo == "string" ? Y.repo : "", Z = ue || X, Q = de || _e, ve = () => {
|
|
377
|
+
E(t.direction), P(t.conflictStrategy), I(S.priority), R(S.dueDate), B(C), H(null), U(""), W(""), K(""), J(null);
|
|
378
|
+
}, [ye, $] = T(ge, { refetchQueries: [...M, ...N] }), be = v && !!Y && (Z !== X || Q !== _e || G.trim() !== ""), xe = F.trim() !== S.priority || L.trim() !== S.dueDate, Se = z.trim() !== C.trim(), Ce = async () => {
|
|
379
|
+
J(null), H(null);
|
|
380
|
+
let n = {};
|
|
381
|
+
if (w !== t.direction && (n.direction = w), k !== t.conflictStrategy && (n.conflictStrategy = k), xe && (n.fieldMapping = {
|
|
382
|
+
...F.trim() ? { priority: F.trim() } : {},
|
|
383
|
+
...L.trim() ? { dueDate: L.trim() } : {}
|
|
384
|
+
}), Se) {
|
|
385
|
+
let e = z.trim();
|
|
386
|
+
if (!e) n.syncFilters = null;
|
|
387
|
+
else try {
|
|
388
|
+
n.syncFilters = JSON.parse(e);
|
|
389
|
+
} catch {
|
|
390
|
+
H("Sync filters must be valid JSON.");
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (be) {
|
|
395
|
+
if (!G.trim() || !Z.trim() || !Q.trim()) {
|
|
396
|
+
J("Changing the owner, repo or token requires all three — re-enter the token too.");
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (!f(Z) || !p(Q)) {
|
|
400
|
+
J("Owner and repo must look like real GitHub names (letters, digits, \"-\", \"_\", \".\").");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
n.connectionConfig = {
|
|
404
|
+
token: G.trim(),
|
|
405
|
+
owner: Z.trim(),
|
|
406
|
+
repo: Q.trim()
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
if (Object.keys(n).length === 0) {
|
|
410
|
+
_(!1);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
await e(ye({ variables: {
|
|
415
|
+
id: t.id,
|
|
416
|
+
input: n
|
|
417
|
+
} })), _(!1);
|
|
418
|
+
} catch (e) {
|
|
419
|
+
J(i(e) ? "Your role can view integrations but not change them." : a(e, "The sync could not be saved."));
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
return /* @__PURE__ */ O(ne, {
|
|
423
|
+
open: g,
|
|
424
|
+
onOpenChange: (e) => {
|
|
425
|
+
_(e), e || ve();
|
|
426
|
+
},
|
|
427
|
+
children: [/* @__PURE__ */ D(ce, {
|
|
428
|
+
asChild: !0,
|
|
429
|
+
children: /* @__PURE__ */ O(A, {
|
|
430
|
+
size: "sm",
|
|
431
|
+
variant: "outline",
|
|
432
|
+
"data-testid": "sync-edit-settings",
|
|
433
|
+
children: [/* @__PURE__ */ D(ee, { className: "mr-1 h-4 w-4" }), "Edit settings"]
|
|
434
|
+
})
|
|
435
|
+
}), /* @__PURE__ */ O(re, {
|
|
436
|
+
className: "max-w-lg max-h-[85vh] overflow-y-auto",
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ O(oe, { children: [/* @__PURE__ */ D(se, { children: "Edit sync settings" }), /* @__PURE__ */ D(ie, { children: "Only changed fields are saved." })] }),
|
|
439
|
+
/* @__PURE__ */ O("div", {
|
|
440
|
+
className: "space-y-4",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("span", {
|
|
443
|
+
className: "text-sm font-medium",
|
|
444
|
+
children: "Direction"
|
|
445
|
+
}), /* @__PURE__ */ D("div", {
|
|
446
|
+
className: "mt-1 flex flex-col gap-1",
|
|
447
|
+
role: "radiogroup",
|
|
448
|
+
"aria-label": "Direction",
|
|
449
|
+
children: x.map((e) => /* @__PURE__ */ O("label", {
|
|
450
|
+
className: "flex items-center gap-2 text-sm",
|
|
451
|
+
children: [/* @__PURE__ */ D("input", {
|
|
452
|
+
type: "radio",
|
|
453
|
+
name: "sync-edit-direction",
|
|
454
|
+
checked: w === e,
|
|
455
|
+
onChange: () => E(e)
|
|
456
|
+
}), u(e)]
|
|
457
|
+
}, e))
|
|
458
|
+
})] }),
|
|
459
|
+
/* @__PURE__ */ O("div", { children: [
|
|
460
|
+
/* @__PURE__ */ D("label", {
|
|
461
|
+
htmlFor: "sync-edit-strategy",
|
|
462
|
+
className: "text-sm font-medium",
|
|
463
|
+
children: "Conflict strategy"
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ D("select", {
|
|
466
|
+
id: "sync-edit-strategy",
|
|
467
|
+
className: me,
|
|
468
|
+
value: k,
|
|
469
|
+
onChange: (e) => P(e.target.value),
|
|
470
|
+
children: s.map((e) => /* @__PURE__ */ D("option", {
|
|
471
|
+
value: e,
|
|
472
|
+
children: r(e)
|
|
473
|
+
}, e))
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ D("p", {
|
|
476
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
477
|
+
children: pe[k]
|
|
478
|
+
})
|
|
479
|
+
] }),
|
|
480
|
+
v && /* @__PURE__ */ O("div", {
|
|
481
|
+
className: "space-y-2 rounded-md border p-3",
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ D("p", {
|
|
484
|
+
className: "text-sm font-medium",
|
|
485
|
+
children: "Field mapping (GitHub labels)"
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ O("p", {
|
|
488
|
+
className: "text-xs text-muted-foreground",
|
|
489
|
+
children: [
|
|
490
|
+
"GitHub issues have no native priority or due-date field — PlanMagnet encodes each as a label of the form ",
|
|
491
|
+
/* @__PURE__ */ D("code", { children: "prefix+value" }),
|
|
492
|
+
" (e.g. ",
|
|
493
|
+
/* @__PURE__ */ D("code", { children: "priority:HIGH" }),
|
|
494
|
+
"). Leave blank to use the built-in prefix."
|
|
495
|
+
]
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ O("label", {
|
|
498
|
+
htmlFor: "sync-edit-priority-prefix",
|
|
499
|
+
className: "text-xs text-muted-foreground",
|
|
500
|
+
children: [
|
|
501
|
+
"Priority label prefix (default \"",
|
|
502
|
+
c.priority,
|
|
503
|
+
"\")"
|
|
504
|
+
]
|
|
505
|
+
}), /* @__PURE__ */ D(j, {
|
|
506
|
+
id: "sync-edit-priority-prefix",
|
|
507
|
+
className: "mt-1",
|
|
508
|
+
placeholder: c.priority,
|
|
509
|
+
value: F,
|
|
510
|
+
onChange: (e) => I(e.target.value)
|
|
511
|
+
})] }),
|
|
512
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ O("label", {
|
|
513
|
+
htmlFor: "sync-edit-duedate-prefix",
|
|
514
|
+
className: "text-xs text-muted-foreground",
|
|
515
|
+
children: [
|
|
516
|
+
"Due-date label prefix (default \"",
|
|
517
|
+
c.dueDate,
|
|
518
|
+
"\")"
|
|
519
|
+
]
|
|
520
|
+
}), /* @__PURE__ */ D(j, {
|
|
521
|
+
id: "sync-edit-duedate-prefix",
|
|
522
|
+
className: "mt-1",
|
|
523
|
+
placeholder: c.dueDate,
|
|
524
|
+
value: L,
|
|
525
|
+
onChange: (e) => R(e.target.value)
|
|
526
|
+
})] })
|
|
527
|
+
]
|
|
528
|
+
}),
|
|
529
|
+
/* @__PURE__ */ O("div", { children: [
|
|
530
|
+
/* @__PURE__ */ D("label", {
|
|
531
|
+
htmlFor: "sync-edit-filters",
|
|
532
|
+
className: "text-sm font-medium",
|
|
533
|
+
children: "Sync filters (advanced, JSON)"
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ D("p", {
|
|
536
|
+
className: "text-xs text-muted-foreground",
|
|
537
|
+
children: "Stored on the sync but not yet read by any run — reserved for a future filtering feature. Leave blank unless you know you need this."
|
|
538
|
+
}),
|
|
539
|
+
/* @__PURE__ */ D(le, {
|
|
540
|
+
id: "sync-edit-filters",
|
|
541
|
+
className: "mt-1 font-mono text-xs min-h-[72px]",
|
|
542
|
+
value: z,
|
|
543
|
+
onChange: (e) => B(e.target.value)
|
|
544
|
+
}),
|
|
545
|
+
V && /* @__PURE__ */ D(n, { message: V })
|
|
546
|
+
] }),
|
|
547
|
+
v && /* @__PURE__ */ O("div", {
|
|
548
|
+
className: "space-y-2 rounded-md border p-3",
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ D("p", {
|
|
551
|
+
className: "text-sm font-medium",
|
|
552
|
+
children: "Replace connection"
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ D("p", {
|
|
555
|
+
className: "text-xs text-muted-foreground",
|
|
556
|
+
children: "The token is never shown once saved. Changing the owner, repo or token requires re-entering all three — PlanMagnet cannot resend the stored token for you."
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("label", {
|
|
559
|
+
htmlFor: "sync-edit-owner",
|
|
560
|
+
className: "text-xs text-muted-foreground",
|
|
561
|
+
children: "Owner"
|
|
562
|
+
}), /* @__PURE__ */ D(j, {
|
|
563
|
+
id: "sync-edit-owner",
|
|
564
|
+
className: "mt-1",
|
|
565
|
+
value: Z,
|
|
566
|
+
onChange: (e) => U(e.target.value)
|
|
567
|
+
})] }),
|
|
568
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("label", {
|
|
569
|
+
htmlFor: "sync-edit-repo",
|
|
570
|
+
className: "text-xs text-muted-foreground",
|
|
571
|
+
children: "Repository"
|
|
572
|
+
}), /* @__PURE__ */ D(j, {
|
|
573
|
+
id: "sync-edit-repo",
|
|
574
|
+
className: "mt-1",
|
|
575
|
+
value: Q,
|
|
576
|
+
onChange: (e) => W(e.target.value)
|
|
577
|
+
})] }),
|
|
578
|
+
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("label", {
|
|
579
|
+
htmlFor: "sync-edit-token",
|
|
580
|
+
className: "text-xs text-muted-foreground",
|
|
581
|
+
children: "Replace token"
|
|
582
|
+
}), /* @__PURE__ */ D(j, {
|
|
583
|
+
id: "sync-edit-token",
|
|
584
|
+
type: "password",
|
|
585
|
+
autoComplete: "off",
|
|
586
|
+
className: "mt-1",
|
|
587
|
+
placeholder: "Leave blank to keep the current token",
|
|
588
|
+
value: G,
|
|
589
|
+
onChange: (e) => K(e.target.value),
|
|
590
|
+
"data-testid": "sync-edit-token"
|
|
591
|
+
})] })
|
|
592
|
+
]
|
|
593
|
+
}),
|
|
594
|
+
q && /* @__PURE__ */ D(n, { message: q })
|
|
595
|
+
]
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ O(ae, { children: [/* @__PURE__ */ D(A, {
|
|
598
|
+
variant: "outline",
|
|
599
|
+
onClick: () => {
|
|
600
|
+
ve(), _(!1);
|
|
601
|
+
},
|
|
602
|
+
children: "Cancel"
|
|
603
|
+
}), /* @__PURE__ */ D(A, {
|
|
604
|
+
onClick: () => void Ce(),
|
|
605
|
+
disabled: $.loading,
|
|
606
|
+
"data-testid": "sync-edit-submit",
|
|
607
|
+
children: $.loading ? "Saving…" : "Save"
|
|
608
|
+
})] })
|
|
609
|
+
]
|
|
610
|
+
})]
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
//#endregion
|
|
614
|
+
export { pe as CONFLICT_STRATEGY_EXPLANATION, Y as ConflictResolveActions, R as ConflictStatusBadge, J as DeleteSyncButton, X as EditSyncDialog, W as PauseResumeButton, H as RunNowButton, B as SyncHealthSummary, ue as SyncRunResultSummary, L as SyncRunStatusBadge, F as SyncStatusBadge, K as TestConnectionButton, z as TruncatedText };
|
|
615
|
+
|
|
616
|
+
//# sourceMappingURL=SyncControls.js.map
|