@miravo/cli-linux-arm64-musl 0.7.3 → 0.7.4
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/console-dist/assets/{api-B8Cqrm2G.js → api-DimikzPd.js} +1 -1
- package/console-dist/assets/catalog-8tLjGq7E.js +1 -0
- package/console-dist/assets/{catalog-C4iFSXl0.js → catalog-CbdG58Mn.js} +1 -1
- package/console-dist/assets/{catalog-source-B_3_Upeh.js → catalog-source-C4jQdH37.js} +1 -1
- package/console-dist/assets/{control-CvQvIf00.js → control-4ugKUt8n.js} +1 -1
- package/console-dist/assets/control-BVr4X_wI.js +1 -0
- package/console-dist/assets/{events-BZaBqF9J.js → events-BP1rvN5g.js} +1 -1
- package/console-dist/assets/events-BcZCvJ63.js +1 -0
- package/console-dist/assets/{fleet-efugggyV.js → fleet-ne7gllQE.js} +1 -1
- package/console-dist/assets/fleet-nhb_0n25.js +1 -0
- package/console-dist/assets/{index-DWUbVyod.js → index-Ds1n4iXS.js} +3 -3
- package/console-dist/assets/{instance-detail-CmF_Rznd.js → instance-detail-k6fWu2DS.js} +1 -1
- package/console-dist/assets/{login-KqoOCjoH.js → login-BmyMgUK4.js} +1 -1
- package/console-dist/assets/{models-Dn9__adB.js → models-C_UOiHSF.js} +1 -1
- package/console-dist/assets/models-DiO_AS9_.js +1 -0
- package/console-dist/assets/{platforms-B52boh2S.js → platforms-CmsbDw-2.js} +1 -1
- package/console-dist/assets/platforms-npS30Kgk.js +1 -0
- package/console-dist/assets/{query-fetch-error-B6y_Rlj9.js → query-fetch-error-Bcg_UjHM.js} +1 -1
- package/console-dist/assets/{route-preload-BOrx0jh2.js → route-preload-BO6weHRR.js} +2 -2
- package/console-dist/assets/{tags-C6UILCQv.js → tags-DORoU260.js} +1 -1
- package/console-dist/assets/tags-nwfbo5cT.js +1 -0
- package/console-dist/assets/{transition-nav-link-LpMCFklr.js → transition-nav-link-nVD3H66a.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-dw_B-1qa.js → use-engine-command-mutation-C8S_hX0O.js} +1 -1
- package/console-dist/assets/{use-platform-stream-DAr3QTPE.js → use-platform-stream-CZLW085n.js} +1 -1
- package/console-dist/assets/{use-transition-navigate-Fgz_LNAd.js → use-transition-navigate-jMR-y4bs.js} +1 -1
- package/console-dist/assets/{validation-eLNuMo9E.js → validation-DLydiTzj.js} +1 -1
- package/console-dist/index.html +17 -17
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/catalog-CvtaOpMA.js +0 -1
- package/console-dist/assets/control-DL1KRHz-.js +0 -1
- package/console-dist/assets/events-BdFbWiaW.js +0 -1
- package/console-dist/assets/fleet-B7pD7lbL.js +0 -1
- package/console-dist/assets/models-IiGAU-LZ.js +0 -1
- package/console-dist/assets/platforms-CleAbZI5.js +0 -1
- package/console-dist/assets/tags-CFcLbtJE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-B8Cqrm2G.js";import{i as o,s as ee,t as s}from"./query-fetch-error-B6y_Rlj9.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as te}from"./AnimatePresence-CPmH1DMY.js";import{u as ne}from"./chunk-OE4NN4TA-DBWZidbW.js";import{S as re,g as l,t as u}from"./format-CshN6yEB.js";import{c as ie,i as d,n as f,s as p,t as ae}from"./select-CmlY1M1a.js";import{r as m}from"./engine-store-DMULdR_V.js";import{t as h}from"./route-preload-BOrx0jh2.js";import{t as oe}from"./use-transition-navigate-Fgz_LNAd.js";import{t as se}from"./badge-eIn_7YrK.js";import{n as ce}from"./transition-types-2i1blGlR.js";import{n as le}from"./auth-screen-backdrop-Cr8qBSXP.js";import{t as g}from"./get-error-message-Dk8elqEP.js";import{r as ue}from"./runtime-link-PMxeHxd6.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./combobox-BCaV1Wbo.js";import{a as _,c as v,i as y,o as b,r as ve,s as ye,t as be}from"./select-display-items-Bqb6Sbg6.js";var x=e(t(),1);function xe(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function Se(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function S(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function C(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=S(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function Ce(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(u):n.toLocaleString(u,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function T(e){return e.type===`platform:operation`||e.type===`platform:resource`?S(e):w(e)}function E(e){return`fault`in e?l(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?C(e):`from`in e&&`to`in e?`${l(e.from)} \u2192 ${l(e.to)}`:``}function D(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}var O=n(),k=1500;function A(){let e=ee(),[t]=ne(),n=t.get(`type`)??`all`,l=t.get(`instanceId`)??``,[u,S]=(0,x.useState)(n),[C,A]=(0,x.useState)(l),[j,we]=(0,x.useState)(!0),M=ue(m(e=>e.connectionState))===null,N=m(e=>e.events.length),P=(0,x.useRef)(!1),F=m(e=>e.instances),Te=oe(),I=o({queryKey:i.events(u,C),queryFn:()=>a(D(u,C,null),r.events),refetchInterval:j&&M?k:!1,staleTime:5e3}),[Ee,L]=(0,x.useState)([]),[De,R]=(0,x.useState)(!1),[Oe,z]=(0,x.useState)(null),B=`${u}::${C}`,V=(0,x.useRef)(B);(0,x.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,x.useEffect)(()=>{S(e=>e===n?e:n)},[n]),(0,x.useEffect)(()=>{A(e=>e===l?e:l)},[l]);let[H,U]=(0,x.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...Ee]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],q=K?.hasMore??!1;(0,x.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let J=(0,x.useRef)(N);(0,x.useEffect)(()=>{N!==J.current&&(J.current=N,j&&M?(e.invalidateQueries({queryKey:i.events(u,C)}),P.current=!1):j&&(P.current=!0))},[N,j,M,e,u,C]),(0,x.useEffect)(()=>{!j||!M||!P.current||(P.current=!1,e.invalidateQueries({queryKey:i.events(u,C)}))},[j,M,e,u,C]);let[Y,ke]=(0,x.useState)(``),X=(0,x.useMemo)(()=>Y?F.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):F,[F,Y]),Z=I.isPending&&!I.data&&!I.isError,Ae=j&&!Z&&!H&&G.length===0,Q=I.error??Oe,je=I.isError&&!I.data,$=(0,x.useCallback)(()=>{I.refetch()},[I]),Me=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await a(D(u,C,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{R(!1)}}};if(je)return(0,O.jsx)(le,{className:`min-h-full`,children:(0,O.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,O.jsx)(`div`,{className:`w-full max-w-md`,children:(0,O.jsx)(s,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let Ne=new Date;return(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,O.jsx)(s,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,O.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),j&&!M?(0,O.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,O.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,O.jsx)(te,{mode:`wait`,initial:!1,children:j?(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,O.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(_e,{value:C||null,onValueChange:e=>{A(e??``)},onInputValueChange:ke,children:[(0,O.jsx)(he,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!C}),(0,O.jsx)(pe,{children:(0,O.jsxs)(de,{children:[X.map(e=>(0,O.jsx)(fe,{value:e.id,children:(0,O.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(ae,{value:u,onValueChange:e=>{S(e??`all`)},items:be,children:[(0,O.jsx)(p,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,O.jsx)(ie,{placeholder:`Filter by type`})}),(0,O.jsxs)(f,{alignItemWithTrigger:!1,align:`start`,children:[(0,O.jsx)(d,{value:`all`,children:`All events`}),(0,O.jsx)(d,{value:`fault:triggered`,children:`Fault Triggered`}),(0,O.jsx)(d,{value:`fault:cleared`,children:`Fault Cleared`}),(0,O.jsx)(d,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,O.jsx)(d,{value:`instance:created`,children:`Instance Created`}),(0,O.jsx)(d,{value:`instance:removed`,children:`Instance Removed`}),(0,O.jsx)(d,{value:`engine:state-changed`,children:`Engine State`}),(0,O.jsx)(d,{value:`platform:resource`,children:`Platform Resource`}),(0,O.jsx)(d,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,O.jsx)(me,{className:`min-w-0 py-0`,children:(0,O.jsx)(ge,{className:`p-0`,children:(0,O.jsxs)(ve,{children:[(0,O.jsx)(ye,{children:(0,O.jsxs)(v,{children:[(0,O.jsx)(b,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,O.jsx)(b,{children:`Type`}),(0,O.jsx)(b,{children:`Context`}),(0,O.jsx)(b,{children:`Details`}),(0,O.jsx)(b,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,O.jsx)(b,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,O.jsxs)(y,{children:[G.map(e=>{let t=w(e),n=T(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,O.jsxs)(v,{className:t?`transition-colors`:``,onMouseEnter:t?()=>h(`/instance/${t}`):void 0,children:[(0,O.jsx)(_,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,O.jsx)(_,{children:(0,O.jsx)(se,{variant:xe(e.type),className:`text-xs ${Se(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,O.jsx)(_,{className:`font-mono text-xs`,children:t?(0,O.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>h(`/instance/${t}`),onClick:()=>Te(`/instance/${t}`,{transitionType:ce}),children:n??t}):n??`—`}),(0,O.jsx)(_,{className:`max-w-xs truncate font-mono text-xs`,children:E(e)||(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,O.jsx)(_,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,O.jsx)(_,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:Ce(e.timestamp,Ne)})]},e.id)}),!Z&&G.length===0&&(0,O.jsx)(v,{children:(0,O.jsx)(_,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:Ae?`Listening for events…`:`No events`})})]})]})})}),q&&(0,O.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,O.jsx)(re,{variant:`outline`,size:`sm`,onClick:()=>void Me(),disabled:De,children:`Load older events`})})]})}export{A as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-DimikzPd.js";import{i as o,s as ee,t as s}from"./query-fetch-error-Bcg_UjHM.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as te}from"./AnimatePresence-CPmH1DMY.js";import{u as ne}from"./chunk-OE4NN4TA-DBWZidbW.js";import{S as re,g as l,t as u}from"./format-CshN6yEB.js";import{c as ie,i as d,n as f,s as p,t as ae}from"./select-CmlY1M1a.js";import{r as m}from"./engine-store-DMULdR_V.js";import{t as h}from"./route-preload-BO6weHRR.js";import{t as oe}from"./use-transition-navigate-jMR-y4bs.js";import{t as se}from"./badge-eIn_7YrK.js";import{n as ce}from"./transition-types-2i1blGlR.js";import{n as le}from"./auth-screen-backdrop-Cr8qBSXP.js";import{t as g}from"./get-error-message-Dk8elqEP.js";import{r as ue}from"./runtime-link-PMxeHxd6.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./combobox-BCaV1Wbo.js";import{a as _,c as v,i as y,o as b,r as ve,s as ye,t as be}from"./select-display-items-Bqb6Sbg6.js";var x=e(t(),1);function xe(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function Se(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function S(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function C(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=S(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function Ce(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(u):n.toLocaleString(u,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function T(e){return e.type===`platform:operation`||e.type===`platform:resource`?S(e):w(e)}function E(e){return`fault`in e?l(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?C(e):`from`in e&&`to`in e?`${l(e.from)} \u2192 ${l(e.to)}`:``}function D(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}var O=n(),k=1500;function A(){let e=ee(),[t]=ne(),n=t.get(`type`)??`all`,l=t.get(`instanceId`)??``,[u,S]=(0,x.useState)(n),[C,A]=(0,x.useState)(l),[j,we]=(0,x.useState)(!0),M=ue(m(e=>e.connectionState))===null,N=m(e=>e.events.length),P=(0,x.useRef)(!1),F=m(e=>e.instances),Te=oe(),I=o({queryKey:i.events(u,C),queryFn:()=>a(D(u,C,null),r.events),refetchInterval:j&&M?k:!1,staleTime:5e3}),[Ee,L]=(0,x.useState)([]),[De,R]=(0,x.useState)(!1),[Oe,z]=(0,x.useState)(null),B=`${u}::${C}`,V=(0,x.useRef)(B);(0,x.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,x.useEffect)(()=>{S(e=>e===n?e:n)},[n]),(0,x.useEffect)(()=>{A(e=>e===l?e:l)},[l]);let[H,U]=(0,x.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...Ee]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],q=K?.hasMore??!1;(0,x.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let J=(0,x.useRef)(N);(0,x.useEffect)(()=>{N!==J.current&&(J.current=N,j&&M?(e.invalidateQueries({queryKey:i.events(u,C)}),P.current=!1):j&&(P.current=!0))},[N,j,M,e,u,C]),(0,x.useEffect)(()=>{!j||!M||!P.current||(P.current=!1,e.invalidateQueries({queryKey:i.events(u,C)}))},[j,M,e,u,C]);let[Y,ke]=(0,x.useState)(``),X=(0,x.useMemo)(()=>Y?F.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):F,[F,Y]),Z=I.isPending&&!I.data&&!I.isError,Ae=j&&!Z&&!H&&G.length===0,Q=I.error??Oe,je=I.isError&&!I.data,$=(0,x.useCallback)(()=>{I.refetch()},[I]),Me=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await a(D(u,C,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{R(!1)}}};if(je)return(0,O.jsx)(le,{className:`min-h-full`,children:(0,O.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,O.jsx)(`div`,{className:`w-full max-w-md`,children:(0,O.jsx)(s,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let Ne=new Date;return(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,O.jsx)(s,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,O.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),j&&!M?(0,O.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,O.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,O.jsx)(te,{mode:`wait`,initial:!1,children:j?(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,O.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(_e,{value:C||null,onValueChange:e=>{A(e??``)},onInputValueChange:ke,children:[(0,O.jsx)(he,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!C}),(0,O.jsx)(pe,{children:(0,O.jsxs)(de,{children:[X.map(e=>(0,O.jsx)(fe,{value:e.id,children:(0,O.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(ae,{value:u,onValueChange:e=>{S(e??`all`)},items:be,children:[(0,O.jsx)(p,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,O.jsx)(ie,{placeholder:`Filter by type`})}),(0,O.jsxs)(f,{alignItemWithTrigger:!1,align:`start`,children:[(0,O.jsx)(d,{value:`all`,children:`All events`}),(0,O.jsx)(d,{value:`fault:triggered`,children:`Fault Triggered`}),(0,O.jsx)(d,{value:`fault:cleared`,children:`Fault Cleared`}),(0,O.jsx)(d,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,O.jsx)(d,{value:`instance:created`,children:`Instance Created`}),(0,O.jsx)(d,{value:`instance:removed`,children:`Instance Removed`}),(0,O.jsx)(d,{value:`engine:state-changed`,children:`Engine State`}),(0,O.jsx)(d,{value:`platform:resource`,children:`Platform Resource`}),(0,O.jsx)(d,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,O.jsx)(me,{className:`min-w-0 py-0`,children:(0,O.jsx)(ge,{className:`p-0`,children:(0,O.jsxs)(ve,{children:[(0,O.jsx)(ye,{children:(0,O.jsxs)(v,{children:[(0,O.jsx)(b,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,O.jsx)(b,{children:`Type`}),(0,O.jsx)(b,{children:`Context`}),(0,O.jsx)(b,{children:`Details`}),(0,O.jsx)(b,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,O.jsx)(b,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,O.jsxs)(y,{children:[G.map(e=>{let t=w(e),n=T(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,O.jsxs)(v,{className:t?`transition-colors`:``,onMouseEnter:t?()=>h(`/instance/${t}`):void 0,children:[(0,O.jsx)(_,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,O.jsx)(_,{children:(0,O.jsx)(se,{variant:xe(e.type),className:`text-xs ${Se(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,O.jsx)(_,{className:`font-mono text-xs`,children:t?(0,O.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>h(`/instance/${t}`),onClick:()=>Te(`/instance/${t}`,{transitionType:ce}),children:n??t}):n??`—`}),(0,O.jsx)(_,{className:`max-w-xs truncate font-mono text-xs`,children:E(e)||(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,O.jsx)(_,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,O.jsx)(_,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:Ce(e.timestamp,Ne)})]},e.id)}),!Z&&G.length===0&&(0,O.jsx)(v,{children:(0,O.jsx)(_,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:Ae?`Listening for events…`:`No events`})})]})]})})}),q&&(0,O.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,O.jsx)(re,{variant:`outline`,size:`sm`,onClick:()=>void Me(),disabled:De,children:`Load older events`})})]})}export{A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./events-BP1rvN5g.js";export{e as EventsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a,x as o}from"./api-B8Cqrm2G.js";import{i as s,n as c}from"./dist-xY0pK9Wy.js";import{c as l,n as u}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as d}from"./shallow-Cin0mLuv.js";import{c as f,d as p,g as m,l as h,p as ee,s as g,u as _,v as te,w as ne,x as re,y as v}from"./format-CshN6yEB.js";import{t as y}from"./utils-XFKvwlFT.js";import{t as b}from"./arrow-right-BjBb4z7g.js";import{t as x}from"./arrow-up-down-C1oJAmrw.js";import{c as S,i as C,n as w,s as T,t as E}from"./select-CmlY1M1a.js";import{t as ie}from"./circle-question-mark-CJvcT6V6.js";import{i as D,n as O,t as k}from"./tooltip-D1ydB4g3.js";import{r as A}from"./engine-store-DMULdR_V.js";import{t as j}from"./route-preload-BOrx0jh2.js";import{t as ae}from"./badge-eIn_7YrK.js";import{n as oe}from"./transition-types-2i1blGlR.js";import{a as se,i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-BCaV1Wbo.js";import{a as M,c as N,i as me,n as he,o as P,r as ge,s as _e}from"./select-display-items-Bqb6Sbg6.js";var F=e(t(),1);function I(e){return o.prefetchQuery({queryKey:i.instances.detail(e),queryFn:()=>a(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var L=n(),R={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},z={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},B={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function V({label:e,pip:t,pulse:n}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,L.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,L.jsx)(`span`,{className:y(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,R[t])}),(0,L.jsx)(`span`,{className:y(`relative inline-flex size-1.5 rounded-full`,R[t])})]}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,R[t])})),(0,L.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function H({children:e,tone:t=`foreground`,live:n}){return(0,L.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:y(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,z[t]),children:e})}function U({children:e}){return(0,L.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function W(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=A(d(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,F.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,F.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>B[e.name]??e.name)}},[a,o]),l=s.activeFaultCount>0,f=l?`destructive`:s.quarantined>0?`warning`:`success`,m=l?`faulted`:`healthy`;return(0,L.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(W(e,m)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":l?`Filter to faulted instances`:`Filter to healthy instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Health`,pip:f}),(0,L.jsxs)(H,{tone:l?`destructive`:`success`,children:[s.pct,`%`]}),(0,L.jsx)(U,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Faults`,pip:l?`destructive`:`success`}),(0,L.jsx)(H,{tone:l?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,L.jsx)(U,{children:l?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Tags`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{children:p(i)}),(0,L.jsxs)(U,{children:[(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(i),` tags`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,L.jsx)(G,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:B[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function G({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{tone:n>0?`warning`:`foreground`,live:!0,children:p(t)}),(0,L.jsxs)(U,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(t),` total`]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[h(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var K=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var q={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=q[e];return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(`span`,{className:y(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,L.jsx)(`span`,{children:g(t.label)})]}),(0,L.jsx)(O,{side:`top`,children:t.help})]})}function J({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,L.jsx)(`span`,{children:e}),n&&(0,L.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,L.jsx)(x,{className:y(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,L.jsx)(P,{className:s,"aria-sort":l,children:r?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:u}),(0,L.jsx)(O,{side:`top`,children:r})]}):u})}function Y({title:e,body:t,action:n}){return(0,L.jsx)(N,{children:(0,L.jsx)(M,{colSpan:7,className:`py-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,L.jsxs)(u,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,L.jsx)(b,{className:`size-3`,"aria-hidden":!0})]})]})})})}function X(){let{instances:e,connectionState:t}=A(d(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=s(`q`,c.withDefault(``)),[i,a]=s(`model`,c.withDefault(``)),[o,u]=s(`lifecycle`,c.withDefault(``)),[p,h]=s(`status`,c.withDefault(``)),g=be(p)?p:``,[x,R]=(0,F.useState)(`id`),[z,B]=(0,F.useState)(`asc`),V=(0,F.useRef)(null),H=l(),[U,W]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),V.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let G=(0,F.useCallback)(e=>{e===x?B(e=>e===`asc`?`desc`:`asc`):(R(e),B(`asc`))},[x]),q=(0,F.useCallback)(e=>{h(e===``?``:e)},[h]),X=(0,F.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),Z=(0,F.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Ce=(0,F.useMemo)(()=>[{value:`all`,label:`All stages`},...Z.map(e=>({value:e,label:m(e)}))],[Z]),Q=(0,F.useMemo)(()=>U?X.filter(([e])=>v(e,U)):X,[X,U]),we=(0,F.useMemo)(()=>i?{value:i,label:_(i)}:null,[i]),$=(0,F.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),o&&(t=t.filter(e=>e.lifecycleStage===o)),n&&(t=t.filter(e=>te(e.id,n)||v(e.model,n))),g===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),g===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),g===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,x,z)},[e,n,g,i,o,x,z]),Te=g!==``||i!==``||o!==``||n!==``,Ee=(0,F.useCallback)(()=>{r(``),h(``),a(``),u(``)},[r,h,a,u]),De=(0,F.useCallback)(e=>{(0,F.startTransition)(()=>{(0,F.addTransitionType)(oe),H(`/instance/${e}`)})},[H]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,L.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,L.jsx)(ve,{statusFilter:g,onStatusFilter:q}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:W,children:[(0,L.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,L.jsx)(le,{children:(0,L.jsxs)(se,{children:[Q.map(([e,t])=>(0,L.jsxs)(ce,{value:{value:e,label:_(e)},children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_(e)}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,L.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),Z.length>1&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsxs)(E,{value:o||`all`,onValueChange:e=>void u(!e||e===`all`?``:e),items:Ce,children:[(0,L.jsx)(T,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,L.jsx)(S,{placeholder:`All stages`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All stages`}),Z.map(e=>(0,L.jsx)(C,{value:e,children:m(e)},e))]})]}),(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,L.jsx)(O,{side:`top`,children:K})]})]}),(0,L.jsxs)(E,{value:g||`all`,onValueChange:e=>void h(!e||e===`all`?``:e),items:he,children:[(0,L.jsx)(T,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,L.jsx)(S,{placeholder:`All status`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All status`}),(0,L.jsx)(C,{value:`healthy`,children:`Healthy`}),(0,L.jsx)(C,{value:`faulted`,children:`Faulted`}),(0,L.jsx)(C,{value:`quarantined`,children:`Quarantined`})]})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(re,{ref:V,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,L.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,L.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,L.jsx)(ue,{className:`py-0`,children:(0,L.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(_e,{children:(0,L.jsxs)(N,{children:[(0,L.jsx)(J,{label:`Instance`,sortKey:`id`,current:x,direction:z,onSort:G}),(0,L.jsx)(J,{label:`Model`,sortKey:`model`,current:x,direction:z,onSort:G,className:`hidden sm:table-cell`}),(0,L.jsx)(J,{label:`Lifecycle`,sortKey:`lifecycle`,current:x,direction:z,onSort:G,tooltip:K}),(0,L.jsx)(J,{label:`Operating age`,sortKey:`hours`,current:x,direction:z,onSort:G,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,L.jsx)(J,{label:`Faults`,sortKey:`faults`,current:x,direction:z,onSort:G,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,L.jsx)(J,{label:`Status`,sortKey:`status`,current:x,direction:z,onSort:G}),(0,L.jsx)(P,{children:(0,L.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,L.jsx)(me,{children:Oe?(0,L.jsx)(Y,{title:`Connecting to runtime`,body:`Live fleet data will appear once the connection is up.`}):ke?(0,L.jsx)(Y,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):$.length===0?(0,L.jsx)(Y,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e),n=f(e.id);return(0,L.jsxs)(N,{tabIndex:0,"aria-label":`Open instance ${n}`,className:y(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>De(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),De(e.id))},onMouseEnter:()=>{j(`/instance/${e.id}`),I(e.id)},onFocus:()=>{j(`/instance/${e.id}`),I(e.id)},children:[(0,L.jsx)(M,{className:`text-sm`,children:(0,L.jsx)(F.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,L.jsx)(`span`,{className:`inline-flex max-w-full rounded-(--miravo-radius-tight) text-left`,children:n})})}),(0,L.jsx)(M,{className:`hidden text-sm sm:table-cell`,children:_(e.model)}),(0,L.jsx)(M,{children:(0,L.jsx)(ae,{variant:`secondary`,className:`text-xs`,children:m(e.lifecycleStage)})}),(0,L.jsx)(M,{className:`hidden font-mono text-sm md:table-cell`,children:ee(e.operatingHours)}),(0,L.jsx)(M,{children:e.activeFaults.length>0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,L.jsxs)(O,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,L.jsx)(M,{children:(0,L.jsx)(Se,{state:t})}),(0,L.jsx)(M,{children:(0,L.jsx)(b,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{X as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a,x as o}from"./api-DimikzPd.js";import{i as s,n as c}from"./dist-xY0pK9Wy.js";import{c as l,n as u}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as d}from"./shallow-Cin0mLuv.js";import{c as f,d as p,g as m,l as h,p as ee,s as g,u as _,v as te,w as ne,x as re,y as v}from"./format-CshN6yEB.js";import{t as y}from"./utils-XFKvwlFT.js";import{t as b}from"./arrow-right-BjBb4z7g.js";import{t as x}from"./arrow-up-down-C1oJAmrw.js";import{c as S,i as C,n as w,s as T,t as E}from"./select-CmlY1M1a.js";import{t as ie}from"./circle-question-mark-CJvcT6V6.js";import{i as D,n as O,t as k}from"./tooltip-D1ydB4g3.js";import{r as A}from"./engine-store-DMULdR_V.js";import{t as j}from"./route-preload-BO6weHRR.js";import{t as ae}from"./badge-eIn_7YrK.js";import{n as oe}from"./transition-types-2i1blGlR.js";import{a as se,i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-BCaV1Wbo.js";import{a as M,c as N,i as me,n as he,o as P,r as ge,s as _e}from"./select-display-items-Bqb6Sbg6.js";var F=e(t(),1);function I(e){return o.prefetchQuery({queryKey:i.instances.detail(e),queryFn:()=>a(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var L=n(),R={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},z={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},B={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function V({label:e,pip:t,pulse:n}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,L.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,L.jsx)(`span`,{className:y(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,R[t])}),(0,L.jsx)(`span`,{className:y(`relative inline-flex size-1.5 rounded-full`,R[t])})]}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,R[t])})),(0,L.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function H({children:e,tone:t=`foreground`,live:n}){return(0,L.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:y(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,z[t]),children:e})}function U({children:e}){return(0,L.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function W(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=A(d(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,F.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,F.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>B[e.name]??e.name)}},[a,o]),l=s.activeFaultCount>0,f=l?`destructive`:s.quarantined>0?`warning`:`success`,m=l?`faulted`:`healthy`;return(0,L.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(W(e,m)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":l?`Filter to faulted instances`:`Filter to healthy instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Health`,pip:f}),(0,L.jsxs)(H,{tone:l?`destructive`:`success`,children:[s.pct,`%`]}),(0,L.jsx)(U,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Faults`,pip:l?`destructive`:`success`}),(0,L.jsx)(H,{tone:l?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,L.jsx)(U,{children:l?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Tags`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{children:p(i)}),(0,L.jsxs)(U,{children:[(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(i),` tags`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,L.jsx)(G,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:B[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function G({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{tone:n>0?`warning`:`foreground`,live:!0,children:p(t)}),(0,L.jsxs)(U,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(t),` total`]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[h(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var K=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var q={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=q[e];return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(`span`,{className:y(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,L.jsx)(`span`,{children:g(t.label)})]}),(0,L.jsx)(O,{side:`top`,children:t.help})]})}function J({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,L.jsx)(`span`,{children:e}),n&&(0,L.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,L.jsx)(x,{className:y(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,L.jsx)(P,{className:s,"aria-sort":l,children:r?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:u}),(0,L.jsx)(O,{side:`top`,children:r})]}):u})}function Y({title:e,body:t,action:n}){return(0,L.jsx)(N,{children:(0,L.jsx)(M,{colSpan:7,className:`py-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,L.jsxs)(u,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,L.jsx)(b,{className:`size-3`,"aria-hidden":!0})]})]})})})}function X(){let{instances:e,connectionState:t}=A(d(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=s(`q`,c.withDefault(``)),[i,a]=s(`model`,c.withDefault(``)),[o,u]=s(`lifecycle`,c.withDefault(``)),[p,h]=s(`status`,c.withDefault(``)),g=be(p)?p:``,[x,R]=(0,F.useState)(`id`),[z,B]=(0,F.useState)(`asc`),V=(0,F.useRef)(null),H=l(),[U,W]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),V.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let G=(0,F.useCallback)(e=>{e===x?B(e=>e===`asc`?`desc`:`asc`):(R(e),B(`asc`))},[x]),q=(0,F.useCallback)(e=>{h(e===``?``:e)},[h]),X=(0,F.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),Z=(0,F.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Ce=(0,F.useMemo)(()=>[{value:`all`,label:`All stages`},...Z.map(e=>({value:e,label:m(e)}))],[Z]),Q=(0,F.useMemo)(()=>U?X.filter(([e])=>v(e,U)):X,[X,U]),we=(0,F.useMemo)(()=>i?{value:i,label:_(i)}:null,[i]),$=(0,F.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),o&&(t=t.filter(e=>e.lifecycleStage===o)),n&&(t=t.filter(e=>te(e.id,n)||v(e.model,n))),g===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),g===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),g===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,x,z)},[e,n,g,i,o,x,z]),Te=g!==``||i!==``||o!==``||n!==``,Ee=(0,F.useCallback)(()=>{r(``),h(``),a(``),u(``)},[r,h,a,u]),De=(0,F.useCallback)(e=>{(0,F.startTransition)(()=>{(0,F.addTransitionType)(oe),H(`/instance/${e}`)})},[H]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,L.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,L.jsx)(ve,{statusFilter:g,onStatusFilter:q}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:W,children:[(0,L.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,L.jsx)(le,{children:(0,L.jsxs)(se,{children:[Q.map(([e,t])=>(0,L.jsxs)(ce,{value:{value:e,label:_(e)},children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_(e)}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,L.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),Z.length>1&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsxs)(E,{value:o||`all`,onValueChange:e=>void u(!e||e===`all`?``:e),items:Ce,children:[(0,L.jsx)(T,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,L.jsx)(S,{placeholder:`All stages`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All stages`}),Z.map(e=>(0,L.jsx)(C,{value:e,children:m(e)},e))]})]}),(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,L.jsx)(O,{side:`top`,children:K})]})]}),(0,L.jsxs)(E,{value:g||`all`,onValueChange:e=>void h(!e||e===`all`?``:e),items:he,children:[(0,L.jsx)(T,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,L.jsx)(S,{placeholder:`All status`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All status`}),(0,L.jsx)(C,{value:`healthy`,children:`Healthy`}),(0,L.jsx)(C,{value:`faulted`,children:`Faulted`}),(0,L.jsx)(C,{value:`quarantined`,children:`Quarantined`})]})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(re,{ref:V,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,L.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,L.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,L.jsx)(ue,{className:`py-0`,children:(0,L.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(_e,{children:(0,L.jsxs)(N,{children:[(0,L.jsx)(J,{label:`Instance`,sortKey:`id`,current:x,direction:z,onSort:G}),(0,L.jsx)(J,{label:`Model`,sortKey:`model`,current:x,direction:z,onSort:G,className:`hidden sm:table-cell`}),(0,L.jsx)(J,{label:`Lifecycle`,sortKey:`lifecycle`,current:x,direction:z,onSort:G,tooltip:K}),(0,L.jsx)(J,{label:`Operating age`,sortKey:`hours`,current:x,direction:z,onSort:G,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,L.jsx)(J,{label:`Faults`,sortKey:`faults`,current:x,direction:z,onSort:G,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,L.jsx)(J,{label:`Status`,sortKey:`status`,current:x,direction:z,onSort:G}),(0,L.jsx)(P,{children:(0,L.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,L.jsx)(me,{children:Oe?(0,L.jsx)(Y,{title:`Connecting to runtime`,body:`Live fleet data will appear once the connection is up.`}):ke?(0,L.jsx)(Y,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):$.length===0?(0,L.jsx)(Y,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e),n=f(e.id);return(0,L.jsxs)(N,{tabIndex:0,"aria-label":`Open instance ${n}`,className:y(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>De(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),De(e.id))},onMouseEnter:()=>{j(`/instance/${e.id}`),I(e.id)},onFocus:()=>{j(`/instance/${e.id}`),I(e.id)},children:[(0,L.jsx)(M,{className:`text-sm`,children:(0,L.jsx)(F.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,L.jsx)(`span`,{className:`inline-flex max-w-full rounded-(--miravo-radius-tight) text-left`,children:n})})}),(0,L.jsx)(M,{className:`hidden text-sm sm:table-cell`,children:_(e.model)}),(0,L.jsx)(M,{children:(0,L.jsx)(ae,{variant:`secondary`,className:`text-xs`,children:m(e.lifecycleStage)})}),(0,L.jsx)(M,{className:`hidden font-mono text-sm md:table-cell`,children:ee(e.operatingHours)}),(0,L.jsx)(M,{children:e.activeFaults.length>0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,L.jsxs)(O,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,L.jsx)(M,{children:(0,L.jsx)(Se,{state:t})}),(0,L.jsx)(M,{children:(0,L.jsx)(b,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{X as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./fleet-ne7gllQE.js";export{e as FleetPage};
|