@burdenoff/microfe-planmagnet 2026.930.7 → 2026.930.9
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/board/BoardViewBar.d.ts +27 -0
- package/dist/planmagnet/board/BoardViewBar.d.ts.map +1 -0
- package/dist/planmagnet/board/BoardViewBar.js +684 -0
- package/dist/planmagnet/board/BoardViewBar.js.map +1 -0
- package/dist/planmagnet/board/ProjectBoard.d.ts.map +1 -1
- package/dist/planmagnet/board/ProjectBoard.js +440 -345
- package/dist/planmagnet/board/ProjectBoard.js.map +1 -1
- package/dist/planmagnet/board/boardViewConfig.d.ts +144 -0
- package/dist/planmagnet/board/boardViewConfig.d.ts.map +1 -0
- package/dist/planmagnet/board/boardViewConfig.js +265 -0
- package/dist/planmagnet/board/boardViewConfig.js.map +1 -0
- package/dist/planmagnet/controls/ConfirmButton.d.ts +3 -1
- package/dist/planmagnet/controls/ConfirmButton.d.ts.map +1 -1
- package/dist/planmagnet/controls/ConfirmButton.js +2 -1
- package/dist/planmagnet/controls/ConfirmButton.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/milestones/MilestoneControls.js +1 -1
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyGraph.js","names":[],"sources":["../../../src/planmagnet/dependency/DependencyGraph.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport { rowLinkProps } from '../utils/rowNavigation';\nimport { statusVisual, STATUS_LEGEND_ORDER } from '../utils/statusColor';\n\n/**\n * Reusable SVG dependency graph (PDM-27). Nodes are work items, edges are `WorkItemDependency` rows, laid out in\n * layers left-to-right by longest-path topological order. Two mount points share this component:\n * - the critical-path page's \"Graph\" view (the whole project — see useProjectWorkItemsGraph.ts)\n * - the task dependency panel's one-hop neighbourhood graph (this item, its predecessors, its successors)\n *\n * The existing text list stays the accessible/no-JS-heavy fallback at every call site — this component is an\n * additional view, never a replacement for it.\n */\n\nexport interface DependencyGraphNode {\n id: string;\n key: string | null;\n title: string | null;\n status: string;\n}\n\nexport interface DependencyGraphEdge {\n /** The WorkItemDependency's own id — stable per edge, used as the React key. */\n id: string;\n predecessorId: string;\n successorId: string;\n /** A DependencyType value. */\n type: string;\n lagMinutes: number | null;\n}\n\nexport interface DependencyGraphProps {\n nodes: DependencyGraphNode[];\n edges: DependencyGraphEdge[];\n /** Node ids on the critical path (CPM chain) — emphasised with a thicker primary outline. */\n criticalNodeIds?: ReadonlySet<string>;\n /** Edge ids that connect two consecutive critical-path nodes — emphasised the same way. */\n criticalEdgeIds?: ReadonlySet<string>;\n onActivateNode: (nodeId: string) => void;\n /** Shown instead of the graph when `nodes` is empty. */\n emptyMessage: string;\n /** Accessible name for the graph region — should say what project/item it scopes to. */\n ariaLabel: string;\n}\n\nconst NODE_WIDTH = 180;\nconst NODE_HEIGHT = 56;\nconst LAYER_GAP_X = 72;\nconst NODE_GAP_Y = 16;\nconst PADDING = 20;\nconst CHIP_R = 4;\nconst TITLE_MAX_CHARS = 24;\nconst KEY_MAX_CHARS = 16;\n\n/** Shared with GanttChart.tsx, which draws the same dependency edges between bars instead of nodes. */\nexport function truncate(text: string, maxChars: number): string {\n if (text.length <= maxChars) return text;\n return `${text.slice(0, Math.max(1, maxChars - 1))}…`;\n}\n\nexport function dependencyTypeLabel(type: string): string {\n switch (type) {\n case 'FINISH_TO_START':\n return 'Finish to start';\n case 'START_TO_START':\n return 'Start to start';\n case 'FINISH_TO_FINISH':\n return 'Finish to finish';\n case 'START_TO_FINISH':\n return 'Start to finish';\n default:\n return enumLabel(type);\n }\n}\n\nexport function lagLabel(lagMinutes: number | null): string | null {\n if (!lagMinutes) return null;\n const days = lagMinutes / (60 * 24);\n const verb = lagMinutes > 0 ? 'lag' : 'lead';\n if (Number.isInteger(days)) return `${Math.abs(days)}d ${verb}`;\n return `${Math.abs(Math.round((lagMinutes / 60) * 10) / 10)}h ${verb}`;\n}\n\n/**\n * Longest-path layering with a cycle guard. Every node ends up on the layer one past the FURTHEST-along of its\n * (in-graph) predecessors — never merely the first predecessor visited — so an edge never points backward across\n * layers except when a cycle forces it (the server refuses cycles; this is defensive, not the expected path).\n *\n * `resolving` tracks ids currently on the call stack: a predecessor already being resolved (a back-edge closing a\n * cycle) is treated as layer -1 (contributing 0) rather than recursed into again, so this always terminates —\n * every id is visited at most once per still-active ancestor chain, bounded by `nodeIds.length`.\n */\nfunction computeLayers(\n nodeIds: string[],\n edges: { predecessorId: string; successorId: string }[]\n): Map<string, number> {\n const predecessorsOf = new Map<string, string[]>(nodeIds.map((id) => [id, []]));\n for (const e of edges) {\n const preds = predecessorsOf.get(e.successorId);\n if (preds && predecessorsOf.has(e.predecessorId)) preds.push(e.predecessorId);\n }\n\n const layer = new Map<string, number>();\n const resolving = new Set<string>();\n\n function resolve(id: string, depth: number): number {\n const cached = layer.get(id);\n if (cached !== undefined) return cached;\n if (resolving.has(id) || depth > nodeIds.length) return -1;\n resolving.add(id);\n const preds = predecessorsOf.get(id) ?? [];\n let max = -1;\n for (const p of preds) max = Math.max(max, resolve(p, depth + 1));\n resolving.delete(id);\n const result = max + 1;\n layer.set(id, result);\n return result;\n }\n\n for (const id of nodeIds) resolve(id, 0);\n return layer;\n}\n\nexport function DependencyGraph({\n nodes,\n edges,\n criticalNodeIds,\n criticalEdgeIds,\n onActivateNode,\n emptyMessage,\n ariaLabel,\n}: DependencyGraphProps) {\n const layout = useMemo(() => {\n const nodeIds = nodes.map((n) => n.id);\n const nodeSet = new Set(nodeIds);\n // Cross-scope edges (e.g. a dependency on a work item outside this project, or outside this item's one-hop\n // neighbourhood) have no node to draw — drop them rather than crash on a missing endpoint.\n const inScopeEdges = edges.filter(\n (e) => nodeSet.has(e.predecessorId) && nodeSet.has(e.successorId)\n );\n const layerOf = computeLayers(nodeIds, inScopeEdges);\n\n const byLayer = new Map<number, string[]>();\n for (const id of nodeIds) {\n const l = layerOf.get(id) ?? 0;\n const list = byLayer.get(l);\n if (list) list.push(id);\n else byLayer.set(l, [id]);\n }\n const layerCount = byLayer.size === 0 ? 1 : Math.max(...byLayer.keys()) + 1;\n const maxPerLayer = Math.max(1, ...Array.from(byLayer.values(), (l) => l.length));\n\n const position = new Map<string, { x: number; y: number }>();\n for (const [l, ids] of byLayer) {\n const x = PADDING + l * (NODE_WIDTH + LAYER_GAP_X);\n // Centered vertically within the tallest layer, so a short layer doesn't hug the top.\n const layerHeight = ids.length * NODE_HEIGHT + (ids.length - 1) * NODE_GAP_Y;\n const fullHeight = maxPerLayer * NODE_HEIGHT + (maxPerLayer - 1) * NODE_GAP_Y;\n const yOffset = PADDING + Math.max(0, (fullHeight - layerHeight) / 2);\n ids.forEach((id, i) => {\n position.set(id, { x, y: yOffset + i * (NODE_HEIGHT + NODE_GAP_Y) });\n });\n }\n\n const width = PADDING * 2 + layerCount * NODE_WIDTH + Math.max(0, layerCount - 1) * LAYER_GAP_X;\n const height =\n PADDING * 2 + maxPerLayer * NODE_HEIGHT + Math.max(0, maxPerLayer - 1) * NODE_GAP_Y;\n\n return { position, inScopeEdges, width, height };\n }, [nodes, edges]);\n\n const presentStatuses = useMemo(\n () => STATUS_LEGEND_ORDER.filter((s) => nodes.some((n) => n.status === s)),\n [nodes]\n );\n\n if (nodes.length === 0) {\n return (\n <div data-testid=\"dependency-graph\" className=\"p-6 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </div>\n );\n }\n\n const nodesById = new Map(nodes.map((n) => [n.id, n]));\n\n return (\n <div data-testid=\"dependency-graph\" className=\"rounded-md border border-input bg-background\">\n <p className=\"sr-only\">\n Dependency graph with {nodes.length} work item{nodes.length === 1 ? '' : 's'} and{' '}\n {layout.inScopeEdges.length} dependenc{layout.inScopeEdges.length === 1 ? 'y' : 'ies'}.\n {criticalNodeIds && criticalNodeIds.size > 0\n ? ` ${criticalNodeIds.size} item${criticalNodeIds.size === 1 ? ' is' : 's are'} on the critical path.`\n : ''}{' '}\n The list above/below gives the same information as text.\n </p>\n <div className=\"overflow-x-auto p-3\">\n {/* No role=\"img\" here: each node below is its own focusable role=\"button\" descendant, and \"img\"\n semantics would tell assistive tech to treat the whole subtree as a single flattened image. */}\n <svg\n aria-label={ariaLabel}\n width={layout.width}\n height={layout.height}\n viewBox={`0 0 ${layout.width} ${layout.height}`}\n className=\"block\"\n >\n <defs>\n <marker\n id=\"dependency-graph-arrow\"\n viewBox=\"0 0 10 10\"\n refX=\"9\"\n refY=\"5\"\n markerWidth=\"6\"\n markerHeight=\"6\"\n orient=\"auto-start-reverse\"\n className=\"text-border-strong\"\n >\n <path d=\"M0,0 L10,5 L0,10 z\" fill=\"currentColor\" />\n </marker>\n <marker\n id=\"dependency-graph-arrow-critical\"\n viewBox=\"0 0 10 10\"\n refX=\"9\"\n refY=\"5\"\n markerWidth=\"6\"\n markerHeight=\"6\"\n orient=\"auto-start-reverse\"\n className=\"text-primary\"\n >\n <path d=\"M0,0 L10,5 L0,10 z\" fill=\"currentColor\" />\n </marker>\n </defs>\n\n {layout.inScopeEdges.map((edge) => {\n const from = layout.position.get(edge.predecessorId);\n const to = layout.position.get(edge.successorId);\n if (!from || !to) return null;\n const x1 = from.x + NODE_WIDTH;\n const y1 = from.y + NODE_HEIGHT / 2;\n const x2 = to.x;\n const y2 = to.y + NODE_HEIGHT / 2;\n const midX = (x1 + x2) / 2;\n const critical = criticalEdgeIds?.has(edge.id) ?? false;\n const typeLabel =\n edge.type === 'FINISH_TO_START' ? null : dependencyTypeLabel(edge.type);\n const lag = lagLabel(edge.lagMinutes);\n const label = [typeLabel, lag].filter((v): v is string => !!v).join(' · ');\n const predecessor = nodesById.get(edge.predecessorId);\n const successor = nodesById.get(edge.successorId);\n return (\n <g key={edge.id} data-testid=\"dependency-graph-edge\">\n <title>\n {predecessor?.key ?? edge.predecessorId} {dependencyTypeLabel(edge.type)}{' '}\n {successor?.key ?? edge.successorId}\n {lag ? ` (${lag})` : ''}\n </title>\n <path\n d={`M ${x1},${y1} C ${midX},${y1} ${midX},${y2} ${x2},${y2}`}\n fill=\"none\"\n strokeWidth={critical ? 2.5 : 1.5}\n className={critical ? 'text-primary' : 'text-border-strong'}\n stroke=\"currentColor\"\n markerEnd={`url(#${critical ? 'dependency-graph-arrow-critical' : 'dependency-graph-arrow'})`}\n />\n {label && (\n <text\n x={midX}\n y={(y1 + y2) / 2 - 4}\n textAnchor=\"middle\"\n className=\"fill-muted-foreground text-[9px]\"\n >\n {label}\n </text>\n )}\n </g>\n );\n })}\n\n {nodes.map((node) => {\n const pos = layout.position.get(node.id);\n if (!pos) return null;\n const critical = criticalNodeIds?.has(node.id) ?? false;\n const visual = statusVisual(node.status);\n const title = node.title ?? 'Untitled work item';\n const keyLabel = node.key ?? '';\n const accessibleLabel = `${keyLabel ? `${keyLabel} — ` : ''}${title} (${enumLabel(node.status)})${critical ? ', on critical path' : ''}`;\n // ROW_LINK_CLASS (in the rowLinkProps spread below) rings via box-shadow, which SVG elements\n // outside a <foreignObject> don't paint — the explicit className after the spread overrides it\n // with an outline-based focus style, which they do.\n return (\n <g\n key={node.id}\n data-testid=\"dependency-graph-node\"\n transform={`translate(${pos.x}, ${pos.y})`}\n {...rowLinkProps<SVGGElement>(() => onActivateNode(node.id), accessibleLabel)}\n className=\"cursor-pointer focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2\"\n >\n <title>{accessibleLabel}</title>\n <rect\n width={NODE_WIDTH}\n height={NODE_HEIGHT}\n rx={8}\n className={`fill-background ${critical ? 'stroke-primary' : 'stroke-input'}`}\n strokeWidth={critical ? 2 : 1}\n />\n <circle cx={16} cy={NODE_HEIGHT / 2} r={CHIP_R} className={visual.fill} />\n <text x={28} y={22} className=\"fill-muted-foreground text-[10px] font-medium\">\n {truncate(keyLabel, KEY_MAX_CHARS)}\n </text>\n <text x={28} y={38} className=\"fill-foreground text-[11px] font-medium\">\n {truncate(title, TITLE_MAX_CHARS)}\n </text>\n </g>\n );\n })}\n </svg>\n </div>\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-input px-3 py-2 text-[11px] text-muted-foreground\">\n {presentStatuses.map((status) => (\n <span key={status} className=\"inline-flex items-center gap-1.5\">\n <span className={`h-2.5 w-2.5 rounded-full ${statusVisual(status).swatch}`} />\n {enumLabel(status)}\n </span>\n ))}\n {criticalNodeIds && criticalNodeIds.size > 0 && (\n <span className=\"inline-flex items-center gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-full border-2 border-primary bg-background\" />\n Critical path\n </span>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AA8CA,IAAM,IAAa,KACb,IAAc,IACd,IAAc,IACd,IAAa,IACb,IAAU,IACV,IAAS,GACT,IAAkB,IAClB,IAAgB;AAGtB,SAAgB,EAAS,GAAc,GAA0B;AAE/D,QADI,EAAK,UAAU,IAAiB,IAC7B,GAAG,EAAK,MAAM,GAAG,KAAK,IAAI,GAAG,IAAW,EAAE,CAAC,CAAC;;AAGrD,SAAgB,EAAoB,GAAsB;AACxD,SAAQ,GAAR;EACE,KAAK,kBACH,QAAO;EACT,KAAK,iBACH,QAAO;EACT,KAAK,mBACH,QAAO;EACT,KAAK,kBACH,QAAO;EACT,QACE,QAAO,EAAU,EAAK;;;AAI5B,SAAgB,EAAS,GAA0C;AACjE,KAAI,CAAC,EAAY,QAAO;CACxB,IAAM,IAAO,IAAc,MACrB,IAAO,IAAa,IAAI,QAAQ;AAEtC,QADI,OAAO,UAAU,EAAK,GAAS,GAAG,KAAK,IAAI,EAAK,CAAC,IAAI,MAClD,GAAG,KAAK,IAAI,KAAK,MAAO,IAAa,KAAM,GAAG,GAAG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AAK,GAAG,EAAE,EAAgB;QAC7E,WAAU;kBALZ;SAOE,kBAAC,SAAD,EAAA,UAAQ,GAAwB,CAAA;SAChC,kBAAC,QAAD;UACE,OAAO;UACP,QAAQ;UACR,IAAI;UACJ,WAAW,mBAAmB,IAAW,mBAAmB;UAC5D,aAAa,IAAW,IAAI;UAC5B,CAAA;SACF,kBAAC,UAAD;UAAQ,IAAI;UAAI,IAAI,IAAc;UAAG,GAAG;UAAQ,WAAW,EAAO;UAAQ,CAAA;SAC1E,kBAAC,QAAD;UAAM,GAAG;UAAI,GAAG;UAAI,WAAU;oBAC3B,EAAS,GAAU,EAAc;UAC7B,CAAA;SACP,kBAAC,QAAD;UAAM,GAAG;UAAI,GAAG;UAAI,WAAU;oBAC3B,EAAS,GAAO,EAAgB;UAC5B,CAAA;SACL;UArBG,EAAK,GAqBR;QAEN;MACE;;IACF,CAAA;GACN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,EAAgB,KAAK,MACpB,kBAAC,QAAD;KAAmB,WAAU;eAA7B,CACE,kBAAC,QAAD,EAAM,WAAW,4BAA4B,EAAa,EAAO,CAAC,UAAY,CAAA,EAC7E,EAAU,EAAO,CACb;OAHI,EAGJ,CACP,EACD,KAAmB,EAAgB,OAAO,KACzC,kBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,kBAAC,QAAD,EAAM,WAAU,kEAAmE,CAAA,EAAA,gBAE9E;OAEL;;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyPanel.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/dependency/DependencyPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DependencyPanel.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/dependency/DependencyPanel.tsx"],"names":[],"mappings":"AAwSA,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,UAAU,EACV,SAAS,GACV,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,2CAmLA"}
|
|
@@ -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,EAAS,EAAW;AAChC,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,UAAD;IACE,MAAK;IACL,WAAU;IACV,SAAS;cAHX;KAKG;KAAS;KAAC,kBAAC,QAAD;MAAM,WAAU;gBAAe;MAAa,CAAA;KAChD;OACT,kBAAC,KAAD;IAAG,WAAU;cAAb,CACG,EAAU,EAAK,EACf,IAAM,MAAM,MAAQ,GACnB;MACA;MACN,kBAAC,GAAD;GACE,MAAK;GACL,SAAQ;GACR,UAAU;GACV,SAAS;GACT,cAAY,wBAAwB;aAEpC,kBAAC,GAAD,EAAG,W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AO;KAAO;KAC1B;OACJ,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,EAAO,KAAK,MACX,kBAAC,GAAD;KAEE,UAAU,EAAK,WAAW,OAAO;KACjC,OAAO,EAAK,WAAW,SAAS;KAChC,MAAM,EAAK;KACX,YAAY,EAAK;KACP;KACV,cACE,EAAK,aACL,EACE,kCAAkC,mBAAmB,EAAK,UAAU,GAAG,GACxE;KAEH,gBAAgB,KAAK,EAAS,EAAK,GAAG;KACtC,EAbK,EAAK,GAaV,CACF,EACD,CAAC,KAAW,EAAO,WAAW,KAC7B,kBAAC,KAAD;KAAG,WAAU;eAAgC;KAEzC,CAAA,CAEF;MACF,EAAA,CAAA;GAEN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;cAAb;KACE,kBAAC,GAAD,EAAW,WAAU,WAAY,CAAA;;KACpB,EAAU;KAAO;KAC5B;OACJ,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,EAAU,KAAK,MACd,kBAAC,GAAD;KAEE,UAAU,EAAK,aAAa,OAAO;KACnC,OAAO,EAAK,aAAa,SAAS;KAClC,MAAM,EAAK;KACX,YAAY,EAAK;KACP;KACV,cACE,EAAK,eACL,EACE,kCAAkC,mBAAmB,EAAK,YAAY,GAAG,GAC1E;KAEH,gBAAgB,KAAK,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;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,EAAS,EAAW;AACh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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"}
|