@shipfox/client-workflows 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.
Files changed (327) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/.storybook/preview.css +10 -0
  3. package/.storybook/preview.tsx +97 -0
  4. package/.swcrc +42 -0
  5. package/.turbo/turbo-build.log +2 -0
  6. package/.turbo/turbo-type$colon$emit.log +1 -0
  7. package/.turbo/turbo-type.log +1 -0
  8. package/CHANGELOG.md +162 -0
  9. package/LICENSE +21 -0
  10. package/dist/components/identifier/identifier.d.ts +6 -0
  11. package/dist/components/identifier/identifier.d.ts.map +1 -0
  12. package/dist/components/identifier/identifier.js +144 -0
  13. package/dist/components/identifier/identifier.js.map +1 -0
  14. package/dist/components/identifier/index.d.ts +2 -0
  15. package/dist/components/identifier/index.d.ts.map +1 -0
  16. package/dist/components/identifier/index.js +3 -0
  17. package/dist/components/identifier/index.js.map +1 -0
  18. package/dist/components/job-graph/graph-model.d.ts +27 -0
  19. package/dist/components/job-graph/graph-model.d.ts.map +1 -0
  20. package/dist/components/job-graph/graph-model.js +107 -0
  21. package/dist/components/job-graph/graph-model.js.map +1 -0
  22. package/dist/components/job-graph/index.d.ts +3 -0
  23. package/dist/components/job-graph/index.d.ts.map +1 -0
  24. package/dist/components/job-graph/index.js +3 -0
  25. package/dist/components/job-graph/index.js.map +1 -0
  26. package/dist/components/job-graph/job-duration-format.d.ts +4 -0
  27. package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
  28. package/dist/components/job-graph/job-duration-format.js +41 -0
  29. package/dist/components/job-graph/job-duration-format.js.map +1 -0
  30. package/dist/components/job-graph/job-duration-label.d.ts +5 -0
  31. package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
  32. package/dist/components/job-graph/job-duration-label.js +33 -0
  33. package/dist/components/job-graph/job-duration-label.js.map +1 -0
  34. package/dist/components/job-graph/job-graph-content.d.ts +9 -0
  35. package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
  36. package/dist/components/job-graph/job-graph-content.js +181 -0
  37. package/dist/components/job-graph/job-graph-content.js.map +1 -0
  38. package/dist/components/job-graph/job-graph-view.d.ts +11 -0
  39. package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
  40. package/dist/components/job-graph/job-graph-view.js +24 -0
  41. package/dist/components/job-graph/job-graph-view.js.map +1 -0
  42. package/dist/components/job-graph/job-graph.d.ts +3 -0
  43. package/dist/components/job-graph/job-graph.d.ts.map +1 -0
  44. package/dist/components/job-graph/job-graph.js +21 -0
  45. package/dist/components/job-graph/job-graph.js.map +1 -0
  46. package/dist/components/job-graph/job-node.d.ts +16 -0
  47. package/dist/components/job-graph/job-node.d.ts.map +1 -0
  48. package/dist/components/job-graph/job-node.js +196 -0
  49. package/dist/components/job-graph/job-node.js.map +1 -0
  50. package/dist/components/job-graph/types.d.ts +9 -0
  51. package/dist/components/job-graph/types.d.ts.map +1 -0
  52. package/dist/components/job-graph/types.js +3 -0
  53. package/dist/components/job-graph/types.js.map +1 -0
  54. package/dist/components/step-list/index.d.ts +3 -0
  55. package/dist/components/step-list/index.d.ts.map +1 -0
  56. package/dist/components/step-list/index.js +3 -0
  57. package/dist/components/step-list/index.js.map +1 -0
  58. package/dist/components/step-list/step-list-model.d.ts +36 -0
  59. package/dist/components/step-list/step-list-model.d.ts.map +1 -0
  60. package/dist/components/step-list/step-list-model.js +135 -0
  61. package/dist/components/step-list/step-list-model.js.map +1 -0
  62. package/dist/components/step-list/step-list.d.ts +32 -0
  63. package/dist/components/step-list/step-list.d.ts.map +1 -0
  64. package/dist/components/step-list/step-list.js +409 -0
  65. package/dist/components/step-list/step-list.js.map +1 -0
  66. package/dist/components/workflow-run-duration-label.d.ts +8 -0
  67. package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
  68. package/dist/components/workflow-run-duration-label.js +84 -0
  69. package/dist/components/workflow-run-duration-label.js.map +1 -0
  70. package/dist/components/workflow-run-list/index.d.ts +2 -0
  71. package/dist/components/workflow-run-list/index.d.ts.map +1 -0
  72. package/dist/components/workflow-run-list/index.js +3 -0
  73. package/dist/components/workflow-run-list/index.js.map +1 -0
  74. package/dist/components/workflow-run-list/run-display.d.ts +5 -0
  75. package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
  76. package/dist/components/workflow-run-list/run-display.js +19 -0
  77. package/dist/components/workflow-run-list/run-display.js.map +1 -0
  78. package/dist/components/workflow-run-list/types.d.ts +21 -0
  79. package/dist/components/workflow-run-list/types.d.ts.map +1 -0
  80. package/dist/components/workflow-run-list/types.js +3 -0
  81. package/dist/components/workflow-run-list/types.js.map +1 -0
  82. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
  83. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
  84. package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
  85. package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
  86. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
  87. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
  88. package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
  89. package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
  90. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
  91. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
  92. package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
  93. package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
  94. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
  95. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
  96. package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
  97. package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
  98. package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
  99. package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
  100. package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
  101. package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
  102. package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
  103. package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
  104. package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
  105. package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
  106. package/dist/components/workflow-run-summary/index.d.ts +2 -0
  107. package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
  108. package/dist/components/workflow-run-summary/index.js +3 -0
  109. package/dist/components/workflow-run-summary/index.js.map +1 -0
  110. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
  111. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
  112. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
  113. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
  114. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
  115. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
  116. package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
  117. package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
  118. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
  119. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
  120. package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
  121. package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
  122. package/dist/components/workflow-run-view/index.d.ts +3 -0
  123. package/dist/components/workflow-run-view/index.d.ts.map +1 -0
  124. package/dist/components/workflow-run-view/index.js +4 -0
  125. package/dist/components/workflow-run-view/index.js.map +1 -0
  126. package/dist/components/workflow-run-view/job-card.d.ts +17 -0
  127. package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
  128. package/dist/components/workflow-run-view/job-card.js +476 -0
  129. package/dist/components/workflow-run-view/job-card.js.map +1 -0
  130. package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
  131. package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
  132. package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
  133. package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
  134. package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
  135. package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
  136. package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
  137. package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
  138. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
  139. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
  140. package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
  141. package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
  142. package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
  143. package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
  144. package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
  145. package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
  146. package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
  147. package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
  148. package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
  149. package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
  150. package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
  151. package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
  152. package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
  153. package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
  154. package/dist/components/workflow-source-panel/index.d.ts +2 -0
  155. package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
  156. package/dist/components/workflow-source-panel/index.js +3 -0
  157. package/dist/components/workflow-source-panel/index.js.map +1 -0
  158. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
  159. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
  160. package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
  161. package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
  162. package/dist/components/workflow-status/status-visuals.d.ts +12 -0
  163. package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
  164. package/dist/components/workflow-status/status-visuals.js +54 -0
  165. package/dist/components/workflow-status/status-visuals.js.map +1 -0
  166. package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
  167. package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
  168. package/dist/components/workflow-status/workflow-status-icon.js +100 -0
  169. package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
  170. package/dist/core/entities/job-execution.d.ts +69 -0
  171. package/dist/core/entities/job-execution.d.ts.map +1 -0
  172. package/dist/core/entities/job-execution.js +83 -0
  173. package/dist/core/entities/job-execution.js.map +1 -0
  174. package/dist/core/entities/job.d.ts +56 -0
  175. package/dist/core/entities/job.d.ts.map +1 -0
  176. package/dist/core/entities/job.js +71 -0
  177. package/dist/core/entities/job.js.map +1 -0
  178. package/dist/core/entities/step-attempt.d.ts +49 -0
  179. package/dist/core/entities/step-attempt.d.ts.map +1 -0
  180. package/dist/core/entities/step-attempt.js +48 -0
  181. package/dist/core/entities/step-attempt.js.map +1 -0
  182. package/dist/core/entities/step.d.ts +41 -0
  183. package/dist/core/entities/step.d.ts.map +1 -0
  184. package/dist/core/entities/step.js +51 -0
  185. package/dist/core/entities/step.js.map +1 -0
  186. package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
  187. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
  188. package/dist/core/entities/workflow-run-attempt.js +51 -0
  189. package/dist/core/entities/workflow-run-attempt.js.map +1 -0
  190. package/dist/core/entities/workflow-run.d.ts +61 -0
  191. package/dist/core/entities/workflow-run.d.ts.map +1 -0
  192. package/dist/core/entities/workflow-run.js +104 -0
  193. package/dist/core/entities/workflow-run.js.map +1 -0
  194. package/dist/core/workflow-run-url-state.d.ts +13 -0
  195. package/dist/core/workflow-run-url-state.d.ts.map +1 -0
  196. package/dist/core/workflow-run-url-state.js +43 -0
  197. package/dist/core/workflow-run-url-state.js.map +1 -0
  198. package/dist/core/workflow-run.d.ts +13 -0
  199. package/dist/core/workflow-run.d.ts.map +1 -0
  200. package/dist/core/workflow-run.js +8 -0
  201. package/dist/core/workflow-run.js.map +1 -0
  202. package/dist/env.d.js +2 -0
  203. package/dist/env.d.js.map +1 -0
  204. package/dist/feature.d.ts +20 -0
  205. package/dist/feature.d.ts.map +1 -0
  206. package/dist/feature.js +27 -0
  207. package/dist/feature.js.map +1 -0
  208. package/dist/hooks/api/workflow-runs.d.ts +109 -0
  209. package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
  210. package/dist/hooks/api/workflow-runs.js +394 -0
  211. package/dist/hooks/api/workflow-runs.js.map +1 -0
  212. package/dist/index.d.ts +5 -0
  213. package/dist/index.d.ts.map +1 -0
  214. package/dist/index.js +5 -0
  215. package/dist/index.js.map +1 -0
  216. package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
  217. package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
  218. package/dist/pages/workflow-run-first-time-use.js +17 -0
  219. package/dist/pages/workflow-run-first-time-use.js.map +1 -0
  220. package/dist/pages/workflow-run-page.d.ts +8 -0
  221. package/dist/pages/workflow-run-page.d.ts.map +1 -0
  222. package/dist/pages/workflow-run-page.js +83 -0
  223. package/dist/pages/workflow-run-page.js.map +1 -0
  224. package/dist/routes/run-detail.d.ts +8 -0
  225. package/dist/routes/run-detail.d.ts.map +1 -0
  226. package/dist/routes/run-detail.js +21 -0
  227. package/dist/routes/run-detail.js.map +1 -0
  228. package/dist/routes/runs.d.ts +8 -0
  229. package/dist/routes/runs.d.ts.map +1 -0
  230. package/dist/routes/runs.js +20 -0
  231. package/dist/routes/runs.js.map +1 -0
  232. package/dist/tsconfig.test.tsbuildinfo +1 -0
  233. package/package.json +114 -0
  234. package/src/components/identifier/identifier.tsx +178 -0
  235. package/src/components/identifier/index.ts +1 -0
  236. package/src/components/job-graph/graph-model.test.ts +189 -0
  237. package/src/components/job-graph/graph-model.ts +178 -0
  238. package/src/components/job-graph/index.ts +2 -0
  239. package/src/components/job-graph/job-duration-format.ts +54 -0
  240. package/src/components/job-graph/job-duration-label.tsx +29 -0
  241. package/src/components/job-graph/job-graph-content.tsx +225 -0
  242. package/src/components/job-graph/job-graph-view.test.tsx +298 -0
  243. package/src/components/job-graph/job-graph-view.tsx +45 -0
  244. package/src/components/job-graph/job-graph.stories.tsx +182 -0
  245. package/src/components/job-graph/job-graph.tsx +24 -0
  246. package/src/components/job-graph/job-node.stories.tsx +364 -0
  247. package/src/components/job-graph/job-node.test.tsx +347 -0
  248. package/src/components/job-graph/job-node.tsx +202 -0
  249. package/src/components/job-graph/types.ts +9 -0
  250. package/src/components/step-list/index.ts +6 -0
  251. package/src/components/step-list/step-list-model.test.ts +369 -0
  252. package/src/components/step-list/step-list-model.ts +205 -0
  253. package/src/components/step-list/step-list.stories.tsx +419 -0
  254. package/src/components/step-list/step-list.test.tsx +566 -0
  255. package/src/components/step-list/step-list.tsx +494 -0
  256. package/src/components/workflow-run-duration-label.tsx +118 -0
  257. package/src/components/workflow-run-list/index.ts +1 -0
  258. package/src/components/workflow-run-list/run-display.test.ts +53 -0
  259. package/src/components/workflow-run-list/run-display.ts +22 -0
  260. package/src/components/workflow-run-list/types.ts +22 -0
  261. package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
  262. package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
  263. package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
  264. package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
  265. package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
  266. package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
  267. package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
  268. package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
  269. package/src/components/workflow-run-summary/index.ts +1 -0
  270. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
  271. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
  272. package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
  273. package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
  274. package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
  275. package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
  276. package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
  277. package/src/components/workflow-run-view/index.ts +2 -0
  278. package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
  279. package/src/components/workflow-run-view/job-card.tsx +566 -0
  280. package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
  281. package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
  282. package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
  283. package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
  284. package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
  285. package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
  286. package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
  287. package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
  288. package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
  289. package/src/components/workflow-source-panel/index.ts +1 -0
  290. package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
  291. package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
  292. package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
  293. package/src/components/workflow-status/status-visuals.test.ts +38 -0
  294. package/src/components/workflow-status/status-visuals.ts +36 -0
  295. package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
  296. package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
  297. package/src/core/entities/job-execution.ts +139 -0
  298. package/src/core/entities/job.ts +149 -0
  299. package/src/core/entities/step-attempt.ts +89 -0
  300. package/src/core/entities/step.ts +105 -0
  301. package/src/core/entities/workflow-run-attempt.ts +87 -0
  302. package/src/core/entities/workflow-run.ts +183 -0
  303. package/src/core/workflow-run-url-state.ts +61 -0
  304. package/src/core/workflow-run.test.ts +640 -0
  305. package/src/core/workflow-run.ts +66 -0
  306. package/src/env.d.ts +8 -0
  307. package/src/feature.ts +26 -0
  308. package/src/hooks/api/workflow-runs.test.tsx +410 -0
  309. package/src/hooks/api/workflow-runs.ts +485 -0
  310. package/src/index.ts +45 -0
  311. package/src/page-harness-budget.test.ts +33 -0
  312. package/src/pages/workflow-run-first-time-use.tsx +17 -0
  313. package/src/pages/workflow-run-page.test.tsx +517 -0
  314. package/src/pages/workflow-run-page.tsx +89 -0
  315. package/src/routes/run-detail.tsx +15 -0
  316. package/src/routes/runs.tsx +11 -0
  317. package/test/fixtures/logs.ts +13 -0
  318. package/test/fixtures/workflow-run.ts +311 -0
  319. package/test/pages.tsx +79 -0
  320. package/test/render.tsx +40 -0
  321. package/test/setup.ts +3 -0
  322. package/tsconfig.build.json +9 -0
  323. package/tsconfig.build.tsbuildinfo +1 -0
  324. package/tsconfig.json +3 -0
  325. package/tsconfig.test.json +8 -0
  326. package/vercel.json +8 -0
  327. package/vitest.config.ts +70 -0
@@ -0,0 +1,176 @@
1
+ import {TriggerSourceIcon} from '@shipfox/client-triggers';
2
+ import {RelativeTime} from '@shipfox/react-ui/relative-time';
3
+ import {Tooltip, TooltipContent, TooltipTrigger} from '@shipfox/react-ui/tooltip';
4
+ import {Code, Text} from '@shipfox/react-ui/typography';
5
+ import {cn} from '@shipfox/react-ui/utils';
6
+ import {Link} from '@tanstack/react-router';
7
+ import {
8
+ useWorkflowRunDurationAccessibleLabel,
9
+ WorkflowRunDurationLabel,
10
+ } from '#components/workflow-run-duration-label.js';
11
+ import {getWorkflowStatusVisual} from '#components/workflow-status/status-visuals.js';
12
+ import {WorkflowStatusIcon} from '#components/workflow-status/workflow-status-icon.js';
13
+ import type {WorkflowRunListItem} from '#core/workflow-run.js';
14
+ import {withoutWorkflowRunSelectionSearch} from '#core/workflow-run-url-state.js';
15
+
16
+ export function WorkflowRunRowList({
17
+ runs,
18
+ workspaceId,
19
+ projectId,
20
+ selectedWorkflowRunId,
21
+ }: {
22
+ runs: WorkflowRunListItem[];
23
+ workspaceId: string;
24
+ projectId: string;
25
+ selectedWorkflowRunId?: string | undefined;
26
+ }) {
27
+ return (
28
+ <nav aria-label="Run history">
29
+ <ul className="flex flex-col gap-4 p-8">
30
+ {runs.map((run) => (
31
+ <li key={run.id}>
32
+ <WorkflowRunRow
33
+ run={run}
34
+ workspaceId={workspaceId}
35
+ projectId={projectId}
36
+ selected={run.id === selectedWorkflowRunId}
37
+ />
38
+ </li>
39
+ ))}
40
+ </ul>
41
+ </nav>
42
+ );
43
+ }
44
+
45
+ export function WorkflowRunRow({
46
+ run,
47
+ workspaceId,
48
+ projectId,
49
+ selected,
50
+ }: {
51
+ run: WorkflowRunListItem;
52
+ workspaceId: string;
53
+ projectId: string;
54
+ selected: boolean;
55
+ }) {
56
+ const durationLabel = useWorkflowRunDurationAccessibleLabel(run.runAttempt.displayDuration);
57
+ const statusLabel = getWorkflowStatusVisual(run.status).label;
58
+ const body = (
59
+ <>
60
+ {selected ? (
61
+ <span
62
+ aria-hidden="true"
63
+ className="absolute inset-y-8 left-0 w-3 rounded-full bg-border-highlights-interactive"
64
+ />
65
+ ) : null}
66
+
67
+ <div className="flex min-w-0 items-center gap-8">
68
+ <WorkflowStatusIcon status={run.status} size={14} />
69
+ <Code variant="label" bold className="truncate text-foreground-neutral-base">
70
+ {run.name}
71
+ </Code>
72
+ </div>
73
+
74
+ <div className="flex min-w-0 items-center gap-8">
75
+ {run.triggerDisplayLabel ? (
76
+ <TriggerLabel run={run} />
77
+ ) : (
78
+ <span className="flex min-w-0 flex-1 items-center gap-8 truncate text-foreground-neutral-muted">
79
+ <span aria-hidden="true" className="size-14 shrink-0" />
80
+ <span className="sr-only">Run updated </span>
81
+ </span>
82
+ )}
83
+ <span className="ml-auto flex shrink-0 items-center gap-6">
84
+ <WorkflowRunDurationLabel
85
+ duration={run.runAttempt.displayDuration}
86
+ className="text-foreground-neutral-disabled"
87
+ />
88
+ {durationLabel ? <RunMetadataSeparator /> : null}
89
+ <Code variant="label" className="shrink-0 text-foreground-neutral-disabled">
90
+ <RelativeTime value={run.updatedAt} />
91
+ </Code>
92
+ </span>
93
+ </div>
94
+ </>
95
+ );
96
+
97
+ // Optimistic manual runs (temp-<uuid>) have no detail page until the canonical row
98
+ // replaces them on the next poll, so they render non-interactively instead of as a link
99
+ // that would navigate to a workflow run id the detail route rejects.
100
+ if (run.isTemporary) {
101
+ return (
102
+ <div className="relative flex w-full flex-col gap-4 rounded-8 border border-transparent px-10 py-8 text-left">
103
+ {body}
104
+ </div>
105
+ );
106
+ }
107
+
108
+ const runLink = (
109
+ <Link
110
+ to="/workspaces/$wid/projects/$pid/runs/$workflowRunId"
111
+ params={{wid: workspaceId, pid: projectId, workflowRunId: run.id}}
112
+ search={
113
+ ((previous: Record<string, unknown>) =>
114
+ withoutWorkflowRunSelectionSearch(previous)) as never
115
+ }
116
+ aria-current={selected ? 'page' : undefined}
117
+ aria-label={[run.name, statusLabel, durationLabel, run.triggerLabel]
118
+ .filter((part): part is string => Boolean(part))
119
+ .join(', ')}
120
+ className={cn(
121
+ 'group relative flex w-full flex-col gap-4 rounded-8 border border-transparent px-10 py-8 text-left transition-colors hover:bg-background-components-hover focus-visible:shadow-border-interactive-with-active focus-visible:outline-none',
122
+ selected && 'bg-background-components-hover',
123
+ )}
124
+ >
125
+ {body}
126
+ </Link>
127
+ );
128
+
129
+ return runLink;
130
+ }
131
+
132
+ function TriggerLabel({run}: {run: WorkflowRunListItem}) {
133
+ return (
134
+ <span className="flex min-w-0 flex-1 items-center">
135
+ <Tooltip>
136
+ <TooltipTrigger asChild>
137
+ <span className="flex w-fit max-w-full min-w-0 items-center gap-8 rounded-6 outline-none">
138
+ <TriggerSourceIcon
139
+ provider={run.triggerProvider}
140
+ source={run.triggerSource}
141
+ aria-hidden
142
+ className="size-14 shrink-0 text-foreground-neutral-muted"
143
+ />
144
+ <Text as="span" size="xs" className="min-w-0 truncate text-foreground-neutral-subtle">
145
+ {run.triggerDisplayLabel}
146
+ </Text>
147
+ </span>
148
+ </TooltipTrigger>
149
+ <TriggerTooltip label={run.triggerLabel} />
150
+ </Tooltip>
151
+ </span>
152
+ );
153
+ }
154
+
155
+ function TriggerTooltip({label}: {label: string}) {
156
+ return (
157
+ <TooltipContent>
158
+ <Text as="span" size="xs" className="block max-w-[360px] break-words">
159
+ {label}
160
+ </Text>
161
+ </TooltipContent>
162
+ );
163
+ }
164
+
165
+ function RunMetadataSeparator() {
166
+ return (
167
+ <Code
168
+ as="span"
169
+ variant="label"
170
+ aria-hidden="true"
171
+ className="shrink-0 text-foreground-neutral-disabled"
172
+ >
173
+ ·
174
+ </Code>
175
+ );
176
+ }
@@ -0,0 +1 @@
1
+ export {WorkflowRunSummary} from './workflow-run-summary.js';
@@ -0,0 +1,230 @@
1
+ import {configureApiClient} from '@shipfox/client-api';
2
+ import {screen, waitFor, within} from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import {workflowRunsQueryKeys} from '#hooks/api/workflow-runs.js';
5
+ import {
6
+ runAttemptsResponseDto,
7
+ workflowRunAttemptDto,
8
+ workflowRunDetail,
9
+ } from '#test/fixtures/workflow-run.js';
10
+ import {jsonResponse, PROJECT_TEST_WID, renderProjectPage} from '#test/pages.js';
11
+ import {WorkflowRunAttemptSwitcher} from './workflow-run-attempt-switcher.js';
12
+
13
+ const ROOT_RUN_ID = '11111111-1111-4111-8111-111111111111';
14
+ const CURRENT_RUN_ID = '22222222-2222-4222-8222-222222222222';
15
+ const THIRD_RUN_ID = '33333333-3333-4333-8333-333333333333';
16
+ const PROJECT_ID = '44444444-4444-4444-8444-444444444444';
17
+ const SWITCH_ATTEMPT_PATTERN = /Switch attempt/;
18
+ const ATTEMPT_1_PATTERN = /Attempt 1/;
19
+ const ATTEMPT_2_PATTERN = /Attempt 2/;
20
+ const ATTEMPT_3_PATTERN = /Attempt 3/;
21
+
22
+ describe('WorkflowRunAttemptSwitcher', () => {
23
+ test('hides itself for a single-attempt run', async () => {
24
+ renderSwitcher({latestAttempt: 1});
25
+
26
+ await screen.findByTestId('attempt-switcher-test-mount');
27
+ expect(screen.queryByRole('button', {name: SWITCH_ATTEMPT_PATTERN})).not.toBeInTheDocument();
28
+ });
29
+
30
+ test('shows a loading row while attempts are loading', async () => {
31
+ const user = userEvent.setup();
32
+ configureApiClient({
33
+ baseUrl: 'https://api.example.test',
34
+ fetchImpl: vi.fn(() => new Promise<Response>(() => undefined)),
35
+ });
36
+ renderSwitcher();
37
+
38
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 4'}));
39
+
40
+ expect(await screen.findByText('Loading attempts...')).toBeInTheDocument();
41
+ });
42
+
43
+ test('shows an error row when attempts fail to load', async () => {
44
+ const user = userEvent.setup();
45
+ configureApiClient({
46
+ baseUrl: 'https://api.example.test',
47
+ fetchImpl: vi.fn(() => Promise.resolve(jsonResponse({code: 'server-error'}, {status: 500}))),
48
+ });
49
+ renderSwitcher();
50
+
51
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 4'}));
52
+
53
+ expect(
54
+ await screen.findByRole('menuitem', {name: 'Could not load attempts. Retry'}),
55
+ ).toBeInTheDocument();
56
+ });
57
+
58
+ test('lists attempts newest first, updates the max attempt, and marks the current row', async () => {
59
+ const user = userEvent.setup();
60
+ configureApiClient({
61
+ baseUrl: 'https://api.example.test',
62
+ fetchImpl: vi.fn(() =>
63
+ Promise.resolve(
64
+ jsonResponse(
65
+ runAttemptsResponseDto({
66
+ attempts: [
67
+ workflowRunAttemptDto({
68
+ id: ROOT_RUN_ID,
69
+ attempt: 1,
70
+ status: 'succeeded',
71
+ created_at: '2026-05-07T01:00:00.000Z',
72
+ }),
73
+ workflowRunAttemptDto({
74
+ id: CURRENT_RUN_ID,
75
+ attempt: 2,
76
+ status: 'failed',
77
+ created_at: '2026-05-07T01:02:00.000Z',
78
+ rerun_mode: 'all',
79
+ }),
80
+ workflowRunAttemptDto({
81
+ id: THIRD_RUN_ID,
82
+ attempt: 3,
83
+ status: 'running',
84
+ created_at: '2026-05-07T01:03:00.000Z',
85
+ rerun_mode: 'failed',
86
+ }),
87
+ ],
88
+ }),
89
+ ),
90
+ ),
91
+ ),
92
+ });
93
+ renderSwitcher({latestAttempt: 2});
94
+
95
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 2'}));
96
+
97
+ await waitFor(() => expect(screen.getByText('Attempt 2 of 3')).toBeInTheDocument());
98
+ const items = await screen.findAllByRole('menuitem');
99
+ expect(items.map((item) => item.textContent)).toEqual(
100
+ expect.arrayContaining([
101
+ expect.stringMatching(ATTEMPT_3_PATTERN),
102
+ expect.stringMatching(ATTEMPT_2_PATTERN),
103
+ expect.stringMatching(ATTEMPT_1_PATTERN),
104
+ ]),
105
+ );
106
+ expect(items[0]).toHaveTextContent('Attempt 3');
107
+ expect(items[1]).toHaveTextContent('Attempt 2');
108
+ expect(items[2]).toHaveTextContent('Attempt 1');
109
+ const current = screen.getByRole('menuitem', {name: ATTEMPT_2_PATTERN});
110
+ expect(current).toHaveAttribute('aria-current', 'page');
111
+ expect(current).not.toHaveClass('bg-background-highlight-base');
112
+ expect(within(current).getByRole('img', {name: 'Failed'})).toBeInTheDocument();
113
+ });
114
+
115
+ test('keeps the max attempt from dropping when cached attempts are stale', async () => {
116
+ const user = userEvent.setup();
117
+ configureApiClient({
118
+ baseUrl: 'https://api.example.test',
119
+ fetchImpl: vi.fn(() =>
120
+ Promise.resolve(
121
+ jsonResponse(
122
+ runAttemptsResponseDto({
123
+ attempts: [
124
+ workflowRunAttemptDto({id: ROOT_RUN_ID, attempt: 1}),
125
+ workflowRunAttemptDto({id: CURRENT_RUN_ID, attempt: 2}),
126
+ ],
127
+ }),
128
+ ),
129
+ ),
130
+ ),
131
+ });
132
+ renderSwitcher({latestAttempt: 3});
133
+
134
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 3'}));
135
+
136
+ await waitFor(() => expect(screen.getByText('Attempt 2 of 3')).toBeInTheDocument());
137
+ });
138
+
139
+ test('shows stale cached attempts with a loading row while fetching a known newer attempt', async () => {
140
+ const user = userEvent.setup();
141
+ configureApiClient({
142
+ baseUrl: 'https://api.example.test',
143
+ fetchImpl: vi.fn(() => new Promise<Response>(() => undefined)),
144
+ });
145
+ const {queryClient} = renderSwitcher({latestAttempt: 3});
146
+ queryClient.setQueryData(
147
+ workflowRunsQueryKeys.attempts(CURRENT_RUN_ID),
148
+ runAttemptsResponseDto({
149
+ attempts: [
150
+ workflowRunAttemptDto({id: ROOT_RUN_ID, attempt: 1}),
151
+ workflowRunAttemptDto({id: CURRENT_RUN_ID, attempt: 2}),
152
+ ],
153
+ }),
154
+ );
155
+
156
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 3'}));
157
+
158
+ expect(await screen.findByRole('menuitem', {name: ATTEMPT_2_PATTERN})).toBeInTheDocument();
159
+ expect(screen.getByRole('menuitem', {name: 'Loading attempts...'})).toBeInTheDocument();
160
+ });
161
+
162
+ test('links to an attempt and clears selected step search on navigation', async () => {
163
+ const user = userEvent.setup();
164
+ configureApiClient({
165
+ baseUrl: 'https://api.example.test',
166
+ fetchImpl: vi.fn(() =>
167
+ Promise.resolve(
168
+ jsonResponse(
169
+ runAttemptsResponseDto({
170
+ attempts: [
171
+ workflowRunAttemptDto({id: ROOT_RUN_ID, attempt: 1}),
172
+ workflowRunAttemptDto({id: CURRENT_RUN_ID, attempt: 2}),
173
+ ],
174
+ }),
175
+ ),
176
+ ),
177
+ ),
178
+ });
179
+ const {router} = renderSwitcher({
180
+ path: `/workspaces/${PROJECT_TEST_WID}/projects/${PROJECT_ID}/runs/${CURRENT_RUN_ID}?job=job-1&step=step-1&stepAttempt=attempt-1`,
181
+ });
182
+
183
+ await user.click(await screen.findByRole('button', {name: 'Switch attempt, currently 2 of 4'}));
184
+ const attemptLink = await screen.findByRole('menuitem', {name: ATTEMPT_1_PATTERN});
185
+
186
+ expect(attemptLink).toHaveAttribute(
187
+ 'href',
188
+ `/workspaces/${PROJECT_TEST_WID}/projects/${PROJECT_ID}/runs/${CURRENT_RUN_ID}?runAttempt=1`,
189
+ );
190
+
191
+ await user.click(attemptLink);
192
+
193
+ await waitFor(() =>
194
+ expect(router.state.location.pathname).toBe(
195
+ `/workspaces/${PROJECT_TEST_WID}/projects/${PROJECT_ID}/runs/${CURRENT_RUN_ID}`,
196
+ ),
197
+ );
198
+ expect(router.state.location.search).toEqual({runAttempt: 1});
199
+ });
200
+ });
201
+
202
+ function renderSwitcher({
203
+ latestAttempt = 4,
204
+ path = `/workspaces/${PROJECT_TEST_WID}/projects/${PROJECT_ID}/runs/${CURRENT_RUN_ID}`,
205
+ }: {
206
+ latestAttempt?: number | undefined;
207
+ path?: string | undefined;
208
+ } = {}) {
209
+ const run = workflowRunDetail({
210
+ id: CURRENT_RUN_ID,
211
+ current_attempt: 2,
212
+ latest_attempt: latestAttempt,
213
+ run_attempt: workflowRunAttemptDto({
214
+ id: CURRENT_RUN_ID,
215
+ workflow_run_id: CURRENT_RUN_ID,
216
+ attempt: 2,
217
+ }),
218
+ });
219
+
220
+ return renderProjectPage(path, () => (
221
+ <div data-testid="attempt-switcher-test-mount">
222
+ <WorkflowRunAttemptSwitcher
223
+ workspaceId={PROJECT_TEST_WID}
224
+ projectId={PROJECT_ID}
225
+ run={run}
226
+ latestAttempt={latestAttempt}
227
+ />
228
+ </div>
229
+ ));
230
+ }
@@ -0,0 +1,146 @@
1
+ import {Button} from '@shipfox/react-ui/button';
2
+ import {
3
+ DropdownMenu,
4
+ DropdownMenuContent,
5
+ DropdownMenuItem,
6
+ DropdownMenuTrigger,
7
+ } from '@shipfox/react-ui/dropdown-menu';
8
+ import {RelativeTime} from '@shipfox/react-ui/relative-time';
9
+ import {Code, Text} from '@shipfox/react-ui/typography';
10
+ import {cn} from '@shipfox/react-ui/utils';
11
+ import {Link} from '@tanstack/react-router';
12
+ import {useState} from 'react';
13
+ import type {WorkflowRunAttempt, WorkflowRunDetail} from '#core/workflow-run.js';
14
+ import {withoutWorkflowRunSelectionSearch} from '#core/workflow-run-url-state.js';
15
+ import {useWorkflowRunAttemptsQuery} from '#hooks/api/workflow-runs.js';
16
+ import {WorkflowStatusIcon} from '../workflow-status/workflow-status-icon.js';
17
+
18
+ export interface WorkflowRunAttemptSwitcherProps {
19
+ workspaceId: string;
20
+ projectId: string;
21
+ run: WorkflowRunDetail;
22
+ latestAttempt: number;
23
+ }
24
+
25
+ export function WorkflowRunAttemptSwitcher({
26
+ workspaceId,
27
+ projectId,
28
+ run,
29
+ latestAttempt,
30
+ }: WorkflowRunAttemptSwitcherProps) {
31
+ const [open, setOpen] = useState(false);
32
+ const attemptsQuery = useWorkflowRunAttemptsQuery({
33
+ workflowRunId: run.id,
34
+ enabled: open,
35
+ });
36
+
37
+ if (latestAttempt <= 1) return null;
38
+
39
+ const attempts = attemptsQuery.data ?? [];
40
+ const latestLoadedAttempt = Math.max(0, ...attempts.map((attempt) => attempt.attempt));
41
+ const maxAttempt = Math.max(latestAttempt, run.runAttempt.attempt, latestLoadedAttempt);
42
+ const isLoadingMissingAttempt =
43
+ attempts.length > 0 && attemptsQuery.isFetching && latestLoadedAttempt < maxAttempt;
44
+
45
+ return (
46
+ <DropdownMenu open={open} onOpenChange={setOpen}>
47
+ <DropdownMenuTrigger asChild>
48
+ <Button
49
+ type="button"
50
+ variant="transparentMuted"
51
+ size="2xs"
52
+ iconRight="arrowDownSLine"
53
+ aria-label={`Switch attempt, currently ${run.runAttempt.attempt} of ${maxAttempt}`}
54
+ className="h-20 px-4 text-foreground-neutral-muted hover:text-foreground-neutral-base"
55
+ >
56
+ <Text as="span" size="xs" className="text-inherit">
57
+ Attempt {run.runAttempt.attempt} of {maxAttempt}
58
+ </Text>
59
+ </Button>
60
+ </DropdownMenuTrigger>
61
+ <DropdownMenuContent align="start" size="lg">
62
+ {attemptsQuery.isPending && attempts.length === 0 ? <LoadingRow /> : null}
63
+ {isLoadingMissingAttempt ? <LoadingRow /> : null}
64
+ {attemptsQuery.isError && attempts.length === 0 ? (
65
+ <ErrorRow onRetry={() => void attemptsQuery.refetch()} />
66
+ ) : null}
67
+ {attempts.length > 0
68
+ ? [...attempts]
69
+ .sort((left, right) => right.attempt - left.attempt)
70
+ .map((attempt) => (
71
+ <AttemptItem
72
+ key={attempt.id}
73
+ attempt={attempt}
74
+ current={attempt.id === run.runAttempt.id}
75
+ workflowRunId={run.id}
76
+ workspaceId={workspaceId}
77
+ projectId={projectId}
78
+ />
79
+ ))
80
+ : null}
81
+ </DropdownMenuContent>
82
+ </DropdownMenu>
83
+ );
84
+ }
85
+
86
+ function LoadingRow() {
87
+ return (
88
+ <DropdownMenuItem disabled>
89
+ <Text as="span" size="sm" className="text-foreground-neutral-muted">
90
+ Loading attempts...
91
+ </Text>
92
+ </DropdownMenuItem>
93
+ );
94
+ }
95
+
96
+ function ErrorRow({onRetry}: {onRetry: () => void}) {
97
+ return (
98
+ <DropdownMenuItem closeOnSelect={false} onSelect={onRetry}>
99
+ <Text as="span" size="sm" className="text-foreground-highlight-error">
100
+ Could not load attempts. Retry
101
+ </Text>
102
+ </DropdownMenuItem>
103
+ );
104
+ }
105
+
106
+ function AttemptItem({
107
+ attempt,
108
+ current,
109
+ workflowRunId,
110
+ workspaceId,
111
+ projectId,
112
+ }: {
113
+ attempt: WorkflowRunAttempt;
114
+ current: boolean;
115
+ workflowRunId: string;
116
+ workspaceId: string;
117
+ projectId: string;
118
+ }) {
119
+ return (
120
+ <DropdownMenuItem asChild className={cn(current && 'text-foreground-neutral-base')}>
121
+ <Link
122
+ to="/workspaces/$wid/projects/$pid/runs/$workflowRunId"
123
+ params={{wid: workspaceId, pid: projectId, workflowRunId}}
124
+ search={
125
+ ((previous: Record<string, unknown>) => {
126
+ if (current) return previous;
127
+ return {
128
+ ...withoutWorkflowRunSelectionSearch(previous),
129
+ runAttempt: attempt.attempt,
130
+ };
131
+ }) as never
132
+ }
133
+ aria-current={current ? 'page' : undefined}
134
+ >
135
+ <WorkflowStatusIcon status={attempt.status} size={14} tooltip={false} />
136
+ <Code as="span" variant="label" className="min-w-0 flex-1 truncate text-inherit">
137
+ Attempt {attempt.attempt}
138
+ </Code>
139
+ <RelativeTime
140
+ value={attempt.createdAt}
141
+ className="shrink-0 whitespace-nowrap font-code text-xs leading-20 text-foreground-neutral-muted"
142
+ />
143
+ </Link>
144
+ </DropdownMenuItem>
145
+ );
146
+ }