@sixb/agent 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/abort.d.ts +6 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/agent-prompt.d.ts +126 -0
- package/dist/agent-prompt.d.ts.map +1 -0
- package/dist/agent-runtime/errors.d.ts +13 -0
- package/dist/agent-runtime/errors.d.ts.map +1 -0
- package/dist/agent-runtime/preflight.d.ts +18 -0
- package/dist/agent-runtime/preflight.d.ts.map +1 -0
- package/dist/agent-runtime/profile.d.ts +14 -0
- package/dist/agent-runtime/profile.d.ts.map +1 -0
- package/dist/artifacts/layout-check/layout-check.d.ts +87 -0
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -0
- package/dist/artifacts/materialize.d.ts +115 -0
- package/dist/artifacts/materialize.d.ts.map +1 -0
- package/dist/artifacts/publish-tool.d.ts +86 -0
- package/dist/artifacts/publish-tool.d.ts.map +1 -0
- package/dist/ask-parent-tool.d.ts +36 -0
- package/dist/ask-parent-tool.d.ts.map +1 -0
- package/dist/attachments.d.ts +109 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/child-files.d.ts +91 -0
- package/dist/child-files.d.ts.map +1 -0
- package/dist/child-questions.d.ts +24 -0
- package/dist/child-questions.d.ts.map +1 -0
- package/dist/computer-runner.d.ts +74 -0
- package/dist/computer-runner.d.ts.map +1 -0
- package/dist/context-budget.d.ts +34 -0
- package/dist/context-budget.d.ts.map +1 -0
- package/dist/context-compaction.d.ts +148 -0
- package/dist/context-compaction.d.ts.map +1 -0
- package/dist/context-guard.d.ts +69 -0
- package/dist/context-guard.d.ts.map +1 -0
- package/dist/conversation-memory.d.ts +21 -0
- package/dist/conversation-memory.d.ts.map +1 -0
- package/dist/conversation-messages.d.ts +33 -0
- package/dist/conversation-messages.d.ts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution-plan.d.ts +38 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/failure.d.ts +14 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/family-mailbox.d.ts +60 -0
- package/dist/family-mailbox.d.ts.map +1 -0
- package/dist/file-ref.d.ts +6 -0
- package/dist/file-ref.d.ts.map +1 -0
- package/dist/image-attachments.d.ts +34 -0
- package/dist/image-attachments.d.ts.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14387 -0
- package/dist/index.js.map +72 -0
- package/dist/inline-images.d.ts +28 -0
- package/dist/inline-images.d.ts.map +1 -0
- package/dist/message-authors.d.ts +34 -0
- package/dist/message-authors.d.ts.map +1 -0
- package/dist/message-times.d.ts +9 -0
- package/dist/message-times.d.ts.map +1 -0
- package/dist/model-adapters.d.ts +59 -0
- package/dist/model-adapters.d.ts.map +1 -0
- package/dist/model-lines.d.ts +16 -0
- package/dist/model-lines.d.ts.map +1 -0
- package/dist/prompt-cache.d.ts +28 -0
- package/dist/prompt-cache.d.ts.map +1 -0
- package/dist/requester.d.ts +15 -0
- package/dist/requester.d.ts.map +1 -0
- package/dist/run-agent-turn.d.ts +93 -0
- package/dist/run-agent-turn.d.ts.map +1 -0
- package/dist/run-child.d.ts +77 -0
- package/dist/run-child.d.ts.map +1 -0
- package/dist/run-conversation-turn.d.ts +42 -0
- package/dist/run-conversation-turn.d.ts.map +1 -0
- package/dist/run-credential.d.ts +22 -0
- package/dist/run-credential.d.ts.map +1 -0
- package/dist/run-environment.d.ts +145 -0
- package/dist/run-environment.d.ts.map +1 -0
- package/dist/run-fate.d.ts +15 -0
- package/dist/run-fate.d.ts.map +1 -0
- package/dist/run-files-lock.d.ts +16 -0
- package/dist/run-files-lock.d.ts.map +1 -0
- package/dist/run-sandbox.d.ts +60 -0
- package/dist/run-sandbox.d.ts.map +1 -0
- package/dist/run-subagent.d.ts +65 -0
- package/dist/run-subagent.d.ts.map +1 -0
- package/dist/run-workflow-agent-node.d.ts +46 -0
- package/dist/run-workflow-agent-node.d.ts.map +1 -0
- package/dist/sandbox-api-context.d.ts +34 -0
- package/dist/sandbox-api-context.d.ts.map +1 -0
- package/dist/sandbox-file-registry.d.ts +9 -0
- package/dist/sandbox-file-registry.d.ts.map +1 -0
- package/dist/sandbox-files.d.ts +71 -0
- package/dist/sandbox-files.d.ts.map +1 -0
- package/dist/sandbox-handle.d.ts +15 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-readiness.d.ts +8 -0
- package/dist/sandbox-readiness.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts +15 -0
- package/dist/skills/built-in.d.ts.map +1 -0
- package/dist/subagent-context.d.ts +50 -0
- package/dist/subagent-context.d.ts.map +1 -0
- package/dist/subagent-continuation.d.ts +33 -0
- package/dist/subagent-continuation.d.ts.map +1 -0
- package/dist/subagent-inbox.d.ts +53 -0
- package/dist/subagent-inbox.d.ts.map +1 -0
- package/dist/subagent-tools.d.ts +293 -0
- package/dist/subagent-tools.d.ts.map +1 -0
- package/dist/thread-context.d.ts +17 -0
- package/dist/thread-context.d.ts.map +1 -0
- package/dist/tools/attachments.d.ts +11 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/bash.d.ts +68 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts +9 -0
- package/dist/tools/model-spec.d.ts.map +1 -0
- package/dist/tools/read.d.ts +43 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/result-media.d.ts +65 -0
- package/dist/tools/result-media.d.ts.map +1 -0
- package/dist/tools/result-output.d.ts +18 -0
- package/dist/tools/result-output.d.ts.map +1 -0
- package/dist/tools/tool-files.d.ts +59 -0
- package/dist/tools/tool-files.d.ts.map +1 -0
- package/dist/tools/tool-outputs.d.ts +63 -0
- package/dist/tools/tool-outputs.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +40 -0
- package/dist/tools/view-file.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/turn-runtime.d.ts +19 -0
- package/dist/turn-runtime.d.ts.map +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow-input-attachments.d.ts +18 -0
- package/dist/workflow-input-attachments.d.ts.map +1 -0
- package/package.json +59 -4
- package/src/abort.ts +40 -0
- package/src/agent-prompt.ts +860 -0
- package/src/agent-runtime/errors.ts +44 -0
- package/src/agent-runtime/preflight.ts +314 -0
- package/src/agent-runtime/profile.ts +23 -0
- package/src/artifacts/layout-check/check.cjs +478 -0
- package/src/artifacts/layout-check/layout-check.ts +460 -0
- package/src/artifacts/materialize.ts +380 -0
- package/src/artifacts/publish-tool.ts +700 -0
- package/src/ask-parent-tool.ts +100 -0
- package/src/attachments.ts +1041 -0
- package/src/child-files.ts +535 -0
- package/src/child-questions.ts +42 -0
- package/src/computer-runner.ts +336 -0
- package/src/context-budget.ts +177 -0
- package/src/context-compaction.ts +1349 -0
- package/src/context-guard.ts +826 -0
- package/src/conversation-memory.ts +45 -0
- package/src/conversation-messages.ts +86 -0
- package/src/errors.ts +85 -0
- package/src/execution-plan.ts +70 -0
- package/src/failure.ts +82 -0
- package/src/family-mailbox.ts +189 -0
- package/src/file-ref.ts +18 -0
- package/src/image-attachments.ts +322 -0
- package/src/index.ts +54 -0
- package/src/inline-images.ts +69 -0
- package/src/message-authors.ts +77 -0
- package/src/message-times.ts +24 -0
- package/src/model-adapters.ts +273 -0
- package/src/model-lines.ts +28 -0
- package/src/prompt-cache.ts +40 -0
- package/src/requester.ts +21 -0
- package/src/run-agent-turn.ts +509 -0
- package/src/run-child.ts +344 -0
- package/src/run-conversation-turn.ts +272 -0
- package/src/run-credential.ts +55 -0
- package/src/run-environment.ts +1216 -0
- package/src/run-fate.ts +51 -0
- package/src/run-files-lock.ts +118 -0
- package/src/run-sandbox.ts +63 -0
- package/src/run-subagent.ts +433 -0
- package/src/run-workflow-agent-node.ts +344 -0
- package/src/sandbox-api-context.ts +237 -0
- package/src/sandbox-file-registry.ts +26 -0
- package/src/sandbox-files.ts +326 -0
- package/src/sandbox-handle.ts +19 -0
- package/src/sandbox-readiness.ts +22 -0
- package/src/skills/built-in.ts +183 -0
- package/src/skills/sixb-artifacts/SKILL.md +95 -0
- package/src/skills/sixb-artifacts/canvas.md +104 -0
- package/src/skills/sixb-artifacts/document.md +63 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/first-job.html +42 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/region.html +29 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/shared.css +35 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/welcome.html +31 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/canvas.json +107 -0
- package/src/skills/sixb-artifacts/examples/canvas/retro/canvas.json +158 -0
- package/src/skills/sixb-artifacts/examples/document/incident-report/document.md +35 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/document.md +41 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/figures/restorations.svg +1 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/index.html +169 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/data/dispatch.json +234 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/index.html +245 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/data/plan.json +53 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/index.html +462 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/data/service.json +276 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/index.html +549 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/workbook.json +30 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Inventory.csv +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Spend.csv +6 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/workbook.json +47 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Quarters.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Regions.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/workbook.json +78 -0
- package/src/skills/sixb-artifacts/examples/slides/launch-plan/index.html +63 -0
- package/src/skills/sixb-artifacts/examples/slides/q3-review/index.html +133 -0
- package/src/skills/sixb-artifacts/file.md +17 -0
- package/src/skills/sixb-artifacts/page.md +215 -0
- package/src/skills/sixb-artifacts/queries.md +66 -0
- package/src/skills/sixb-artifacts/references.md +68 -0
- package/src/skills/sixb-artifacts/sheet.md +223 -0
- package/src/skills/sixb-artifacts/slides.md +137 -0
- package/src/skills/sixb-memory/SKILL.md +68 -0
- package/src/skills/text-assets.d.ts +25 -0
- package/src/subagent-context.ts +182 -0
- package/src/subagent-continuation.ts +56 -0
- package/src/subagent-inbox.ts +101 -0
- package/src/subagent-tools.ts +1671 -0
- package/src/thread-context.ts +31 -0
- package/src/tools/attachments.ts +28 -0
- package/src/tools/bash.ts +233 -0
- package/src/tools/model-spec.ts +27 -0
- package/src/tools/read.ts +262 -0
- package/src/tools/result-media.ts +351 -0
- package/src/tools/result-output.ts +46 -0
- package/src/tools/tool-files.ts +204 -0
- package/src/tools/tool-outputs.ts +464 -0
- package/src/tools/view-file.ts +155 -0
- package/src/turn-runtime.ts +33 -0
- package/src/types.ts +91 -0
- package/src/workflow-input-attachments.ts +140 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Service levels, 2026</title>
|
|
6
|
+
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
|
|
7
|
+
<style>
|
|
8
|
+
:root { --over: #c2410c; --ok: #15803d; }
|
|
9
|
+
html.dark { --over: #fb923c; --ok: #4ade80; }
|
|
10
|
+
|
|
11
|
+
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 20px; }
|
|
12
|
+
.head .lede { margin-bottom: 0; }
|
|
13
|
+
|
|
14
|
+
/* Segmented controls and chips: radios drawn as buttons. */
|
|
15
|
+
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); }
|
|
16
|
+
.segmented label, .chips label { position: relative; margin: 0; }
|
|
17
|
+
.segmented input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
|
|
18
|
+
.segmented span { display: block; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 550; line-height: 18px; color: var(--muted-foreground); white-space: nowrap; cursor: pointer; }
|
|
19
|
+
.segmented input:checked + span { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--border); }
|
|
20
|
+
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
|
|
21
|
+
.chips span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; }
|
|
22
|
+
.chips input:checked + span { border-color: var(--foreground); background: var(--foreground); color: var(--background); }
|
|
23
|
+
:is(.segmented, .chips) input:focus-visible + span { outline: 2px solid var(--foreground); outline-offset: 1px; }
|
|
24
|
+
|
|
25
|
+
.stat .value small { margin-left: 4px; font-size: 15px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }
|
|
26
|
+
.delta.over { color: var(--over); }
|
|
27
|
+
.delta.ok { color: var(--ok); }
|
|
28
|
+
|
|
29
|
+
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 4px; }
|
|
30
|
+
.card-head h3 { margin: 0; }
|
|
31
|
+
.card-head p { margin: 0; font-size: 13px; color: var(--muted-foreground); }
|
|
32
|
+
|
|
33
|
+
/* The calendar keeps its cells legible, scrolling sideways on a phone. */
|
|
34
|
+
.scroll-x { overflow-x: auto; }
|
|
35
|
+
#calendar { min-width: 760px; height: 228px; }
|
|
36
|
+
#trend { height: 300px; }
|
|
37
|
+
#causes { height: 330px; }
|
|
38
|
+
|
|
39
|
+
.pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
|
|
40
|
+
.pair.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
41
|
+
.pair > .card { margin: 0; }
|
|
42
|
+
@media (max-width: 860px) { .pair, .pair.even { grid-template-columns: minmax(0, 1fr); } }
|
|
43
|
+
|
|
44
|
+
/* The day picked on the calendar or in the table. */
|
|
45
|
+
.day-date { margin: 2px 0 14px; font-size: 13px; color: var(--muted-foreground); }
|
|
46
|
+
.day-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
|
|
47
|
+
.day-figures div { font-size: 12px; color: var(--muted-foreground); }
|
|
48
|
+
.day-figures b { display: block; margin-top: 2px; font-size: 20px; font-weight: 650; color: var(--foreground); font-variant-numeric: tabular-nums; }
|
|
49
|
+
.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
|
|
50
|
+
.bars li { display: grid; grid-template-columns: 84px minmax(0, 1fr) 52px; align-items: center; gap: 10px; margin: 0; font-size: 13px; }
|
|
51
|
+
.bars .track { display: block; height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
|
|
52
|
+
.bars .fill { display: block; height: 100%; border-radius: inherit; background: var(--foreground); }
|
|
53
|
+
.bars .fill.over { background: var(--over); }
|
|
54
|
+
.bars .figure { text-align: right; font-variant-numeric: tabular-nums; }
|
|
55
|
+
|
|
56
|
+
th button { all: unset; display: inline-flex; align-items: center; gap: 4px; min-height: 24px; cursor: pointer; }
|
|
57
|
+
th button:focus-visible { outline: 2px solid var(--foreground); outline-offset: 2px; border-radius: 4px; }
|
|
58
|
+
th button::after { content: "↕"; opacity: 0.35; }
|
|
59
|
+
th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
|
|
60
|
+
th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
|
|
61
|
+
tbody tr { cursor: pointer; }
|
|
62
|
+
tbody tr:hover td, tbody tr[aria-selected="true"] td { background: var(--muted); }
|
|
63
|
+
td:first-child { white-space: nowrap; }
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<main>
|
|
68
|
+
<header class="head">
|
|
69
|
+
<div>
|
|
70
|
+
<p class="eyebrow">January to September 2026 · Field service</p>
|
|
71
|
+
<h1>Service levels</h1>
|
|
72
|
+
<p class="lede" id="lede">–</p>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="segmented" role="radiogroup" aria-label="Measure">
|
|
75
|
+
<label><input type="radio" name="metric" value="sla" checked><span>Within SLA</span></label>
|
|
76
|
+
<label><input type="radio" name="metric" value="calls"><span>Calls</span></label>
|
|
77
|
+
<label><input type="radio" name="metric" value="restore"><span>Time to restore</span></label>
|
|
78
|
+
</div>
|
|
79
|
+
</header>
|
|
80
|
+
|
|
81
|
+
<div class="chips" role="radiogroup" aria-label="Region" id="regions"></div>
|
|
82
|
+
|
|
83
|
+
<div class="grid">
|
|
84
|
+
<div class="card stat"><div class="label">Within SLA</div><div class="value" id="sla">–</div><div class="delta" id="sla-note">–</div></div>
|
|
85
|
+
<div class="card stat"><div class="label">Calls</div><div class="value" id="calls">–</div><div class="delta" id="calls-note">–</div></div>
|
|
86
|
+
<div class="card stat"><div class="label">Average time to restore</div><div class="value" id="restore">–</div><div class="delta" id="restore-note">–</div></div>
|
|
87
|
+
<div class="card stat"><div class="label">Days under target</div><div class="value" id="under">–</div><div class="delta" id="under-note">–</div></div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="card">
|
|
91
|
+
<div class="card-head"><h3 id="calendar-title">Every day</h3><p>Click a day for its regions.</p></div>
|
|
92
|
+
<div class="scroll-x"><div id="calendar" role="img" aria-label="Each day of 2026 so far, shaded by the chosen measure"></div></div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div class="pair">
|
|
96
|
+
<div class="card">
|
|
97
|
+
<div class="card-head"><h3 id="trend-title">Trend</h3><p>Drag the handles to zoom.</p></div>
|
|
98
|
+
<div id="trend" role="img" aria-label="The chosen measure by day, with its 7-day average"></div>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="card">
|
|
101
|
+
<h3>The day</h3>
|
|
102
|
+
<p class="day-date" id="day-date">–</p>
|
|
103
|
+
<div class="day-figures">
|
|
104
|
+
<div>Calls<b id="day-calls">–</b></div>
|
|
105
|
+
<div>Within SLA<b id="day-sla">–</b></div>
|
|
106
|
+
<div>Restore<b id="day-restore">–</b></div>
|
|
107
|
+
</div>
|
|
108
|
+
<ul class="bars" id="day-regions"></ul>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="pair even">
|
|
113
|
+
<div class="card">
|
|
114
|
+
<div class="card-head"><h3>What caused the calls</h3><p id="causes-note">–</p></div>
|
|
115
|
+
<div id="causes" role="img" aria-label="Calls by cause"></div>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="card">
|
|
118
|
+
<h3>Hardest days</h3>
|
|
119
|
+
<div class="table-scroll">
|
|
120
|
+
<table>
|
|
121
|
+
<thead><tr>
|
|
122
|
+
<th data-key="date"><button type="button">Day</button></th>
|
|
123
|
+
<th class="num" data-key="calls"><button type="button">Calls</button></th>
|
|
124
|
+
<th class="num" data-key="sla" aria-sort="ascending"><button type="button">Within SLA</button></th>
|
|
125
|
+
<th class="num" data-key="restore"><button type="button">Restore</button></th>
|
|
126
|
+
</tr></thead>
|
|
127
|
+
<tbody id="hardest"></tbody>
|
|
128
|
+
</table>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<p class="note">Source: field service records, January 1 to September 30, 2026. Within SLA is the share of calls restored inside the region's agreed time; the target is 90%.</p>
|
|
134
|
+
</main>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
const number = new Intl.NumberFormat("en-US")
|
|
138
|
+
const percent = new Intl.NumberFormat("en-US", { style: "percent", maximumFractionDigits: 1 })
|
|
139
|
+
const whole = new Intl.NumberFormat("en-US", { style: "percent", maximumFractionDigits: 0 })
|
|
140
|
+
const longDay = new Intl.DateTimeFormat("en-US", { weekday: "long", month: "long", day: "numeric", timeZone: "UTC" })
|
|
141
|
+
const shortDay = new Intl.DateTimeFormat("en-US", { weekday: "short", month: "short", day: "numeric", timeZone: "UTC" })
|
|
142
|
+
const field = (id) => document.getElementById(id)
|
|
143
|
+
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
144
|
+
const METRICS = {
|
|
145
|
+
sla: { title: "Within SLA", format: (value) => whole.format(value) },
|
|
146
|
+
calls: { title: "Calls", format: (value) => number.format(Math.round(value)) },
|
|
147
|
+
restore: { title: "Time to restore", format: (value) => duration(value) },
|
|
148
|
+
}
|
|
149
|
+
const state = { region: "", metric: "sla", day: 0, sort: { key: "sla", ascending: true } }
|
|
150
|
+
const charts = {}
|
|
151
|
+
let data = null
|
|
152
|
+
|
|
153
|
+
function duration(minutes) {
|
|
154
|
+
const rounded = Math.round(minutes)
|
|
155
|
+
return rounded < 60 ? `${rounded} m` : `${Math.floor(rounded / 60)} h ${String(rounded % 60).padStart(2, "0")} m`
|
|
156
|
+
}
|
|
157
|
+
const iso = (day) => new Date(Date.parse(data.start) + day * 86_400_000).toISOString().slice(0, 10)
|
|
158
|
+
const date = (day) => new Date(Date.parse(data.start) + day * 86_400_000)
|
|
159
|
+
|
|
160
|
+
function palette() {
|
|
161
|
+
const style = getComputedStyle(document.documentElement)
|
|
162
|
+
const read = (name) => style.getPropertyValue(name).trim()
|
|
163
|
+
return {
|
|
164
|
+
foreground: read("--foreground"),
|
|
165
|
+
muted: read("--muted-foreground"),
|
|
166
|
+
surface: read("--muted"),
|
|
167
|
+
border: read("--border"),
|
|
168
|
+
card: read("--card"),
|
|
169
|
+
over: read("--over"),
|
|
170
|
+
font: read("--font-sans"),
|
|
171
|
+
series: [1, 2, 3, 4, 5].map((index) => read(`--chart-${index}`)),
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Each day's calls, calls within SLA, and restore minutes, for the chosen regions. */
|
|
176
|
+
function days(regions) {
|
|
177
|
+
return Array.from({ length: data.days }, (_, day) => {
|
|
178
|
+
const calls = regions.reduce((sum, region) => sum + region.calls[day], 0)
|
|
179
|
+
const within = regions.reduce((sum, region) => sum + region.within[day], 0)
|
|
180
|
+
const minutes = regions.reduce((sum, region) => sum + region.restore[day] * region.calls[day], 0)
|
|
181
|
+
return { day, calls, within, sla: within / calls, restore: minutes / calls }
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function chosen() {
|
|
186
|
+
return data.regions.filter((region) => !state.region || region.region === state.region)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function render() {
|
|
190
|
+
const regions = chosen()
|
|
191
|
+
const series = days(regions)
|
|
192
|
+
const calls = series.reduce((sum, day) => sum + day.calls, 0)
|
|
193
|
+
const within = series.reduce((sum, day) => sum + day.within, 0)
|
|
194
|
+
const restore = series.reduce((sum, day) => sum + day.restore * day.calls, 0) / calls
|
|
195
|
+
const under = series.filter((day) => day.sla < data.target)
|
|
196
|
+
const quarter = (index) => series.filter((day) => Math.floor(date(day.day).getUTCMonth() / 3) === index)
|
|
197
|
+
const share = (part) => part.reduce((sum, day) => sum + day.within, 0) / part.reduce((sum, day) => sum + day.calls, 0)
|
|
198
|
+
const change = share(quarter(2)) - share(quarter(0))
|
|
199
|
+
|
|
200
|
+
field("lede").textContent = `${state.region ? `In ${state.region}` : "Across all regions"}, ${percent.format(within / calls)} of ${number.format(calls)} calls were restored within SLA: ${change >= 0 ? "up" : "down"} ${Math.abs(change * 100).toFixed(1)} points from Q1 to Q3.`
|
|
201
|
+
field("sla").textContent = percent.format(within / calls)
|
|
202
|
+
field("sla-note").textContent = `${within / calls >= data.target ? "Above" : "Under"} the ${whole.format(data.target)} target`
|
|
203
|
+
field("sla-note").className = `delta ${within / calls >= data.target ? "ok" : "over"}`
|
|
204
|
+
field("calls").textContent = number.format(calls)
|
|
205
|
+
field("calls-note").textContent = `${number.format(Math.round(calls / series.length))} a day on average`
|
|
206
|
+
field("restore").textContent = duration(restore)
|
|
207
|
+
field("restore-note").textContent = `${duration(Math.max(...series.map((day) => day.restore)))} on the slowest day`
|
|
208
|
+
field("under").innerHTML = `${under.length}<small>of ${series.length}</small>`
|
|
209
|
+
field("under-note").textContent = under.length ? `Most in ${mostIn(under)}` : "None this year"
|
|
210
|
+
|
|
211
|
+
if (!state.day) state.day = series.reduce((worst, day) => (day.sla < worst.sla ? day : worst)).day
|
|
212
|
+
drawCalendar(series)
|
|
213
|
+
drawTrend(series)
|
|
214
|
+
drawCauses(regions)
|
|
215
|
+
drawDay()
|
|
216
|
+
drawTable(series)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function mostIn(list) {
|
|
220
|
+
const months = new Map()
|
|
221
|
+
for (const day of list) {
|
|
222
|
+
const month = date(day.day).toLocaleString("en-US", { month: "long", timeZone: "UTC" })
|
|
223
|
+
months.set(month, (months.get(month) ?? 0) + 1)
|
|
224
|
+
}
|
|
225
|
+
return [...months].sort((a, b) => b[1] - a[1])[0][0]
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function chart(id) {
|
|
229
|
+
if (!window.echarts) {
|
|
230
|
+
field(id).textContent = "Charts need cdn.jsdelivr.net, which this page could not reach."
|
|
231
|
+
return null
|
|
232
|
+
}
|
|
233
|
+
charts[id] ??= echarts.init(field(id))
|
|
234
|
+
return charts[id]
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const base = (p) => ({
|
|
238
|
+
animation: !reduced,
|
|
239
|
+
textStyle: { fontFamily: p.font },
|
|
240
|
+
tooltip: {
|
|
241
|
+
backgroundColor: p.card,
|
|
242
|
+
borderColor: p.border,
|
|
243
|
+
textStyle: { color: p.foreground, fontFamily: p.font, fontSize: 13 },
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
function drawCalendar(series) {
|
|
248
|
+
const view = chart("calendar")
|
|
249
|
+
if (!view) return
|
|
250
|
+
const p = palette()
|
|
251
|
+
const metric = state.metric
|
|
252
|
+
field("calendar-title").textContent = `${METRICS[metric].title}, every day`
|
|
253
|
+
const values = series.map((day) => day[metric])
|
|
254
|
+
// Within SLA reads best as bands around the target; calls and time to restore as a ramp.
|
|
255
|
+
const visualMap =
|
|
256
|
+
metric === "sla"
|
|
257
|
+
? {
|
|
258
|
+
type: "piecewise",
|
|
259
|
+
pieces: [
|
|
260
|
+
{ min: 0.95, label: "95% and up", color: p.series[4] },
|
|
261
|
+
{ min: 0.9, max: 0.95, label: "90–95%", color: p.series[3] },
|
|
262
|
+
{ min: 0.85, max: 0.9, label: "85–90%", color: p.series[2] },
|
|
263
|
+
{ max: 0.85, label: "Under 85%", color: p.over },
|
|
264
|
+
],
|
|
265
|
+
}
|
|
266
|
+
: {
|
|
267
|
+
type: "continuous",
|
|
268
|
+
min: Math.min(...values),
|
|
269
|
+
max: Math.max(...values),
|
|
270
|
+
inRange: { color: [p.surface, p.series[3], p.series[0]] },
|
|
271
|
+
text: [METRICS[metric].format(Math.max(...values)), METRICS[metric].format(Math.min(...values))],
|
|
272
|
+
itemWidth: 10,
|
|
273
|
+
itemHeight: 120,
|
|
274
|
+
}
|
|
275
|
+
view.setOption(
|
|
276
|
+
{
|
|
277
|
+
...base(p),
|
|
278
|
+
tooltip: { ...base(p).tooltip, formatter: ({ value }) => `${shortDay.format(new Date(value[0]))}<br><b>${METRICS[metric].format(value[1])}</b>` },
|
|
279
|
+
visualMap: {
|
|
280
|
+
...visualMap,
|
|
281
|
+
orient: "horizontal",
|
|
282
|
+
left: 36,
|
|
283
|
+
bottom: 0,
|
|
284
|
+
textStyle: { color: p.muted, fontSize: 12 },
|
|
285
|
+
itemGap: 14,
|
|
286
|
+
},
|
|
287
|
+
calendar: {
|
|
288
|
+
range: [iso(0), iso(data.days - 1)],
|
|
289
|
+
top: 26,
|
|
290
|
+
left: 36,
|
|
291
|
+
right: 8,
|
|
292
|
+
cellSize: ["auto", 18],
|
|
293
|
+
splitLine: { show: false },
|
|
294
|
+
itemStyle: { color: p.card, borderColor: p.card, borderWidth: 3 },
|
|
295
|
+
dayLabel: { firstDay: 1, nameMap: ["S", "M", "T", "W", "T", "F", "S"], color: p.muted, fontSize: 12 },
|
|
296
|
+
monthLabel: { color: p.muted, fontSize: 12 },
|
|
297
|
+
yearLabel: { show: false },
|
|
298
|
+
},
|
|
299
|
+
series: [
|
|
300
|
+
{
|
|
301
|
+
type: "heatmap",
|
|
302
|
+
coordinateSystem: "calendar",
|
|
303
|
+
data: series.map((day) => [iso(day.day), day[metric]]),
|
|
304
|
+
itemStyle: { borderRadius: 3 },
|
|
305
|
+
emphasis: { itemStyle: { borderColor: p.foreground, borderWidth: 1.5 } },
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
// The day picked, ringed.
|
|
309
|
+
type: "scatter",
|
|
310
|
+
coordinateSystem: "calendar",
|
|
311
|
+
symbol: "roundRect",
|
|
312
|
+
symbolSize: 16,
|
|
313
|
+
silent: true,
|
|
314
|
+
itemStyle: { color: "rgba(0, 0, 0, 0)", borderColor: p.foreground, borderWidth: 2 },
|
|
315
|
+
data: [[iso(state.day), 1]],
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
true
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function drawTrend(series) {
|
|
324
|
+
const view = chart("trend")
|
|
325
|
+
if (!view) return
|
|
326
|
+
const p = palette()
|
|
327
|
+
const metric = state.metric
|
|
328
|
+
field("trend-title").textContent = `${METRICS[metric].title}, with its 7-day average`
|
|
329
|
+
const values = series.map((day) => day[metric])
|
|
330
|
+
const average = values.map((_, index) => {
|
|
331
|
+
const window = values.slice(Math.max(0, index - 6), index + 1)
|
|
332
|
+
return window.reduce((sum, value) => sum + value, 0) / window.length
|
|
333
|
+
})
|
|
334
|
+
const dates = series.map((day) => iso(day.day))
|
|
335
|
+
view.setOption(
|
|
336
|
+
{
|
|
337
|
+
...base(p),
|
|
338
|
+
tooltip: { ...base(p).tooltip, trigger: "axis", valueFormatter: (value) => METRICS[metric].format(value) },
|
|
339
|
+
grid: { left: 4, right: 12, top: 12, bottom: 56, containLabel: true },
|
|
340
|
+
xAxis: {
|
|
341
|
+
type: "category",
|
|
342
|
+
data: dates,
|
|
343
|
+
axisTick: { show: false },
|
|
344
|
+
axisLine: { lineStyle: { color: p.border } },
|
|
345
|
+
axisLabel: { color: p.muted, fontSize: 12, formatter: (value) => new Date(value).toLocaleString("en-US", { month: "short", timeZone: "UTC" }), interval: (index) => date(index).getUTCDate() === 1 },
|
|
346
|
+
},
|
|
347
|
+
yAxis: {
|
|
348
|
+
type: "value",
|
|
349
|
+
scale: true,
|
|
350
|
+
splitLine: { lineStyle: { color: p.border } },
|
|
351
|
+
axisLabel: { color: p.muted, fontSize: 12, formatter: (value) => METRICS[metric].format(value) },
|
|
352
|
+
},
|
|
353
|
+
dataZoom: [
|
|
354
|
+
{ type: "inside", start: 55, end: 100 },
|
|
355
|
+
{
|
|
356
|
+
type: "slider",
|
|
357
|
+
start: 55,
|
|
358
|
+
end: 100,
|
|
359
|
+
height: 26,
|
|
360
|
+
bottom: 8,
|
|
361
|
+
borderColor: p.border,
|
|
362
|
+
backgroundColor: p.surface,
|
|
363
|
+
fillerColor: "rgba(127, 127, 127, 0.12)",
|
|
364
|
+
dataBackground: { lineStyle: { color: p.series[3] }, areaStyle: { color: p.border } },
|
|
365
|
+
selectedDataBackground: { lineStyle: { color: p.series[1] }, areaStyle: { color: p.series[4] } },
|
|
366
|
+
handleStyle: { color: p.card, borderColor: p.series[2] },
|
|
367
|
+
moveHandleStyle: { color: p.series[3] },
|
|
368
|
+
textStyle: { color: p.muted, fontSize: 12 },
|
|
369
|
+
labelFormatter: (index) => shortDay.format(date(index)),
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
series: [
|
|
373
|
+
{ name: "Daily", type: "line", data: values, symbol: "none", lineStyle: { color: p.series[3], width: 1 } },
|
|
374
|
+
{
|
|
375
|
+
name: "7-day average",
|
|
376
|
+
type: "line",
|
|
377
|
+
data: average,
|
|
378
|
+
symbol: "none",
|
|
379
|
+
smooth: true,
|
|
380
|
+
lineStyle: { color: p.foreground, width: 2.5 },
|
|
381
|
+
markLine:
|
|
382
|
+
metric === "sla"
|
|
383
|
+
? {
|
|
384
|
+
silent: true,
|
|
385
|
+
symbol: "none",
|
|
386
|
+
lineStyle: { color: p.over, type: [6, 4], width: 1.5 },
|
|
387
|
+
label: { formatter: "Target", color: p.over, fontSize: 12, position: "insideEndTop" },
|
|
388
|
+
data: [{ yAxis: data.target }],
|
|
389
|
+
}
|
|
390
|
+
: undefined,
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
// The day picked, on the line.
|
|
394
|
+
type: "scatter",
|
|
395
|
+
data: [[iso(state.day), values[state.day]]],
|
|
396
|
+
symbolSize: 10,
|
|
397
|
+
itemStyle: { color: p.card, borderColor: p.foreground, borderWidth: 2.5 },
|
|
398
|
+
silent: true,
|
|
399
|
+
z: 10,
|
|
400
|
+
},
|
|
401
|
+
],
|
|
402
|
+
},
|
|
403
|
+
true
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function drawCauses(regions) {
|
|
408
|
+
const view = chart("causes")
|
|
409
|
+
if (!view) return
|
|
410
|
+
const p = palette()
|
|
411
|
+
const totals = data.causes.map((cause, index) => ({
|
|
412
|
+
cause,
|
|
413
|
+
calls: regions.reduce((sum, region) => sum + region.causes[index], 0),
|
|
414
|
+
}))
|
|
415
|
+
const all = totals.reduce((sum, item) => sum + item.calls, 0)
|
|
416
|
+
totals.sort((a, b) => a.calls - b.calls)
|
|
417
|
+
field("causes-note").textContent = state.region || "All regions"
|
|
418
|
+
view.setOption(
|
|
419
|
+
{
|
|
420
|
+
...base(p),
|
|
421
|
+
tooltip: { ...base(p).tooltip, trigger: "axis", axisPointer: { type: "none" }, valueFormatter: (value) => `${number.format(value)} calls` },
|
|
422
|
+
grid: { left: 4, right: 56, top: 8, bottom: 0, containLabel: true },
|
|
423
|
+
xAxis: { type: "value", show: false },
|
|
424
|
+
yAxis: {
|
|
425
|
+
type: "category",
|
|
426
|
+
data: totals.map((item) => item.cause),
|
|
427
|
+
axisTick: { show: false },
|
|
428
|
+
axisLine: { show: false },
|
|
429
|
+
axisLabel: { color: p.foreground, fontSize: 13 },
|
|
430
|
+
},
|
|
431
|
+
series: [
|
|
432
|
+
{
|
|
433
|
+
type: "bar",
|
|
434
|
+
data: totals.map((item, index) => ({
|
|
435
|
+
value: item.calls,
|
|
436
|
+
itemStyle: { color: index === totals.length - 1 ? p.foreground : p.series[3], borderRadius: [0, 4, 4, 0] },
|
|
437
|
+
})),
|
|
438
|
+
barWidth: 16,
|
|
439
|
+
showBackground: true,
|
|
440
|
+
backgroundStyle: { color: p.surface, borderRadius: [0, 4, 4, 0] },
|
|
441
|
+
label: { show: true, position: "right", color: p.muted, fontSize: 12, formatter: ({ value }) => whole.format(value / all) },
|
|
442
|
+
},
|
|
443
|
+
],
|
|
444
|
+
},
|
|
445
|
+
true
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function drawDay() {
|
|
450
|
+
const day = state.day
|
|
451
|
+
const regions = chosen()
|
|
452
|
+
const calls = regions.reduce((sum, region) => sum + region.calls[day], 0)
|
|
453
|
+
const within = regions.reduce((sum, region) => sum + region.within[day], 0)
|
|
454
|
+
const restore = regions.reduce((sum, region) => sum + region.restore[day] * region.calls[day], 0) / calls
|
|
455
|
+
field("day-date").textContent = longDay.format(date(day))
|
|
456
|
+
field("day-calls").textContent = number.format(calls)
|
|
457
|
+
field("day-sla").textContent = whole.format(within / calls)
|
|
458
|
+
field("day-restore").textContent = duration(restore)
|
|
459
|
+
// Every region that day, so a region chosen above is seen beside the others.
|
|
460
|
+
const rows = data.regions.map((region) => ({
|
|
461
|
+
region: region.region,
|
|
462
|
+
sla: region.within[day] / region.calls[day],
|
|
463
|
+
calls: region.calls[day],
|
|
464
|
+
restore: region.restore[day],
|
|
465
|
+
}))
|
|
466
|
+
const metric = state.metric
|
|
467
|
+
const top = Math.max(...rows.map((row) => row[metric]))
|
|
468
|
+
field("day-regions").replaceChildren(
|
|
469
|
+
...rows.map((row) => {
|
|
470
|
+
const item = document.createElement("li")
|
|
471
|
+
const width = metric === "sla" ? row.sla * 100 : (row[metric] / top) * 100
|
|
472
|
+
const over = metric === "sla" && row.sla < data.target
|
|
473
|
+
item.innerHTML = `<span></span><span class="track"><span class="fill${over ? " over" : ""}" style="width: ${width.toFixed(1)}%"></span></span><span class="figure"></span>`
|
|
474
|
+
item.firstChild.textContent = row.region
|
|
475
|
+
item.lastChild.textContent = METRICS[metric].format(row[metric])
|
|
476
|
+
if (state.region && row.region !== state.region) item.style.opacity = "0.45"
|
|
477
|
+
return item
|
|
478
|
+
})
|
|
479
|
+
)
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function drawTable(series) {
|
|
483
|
+
const { key, ascending } = state.sort
|
|
484
|
+
const worst = [...series].sort((a, b) => a.sla - b.sla).slice(0, 8)
|
|
485
|
+
worst.sort((a, b) => (key === "date" ? a.day - b.day : a[key] - b[key]) * (ascending ? 1 : -1))
|
|
486
|
+
for (const header of document.querySelectorAll("th[data-key]")) {
|
|
487
|
+
if (header.dataset.key === key) header.setAttribute("aria-sort", ascending ? "ascending" : "descending")
|
|
488
|
+
else header.removeAttribute("aria-sort")
|
|
489
|
+
}
|
|
490
|
+
field("hardest").replaceChildren(
|
|
491
|
+
...worst.map((day) => {
|
|
492
|
+
const row = document.createElement("tr")
|
|
493
|
+
row.setAttribute("aria-selected", String(day.day === state.day))
|
|
494
|
+
row.innerHTML = `<td></td><td class="num">${number.format(day.calls)}</td><td class="num">${percent.format(day.sla)}</td><td class="num">${duration(day.restore)}</td>`
|
|
495
|
+
row.cells[0].textContent = shortDay.format(date(day.day))
|
|
496
|
+
row.addEventListener("click", () => pick(day.day))
|
|
497
|
+
return row
|
|
498
|
+
})
|
|
499
|
+
)
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function pick(day) {
|
|
503
|
+
state.day = day
|
|
504
|
+
render()
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
for (const input of document.querySelectorAll('input[name="metric"]')) {
|
|
508
|
+
input.addEventListener("change", () => {
|
|
509
|
+
state.metric = input.value
|
|
510
|
+
render()
|
|
511
|
+
})
|
|
512
|
+
}
|
|
513
|
+
for (const header of document.querySelectorAll("th[data-key]")) {
|
|
514
|
+
header.querySelector("button").addEventListener("click", () => {
|
|
515
|
+
const key = header.dataset.key
|
|
516
|
+
state.sort = { key, ascending: state.sort.key === key ? !state.sort.ascending : key !== "calls" && key !== "restore" }
|
|
517
|
+
render()
|
|
518
|
+
})
|
|
519
|
+
}
|
|
520
|
+
// Charts on a canvas keep the colors they were drawn in: draw them again in the new theme.
|
|
521
|
+
addEventListener("sixb:theme", () => data && render())
|
|
522
|
+
new ResizeObserver(() => Object.values(charts).forEach((view) => view.resize())).observe(document.querySelector("main"))
|
|
523
|
+
|
|
524
|
+
fetch("data/service.json")
|
|
525
|
+
.then((response) => response.json())
|
|
526
|
+
.then((service) => {
|
|
527
|
+
data = service
|
|
528
|
+
field("regions").replaceChildren(
|
|
529
|
+
...["", ...data.regions.map((region) => region.region)].map((name) => {
|
|
530
|
+
const chip = document.createElement("label")
|
|
531
|
+
chip.innerHTML = `<input type="radio" name="region"><span></span>`
|
|
532
|
+
const input = chip.querySelector("input")
|
|
533
|
+
input.value = name
|
|
534
|
+
input.checked = name === state.region
|
|
535
|
+
input.addEventListener("change", () => {
|
|
536
|
+
state.region = name
|
|
537
|
+
state.day = 0
|
|
538
|
+
render()
|
|
539
|
+
})
|
|
540
|
+
chip.querySelector("span").textContent = name || "All regions"
|
|
541
|
+
return chip
|
|
542
|
+
})
|
|
543
|
+
)
|
|
544
|
+
render()
|
|
545
|
+
charts.calendar?.on("click", ({ value }) => pick(Math.round((Date.parse(value[0]) - Date.parse(data.start)) / 86_400_000)))
|
|
546
|
+
})
|
|
547
|
+
</script>
|
|
548
|
+
</body>
|
|
549
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "expand",
|
|
3
|
+
"expansions": [{ "linkId": "customer", "direction": "outgoing" }],
|
|
4
|
+
"input": {
|
|
5
|
+
"kind": "sort",
|
|
6
|
+
"fields": [{ "kind": "property", "propertyId": "dueDate", "direction": "asc" }],
|
|
7
|
+
"input": {
|
|
8
|
+
"kind": "filter",
|
|
9
|
+
"input": { "kind": "start", "objectTypeId": "Invoice" },
|
|
10
|
+
"predicate": { "op": "eq", "propertyId": "status", "value": "overdue" }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sheets": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Overdue",
|
|
5
|
+
"query": "overdue",
|
|
6
|
+
"frozenColumns": 1,
|
|
7
|
+
"columns": {
|
|
8
|
+
"Invoice": { "from": "number" },
|
|
9
|
+
"Customer": { "from": "customer.name" },
|
|
10
|
+
"Due": { "from": "dueDate" },
|
|
11
|
+
"Amount": { "from": "amount", "type": "currency" },
|
|
12
|
+
"Paid": { "from": "paid", "type": "currency" },
|
|
13
|
+
"Balance": { "type": "currency", "formula": "[@Amount]-[@Paid]", "highlight": "bars" }
|
|
14
|
+
},
|
|
15
|
+
"descriptions": { "Balance": "What the customer still owes on the invoice." },
|
|
16
|
+
"totals": { "Invoice": "count", "Amount": "sum", "Balance": "sum" }
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"charts": [
|
|
20
|
+
{
|
|
21
|
+
"name": "balance-by-customer",
|
|
22
|
+
"type": "bar",
|
|
23
|
+
"sheet": "Overdue",
|
|
24
|
+
"x": "Customer",
|
|
25
|
+
"y": "Balance",
|
|
26
|
+
"aggregate": "sum",
|
|
27
|
+
"title": "Balance owed by customer"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Part,SKU,Category,Depot,Status,On hand,Reorder point,Lead time (weeks),Unit cost,Last received,Supplier,Counted
|
|
2
|
+
Scroll compressor 5 ton,CMP-5T-220,Compressors,North,Reorder,2,4,9,2840,2026-08-14,https://parts.example.com/cmp-5t-220,true
|
|
3
|
+
Scroll compressor 3 ton,CMP-3T-220,Compressors,Central,Reorder,3,4,9,2190,2026-08-21,https://parts.example.com/cmp-3t-220,true
|
|
4
|
+
Condenser fan motor,FAN-075-1PH,Motors,North,In stock,14,8,2,318.5,2026-09-26,https://parts.example.com/fan-075-1ph,false
|
|
5
|
+
Blower motor 1/2 hp,BLW-050-VS,Motors,South,In stock,9,6,3,412,2026-09-19,https://parts.example.com/blw-050-vs,true
|
|
6
|
+
Run capacitor 45/5 µF,CAP-455-370,Electrical,Coastal,In stock,62,40,1,18.75,2026-10-02,https://parts.example.com/cap-455-370,true
|
|
7
|
+
Contactor 40 A 2-pole,CON-40-2P,Electrical,Central,In stock,31,20,1,27.4,2026-09-30,https://parts.example.com/con-40-2p,true
|
|
8
|
+
Control board,BRD-ICM-282,Controls,North,Reorder,5,6,4,264,2026-09-05,https://parts.example.com/brd-icm-282,false
|
|
9
|
+
"Thermostat, 7-day programmable",TST-7D-PRO,Controls,South,In stock,18,10,2,129.99,2026-09-24,https://parts.example.com/tst-7d-pro,true
|
|
10
|
+
Expansion valve 3 ton,TXV-3T-R410,Refrigerant circuit,Coastal,Low,7,5,5,186,2026-09-11,https://parts.example.com/txv-3t-r410,true
|
|
11
|
+
Filter drier 3/8 in,FD-038-SW,Refrigerant circuit,North,In stock,40,24,1,22.6,2026-10-01,https://parts.example.com/fd-038-sw,true
|
|
12
|
+
R-410A cylinder 25 lb,REF-410A-25,Refrigerant circuit,Central,Reorder,11,12,2,348,2026-09-17,https://parts.example.com/ref-410a-25,false
|
|
13
|
+
Pleated filter 20x25x4,FLT-20254-M11,Filters,South,In stock,120,80,1,24.1,2026-10-06,https://parts.example.com/flt-20254-m11,true
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sheets": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Inventory",
|
|
5
|
+
"frozenColumns": 1,
|
|
6
|
+
"columns": {
|
|
7
|
+
"Status": {
|
|
8
|
+
"type": "tag",
|
|
9
|
+
"tones": { "Reorder": "negative", "Low": "warning", "In stock": "positive" }
|
|
10
|
+
},
|
|
11
|
+
"On hand": { "type": "number", "highlight": "bars" },
|
|
12
|
+
"Reorder point": "number",
|
|
13
|
+
"Lead time (weeks)": "number",
|
|
14
|
+
"Unit cost": { "type": "currency", "currency": "USD" },
|
|
15
|
+
"Last received": "date",
|
|
16
|
+
"Supplier": "link",
|
|
17
|
+
"Counted": "boolean"
|
|
18
|
+
},
|
|
19
|
+
"descriptions": { "Counted": "Counted by hand in the September cycle count." },
|
|
20
|
+
"widths": { "Part": 200 }
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Spend",
|
|
24
|
+
"columns": {
|
|
25
|
+
"Q3 spend": { "type": "currency", "currency": "USD", "decimals": 0 }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"charts": [
|
|
30
|
+
{
|
|
31
|
+
"name": "spend-by-category",
|
|
32
|
+
"type": "pie",
|
|
33
|
+
"sheet": "Spend",
|
|
34
|
+
"x": "Category",
|
|
35
|
+
"y": "Q3 spend",
|
|
36
|
+
"title": "Parts spend by category, Q3"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "parts-by-category",
|
|
40
|
+
"type": "bar",
|
|
41
|
+
"sheet": "Inventory",
|
|
42
|
+
"x": "Category",
|
|
43
|
+
"aggregate": "count",
|
|
44
|
+
"title": "Parts stocked, by category"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|