prismalens 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZZ3DOHTJ.js → chunk-3PSZIGUA.js} +14 -2
- package/dist/src/cli/up.js +1 -1
- package/dist/src/cli/update-notice.js +1 -1
- package/dist/src/cli/upgrade.js +70 -10
- package/node_modules/@prismalens/api/dist/src/core/settings/about.service.js +28 -8
- package/node_modules/@prismalens/api/dist/src/core/settings/update.service.js +9 -3
- package/node_modules/@prismalens/api/public/assets/{AddProjectDialog-BEBKziDJ.js → AddProjectDialog-p3LLsE1B.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{AgentDetail-DNNZ2RSQ.js → AgentDetail-CbhnttdO.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{AlertsBlank-M7HkWlgo.js → AlertsBlank-CVPQuVxb.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/Composer-DIYA4JDp.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{HelperThread-BmGnmkL5.js → HelperThread-DNWceguA.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{Hint-BCpVhAvV.js → Hint-Od6cnmvm.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{HomeComposer-BI6Vhge8.js → HomeComposer-sotk5r71.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{HypothesesCard-HKxfxVbG.js → HypothesesCard-BcaBcZ8b.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{IncidentHeader-BIYafwD0.js → IncidentHeader-GG30mdkp.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{KeptWorkspaces-ozJb7lRG.js → KeptWorkspaces-B_TvW0ro.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{MergeDialog-DRjChRQQ.js → MergeDialog-82IoAwUo.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{NewThread-HisGwIRc.js → NewThread-CAT5otyD.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{PanelShell-BHpdPx3P.js → PanelShell-ghqMmsZW.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{ProjectList-lAMigyat.js → ProjectList-DAPGOIoj.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{ResolveDialog-DbMNHrwo.js → ResolveDialog-CPNlWRrP.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{RingTick-DkMvLoUV.js → RingTick-Zd_duqBv.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{RunStrip-CLaYEj2D.js → RunStrip-CAosRfHY.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{RunsMenu-CD4Yy4jT.js → RunsMenu-B9_X_90y.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{ScheduleDialog-DPYtmK0g.js → ScheduleDialog-DKRvxEa7.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{ServiceFormDialog-9-qDnObk.js → ServiceFormDialog-Bfyz7V7X.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{SubagentPane-exGNOprU.js → SubagentPane-DxVUfFbn.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{Transcript-2ke3pjya.js → Transcript-Csly_ODF.js} +4 -4
- package/node_modules/@prismalens/api/public/assets/{TriggerCard-BIAznpA9.js → TriggerCard-B4_zrVDz.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{WebhookCopy-C8w9xwD6.js → WebhookCopy-Cy9bof9B.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{WorkspaceFields-DCSJCThm.js → WorkspaceFields-CXSg1krp.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{___design-8brlEBqd.js → ___design-F8T4DJmm.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_authenticated-BETuqAeS.js → _authenticated-CJYOmwQf.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-y5y3CxjT.js → _id-0EUmYM6O.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-B8v8uWe_.js → _id-B4P0alBy.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-DiQnst4D.js → _id-C_OturvV.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-BeO8QWfB.js → _id-D3aRrGal.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-Cnh_sXTf.js → _id-Jd8V68_n.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id-VgE-Xeq5.js → _id-o6KZri3X.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{_id_.runs._runId-U4P5LH-M.js → _id_.runs._runId-B2eT22Ak.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{alerts-BI1l8Cxn.js → alerts-DkmUI_TY.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{automation-FhFtuS5_.js → automation-Cw0qe0-8.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{boxes-Dh2QZfJa.js → boxes-B__2zYVO.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/check-C96xWdLm.js +1 -0
- package/node_modules/@prismalens/api/public/assets/chevron-left-S6eOHk4C.js +1 -0
- package/node_modules/@prismalens/api/public/assets/chevron-right-DXWfiPu3.js +1 -0
- package/node_modules/@prismalens/api/public/assets/circle-Dy7W2aR3.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{command-chip-5Lf0FARB.js → command-chip-BFhgzAY5.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{conversation-CXkaesO_.js → conversation-Cf7_OnZb.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{copy-BUnkkIK-.js → copy-_5FNPl7W.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/desktop-yb-lqHMd.js +9 -0
- package/node_modules/@prismalens/api/public/assets/{device-name-CZPntaj6.js → device-name-CxC_JUpj.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{dist-CYLssYEL.js → dist-CtE2KbbF.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{dist-CQz4Osl1.js → dist-zIr1CK3Q.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{dropdown-menu-Db9u3UIb.js → dropdown-menu-yoILSLgJ.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{ellipsis-d1vABf4v.js → ellipsis-BsNLvnl9.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{evidence-files-C9UcJR1J.js → evidence-files-C_a9Ct8m.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{fixes-CgjsPkfr.js → fixes-BWFKY2Zx.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{folder-git-2-DRsiaeAx.js → folder-git-2-Co_pliwR.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{globe-D2S-zGel.js → globe-C0OZE9Nx.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{highlighted-body-JLMTFACH-B_v9yJZa.js → highlighted-body-JLMTFACH-DGWjXpHw.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{incidents-B0KnIveX.js → incidents-TJ2Rty4H.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{index-DZMj9YK4.js → index-BoI68UdU.js} +6 -6
- package/node_modules/@prismalens/api/public/assets/{key-CjFGD02m.js → key-BjaZOgBI.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{live-refresh-C5Jfxdxb.js → live-refresh-DlFUKDgl.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-BQk6GVWB.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{new-Ci475pgf.js → new-Bo1xcbFc.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{pair-CobM73_c.js → pair-BePmSLQZ.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{pencil-BwNhunJy.js → pencil-CKAiE_29.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/plus-f3bDJe68.js +1 -0
- package/node_modules/@prismalens/api/public/assets/projects-Cwgyv1jw.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{restart-40l7XMmi.js → restart-FIcq7DzH.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{route-DX3TI7JD.js → route-1kdlRYKk.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{route-Dvao2bBW.js → route-CLgiK_od.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{route-Bg17GbpR.js → route-q1BFinlW.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{route-ah1SnYbH.js → route-rOkhgLEt.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{run-details-DTzMO1X0.js → run-details-B1I5SE7k.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{run-labels-ubQZmnqd.js → run-labels-BLTL5eG9.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{select-98_n4DVz.js → select-hkRu0Dxf.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{service-detail.utils-ulWHS1Ao.js → service-detail.utils-BQfYgq-F.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{services-CZQMzqYj.js → services-CnYlTAN3.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{settings-QPxeIS82.js → settings-COMwARMq.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{source-words-B5oOdiQU.js → source-words-CCeTLwOy.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{state-tone-DEsvSFn6.js → state-tone-DOGSNxJV.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{switch-DpPkkZxw.js → switch-u0tmvVOg.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{theme-provider-C9jvt7JX.js → theme-provider-Cg3suR2p.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{threads-BqAHgCGd.js → threads-Pk0lpo7I.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{tick-copy-B7dbIrfQ.js → tick-copy-DPjahm-5.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{use-operator-BH6GxjAY.js → use-operator-BdSmIxpm.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{use-repositories-orpc-c6hPOKjE.js → use-repositories-orpc-Ban_zGD7.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{use-threads-orpc-rBrvQXJf.js → use-threads-orpc-mbpsuq3G.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{useInvestigationRun-xdB0R08B.js → useInvestigationRun-BJKQxOF2.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/{useQueries-CGpidxif.js → useQueries-B6U7UAZl.js} +1 -1
- package/node_modules/@prismalens/api/public/index.html +2 -2
- package/node_modules/@prismalens/config/dist/index.js +2 -1
- package/node_modules/@prismalens/config/dist/utils/install-channel.js +3 -3
- package/node_modules/@prismalens/config/dist/utils/update-channel.js +65 -0
- package/node_modules/@prismalens/config/dist/utils/update-check.js +67 -34
- package/node_modules/@prismalens/contracts/dist/schemas/settings.js +16 -0
- package/package.json +3 -2
- package/node_modules/@prismalens/api/public/assets/Composer-MAXlRLhF.js +0 -1
- package/node_modules/@prismalens/api/public/assets/check-DfKru7HJ.js +0 -1
- package/node_modules/@prismalens/api/public/assets/chevron-left-DWLaEwl8.js +0 -1
- package/node_modules/@prismalens/api/public/assets/chevron-right-tPbGnTHi.js +0 -1
- package/node_modules/@prismalens/api/public/assets/circle-BqIhGHXt.js +0 -1
- package/node_modules/@prismalens/api/public/assets/desktop-Bqso9PNq.js +0 -9
- package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-CqliGVff.js +0 -1
- package/node_modules/@prismalens/api/public/assets/plus-DWSahnrj.js +0 -1
- package/node_modules/@prismalens/api/public/assets/projects-CIckRlw8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_t as e,c as t}from"./desktop-
|
|
1
|
+
import{_t as e,c as t}from"./desktop-yb-lqHMd.js";import{t as n}from"./link-BHh9_evg.js";import{I as r,j as i,z as a}from"./index-BoI68UdU.js";import{Z as o}from"./Hint-Od6cnmvm.js";import{i as s,t as c}from"./trigger-DVo1oKMX.js";import{r as l}from"./run-labels-BLTL5eG9.js";import{t as u}from"./jsx-runtime-Wy9s6hX0.js";var d=u(),f=4;function p({incident:e}){let t=a(3e4),{kind:o,source:u}=s(e),p=e.alerts?.[0];if(o===`you`||!p)return null;let m=i[o],h=l(e.alerts??[],t),g=Object.entries(p.labels??{}).slice(0,f);return(0,d.jsxs)(`li`,{className:`flex flex-col gap-1.5 rounded-surface bg-surface-1 px-3.5 py-3`,"data-testid":`trigger-card`,"data-kind":o,children:[(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-text-2`,children:[(0,d.jsx)(m,{"aria-hidden":!0,className:`size-3.5 shrink-0 stroke-[1.75]`}),(0,d.jsx)(`span`,{children:c[o]}),u&&(0,d.jsx)(`span`,{className:`text-text-3`,children:u}),h&&(0,d.jsx)(`span`,{className:h.firing?`text-danger`:`text-text-3`,"data-testid":`trigger-firing`,children:h.text}),(0,d.jsx)(n,{to:`/alerts/$id`,params:{id:p.id},className:`ml-auto inline-flex min-h-6 items-center text-accent hover:underline`,"data-testid":`trigger-open`,children:`Open`})]}),(0,d.jsx)(`p`,{className:`min-w-0 truncate text-body font-medium text-text-1`,children:r(p.title)}),g.length>0&&(0,d.jsx)(`p`,{className:`flex min-w-0 flex-wrap gap-x-3 gap-y-0.5 font-mono text-meta text-text-3 max-sm:hidden`,children:g.map(([e,t])=>(0,d.jsxs)(`span`,{className:`min-w-0 break-all`,children:[e,`=`,t]},e))})]})}var m=new Intl.DateTimeFormat(void 0,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function h({scheduleId:r,ranAt:a}){let{data:s}=e(t.schedules.get.queryOptions({input:{id:r}})),l=s?.schedule,u=i.schedule;return(0,d.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-surface bg-surface-1 px-3.5 py-3`,"data-testid":`trigger-card`,"data-kind":`schedule`,children:[(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-text-2`,children:[(0,d.jsx)(u,{"aria-hidden":!0,className:`size-3.5 shrink-0 stroke-[1.75]`}),(0,d.jsx)(`span`,{children:c.schedule}),l&&(0,d.jsx)(`span`,{className:`text-text-3`,children:o(l)}),a&&(0,d.jsxs)(`span`,{className:`text-text-3`,"data-testid":`trigger-ran`,children:[`ran `,m.format(new Date(a))]}),(0,d.jsx)(n,{to:`/schedules/$id`,params:{id:r},className:`ml-auto inline-flex min-h-6 items-center text-accent hover:underline`,"data-testid":`trigger-open`,children:`Open`})]}),(0,d.jsx)(`p`,{className:`min-w-0 truncate text-body font-medium text-text-1`,children:l?.name??`Scheduled run`})]})}export{p as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./CopyButton-DKP5JHET.js";import{ot as t,st as n}from"./index-
|
|
1
|
+
import{t as e}from"./CopyButton-DKP5JHET.js";import{ot as t,st as n}from"./index-BoI68UdU.js";import{t as r}from"./jsx-runtime-Wy9s6hX0.js";var i=r();function a({testIdPrefix:r,buttonClassName:a}){let{data:o}=t();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e,{value:n(`prometheus`),label:`Copy URL`,testId:`${r}-copy-url`,className:a}),o&&(0,i.jsx)(e,{value:o.token,label:`Copy token`,testId:`${r}-copy-token`,className:a})]})}export{a as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{t as r}from"./input-CXxt1dAV.js";import{i,n as a,o,s,t as c}from"./select-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{t as r}from"./input-CXxt1dAV.js";import{i,n as a,o,s,t as c}from"./select-hkRu0Dxf.js";import{v as l}from"./source-words-CCeTLwOy.js";var u=e(t()),d=n(),f=[{key:`method`,label:`Method`},{key:`location`,label:`Location`},{key:`retention`,label:`After a run`},{key:`setup`,label:`Setup command`},{key:`teardown`,label:`Teardown command`},{key:`copyIn`,label:`Files to copy in`},{key:`submodules`,label:`Submodules`},{key:`branch`,label:`Branch`}],p={worktree:`Worktree of your repo`,clone:`Clone of your repo`},m={"keep-until-resolved":`Keep until the incident is resolved`,"remove-unless-changed":`Remove unless changed`,"always-remove":`Always remove`,"keep-days":`Keep for some days`},h={skip:`Skip`,"top-level":`Top level`,recursive:`Recursive`},g={detached:`Detached`,named:`Named prismalens/<incident>-<run>`};function _(e){let t=[e.posix?.trim()&&`macOS and Linux: ${e.posix.trim()}`,e.windows?.trim()&&`Windows: ${e.windows.trim()}`].filter(Boolean);return t.length?t.join(`; `):`None`}function v(e,t,n){switch(e){case`method`:return p[t.method];case`location`:return t.location??n;case`retention`:return t.retention.kind===`keep-days`?`Keep for ${t.retention.days} days`:m[t.retention.kind];case`setup`:case`teardown`:return _(t[e]);case`copyIn`:return t.copyIn.length?t.copyIn.join(`, `):`None`;case`submodules`:return h[t.submodules];case`branch`:return g[t.branch]}}function y({value:e,options:t,label:n,onChange:r,disabled:l}){return(0,d.jsxs)(c,{value:e,onValueChange:e=>r(e),disabled:l,children:[(0,d.jsx)(o,{"aria-label":n,className:`w-full sm:w-72`,children:(0,d.jsx)(s,{})}),(0,d.jsx)(a,{children:Object.keys(t).map(e=>(0,d.jsx)(i,{value:e,children:t[e]},e))})]})}function b({value:e,label:t,onChange:n,disabled:i}){let a=(t,r)=>{let i={...e};r.trim()?i[t]=r:delete i[t],n(i)};return(0,d.jsxs)(`div`,{className:`grid gap-2`,children:[(0,d.jsx)(r,{"aria-label":`${t} on macOS and Linux`,placeholder:`macOS and Linux, e.g. pnpm install`,value:e.posix??``,onChange:e=>a(`posix`,e.target.value),disabled:i,className:`font-mono`}),(0,d.jsx)(r,{"aria-label":`${t} on Windows`,placeholder:`Windows, e.g. pnpm install`,value:e.windows??``,onChange:e=>a(`windows`,e.target.value),disabled:i,className:`font-mono`})]})}var x=e=>e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(Boolean);function S({value:e,onChange:t,disabled:n}){let[r,i]=(0,u.useState)(e.join(`
|
|
3
3
|
`)),a=e.join(`
|
|
4
4
|
`);return(0,u.useEffect)(()=>{i(e=>x(e).join(`
|
package/node_modules/@prismalens/api/public/assets/{___design-8brlEBqd.js → ___design-F8T4DJmm.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./AgentDetail-
|
|
1
|
+
import{L as e}from"./AgentDetail-CbhnttdO.js";import{t}from"./Transcript-Csly_ODF.js";import{t as n}from"./RunStrip-CAosRfHY.js";import{n as r}from"./TriggerCard-B4_zrVDz.js";import{B as i,M as a,P as o,rt as s}from"./index-BoI68UdU.js";import{a as c,n as l,r as u,t as d}from"./State-CCKzehkH.js";import{t as f}from"./jsx-runtime-Wy9s6hX0.js";var p=f(),m=Date.parse(`2026-11-05T12:00:00Z`),h=e=>new Date(m-e*6e4).toISOString(),g=(e,t,n={})=>({id:`fixture-${e}`,number:7,title:e,status:`investigating`,severity:`high`,triggeredAt:h(30),updatedAt:h(2),alertCount:+!!t,alerts:t?[{id:`alert-${e}`,title:e,status:`triggered`,source:t,triggeredAt:h(30),labels:{severity:`high`,service:`checkout-api`}}]:[],investigations:[],tags:t?[]:[`chat`],service:{id:`s1`,name:`checkout-api`,displayName:`Checkout API`},...n}),_=e=>o({section:`active`,incident:{id:e.id,number:e.number,title:e.title,severity:e.severity,status:e.status},threads:[{id:`run-${e.id}`,incidentId:e.id,kind:`investigation`,status:`completed`,title:e.title,triggerType:e.alertCount?`alert`:`manual`,lastActivityAt:e.updatedAt,serviceName:`Checkout API`,projectName:null}]},e),v=[{..._(g(`CheckoutLatencyHigh`,`prometheus`)),state:`asks`},{..._(g(`PaymentsQueueBacklog`,`prometheus`)),state:`failed`},{..._(g(`CacheMissSpike`,`prometheus`)),state:`working`},{..._(g(`ApiLatencyP99High`,`prometheus`)),state:`ready`},_(g(`CI failed on main`,`github`)),_(g(`Why does the cart reload twice?`,null))],y=[{kind:`prose`,key:`p1`,text:`Looking at **recent commits** first.`},{kind:`tools`,key:`t1`,count:3,summary:`ran 2 commands, read 1 file`,failed:0,running:0,rows:[],callIds:[`c1`,`c2`,`c3`]},{kind:`prose`,key:`p2`,text:"The p99 rise follows `d37d888`, which dropped the index the list query uses."},{kind:`end`,key:`e1`,tone:`done`,text:`Report ready`,report:!0}];function b(){return(0,p.jsx)(`div`,{className:`h-full overflow-y-auto`,"data-testid":`design-gallery`,children:(0,p.jsxs)(`div`,{className:`mx-auto flex max-w-[960px] flex-col gap-10 px-6 py-8`,children:[(0,p.jsx)(`h1`,{className:`text-display`,children:`States`}),(0,p.jsx)(x,{title:`Thread rows: sidebar, then the Threads page`,children:(0,p.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,children:[(0,p.jsx)(`div`,{className:`flex flex-col gap-px rounded-pool bg-surface-1 p-2`,children:v.map(e=>(0,p.jsx)(a,{row:e,now:m,on:!1},e.key))}),(0,p.jsx)(`div`,{className:`flex flex-col gap-px`,children:v.map(e=>(0,p.jsx)(a,{row:e,now:m,on:!1,detailed:!0},e.key))})]})}),(0,p.jsx)(x,{title:`What started a thread`,children:(0,p.jsxs)(`ul`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(r,{incident:g(`CheckoutLatencyHigh`,`prometheus`)}),(0,p.jsx)(r,{incident:g(`CI failed on main`,`github`)})]})}),(0,p.jsx)(x,{title:`Run strip`,children:(0,p.jsx)(`div`,{className:`flex flex-col gap-2 rounded-pool bg-surface-1`,children:[[`working`,`Run 1 investigating`,`Reading worker/consumer.py`],[`done`,`Run 1 concluded`,`Likely cause found, 2m ago`],[`failed`,`Run 1 failed`,`The agent is not signed in.`]].map(([e,t,r])=>(0,p.jsx)(n,{state:e,label:t,detail:r,incidentId:`fixture`,runs:[],current:null},e))})}),(0,p.jsx)(x,{title:`Transcript: a folded tool group and the report card`,children:(0,p.jsx)(`div`,{className:`h-[420px] rounded-pool bg-canvas`,children:(0,p.jsx)(t,{items:y,incidentId:null,agent:`The agent`,report:{title:`Run 1 concluded: likely cause`,summary:`The p99 rise follows d37d888.`,stop:null,lasting:null}})})}),(0,p.jsx)(x,{title:`State words, the ring and agent marks`,children:(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[[`danger`,`warn`,`ok`,`live`,`accent`,`neutral`,`quiet`].map(e=>(0,p.jsx)(s,{tone:e,children:e},e)),(0,p.jsx)(i,{}),[`claude-code`,`codex`,`opencode`,`gemini`,`unknown`].map(t=>(0,p.jsx)(e,{id:t,className:`size-5`},t))]})}),(0,p.jsx)(x,{title:`Empty, loading and failed`,children:(0,p.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,p.jsx)(l,{text:`No threads yet.`}),(0,p.jsx)(u,{rows:3}),(0,p.jsx)(c,{text:`This run did not load.`,onRetry:()=>void 0}),(0,p.jsx)(d,{title:`Add your first service`,testId:`gallery-blank`,children:(0,p.jsx)(`p`,{className:`text-body text-text-2`,children:`One action fills this.`})})]})})]})})}function x({title:e,children:t}){return(0,p.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(`h2`,{className:`text-heading text-text-2`,children:e}),t]})}export{b as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as e,O as t,Pt as n,T as r,Y as i}from"./index-
|
|
1
|
+
import{E as e,O as t,Pt as n,T as r,Y as i}from"./index-BoI68UdU.js";import{a,n as o,t as s}from"./jsx-runtime-Wy9s6hX0.js";import{C as c,b as l,w as u,x as d,y as f}from"./use-repositories-orpc-Ban_zGD7.js";import{n as p}from"./Row-B3HLhwlw.js";import{n as m,t as h}from"./PanelShell-ghqMmsZW.js";import{t as g}from"./link-BHh9_evg.js";import{d as _,i as ee,s as te,u as ne}from"./desktop-yb-lqHMd.js";import{t as re}from"./button-DmIfWVZ8.js";import{i as ie,t as ae}from"./use-media-query-CAes3BP5.js";import{$ as oe,Q as se,Y as ce,_ as v}from"./Hint-Od6cnmvm.js";import{n as le,s as y}from"./restart-FIcq7DzH.js";import{a as b,i as ue,o as de,t as x}from"./command-chip-BFhgzAY5.js";import{t as fe}from"./plus-f3bDJe68.js";import{t as pe}from"./utils-A3okWeke.js";import{r as me}from"./key-BjaZOgBI.js";import{a as he}from"./use-back-R0oWqfab.js";import{n as ge}from"./live-refresh-DlFUKDgl.js";var S=a(o()),C=s(),_e=[{keys:[`Ctrl`,`K`],label:`Search`},{keys:[`C`],label:`Log incident`},{keys:[`Ctrl`,`Shift`,`O`],label:`New thread`},...r.map(e=>({keys:[`G`,e.key.toUpperCase()],label:`Go to ${e.label}`})),{keys:[`J`,`K`],label:`Next or previous item in the active list`},{keys:[`Enter`],label:`Open the highlighted row`},{keys:[`[`],label:`Fold the sidebar to its icons`},{keys:[`Ctrl`,"`"],label:`Show or hide the terminal`},{keys:[`Esc`],label:`Go back`},{keys:[`Enter`],label:`Send, at the agent's next pause`},{keys:[`Ctrl`,`Enter`],label:`Send now, ending the agent's step`},{keys:[`Shift`,`Enter`],label:`New line in the box`},{keys:[`Esc`],label:`Stop the agent, from the box while it works`},{keys:[`?`],label:`This sheet`}];function ve({open:e,onOpenChange:t}){return(0,C.jsx)(f,{open:e,onOpenChange:t,children:(0,C.jsxs)(l,{size:`sm`,"data-testid":`shortcut-sheet`,children:[(0,C.jsxs)(c,{children:[(0,C.jsx)(u,{children:`Keyboard`}),(0,C.jsx)(d,{children:`Keys work anywhere you are not typing. J/K works in the active thread or alert list.`})]}),(0,C.jsx)(`div`,{children:_e.map(e=>(0,C.jsx)(p,{label:e.label,className:`py-1`,trailing:e.keys.map(e=>(0,C.jsx)(`kbd`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-[4px] bg-surface-3 px-1 font-mono text-meta text-text-2`,children:e},e))},e.label))})]})})}var ye=`pl.restartNotice.seen`,be=36e5;function xe(e,t,n){if(!e||e.resumed.length+e.skipped.length===0||t===e.at)return!1;let r=n-new Date(e.at).getTime();return r>=0&&r<=be}var Se=(e,t,n)=>`${e} ${e===1?t:n}`;function Ce(e){let t=Math.max(1,Math.round(e/6e4));if(t<60)return Se(t,`minute`,`minutes`);let n=Math.round(t/60);return n<48?Se(n,`hour`,`hours`):Se(Math.round(n/24),`day`,`days`)}function we(e,t){let n=e.skipped[0],r=n?n.incidentNumber===null?n.title:`INC-${n.incidentNumber}`:null;return{title:`PrismaLens started again`,gap:e.stoppedAt?`It stopped at ${ce(e.stoppedAt,t)} and was off for ${Ce(new Date(e.at).getTime()-new Date(e.stoppedAt).getTime())}.`:null,resumed:e.resumed.length?`${Se(e.resumed.length,`investigation`,`investigations`)} resumed`:null,skipped:n&&r?`${e.skipped.length} couldn't: ${r}, ${le(n.reason)??n.reason}`:null,open:n&&r?{investigationId:n.investigationId,incidentId:n.incidentId,label:`Open ${r}`}:null}}function Te(){try{return localStorage.getItem(ye)}catch{return null}}function Ee(){let{data:e}=v(),t=ie(ae),[n]=(0,S.useState)(()=>Date.now()),[r,i]=(0,S.useState)(void 0);if((0,S.useEffect)(()=>i(Te()),[]),r===void 0||!xe(e,r,n))return null;let a=we(e,n),o=()=>{try{localStorage.setItem(ye,e.at)}catch{}i(e.at)},s=a.open&&(0,C.jsx)(re,{variant:`secondary`,asChild:!0,className:`self-start`,"data-testid":`restart-notice-open`,children:a.open.incidentId?(0,C.jsx)(g,{to:`/incidents/$id/conversation`,params:{id:a.open.incidentId},search:{investigation:a.open.investigationId},onClick:o,children:a.open.label}):(0,C.jsx)(g,{to:`/investigations/$id`,params:{id:a.open.investigationId},onClick:o,children:a.open.label})}),c=(0,C.jsx)(re,{variant:`text`,size:`icon`,onClick:o,"aria-label":`Dismiss`,className:`shrink-0`,"data-testid":`restart-notice-dismiss`,children:(0,C.jsx)(ee,{"aria-hidden":!0})});return t?(0,C.jsxs)(`div`,{role:`status`,className:`floating mx-3 mt-2 flex gap-1 rounded-surface py-0.5 pl-3`,"data-testid":`restart-notice`,"data-layout":`banner`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5 py-2 text-meta`,children:[(0,C.jsxs)(`p`,{children:[(0,C.jsxs)(`span`,{className:`font-semibold`,children:[a.title,`.`]}),` `,(0,C.jsx)(`span`,{className:`text-text-2`,children:[a.resumed,a.skipped].filter(Boolean).join(`, `)})]}),s]}),c]}):(0,C.jsxs)(`div`,{role:`status`,className:`floating fixed right-4 bottom-4 z-[90] flex w-[340px] max-w-[calc(100%-2rem)] flex-col gap-2 rounded-surface py-3 pr-10 pl-3.5`,"data-testid":`restart-notice`,"data-layout":`toast`,children:[(0,C.jsx)(`div`,{className:`absolute top-1 right-1`,children:c}),(0,C.jsx)(`h2`,{className:`text-body font-semibold`,children:a.title}),a.gap&&(0,C.jsx)(`p`,{className:`text-meta text-text-2`,children:a.gap}),(0,C.jsxs)(`ul`,{className:`flex flex-col gap-1 text-meta`,children:[a.resumed&&(0,C.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,className:`size-[7px] shrink-0 rounded-full bg-live`}),a.resumed]}),a.skipped&&(0,C.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":!0,className:`size-[7px] shrink-0 rounded-full bg-warn`}),a.skipped]})]}),s]})}var De=2,Oe=1,ke=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(De,Math.floor(u/e.css.cell.width)),rows:Math.max(Oe,Math.floor(l/e.css.cell.height))}}},Ae=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],je=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],w;function Me(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var Ne=class{constructor(){if(this.version=`6`,!w){w=new Uint8Array(65536),w.fill(1),w[0]=0,w.fill(0,1,32),w.fill(0,127,160),w.fill(2,4352,4448),w[9001]=2,w[9002]=2,w.fill(2,11904,42192),w[12351]=1,w.fill(2,44032,55204),w.fill(2,63744,64256),w.fill(2,65040,65050),w.fill(2,65072,65136),w.fill(2,65280,65377),w.fill(2,65504,65511);for(let e=0;e<Ae.length;++e)w.fill(0,Ae[e][0],Ae[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?w[e]:Me(e,je)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=_t.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return _t.createPropertyValue(0,n,r)}},Pe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ze.isErrorNoTelemetry(e)?new ze(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,Q as t,Xt as n,_t as r,c as i,gt as a,j as o,q as ee,r as s}from"./desktop-
|
|
1
|
+
import{F as e,Q as t,Xt as n,_t as r,c as i,gt as a,j as o,q as ee,r as s}from"./desktop-yb-lqHMd.js";import{t as c}from"./link-BHh9_evg.js";import{t as l}from"./chevron-left-S6eOHk4C.js";import{t as te}from"./ellipsis-BsNLvnl9.js";import{a as u,n as d,t as f}from"./jsx-runtime-Wy9s6hX0.js";import{a as p,i as m,r as h,t as g}from"./state-tone-DOGSNxJV.js";import{F as ne,J as _,t as re,z as v}from"./Hint-Od6cnmvm.js";import{c as y}from"./select-hkRu0Dxf.js";import{a as b,r as ie}from"./State-CCKzehkH.js";import{l as x,rt as S}from"./index-BoI68UdU.js";import{t as C}from"./button-DmIfWVZ8.js";import{d as w,n as T,r as E,t as D}from"./dropdown-menu-yoILSLgJ.js";import{i as O,n as k,r as A,t as ae}from"./use-back-R0oWqfab.js";import{t as oe}from"./use-escape-back-CK0fWxlL.js";import{t as se}from"./use-page-title-DEIRQICr.js";import{n as ce}from"./CopyButton-DKP5JHET.js";function le(e){if(!e)return null;try{let t=new URL(e);return t.protocol!==`http:`&&t.protocol!==`https:`?null:(t.username=t.password=``,t.href)}catch{return null}}var j=u(d());function M(e,t){return t?`var(--sev-${e})`:`var(--text-3)`}var N=f();function P(e){if(!e)return null;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function F({id:e,title:t,count:n,action:r,children:i}){return(0,N.jsxs)(`section`,{id:e,className:`mt-8 first:mt-0`,children:[(0,N.jsxs)(`h2`,{className:`mb-2 flex items-baseline gap-2 text-heading`,children:[t,n!==void 0&&(0,N.jsx)(`span`,{className:`font-normal text-text-3 tabular-nums`,children:n}),r&&(0,N.jsx)(`span`,{className:`ml-auto font-normal`,children:r})]}),i]})}function I({rows:e}){return(0,N.jsx)(`dl`,{className:`divide-y divide-hairline`,children:e.map(([e,t])=>(0,N.jsxs)(`div`,{className:`grid min-h-9 grid-cols-[minmax(6rem,11rem)_minmax(0,1fr)] items-baseline gap-x-6 py-2`,children:[(0,N.jsx)(`dt`,{className:`truncate font-mono text-mono leading-5 text-text-3`,children:e}),(0,N.jsx)(`dd`,{className:`min-w-0 break-words text-body`,children:t})]},e))})}function L(e){return e?e.charAt(0).toUpperCase()+e.slice(1):`Unknown source`}function R({alertId:u}){let d=n(),{toast:f}=ce(),{data:x,isLoading:R,error:z}=r(i.alerts.get.queryOptions({input:{id:u}}));se(x?.title??`Alert`);let B=O(A,`/alerts`);oe(B);let V=()=>{d.invalidateQueries({queryKey:v.all()}),d.invalidateQueries({queryKey:ne.all()})},H=e=>t=>f({title:e,description:s(t),variant:`destructive`}),U=a({...i.alerts.resolve.mutationOptions(),onSuccess:V,onError:H(`Could not resolve`)}),W=a({...i.alerts.correlate.mutationOptions(),onSuccess:()=>{V(),f({title:`Correlated`,description:`The alert went through the rules again.`})},onError:H(`Still suppressed`)}),[G,K]=(0,j.useState)(!1),q=(0,j.useMemo)(()=>P(x?.rawPayload??null),[x?.rawPayload]),J=k(A,`/alerts`),Y=ae(J,x?.incident),X=(0,N.jsxs)(`div`,{className:`flex h-(--header-h) shrink-0 items-center gap-2.5 bg-surface-1 pr-4 pl-3`,"data-testid":`alert-band`,"data-title-row":!0,children:[(0,N.jsx)(re,{label:Y,keys:[`Esc`],children:(0,N.jsx)(C,{variant:`text`,size:`icon`,asChild:!0,children:(0,N.jsx)(`a`,{href:J,onClick:e=>{e.preventDefault(),B()},"aria-label":Y,"data-testid":`alert-back`,children:(0,N.jsx)(l,{className:`size-4`})})})}),x&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{role:`img`,"aria-label":`${t[x.severity]}, ${e(x.status)?`firing`:`cleared`}`,className:`size-2 shrink-0 rounded-full`,style:{background:M(x.severity,e(x.status))}}),(0,N.jsx)(`h1`,{className:`min-w-0 truncate text-title`,children:x.title}),(0,N.jsx)(`span`,{className:`flex-1`}),(0,N.jsx)(S,{tone:g(x.status),className:`max-sm:hidden`,"data-testid":`alert-state`,children:m(x.status)}),(0,N.jsxs)(`span`,{className:`shrink-0 text-meta text-text-3 tabular-nums max-sm:hidden`,children:[`since `,p(h(x))]}),x.incident&&(0,N.jsx)(C,{variant:`secondary`,asChild:!0,children:(0,N.jsxs)(c,{to:`/incidents/$id`,params:{id:x.incident.id},"data-testid":`alert-open-incident`,children:[`Open INC-`,x.incident.number]})}),(0,N.jsxs)(D,{modal:!1,children:[(0,N.jsx)(w,{asChild:!0,children:(0,N.jsx)(C,{variant:`text`,size:`icon`,"aria-label":`More actions`,"data-testid":`alert-more`,children:(0,N.jsx)(te,{className:`size-4`})})}),(0,N.jsxs)(T,{align:`end`,children:[o(`resolve`,x.status)&&(0,N.jsx)(E,{onSelect:()=>U.mutate({id:x.id}),disabled:U.isPending,"data-testid":`alert-resolve`,children:`Resolve this alert`}),q&&(0,N.jsx)(E,{onSelect:()=>{navigator.clipboard?.writeText(q),f({title:`Payload copied`})},children:`Copy the raw payload`})]})]})]})]});if(R)return(0,N.jsxs)(`div`,{className:`flex h-full flex-col`,"data-testid":`alert-detail-loading`,children:[X,(0,N.jsx)(ie,{className:`mx-auto w-full max-w-(--reading-w) px-6 pt-4`})]});if(z||!x)return(0,N.jsxs)(`div`,{className:`flex h-full flex-col`,"data-testid":`alert-detail`,children:[X,(0,N.jsx)(`div`,{className:`mx-auto w-full max-w-(--reading-w) px-6 pt-4`,children:(0,N.jsx)(b,{text:`Failed to load alert. It may have been deleted.`,back:(0,N.jsx)(C,{variant:`text`,size:`sm`,onClick:B,children:Y})})})]});let Z=Object.entries(x.labels??{}),Q=le(x.sourceUrl),$=x.service?x.service.displayName||x.service.name:null;return(0,N.jsxs)(`div`,{className:`grid h-full grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)]`,"data-testid":`alert-detail`,children:[X,(0,N.jsx)(`div`,{className:`min-h-0 overflow-y-auto`,children:(0,N.jsxs)(`div`,{className:`mx-auto w-full max-w-(--reading-w) px-4 pt-4 pb-12 md:px-6`,children:[(0,N.jsxs)(`div`,{className:`mb-6 flex items-center gap-2.5 text-meta sm:hidden`,children:[(0,N.jsx)(S,{tone:g(x.status),children:m(x.status)}),(0,N.jsxs)(`span`,{className:`text-text-3`,children:[`since `,p(h(x))]})]}),x.description&&(0,N.jsx)(`p`,{className:`mb-8 text-body text-text-2`,children:x.description}),(0,N.jsx)(F,{title:`Where it landed`,children:x.incident?(0,N.jsxs)(`div`,{className:`pool flex min-w-0 items-center gap-3 px-3.5 py-3`,"data-testid":`alert-incident`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(c,{to:`/incidents/$id`,params:{id:x.incident.id},className:`block truncate text-body text-text-1 hover:underline`,children:[(0,N.jsxs)(y,{className:`mr-1.5 text-text-3`,children:[`INC-`,x.incident.number]}),x.incident.title]}),(0,N.jsxs)(`div`,{className:`mt-0.5 truncate text-meta text-text-3`,children:[$??`No service`,`.`,` `,ee[x.incident.status]??x.incident.status,`.`]})]}),(0,N.jsx)(C,{variant:`text`,size:`sm`,asChild:!0,children:(0,N.jsx)(c,{to:`/incidents/$id`,params:{id:x.incident.id},tabIndex:-1,"aria-hidden":!0,children:`Open`})})]}):(0,N.jsxs)(`div`,{className:`pool flex flex-wrap items-center justify-between gap-3 px-3.5 py-3`,"data-testid":x.suppressedBy?`alert-suppressed`:`alert-uncorrelated`,children:[(0,N.jsx)(`p`,{className:`min-w-0 flex-1 text-body text-text-2`,children:x.suppressedBy?(0,N.jsxs)(N.Fragment,{children:[`Held down by the rule`,` `,(0,N.jsx)(y,{className:`text-text-1`,children:x.suppressedBy.ruleName}),`. It reaches no incident while that rule is on.`]}):`No incident. No rule matched it, or it fired before its service existed.`}),(0,N.jsx)(C,{variant:`secondary`,size:`sm`,onClick:()=>W.mutate({id:x.id}),disabled:W.isPending,"data-testid":`alert-correlate`,children:x.suppressedBy?`Correlate anyway`:`Run correlation`})]})}),(0,N.jsxs)(F,{id:`identity`,title:`Source`,children:[(0,N.jsxs)(`div`,{className:`py-1`,children:[(0,N.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,N.jsx)(`span`,{className:`text-body text-text-1`,children:L(x.source)}),Q&&(0,N.jsx)(`a`,{href:Q,target:`_blank`,rel:`noreferrer`,className:`text-meta text-text-3 hover:text-text-1`,children:`Open in the source`})]}),(0,N.jsxs)(`div`,{className:`mt-0.5 text-meta text-text-3 tabular-nums`,children:[x.occurrenceCount===1?`Fired once at ${_(x.triggeredAt)}`:`${x.occurrenceCount} occurrences, first ${_(x.triggeredAt)}, last ${_(x.lastOccurrence)}`,x.status===`resolved`&&x.resolvedAt&&`, cleared ${_(x.resolvedAt)}`]})]}),(0,N.jsx)(`div`,{className:`mt-3`,children:(0,N.jsx)(I,{rows:[[`dedup key`,(0,N.jsx)(y,{children:x.dedupKey},`d`)],...x.fingerprint?[[`fingerprint`,(0,N.jsx)(y,{children:x.fingerprint},`f`)]]:[],...x.externalId?[[`external id`,(0,N.jsx)(y,{children:x.externalId},`e`)]]:[],...$&&x.service?[[`service`,(0,N.jsx)(c,{to:`/services/$id`,params:{id:x.service.id},search:{tab:`overview`},className:`text-text-1 hover:underline`,children:$},`s`)]]:[]]})})]}),(Z.length>0||(x.tags?.length??0)>0)&&(0,N.jsx)(F,{title:`Labels`,count:Z.length,children:(0,N.jsx)(I,{rows:[...Z.map(([e,t])=>[e,t]),...x.tags?.length?[[`tags`,x.tags.join(`, `)]]:[]]})}),(0,N.jsxs)(F,{title:`Raw payload`,action:q?(0,N.jsx)(C,{variant:`text`,size:`sm`,onClick:()=>K(e=>!e),"data-testid":`alert-payload-toggle`,children:G?`Hide`:`Show`}):void 0,children:[!q&&(0,N.jsx)(`p`,{className:`text-body text-text-2`,children:`The source sent nothing beyond the fields above.`}),q&&G&&(0,N.jsx)(`pre`,{"data-scroll-x":!0,className:`raised overflow-auto rounded-surface p-3 font-mono text-mono text-text-2`,"data-testid":`alert-payload`,children:q})]})]})})]})}function z(){let{id:e}=x.useParams();return(0,N.jsx)(R,{alertId:e})}export{z as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,a as t,i as n,r}from"./desktop-Bqso9PNq.js";import{t as i}from"./link-BHh9_evg.js";import{t as a}from"./chevron-left-DWLaEwl8.js";import{c as o,d as s,f as c,n as l,p as u,s as d,t as f,u as p}from"./SubagentPane-exGNOprU.js";import{$ as m,lt as h,mt as g,q as ee,z as te}from"./source-words-B5oOdiQU.js";import{a as _,n as v,t as y}from"./jsx-runtime-Wy9s6hX0.js";import{p as ne,u as re}from"./AgentDetail-DNNZ2RSQ.js";import{g as ie}from"./run-labels-ubQZmnqd.js";import{t as ae}from"./Transcript-2ke3pjya.js";import{n as oe}from"./useInvestigationRun-xdB0R08B.js";import{t as se}from"./TickDot-m_aEzdkj.js";import{t as b,v as ce}from"./Hint-BCpVhAvV.js";import{a as le,i as ue,n as x,r as de}from"./State-CCKzehkH.js";import{r as fe}from"./PanelShell-BHpdPx3P.js";import{t as S}from"./button-DmIfWVZ8.js";import{t as pe}from"./use-page-title-DEIRQICr.js";import{o as me,p as he}from"./use-repositories-orpc-c6hPOKjE.js";import{c as ge}from"./use-threads-orpc-rBrvQXJf.js";import{i as _e,t as ve}from"./Composer-MAXlRLhF.js";import{c as ye,o as be}from"./evidence-files-C9UcJR1J.js";import{c as xe,u as C}from"./index-DZMj9YK4.js";import{t as w}from"./utils-A3okWeke.js";import{t as T}from"./globe-D2S-zGel.js";var E={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};E.node;var Se=t(E),D=_(v()),O=y(),k=[{id:`files`,label:`Files`,Icon:c},{id:`diff`,label:`Diff`,Icon:u},{id:`suspects`,label:`Suspects`,Icon:g},{id:`browser`,label:`Browser`,Icon:T}];function Ce({surface:e,onSurface:t,onClose:r,runId:i,live:a,investigation:o,diff:s=!0,files:c,suspects:u,subagent:f}){let m=k.filter(e=>(o||e.id!==`suspects`)&&(s||e.id!==`diff`));return(0,O.jsxs)(`div`,{id:`thread-panel`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||(e.stopPropagation(),r())},className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-panel`,children:[(0,O.jsxs)(`div`,{role:`tablist`,"aria-label":`Surfaces`,"data-title-row":!0,className:`flex h-(--header-h) shrink-0 items-center gap-1 px-2 shadow-[0_1px_0_var(--hairline)]`,children:[m.map(({id:n,label:r,Icon:i})=>(0,O.jsx)(b,{label:r,children:(0,O.jsx)(`button`,{type:`button`,role:`tab`,id:`surface-tab-${n}`,"aria-controls":`surface-panel`,"aria-selected":e===n,"aria-label":r,onClick:()=>t(n),className:w(`flex size-7 items-center justify-center rounded-control transition-colors duration-(--dur-instant) hover:bg-surface-3`,e===n?`bg-surface-3 text-text-1`:`text-text-2`),"data-testid":`surface-${n}`,children:(0,O.jsx)(i,{className:`size-4`,"aria-hidden":!0})})},n)),(0,O.jsx)(`span`,{className:`flex-1`}),(0,O.jsx)(S,{variant:`text`,size:`icon`,"aria-label":`Close panel`,onClick:r,className:`text-text-3`,"data-testid":`thread-panel-close`,children:(0,O.jsx)(n,{className:`size-3.5`})})]}),(0,O.jsx)(`div`,{role:`tabpanel`,id:`surface-panel`,"aria-labelledby":e&&e!==`subagent`?`surface-tab-${e}`:void 0,"aria-label":e===`subagent`?`Sub-agent`:e?void 0:`Surfaces`,className:`flex min-h-0 flex-1 flex-col`,children:e===null||e===`diff`&&!s||e===`suspects`&&!o||e===`subagent`&&!f?(0,O.jsx)(x,{className:`justify-center px-3 pt-8`,text:`Open a surface`,testId:`surface-empty`}):e===`files`?(0,O.jsx)(l,{files:c,onJump:()=>{}}):e===`diff`?(0,O.jsx)(p,{runId:i,live:a}):e===`suspects`?(0,O.jsx)(A,{suspects:u}):e===`subagent`?f:(0,O.jsx)(d,{links:c.links})})]})}function A({suspects:e}){return e.length===0?(0,O.jsx)(x,{className:`px-3`,text:`No suspects yet`,testId:`suspects-empty`}):(0,O.jsx)(`ol`,{className:`m-0 flex min-h-0 list-none flex-col gap-2 overflow-y-auto px-3 py-3`,"data-testid":`suspects`,children:e.map(e=>(0,O.jsxs)(`li`,{className:`flex flex-col gap-0.5 rounded-surface bg-surface-1 px-3 py-2`,"data-testid":`suspect`,children:[(0,O.jsx)(`span`,{className:w(`text-meta`,e.status===`refuted`?`text-text-3`:`text-accent`),"data-testid":`suspect-status`,children:m(e.status)}),(0,O.jsx)(`span`,{dir:`auto`,className:`[overflow-wrap:anywhere] text-text-1`,children:e.statement})]},e.id))})}var we={pending:[`live`,`Starting`],running:[`live`,`Working`],completed:[`ok`,`Done`],failed:[`bad`,`Failed`],cancelled:[`muted`,`Stopped`]};function Te(e){return e.repositoryId?{to:`/projects/$id`,params:{id:e.repositoryId},label:`Back to the project`}:e.serviceId?{to:`/services/$id`,params:{id:e.serviceId},label:`Back to the service`}:{to:`/`,params:{},label:`Back home`}}function j({label:e,pressed:t,disabled:n,onToggle:r,icon:i,testId:a,controls:o}){return(0,O.jsx)(b,{label:e,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":t,"aria-controls":o,disabled:n,onClick:r,className:w(`flex size-7 shrink-0 items-center justify-center rounded-control transition-colors duration-(--dur-instant) hover:bg-surface-3 disabled:opacity-50`,t?`bg-surface-3 text-text-1`:`bg-surface-2 text-text-2`),"data-testid":a,children:i})})}function M({id:t}){let n=oe(t),{harnesses:c}=ne(),l=ce(),[u,d]=(0,D.useState)(null),[p,m]=(0,D.useState)(!1),[g,_]=(0,D.useState)(!1),[v,y]=(0,D.useState)(null),[b,x]=(0,D.useState)(null),[C,w]=(0,D.useState)(new Set),[T,E]=(0,D.useState)(null),[k,A]=(0,D.useState)(``),[M,N]=(0,D.useState)(0),P=n.investigation;ge(P?.id??null,!n.isActive),pe(P?.title??`Thread`);let F=c.find(e=>e.id===P?.harness),Ee=me(P?.repositoryId??``),I=he(P?.repositoryId?``:P?.serviceId??``),L=P?.workspace,R=(0,D.useMemo)(()=>te(n.events,{pending:n.pending,modelName:e=>re(F,e)??e,agentName:e=>c.find(t=>t.id===e)?.label??e,run:P?{id:P.id,status:P.status,live:n.isActive,stopRequested:n.stopRequested,error:P.error,startedAt:P.startedAt,completedAt:P.completedAt,kind:P.kind,hasReport:!1,continuable:!1,lastTurnOutcome:P.lastTurnOutcome,accessLevel:P.accessLevel,endReason:P.endReason}:void 0}),[n.events,n.pending,n.isActive,n.stopRequested,P,F,c]),z=(0,D.useMemo)(()=>ee(n.events,{ended:!n.isActive}),[n.events,n.isActive]),De=(0,D.useMemo)(()=>e(n.events).hypotheses,[n.events]),B=(0,D.useCallback)(e=>{y(e),_(!0)},[]),V=(0,D.useCallback)(e=>{x(e),B(`files`)},[B]),H=(0,D.useCallback)(e=>{E(e),B(`subagent`)},[B]),Oe=(0,D.useCallback)(e=>{A(t=>e+t),N(e=>e+1)},[]),U=(0,D.useCallback)(e=>w(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),W=(0,D.useCallback)(e=>ye(e,L),[L]),ke=(0,D.useMemo)(()=>({all:n.steps,open:C,onToggle:U,highlight:null,flagged:new Set,asks:n.asks,fileOf:W,onOpenFile:e=>{let t=W(e);t&&V(t)}}),[n.steps,n.asks,C,U,W,V]),Ae=(0,D.useMemo)(()=>({runId:t,workspace:L,touched:xe(n.steps,L,[]),links:[],viewing:b,onOpen:e=>x(e),onClose:()=>x(null),backLabel:`Back to files`,reads:b?be(b,n.steps,L):[],codeHost:null,stepFile:W,onOpenHypotheses:()=>{}}),[t,L,n.steps,b,W]),{sendMessage:G}=n,je=(0,D.useCallback)(async({text:e,files:n},r)=>{let i=await Promise.all(n.map(e=>_e({runId:t},e)));await G(e,r?`now`:`queue`,{attachments:i,kind:`chat`})},[t,G]),K=(0,D.useCallback)(()=>_(!1),[]),q=!n.isLoading&&!n.error&&!!P,J=Te(P||{}),[Me,Ne]=P?n.stopRequested?[`live`,`Stopping`]:we[P.status]:[`muted`,``],Y=(0,O.jsxs)(`header`,{"data-title-row":!0,className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 py-1.5 pr-3 pl-2`,children:[(0,O.jsx)(S,{variant:`ghost`,size:`icon-lg`,"aria-label":J.label,asChild:!0,children:(0,O.jsx)(i,{to:J.to,params:J.params,children:(0,O.jsx)(a,{})})}),(0,O.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-title`,"data-testid":`thread-title`,children:P?.title??`Thread`}),L?.layout===`folder`&&(0,O.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-meta text-warn`,"data-testid":`thread-no-undo`,children:[(0,O.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),`No undo`]}),P&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body text-text-2`,"data-testid":`thread-state`,children:[(0,O.jsx)(se,{tone:Me}),Ne]}),(0,O.jsx)(j,{label:`Status`,pressed:p,disabled:!q,onToggle:()=>m(e=>!e),icon:(0,O.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),testId:`status-box-toggle`,controls:`status-box`}),(0,O.jsx)(j,{label:`Panel`,pressed:g,disabled:!q,onToggle:()=>_(e=>!e),icon:(0,O.jsx)(s,{className:`size-4`,"aria-hidden":!0}),testId:`panel-toggle`,controls:`thread-panel`})]});if(n.isLoading)return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-page`,children:[Y,(0,O.jsx)(`div`,{className:`mx-auto w-full max-w-[760px] px-4 pt-5`,children:(0,O.jsx)(de,{rows:5})})]});if(n.error||!P){let e=(0,O.jsx)(S,{variant:`text`,size:`sm`,asChild:!0,children:(0,O.jsx)(i,{to:`/`,children:`Back home`})});return!n.error||n.error.status===404?(0,O.jsx)(ue,{text:`No thread here.`,back:e}):(0,O.jsx)(le,{text:r(n.error),onRetry:()=>void n.refetch(),back:e})}let X=n.isActive?`live`:P.endReason===`interrupted`?`interrupted`:`ready`,Z=n.isActive?n.asks.filter(e=>e.state===`waiting`):[],Q=F?.label??`The agent`,Pe=Z.length>0||n.queued.length>0?(0,O.jsx)(ie,{asks:Z,queued:n.queued,runId:P.id,agent:Q,cwd:L?.cwd}):null,Fe=n.ended&&!n.resumable&&X!==`interrupted`?n.resumeBlockedReason??`Can't continue`:null,Ie=Ee.data?.fullName??I.data?.name??null,$=z.find(e=>e.sessionId===T);return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-page`,children:[Y,p&&(0,O.jsx)(`div`,{id:`status-box`,children:(0,O.jsx)(o,{runId:P.id,live:n.isActive,project:Ie,workspace:L,onOpenDiff:()=>B(`diff`),subagents:z,onOpenSubagent:H})}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:R.length?(0,O.jsx)(ae,{items:R,incidentId:null,cwd:L?.cwd,agent:[Q,P.model].filter(Boolean).join(`, `),runName:P.title??`Thread`,chat:P.kind===`chat`,steps:ke,runId:P.id,foldTurns:{live:n.isActive},onOpenSubagent:H}):(0,O.jsx)(`p`,{className:`px-5 pt-6 text-body text-text-3`,children:n.isActive?`Starting the agent`:`Nothing yet`})}),P.status===`failed`&&P.error&&(0,O.jsxs)(`div`,{role:`status`,className:`mx-auto flex w-full max-w-[760px] items-start gap-2.5 px-4 text-body`,children:[(0,O.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,O.jsx)(`span`,{children:P.error})]}),(0,O.jsx)(`div`,{className:`shrink-0 px-4 pt-2 pb-3`,children:(0,O.jsxs)(`div`,{className:`mx-auto w-full max-w-[760px]`,children:[(0,O.jsx)(ve,{state:X,onSend:je,onStop:()=>n.stop(),stopping:n.stopRequested,onResume:()=>{d(null),l.mutate({id:P.id},{onError:e=>d(r(e))})},resuming:l.isPending,placeholder:n.isActive?`Message the agent`:`Reply`,choice:{harness:F,model:P.model??``,effort:P.effort??null,accessLevel:P.accessLevel??`supervised`},onChoice:()=>{},locked:!0,dock:Pe,blockedReason:Fe,text:k,onText:A,focusSignal:M}),u&&(0,O.jsx)(`p`,{className:`px-3 pt-1 text-meta text-danger`,role:`alert`,children:u})]})}),(0,O.jsx)(fe,{open:g,label:`Thread panel`,onClose:K,children:(0,O.jsx)(Ce,{surface:v,onSurface:y,onClose:K,runId:P.id,live:n.isActive,investigation:P.kind===`investigation`,diff:L?.layout!==`folder`,files:Ae,suspects:De,subagent:$&&(0,O.jsx)(f,{runId:P.id,agent:$,events:n.events,live:n.isActive,onAskMain:Oe},$.sessionId)})})]})}var N=function(){let{id:e}=C.useParams();return(0,O.jsx)(M,{id:e},e)};export{N as component};
|
|
1
|
+
import{O as e,a as t,i as n,r}from"./desktop-yb-lqHMd.js";import{t as i}from"./link-BHh9_evg.js";import{t as a}from"./chevron-left-S6eOHk4C.js";import{c as o,d as s,f as c,n as l,p as u,s as d,t as f,u as p}from"./SubagentPane-DxVUfFbn.js";import{$ as m,lt as h,mt as g,q as ee,z as te}from"./source-words-CCeTLwOy.js";import{a as _,n as v,t as y}from"./jsx-runtime-Wy9s6hX0.js";import{p as ne,u as re}from"./AgentDetail-CbhnttdO.js";import{g as ie}from"./run-labels-BLTL5eG9.js";import{t as ae}from"./Transcript-Csly_ODF.js";import{n as oe}from"./useInvestigationRun-BJKQxOF2.js";import{t as se}from"./TickDot-m_aEzdkj.js";import{t as b,v as ce}from"./Hint-Od6cnmvm.js";import{a as le,i as ue,n as x,r as de}from"./State-CCKzehkH.js";import{r as fe}from"./PanelShell-ghqMmsZW.js";import{t as S}from"./button-DmIfWVZ8.js";import{t as pe}from"./use-page-title-DEIRQICr.js";import{o as me,p as he}from"./use-repositories-orpc-Ban_zGD7.js";import{c as ge}from"./use-threads-orpc-mbpsuq3G.js";import{i as _e,t as ve}from"./Composer-DIYA4JDp.js";import{c as ye,o as be}from"./evidence-files-C_a9Ct8m.js";import{c as xe,u as C}from"./index-BoI68UdU.js";import{t as w}from"./utils-A3okWeke.js";import{t as T}from"./globe-C0OZE9Nx.js";var E={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};E.node;var Se=t(E),D=_(v()),O=y(),k=[{id:`files`,label:`Files`,Icon:c},{id:`diff`,label:`Diff`,Icon:u},{id:`suspects`,label:`Suspects`,Icon:g},{id:`browser`,label:`Browser`,Icon:T}];function Ce({surface:e,onSurface:t,onClose:r,runId:i,live:a,investigation:o,diff:s=!0,files:c,suspects:u,subagent:f}){let m=k.filter(e=>(o||e.id!==`suspects`)&&(s||e.id!==`diff`));return(0,O.jsxs)(`div`,{id:`thread-panel`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||(e.stopPropagation(),r())},className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-panel`,children:[(0,O.jsxs)(`div`,{role:`tablist`,"aria-label":`Surfaces`,"data-title-row":!0,className:`flex h-(--header-h) shrink-0 items-center gap-1 px-2 shadow-[0_1px_0_var(--hairline)]`,children:[m.map(({id:n,label:r,Icon:i})=>(0,O.jsx)(b,{label:r,children:(0,O.jsx)(`button`,{type:`button`,role:`tab`,id:`surface-tab-${n}`,"aria-controls":`surface-panel`,"aria-selected":e===n,"aria-label":r,onClick:()=>t(n),className:w(`flex size-7 items-center justify-center rounded-control transition-colors duration-(--dur-instant) hover:bg-surface-3`,e===n?`bg-surface-3 text-text-1`:`text-text-2`),"data-testid":`surface-${n}`,children:(0,O.jsx)(i,{className:`size-4`,"aria-hidden":!0})})},n)),(0,O.jsx)(`span`,{className:`flex-1`}),(0,O.jsx)(S,{variant:`text`,size:`icon`,"aria-label":`Close panel`,onClick:r,className:`text-text-3`,"data-testid":`thread-panel-close`,children:(0,O.jsx)(n,{className:`size-3.5`})})]}),(0,O.jsx)(`div`,{role:`tabpanel`,id:`surface-panel`,"aria-labelledby":e&&e!==`subagent`?`surface-tab-${e}`:void 0,"aria-label":e===`subagent`?`Sub-agent`:e?void 0:`Surfaces`,className:`flex min-h-0 flex-1 flex-col`,children:e===null||e===`diff`&&!s||e===`suspects`&&!o||e===`subagent`&&!f?(0,O.jsx)(x,{className:`justify-center px-3 pt-8`,text:`Open a surface`,testId:`surface-empty`}):e===`files`?(0,O.jsx)(l,{files:c,onJump:()=>{}}):e===`diff`?(0,O.jsx)(p,{runId:i,live:a}):e===`suspects`?(0,O.jsx)(A,{suspects:u}):e===`subagent`?f:(0,O.jsx)(d,{links:c.links})})]})}function A({suspects:e}){return e.length===0?(0,O.jsx)(x,{className:`px-3`,text:`No suspects yet`,testId:`suspects-empty`}):(0,O.jsx)(`ol`,{className:`m-0 flex min-h-0 list-none flex-col gap-2 overflow-y-auto px-3 py-3`,"data-testid":`suspects`,children:e.map(e=>(0,O.jsxs)(`li`,{className:`flex flex-col gap-0.5 rounded-surface bg-surface-1 px-3 py-2`,"data-testid":`suspect`,children:[(0,O.jsx)(`span`,{className:w(`text-meta`,e.status===`refuted`?`text-text-3`:`text-accent`),"data-testid":`suspect-status`,children:m(e.status)}),(0,O.jsx)(`span`,{dir:`auto`,className:`[overflow-wrap:anywhere] text-text-1`,children:e.statement})]},e.id))})}var we={pending:[`live`,`Starting`],running:[`live`,`Working`],completed:[`ok`,`Done`],failed:[`bad`,`Failed`],cancelled:[`muted`,`Stopped`]};function Te(e){return e.repositoryId?{to:`/projects/$id`,params:{id:e.repositoryId},label:`Back to the project`}:e.serviceId?{to:`/services/$id`,params:{id:e.serviceId},label:`Back to the service`}:{to:`/`,params:{},label:`Back home`}}function j({label:e,pressed:t,disabled:n,onToggle:r,icon:i,testId:a,controls:o}){return(0,O.jsx)(b,{label:e,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":t,"aria-controls":o,disabled:n,onClick:r,className:w(`flex size-7 shrink-0 items-center justify-center rounded-control transition-colors duration-(--dur-instant) hover:bg-surface-3 disabled:opacity-50`,t?`bg-surface-3 text-text-1`:`bg-surface-2 text-text-2`),"data-testid":a,children:i})})}function M({id:t}){let n=oe(t),{harnesses:c}=ne(),l=ce(),[u,d]=(0,D.useState)(null),[p,m]=(0,D.useState)(!1),[g,_]=(0,D.useState)(!1),[v,y]=(0,D.useState)(null),[b,x]=(0,D.useState)(null),[C,w]=(0,D.useState)(new Set),[T,E]=(0,D.useState)(null),[k,A]=(0,D.useState)(``),[M,N]=(0,D.useState)(0),P=n.investigation;ge(P?.id??null,!n.isActive),pe(P?.title??`Thread`);let F=c.find(e=>e.id===P?.harness),Ee=me(P?.repositoryId??``),I=he(P?.repositoryId?``:P?.serviceId??``),L=P?.workspace,R=(0,D.useMemo)(()=>te(n.events,{pending:n.pending,modelName:e=>re(F,e)??e,agentName:e=>c.find(t=>t.id===e)?.label??e,run:P?{id:P.id,status:P.status,live:n.isActive,stopRequested:n.stopRequested,error:P.error,startedAt:P.startedAt,completedAt:P.completedAt,kind:P.kind,hasReport:!1,continuable:!1,lastTurnOutcome:P.lastTurnOutcome,accessLevel:P.accessLevel,endReason:P.endReason}:void 0}),[n.events,n.pending,n.isActive,n.stopRequested,P,F,c]),z=(0,D.useMemo)(()=>ee(n.events,{ended:!n.isActive}),[n.events,n.isActive]),De=(0,D.useMemo)(()=>e(n.events).hypotheses,[n.events]),B=(0,D.useCallback)(e=>{y(e),_(!0)},[]),V=(0,D.useCallback)(e=>{x(e),B(`files`)},[B]),H=(0,D.useCallback)(e=>{E(e),B(`subagent`)},[B]),Oe=(0,D.useCallback)(e=>{A(t=>e+t),N(e=>e+1)},[]),U=(0,D.useCallback)(e=>w(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),W=(0,D.useCallback)(e=>ye(e,L),[L]),ke=(0,D.useMemo)(()=>({all:n.steps,open:C,onToggle:U,highlight:null,flagged:new Set,asks:n.asks,fileOf:W,onOpenFile:e=>{let t=W(e);t&&V(t)}}),[n.steps,n.asks,C,U,W,V]),Ae=(0,D.useMemo)(()=>({runId:t,workspace:L,touched:xe(n.steps,L,[]),links:[],viewing:b,onOpen:e=>x(e),onClose:()=>x(null),backLabel:`Back to files`,reads:b?be(b,n.steps,L):[],codeHost:null,stepFile:W,onOpenHypotheses:()=>{}}),[t,L,n.steps,b,W]),{sendMessage:G}=n,je=(0,D.useCallback)(async({text:e,files:n},r)=>{let i=await Promise.all(n.map(e=>_e({runId:t},e)));await G(e,r?`now`:`queue`,{attachments:i,kind:`chat`})},[t,G]),K=(0,D.useCallback)(()=>_(!1),[]),q=!n.isLoading&&!n.error&&!!P,J=Te(P||{}),[Me,Ne]=P?n.stopRequested?[`live`,`Stopping`]:we[P.status]:[`muted`,``],Y=(0,O.jsxs)(`header`,{"data-title-row":!0,className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 py-1.5 pr-3 pl-2`,children:[(0,O.jsx)(S,{variant:`ghost`,size:`icon-lg`,"aria-label":J.label,asChild:!0,children:(0,O.jsx)(i,{to:J.to,params:J.params,children:(0,O.jsx)(a,{})})}),(0,O.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-title`,"data-testid":`thread-title`,children:P?.title??`Thread`}),L?.layout===`folder`&&(0,O.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-meta text-warn`,"data-testid":`thread-no-undo`,children:[(0,O.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),`No undo`]}),P&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body text-text-2`,"data-testid":`thread-state`,children:[(0,O.jsx)(se,{tone:Me}),Ne]}),(0,O.jsx)(j,{label:`Status`,pressed:p,disabled:!q,onToggle:()=>m(e=>!e),icon:(0,O.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),testId:`status-box-toggle`,controls:`status-box`}),(0,O.jsx)(j,{label:`Panel`,pressed:g,disabled:!q,onToggle:()=>_(e=>!e),icon:(0,O.jsx)(s,{className:`size-4`,"aria-hidden":!0}),testId:`panel-toggle`,controls:`thread-panel`})]});if(n.isLoading)return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-page`,children:[Y,(0,O.jsx)(`div`,{className:`mx-auto w-full max-w-[760px] px-4 pt-5`,children:(0,O.jsx)(de,{rows:5})})]});if(n.error||!P){let e=(0,O.jsx)(S,{variant:`text`,size:`sm`,asChild:!0,children:(0,O.jsx)(i,{to:`/`,children:`Back home`})});return!n.error||n.error.status===404?(0,O.jsx)(ue,{text:`No thread here.`,back:e}):(0,O.jsx)(le,{text:r(n.error),onRetry:()=>void n.refetch(),back:e})}let X=n.isActive?`live`:P.endReason===`interrupted`?`interrupted`:`ready`,Z=n.isActive?n.asks.filter(e=>e.state===`waiting`):[],Q=F?.label??`The agent`,Pe=Z.length>0||n.queued.length>0?(0,O.jsx)(ie,{asks:Z,queued:n.queued,runId:P.id,agent:Q,cwd:L?.cwd}):null,Fe=n.ended&&!n.resumable&&X!==`interrupted`?n.resumeBlockedReason??`Can't continue`:null,Ie=Ee.data?.fullName??I.data?.name??null,$=z.find(e=>e.sessionId===T);return(0,O.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`thread-page`,children:[Y,p&&(0,O.jsx)(`div`,{id:`status-box`,children:(0,O.jsx)(o,{runId:P.id,live:n.isActive,project:Ie,workspace:L,onOpenDiff:()=>B(`diff`),subagents:z,onOpenSubagent:H})}),(0,O.jsx)(`div`,{className:`min-h-0 flex-1`,children:R.length?(0,O.jsx)(ae,{items:R,incidentId:null,cwd:L?.cwd,agent:[Q,P.model].filter(Boolean).join(`, `),runName:P.title??`Thread`,chat:P.kind===`chat`,steps:ke,runId:P.id,foldTurns:{live:n.isActive},onOpenSubagent:H}):(0,O.jsx)(`p`,{className:`px-5 pt-6 text-body text-text-3`,children:n.isActive?`Starting the agent`:`Nothing yet`})}),P.status===`failed`&&P.error&&(0,O.jsxs)(`div`,{role:`status`,className:`mx-auto flex w-full max-w-[760px] items-start gap-2.5 px-4 text-body`,children:[(0,O.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,O.jsx)(`span`,{children:P.error})]}),(0,O.jsx)(`div`,{className:`shrink-0 px-4 pt-2 pb-3`,children:(0,O.jsxs)(`div`,{className:`mx-auto w-full max-w-[760px]`,children:[(0,O.jsx)(ve,{state:X,onSend:je,onStop:()=>n.stop(),stopping:n.stopRequested,onResume:()=>{d(null),l.mutate({id:P.id},{onError:e=>d(r(e))})},resuming:l.isPending,placeholder:n.isActive?`Message the agent`:`Reply`,choice:{harness:F,model:P.model??``,effort:P.effort??null,accessLevel:P.accessLevel??`supervised`},onChoice:()=>{},locked:!0,dock:Pe,blockedReason:Fe,text:k,onText:A,focusSignal:M}),u&&(0,O.jsx)(`p`,{className:`px-3 pt-1 text-meta text-danger`,role:`alert`,children:u})]})}),(0,O.jsx)(fe,{open:g,label:`Thread panel`,onClose:K,children:(0,O.jsx)(Ce,{surface:v,onSurface:y,onClose:K,runId:P.id,live:n.isActive,investigation:P.kind===`investigation`,diff:L?.layout!==`folder`,files:Ae,suspects:De,subagent:$&&(0,O.jsx)(f,{runId:P.id,agent:$,events:n.events,live:n.isActive,onAskMain:Oe},$.sessionId)})})]})}var N=function(){let{id:e}=C.useParams();return(0,O.jsx)(M,{id:e},e)};export{N as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./useNavigate-I5E4IRt2.js";import{a as t,n,t as r}from"./jsx-runtime-Wy9s6hX0.js";import{W as i,c as a,d as o,f as s,p as c}from"./AgentDetail-DNNZ2RSQ.js";import{a as l,c as u,f as d,l as f,n as p,o as m,s as h,t as g,u as _}from"./IncidentHeader-BIYafwD0.js";import{n as v}from"./CopyButton-DKP5JHET.js";import{X as y,v as b}from"./Hint-BCpVhAvV.js";import{R as x,Xt as S,c as C,gt as w,r as T}from"./desktop-Bqso9PNq.js";import{a as E,n as D,t as O}from"./restart-40l7XMmi.js";import{i as k}from"./trigger-DVo1oKMX.js";import{t as ee}from"./link-BHh9_evg.js";import{G as A,J as j,K as te,Ot as ne,R as M,W as re,z as ie}from"./index-DZMj9YK4.js";import{n as ae,t as oe}from"./RunsMenu-CD4Yy4jT.js";import{c as N,f as P,g as F,i as I}from"./run-labels-ubQZmnqd.js";import{h as L}from"./use-repositories-orpc-c6hPOKjE.js";import{t as R}from"./button-DmIfWVZ8.js";import{d as z}from"./useInvestigationRun-xdB0R08B.js";import{t as B}from"./strip-inline-markdown-d6Movgzo.js";import{t as V}from"./utils-A3okWeke.js";import{t as H}from"./input-CXxt1dAV.js";import{i as U,n as W,o as G,s as K,t as q}from"./select-98_n4DVz.js";import{t as se}from"./needs-find-DPugLWCN.js";import{n as ce,r as le,t as ue}from"./Composer-MAXlRLhF.js";var J=t(n(),1);function de(e){return e.alerts===0&&e.runs===0&&e.changes===0&&!e.deploy&&e.entries===0}var Y=r(),fe=e=>e.charAt(0).toUpperCase()+e.slice(1);function pe({o:e}){let t=ie(1e3),{incident:n,runs:r}=e.record,a=e.latest,o=e.latestRun,s=o.investigation,c=j(s),l=a?o.state??I(a):null,u=!!l&&x(l),d=u&&(o.awaiting||!!a?.awaitingApprovalAt),f=o.asks.find(e=>e.state===`waiting`),p=a?P(r,a):null,m=s&&te(s)?y(re(s,t,o.events)):null,h=a?N(a):``,g=(s?.endReason??a?.endReason)===`interrupted`,_=g?D(s?.error):null,v=a?d?`${c.agent} asks to run ${f?z(f):`a tool`}`:u?O(o.events)?`Resumed after a restart`:B(o.latestText??`Working`):l===`failed`?_?`Interrupted, not resumed: ${_}`:g?`PrismaLens restarted`:i(s?.error??a.error,c.agent).what:a.hasReport?a.rootCause?`Likely cause found`:`No cause named`:fe(h):`No run yet`,b=a?u?`started ${M(a.startedAt??a.createdAt,t)}`:[M(a.completedAt??a.createdAt,t),m&&`${l===`failed`?`after`:`took`} ${m}`].filter(Boolean).join(`, `):``;return(0,Y.jsxs)(`div`,{className:`relative flex h-9 min-w-0 shrink-0 items-center gap-2 px-4 whitespace-nowrap md:gap-3 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-hairline`,"data-testid":`latest-run-strip`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-text-3 max-md:hidden`,children:`Latest run`}),l?(0,Y.jsx)(ae,{state:l,waiting:d,className:`size-[7px]`}):(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`size-[7px] shrink-0 rounded-full bg-text-3`}),a&&p?(0,Y.jsxs)(ee,{to:`/incidents/$id/conversation`,params:{id:n.id},search:{investigation:a.id},className:`min-w-0 truncate font-medium hover:underline md:shrink-0`,"data-testid":`latest-run-link`,children:[p,` `,d?`waiting for you`:u?`investigating`:l===`failed`?g?`interrupted`:`failed`:l===`stopped`?`stopped`:`concluded`]}):null,(0,Y.jsx)(`span`,{className:V(`min-w-0 shrink truncate md:min-w-[100px]`,d?`text-warn`:u?`text-live`:l===`failed`?`text-danger`:`text-text-2`,_&&`max-md:hidden`),"data-testid":`latest-run-detail`,children:v}),(0,Y.jsx)(`span`,{className:`shrink-0 text-text-3 max-lg:hidden`,children:b}),(0,Y.jsx)(`span`,{className:`flex-1`}),u&&(0,Y.jsxs)(R,{variant:`secondary`,className:`h-[26px] shrink-0 gap-1.5 bg-surface-2 hover:bg-surface-3`,disabled:o.stopRequested,onClick:()=>o.stop({onError:()=>void 0}),"data-testid":`latest-run-stop`,children:[(0,Y.jsx)(ne,{className:`size-3 fill-current`,"aria-hidden":!0}),o.stopRequested?`Stopping`:`Stop run`]}),(0,Y.jsx)(oe,{incidentId:n.id,runs:r,current:null})]})}function me(e){return e.displayName&&e.displayName!==e.name?`${e.displayName} (${e.name})`:e.name}var X=100;function he({incidentId:e}){let[t,n]=(0,J.useState)(``),r=(0,J.useDeferredValue)(t.trim()),[i,a]=(0,J.useState)(0),o=L({limit:X,...r?{search:r}:{},...i?{offset:i}:{}}),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),{toast:d}=v(),f=S(),p=w({...C.incidents.update.mutationOptions(),onSuccess:()=>f.invalidateQueries({queryKey:C.incidents.key()}),onError:e=>{c(``),d({title:`Service not linked`,description:T(e),variant:`destructive`})}}),m=o.data?.data??[],h=se(o.data,t);h&&!l&&u(!0);let g=h||l,_=o.data?.total??0,y=_>m.length,b=i+m.length<_;return o.isError?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-body text-danger`,role:`alert`,"data-testid":`incident-link-service-error`,children:[T(o.error),(0,Y.jsx)(R,{variant:`text`,size:`sm`,onClick:()=>void o.refetch(),"data-testid":`incident-link-service-retry`,children:`Retry`})]}):m.length===0&&!g?null:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[g&&(0,Y.jsx)(H,{value:t,onChange:e=>{n(e.target.value),a(0)},placeholder:y?`${i+1}-${i+m.length} of ${_}: narrow the search`:`Find a service`,"aria-label":`Find a service`,className:`w-44`,"data-testid":`incident-link-service-find`}),g&&(i>0||b)&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{variant:`text`,size:`sm`,disabled:i===0,onClick:()=>a(Math.max(0,i-X)),"data-testid":`incident-link-service-prev`,children:`Previous`}),(0,Y.jsx)(R,{variant:`text`,size:`sm`,disabled:!b,onClick:()=>a(i+X),"data-testid":`incident-link-service-next`,children:`Next`})]}),(0,Y.jsxs)(q,{value:s,disabled:p.isPending,onValueChange:t=>{c(t),p.mutate({id:e,serviceId:t})},children:[(0,Y.jsx)(G,{"aria-label":`Link service`,className:`w-56`,"data-testid":`incident-link-service`,children:(0,Y.jsx)(K,{placeholder:`Link service`})}),(0,Y.jsx)(W,{children:m.map(e=>(0,Y.jsx)(U,{value:e.id,"data-testid":`incident-link-service-${e.id}`,children:me(e)},e.id))})]})]})}function Z(e){let t={id:`note`,label:`Note`,detail:`Goes on the timeline. The agent never reads it.`,needsText:!0},n={ask:`Ask about this incident`,investigate:`Brief the agent (optional)`,note:`Add a note`,message:`Message the agent`};return e.live?{actions:[{id:`message`,label:`Message`,detail:`Goes to ${e.live} at its next pause.`,needsText:!0},t],hint:{message:`Reaches ${e.live} at its next pause. You stay here.`,note:`Goes on the timeline. The agent never reads it.`},placeholder:n}:{actions:[{id:`ask`,label:`Ask`,detail:`A question to the agent. No new report.`,needsText:!0},{id:`investigate`,label:e.reported?`Investigate again`:`Investigate`,detail:`A new run that ends in a report.`,needsText:!1},t],hint:{ask:`Opens the conversation; the agent answers there.`,investigate:`Starts ${e.nextName} and opens it.`,note:`Goes on the timeline. The agent never reads it.`},placeholder:n}}function Q(e){return ge(c(),e.draftChoice)}function ge(e,t){let n=e.harnesses.find(e=>e.id===t.harness),r=t.harness&&!n?{accessLevel:t.accessLevel}:t,i=n??e.effective,o=i?.id,s=r.model??(r.harness?e.models[o]:e.model)??``,c=r.effort===void 0?e.efforts[o]??null:r.effort,l=r.accessLevel??a(i,e.axes).level.level;return{choice:e,harness:i,hid:o,model:s,effort:c,accessLevel:l,now:o?{harness:o,model:s,effort:c,accessLevel:l}:{},sent:{accessLevel:l,...t.harness&&o?{harness:o}:{},...r.model===void 0?{}:{model:r.model},...r.effort===void 0?{}:{effort:r.effort}}}}function $({o:e,action:t,onAction:n}){let r=e.record,{incident:i,runs:a}=r,{choice:s,harness:c,hid:l,model:u,effort:f,accessLevel:p,now:m,sent:h}=Q(r),[g,_]=(0,J.useState)(``),v=e.live,y=Z({live:v?P(a,v):null,nextName:`Run ${A(a,``)}`,reported:!!e.report}),b=t&&y.actions.some(e=>e.id===t)?t:y.actions[0]?.id,x=c?o(c):null,S=b===`note`||b===`message`?void 0:x||r.investigateBlocked,C=b===`note`||b===`message`,w=e=>{e.harnessId?r.setDraftChoice(e.harnessId===l?{...m,model:e.model??``}:{harness:e.harnessId,model:e.model??``}):e.model===void 0?e.effort?r.setDraftChoice({...m,effort:e.effort}):e.accessLevel&&r.setDraftChoice({...m,accessLevel:e.accessLevel}):r.setDraftChoice({...m,model:e.model})},T=async({text:t,files:n})=>{if(b===`note`)return new Promise((e,n)=>r.addNote(t,e,n));let o=await Promise.all(n.map(e=>le(i.id,e))),s=o.map(e=>e.id);if(b===`message`){let n=e.latestRun.investigation,r=n?.liveTurn===`report`?`continue`:n?.liveTurn===`answer`?`chat`:void 0;await e.latestRun.sendMessage(t,`queue`,{attachments:o,...r?{kind:r}:{}});return}if(b===`ask`)return r.chat({text:t,...h,attachments:s});let c=e.report;return r.investigate({text:c&&e.reported?d(c,A(a,e.reported.id),t):t||void 0,...h,attachments:s})},E=e.latestRun,D=E.isActive?E.asks.filter(e=>e.state===`waiting`):[],O=D.length>0||E.queued.length>0?(0,Y.jsx)(F,{asks:D,queued:E.queued,runId:E.investigation?.id,agent:s.harnesses.find(e=>e.id===E.investigation?.harness)?.label??`The agent`,cwd:E.investigation?.workspace?.cwd}):null;return(0,Y.jsx)(`div`,{className:`shrink-0 px-4 pt-2 pb-3`,"data-testid":`overview-composer`,children:(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-[760px]`,children:(0,Y.jsx)(ue,{state:`ready`,...ce(y.actions,b,e=>n(e)),choice:{harness:c,model:u,effort:f,accessLevel:p},onChoice:w,agentless:C,onSend:T,placeholder:y.placeholder[b]??``,text:g,onText:_,dock:O,pending:r.isStarting||r.isSavingNote,blockedReason:S})})})}function _e(){let t=l(),{incident:n}=t.record,r=e(),{toast:i}=v(),a=(0,J.useRef)(null),[o,c]=(0,J.useState)(null),d=e=>{c(e),window.setTimeout(()=>document.querySelector(`[data-testid=overview-composer] textarea`)?.focus(),0)},y=Q(t.record),x=de({alerts:n.alerts?.length??0,runs:t.record.runs.length,changes:t.changes?.total??0,deploy:!!t.changes?.deploy,entries:(t.record.timeline??[]).filter(e=>e.type!==`incident_created`).length}),S=b(),C=()=>void t.record.investigate({...y.sent}).catch(e=>i({title:`The run did not start`,description:T(e),variant:`destructive`})),w=u(t,{commandRef:a,resume:()=>{t.latest&&S.mutate({id:t.latest.id},{onError:E(i)})},investigate:()=>{y.harness&&(s(y.harness)?d(`investigate`):C())},ask:()=>d(`ask`),services:()=>void r({to:`/services`,search:{add:`1`}}),watch:()=>{t.live&&r({to:`/incidents/$id/conversation`,params:{id:n.id},search:{investigation:t.live.id}})}}),D=k(n).kind===`webhook`;return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`incident-overview`,children:[(0,Y.jsx)(g,{incident:n,view:`Overview`,reportRunId:t.reported?.id??null,onResolve:t.record.openClose,onReopen:t.record.openReopen,onEditCause:t.record.openEditCause}),x?(0,Y.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col justify-center overflow-y-auto pb-[12vh]`,"data-testid":`incident-blank`,children:[(0,Y.jsx)(`h2`,{className:`mb-4 text-center text-display text-text-1`,children:`What do you know so far?`}),!n.service&&(0,Y.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,Y.jsx)(he,{incidentId:n.id})}),(0,Y.jsx)($,{o:t,action:o,onAction:c})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(pe,{o:t}),(0,Y.jsxs)(`main`,{className:`grid min-h-0 flex-1 auto-rows-[280px] grid-cols-1 grid-rows-[auto] gap-3 overflow-y-auto overscroll-contain px-4 pt-3 pb-1 md:grid-cols-[minmax(0,1.35fr)_minmax(0,1fr)] md:grid-rows-[auto_minmax(120px,1fr)_minmax(120px,1fr)]`,"data-testid":`overview-grid`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 md:col-span-2`,children:(0,Y.jsx)(h,{o:t,onAction:w,canStart:!!y.harness})}),!D&&(0,Y.jsx)(f,{view:t.impact}),t.latest&&(0,Y.jsx)(m,{o:t,commandRef:a}),t.latest&&(0,Y.jsx)(p,{o:t,onInvestigate:()=>d(`investigate`)}),(0,Y.jsx)(_,{o:t,wide:D&&!t.latest})]}),(0,Y.jsx)($,{o:t,action:o,onAction:c})]})]})}var ve=_e;export{ve as component};
|
|
1
|
+
import{n as e}from"./useNavigate-I5E4IRt2.js";import{a as t,n,t as r}from"./jsx-runtime-Wy9s6hX0.js";import{W as i,c as a,d as o,f as s,p as c}from"./AgentDetail-CbhnttdO.js";import{a as l,c as u,f as d,l as f,n as p,o as m,s as h,t as g,u as _}from"./IncidentHeader-GG30mdkp.js";import{n as v}from"./CopyButton-DKP5JHET.js";import{X as y,v as b}from"./Hint-Od6cnmvm.js";import{R as x,Xt as S,c as C,gt as w,r as T}from"./desktop-yb-lqHMd.js";import{a as E,n as D,t as O}from"./restart-FIcq7DzH.js";import{i as k}from"./trigger-DVo1oKMX.js";import{t as ee}from"./link-BHh9_evg.js";import{G as A,J as j,K as te,Ot as ne,R as M,W as re,z as ie}from"./index-BoI68UdU.js";import{n as ae,t as oe}from"./RunsMenu-B9_X_90y.js";import{c as N,f as P,g as F,i as I}from"./run-labels-BLTL5eG9.js";import{h as L}from"./use-repositories-orpc-Ban_zGD7.js";import{t as R}from"./button-DmIfWVZ8.js";import{d as z}from"./useInvestigationRun-BJKQxOF2.js";import{t as B}from"./strip-inline-markdown-d6Movgzo.js";import{t as V}from"./utils-A3okWeke.js";import{t as H}from"./input-CXxt1dAV.js";import{i as U,n as W,o as G,s as K,t as q}from"./select-hkRu0Dxf.js";import{t as se}from"./needs-find-DPugLWCN.js";import{n as ce,r as le,t as ue}from"./Composer-DIYA4JDp.js";var J=t(n(),1);function de(e){return e.alerts===0&&e.runs===0&&e.changes===0&&!e.deploy&&e.entries===0}var Y=r(),fe=e=>e.charAt(0).toUpperCase()+e.slice(1);function pe({o:e}){let t=ie(1e3),{incident:n,runs:r}=e.record,a=e.latest,o=e.latestRun,s=o.investigation,c=j(s),l=a?o.state??I(a):null,u=!!l&&x(l),d=u&&(o.awaiting||!!a?.awaitingApprovalAt),f=o.asks.find(e=>e.state===`waiting`),p=a?P(r,a):null,m=s&&te(s)?y(re(s,t,o.events)):null,h=a?N(a):``,g=(s?.endReason??a?.endReason)===`interrupted`,_=g?D(s?.error):null,v=a?d?`${c.agent} asks to run ${f?z(f):`a tool`}`:u?O(o.events)?`Resumed after a restart`:B(o.latestText??`Working`):l===`failed`?_?`Interrupted, not resumed: ${_}`:g?`PrismaLens restarted`:i(s?.error??a.error,c.agent).what:a.hasReport?a.rootCause?`Likely cause found`:`No cause named`:fe(h):`No run yet`,b=a?u?`started ${M(a.startedAt??a.createdAt,t)}`:[M(a.completedAt??a.createdAt,t),m&&`${l===`failed`?`after`:`took`} ${m}`].filter(Boolean).join(`, `):``;return(0,Y.jsxs)(`div`,{className:`relative flex h-9 min-w-0 shrink-0 items-center gap-2 px-4 whitespace-nowrap md:gap-3 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-hairline`,"data-testid":`latest-run-strip`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-text-3 max-md:hidden`,children:`Latest run`}),l?(0,Y.jsx)(ae,{state:l,waiting:d,className:`size-[7px]`}):(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`size-[7px] shrink-0 rounded-full bg-text-3`}),a&&p?(0,Y.jsxs)(ee,{to:`/incidents/$id/conversation`,params:{id:n.id},search:{investigation:a.id},className:`min-w-0 truncate font-medium hover:underline md:shrink-0`,"data-testid":`latest-run-link`,children:[p,` `,d?`waiting for you`:u?`investigating`:l===`failed`?g?`interrupted`:`failed`:l===`stopped`?`stopped`:`concluded`]}):null,(0,Y.jsx)(`span`,{className:V(`min-w-0 shrink truncate md:min-w-[100px]`,d?`text-warn`:u?`text-live`:l===`failed`?`text-danger`:`text-text-2`,_&&`max-md:hidden`),"data-testid":`latest-run-detail`,children:v}),(0,Y.jsx)(`span`,{className:`shrink-0 text-text-3 max-lg:hidden`,children:b}),(0,Y.jsx)(`span`,{className:`flex-1`}),u&&(0,Y.jsxs)(R,{variant:`secondary`,className:`h-[26px] shrink-0 gap-1.5 bg-surface-2 hover:bg-surface-3`,disabled:o.stopRequested,onClick:()=>o.stop({onError:()=>void 0}),"data-testid":`latest-run-stop`,children:[(0,Y.jsx)(ne,{className:`size-3 fill-current`,"aria-hidden":!0}),o.stopRequested?`Stopping`:`Stop run`]}),(0,Y.jsx)(oe,{incidentId:n.id,runs:r,current:null})]})}function me(e){return e.displayName&&e.displayName!==e.name?`${e.displayName} (${e.name})`:e.name}var X=100;function he({incidentId:e}){let[t,n]=(0,J.useState)(``),r=(0,J.useDeferredValue)(t.trim()),[i,a]=(0,J.useState)(0),o=L({limit:X,...r?{search:r}:{},...i?{offset:i}:{}}),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),{toast:d}=v(),f=S(),p=w({...C.incidents.update.mutationOptions(),onSuccess:()=>f.invalidateQueries({queryKey:C.incidents.key()}),onError:e=>{c(``),d({title:`Service not linked`,description:T(e),variant:`destructive`})}}),m=o.data?.data??[],h=se(o.data,t);h&&!l&&u(!0);let g=h||l,_=o.data?.total??0,y=_>m.length,b=i+m.length<_;return o.isError?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-body text-danger`,role:`alert`,"data-testid":`incident-link-service-error`,children:[T(o.error),(0,Y.jsx)(R,{variant:`text`,size:`sm`,onClick:()=>void o.refetch(),"data-testid":`incident-link-service-retry`,children:`Retry`})]}):m.length===0&&!g?null:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[g&&(0,Y.jsx)(H,{value:t,onChange:e=>{n(e.target.value),a(0)},placeholder:y?`${i+1}-${i+m.length} of ${_}: narrow the search`:`Find a service`,"aria-label":`Find a service`,className:`w-44`,"data-testid":`incident-link-service-find`}),g&&(i>0||b)&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(R,{variant:`text`,size:`sm`,disabled:i===0,onClick:()=>a(Math.max(0,i-X)),"data-testid":`incident-link-service-prev`,children:`Previous`}),(0,Y.jsx)(R,{variant:`text`,size:`sm`,disabled:!b,onClick:()=>a(i+X),"data-testid":`incident-link-service-next`,children:`Next`})]}),(0,Y.jsxs)(q,{value:s,disabled:p.isPending,onValueChange:t=>{c(t),p.mutate({id:e,serviceId:t})},children:[(0,Y.jsx)(G,{"aria-label":`Link service`,className:`w-56`,"data-testid":`incident-link-service`,children:(0,Y.jsx)(K,{placeholder:`Link service`})}),(0,Y.jsx)(W,{children:m.map(e=>(0,Y.jsx)(U,{value:e.id,"data-testid":`incident-link-service-${e.id}`,children:me(e)},e.id))})]})]})}function Z(e){let t={id:`note`,label:`Note`,detail:`Goes on the timeline. The agent never reads it.`,needsText:!0},n={ask:`Ask about this incident`,investigate:`Brief the agent (optional)`,note:`Add a note`,message:`Message the agent`};return e.live?{actions:[{id:`message`,label:`Message`,detail:`Goes to ${e.live} at its next pause.`,needsText:!0},t],hint:{message:`Reaches ${e.live} at its next pause. You stay here.`,note:`Goes on the timeline. The agent never reads it.`},placeholder:n}:{actions:[{id:`ask`,label:`Ask`,detail:`A question to the agent. No new report.`,needsText:!0},{id:`investigate`,label:e.reported?`Investigate again`:`Investigate`,detail:`A new run that ends in a report.`,needsText:!1},t],hint:{ask:`Opens the conversation; the agent answers there.`,investigate:`Starts ${e.nextName} and opens it.`,note:`Goes on the timeline. The agent never reads it.`},placeholder:n}}function Q(e){return ge(c(),e.draftChoice)}function ge(e,t){let n=e.harnesses.find(e=>e.id===t.harness),r=t.harness&&!n?{accessLevel:t.accessLevel}:t,i=n??e.effective,o=i?.id,s=r.model??(r.harness?e.models[o]:e.model)??``,c=r.effort===void 0?e.efforts[o]??null:r.effort,l=r.accessLevel??a(i,e.axes).level.level;return{choice:e,harness:i,hid:o,model:s,effort:c,accessLevel:l,now:o?{harness:o,model:s,effort:c,accessLevel:l}:{},sent:{accessLevel:l,...t.harness&&o?{harness:o}:{},...r.model===void 0?{}:{model:r.model},...r.effort===void 0?{}:{effort:r.effort}}}}function $({o:e,action:t,onAction:n}){let r=e.record,{incident:i,runs:a}=r,{choice:s,harness:c,hid:l,model:u,effort:f,accessLevel:p,now:m,sent:h}=Q(r),[g,_]=(0,J.useState)(``),v=e.live,y=Z({live:v?P(a,v):null,nextName:`Run ${A(a,``)}`,reported:!!e.report}),b=t&&y.actions.some(e=>e.id===t)?t:y.actions[0]?.id,x=c?o(c):null,S=b===`note`||b===`message`?void 0:x||r.investigateBlocked,C=b===`note`||b===`message`,w=e=>{e.harnessId?r.setDraftChoice(e.harnessId===l?{...m,model:e.model??``}:{harness:e.harnessId,model:e.model??``}):e.model===void 0?e.effort?r.setDraftChoice({...m,effort:e.effort}):e.accessLevel&&r.setDraftChoice({...m,accessLevel:e.accessLevel}):r.setDraftChoice({...m,model:e.model})},T=async({text:t,files:n})=>{if(b===`note`)return new Promise((e,n)=>r.addNote(t,e,n));let o=await Promise.all(n.map(e=>le(i.id,e))),s=o.map(e=>e.id);if(b===`message`){let n=e.latestRun.investigation,r=n?.liveTurn===`report`?`continue`:n?.liveTurn===`answer`?`chat`:void 0;await e.latestRun.sendMessage(t,`queue`,{attachments:o,...r?{kind:r}:{}});return}if(b===`ask`)return r.chat({text:t,...h,attachments:s});let c=e.report;return r.investigate({text:c&&e.reported?d(c,A(a,e.reported.id),t):t||void 0,...h,attachments:s})},E=e.latestRun,D=E.isActive?E.asks.filter(e=>e.state===`waiting`):[],O=D.length>0||E.queued.length>0?(0,Y.jsx)(F,{asks:D,queued:E.queued,runId:E.investigation?.id,agent:s.harnesses.find(e=>e.id===E.investigation?.harness)?.label??`The agent`,cwd:E.investigation?.workspace?.cwd}):null;return(0,Y.jsx)(`div`,{className:`shrink-0 px-4 pt-2 pb-3`,"data-testid":`overview-composer`,children:(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-[760px]`,children:(0,Y.jsx)(ue,{state:`ready`,...ce(y.actions,b,e=>n(e)),choice:{harness:c,model:u,effort:f,accessLevel:p},onChoice:w,agentless:C,onSend:T,placeholder:y.placeholder[b]??``,text:g,onText:_,dock:O,pending:r.isStarting||r.isSavingNote,blockedReason:S})})})}function _e(){let t=l(),{incident:n}=t.record,r=e(),{toast:i}=v(),a=(0,J.useRef)(null),[o,c]=(0,J.useState)(null),d=e=>{c(e),window.setTimeout(()=>document.querySelector(`[data-testid=overview-composer] textarea`)?.focus(),0)},y=Q(t.record),x=de({alerts:n.alerts?.length??0,runs:t.record.runs.length,changes:t.changes?.total??0,deploy:!!t.changes?.deploy,entries:(t.record.timeline??[]).filter(e=>e.type!==`incident_created`).length}),S=b(),C=()=>void t.record.investigate({...y.sent}).catch(e=>i({title:`The run did not start`,description:T(e),variant:`destructive`})),w=u(t,{commandRef:a,resume:()=>{t.latest&&S.mutate({id:t.latest.id},{onError:E(i)})},investigate:()=>{y.harness&&(s(y.harness)?d(`investigate`):C())},ask:()=>d(`ask`),services:()=>void r({to:`/services`,search:{add:`1`}}),watch:()=>{t.live&&r({to:`/incidents/$id/conversation`,params:{id:n.id},search:{investigation:t.live.id}})}}),D=k(n).kind===`webhook`;return(0,Y.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`incident-overview`,children:[(0,Y.jsx)(g,{incident:n,view:`Overview`,reportRunId:t.reported?.id??null,onResolve:t.record.openClose,onReopen:t.record.openReopen,onEditCause:t.record.openEditCause}),x?(0,Y.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col justify-center overflow-y-auto pb-[12vh]`,"data-testid":`incident-blank`,children:[(0,Y.jsx)(`h2`,{className:`mb-4 text-center text-display text-text-1`,children:`What do you know so far?`}),!n.service&&(0,Y.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,Y.jsx)(he,{incidentId:n.id})}),(0,Y.jsx)($,{o:t,action:o,onAction:c})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(pe,{o:t}),(0,Y.jsxs)(`main`,{className:`grid min-h-0 flex-1 auto-rows-[280px] grid-cols-1 grid-rows-[auto] gap-3 overflow-y-auto overscroll-contain px-4 pt-3 pb-1 md:grid-cols-[minmax(0,1.35fr)_minmax(0,1fr)] md:grid-rows-[auto_minmax(120px,1fr)_minmax(120px,1fr)]`,"data-testid":`overview-grid`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 md:col-span-2`,children:(0,Y.jsx)(h,{o:t,onAction:w,canStart:!!y.harness})}),!D&&(0,Y.jsx)(f,{view:t.impact}),t.latest&&(0,Y.jsx)(m,{o:t,commandRef:a}),t.latest&&(0,Y.jsx)(p,{o:t,onInvestigate:()=>d(`investigate`)}),(0,Y.jsx)(_,{o:t,wide:D&&!t.latest})]}),(0,Y.jsx)($,{o:t,action:o,onAction:c})]})]})}var ve=_e;export{ve as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e,Xt as t,_t as n,c as r,gt as i,it as a,ot as o,q as s,r as c,x as l}from"./desktop-Bqso9PNq.js";import{n as u}from"./useNavigate-I5E4IRt2.js";import{t as d}from"./chevron-left-DWLaEwl8.js";import{a as f,n as p,t as m}from"./jsx-runtime-Wy9s6hX0.js";import{E as h,R as g,_,_t as v,f as y,l as b,lt as x,r as S,x as C}from"./source-words-B5oOdiQU.js";import{t as w}from"./button-DmIfWVZ8.js";import{$ as T,A as E,D,P as O,k as ee,t as k,w as A}from"./Hint-BCpVhAvV.js";import{c as j,i as M,n as N,o as P,s as F,t as I}from"./select-98_n4DVz.js";import{r as L}from"./RingTick-DkMvLoUV.js";import{n as R,t as te}from"./ServiceFormDialog-9-qDnObk.js";import{t as ne}from"./AddProjectDialog-BEBKziDJ.js";import{t as z}from"./link-BHh9_evg.js";import{t as re}from"./Segmented-CeyAquj9.js";import{i as ie,n as B,r as ae}from"./service-detail.utils-ulWHS1Ao.js";import{c as oe,d as se,f as ce,g as le,h as ue,l as de,n as fe,s as pe}from"./use-repositories-orpc-c6hPOKjE.js";import{a as me,i as he,o as V}from"./State-CCKzehkH.js";import{R as ge,n as _e,z as ve}from"./index-DZMj9YK4.js";import{r as ye,t as be}from"./switch-DpPkkZxw.js";import{t as xe}from"./boxes-Dh2QZfJa.js";import{t as H}from"./input-CXxt1dAV.js";import{t as U}from"./utils-A3okWeke.js";import{t as Se}from"./useQueries-CGpidxif.js";import{a as Ce,n as we,t as Te}from"./WorkspaceFields-DCSJCThm.js";import{n as Ee}from"./Row-B3HLhwlw.js";import{i as De,n as Oe}from"./use-back-R0oWqfab.js";import{t as ke}from"./use-page-title-DEIRQICr.js";var W=f(p()),G=m();function K(e){let t=e.length>3?e.slice(0,2):e,n=e.length-t.length,r=n>0?[...t,`${n} more`]:t;return r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0]??``}function Ae(e,t){let n=[];if(t.length&&n.push(`${K(t)} ${t.length===1?`depends`:`depend`} on it.`),e.length&&n.push(`It depends on ${K(e)}.`),n.length===0)return null;let r=e.length+t.length;return`Its ${r===1?`dependency link goes`:`${r} dependency links go`} too: ${n.join(` `)}`}function je({open:e,onOpenChange:t,serviceId:n,serviceName:r,upstream:i=[],downstream:a=[],links:o=`success`,onRetryLinks:s,onSuccess:c}){let l=se(),u=Ae(i,a);return(0,G.jsx)(h,{open:e,onOpenChange:t,title:`Delete service?`,description:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`This removes `,(0,G.jsx)(`strong`,{children:r}),` from the catalog. Incidents that named it keep their record.`]}),o===`error`?(0,G.jsxs)(`p`,{"data-testid":`delete-service-links-error`,children:[`Couldn't load this service's dependency links. Any it has go with it.`,` `,s&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:s,children:`Retry`})]}):o===`success`&&u&&(0,G.jsx)(`p`,{"data-testid":`delete-service-links`,children:u})]}),confirmLabel:`Delete`,onConfirm:async()=>{await l.mutateAsync({id:n}),c?.()},isPending:l.isPending,isLoading:o===`pending`})}var q=`auto`;function J(e){let t=e.metadata?.credentialConnectionId;return typeof t==`string`&&t?t:null}function Me({repo:e,credential:t}){let n=pe(),r=J(e),i=t.problem?.candidates??[],a=r&&!i.some(e=>e.connectionId===r)?[...i,{connectionId:r,label:t.label.replace(/^token /,``),fingerprint:t.fingerprint??``}]:i;return(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(I,{value:r??q,disabled:n.isPending,onValueChange:t=>n.mutate({id:e.id,connectionId:t===q?null:t}),children:[(0,G.jsx)(P,{className:`h-7 w-auto min-w-32`,"aria-label":`Which token this repository clones with`,"data-testid":`service-code-credential-picker`,children:(0,G.jsx)(F,{})}),(0,G.jsxs)(N,{children:[(0,G.jsx)(M,{value:q,children:`Auto`}),a.map(e=>(0,G.jsx)(M,{value:e.connectionId,children:e.fingerprint?`${e.label}, fp ${e.fingerprint}`:e.label},e.connectionId))]})]}),(0,G.jsx)(L,{error:n.error})]})}function Ne({service:e}){let[t,n]=(0,W.useState)(!1),r=fe(),i=oe(),a=e.repositories??[];return(0,G.jsxs)(R,{id:`code`,title:`Code the run reads`,actions:!t&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>n(!0),children:`Add`}),children:[a.length===0&&!t&&(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None, so a run on this service reads no code.`}),(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:a.map(t=>{let n=t.repository,r=t.subPath&&n.sourceKind===`folder`?`${n.url}/${t.subPath}`:n.url,a=[n.sourceKind===`folder`?`Folder on this machine`:`Git URL`,n.syncBranch?`branch ${n.syncBranch}`:null,n.syncHead?`last read at ${n.syncHead.slice(0,7)}`:null].filter(Boolean).join(`, `),o=n.credential,s=n.sourceKind===`url`&&o&&(o.problem?.code===`ambiguous`||!!J(n));return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 py-2.5`,"data-testid":`service-code-row`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(k,{label:r,children:(0,G.jsx)(j,{tabIndex:0,className:`block truncate rounded-[2px] text-left text-text-1 [direction:rtl] focus-visible:ring-1 focus-visible:ring-accent focus-visible:outline-none`,children:(0,G.jsx)(`bdi`,{children:r})})}),(0,G.jsxs)(`p`,{className:`text-meta text-text-2`,children:[a,o&&(0,G.jsxs)(G.Fragment,{children:[`, `,(0,G.jsxs)(`span`,{title:o.via,"data-testid":`service-code-credential`,children:[`Code: `,g(o)]})]})]}),o?.problem&&(0,G.jsx)(`p`,{className:`text-meta text-danger`,"data-testid":`service-code-credential-problem`,children:o.problem.message}),n.syncError&&(0,G.jsx)(`p`,{className:`text-meta text-danger`,children:n.syncError}),s&&o&&(0,G.jsx)(Me,{repo:n,credential:o})]}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,disabled:i.isPending,onClick:()=>i.mutate({id:n.id,serviceId:e.id}),children:`Stop reading it`})]},t.id)})}),t&&(0,G.jsx)(ne,{open:!0,onOpenChange:e=>{n(e),e||r.reset()},title:`Add code`,pending:r.isPending,error:r.error?c(r.error):null,onChoose:t=>r.mutate({serviceId:e.id,source:t},{onSuccess:()=>n(!1)})}),(0,G.jsx)(L,{error:i.error,className:`mt-2`})]})}function Pe({serviceId:e,topology:n,onRemove:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(`upstream`),d=de(),f=t(),{data:p}=ue({limit:100}),m=[...(n?.upstream??[]).map(e=>({edge:e,direction:`upstream`})),...(n?.downstream??[]).map(e=>({edge:e,direction:`downstream`}))],h=new Set(m.map(e=>e.edge.service.id)),g=(p?.data??[]).filter(t=>t.id!==e&&!h.has(t.id));return(0,G.jsxs)(R,{id:`dependencies`,title:`Dependencies`,count:m.length||void 0,actions:!a&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>o(!0),"data-testid":`add-dependency`,children:`Add`}),children:[m.length===0&&!a&&(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None recorded.`}),(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:m.map(({edge:t,direction:n})=>(0,G.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,"data-testid":`service-dependency-row`,children:[(0,G.jsxs)(`p`,{className:`min-w-0 flex-1 text-body`,children:[(0,G.jsx)(z,{to:`/services/$id`,params:{id:t.service.id},className:`text-text-1 hover:underline`,children:t.service.name}),` `,(0,G.jsxs)(`span`,{className:`text-meta text-text-3`,"data-testid":`dependency-kind`,children:[B(t.service.type),`, `,n]})]}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,onClick:()=>i(n===`upstream`?{from:e,to:t.service.id}:{from:t.service.id,to:e}),children:`Remove`})]},`${n}-${t.service.id}`))}),a&&(0,G.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,G.jsxs)(I,{value:s,onValueChange:c,children:[(0,G.jsx)(P,{"aria-label":`Service`,"data-testid":`dependency-service`,children:(0,G.jsx)(F,{placeholder:`A service`})}),(0,G.jsx)(N,{children:g.map(e=>(0,G.jsx)(M,{value:e.id,children:e.name},e.id))})]}),(0,G.jsx)(re,{label:`Direction`,value:l,onChange:u,options:[{value:`upstream`,label:`Upstream`},{value:`downstream`,label:`Downstream`}],testId:`dependency-direction`}),(0,G.jsx)(w,{variant:`secondary`,disabled:!s||d.isPending,onClick:()=>{if(!s)return;let[t,n]=l===`upstream`?[e,s]:[s,e];d.mutate({id:t,dependencyId:n},{onSuccess:()=>{o(!1),c(``),f.invalidateQueries({queryKey:r.services.key()})}})},"data-testid":`dependency-save`,children:`Add`}),(0,G.jsx)(w,{variant:`text`,onClick:()=>o(!1),children:`Cancel`})]}),(0,G.jsx)(L,{error:d.error,className:`mt-2`})]})}function Fe(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(V,{className:`h-4 w-32`}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(V,{className:`h-10 w-10 rounded-lg`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(V,{className:`h-8 w-64`}),(0,G.jsx)(V,{className:`h-4 w-32`})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-8`,children:[(0,G.jsx)(V,{className:`h-64 w-48`}),(0,G.jsx)(V,{className:`h-64 flex-1`})]})]})}function Ie({incidents:e,total:t}){let n=ve();return(0,G.jsx)(R,{id:`incidents`,title:`Incidents`,count:t,children:e.length===0?(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None yet.`}):(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:e.slice(0,10).map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5 py-2.5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 size-2 shrink-0 rounded-full`,style:{background:`var(--sev-${e.severity})`}}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(z,{to:`/incidents/$id`,params:{id:e.id},className:`block truncate text-body text-text-1 hover:underline`,children:[(0,G.jsxs)(j,{className:`mr-2 text-text-3`,children:[`INC-`,e.number]}),(0,G.jsx)(`span`,{className:`font-semibold`,children:e.title})]}),(0,G.jsxs)(`p`,{className:`text-meta text-text-2`,children:[s[e.status],`,`,` `,ge(e.triggeredAt,n)]})]})]},e.id))})})}var Y={always:{label:`Start one for every alert`,line:`Every alert on this service starts a run`,short:`Every alert`},critical_and_high:{label:`Start one for every critical and high alert`,line:`Lower alerts wait for you`,short:`Critical and high`},critical_only:{label:`Start one for every critical alert`,line:`Every other alert waits for you`,short:`Critical only`},never:{label:`Start none on their own`,line:`Every alert waits for you to start a run`,short:`None`}};function Le({serviceId:e,metadata:t}){let n=le(),r=t?.investigation??{},i=o.safeParse(r.trigger),s=i.success?i.data:a;return(0,G.jsxs)(R,{id:`investigations`,title:`Runs`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-16 flex-col justify-center gap-2 py-3 sm:flex-row sm:items-center sm:gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:Y[s].label}),(0,G.jsx)(`p`,{className:`text-meta text-text-2`,children:Y[s].line})]}),(0,G.jsxs)(I,{value:s,onValueChange:i=>n.mutate({id:e,metadata:{...t,investigation:{...r,trigger:i}}}),children:[(0,G.jsx)(P,{className:`self-start sm:self-auto`,"aria-label":`Which alerts start a run`,children:(0,G.jsx)(F,{})}),(0,G.jsx)(N,{children:Object.keys(Y).map(e=>(0,G.jsx)(M,{value:e,children:Y[e].short},e))})]})]}),(0,G.jsx)(L,{error:n.error,className:`mt-2`})]})}var Re=[`prometheus`,`alertmanager`,`loki`];function ze(e,t){if(!e)return null;let n=e.kinds.find(e=>e.kind===t);if(!n||n.notConfigured)return{text:`Not set up`};if(n.skipped)return{text:`Choose one`,warn:!0};let r=n.units[0];if(!r)return{text:`Not set up`};let i=r.selection?.rule;return r.from===`env`||i===`env`?{text:`From environment`}:i===`other-tag`&&r.deployment?{text:r.label,sub:`${r.deployment} data`,warn:!0}:i===`tag-match`?{text:r.label}:{text:r.label,sub:`Any deployment`}}function Be({serviceId:e,deployments:t}){let n=[...t,null],i=Se({queries:n.map(t=>r.sources.preRun.queryOptions({input:{serviceId:e,...t?{deployment:t}:{}},staleTime:3e4}))});return(0,G.jsxs)(`div`,{"data-testid":`service-matrix`,children:[(0,G.jsx)(`h3`,{className:`mb-2 text-heading`,children:`By deployment`}),(0,G.jsx)(`div`,{"data-scroll-x":!0,className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{"aria-label":`Connections by deployment`,className:`grid min-w-[560px] gap-1.5`,style:{gridTemplateColumns:`9rem repeat(${n.length}, minmax(7rem, 1fr))`},children:[(0,G.jsx)(`thead`,{className:`contents`,children:(0,G.jsxs)(`tr`,{className:`contents text-meta text-text-2`,children:[(0,G.jsx)(`th`,{children:(0,G.jsx)(`span`,{className:`sr-only`,children:`Kind`})}),n.map(e=>(0,G.jsx)(`th`,{className:`px-1 text-left font-medium`,children:e??`Not named`},e??`-`))]})}),(0,G.jsx)(`tbody`,{className:`contents`,children:Re.map(e=>(0,G.jsxs)(`tr`,{className:`contents`,children:[(0,G.jsxs)(`th`,{className:`flex items-center gap-2 pr-2 text-left font-semibold`,children:[(0,G.jsx)(S,{kind:e,small:!0}),y(e)]}),n.map((t,n)=>{let r=i[n],a=ze(r?.data,e);return(0,G.jsx)(`td`,{className:U(`raised flex min-h-14 flex-col justify-center rounded-pool px-3 py-2`,a?.warn&&`bg-warn/10`),"data-testid":`matrix-cell`,children:r?.isError?(0,G.jsx)(`span`,{className:`text-meta text-text-2`,children:`Did not load`}):a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`block truncate font-semibold`,children:a.text}),a.sub&&(0,G.jsxs)(`span`,{className:U(`flex items-center gap-1 text-meta`,a.warn?`text-warn`:`text-text-2`),children:[a.warn&&(0,G.jsx)(x,{className:`size-3`,"aria-hidden":!0}),a.sub]})]}):(0,G.jsx)(`span`,{className:`text-meta text-text-3`,children:`…`})},t??`-`)})]},e))})]})})]})}var Ve=[`prometheus`,`alertmanager`,`loki`],He=/^\{\s*[A-Za-z_][A-Za-z0-9_]*\s*(=|!=|=~|!~)\s*"[^"]*"\s*(,\s*[A-Za-z_][A-Za-z0-9_]*\s*(=|!=|=~|!~)\s*"[^"]*"\s*)*,?\s*\}$/;function Ue(e){let t=e.trim();return!t||He.test(t)?null:`This is not a list of label matchers. Write it like {app="checkout"}, not a bare metric name like up.`}var X=e=>typeof e==`string`?e:``,Z=e=>e.serviceConfig??{},We=e=>e.hasOverride&&Z(e).enabled!==!1,Ge=e=>X(e.globalConfig?.baseUrl);function Q(e){return[...e.filter(e=>e.hasOverride).sort((e,t)=>(t.priority??0)-(e.priority??0)),...e.filter(e=>!e.hasOverride)]}function Ke(e,t,n){let r=e.flatMap(e=>e.overrideId?[e.overrideId]:[]),i=r.indexOf(t),a=i+n;return i<0||a<0||a>=r.length?null:([r[i],r[a]]=[r[a],r[i]],r)}function qe({serviceId:e,integrations:t}){let n=C(e),r=E(),[i,a]=(0,W.useState)(``),o=Ve.map(e=>{let n=Q(t.filter(t=>t.templateId===e));return{kind:e,rows:n,mapped:n.filter(e=>e.hasOverride)}}).filter(e=>e.rows.length>0),s=(t,n,i)=>{let o=n.overrideId&&Ke(t,n.overrideId,i);o&&r.mutate({serviceId:e,overrideIds:o},{onSuccess:()=>a(`${n.connectionName} moved ${i<0?`up`:`down`}`)})},c=n.data?.deploymentsSeen??[];return(0,G.jsx)(R,{id:`telemetry`,title:`Connections`,children:o.length===0?(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None. Add Prometheus, Alertmanager or Loki under Settings, Sources, then map it here.`}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>1&&(0,G.jsx)(Be,{serviceId:e,deployments:c}),o.map(t=>(0,G.jsxs)(`div`,{"data-testid":`service-kind-${t.kind}`,children:[(0,G.jsxs)(`h3`,{className:`mb-2 flex items-baseline gap-2 text-heading`,children:[y(t.kind),(0,G.jsx)(`span`,{className:`font-normal text-text-3 tabular-nums`,children:t.mapped.length||``})]}),t.mapped.length>1&&(0,G.jsx)(`p`,{className:`-mt-1 mb-2 text-meta text-text-2`,"data-testid":`mapping-order-hint`,children:`Higher rows win.`}),(0,G.jsx)(`ul`,{className:`raised flex flex-col divide-y divide-hairline rounded-pool px-4`,children:t.rows.map(i=>(0,G.jsx)(Ye,{serviceId:e,item:i,preview:n.data,deployments:c,order:t.mapped.length>1&&i.hasOverride?{index:t.mapped.indexOf(i),count:t.mapped.length,pending:r.isPending,onMove:e=>s(t.mapped,i,e)}:void 0},i.connectionId))})]},t.kind)),(0,G.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:i})]})})}function Je(e,t){return t?.kinds.find(t=>t.kind===e.templateId)?.units.find(t=>t.connectionId===e.connectionId)?`Used for every deployment`:`Not used by this service`}function Ye({serviceId:e,item:t,preview:n,deployments:r,order:i}){let a=A(),o=O(),s=D(),[c,l]=(0,W.useState)(!1),u=a.isPending||o.isPending||s.isPending,d=Z(t),f=X(d.deployment),p=X(d.selector),m=We(t),h=(0,W.useId)(),g=(0,W.useId)();return(0,G.jsxs)(`li`,{className:`py-3`,"data-testid":`service-telemetry-row`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(S,{kind:t.templateId}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[t.hasOverride&&t.overrideId?(0,G.jsx)(`label`,{htmlFor:g,className:`block text-heading`,children:t.connectionName}):(0,G.jsx)(`p`,{className:`text-heading`,children:t.connectionName}),(0,G.jsx)(`p`,{className:`truncate font-mono text-mono text-text-2`,children:b(Ge(t))}),t.hasOverride?(0,G.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:U(`inline-flex h-[22px] items-center gap-1.5 rounded-control px-2 text-meta`,f?`bg-surface-3 text-text-1`:`text-text-2 outline-1 -outline-offset-1 outline-text-3/60`),"data-testid":`mapping-deployment`,children:[(0,G.jsx)(xe,{className:`size-[13px] text-text-2`,"aria-hidden":!0}),f||`Any deployment`]}),p&&(0,G.jsx)(`code`,{className:`inline-flex h-[22px] items-center rounded-control bg-surface-3 px-2 font-mono text-mono`,children:p})]}):(0,G.jsx)(`p`,{className:`text-meta text-text-2`,children:Je(t,n)})]}),t.hasOverride&&t.overrideId?(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 max-md:gap-4.5 pointer-coarse:gap-4.5`,children:[(0,G.jsx)(be,{id:g,checked:m,disabled:u,onCheckedChange:e=>t.overrideId&&o.mutate({id:t.overrideId,config:{...d,enabled:e}}),"aria-label":`Use ${t.connectionName} for this service`,"data-testid":`mapping-switch`}),(0,G.jsx)(w,{variant:`text`,size:`icon`,"aria-expanded":c,"aria-controls":h,"aria-label":`Edit the mapping of ${t.connectionName}`,onClick:()=>l(!c),children:(0,G.jsx)(T,{className:U(`size-4 transition-transform duration-(--dur-fast)`,c&&`rotate-180`)})})]}):(0,G.jsx)(w,{variant:`secondary`,size:`sm`,disabled:u,onClick:()=>a.mutate({serviceId:e,connectionId:t.connectionId,config:{}}),"data-testid":`mapping-add`,children:`Add`})]}),c&&t.overrideId&&(0,G.jsxs)(`div`,{id:h,className:`mt-3 flex flex-col gap-3 pl-11`,children:[i&&(0,G.jsx)(Xe,{name:t.connectionName,order:i}),(0,G.jsx)(Ze,{item:t,deployments:r,pending:u,onSave:e=>t.overrideId&&o.mutate({id:t.overrideId,config:e},{onSuccess:()=>l(!1)}),onRemove:()=>t.overrideId&&s.mutate({id:t.overrideId})})]})]})}function Xe({name:e,order:t}){let{index:n,count:r,pending:i,onMove:a}=t;return(0,G.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`mapping-order`,children:[(0,G.jsxs)(`legend`,{className:`sr-only`,children:[`Order of `,e]}),(0,G.jsxs)(w,{type:`button`,variant:`secondary`,size:`sm`,disabled:i||n===0,onClick:()=>a(-1),"data-testid":`mapping-move-up`,children:[(0,G.jsx)(ye,{"aria-hidden":!0}),`Move up`]}),(0,G.jsxs)(w,{type:`button`,variant:`secondary`,size:`sm`,disabled:i||n===r-1,onClick:()=>a(1),"data-testid":`mapping-move-down`,children:[(0,G.jsx)(v,{"aria-hidden":!0}),`Move down`]})]})}function Ze({item:e,deployments:t,pending:n,onSave:r,onRemove:i}){let a=Z(e),[o,s]=(0,W.useState)(X(a.deployment)),[c,u]=(0,W.useState)(X(a.selector)),[d,f]=(0,W.useState)(X(a[l])),[p,m]=(0,W.useState)(!1),h={d:(0,W.useId)(),s:(0,W.useId)(),m:(0,W.useId)(),list:(0,W.useId)()},g=Ue(c),v=o.trim().length>64?`Use 64 characters or fewer.`:null;return(0,G.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{if(e.preventDefault(),m(!0),g||v)return;let{deployment:t,selector:n,[l]:i,...s}=a;r({...s,...o.trim()?{deployment:o.trim()}:{},...c.trim()?{selector:c.trim()}:{},...d.trim()?{[l]:d.trim()}:{}})},"data-testid":`mapping-editor`,children:[(0,G.jsx)(_,{label:`Deployment tag`,htmlFor:h.d,hint:t.length?`Leave empty to match any deployment. Seen lately: ${t.join(`, `)}.`:`Leave empty to match any deployment.`,error:p&&v,children:(0,G.jsx)(H,{id:h.d,value:o,onChange:e=>s(e.target.value),list:h.list,placeholder:`prod-eu`})}),(0,G.jsx)(`datalist`,{id:h.list,children:t.map(e=>(0,G.jsx)(`option`,{value:e},e))}),(0,G.jsx)(_,{label:e.templateId===`alertmanager`?`Selector (filter matchers)`:`Selector`,htmlFor:h.s,hint:`Label matchers only, like {app="checkout"}.`,error:p&&g,children:(0,G.jsx)(H,{id:h.s,value:c,onChange:e=>u(e.target.value),className:`font-mono`,spellCheck:!1,placeholder:`{app="checkout"}`,"data-testid":`mapping-selector`})}),e.templateId===`prometheus`&&(0,G.jsx)(_,{label:`Impact metric`,htmlFor:h.m,hint:`A PromQL query for this service. An incident's Impact chart shows it, labelled as the service's metric, when the alert's own query is not known.`,children:(0,G.jsx)(H,{id:h.m,value:d,onChange:e=>f(e.target.value),className:`font-mono`,spellCheck:!1,"data-testid":`service-metric-input`})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(w,{type:`submit`,variant:`primary`,size:`sm`,disabled:n,children:`Save`}),(0,G.jsx)(w,{type:`button`,variant:`danger`,size:`sm`,className:`ml-auto`,disabled:n,onClick:i,children:`Remove from this service`})]})]})}var Qe=`From global settings`;function $e({serviceId:e}){let a=t(),o=n(r.runWorkspaces.getService.queryOptions({input:{serviceId:e}})),s=n(r.runWorkspaces.get.queryOptions()),[c,l]=(0,W.useState)(null),u=o.data?.override;(0,W.useEffect)(()=>{u&&l(u)},[u]);let d=i({...r.runWorkspaces.updateService.mutationOptions(),onSuccess:t=>a.setQueryData(r.runWorkspaces.getService.queryKey({input:{serviceId:e}}),t)});if(!o.data||!s.data||!c)return null;let{canEdit:f}=o.data,p=s.data.settings,m=s.data.defaultLocation,h={...p,...c},g=JSON.stringify(c)!==JSON.stringify(u),_=e=>c[e]!==void 0,v=e=>{let t={...c};_(e)?delete t[e]:t[e]=p[e],l(t)};return(0,G.jsxs)(R,{id:`workspace`,title:`Workspace`,children:[(0,G.jsx)(`p`,{className:`py-2 text-meta text-text-2`,children:`Where this service's runs check out its code, and what happens to it afterwards.`}),Te.map(({key:e,label:t})=>(0,G.jsx)(Ee,{testId:`service-workspace-${e}`,label:t,meta:_(e)?void 0:`${Qe} · ${Ce(e,p,m)}`,trailing:f&&(0,G.jsx)(w,{size:`sm`,variant:`text`,onClick:()=>v(e),children:_(e)?`Use global`:`Set for this service`}),below:_(e)&&(0,G.jsx)(we,{field:e,value:h,defaultLocation:m,onChange:(e,t)=>l({...c,[e]:t}),disabled:!f})},e)),f&&g&&(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,G.jsx)(w,{size:`sm`,disabled:d.isPending,onClick:()=>d.mutate({serviceId:e,override:c}),"data-testid":`service-workspace-save`,children:`Save`}),(0,G.jsx)(w,{size:`sm`,variant:`text`,disabled:d.isPending,onClick:()=>l(u??{}),children:`Discard`})]}),(0,G.jsx)(L,{error:d.error,className:`mt-2`})]})}var $=e=>e.startsWith(`/services/`),et=864e5;function tt(){let{id:i}=_e.useParams(),a=u(),o=De($,`/services`),[s,c]=(0,W.useState)(!1),[l,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),{data:g,isLoading:_,error:v,refetch:y}=n(r.services.get.queryOptions({input:{id:i}})),{data:b,status:x,refetch:S}=n({...r.services.getTopology.queryOptions({input:{id:i}}),enabled:!!g}),{data:C=[]}=ee(i),{data:T}=n(r.incidents.list.queryOptions({input:{serviceId:i,limit:100}})),E=ce(),D=t();if(ke(g?`${g.name}, Services`:`Services`),(0,W.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target;t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable||document.querySelector(`[role=dialog], [role=alertdialog], [role=menu]`)||o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]),_)return(0,G.jsx)(Fe,{});if(v||!g){let e=(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:o,children:`Back to the services`}),t=!v||v.status===404;return(0,G.jsx)(`div`,{className:`p-6`,children:t?(0,G.jsx)(he,{text:`This service is not here. It may have been deleted.`,back:e}):(0,G.jsx)(me,{text:`This service did not load.`,onRetry:()=>void y(),back:e})})}let O=T?.data??[],A=O.filter(t=>e(t.status)).length,j=O.filter(e=>Date.now()-new Date(e.triggeredAt).getTime()<30*et).length,M=Oe($,`/services`);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-canvas`,"data-testid":`service-page`,children:[(0,G.jsxs)(`header`,{className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 px-3 md:px-4`,"data-testid":`service-band`,"data-title-row":!0,children:[(0,G.jsx)(w,{variant:`text`,size:`icon`,className:`shrink-0`,asChild:!0,children:(0,G.jsx)(`a`,{href:M,onClick:e=>{e.preventDefault(),o()},"aria-label":M===`/services`?`Back to the services`:`Back`,"data-testid":`service-back`,children:(0,G.jsx)(d,{className:`size-4`})})}),(0,G.jsx)(`h1`,{className:`min-w-0 truncate text-title`,children:g.name}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2.5 text-meta`,"data-testid":`service-meta`,children:[(0,G.jsx)(`span`,{className:`text-text-2`,children:B(g.type)}),(0,G.jsx)(k,{label:ae(g.tier),children:(0,G.jsx)(`span`,{className:`text-text-3`,children:ie(g.tier)})}),g.team&&(0,G.jsx)(`span`,{className:`truncate text-text-3 max-sm:hidden`,children:g.team})]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>c(!0),"data-testid":`service-edit`,children:`Edit`}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,onClick:()=>f(!0),"data-testid":`service-delete`,children:`Delete`})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-[52rem] px-4 pt-3 pb-12`,children:[g.description&&(0,G.jsx)(`p`,{className:`text-body text-text-1`,children:g.description}),(0,G.jsxs)(`p`,{className:`mt-1 text-meta text-text-2 tabular-nums`,"data-testid":`service-summary`,children:[A===1?`1 incident open`:`${A} incidents open`,`,`,` `,j,` in 30 days.`]}),(0,G.jsxs)(`div`,{className:`mt-8`,children:[(0,G.jsx)(Ne,{service:g}),(0,G.jsx)(qe,{serviceId:i,integrations:C}),(0,G.jsx)(Pe,{serviceId:i,topology:b,onRemove:m}),(0,G.jsx)(Le,{serviceId:i,metadata:g.metadata}),(0,G.jsx)($e,{serviceId:i}),(0,G.jsx)(Ie,{incidents:O,total:T?.pagination.total??O.length})]})]})}),(0,G.jsx)(te,{open:s,onOpenChange:c,service:g}),(0,G.jsx)(je,{open:l,onOpenChange:f,serviceId:g.id,serviceName:g.displayName||g.name,upstream:(b?.upstream??[]).map(e=>e.service.displayName||e.service.name),downstream:(b?.downstream??[]).map(e=>e.service.displayName||e.service.name),links:x,onRetryLinks:()=>void S(),onSuccess:()=>a({to:`/services`})}),(0,G.jsx)(h,{open:!!p,onOpenChange:e=>!e&&m(null),title:`Remove this dependency?`,description:(0,G.jsx)(`p`,{children:`The edge between the two services goes; both services stay.`}),confirmLabel:`Remove`,onConfirm:()=>p&&E.mutateAsync({id:p.from,dependencyId:p.to}).then(()=>D.invalidateQueries({queryKey:r.services.key()})),isPending:E.isPending})]})}export{tt as component};
|
|
1
|
+
import{L as e,Xt as t,_t as n,c as r,gt as i,it as a,ot as o,q as s,r as c,x as l}from"./desktop-yb-lqHMd.js";import{n as u}from"./useNavigate-I5E4IRt2.js";import{t as d}from"./chevron-left-S6eOHk4C.js";import{a as f,n as p,t as m}from"./jsx-runtime-Wy9s6hX0.js";import{E as h,R as g,_,_t as v,f as y,l as b,lt as x,r as S,x as C}from"./source-words-CCeTLwOy.js";import{t as w}from"./button-DmIfWVZ8.js";import{$ as T,A as E,D,P as O,k as ee,t as k,w as A}from"./Hint-Od6cnmvm.js";import{c as j,i as M,n as N,o as P,s as F,t as I}from"./select-hkRu0Dxf.js";import{r as L}from"./RingTick-Zd_duqBv.js";import{n as R,t as te}from"./ServiceFormDialog-Bfyz7V7X.js";import{t as ne}from"./AddProjectDialog-p3LLsE1B.js";import{t as z}from"./link-BHh9_evg.js";import{t as re}from"./Segmented-CeyAquj9.js";import{i as ie,n as B,r as ae}from"./service-detail.utils-BQfYgq-F.js";import{c as oe,d as se,f as ce,g as le,h as ue,l as de,n as fe,s as pe}from"./use-repositories-orpc-Ban_zGD7.js";import{a as me,i as he,o as V}from"./State-CCKzehkH.js";import{R as ge,n as _e,z as ve}from"./index-BoI68UdU.js";import{r as ye,t as be}from"./switch-u0tmvVOg.js";import{t as xe}from"./boxes-B__2zYVO.js";import{t as H}from"./input-CXxt1dAV.js";import{t as U}from"./utils-A3okWeke.js";import{t as Se}from"./useQueries-B6U7UAZl.js";import{a as Ce,n as we,t as Te}from"./WorkspaceFields-CXSg1krp.js";import{n as Ee}from"./Row-B3HLhwlw.js";import{i as De,n as Oe}from"./use-back-R0oWqfab.js";import{t as ke}from"./use-page-title-DEIRQICr.js";var W=f(p()),G=m();function K(e){let t=e.length>3?e.slice(0,2):e,n=e.length-t.length,r=n>0?[...t,`${n} more`]:t;return r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0]??``}function Ae(e,t){let n=[];if(t.length&&n.push(`${K(t)} ${t.length===1?`depends`:`depend`} on it.`),e.length&&n.push(`It depends on ${K(e)}.`),n.length===0)return null;let r=e.length+t.length;return`Its ${r===1?`dependency link goes`:`${r} dependency links go`} too: ${n.join(` `)}`}function je({open:e,onOpenChange:t,serviceId:n,serviceName:r,upstream:i=[],downstream:a=[],links:o=`success`,onRetryLinks:s,onSuccess:c}){let l=se(),u=Ae(i,a);return(0,G.jsx)(h,{open:e,onOpenChange:t,title:`Delete service?`,description:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`This removes `,(0,G.jsx)(`strong`,{children:r}),` from the catalog. Incidents that named it keep their record.`]}),o===`error`?(0,G.jsxs)(`p`,{"data-testid":`delete-service-links-error`,children:[`Couldn't load this service's dependency links. Any it has go with it.`,` `,s&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:s,children:`Retry`})]}):o===`success`&&u&&(0,G.jsx)(`p`,{"data-testid":`delete-service-links`,children:u})]}),confirmLabel:`Delete`,onConfirm:async()=>{await l.mutateAsync({id:n}),c?.()},isPending:l.isPending,isLoading:o===`pending`})}var q=`auto`;function J(e){let t=e.metadata?.credentialConnectionId;return typeof t==`string`&&t?t:null}function Me({repo:e,credential:t}){let n=pe(),r=J(e),i=t.problem?.candidates??[],a=r&&!i.some(e=>e.connectionId===r)?[...i,{connectionId:r,label:t.label.replace(/^token /,``),fingerprint:t.fingerprint??``}]:i;return(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(I,{value:r??q,disabled:n.isPending,onValueChange:t=>n.mutate({id:e.id,connectionId:t===q?null:t}),children:[(0,G.jsx)(P,{className:`h-7 w-auto min-w-32`,"aria-label":`Which token this repository clones with`,"data-testid":`service-code-credential-picker`,children:(0,G.jsx)(F,{})}),(0,G.jsxs)(N,{children:[(0,G.jsx)(M,{value:q,children:`Auto`}),a.map(e=>(0,G.jsx)(M,{value:e.connectionId,children:e.fingerprint?`${e.label}, fp ${e.fingerprint}`:e.label},e.connectionId))]})]}),(0,G.jsx)(L,{error:n.error})]})}function Ne({service:e}){let[t,n]=(0,W.useState)(!1),r=fe(),i=oe(),a=e.repositories??[];return(0,G.jsxs)(R,{id:`code`,title:`Code the run reads`,actions:!t&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>n(!0),children:`Add`}),children:[a.length===0&&!t&&(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None, so a run on this service reads no code.`}),(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:a.map(t=>{let n=t.repository,r=t.subPath&&n.sourceKind===`folder`?`${n.url}/${t.subPath}`:n.url,a=[n.sourceKind===`folder`?`Folder on this machine`:`Git URL`,n.syncBranch?`branch ${n.syncBranch}`:null,n.syncHead?`last read at ${n.syncHead.slice(0,7)}`:null].filter(Boolean).join(`, `),o=n.credential,s=n.sourceKind===`url`&&o&&(o.problem?.code===`ambiguous`||!!J(n));return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 py-2.5`,"data-testid":`service-code-row`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(k,{label:r,children:(0,G.jsx)(j,{tabIndex:0,className:`block truncate rounded-[2px] text-left text-text-1 [direction:rtl] focus-visible:ring-1 focus-visible:ring-accent focus-visible:outline-none`,children:(0,G.jsx)(`bdi`,{children:r})})}),(0,G.jsxs)(`p`,{className:`text-meta text-text-2`,children:[a,o&&(0,G.jsxs)(G.Fragment,{children:[`, `,(0,G.jsxs)(`span`,{title:o.via,"data-testid":`service-code-credential`,children:[`Code: `,g(o)]})]})]}),o?.problem&&(0,G.jsx)(`p`,{className:`text-meta text-danger`,"data-testid":`service-code-credential-problem`,children:o.problem.message}),n.syncError&&(0,G.jsx)(`p`,{className:`text-meta text-danger`,children:n.syncError}),s&&o&&(0,G.jsx)(Me,{repo:n,credential:o})]}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,disabled:i.isPending,onClick:()=>i.mutate({id:n.id,serviceId:e.id}),children:`Stop reading it`})]},t.id)})}),t&&(0,G.jsx)(ne,{open:!0,onOpenChange:e=>{n(e),e||r.reset()},title:`Add code`,pending:r.isPending,error:r.error?c(r.error):null,onChoose:t=>r.mutate({serviceId:e.id,source:t},{onSuccess:()=>n(!1)})}),(0,G.jsx)(L,{error:i.error,className:`mt-2`})]})}function Pe({serviceId:e,topology:n,onRemove:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(`upstream`),d=de(),f=t(),{data:p}=ue({limit:100}),m=[...(n?.upstream??[]).map(e=>({edge:e,direction:`upstream`})),...(n?.downstream??[]).map(e=>({edge:e,direction:`downstream`}))],h=new Set(m.map(e=>e.edge.service.id)),g=(p?.data??[]).filter(t=>t.id!==e&&!h.has(t.id));return(0,G.jsxs)(R,{id:`dependencies`,title:`Dependencies`,count:m.length||void 0,actions:!a&&(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>o(!0),"data-testid":`add-dependency`,children:`Add`}),children:[m.length===0&&!a&&(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None recorded.`}),(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:m.map(({edge:t,direction:n})=>(0,G.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,"data-testid":`service-dependency-row`,children:[(0,G.jsxs)(`p`,{className:`min-w-0 flex-1 text-body`,children:[(0,G.jsx)(z,{to:`/services/$id`,params:{id:t.service.id},className:`text-text-1 hover:underline`,children:t.service.name}),` `,(0,G.jsxs)(`span`,{className:`text-meta text-text-3`,"data-testid":`dependency-kind`,children:[B(t.service.type),`, `,n]})]}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,onClick:()=>i(n===`upstream`?{from:e,to:t.service.id}:{from:t.service.id,to:e}),children:`Remove`})]},`${n}-${t.service.id}`))}),a&&(0,G.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,G.jsxs)(I,{value:s,onValueChange:c,children:[(0,G.jsx)(P,{"aria-label":`Service`,"data-testid":`dependency-service`,children:(0,G.jsx)(F,{placeholder:`A service`})}),(0,G.jsx)(N,{children:g.map(e=>(0,G.jsx)(M,{value:e.id,children:e.name},e.id))})]}),(0,G.jsx)(re,{label:`Direction`,value:l,onChange:u,options:[{value:`upstream`,label:`Upstream`},{value:`downstream`,label:`Downstream`}],testId:`dependency-direction`}),(0,G.jsx)(w,{variant:`secondary`,disabled:!s||d.isPending,onClick:()=>{if(!s)return;let[t,n]=l===`upstream`?[e,s]:[s,e];d.mutate({id:t,dependencyId:n},{onSuccess:()=>{o(!1),c(``),f.invalidateQueries({queryKey:r.services.key()})}})},"data-testid":`dependency-save`,children:`Add`}),(0,G.jsx)(w,{variant:`text`,onClick:()=>o(!1),children:`Cancel`})]}),(0,G.jsx)(L,{error:d.error,className:`mt-2`})]})}function Fe(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(V,{className:`h-4 w-32`}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(V,{className:`h-10 w-10 rounded-lg`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(V,{className:`h-8 w-64`}),(0,G.jsx)(V,{className:`h-4 w-32`})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-8`,children:[(0,G.jsx)(V,{className:`h-64 w-48`}),(0,G.jsx)(V,{className:`h-64 flex-1`})]})]})}function Ie({incidents:e,total:t}){let n=ve();return(0,G.jsx)(R,{id:`incidents`,title:`Incidents`,count:t,children:e.length===0?(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None yet.`}):(0,G.jsx)(`ul`,{className:`divide-y divide-hairline`,children:e.slice(0,10).map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5 py-2.5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 size-2 shrink-0 rounded-full`,style:{background:`var(--sev-${e.severity})`}}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(z,{to:`/incidents/$id`,params:{id:e.id},className:`block truncate text-body text-text-1 hover:underline`,children:[(0,G.jsxs)(j,{className:`mr-2 text-text-3`,children:[`INC-`,e.number]}),(0,G.jsx)(`span`,{className:`font-semibold`,children:e.title})]}),(0,G.jsxs)(`p`,{className:`text-meta text-text-2`,children:[s[e.status],`,`,` `,ge(e.triggeredAt,n)]})]})]},e.id))})})}var Y={always:{label:`Start one for every alert`,line:`Every alert on this service starts a run`,short:`Every alert`},critical_and_high:{label:`Start one for every critical and high alert`,line:`Lower alerts wait for you`,short:`Critical and high`},critical_only:{label:`Start one for every critical alert`,line:`Every other alert waits for you`,short:`Critical only`},never:{label:`Start none on their own`,line:`Every alert waits for you to start a run`,short:`None`}};function Le({serviceId:e,metadata:t}){let n=le(),r=t?.investigation??{},i=o.safeParse(r.trigger),s=i.success?i.data:a;return(0,G.jsxs)(R,{id:`investigations`,title:`Runs`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-16 flex-col justify-center gap-2 py-3 sm:flex-row sm:items-center sm:gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:Y[s].label}),(0,G.jsx)(`p`,{className:`text-meta text-text-2`,children:Y[s].line})]}),(0,G.jsxs)(I,{value:s,onValueChange:i=>n.mutate({id:e,metadata:{...t,investigation:{...r,trigger:i}}}),children:[(0,G.jsx)(P,{className:`self-start sm:self-auto`,"aria-label":`Which alerts start a run`,children:(0,G.jsx)(F,{})}),(0,G.jsx)(N,{children:Object.keys(Y).map(e=>(0,G.jsx)(M,{value:e,children:Y[e].short},e))})]})]}),(0,G.jsx)(L,{error:n.error,className:`mt-2`})]})}var Re=[`prometheus`,`alertmanager`,`loki`];function ze(e,t){if(!e)return null;let n=e.kinds.find(e=>e.kind===t);if(!n||n.notConfigured)return{text:`Not set up`};if(n.skipped)return{text:`Choose one`,warn:!0};let r=n.units[0];if(!r)return{text:`Not set up`};let i=r.selection?.rule;return r.from===`env`||i===`env`?{text:`From environment`}:i===`other-tag`&&r.deployment?{text:r.label,sub:`${r.deployment} data`,warn:!0}:i===`tag-match`?{text:r.label}:{text:r.label,sub:`Any deployment`}}function Be({serviceId:e,deployments:t}){let n=[...t,null],i=Se({queries:n.map(t=>r.sources.preRun.queryOptions({input:{serviceId:e,...t?{deployment:t}:{}},staleTime:3e4}))});return(0,G.jsxs)(`div`,{"data-testid":`service-matrix`,children:[(0,G.jsx)(`h3`,{className:`mb-2 text-heading`,children:`By deployment`}),(0,G.jsx)(`div`,{"data-scroll-x":!0,className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{"aria-label":`Connections by deployment`,className:`grid min-w-[560px] gap-1.5`,style:{gridTemplateColumns:`9rem repeat(${n.length}, minmax(7rem, 1fr))`},children:[(0,G.jsx)(`thead`,{className:`contents`,children:(0,G.jsxs)(`tr`,{className:`contents text-meta text-text-2`,children:[(0,G.jsx)(`th`,{children:(0,G.jsx)(`span`,{className:`sr-only`,children:`Kind`})}),n.map(e=>(0,G.jsx)(`th`,{className:`px-1 text-left font-medium`,children:e??`Not named`},e??`-`))]})}),(0,G.jsx)(`tbody`,{className:`contents`,children:Re.map(e=>(0,G.jsxs)(`tr`,{className:`contents`,children:[(0,G.jsxs)(`th`,{className:`flex items-center gap-2 pr-2 text-left font-semibold`,children:[(0,G.jsx)(S,{kind:e,small:!0}),y(e)]}),n.map((t,n)=>{let r=i[n],a=ze(r?.data,e);return(0,G.jsx)(`td`,{className:U(`raised flex min-h-14 flex-col justify-center rounded-pool px-3 py-2`,a?.warn&&`bg-warn/10`),"data-testid":`matrix-cell`,children:r?.isError?(0,G.jsx)(`span`,{className:`text-meta text-text-2`,children:`Did not load`}):a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`block truncate font-semibold`,children:a.text}),a.sub&&(0,G.jsxs)(`span`,{className:U(`flex items-center gap-1 text-meta`,a.warn?`text-warn`:`text-text-2`),children:[a.warn&&(0,G.jsx)(x,{className:`size-3`,"aria-hidden":!0}),a.sub]})]}):(0,G.jsx)(`span`,{className:`text-meta text-text-3`,children:`…`})},t??`-`)})]},e))})]})})]})}var Ve=[`prometheus`,`alertmanager`,`loki`],He=/^\{\s*[A-Za-z_][A-Za-z0-9_]*\s*(=|!=|=~|!~)\s*"[^"]*"\s*(,\s*[A-Za-z_][A-Za-z0-9_]*\s*(=|!=|=~|!~)\s*"[^"]*"\s*)*,?\s*\}$/;function Ue(e){let t=e.trim();return!t||He.test(t)?null:`This is not a list of label matchers. Write it like {app="checkout"}, not a bare metric name like up.`}var X=e=>typeof e==`string`?e:``,Z=e=>e.serviceConfig??{},We=e=>e.hasOverride&&Z(e).enabled!==!1,Ge=e=>X(e.globalConfig?.baseUrl);function Q(e){return[...e.filter(e=>e.hasOverride).sort((e,t)=>(t.priority??0)-(e.priority??0)),...e.filter(e=>!e.hasOverride)]}function Ke(e,t,n){let r=e.flatMap(e=>e.overrideId?[e.overrideId]:[]),i=r.indexOf(t),a=i+n;return i<0||a<0||a>=r.length?null:([r[i],r[a]]=[r[a],r[i]],r)}function qe({serviceId:e,integrations:t}){let n=C(e),r=E(),[i,a]=(0,W.useState)(``),o=Ve.map(e=>{let n=Q(t.filter(t=>t.templateId===e));return{kind:e,rows:n,mapped:n.filter(e=>e.hasOverride)}}).filter(e=>e.rows.length>0),s=(t,n,i)=>{let o=n.overrideId&&Ke(t,n.overrideId,i);o&&r.mutate({serviceId:e,overrideIds:o},{onSuccess:()=>a(`${n.connectionName} moved ${i<0?`up`:`down`}`)})},c=n.data?.deploymentsSeen??[];return(0,G.jsx)(R,{id:`telemetry`,title:`Connections`,children:o.length===0?(0,G.jsx)(`p`,{className:`text-body text-text-2`,children:`None. Add Prometheus, Alertmanager or Loki under Settings, Sources, then map it here.`}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[c.length>1&&(0,G.jsx)(Be,{serviceId:e,deployments:c}),o.map(t=>(0,G.jsxs)(`div`,{"data-testid":`service-kind-${t.kind}`,children:[(0,G.jsxs)(`h3`,{className:`mb-2 flex items-baseline gap-2 text-heading`,children:[y(t.kind),(0,G.jsx)(`span`,{className:`font-normal text-text-3 tabular-nums`,children:t.mapped.length||``})]}),t.mapped.length>1&&(0,G.jsx)(`p`,{className:`-mt-1 mb-2 text-meta text-text-2`,"data-testid":`mapping-order-hint`,children:`Higher rows win.`}),(0,G.jsx)(`ul`,{className:`raised flex flex-col divide-y divide-hairline rounded-pool px-4`,children:t.rows.map(i=>(0,G.jsx)(Ye,{serviceId:e,item:i,preview:n.data,deployments:c,order:t.mapped.length>1&&i.hasOverride?{index:t.mapped.indexOf(i),count:t.mapped.length,pending:r.isPending,onMove:e=>s(t.mapped,i,e)}:void 0},i.connectionId))})]},t.kind)),(0,G.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:i})]})})}function Je(e,t){return t?.kinds.find(t=>t.kind===e.templateId)?.units.find(t=>t.connectionId===e.connectionId)?`Used for every deployment`:`Not used by this service`}function Ye({serviceId:e,item:t,preview:n,deployments:r,order:i}){let a=A(),o=O(),s=D(),[c,l]=(0,W.useState)(!1),u=a.isPending||o.isPending||s.isPending,d=Z(t),f=X(d.deployment),p=X(d.selector),m=We(t),h=(0,W.useId)(),g=(0,W.useId)();return(0,G.jsxs)(`li`,{className:`py-3`,"data-testid":`service-telemetry-row`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(S,{kind:t.templateId}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[t.hasOverride&&t.overrideId?(0,G.jsx)(`label`,{htmlFor:g,className:`block text-heading`,children:t.connectionName}):(0,G.jsx)(`p`,{className:`text-heading`,children:t.connectionName}),(0,G.jsx)(`p`,{className:`truncate font-mono text-mono text-text-2`,children:b(Ge(t))}),t.hasOverride?(0,G.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:U(`inline-flex h-[22px] items-center gap-1.5 rounded-control px-2 text-meta`,f?`bg-surface-3 text-text-1`:`text-text-2 outline-1 -outline-offset-1 outline-text-3/60`),"data-testid":`mapping-deployment`,children:[(0,G.jsx)(xe,{className:`size-[13px] text-text-2`,"aria-hidden":!0}),f||`Any deployment`]}),p&&(0,G.jsx)(`code`,{className:`inline-flex h-[22px] items-center rounded-control bg-surface-3 px-2 font-mono text-mono`,children:p})]}):(0,G.jsx)(`p`,{className:`text-meta text-text-2`,children:Je(t,n)})]}),t.hasOverride&&t.overrideId?(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 max-md:gap-4.5 pointer-coarse:gap-4.5`,children:[(0,G.jsx)(be,{id:g,checked:m,disabled:u,onCheckedChange:e=>t.overrideId&&o.mutate({id:t.overrideId,config:{...d,enabled:e}}),"aria-label":`Use ${t.connectionName} for this service`,"data-testid":`mapping-switch`}),(0,G.jsx)(w,{variant:`text`,size:`icon`,"aria-expanded":c,"aria-controls":h,"aria-label":`Edit the mapping of ${t.connectionName}`,onClick:()=>l(!c),children:(0,G.jsx)(T,{className:U(`size-4 transition-transform duration-(--dur-fast)`,c&&`rotate-180`)})})]}):(0,G.jsx)(w,{variant:`secondary`,size:`sm`,disabled:u,onClick:()=>a.mutate({serviceId:e,connectionId:t.connectionId,config:{}}),"data-testid":`mapping-add`,children:`Add`})]}),c&&t.overrideId&&(0,G.jsxs)(`div`,{id:h,className:`mt-3 flex flex-col gap-3 pl-11`,children:[i&&(0,G.jsx)(Xe,{name:t.connectionName,order:i}),(0,G.jsx)(Ze,{item:t,deployments:r,pending:u,onSave:e=>t.overrideId&&o.mutate({id:t.overrideId,config:e},{onSuccess:()=>l(!1)}),onRemove:()=>t.overrideId&&s.mutate({id:t.overrideId})})]})]})}function Xe({name:e,order:t}){let{index:n,count:r,pending:i,onMove:a}=t;return(0,G.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`mapping-order`,children:[(0,G.jsxs)(`legend`,{className:`sr-only`,children:[`Order of `,e]}),(0,G.jsxs)(w,{type:`button`,variant:`secondary`,size:`sm`,disabled:i||n===0,onClick:()=>a(-1),"data-testid":`mapping-move-up`,children:[(0,G.jsx)(ye,{"aria-hidden":!0}),`Move up`]}),(0,G.jsxs)(w,{type:`button`,variant:`secondary`,size:`sm`,disabled:i||n===r-1,onClick:()=>a(1),"data-testid":`mapping-move-down`,children:[(0,G.jsx)(v,{"aria-hidden":!0}),`Move down`]})]})}function Ze({item:e,deployments:t,pending:n,onSave:r,onRemove:i}){let a=Z(e),[o,s]=(0,W.useState)(X(a.deployment)),[c,u]=(0,W.useState)(X(a.selector)),[d,f]=(0,W.useState)(X(a[l])),[p,m]=(0,W.useState)(!1),h={d:(0,W.useId)(),s:(0,W.useId)(),m:(0,W.useId)(),list:(0,W.useId)()},g=Ue(c),v=o.trim().length>64?`Use 64 characters or fewer.`:null;return(0,G.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{if(e.preventDefault(),m(!0),g||v)return;let{deployment:t,selector:n,[l]:i,...s}=a;r({...s,...o.trim()?{deployment:o.trim()}:{},...c.trim()?{selector:c.trim()}:{},...d.trim()?{[l]:d.trim()}:{}})},"data-testid":`mapping-editor`,children:[(0,G.jsx)(_,{label:`Deployment tag`,htmlFor:h.d,hint:t.length?`Leave empty to match any deployment. Seen lately: ${t.join(`, `)}.`:`Leave empty to match any deployment.`,error:p&&v,children:(0,G.jsx)(H,{id:h.d,value:o,onChange:e=>s(e.target.value),list:h.list,placeholder:`prod-eu`})}),(0,G.jsx)(`datalist`,{id:h.list,children:t.map(e=>(0,G.jsx)(`option`,{value:e},e))}),(0,G.jsx)(_,{label:e.templateId===`alertmanager`?`Selector (filter matchers)`:`Selector`,htmlFor:h.s,hint:`Label matchers only, like {app="checkout"}.`,error:p&&g,children:(0,G.jsx)(H,{id:h.s,value:c,onChange:e=>u(e.target.value),className:`font-mono`,spellCheck:!1,placeholder:`{app="checkout"}`,"data-testid":`mapping-selector`})}),e.templateId===`prometheus`&&(0,G.jsx)(_,{label:`Impact metric`,htmlFor:h.m,hint:`A PromQL query for this service. An incident's Impact chart shows it, labelled as the service's metric, when the alert's own query is not known.`,children:(0,G.jsx)(H,{id:h.m,value:d,onChange:e=>f(e.target.value),className:`font-mono`,spellCheck:!1,"data-testid":`service-metric-input`})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(w,{type:`submit`,variant:`primary`,size:`sm`,disabled:n,children:`Save`}),(0,G.jsx)(w,{type:`button`,variant:`danger`,size:`sm`,className:`ml-auto`,disabled:n,onClick:i,children:`Remove from this service`})]})]})}var Qe=`From global settings`;function $e({serviceId:e}){let a=t(),o=n(r.runWorkspaces.getService.queryOptions({input:{serviceId:e}})),s=n(r.runWorkspaces.get.queryOptions()),[c,l]=(0,W.useState)(null),u=o.data?.override;(0,W.useEffect)(()=>{u&&l(u)},[u]);let d=i({...r.runWorkspaces.updateService.mutationOptions(),onSuccess:t=>a.setQueryData(r.runWorkspaces.getService.queryKey({input:{serviceId:e}}),t)});if(!o.data||!s.data||!c)return null;let{canEdit:f}=o.data,p=s.data.settings,m=s.data.defaultLocation,h={...p,...c},g=JSON.stringify(c)!==JSON.stringify(u),_=e=>c[e]!==void 0,v=e=>{let t={...c};_(e)?delete t[e]:t[e]=p[e],l(t)};return(0,G.jsxs)(R,{id:`workspace`,title:`Workspace`,children:[(0,G.jsx)(`p`,{className:`py-2 text-meta text-text-2`,children:`Where this service's runs check out its code, and what happens to it afterwards.`}),Te.map(({key:e,label:t})=>(0,G.jsx)(Ee,{testId:`service-workspace-${e}`,label:t,meta:_(e)?void 0:`${Qe} · ${Ce(e,p,m)}`,trailing:f&&(0,G.jsx)(w,{size:`sm`,variant:`text`,onClick:()=>v(e),children:_(e)?`Use global`:`Set for this service`}),below:_(e)&&(0,G.jsx)(we,{field:e,value:h,defaultLocation:m,onChange:(e,t)=>l({...c,[e]:t}),disabled:!f})},e)),f&&g&&(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,G.jsx)(w,{size:`sm`,disabled:d.isPending,onClick:()=>d.mutate({serviceId:e,override:c}),"data-testid":`service-workspace-save`,children:`Save`}),(0,G.jsx)(w,{size:`sm`,variant:`text`,disabled:d.isPending,onClick:()=>l(u??{}),children:`Discard`})]}),(0,G.jsx)(L,{error:d.error,className:`mt-2`})]})}var $=e=>e.startsWith(`/services/`),et=864e5;function tt(){let{id:i}=_e.useParams(),a=u(),o=De($,`/services`),[s,c]=(0,W.useState)(!1),[l,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),{data:g,isLoading:_,error:v,refetch:y}=n(r.services.get.queryOptions({input:{id:i}})),{data:b,status:x,refetch:S}=n({...r.services.getTopology.queryOptions({input:{id:i}}),enabled:!!g}),{data:C=[]}=ee(i),{data:T}=n(r.incidents.list.queryOptions({input:{serviceId:i,limit:100}})),E=ce(),D=t();if(ke(g?`${g.name}, Services`:`Services`),(0,W.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target;t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable||document.querySelector(`[role=dialog], [role=alertdialog], [role=menu]`)||o()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]),_)return(0,G.jsx)(Fe,{});if(v||!g){let e=(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:o,children:`Back to the services`}),t=!v||v.status===404;return(0,G.jsx)(`div`,{className:`p-6`,children:t?(0,G.jsx)(he,{text:`This service is not here. It may have been deleted.`,back:e}):(0,G.jsx)(me,{text:`This service did not load.`,onRetry:()=>void y(),back:e})})}let O=T?.data??[],A=O.filter(t=>e(t.status)).length,j=O.filter(e=>Date.now()-new Date(e.triggeredAt).getTime()<30*et).length,M=Oe($,`/services`);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-canvas`,"data-testid":`service-page`,children:[(0,G.jsxs)(`header`,{className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 px-3 md:px-4`,"data-testid":`service-band`,"data-title-row":!0,children:[(0,G.jsx)(w,{variant:`text`,size:`icon`,className:`shrink-0`,asChild:!0,children:(0,G.jsx)(`a`,{href:M,onClick:e=>{e.preventDefault(),o()},"aria-label":M===`/services`?`Back to the services`:`Back`,"data-testid":`service-back`,children:(0,G.jsx)(d,{className:`size-4`})})}),(0,G.jsx)(`h1`,{className:`min-w-0 truncate text-title`,children:g.name}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2.5 text-meta`,"data-testid":`service-meta`,children:[(0,G.jsx)(`span`,{className:`text-text-2`,children:B(g.type)}),(0,G.jsx)(k,{label:ae(g.tier),children:(0,G.jsx)(`span`,{className:`text-text-3`,children:ie(g.tier)})}),g.team&&(0,G.jsx)(`span`,{className:`truncate text-text-3 max-sm:hidden`,children:g.team})]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(w,{variant:`text`,size:`sm`,onClick:()=>c(!0),"data-testid":`service-edit`,children:`Edit`}),(0,G.jsx)(w,{variant:`danger`,size:`sm`,onClick:()=>f(!0),"data-testid":`service-delete`,children:`Delete`})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-[52rem] px-4 pt-3 pb-12`,children:[g.description&&(0,G.jsx)(`p`,{className:`text-body text-text-1`,children:g.description}),(0,G.jsxs)(`p`,{className:`mt-1 text-meta text-text-2 tabular-nums`,"data-testid":`service-summary`,children:[A===1?`1 incident open`:`${A} incidents open`,`,`,` `,j,` in 30 days.`]}),(0,G.jsxs)(`div`,{className:`mt-8`,children:[(0,G.jsx)(Ne,{service:g}),(0,G.jsx)(qe,{serviceId:i,integrations:C}),(0,G.jsx)(Pe,{serviceId:i,topology:b,onRemove:m}),(0,G.jsx)(Le,{serviceId:i,metadata:g.metadata}),(0,G.jsx)($e,{serviceId:i}),(0,G.jsx)(Ie,{incidents:O,total:T?.pagination.total??O.length})]})]})}),(0,G.jsx)(te,{open:s,onOpenChange:c,service:g}),(0,G.jsx)(je,{open:l,onOpenChange:f,serviceId:g.id,serviceName:g.displayName||g.name,upstream:(b?.upstream??[]).map(e=>e.service.displayName||e.service.name),downstream:(b?.downstream??[]).map(e=>e.service.displayName||e.service.name),links:x,onRetryLinks:()=>void S(),onSuccess:()=>a({to:`/services`})}),(0,G.jsx)(h,{open:!!p,onOpenChange:e=>!e&&m(null),title:`Remove this dependency?`,description:(0,G.jsx)(`p`,{children:`The edge between the two services goes; both services stay.`}),confirmLabel:`Remove`,onConfirm:()=>p&&E.mutateAsync({id:p.from,dependencyId:p.to}).then(()=>D.invalidateQueries({queryKey:r.services.key()})),isPending:E.isPending})]})}export{tt as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Xt as e,a as t,c as n,gt as r,r as i,ut as a}from"./desktop-
|
|
1
|
+
import{Xt as e,a as t,c as n,gt as r,r as i,ut as a}from"./desktop-yb-lqHMd.js";import{t as o}from"./link-BHh9_evg.js";import{t as s}from"./chevron-left-S6eOHk4C.js";import{Nt as c,g as l,jt as u}from"./index-BoI68UdU.js";import{a as d,n as f,t as p}from"./jsx-runtime-Wy9s6hX0.js";import{t as m}from"./TickDot-m_aEzdkj.js";import{a as h,i as g,n as _,r as v}from"./State-CCKzehkH.js";import{t as y}from"./NewThread-CAT5otyD.js";import{t as b}from"./button-DmIfWVZ8.js";import{t as x}from"./input-CXxt1dAV.js";import{r as S}from"./use-operator-BdSmIxpm.js";import{t as C}from"./use-page-title-DEIRQICr.js";import{i as w,o as T,p as E,t as D,u as O}from"./use-repositories-orpc-Ban_zGD7.js";import{o as k}from"./use-threads-orpc-mbpsuq3G.js";import{r as A}from"./AddProjectDialog-p3LLsE1B.js";import{t as j}from"./ProjectList-DAPGOIoj.js";var M={name:`git-branch-plus`,size:24,node:[[`path`,{d:`M6 3v12`,key:`qpgusn`}],[`path`,{d:`M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,key:`1d02ji`}],[`path`,{d:`M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,key:`chk6ph`}],[`path`,{d:`M15 6a9 9 0 0 0-9 9`,key:`or332x`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]};M.node;var N=t(M),P=d(f()),F=p(),I={pending:`live`,running:`live`,completed:`ok`,failed:`bad`,cancelled:`muted`};function L({id:e}){let t=T(e),n=k({repositoryId:e});C(t.data?`${t.data.fullName}, Projects`:`Projects`);let r=(0,F.jsx)(b,{variant:`text`,size:`sm`,asChild:!0,children:(0,F.jsx)(o,{to:`/projects`,children:`Back to projects`})});if(t.isLoading)return(0,F.jsx)(v,{});if(t.error||!t.data)return!t.error||t.error.status===404?(0,F.jsx)(g,{text:`No project here.`,back:r}):(0,F.jsx)(h,{text:i(t.error),onRetry:()=>void t.refetch(),back:r});let c=t.data,l=a(c),u=A[l],d=c.services??[],f=n.data?.data??[];return(0,F.jsxs)(`div`,{className:`flex h-full flex-col bg-canvas`,"data-testid":`project-page`,children:[(0,F.jsxs)(`header`,{"data-title-row":!0,className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 py-1.5 pr-3 pl-2`,children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon-lg`,"aria-label":`Back to projects`,asChild:!0,children:(0,F.jsx)(o,{to:`/projects`,children:(0,F.jsx)(s,{})})}),(0,F.jsx)(u,{className:`size-4 shrink-0 text-text-3`,"aria-hidden":!0}),(0,F.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-title`,"data-testid":`project-name`,children:c.fullName})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-6`,children:(0,F.jsxs)(`div`,{className:`mx-auto grid max-w-(--reading-w) gap-5 pt-4`,children:[(0,F.jsxs)(`section`,{"aria-label":`Code`,className:`grid gap-1 rounded-pool bg-surface-2 px-3.5 py-3 text-body`,"data-testid":`project-code`,children:[(0,F.jsx)(`span`,{className:`truncate text-text-1`,children:c.subPath?`${c.url}/${c.subPath}`:c.url}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-meta text-text-3`,children:[(0,F.jsx)(j,{kind:l,className:`flex items-center gap-1.5`}),c.syncError?c.syncError:[c.syncBranch,c.syncHead?.slice(0,7)].filter(Boolean).join(` `)]}),l===`folder`&&(0,F.jsx)(R,{id:e})]}),(0,F.jsx)(y,{subject:{kind:`project`,repositoryId:e},branch:l===`folder`?null:c.syncBranch??c.defaultBranch}),(0,F.jsxs)(`section`,{"aria-label":`Threads`,"data-testid":`project-threads`,children:[(0,F.jsx)(`h2`,{className:`mb-1.5 ml-1 text-heading text-text-2`,children:`Threads`}),n.isLoading?(0,F.jsx)(v,{rows:2}):n.error?(0,F.jsx)(h,{text:i(n.error),onRetry:()=>void n.refetch()}):f.length===0?(0,F.jsx)(_,{text:`No threads yet`}):(0,F.jsx)(`ul`,{className:`grid gap-1`,children:f.map(e=>(0,F.jsx)(z,{thread:e},e.id))})]}),l===`folder`?(0,F.jsx)(`p`,{className:`ml-1 text-meta text-text-3`,"data-testid":`make-service-needs-git`,children:`Services need git`}):(0,F.jsx)(B,{repositoryId:e,defaultName:c.fullName,linked:d.map(e=>e.serviceId)})]})})]})}function R({id:t}){let{managesPairing:a}=S(),o=e(),s=r({...n.repositories.startGit.mutationOptions(),onSuccess:()=>{o.invalidateQueries({queryKey:D.detail(t)}),o.invalidateQueries({queryKey:D.lists()})}});return a?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,F.jsxs)(b,{size:`sm`,variant:`secondary`,disabled:s.isPending,onClick:()=>s.mutate({id:t}),"data-testid":`project-start-git`,children:[(0,F.jsx)(N,{}),`Start git here`]}),s.error&&(0,F.jsx)(`span`,{className:`text-meta text-danger`,role:`alert`,"data-testid":`project-start-git-error`,children:i(s.error)})]}):null}function z({thread:e}){return(0,F.jsx)(`li`,{children:(0,F.jsxs)(o,{to:`/threads/$id`,params:{id:e.id},className:`flex h-10 items-center gap-2 rounded-control px-2 text-body text-text-1 hover:bg-surface-2`,"data-testid":`project-thread-row`,children:[(0,F.jsx)(c,{className:`size-4 shrink-0 text-text-3`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title??`Thread`}),(0,F.jsx)(m,{tone:I[e.status]})]})})}function B({repositoryId:e,defaultName:t,linked:n}){let r=O(),a=w(),s=E(n[0]??``),[c,l]=(0,P.useState)(t),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(null),h=n[0];if(h){let e=s.data?.name;return(0,F.jsxs)(`section`,{"aria-label":`Service`,className:`grid gap-1`,"data-testid":`project-service`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-body text-text-2`,children:[(0,F.jsx)(u,{className:`size-4 shrink-0 text-text-3`,"aria-hidden":!0}),(0,F.jsx)(o,{to:`/services/$id`,params:{id:h},className:`text-text-1 hover:underline`,children:`Open service`})]}),e&&(0,F.jsxs)(`p`,{className:`ml-6 font-mono text-meta text-text-3`,"data-testid":`project-service-rule`,children:[`service=`,e]})]})}let g=async t=>{t.preventDefault();let n=c.trim();if(n){f(null);try{let t=p;t||(t=(await r.mutateAsync({name:n})).id,m(t)),await a.mutateAsync({id:e,serviceId:t})}catch(e){f(i(e))}}};return(0,F.jsxs)(`section`,{"aria-label":`Make it a service`,className:`grid gap-2`,"data-testid":`make-service`,children:[(0,F.jsx)(`h2`,{className:`ml-1 text-heading text-text-2`,children:`Make it a service`}),(0,F.jsxs)(`form`,{onSubmit:e=>void g(e),className:`flex gap-2`,children:[(0,F.jsx)(x,{value:c,onChange:e=>l(e.target.value),readOnly:r.isPending||!!p,"aria-label":`Service name`,"data-testid":`make-service-name`}),(0,F.jsx)(b,{type:`submit`,variant:`secondary`,disabled:!c.trim()||r.isPending||a.isPending,"data-testid":`make-service-submit`,children:`Make service`})]}),(0,F.jsxs)(`p`,{className:`ml-1 font-mono text-meta text-text-3`,children:[`service=`,c.trim()||t]}),d&&(0,F.jsx)(`p`,{className:`ml-1 text-meta text-danger`,role:`alert`,children:d})]})}var V=function(){let{id:e}=l.useParams();return(0,F.jsx)(L,{id:e},e)};export{V as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as e,a as t,r as n,s as r}from"./desktop-
|
|
1
|
+
import{W as e,a as t,r as n,s as r}from"./desktop-yb-lqHMd.js";import{t as i}from"./link-BHh9_evg.js";import{n as a}from"./useNavigate-I5E4IRt2.js";import{t as o}from"./chevron-left-S6eOHk4C.js";import{t as s}from"./copy-_5FNPl7W.js";import{E as c,lt as l,ut as u}from"./source-words-CCeTLwOy.js";import{Mt as d,h as f}from"./index-BoI68UdU.js";import{t as ee}from"./ellipsis-BsNLvnl9.js";import{t as p}from"./pencil-CKAiE_29.js";import{a as m}from"./Composer-DIYA4JDp.js";import{a as h,n as g,t as _}from"./jsx-runtime-Wy9s6hX0.js";import{n as v,r as y,t as b}from"./tick-copy-DPjahm-5.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./ScheduleDialog-DKRvxEa7.js";import{t as O}from"./TickDot-m_aEzdkj.js";import{a as k,i as A,r as j}from"./State-CCKzehkH.js";import{t as M}from"./button-DmIfWVZ8.js";import{d as N,n as te,r as P,t as ne}from"./dropdown-menu-yoILSLgJ.js";import{t as F}from"./use-page-title-DEIRQICr.js";import{n as I}from"./CopyButton-DKP5JHET.js";import{Z as L}from"./Hint-Od6cnmvm.js";import{t as R}from"./utils-A3okWeke.js";var z={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};z.node;var B=t(z),V=h(g());function H(e,t){let[n,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1);return{ticks:n,cursor:a===``?null:a,loading:s,more:async n=>{if(n){c(!0);try{let t=await r.schedules.get({id:e,cursor:n,limit:30});i(e=>[...e,...t.ticks]),o(t.nextCursor??``)}catch(e){t(e)}finally{c(!1)}}},done:a===``}}var U=_();function W(){let{id:e}=f.useParams(),{data:t,isLoading:r,error:d,refetch:h}=E(e),g=a(),{toast:_}=I(),v=w(),b=x(),[C,T]=(0,V.useState)(!1),[O,L]=(0,V.useState)(!1),[R,z]=(0,V.useState)(!1),W=H(e,e=>_({title:`Could not load older runs`,description:n(e),variant:`destructive`}));if(F(t?.schedule.name??`Schedule`),r)return(0,U.jsx)(j,{});if(d&&!t)return d.code===`NOT_FOUND`?(0,U.jsx)(A,{text:`This schedule no longer exists.`,back:(0,U.jsx)(i,{to:`/automation`,children:`Automation`})}):(0,U.jsx)(k,{text:n(d),onRetry:()=>void h()});if(!t)return null;let{schedule:Y,ticks:X,canEdit:Z,hostName:re}=t,Q=X[0],$=()=>v.mutate({id:Y.id},{onError:e=>_({title:`Not started`,description:n(e),variant:`destructive`})});return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(`header`,{"data-title-row":!0,className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 py-1.5 pr-3 pl-2`,children:[(0,U.jsx)(M,{variant:`ghost`,size:`icon-lg`,"aria-label":`Back to Schedules`,asChild:!0,children:(0,U.jsx)(i,{to:`/schedules`,children:(0,U.jsx)(o,{})})}),(0,U.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-title`,children:Y.name}),Z?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(M,{variant:`secondary`,onClick:$,disabled:v.isPending||!!Y.liveRunId,children:[(0,U.jsx)(m,{}),(0,U.jsx)(`span`,{className:`max-sm:sr-only`,children:`Run now`})]}),(0,U.jsxs)(M,{variant:`secondary`,onClick:()=>T(!0),children:[(0,U.jsx)(p,{}),(0,U.jsx)(`span`,{className:`max-sm:sr-only`,children:`Edit`})]}),(0,U.jsxs)(ne,{children:[(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(M,{variant:`ghost`,size:`icon-lg`,"aria-label":`More`,children:(0,U.jsx)(ee,{})})}),(0,U.jsxs)(te,{align:`end`,children:[(0,U.jsxs)(P,{onSelect:()=>L(!0),children:[(0,U.jsx)(s,{}),`Duplicate`]}),(0,U.jsxs)(P,{className:`text-danger`,onSelect:()=>z(!0),children:[(0,U.jsx)(B,{}),`Delete schedule`]})]})]})]}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-meta text-text-3`,children:[(0,U.jsx)(u,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`max-sm:sr-only`,children:`View only`})]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-6 @container`,children:(0,U.jsxs)(`div`,{className:`mx-auto grid max-w-(--reading-w) gap-5 pt-1`,children:[!Z&&(0,U.jsx)(y,{hostName:re}),!Y.enabled&&Y.pausedReason&&(0,U.jsx)(G,{tone:`warn`,icon:(0,U.jsx)(l,{}),children:Y.pausedReason}),Q&&(0,U.jsx)(K,{tick:Q,schedule:Y,canEdit:Z,onRun:$}),(0,U.jsx)(q,{schedule:Y}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-1.5 ml-1 text-heading text-text-2`,children:`Runs`}),X.length===0?(0,U.jsxs)(`p`,{className:`px-1 text-body text-text-3`,children:[`No runs yet. The first is`,` `,S(Y.nextRunAt)||`when you resume it`,`.`]}):(0,U.jsx)(`div`,{className:`grid gap-px overflow-hidden rounded-pool bg-surface-1`,"data-testid":`schedule-ticks`,children:[...X,...W.ticks].map(e=>(0,U.jsx)(J,{tick:e},e.id))}),!W.done&&(W.cursor??t.nextCursor)&&(0,U.jsx)(M,{variant:`ghost`,className:`mt-2`,disabled:W.loading,onClick:()=>W.more(W.cursor??t.nextCursor),children:`Show older runs`})]})]})}),Z&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(D,{open:C,onOpenChange:T,editing:Y,canSetHostZone:!0}),(0,U.jsx)(D,{open:O,onOpenChange:L,copyOf:Y,canSetHostZone:!0}),(0,U.jsx)(c,{open:R,onOpenChange:z,title:`Delete ${Y.name}?`,description:`Its runs stay where they are. Nothing runs on this schedule again.`,confirmLabel:`Delete schedule`,onConfirm:()=>b.mutate({id:Y.id},{onSuccess:()=>g({to:`/schedules`})})})]})]})}function G({tone:e,icon:t,children:n}){return(0,U.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2.5 rounded-pool bg-surface-2 px-3.5 py-3 text-body text-text-1`,children:[(0,U.jsx)(`span`,{className:R(`mt-0.5 shrink-0 [&_svg]:size-4`,e===`bad`?`text-danger`:`text-warn`),children:t}),(0,U.jsx)(`div`,{className:`min-w-0`,children:n})]})}function K({tick:e,schedule:t,canEdit:n,onRun:r}){return e.run?.status===`failed`?(0,U.jsxs)(G,{tone:`bad`,icon:(0,U.jsx)(l,{}),children:[(0,U.jsx)(`strong`,{children:`The last run failed.`}),` `,e.run.error??`The run stopped.`,` `,t.enabled&&t.nextRunAt?`The next run is still due ${S(t.nextRunAt)}.`:``,(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,U.jsx)(M,{variant:`secondary`,asChild:!0,children:(0,U.jsx)(i,{to:`/investigations/$id`,params:{id:e.run.id},children:`Open the run`})}),n&&(0,U.jsxs)(M,{variant:`ghost`,onClick:r,children:[(0,U.jsx)(m,{}),`Run now`]})]})]}):e.outcome===`late_started`&&e.reason===`asleep`?(0,U.jsxs)(G,{tone:`warn`,icon:(0,U.jsx)(d,{}),children:[`This computer was asleep at `,C(e.scheduledFor),`. PrismaLens ran the check once when it woke, at `,C(e.decidedAt),`.`]}):null}function q({schedule:t}){let n=[[`Runs`,b(t),t.runbook?`Runbook ${t.runbook}`:``],[`When`,L(t),t.enabled?`Next ${S(t.nextRunAt)}`:`Paused`],[`Agent`,[t.harness,t.model].filter(Boolean).join(`, `),`${e[t.accessLevel??`auto`]} access`],[`If missed`,t.missedPolicy===`run_once`?`Run once when back`:`Skip it`,t.missedPolicy===`run_once`?`Within ${t.catchUpMinutes/60} hours`:``]];return(0,U.jsx)(`dl`,{className:`grid grid-cols-1 gap-0.5 overflow-hidden rounded-pool bg-surface-2 @lg:grid-cols-2 @3xl:grid-cols-4`,children:n.map(([e,t,n])=>(0,U.jsxs)(`div`,{className:`px-3.5 py-3`,children:[(0,U.jsx)(`dt`,{className:`text-meta text-text-3`,children:e}),(0,U.jsx)(`dd`,{className:`text-heading`,children:t}),n&&(0,U.jsx)(`dd`,{className:`text-meta text-text-3`,children:n})]},e))})}function J({tick:e}){let t=v(e,C);return(0,U.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3 gap-y-0.5 bg-surface-2 px-3.5 py-3 @3xl:grid-cols-[150px_minmax(0,1fr)_80px_110px]`,"data-testid":`schedule-tick`,children:[(0,U.jsx)(`span`,{className:`text-meta text-text-2`,children:S(e.scheduledFor)}),(0,U.jsxs)(`span`,{className:`col-start-1 flex min-w-0 items-baseline gap-2 text-body @3xl:col-start-auto`,children:[(0,U.jsx)(O,{tone:t.tone}),(0,U.jsx)(`span`,{className:R(t.tone===`bad`&&`text-danger`,t.tone===`muted`&&`text-text-2`),children:t.text})]}),(0,U.jsx)(`span`,{className:`hidden text-meta text-text-3 @3xl:block`,children:T(e.run?.startedAt??null,e.run?.completedAt??null)}),(0,U.jsx)(`span`,{className:`col-start-2 row-span-2 row-start-1 @3xl:col-start-auto @3xl:row-span-1 @3xl:row-start-auto`,children:t.link&&(t.link.kind===`incident`?(0,U.jsx)(i,{to:`/incidents/$id`,params:{id:t.link.id},className:`inline-flex min-h-8 items-center font-medium text-accent max-sm:min-h-11`,children:t.link.label}):(0,U.jsx)(i,{to:`/investigations/$id`,params:{id:t.link.id},className:`inline-flex min-h-8 items-center font-medium text-accent max-sm:min-h-11`,children:t.link.label}))})]})}export{W as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_t as e,c as t,r as n}from"./desktop-
|
|
1
|
+
import{_t as e,c as t,r as n}from"./desktop-yb-lqHMd.js";import{t as r}from"./link-BHh9_evg.js";import{t as i}from"./chevron-left-S6eOHk4C.js";import{lt as a,z as o}from"./source-words-CCeTLwOy.js";import{a as s,n as c,t as l}from"./jsx-runtime-Wy9s6hX0.js";import{t as u}from"./Transcript-Csly_ODF.js";import{n as d}from"./HypothesesCard-BcaBcZ8b.js";import{t as f}from"./TriggerCard-B4_zrVDz.js";import{t as p}from"./TickDot-m_aEzdkj.js";import{a as m,i as h,r as g}from"./State-CCKzehkH.js";import{t as _}from"./button-DmIfWVZ8.js";import{t as v}from"./use-page-title-DEIRQICr.js";import{r as y}from"./useInvestigationRun-BJKQxOF2.js";import{t as b}from"./index-BoI68UdU.js";var x=s(c()),S=l(),C={pending:[`live`,`Waiting to start`],running:[`live`,`Running`],completed:[`ok`,`Finished`],failed:[`bad`,`Failed`],cancelled:[`muted`,`Stopped`]};function w(){let{id:s,runId:c}=b.useParams(),{data:l,isLoading:w,error:T,refetch:E}=e(t.investigations.get.queryOptions({input:{id:c}}));v(l?.title??`Scheduled run`);let D=l?.status===`pending`||l?.status===`running`,O=y(c,{pollMs:D?3e3:!1}),k=(0,x.useRef)(!1),{catchUp:A}=O;(0,x.useEffect)(()=>{D?k.current=!0:k.current&&(k.current=!1,A())},[D,A]);let j=(0,x.useMemo)(()=>o(O.data??[]),[O.data]),M=(0,S.jsx)(_,{variant:`text`,size:`sm`,asChild:!0,children:(0,S.jsx)(r,{to:`/schedules/$id`,params:{id:s},children:`Back to the schedule`})});if(w)return(0,S.jsx)(g,{});if(T)return(0,S.jsx)(m,{text:n(T),onRetry:()=>void E(),back:M});if(!l)return(0,S.jsx)(h,{text:`No run has this address.`,back:M});let[N,P]=C[l.status];return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,S.jsxs)(`header`,{"data-title-row":!0,className:`flex min-h-(--header-h) shrink-0 items-center gap-2 bg-surface-1 py-1.5 pr-3 pl-2`,children:[(0,S.jsx)(_,{variant:`ghost`,size:`icon-lg`,"aria-label":`Back to the schedule`,asChild:!0,children:(0,S.jsx)(r,{to:`/schedules/$id`,params:{id:s},children:(0,S.jsx)(i,{})})}),(0,S.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-title`,children:l.title??`Scheduled run`}),(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body text-text-2`,children:[(0,S.jsx)(p,{tone:N}),P]})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-6`,children:(0,S.jsxs)(`div`,{className:`mx-auto grid max-w-(--reading-w) gap-5 pt-1`,children:[l.status===`failed`&&(0,S.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2.5 rounded-pool bg-surface-2 px-3.5 py-3 text-body`,children:[(0,S.jsx)(a,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,S.jsx)(`span`,{children:l.error??`The run stopped.`})]}),l.summary&&(0,S.jsxs)(`section`,{className:`rounded-pool bg-surface-2 px-3.5 py-3`,children:[(0,S.jsx)(`h2`,{className:`text-heading`,children:`What it found`}),(0,S.jsx)(`p`,{className:`mt-1 text-body text-text-2`,children:l.summary}),l.rootCause&&(0,S.jsx)(`p`,{className:`mt-2 text-body`,children:l.rootCause})]}),l.report&&(0,S.jsx)(`ul`,{className:`m-0 list-none p-0`,children:(0,S.jsx)(d,{report:l.report,at:l.completedAt,targetOf:()=>null,onOpenFile:()=>{},onJump:()=>{}})}),(0,S.jsx)(f,{scheduleId:s,ranAt:l.startedAt??l.createdAt}),(0,S.jsxs)(`section`,{"aria-label":`Transcript`,children:[(0,S.jsx)(`h2`,{className:`mb-1.5 ml-1 text-heading text-text-2`,children:`What the agent did`}),j.length?(0,S.jsx)(u,{items:j,incidentId:l.incidentId,cwd:l.workspace?.cwd,agent:[l.harness,l.model].filter(Boolean).join(`, `),runName:l.title??`Scheduled run`,briefBy:`PrismaLens`}):(0,S.jsx)(`p`,{className:`px-1 text-body text-text-3`,children:D?`Starting the agent.`:`This run recorded no steps.`})]})]})})]})}export{w as component};
|
package/node_modules/@prismalens/api/public/assets/{alerts-BI1l8Cxn.js → alerts-DkmUI_TY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,K as t,N as n,Q as r,_t as i,c as a,dt as o,ht as s,i as c}from"./desktop-
|
|
1
|
+
import{$ as e,K as t,N as n,Q as r,_t as i,c as a,dt as o,ht as s,i as c}from"./desktop-yb-lqHMd.js";import{t as l}from"./link-BHh9_evg.js";import{n as u}from"./useNavigate-I5E4IRt2.js";import{kt as d,rt as f}from"./index-BoI68UdU.js";import{a as p,n as m,t as h}from"./jsx-runtime-Wy9s6hX0.js";import{t as g}from"./button-DmIfWVZ8.js";import{i as _,n as v,o as y,s as b,t as x}from"./select-hkRu0Dxf.js";import{c as S,i as C,n as w,o as T,s as E,t as D}from"./state-tone-DOGSNxJV.js";import{t as O}from"./AlertsBlank-CVPQuVxb.js";import{t as k}from"./WebhookCopy-Cy9bof9B.js";import{t as A}from"./Hint-Od6cnmvm.js";import{a as j,n as M,r as N}from"./State-CCKzehkH.js";import{t as P}from"./PageHeader-CL1AN9BA.js";import{t as F}from"./HelperThread-DNWceguA.js";import{i as I,n as L,r as R,t as z}from"./dist-CtE2KbbF.js";import{t as B}from"./use-sliding-mark-Bprqapa0.js";import{t as V}from"./utils-A3okWeke.js";import{t as H}from"./use-page-title-DEIRQICr.js";import{r as U}from"./live-refresh-DlFUKDgl.js";var W=p(m()),G=h(),K=[{value:`all`,label:`All Statuses`},...e(o,t)],q=[{value:`all`,label:`All Severities`},...e(s,r)];function J({status:e,severity:t,onStatusChange:n,onSeverityChange:r,onClear:i}){let a=e!==`all`||t!==`all`;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(x,{value:e,onValueChange:e=>n(e),children:[(0,G.jsx)(y,{className:`min-w-36`,children:(0,G.jsx)(b,{placeholder:`Filter by status`})}),(0,G.jsx)(v,{children:K.map(e=>(0,G.jsx)(_,{value:e.value,children:e.label},e.value))})]}),(0,G.jsxs)(x,{value:t,onValueChange:e=>r(e),children:[(0,G.jsx)(y,{className:`min-w-36`,children:(0,G.jsx)(b,{placeholder:`Filter by severity`})}),(0,G.jsx)(v,{children:q.map(e=>(0,G.jsx)(_,{value:e.value,children:e.label},e.value))})]}),a&&(0,G.jsxs)(g,{variant:`text`,size:`sm`,onClick:i,children:[(0,G.jsx)(c,{}),`Clear filters`]})]})}var Y=z,X=W.forwardRef(({className:e,children:t,...n},r)=>{let{ref:i,box:a}=B(`[role="tab"][data-state="active"]`);return(0,G.jsxs)(R,{ref:e=>{i.current=e,typeof r==`function`?r(e):r&&(r.current=e)},className:V(`relative inline-flex h-9 items-center gap-4 text-text-2`,e),...n,children:[t,a&&(0,G.jsx)(`span`,{"aria-hidden":!0,"data-testid":`tab-underline`,className:`pointer-events-none absolute bottom-0 h-0.5 rounded-full bg-accent transition-[left,width] duration-(--dur-fast) ease-(--ease-standard)`,style:{left:a.x,width:a.w}})]})});X.displayName=R.displayName;var Z=W.forwardRef(({className:e,...t},n)=>(0,G.jsx)(I,{ref:n,className:V(`relative inline-flex h-9 items-center justify-center whitespace-nowrap text-body transition-colors duration-(--dur-fast) hover:text-text-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:font-medium data-[state=active]:text-text-1`,e),...t}));Z.displayName=I.displayName;var Q=W.forwardRef(({className:e,...t},n)=>(0,G.jsx)(L,{ref:n,className:V(`mt-4`,e),...t}));Q.displayName=L.displayName;function $(){H(`Alerts`);let e=u(),{search:t}=T(),r=E(),o=t.view===`stats`,s=i({...a.alerts.getStats.queryOptions({input:{}}),refetchInterval:U()}),[c,f]=(0,W.useState)(!!(t.status||t.severity)),p=t=>e({to:`.`,search:e=>({...e,...t}),replace:!0}),m=s.data?n(s.data.byStatus):0;return s.data?.total===0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(P,{title:`Alerts`,primary:(0,G.jsx)(g,{variant:`text`,onClick:()=>r.mutate({}),disabled:r.isPending,"data-testid":`alerts-pull`,children:`Pull now`})}),(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,G.jsx)(O,{}),(0,G.jsx)(F,{place:`alerts`,className:`mx-auto max-w-(--reading-w) px-4 pb-8`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(P,{title:(0,G.jsxs)(G.Fragment,{children:[`Alerts`,s.data&&(0,G.jsxs)(`span`,{className:`ml-2 text-meta font-normal text-text-3 tabular-nums`,children:[m,` firing of`,` `,(0,G.jsx)(`span`,{"data-testid":`alerts-total-count`,children:s.data.total})]})]}),children:[(0,G.jsx)(Y,{value:t.tab??`all`,onValueChange:e=>p({tab:e===`unmapped`?`unmapped`:void 0}),children:(0,G.jsxs)(X,{children:[(0,G.jsx)(Z,{value:`all`,children:`All alerts`}),(0,G.jsx)(Z,{value:`unmapped`,children:`Unmapped`})]})}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsx)(S,{className:`max-sm:hidden`}),(0,G.jsx)(A,{label:`Filters`,when:!c,children:(0,G.jsx)(g,{variant:`text`,size:`icon`,"aria-label":`Filters`,"aria-pressed":c,onClick:()=>f(e=>!e),className:c?`bg-surface-3 text-text-1`:void 0,"data-testid":`alert-list-filters-toggle`,children:(0,G.jsx)(d,{})})}),(0,G.jsx)(g,{variant:`text`,asChild:!0,children:(0,G.jsx)(l,{to:`/settings`,search:{tab:`alert-intake`},"data-testid":`alerts-connect`,children:`Connect`})}),(0,G.jsx)(g,{variant:`text`,onClick:()=>p({view:o?void 0:`stats`}),"aria-pressed":o,"data-testid":`alerts-view-numbers`,children:o?`List`:`Numbers`}),(0,G.jsx)(g,{variant:`text`,onClick:()=>r.mutate({}),disabled:r.isPending,"data-testid":`alerts-pull`,children:`Pull now`})]})]}),c&&(0,G.jsx)(`div`,{className:`px-4 pb-2 md:px-6`,"data-testid":`alert-list-filters`,children:(0,G.jsx)(J,{status:t.status??`all`,severity:t.severity??`all`,onStatusChange:e=>p({status:e===`all`?void 0:e}),onSeverityChange:e=>p({severity:e===`all`?void 0:e}),onClear:()=>p({status:void 0,severity:void 0})})}),o?(0,G.jsx)(ee,{}):(0,G.jsx)(w,{selectedId:null,className:`min-h-0 flex-1 pt-1`,whenEmpty:(0,G.jsx)(F,{place:`alerts`,className:`mx-auto mt-4 px-4`})})]})}function ee(){let e=i({...a.alerts.getStats.queryOptions({input:{}}),refetchInterval:U()}),t=e.data,c=t?n(t.byStatus):0;return(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,"data-testid":`alerts-overview`,children:(0,G.jsx)(`div`,{className:`mx-auto w-full max-w-(--reading-w) px-6 pt-4 pb-12`,children:e.error&&!t?(0,G.jsx)(j,{text:`The numbers did not load.`,onRetry:()=>void e.refetch()}):t?t.total===0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(M,{text:`Nothing has fired yet.`,testId:`alerts-none`,action:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(g,{variant:`text`,size:`sm`,asChild:!0,children:(0,G.jsx)(l,{to:`/settings`,search:{tab:`sources`},children:`Add an alert source`})}),(0,G.jsx)(k,{testIdPrefix:`alerts`})]})}),(0,G.jsx)(F,{place:`alerts`,className:`mt-4`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-title font-normal text-text-2`,"data-testid":`alerts-stat-firing`,children:[(0,G.jsx)(`span`,{className:`font-semibold text-text-1 tabular-nums`,children:c}),` `,`firing of `,(0,G.jsx)(`span`,{className:`tabular-nums`,children:t.total}),`,`,` `,(0,G.jsx)(`span`,{className:`tabular-nums`,children:t.byStatus.resolved??0}),` `,`cleared.`]}),(0,G.jsxs)(`dl`,{className:`mt-8 grid grid-cols-[8rem_1fr] gap-x-6 gap-y-2 text-body`,children:[(0,G.jsx)(`dt`,{className:`text-text-3`,children:`By severity`}),(0,G.jsx)(`dd`,{className:`flex flex-wrap gap-x-4 gap-y-1`,children:s.options.map(e=>t.bySeverity[e]?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full`,style:{background:`var(--sev-${e})`}}),r[e],(0,G.jsx)(`span`,{className:`text-text-3 tabular-nums`,children:t.bySeverity[e]})]},e):null)}),(0,G.jsx)(`dt`,{className:`text-text-3`,children:`By status`}),(0,G.jsx)(`dd`,{className:`flex flex-wrap gap-x-4 gap-y-1`,children:o.options.map(e=>t.byStatus[e]?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(f,{tone:D(e),children:C(e)}),` `,(0,G.jsx)(`span`,{className:`text-text-3 tabular-nums`,children:t.byStatus[e]})]},e):null)})]})]}):(0,G.jsx)(N,{rows:3})})})}export{$ as component};
|