Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | // Abacus Studio — ParkedJobCard stories (Gitea #9). // // Every standstill an auto-start print can land in, staged without a live print // service: a dirty/uncertain bed, a failed verdict, a mid-print nozzle pause, a // plain sliced-and-waiting job, and a refused start. Failure copy is fed through // the real `describeSubmitFailure`, the same function the panel uses, so the // words here are exactly the words a user gets. The bed-photo <img> points at a // live proxy endpoint that isn't up in Storybook, so it self-hides (onError) — // the reasons and controls are the point of these stories. import type { Meta, StoryObj } from '@storybook/react' import { ParkedJobCard } from './ParkedJobCard' import type { JobRow } from './print-jobs' import { describeSubmitFailure } from './print-submit-failure' const meta: Meta<typeof ParkedJobCard> = { title: 'AbacusStudio/ParkedJobCard', component: ParkedJobCard, tags: ['autodocs'], args: { // Stop's two-tap arming is still exercisable in the canvas with no-ops. onStart: () => {}, onCancel: () => {}, }, decorators: [ (Story) => ( // the studio's dark sidebar column; the card's palette assumes it <div style={{ width: 300, padding: 12, borderRadius: 12, background: '#111827', fontFamily: 'ui-sans-serif, system-ui, sans-serif', fontSize: 12, }} > <Story /> </div> ), ], } export default meta type Story = StoryObj<typeof ParkedJobCard> /** A parked/healthy job row with the fields a story cares about; the rest are * the empty/neutral defaults `normalizeJobs` would produce. */ function job(overrides: Partial<JobRow>): JobRow { return { id: 'job-1', name: 'Abacus — 4 columns', phase: 'needs_attention', progress: null, error: null, attention: [], notices: [], startPolicy: 'auto', acknowledged: [], updatedAt: 1_784_700_000, ...overrides, } } /** The common case: the printer's vision check couldn't confirm a clear bed, * so the print is held for a human to look and start anyway — one tap. */ export const BedNotClear: Story = { args: { job: job({ attention: [ { code: 'bed_not_clear', detail: 'The print bed doesn’t look clear — remove anything left on it before printing.', }, ], }), }, } /** Vision was inconclusive (never promotes to "clear"): the human decides. */ export const BedUnknown: Story = { args: { job: job({ attention: [ { code: 'bed_unknown', detail: 'Couldn’t get a clear view of the bed — check it, then start when it’s clear.', }, ], }), }, } /** A filament/verdict check failed. Verdict-only parks carry no bed photo, so * the <img> self-hides and the reason stands on its own. */ export const VerdictFailed: Story = { args: { job: job({ attention: [ { code: 'verdict:filament-mismatch', detail: 'The loaded filaments don’t match this job’s plate — check the AMS mapping.', }, ], }), }, } /** THH has not catalogued the spool's exact family yet. The job still sliced * with the closest generic profile and now waits on an explicit acceptance. */ export const UnverifiedFilamentProfile: Story = { args: { job: job({ attention: [ { code: 'filament_profile_unverified:0', detail: "Filament 1 reports unrecognized material family 'PLA-WOOD'. THH inferred the PLA material class and sliced it with fallback profile 'pla-basic'. Verify the material and temperature settings before starting.", }, ], }), }, } /** A clean `hold` slice waiting on a human ▶. Auto-start won't produce these, * but a pre-existing held job resolves the same way — plain Start, no photo. */ export const ReadyToStart: Story = { args: { job: job({ phase: 'ready', startPolicy: 'hold', attention: [] }), }, } /** The printer paused mid-print for a hands-on nozzle confirmation: no Start * (it's already printing), just the situation and a Stop. */ export const PrintingNozzleConfirm: Story = { args: { job: job({ name: 'Abacus — 7 columns', phase: 'printing', attention: [ { code: 'nozzle_confirm', detail: 'Paused to confirm the nozzle — check it at the printer, then press Resume.', }, ], }), }, } /** The printer paused itself on a fault mid-print (the abacus Stage B of * 2026-09-13): the service's sentence is the printer's own facts plus what * our file does at that layer, and each code links to Bambu's page for it. */ export const PrintingPausedFault: Story = { args: { job: job({ name: 'Abacus — 7 columns (Stage B)', phase: 'printing', attention: [ { code: 'print_paused_fault', detail: 'Printer paused at reported layer 6 (8%). It reported HMS 07FF-2000-0002-0004. Our file at that layer changes from filament 2 (PLA, slot 0.1) to filament 0 (TPU, slot 0.3), load 4 of filament 0 in this file.', printer: { gcodeState: 'PAUSE', hms: [ { hex: '07FF-2000-0002-0004', wiki: 'https://wiki.bambulab.com/en/x1/troubleshooting/hmscode/07FF_2000_0002_0004', lvl: 3, }, ], layer: 6, percent: 8, totalLayers: 68, }, }, ], }), }, } /** Paused mid-print with nothing reported — a hand on the printer's screen. */ export const PrintingPausedNoCode: Story = { args: { job: job({ name: 'Abacus — 7 columns', phase: 'printing', attention: [ { code: 'print_paused', detail: 'Printer paused at reported layer 12 (40%). It reported no error code.', printer: { gcodeState: 'PAUSE', hms: [], layer: 12, percent: 40, totalLayers: 68 }, }, ], }), }, } /** A start that was refused: the service's honest, coded reason renders inline * through the same copy the submit panel uses. */ export const StartRefused: Story = { args: { job: job({ attention: [{ code: 'bed_not_clear', detail: 'The print bed doesn’t look clear.' }], }), startFailure: describeSubmitFailure(409, { detail: { code: 'acknowledgement_required', message: 'Confirm the bed before printing.', missing: ['bed_not_clear'], }, }), }, } // ── Two-stage feet print (Gitea #38 / things-haunt-house #456, #463) ───────── // The parks a split pair can land in. The wording is the gateway's own `detail`, // copied from `print_jobs.py`, because that is what the card renders — there is // no client-side mapping for these codes. /** Stage A (feet, external spool) submitted with the AMS still at the nozzle: * positive sensor evidence, so the gateway re-parks it even after an * acknowledgement — the swap has to actually happen (#463). */ export const StageAAwaitingExternalSpool: Story = { args: { job: job({ name: 'Abacus — 4 columns · Stage A (feet)', attention: [ { code: 'awaiting_external_spool', detail: 'the AMS is still at the nozzle (tray 5) — pull the AMS tube from the toolhead, load the external spool through to the nozzle, then acknowledge to start', }, ], }), }, } /** A chained Stage B sliced and held with nothing wrong: plain Start, no * reasons. (Abaci submits its own stages `auto`, so this is the `hold` shape * another client — or the cockpit's ▶ — would see.) */ export const StageBReadyHeld: Story = { args: { job: job({ name: 'Abacus — 4 columns · Stage B (body)', phase: 'ready', startPolicy: 'hold', attention: [], }), }, } /** Stage B parked because the external spool is still on the feed — the * mirror of the Stage A park above (#451 C6). */ export const StageBAwaitingSpoolSwap: Story = { args: { job: job({ name: 'Abacus — 4 columns · Stage B (body)', startPolicy: 'hold', attention: [ { code: 'awaiting_spool_swap', detail: 'a spool is still loaded on the external feed — unload it at the printer and let the AMS take over, then acknowledge to start', }, ], }), }, } /** Stage B's expectation-based bed check: the live bed no longer looks like * Stage A's finish frames (the plate moved, or the feet came off). */ export const StageBBedMismatch: Story = { args: { job: job({ name: 'Abacus — 4 columns · Stage B (body)', startPolicy: 'hold', attention: [ { code: 'bed_mismatch', detail: "the plate no longer holds the previous job's output", frameRef: null, }, ], }), }, } /** Chained starts switched off on the gateway: prepared, but acknowledging * can't override it, so the Start button is disabled and says why. */ export const StageBChainStartDisabled: Story = { args: { job: job({ name: 'Abacus — 4 columns · Stage B (body)', startPolicy: 'hold', attention: [ { code: 'chain_start_disabled', detail: 'chained same-plate starts are switched off on this gateway — a chained job may be prepared but not started until CHAINED_START_ENABLED is set', }, ], }), }, } |