@burdenoff/microfe-planmagnet 2026.930.8 → 2026.930.10
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/planmagnet/PlanMagnetRoot.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoot.js +126 -120
- package/dist/planmagnet/PlanMagnetRoot.js.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +83 -75
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/dependency/DependencyGraph.d.ts +43 -0
- package/dist/planmagnet/dependency/DependencyGraph.d.ts.map +1 -0
- package/dist/planmagnet/dependency/DependencyGraph.js +225 -0
- package/dist/planmagnet/dependency/DependencyGraph.js.map +1 -0
- package/dist/planmagnet/dependency/DependencyPanel.d.ts.map +1 -1
- package/dist/planmagnet/dependency/DependencyPanel.js +136 -90
- package/dist/planmagnet/dependency/DependencyPanel.js.map +1 -1
- package/dist/planmagnet/dependency/GanttChart.d.ts +40 -0
- package/dist/planmagnet/dependency/GanttChart.d.ts.map +1 -0
- package/dist/planmagnet/dependency/GanttChart.js +326 -0
- package/dist/planmagnet/dependency/GanttChart.js.map +1 -0
- package/dist/planmagnet/dependency/useProjectWorkItemsGraph.d.ts +40 -0
- package/dist/planmagnet/dependency/useProjectWorkItemsGraph.d.ts.map +1 -0
- package/dist/planmagnet/dependency/useProjectWorkItemsGraph.js +106 -0
- package/dist/planmagnet/dependency/useProjectWorkItemsGraph.js.map +1 -0
- package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.js +169 -100
- package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.js.map +1 -1
- package/dist/planmagnet/pages/ProjectsGanttPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/ProjectsGanttPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/ProjectsGanttPagePage.js +143 -0
- package/dist/planmagnet/pages/ProjectsGanttPagePage.js.map +1 -0
- package/dist/planmagnet/pages/TasksTasksPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/TasksTasksPagePage.js +63 -48
- package/dist/planmagnet/pages/TasksTasksPagePage.js.map +1 -1
- package/dist/planmagnet/utils/rowNavigation.d.ts +7 -2
- package/dist/planmagnet/utils/rowNavigation.d.ts.map +1 -1
- package/dist/planmagnet/utils/rowNavigation.js.map +1 -1
- package/dist/planmagnet/utils/statusColor.d.ts +26 -0
- package/dist/planmagnet/utils/statusColor.d.ts.map +1 -0
- package/dist/planmagnet/utils/statusColor.js +51 -0
- package/dist/planmagnet/utils/statusColor.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,19 +3,20 @@ import { throwOnError as t } from "../utils/mutationResult.js";
|
|
|
3
3
|
import { ErrorLine as n } from "../controls/ConfirmButton.js";
|
|
4
4
|
import { WorkItemSearchSelect as r } from "../controls/Pickers.js";
|
|
5
5
|
import { enumLabel as i } from "../controls/WorkItemControls.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { DependencyGraph as a } from "./DependencyGraph.js";
|
|
7
|
+
import { useState as o } from "react";
|
|
8
|
+
import { ArrowLeft as s, ArrowRight as c, Plus as l, X as u } from "lucide-react";
|
|
9
|
+
import { gql as d } from "@apollo/client";
|
|
10
|
+
import { useMutation as f, useQuery as p } from "@apollo/client/react";
|
|
11
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
|
+
import { Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b } from "@burdenoff/fe-libs/ui";
|
|
12
13
|
//#region src/planmagnet/dependency/DependencyPanel.tsx
|
|
13
|
-
var
|
|
14
|
+
var x = [
|
|
14
15
|
"FINISH_TO_START",
|
|
15
16
|
"START_TO_START",
|
|
16
17
|
"FINISH_TO_FINISH",
|
|
17
18
|
"START_TO_FINISH"
|
|
18
|
-
],
|
|
19
|
+
], S = d`
|
|
19
20
|
query GetWorkItemDependencies($workspaceId: ID!, $workItemId: String!) {
|
|
20
21
|
blocks: planmagnetDependencies(
|
|
21
22
|
workspaceId: $workspaceId
|
|
@@ -33,6 +34,7 @@ var b = [
|
|
|
33
34
|
id
|
|
34
35
|
title
|
|
35
36
|
key
|
|
37
|
+
status
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
totalCount
|
|
@@ -53,100 +55,110 @@ var b = [
|
|
|
53
55
|
id
|
|
54
56
|
title
|
|
55
57
|
key
|
|
58
|
+
status
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
totalCount
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
`,
|
|
64
|
+
`, C = d`
|
|
65
|
+
query GetDependencyGraphCenter($id: ID!) {
|
|
66
|
+
planmagnetWorkItem(id: $id) {
|
|
67
|
+
id
|
|
68
|
+
key
|
|
69
|
+
title
|
|
70
|
+
status
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`, w = d`
|
|
62
74
|
mutation CreateWorkItemDependency($input: PlanmagnetCreateDependencyInput!) {
|
|
63
75
|
planmagnetCreateDependency(input: $input) {
|
|
64
76
|
id
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
|
-
`,
|
|
79
|
+
`, T = d`
|
|
68
80
|
mutation DeleteWorkItemDependency($id: ID!) {
|
|
69
81
|
planmagnetDeleteDependency(id: $id)
|
|
70
82
|
}
|
|
71
83
|
`;
|
|
72
|
-
function
|
|
84
|
+
function E(e) {
|
|
73
85
|
if (!e) return null;
|
|
74
86
|
let t = e / 60, n = t / 24, r = e > 0 ? "lag" : "lead";
|
|
75
87
|
return Number.isInteger(n) && Math.abs(n) >= 1 ? `${Math.abs(n)}d ${r}` : Number.isInteger(t) ? `${Math.abs(t)}h ${r}` : `${Math.abs(e)}m ${r}`;
|
|
76
88
|
}
|
|
77
|
-
function
|
|
78
|
-
let c =
|
|
79
|
-
return /* @__PURE__ */
|
|
89
|
+
function D({ keyLabel: e, title: t, type: n, lagMinutes: r, onOpen: a, onRemove: o, removing: s }) {
|
|
90
|
+
let c = E(r);
|
|
91
|
+
return /* @__PURE__ */ h("div", {
|
|
80
92
|
className: "flex items-center justify-between gap-3 rounded-md border border-input p-3",
|
|
81
|
-
children: [/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ h("div", {
|
|
82
94
|
className: "min-w-0",
|
|
83
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ h("button", {
|
|
84
96
|
type: "button",
|
|
85
97
|
className: "block max-w-full truncate text-left text-sm font-medium hover:underline",
|
|
86
98
|
onClick: a,
|
|
87
99
|
children: [
|
|
88
100
|
e,
|
|
89
101
|
" ",
|
|
90
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ m("span", {
|
|
91
103
|
className: "font-normal",
|
|
92
104
|
children: t
|
|
93
105
|
})
|
|
94
106
|
]
|
|
95
|
-
}), /* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ h("p", {
|
|
96
108
|
className: "text-xs text-muted-foreground",
|
|
97
109
|
children: [i(n), c ? ` · ${c}` : ""]
|
|
98
110
|
})]
|
|
99
|
-
}), /* @__PURE__ */
|
|
111
|
+
}), /* @__PURE__ */ m(g, {
|
|
100
112
|
size: "icon",
|
|
101
113
|
variant: "ghost",
|
|
102
114
|
disabled: s,
|
|
103
115
|
onClick: o,
|
|
104
116
|
"aria-label": `Remove dependency on ${t}`,
|
|
105
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ m(u, { className: "h-4 w-4" })
|
|
106
118
|
})]
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
|
-
function
|
|
110
|
-
let [l, u] =
|
|
121
|
+
function O({ workItemId: e, projectId: a, excludeIds: s, onDone: c }) {
|
|
122
|
+
let [l, u] = o("blocks"), [d, p] = o(""), [_, v] = o("FINISH_TO_START"), [y, b] = o(""), [S, C] = o(null), [T, { loading: E }] = f(w, {
|
|
111
123
|
refetchQueries: ["GetWorkItemDependencies", "GetProjectCriticalPath"],
|
|
112
124
|
awaitRefetchQueries: !0
|
|
113
125
|
}), D = async () => {
|
|
114
|
-
if (!
|
|
115
|
-
|
|
126
|
+
if (!d) return;
|
|
127
|
+
C(null);
|
|
116
128
|
let n = y.trim(), r = n === "" ? void 0 : Math.round(Number(n) * 24 * 60);
|
|
117
129
|
if (n !== "" && !Number.isFinite(r)) {
|
|
118
|
-
|
|
130
|
+
C("Lag must be a number of days.");
|
|
119
131
|
return;
|
|
120
132
|
}
|
|
121
133
|
let i = l === "blocks" ? {
|
|
122
134
|
predecessorId: e,
|
|
123
|
-
successorId:
|
|
135
|
+
successorId: d,
|
|
124
136
|
type: _,
|
|
125
137
|
lagMinutes: r
|
|
126
138
|
} : {
|
|
127
|
-
predecessorId:
|
|
139
|
+
predecessorId: d,
|
|
128
140
|
successorId: e,
|
|
129
141
|
type: _,
|
|
130
142
|
lagMinutes: r
|
|
131
143
|
};
|
|
132
144
|
try {
|
|
133
|
-
await t(T({ variables: { input: i } })),
|
|
145
|
+
await t(T({ variables: { input: i } })), p(""), b(""), c();
|
|
134
146
|
} catch (e) {
|
|
135
|
-
|
|
147
|
+
C(e instanceof Error ? e.message : "The dependency could not be created.");
|
|
136
148
|
}
|
|
137
149
|
};
|
|
138
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ h("div", {
|
|
139
151
|
className: "space-y-3 rounded-md border border-input p-3",
|
|
140
152
|
children: [
|
|
141
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ h("div", {
|
|
142
154
|
className: "flex gap-1",
|
|
143
|
-
children: [/* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ m("button", {
|
|
144
156
|
type: "button",
|
|
145
157
|
"data-testid": "dependency-direction-blocks",
|
|
146
158
|
className: `px-3 py-1.5 text-xs rounded-md ${l === "blocks" ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted"}`,
|
|
147
159
|
onClick: () => u("blocks"),
|
|
148
160
|
children: "This blocks…"
|
|
149
|
-
}), /* @__PURE__ */
|
|
161
|
+
}), /* @__PURE__ */ m("button", {
|
|
150
162
|
type: "button",
|
|
151
163
|
"data-testid": "dependency-direction-blockedby",
|
|
152
164
|
className: `px-3 py-1.5 text-xs rounded-md ${l === "blockedBy" ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted"}`,
|
|
@@ -154,53 +166,53 @@ function E({ workItemId: e, projectId: o, excludeIds: s, onDone: c }) {
|
|
|
154
166
|
children: "Blocked by…"
|
|
155
167
|
})]
|
|
156
168
|
}),
|
|
157
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ m(r, {
|
|
158
170
|
id: "dependency-other-work-item",
|
|
159
|
-
projectId:
|
|
160
|
-
value:
|
|
161
|
-
onChange:
|
|
171
|
+
projectId: a,
|
|
172
|
+
value: d,
|
|
173
|
+
onChange: p,
|
|
162
174
|
exclude: s
|
|
163
175
|
}),
|
|
164
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ h("div", {
|
|
165
177
|
className: "grid grid-cols-2 gap-3",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
167
179
|
htmlFor: "dependency-type",
|
|
168
180
|
className: "text-xs font-medium text-muted-foreground",
|
|
169
181
|
children: "Relationship"
|
|
170
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ m("select", {
|
|
171
183
|
id: "dependency-type",
|
|
172
184
|
className: "mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",
|
|
173
185
|
value: _,
|
|
174
186
|
onChange: (e) => v(e.target.value),
|
|
175
|
-
children:
|
|
187
|
+
children: x.map((e) => /* @__PURE__ */ m("option", {
|
|
176
188
|
value: e,
|
|
177
189
|
children: i(e)
|
|
178
190
|
}, e))
|
|
179
|
-
})] }), /* @__PURE__ */
|
|
191
|
+
})] }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
180
192
|
htmlFor: "dependency-lag",
|
|
181
193
|
className: "text-xs font-medium text-muted-foreground",
|
|
182
194
|
children: "Lag (days, optional)"
|
|
183
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ m("input", {
|
|
184
196
|
id: "dependency-lag",
|
|
185
197
|
type: "number",
|
|
186
198
|
step: "0.5",
|
|
187
199
|
className: "mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",
|
|
188
200
|
value: y,
|
|
189
201
|
placeholder: "0",
|
|
190
|
-
onChange: (e) =>
|
|
202
|
+
onChange: (e) => b(e.target.value)
|
|
191
203
|
})] })]
|
|
192
204
|
}),
|
|
193
|
-
|
|
194
|
-
/* @__PURE__ */
|
|
205
|
+
S && /* @__PURE__ */ m(n, { message: S }),
|
|
206
|
+
/* @__PURE__ */ h("div", {
|
|
195
207
|
className: "flex justify-end gap-2",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
208
|
+
children: [/* @__PURE__ */ m(g, {
|
|
197
209
|
size: "sm",
|
|
198
210
|
variant: "ghost",
|
|
199
211
|
onClick: c,
|
|
200
212
|
children: "Cancel"
|
|
201
|
-
}), /* @__PURE__ */
|
|
213
|
+
}), /* @__PURE__ */ m(g, {
|
|
202
214
|
size: "sm",
|
|
203
|
-
disabled: !
|
|
215
|
+
disabled: !d || E,
|
|
204
216
|
onClick: () => void D(),
|
|
205
217
|
children: E ? "Adding…" : "Add dependency"
|
|
206
218
|
})]
|
|
@@ -208,103 +220,137 @@ function E({ workItemId: e, projectId: o, excludeIds: s, onDone: c }) {
|
|
|
208
220
|
]
|
|
209
221
|
});
|
|
210
222
|
}
|
|
211
|
-
function
|
|
212
|
-
let
|
|
223
|
+
function k({ workspaceId: r, workItemId: i, projectId: u }) {
|
|
224
|
+
let d = e(), [x, w] = o(!1), [E, k] = o(null), { data: A, loading: j, error: M, refetch: N } = p(S, {
|
|
213
225
|
variables: {
|
|
214
226
|
workspaceId: r,
|
|
215
227
|
workItemId: i
|
|
216
228
|
},
|
|
217
229
|
skip: !r || !i
|
|
218
|
-
}),
|
|
230
|
+
}), { data: P, error: F } = p(C, {
|
|
231
|
+
variables: { id: i },
|
|
232
|
+
skip: !i
|
|
233
|
+
}), [I, { loading: L }] = f(T, { refetchQueries: ["GetWorkItemDependencies", "GetProjectCriticalPath"] }), R = A?.blocks.items ?? [], z = A?.blockedBy.items ?? [], B = [
|
|
219
234
|
i,
|
|
220
|
-
...
|
|
221
|
-
...
|
|
222
|
-
],
|
|
223
|
-
|
|
235
|
+
...R.map((e) => e.successorId),
|
|
236
|
+
...z.map((e) => e.predecessorId)
|
|
237
|
+
], V = P?.planmagnetWorkItem ?? null, H = /* @__PURE__ */ new Map();
|
|
238
|
+
V && H.set(V.id, V);
|
|
239
|
+
for (let e of R) e.successor && H.set(e.successor.id, e.successor);
|
|
240
|
+
for (let e of z) e.predecessor && H.set(e.predecessor.id, e.predecessor);
|
|
241
|
+
let U = V ? [...R.map((e) => ({
|
|
242
|
+
id: e.id,
|
|
243
|
+
predecessorId: V.id,
|
|
244
|
+
successorId: e.successorId,
|
|
245
|
+
type: e.type,
|
|
246
|
+
lagMinutes: e.lagMinutes
|
|
247
|
+
})), ...z.map((e) => ({
|
|
248
|
+
id: e.id,
|
|
249
|
+
predecessorId: e.predecessorId,
|
|
250
|
+
successorId: V.id,
|
|
251
|
+
type: e.type,
|
|
252
|
+
lagMinutes: e.lagMinutes
|
|
253
|
+
}))] : [], W = async (e) => {
|
|
254
|
+
k(null);
|
|
224
255
|
try {
|
|
225
|
-
await t(
|
|
256
|
+
await t(I({ variables: { id: e } }));
|
|
226
257
|
} catch (e) {
|
|
227
|
-
|
|
258
|
+
k(e instanceof Error ? e.message : "The dependency could not be removed.");
|
|
228
259
|
}
|
|
229
260
|
};
|
|
230
|
-
return /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ h(_, { children: [/* @__PURE__ */ h(y, {
|
|
231
262
|
className: "flex flex-row items-center justify-between space-y-0",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ m(b, { children: "Dependencies" }), !x && /* @__PURE__ */ h(g, {
|
|
233
264
|
size: "sm",
|
|
234
265
|
variant: "outline",
|
|
235
|
-
onClick: () =>
|
|
236
|
-
children: [/* @__PURE__ */
|
|
266
|
+
onClick: () => w(!0),
|
|
267
|
+
children: [/* @__PURE__ */ m(l, { className: "h-4 w-4 mr-1" }), "Add dependency"]
|
|
237
268
|
})]
|
|
238
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ h(v, {
|
|
239
270
|
className: "space-y-4",
|
|
240
271
|
children: [
|
|
241
|
-
|
|
272
|
+
x && /* @__PURE__ */ m(O, {
|
|
242
273
|
workItemId: i,
|
|
243
|
-
projectId:
|
|
244
|
-
excludeIds:
|
|
274
|
+
projectId: u,
|
|
275
|
+
excludeIds: B,
|
|
245
276
|
onDone: () => {
|
|
246
|
-
|
|
277
|
+
w(!1), N();
|
|
247
278
|
}
|
|
248
279
|
}),
|
|
249
|
-
|
|
280
|
+
j && !A && /* @__PURE__ */ m("p", {
|
|
250
281
|
className: "text-sm text-muted-foreground",
|
|
251
282
|
children: "Loading dependencies…"
|
|
252
283
|
}),
|
|
253
|
-
|
|
284
|
+
M && /* @__PURE__ */ h("p", {
|
|
254
285
|
className: "text-sm text-red-500",
|
|
255
|
-
children: ["Error: ",
|
|
286
|
+
children: ["Error: ", M.message]
|
|
256
287
|
}),
|
|
257
|
-
|
|
258
|
-
/* @__PURE__ */
|
|
288
|
+
E && /* @__PURE__ */ m(n, { message: E }),
|
|
289
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("p", {
|
|
259
290
|
className: "mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase",
|
|
260
291
|
children: [
|
|
261
|
-
/* @__PURE__ */
|
|
292
|
+
/* @__PURE__ */ m(c, { className: "h-3 w-3" }),
|
|
262
293
|
"This blocks (",
|
|
263
|
-
|
|
294
|
+
R.length,
|
|
264
295
|
")"
|
|
265
296
|
]
|
|
266
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ h("div", {
|
|
267
298
|
className: "space-y-2",
|
|
268
|
-
children: [
|
|
299
|
+
children: [R.map((e) => /* @__PURE__ */ m(D, {
|
|
269
300
|
keyLabel: e.successor?.key ?? "",
|
|
270
301
|
title: e.successor?.title ?? "Unknown work item",
|
|
271
302
|
type: e.type,
|
|
272
303
|
lagMinutes: e.lagMinutes,
|
|
273
|
-
removing:
|
|
274
|
-
onOpen: () => e.successor &&
|
|
275
|
-
onRemove: () => void
|
|
276
|
-
}, e.id)), !
|
|
304
|
+
removing: L,
|
|
305
|
+
onOpen: () => e.successor && d(`/tasks/task-detail-page?taskId=${encodeURIComponent(e.successor.id)}`),
|
|
306
|
+
onRemove: () => void W(e.id)
|
|
307
|
+
}, e.id)), !j && R.length === 0 && /* @__PURE__ */ m("p", {
|
|
277
308
|
className: "text-sm text-muted-foreground",
|
|
278
309
|
children: "Nothing depends on this task finishing."
|
|
279
310
|
})]
|
|
280
311
|
})] }),
|
|
281
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("p", {
|
|
282
313
|
className: "mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase",
|
|
283
314
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ m(s, { className: "h-3 w-3" }),
|
|
285
316
|
"Blocked by (",
|
|
286
|
-
|
|
317
|
+
z.length,
|
|
287
318
|
")"
|
|
288
319
|
]
|
|
289
|
-
}), /* @__PURE__ */
|
|
320
|
+
}), /* @__PURE__ */ h("div", {
|
|
290
321
|
className: "space-y-2",
|
|
291
|
-
children: [
|
|
322
|
+
children: [z.map((e) => /* @__PURE__ */ m(D, {
|
|
292
323
|
keyLabel: e.predecessor?.key ?? "",
|
|
293
324
|
title: e.predecessor?.title ?? "Unknown work item",
|
|
294
325
|
type: e.type,
|
|
295
326
|
lagMinutes: e.lagMinutes,
|
|
296
|
-
removing:
|
|
297
|
-
onOpen: () => e.predecessor &&
|
|
298
|
-
onRemove: () => void
|
|
299
|
-
}, e.id)), !
|
|
327
|
+
removing: L,
|
|
328
|
+
onOpen: () => e.predecessor && d(`/tasks/task-detail-page?taskId=${encodeURIComponent(e.predecessor.id)}`),
|
|
329
|
+
onRemove: () => void W(e.id)
|
|
330
|
+
}, e.id)), !j && z.length === 0 && /* @__PURE__ */ m("p", {
|
|
300
331
|
className: "text-sm text-muted-foreground",
|
|
301
332
|
children: "This task has no upstream dependency."
|
|
302
333
|
})]
|
|
334
|
+
})] }),
|
|
335
|
+
F && (R.length > 0 || z.length > 0) && /* @__PURE__ */ h("p", {
|
|
336
|
+
role: "alert",
|
|
337
|
+
className: "text-xs text-destructive",
|
|
338
|
+
children: ["The dependency graph could not be drawn: ", F.message]
|
|
339
|
+
}),
|
|
340
|
+
V && (R.length > 0 || z.length > 0) && /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
|
|
341
|
+
className: "mb-2 text-xs font-medium text-muted-foreground uppercase",
|
|
342
|
+
children: "Neighbourhood graph"
|
|
343
|
+
}), /* @__PURE__ */ m(a, {
|
|
344
|
+
nodes: Array.from(H.values()),
|
|
345
|
+
edges: U,
|
|
346
|
+
onActivateNode: (e) => d(`/tasks/task-detail-page?taskId=${encodeURIComponent(e)}`),
|
|
347
|
+
emptyMessage: "No dependencies to graph yet.",
|
|
348
|
+
ariaLabel: `Dependency neighbourhood for ${V.key ?? V.title ?? "this task"}`
|
|
303
349
|
})] })
|
|
304
350
|
]
|
|
305
351
|
})] });
|
|
306
352
|
}
|
|
307
353
|
//#endregion
|
|
308
|
-
export {
|
|
354
|
+
export { k as DependencyPanel };
|
|
309
355
|
|
|
310
356
|
//# sourceMappingURL=DependencyPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyPanel.js","names":[],"sources":["../../../src/planmagnet/dependency/DependencyPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent, CardHeader, CardTitle } from '@burdenoff/fe-libs/ui';\nimport { ArrowLeft, ArrowRight, Plus, X } from 'lucide-react';\nimport { WorkItemSearchSelect } from '../controls/Pickers';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport { ErrorLine } from '../controls/ConfirmButton';\nimport { usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\n\n/**\n * Dependencies panel for the task detail page (BOFF-8047). `WorkItemDependency` is the CPM model only\n * (predecessor/successor + FINISH_TO_START/START_TO_START/FINISH_TO_FINISH/START_TO_FINISH + lagMinutes) — the\n * P0 architecture decision keeps issue-link verbs (blocks/relates-to) on the separate WorkItemLink type, out of\n * scope here. \"This blocks\" (this item is the predecessor) and \"Blocked by\" (this item is the successor) are the\n * two directions a FINISH_TO_START edge can be read in, which is the common case; the type select still shows all\n * four so a start-to-start or finish-to-finish constraint can be recorded correctly.\n */\n\nconst DEPENDENCY_TYPES = [\n 'FINISH_TO_START',\n 'START_TO_START',\n 'FINISH_TO_FINISH',\n 'START_TO_FINISH',\n] as const;\n\nconst GET_WORK_ITEM_DEPENDENCIES = gql`\n query GetWorkItemDependencies($workspaceId: ID!, $workItemId: String!) {\n blocks: planmagnetDependencies(\n workspaceId: $workspaceId\n filter: { predecessorId: $workItemId }\n pagination: { first: 50 }\n ) {\n items {\n id\n successorId\n lagMinutes\n type\n status\n description\n successor {\n id\n title\n key\n }\n }\n totalCount\n }\n blockedBy: planmagnetDependencies(\n workspaceId: $workspaceId\n filter: { successorId: $workItemId }\n pagination: { first: 50 }\n ) {\n items {\n id\n predecessorId\n lagMinutes\n type\n status\n description\n predecessor {\n id\n title\n key\n }\n }\n totalCount\n }\n }\n`;\n\nconst CREATE_DEPENDENCY = gql`\n mutation CreateWorkItemDependency($input: PlanmagnetCreateDependencyInput!) {\n planmagnetCreateDependency(input: $input) {\n id\n }\n }\n`;\n\nconst DELETE_DEPENDENCY = gql`\n mutation DeleteWorkItemDependency($id: ID!) {\n planmagnetDeleteDependency(id: $id)\n }\n`;\n\ninterface DependencyEdge {\n id: string;\n lagMinutes: number | null;\n type: string;\n status: string;\n description: string | null;\n}\ninterface BlockEdge extends DependencyEdge {\n successorId: string;\n successor: { id: string; title: string; key: string } | null;\n}\ninterface BlockedByEdge extends DependencyEdge {\n predecessorId: string;\n predecessor: { id: string; title: string; key: string } | null;\n}\n\nfunction lagLabel(lagMinutes: number | null): string | null {\n if (!lagMinutes) return null;\n const hours = lagMinutes / 60;\n const days = hours / 24;\n const verb = lagMinutes > 0 ? 'lag' : 'lead';\n if (Number.isInteger(days) && Math.abs(days) >= 1) return `${Math.abs(days)}d ${verb}`;\n if (Number.isInteger(hours)) return `${Math.abs(hours)}h ${verb}`;\n return `${Math.abs(lagMinutes)}m ${verb}`;\n}\n\nfunction EdgeRow({\n keyLabel,\n title,\n type,\n lagMinutes,\n onOpen,\n onRemove,\n removing,\n}: {\n keyLabel: string;\n title: string;\n type: string;\n lagMinutes: number | null;\n onOpen: () => void;\n onRemove: () => void;\n removing: boolean;\n}) {\n const lag = lagLabel(lagMinutes);\n return (\n <div className=\"flex items-center justify-between gap-3 rounded-md border border-input p-3\">\n <div className=\"min-w-0\">\n <button\n type=\"button\"\n className=\"block max-w-full truncate text-left text-sm font-medium hover:underline\"\n onClick={onOpen}\n >\n {keyLabel} <span className=\"font-normal\">{title}</span>\n </button>\n <p className=\"text-xs text-muted-foreground\">\n {enumLabel(type)}\n {lag ? ` · ${lag}` : ''}\n </p>\n </div>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n disabled={removing}\n onClick={onRemove}\n aria-label={`Remove dependency on ${title}`}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n}\n\n/** The \"add dependency\" form: pick a direction, a work item, a type and an optional lag. */\nfunction AddDependencyForm({\n workItemId,\n projectId,\n excludeIds,\n onDone,\n}: {\n workItemId: string;\n projectId: string;\n excludeIds: string[];\n onDone: () => void;\n}) {\n const [direction, setDirection] = useState<'blocks' | 'blockedBy'>('blocks');\n const [otherId, setOtherId] = useState('');\n const [type, setType] = useState<(typeof DEPENDENCY_TYPES)[number]>('FINISH_TO_START');\n const [lagDays, setLagDays] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [create, { loading }] = useMutation(CREATE_DEPENDENCY, {\n refetchQueries: ['GetWorkItemDependencies', 'GetProjectCriticalPath'],\n awaitRefetchQueries: true,\n });\n\n const submit = async () => {\n if (!otherId) return;\n setError(null);\n const lagTrimmed = lagDays.trim();\n const lagMinutes = lagTrimmed === '' ? undefined : Math.round(Number(lagTrimmed) * 24 * 60);\n if (lagTrimmed !== '' && !Number.isFinite(lagMinutes)) {\n setError('Lag must be a number of days.');\n return;\n }\n const input =\n direction === 'blocks'\n ? { predecessorId: workItemId, successorId: otherId, type, lagMinutes }\n : { predecessorId: otherId, successorId: workItemId, type, lagMinutes };\n try {\n await throwOnError(create({ variables: { input } }));\n setOtherId('');\n setLagDays('');\n onDone();\n } catch (e) {\n setError(e instanceof Error ? e.message : 'The dependency could not be created.');\n }\n };\n\n return (\n <div className=\"space-y-3 rounded-md border border-input p-3\">\n <div className=\"flex gap-1\">\n <button\n type=\"button\"\n data-testid=\"dependency-direction-blocks\"\n className={`px-3 py-1.5 text-xs rounded-md ${direction === 'blocks' ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n onClick={() => setDirection('blocks')}\n >\n This blocks…\n </button>\n <button\n type=\"button\"\n data-testid=\"dependency-direction-blockedby\"\n className={`px-3 py-1.5 text-xs rounded-md ${direction === 'blockedBy' ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n onClick={() => setDirection('blockedBy')}\n >\n Blocked by…\n </button>\n </div>\n <WorkItemSearchSelect\n id=\"dependency-other-work-item\"\n projectId={projectId}\n value={otherId}\n onChange={setOtherId}\n exclude={excludeIds}\n />\n <div className=\"grid grid-cols-2 gap-3\">\n <div>\n <label htmlFor=\"dependency-type\" className=\"text-xs font-medium text-muted-foreground\">\n Relationship\n </label>\n <select\n id=\"dependency-type\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={type}\n onChange={(e) => setType(e.target.value as (typeof DEPENDENCY_TYPES)[number])}\n >\n {DEPENDENCY_TYPES.map((t) => (\n <option key={t} value={t}>\n {enumLabel(t)}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"dependency-lag\" className=\"text-xs font-medium text-muted-foreground\">\n Lag (days, optional)\n </label>\n <input\n id=\"dependency-lag\"\n type=\"number\"\n step=\"0.5\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={lagDays}\n placeholder=\"0\"\n onChange={(e) => setLagDays(e.target.value)}\n />\n </div>\n </div>\n {error && <ErrorLine message={error} />}\n <div className=\"flex justify-end gap-2\">\n <Button size=\"sm\" variant=\"ghost\" onClick={onDone}>\n Cancel\n </Button>\n <Button size=\"sm\" disabled={!otherId || loading} onClick={() => void submit()}>\n {loading ? 'Adding…' : 'Add dependency'}\n </Button>\n </div>\n </div>\n );\n}\n\nexport function DependencyPanel({\n workspaceId,\n workItemId,\n projectId,\n}: {\n workspaceId: string;\n workItemId: string;\n projectId: string;\n}) {\n const navigate = usePlanMagnetNavigate();\n const [isAdding, setIsAdding] = useState(false);\n const [removeError, setRemoveError] = useState<string | null>(null);\n const { data, loading, error, refetch } = useQuery<{\n blocks: { items: BlockEdge[]; totalCount: number };\n blockedBy: { items: BlockedByEdge[]; totalCount: number };\n }>(GET_WORK_ITEM_DEPENDENCIES, {\n variables: { workspaceId, workItemId },\n skip: !workspaceId || !workItemId,\n });\n const [remove, { loading: removing }] = useMutation(DELETE_DEPENDENCY, {\n refetchQueries: ['GetWorkItemDependencies', 'GetProjectCriticalPath'],\n });\n\n const blocks = data?.blocks.items ?? [];\n const blockedBy = data?.blockedBy.items ?? [];\n const excludeIds = [\n workItemId,\n ...blocks.map((e) => e.successorId),\n ...blockedBy.map((e) => e.predecessorId),\n ];\n\n const onRemove = async (id: string) => {\n setRemoveError(null);\n try {\n await throwOnError(remove({ variables: { id } }));\n } catch (e) {\n setRemoveError(e instanceof Error ? e.message : 'The dependency could not be removed.');\n }\n };\n\n return (\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Dependencies</CardTitle>\n {!isAdding && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => setIsAdding(true)}>\n <Plus className=\"h-4 w-4 mr-1\" />\n Add dependency\n </Button>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {isAdding && (\n <AddDependencyForm\n workItemId={workItemId}\n projectId={projectId}\n excludeIds={excludeIds}\n onDone={() => {\n setIsAdding(false);\n void refetch();\n }}\n />\n )}\n {loading && !data && <p className=\"text-sm text-muted-foreground\">Loading dependencies…</p>}\n {error && <p className=\"text-sm text-red-500\">Error: {error.message}</p>}\n {removeError && <ErrorLine message={removeError} />}\n\n <div>\n <p className=\"mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase\">\n <ArrowRight className=\"h-3 w-3\" />\n This blocks ({blocks.length})\n </p>\n <div className=\"space-y-2\">\n {blocks.map((edge) => (\n <EdgeRow\n key={edge.id}\n keyLabel={edge.successor?.key ?? ''}\n title={edge.successor?.title ?? 'Unknown work item'}\n type={edge.type}\n lagMinutes={edge.lagMinutes}\n removing={removing}\n onOpen={() =>\n edge.successor &&\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(edge.successor.id)}`\n )\n }\n onRemove={() => void onRemove(edge.id)}\n />\n ))}\n {!loading && blocks.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n Nothing depends on this task finishing.\n </p>\n )}\n </div>\n </div>\n\n <div>\n <p className=\"mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase\">\n <ArrowLeft className=\"h-3 w-3\" />\n Blocked by ({blockedBy.length})\n </p>\n <div className=\"space-y-2\">\n {blockedBy.map((edge) => (\n <EdgeRow\n key={edge.id}\n keyLabel={edge.predecessor?.key ?? ''}\n title={edge.predecessor?.title ?? 'Unknown work item'}\n type={edge.type}\n lagMinutes={edge.lagMinutes}\n removing={removing}\n onOpen={() =>\n edge.predecessor &&\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(edge.predecessor.id)}`\n )\n }\n onRemove={() => void onRemove(edge.id)}\n />\n ))}\n {!loading && blockedBy.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">This task has no upstream dependency.</p>\n )}\n </div>\n </div>\n </CardContent>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAM,IAAmB;CACvB;CACA;CACA;CACA;CACD,EAEK,IAA6B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6ChC,IAAoB,CAAG;;;;;;GAQvB,IAAoB,CAAG;;;;;AAsB7B,SAAS,EAAS,GAA0C;AAC1D,KAAI,CAAC,EAAY,QAAO;CACxB,IAAM,IAAQ,IAAa,IACrB,IAAO,IAAQ,IACf,IAAO,IAAa,IAAI,QAAQ;AAGtC,QAFI,OAAO,UAAU,EAAK,IAAI,KAAK,IAAI,EAAK,IAAI,IAAU,GAAG,KAAK,IAAI,EAAK,CAAC,IAAI,MAC5E,OAAO,UAAU,EAAM,GAAS,GAAG,KAAK,IAAI,EAAM,CAAC,IAAI,MACpD,GAAG,KAAK,IAAI,EAAW,CAAC,IAAI;;AAGrC,SAAS,EAAQ,EACf,aACA,UACA,SACA,eACA,WACA,aACA,eASC;CACD,IAAM,IAAM,EA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,EAAS,EAAK,GAAG;KACtC,EAbK,EAAK,GAaV,CACF,EACD,CAAC,KAAW,EAAU,WAAW,KAChC,kBAAC,KAAD;KAAG,WAAU;eAAgC;KAAyC,CAAA,CAEpF;MACF,EAAA,CAAA;GACM;IACT,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"DependencyPanel.js","names":[],"sources":["../../../src/planmagnet/dependency/DependencyPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent, CardHeader, CardTitle } from '@burdenoff/fe-libs/ui';\nimport { ArrowLeft, ArrowRight, Plus, X } from 'lucide-react';\nimport { WorkItemSearchSelect } from '../controls/Pickers';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport { ErrorLine } from '../controls/ConfirmButton';\nimport { usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\nimport { DependencyGraph } from './DependencyGraph';\n\n/**\n * Dependencies panel for the task detail page (BOFF-8047). `WorkItemDependency` is the CPM model only\n * (predecessor/successor + FINISH_TO_START/START_TO_START/FINISH_TO_FINISH/START_TO_FINISH + lagMinutes) — the\n * P0 architecture decision keeps issue-link verbs (blocks/relates-to) on the separate WorkItemLink type, out of\n * scope here. \"This blocks\" (this item is the predecessor) and \"Blocked by\" (this item is the successor) are the\n * two directions a FINISH_TO_START edge can be read in, which is the common case; the type select still shows all\n * four so a start-to-start or finish-to-finish constraint can be recorded correctly.\n */\n\nconst DEPENDENCY_TYPES = [\n 'FINISH_TO_START',\n 'START_TO_START',\n 'FINISH_TO_FINISH',\n 'START_TO_FINISH',\n] as const;\n\nconst GET_WORK_ITEM_DEPENDENCIES = gql`\n query GetWorkItemDependencies($workspaceId: ID!, $workItemId: String!) {\n blocks: planmagnetDependencies(\n workspaceId: $workspaceId\n filter: { predecessorId: $workItemId }\n pagination: { first: 50 }\n ) {\n items {\n id\n successorId\n lagMinutes\n type\n status\n description\n successor {\n id\n title\n key\n status\n }\n }\n totalCount\n }\n blockedBy: planmagnetDependencies(\n workspaceId: $workspaceId\n filter: { successorId: $workItemId }\n pagination: { first: 50 }\n ) {\n items {\n id\n predecessorId\n lagMinutes\n type\n status\n description\n predecessor {\n id\n title\n key\n status\n }\n }\n totalCount\n }\n }\n`;\n\n/**\n * The center node's own title/key/status for the neighbourhood graph below (PDM-27) — a separate query, not an\n * added root field on GET_WORK_ITEM_DEPENDENCIES above, because that query's `$workItemId` is typed `String!`\n * (matching `PlanmagnetDependencyFilter`'s `predecessorId`/`successorId: String`) while `planmagnetWorkItem`\n * takes `id: ID!`; reusing the same variable across both positions would fail schema-drift validation.\n */\nconst GET_DEPENDENCY_GRAPH_CENTER = gql`\n query GetDependencyGraphCenter($id: ID!) {\n planmagnetWorkItem(id: $id) {\n id\n key\n title\n status\n }\n }\n`;\n\nconst CREATE_DEPENDENCY = gql`\n mutation CreateWorkItemDependency($input: PlanmagnetCreateDependencyInput!) {\n planmagnetCreateDependency(input: $input) {\n id\n }\n }\n`;\n\nconst DELETE_DEPENDENCY = gql`\n mutation DeleteWorkItemDependency($id: ID!) {\n planmagnetDeleteDependency(id: $id)\n }\n`;\n\ninterface DependencyEdge {\n id: string;\n lagMinutes: number | null;\n type: string;\n status: string;\n description: string | null;\n}\ninterface BlockEdge extends DependencyEdge {\n successorId: string;\n successor: { id: string; title: string; key: string; status: string } | null;\n}\ninterface BlockedByEdge extends DependencyEdge {\n predecessorId: string;\n predecessor: { id: string; title: string; key: string; status: string } | null;\n}\n\nfunction lagLabel(lagMinutes: number | null): string | null {\n if (!lagMinutes) return null;\n const hours = lagMinutes / 60;\n const days = hours / 24;\n const verb = lagMinutes > 0 ? 'lag' : 'lead';\n if (Number.isInteger(days) && Math.abs(days) >= 1) return `${Math.abs(days)}d ${verb}`;\n if (Number.isInteger(hours)) return `${Math.abs(hours)}h ${verb}`;\n return `${Math.abs(lagMinutes)}m ${verb}`;\n}\n\nfunction EdgeRow({\n keyLabel,\n title,\n type,\n lagMinutes,\n onOpen,\n onRemove,\n removing,\n}: {\n keyLabel: string;\n title: string;\n type: string;\n lagMinutes: number | null;\n onOpen: () => void;\n onRemove: () => void;\n removing: boolean;\n}) {\n const lag = lagLabel(lagMinutes);\n return (\n <div className=\"flex items-center justify-between gap-3 rounded-md border border-input p-3\">\n <div className=\"min-w-0\">\n <button\n type=\"button\"\n className=\"block max-w-full truncate text-left text-sm font-medium hover:underline\"\n onClick={onOpen}\n >\n {keyLabel} <span className=\"font-normal\">{title}</span>\n </button>\n <p className=\"text-xs text-muted-foreground\">\n {enumLabel(type)}\n {lag ? ` · ${lag}` : ''}\n </p>\n </div>\n <Button\n size=\"icon\"\n variant=\"ghost\"\n disabled={removing}\n onClick={onRemove}\n aria-label={`Remove dependency on ${title}`}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n}\n\n/** The \"add dependency\" form: pick a direction, a work item, a type and an optional lag. */\nfunction AddDependencyForm({\n workItemId,\n projectId,\n excludeIds,\n onDone,\n}: {\n workItemId: string;\n projectId: string;\n excludeIds: string[];\n onDone: () => void;\n}) {\n const [direction, setDirection] = useState<'blocks' | 'blockedBy'>('blocks');\n const [otherId, setOtherId] = useState('');\n const [type, setType] = useState<(typeof DEPENDENCY_TYPES)[number]>('FINISH_TO_START');\n const [lagDays, setLagDays] = useState('');\n const [error, setError] = useState<string | null>(null);\n const [create, { loading }] = useMutation(CREATE_DEPENDENCY, {\n refetchQueries: ['GetWorkItemDependencies', 'GetProjectCriticalPath'],\n awaitRefetchQueries: true,\n });\n\n const submit = async () => {\n if (!otherId) return;\n setError(null);\n const lagTrimmed = lagDays.trim();\n const lagMinutes = lagTrimmed === '' ? undefined : Math.round(Number(lagTrimmed) * 24 * 60);\n if (lagTrimmed !== '' && !Number.isFinite(lagMinutes)) {\n setError('Lag must be a number of days.');\n return;\n }\n const input =\n direction === 'blocks'\n ? { predecessorId: workItemId, successorId: otherId, type, lagMinutes }\n : { predecessorId: otherId, successorId: workItemId, type, lagMinutes };\n try {\n await throwOnError(create({ variables: { input } }));\n setOtherId('');\n setLagDays('');\n onDone();\n } catch (e) {\n setError(e instanceof Error ? e.message : 'The dependency could not be created.');\n }\n };\n\n return (\n <div className=\"space-y-3 rounded-md border border-input p-3\">\n <div className=\"flex gap-1\">\n <button\n type=\"button\"\n data-testid=\"dependency-direction-blocks\"\n className={`px-3 py-1.5 text-xs rounded-md ${direction === 'blocks' ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n onClick={() => setDirection('blocks')}\n >\n This blocks…\n </button>\n <button\n type=\"button\"\n data-testid=\"dependency-direction-blockedby\"\n className={`px-3 py-1.5 text-xs rounded-md ${direction === 'blockedBy' ? 'bg-primary text-primary-foreground' : 'text-muted-foreground hover:bg-muted'}`}\n onClick={() => setDirection('blockedBy')}\n >\n Blocked by…\n </button>\n </div>\n <WorkItemSearchSelect\n id=\"dependency-other-work-item\"\n projectId={projectId}\n value={otherId}\n onChange={setOtherId}\n exclude={excludeIds}\n />\n <div className=\"grid grid-cols-2 gap-3\">\n <div>\n <label htmlFor=\"dependency-type\" className=\"text-xs font-medium text-muted-foreground\">\n Relationship\n </label>\n <select\n id=\"dependency-type\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={type}\n onChange={(e) => setType(e.target.value as (typeof DEPENDENCY_TYPES)[number])}\n >\n {DEPENDENCY_TYPES.map((t) => (\n <option key={t} value={t}>\n {enumLabel(t)}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"dependency-lag\" className=\"text-xs font-medium text-muted-foreground\">\n Lag (days, optional)\n </label>\n <input\n id=\"dependency-lag\"\n type=\"number\"\n step=\"0.5\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm\"\n value={lagDays}\n placeholder=\"0\"\n onChange={(e) => setLagDays(e.target.value)}\n />\n </div>\n </div>\n {error && <ErrorLine message={error} />}\n <div className=\"flex justify-end gap-2\">\n <Button size=\"sm\" variant=\"ghost\" onClick={onDone}>\n Cancel\n </Button>\n <Button size=\"sm\" disabled={!otherId || loading} onClick={() => void submit()}>\n {loading ? 'Adding…' : 'Add dependency'}\n </Button>\n </div>\n </div>\n );\n}\n\nexport function DependencyPanel({\n workspaceId,\n workItemId,\n projectId,\n}: {\n workspaceId: string;\n workItemId: string;\n projectId: string;\n}) {\n const navigate = usePlanMagnetNavigate();\n const [isAdding, setIsAdding] = useState(false);\n const [removeError, setRemoveError] = useState<string | null>(null);\n const { data, loading, error, refetch } = useQuery<{\n blocks: { items: BlockEdge[]; totalCount: number };\n blockedBy: { items: BlockedByEdge[]; totalCount: number };\n }>(GET_WORK_ITEM_DEPENDENCIES, {\n variables: { workspaceId, workItemId },\n skip: !workspaceId || !workItemId,\n });\n // PDM-27: this item's own title/key/status, for the neighbourhood graph below — see\n // GET_DEPENDENCY_GRAPH_CENTER's doc comment for why this is a second query rather than a field added to the\n // one above.\n const { data: centerData, error: centerError } = useQuery<{\n planmagnetWorkItem: { id: string; key: string; title: string; status: string } | null;\n }>(GET_DEPENDENCY_GRAPH_CENTER, { variables: { id: workItemId }, skip: !workItemId });\n const [remove, { loading: removing }] = useMutation(DELETE_DEPENDENCY, {\n refetchQueries: ['GetWorkItemDependencies', 'GetProjectCriticalPath'],\n });\n\n const blocks = data?.blocks.items ?? [];\n const blockedBy = data?.blockedBy.items ?? [];\n const excludeIds = [\n workItemId,\n ...blocks.map((e) => e.successorId),\n ...blockedBy.map((e) => e.predecessorId),\n ];\n\n const center = centerData?.planmagnetWorkItem ?? null;\n const neighbourNodesById = new Map<\n string,\n { id: string; key: string | null; title: string | null; status: string }\n >();\n if (center) neighbourNodesById.set(center.id, center);\n for (const edge of blocks)\n if (edge.successor) neighbourNodesById.set(edge.successor.id, edge.successor);\n for (const edge of blockedBy) {\n if (edge.predecessor) neighbourNodesById.set(edge.predecessor.id, edge.predecessor);\n }\n const neighbourEdges = center\n ? [\n ...blocks.map((edge) => ({\n id: edge.id,\n predecessorId: center.id,\n successorId: edge.successorId,\n type: edge.type,\n lagMinutes: edge.lagMinutes,\n })),\n ...blockedBy.map((edge) => ({\n id: edge.id,\n predecessorId: edge.predecessorId,\n successorId: center.id,\n type: edge.type,\n lagMinutes: edge.lagMinutes,\n })),\n ]\n : [];\n\n const onRemove = async (id: string) => {\n setRemoveError(null);\n try {\n await throwOnError(remove({ variables: { id } }));\n } catch (e) {\n setRemoveError(e instanceof Error ? e.message : 'The dependency could not be removed.');\n }\n };\n\n return (\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0\">\n <CardTitle>Dependencies</CardTitle>\n {!isAdding && (\n <Button size=\"sm\" variant=\"outline\" onClick={() => setIsAdding(true)}>\n <Plus className=\"h-4 w-4 mr-1\" />\n Add dependency\n </Button>\n )}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {isAdding && (\n <AddDependencyForm\n workItemId={workItemId}\n projectId={projectId}\n excludeIds={excludeIds}\n onDone={() => {\n setIsAdding(false);\n void refetch();\n }}\n />\n )}\n {loading && !data && <p className=\"text-sm text-muted-foreground\">Loading dependencies…</p>}\n {error && <p className=\"text-sm text-red-500\">Error: {error.message}</p>}\n {removeError && <ErrorLine message={removeError} />}\n\n <div>\n <p className=\"mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase\">\n <ArrowRight className=\"h-3 w-3\" />\n This blocks ({blocks.length})\n </p>\n <div className=\"space-y-2\">\n {blocks.map((edge) => (\n <EdgeRow\n key={edge.id}\n keyLabel={edge.successor?.key ?? ''}\n title={edge.successor?.title ?? 'Unknown work item'}\n type={edge.type}\n lagMinutes={edge.lagMinutes}\n removing={removing}\n onOpen={() =>\n edge.successor &&\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(edge.successor.id)}`\n )\n }\n onRemove={() => void onRemove(edge.id)}\n />\n ))}\n {!loading && blocks.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">\n Nothing depends on this task finishing.\n </p>\n )}\n </div>\n </div>\n\n <div>\n <p className=\"mb-2 flex items-center gap-1 text-xs font-medium text-muted-foreground uppercase\">\n <ArrowLeft className=\"h-3 w-3\" />\n Blocked by ({blockedBy.length})\n </p>\n <div className=\"space-y-2\">\n {blockedBy.map((edge) => (\n <EdgeRow\n key={edge.id}\n keyLabel={edge.predecessor?.key ?? ''}\n title={edge.predecessor?.title ?? 'Unknown work item'}\n type={edge.type}\n lagMinutes={edge.lagMinutes}\n removing={removing}\n onOpen={() =>\n edge.predecessor &&\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(edge.predecessor.id)}`\n )\n }\n onRemove={() => void onRemove(edge.id)}\n />\n ))}\n {!loading && blockedBy.length === 0 && (\n <p className=\"text-sm text-muted-foreground\">This task has no upstream dependency.</p>\n )}\n </div>\n </div>\n\n {centerError && (blocks.length > 0 || blockedBy.length > 0) && (\n <p role=\"alert\" className=\"text-xs text-destructive\">\n The dependency graph could not be drawn: {centerError.message}\n </p>\n )}\n {center && (blocks.length > 0 || blockedBy.length > 0) && (\n <div>\n <p className=\"mb-2 text-xs font-medium text-muted-foreground uppercase\">\n Neighbourhood graph\n </p>\n <DependencyGraph\n nodes={Array.from(neighbourNodesById.values())}\n edges={neighbourEdges}\n onActivateNode={(id) =>\n navigate(`/tasks/task-detail-page?taskId=${encodeURIComponent(id)}`)\n }\n emptyMessage=\"No dependencies to graph yet.\"\n ariaLabel={`Dependency neighbourhood for ${center.key ?? center.title ?? 'this task'}`}\n />\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAM,IAAmB;CACvB;CACA;CACA;CACA;CACD,EAEK,IAA6B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDhC,IAA8B,CAAG;;;;;;;;;GAWjC,IAAoB,CAAG;;;;;;GAQvB,IAAoB,CAAG;;;;;AAsB7B,SAAS,EAAS,GAA0C;A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AEpF;MACF,EAAA,CAAA;GAEL,MAAgB,EAAO,SAAS,KAAK,EAAU,SAAS,MACvD,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cAA1B,CAAqD,6CACT,EAAY,QACpD;;GAEL,MAAW,EAAO,SAAS,KAAK,EAAU,SAAS,MAClD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;cAA2D;IAEpE,CAAA,EACJ,kBAAC,GAAD;IACE,OAAO,MAAM,KAAK,EAAmB,QAAQ,CAAC;IAC9C,OAAO;IACP,iBAAiB,MACf,EAAS,kCAAkC,mBAAmB,EAAG,GAAG;IAEtE,cAAa;IACb,WAAW,gCAAgC,EAAO,OAAO,EAAO,SAAS;IACzE,CAAA,CACE,EAAA,CAAA;GAEI;IACT,EAAA,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gantt timeline (ANR-24) for one project's work items. Plain SVG (recharts has no Gantt/timeline mark) — see
|
|
3
|
+
* ProjectsGanttPagePage.tsx for data fetching, project choice, and the week/month zoom control this renders to.
|
|
4
|
+
*
|
|
5
|
+
* SCHEDULE SOURCE: `WorkItem` has no persisted start date in the current schema (`graphql/wspace.graphql` —
|
|
6
|
+
* only `dueDate` and `estimateMinutes`). A bar's start is therefore DERIVED, backward from the due date, as
|
|
7
|
+
* `dueDate - estimateMinutes`: an item with a due date AND a positive estimate draws as a bar; an item with a
|
|
8
|
+
* due date but no (or a zero/negative) estimate draws as a milestone diamond, since there is no span to show; an
|
|
9
|
+
* item with no due date at all has no anchor to place it on the axis and is counted in the unscheduled note
|
|
10
|
+
* instead. This is called out again in the delivery notes — it is a real deviation from a literal "has its own
|
|
11
|
+
* start date" reading, forced by the schema as it stands today.
|
|
12
|
+
*/
|
|
13
|
+
export interface GanttDependency {
|
|
14
|
+
id: string;
|
|
15
|
+
successorId: string;
|
|
16
|
+
type: string;
|
|
17
|
+
lagMinutes: number | null;
|
|
18
|
+
}
|
|
19
|
+
export interface GanttWorkItem {
|
|
20
|
+
id: string;
|
|
21
|
+
key: string;
|
|
22
|
+
title: string;
|
|
23
|
+
status: string;
|
|
24
|
+
dueDate: string | null;
|
|
25
|
+
estimateMinutes: number | null;
|
|
26
|
+
dependencies: GanttDependency[];
|
|
27
|
+
}
|
|
28
|
+
export interface GanttChartProps {
|
|
29
|
+
items: GanttWorkItem[];
|
|
30
|
+
/** Work item ids on the critical path — their bars/diamonds are emphasised. */
|
|
31
|
+
criticalIds?: ReadonlySet<string>;
|
|
32
|
+
/** WorkItemDependency ids connecting two CONSECUTIVE critical-path items — their arrows are emphasised. */
|
|
33
|
+
criticalEdgeIds?: ReadonlySet<string>;
|
|
34
|
+
zoom: 'week' | 'month';
|
|
35
|
+
onActivateRow: (id: string) => void;
|
|
36
|
+
/** Injectable for predictable output; defaults to the real current time. */
|
|
37
|
+
today?: Date;
|
|
38
|
+
}
|
|
39
|
+
export declare function GanttChart({ items, criticalIds, criticalEdgeIds, zoom, onActivateRow, today, }: GanttChartProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=GanttChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GanttChart.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/dependency/GanttChart.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,eAAe,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,2GAA2G;IAC3G,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,4EAA4E;IAC5E,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAsED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,eAAe,EACf,IAAI,EACJ,aAAa,EACb,KAAK,GACN,EAAE,eAAe,2CA6SjB"}
|