@omnitron-dev/omnitron 0.3.3 → 0.3.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/bin/pnpmfile-sdk.mjs +6 -1
- package/bin/sdk.mjs +6 -2
- package/dist/BUILD.json +2 -2
- package/dist/cli/omnitron.js +54 -14
- package/dist/cli/omnitron.js.map +1 -1
- package/dist/commands/infra.d.ts +8 -2
- package/dist/commands/infra.d.ts.map +1 -1
- package/dist/commands/infra.js +52 -59
- package/dist/commands/infra.js.map +1 -1
- package/dist/commands/node.d.ts.map +1 -1
- package/dist/commands/node.js +8 -1
- package/dist/commands/node.js.map +1 -1
- package/dist/commands/release-store.d.ts.map +1 -1
- package/dist/commands/release-store.js +6 -9
- package/dist/commands/release-store.js.map +1 -1
- package/dist/commands/release.d.ts +4 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +125 -5
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/stack.d.ts +1 -1
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +19 -9
- package/dist/commands/stack.js.map +1 -1
- package/dist/config/saved.d.ts +3 -0
- package/dist/config/saved.d.ts.map +1 -1
- package/dist/config/saved.js +1 -0
- package/dist/config/saved.js.map +1 -1
- package/dist/config/types.d.ts +4 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/daemon/daemon.d.ts.map +1 -1
- package/dist/daemon/daemon.js +30 -6
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/daemon.rpc-service.d.ts +0 -26
- package/dist/daemon/daemon.rpc-service.d.ts.map +1 -1
- package/dist/daemon/daemon.rpc-service.js +23 -114
- package/dist/daemon/daemon.rpc-service.js.map +1 -1
- package/dist/daemon/execution-client.d.ts +1 -1
- package/dist/daemon/execution-client.d.ts.map +1 -1
- package/dist/daemon/execution-client.js +17 -13
- package/dist/daemon/execution-client.js.map +1 -1
- package/dist/daemon/startup-config.d.ts +1 -0
- package/dist/daemon/startup-config.d.ts.map +1 -1
- package/dist/infrastructure/container-runtime.d.ts +8 -0
- package/dist/infrastructure/container-runtime.d.ts.map +1 -1
- package/dist/infrastructure/container-runtime.js +5 -0
- package/dist/infrastructure/container-runtime.js.map +1 -1
- package/dist/infrastructure/infrastructure.service.d.ts +5 -0
- package/dist/infrastructure/infrastructure.service.d.ts.map +1 -1
- package/dist/infrastructure/infrastructure.service.js +18 -8
- package/dist/infrastructure/infrastructure.service.js.map +1 -1
- package/dist/infrastructure/presets/postgres.js +1 -1
- package/dist/infrastructure/presets/postgres.js.map +1 -1
- package/dist/infrastructure/presets/registry.d.ts.map +1 -1
- package/dist/infrastructure/presets/registry.js +11 -19
- package/dist/infrastructure/presets/registry.js.map +1 -1
- package/dist/infrastructure/stack-infra-manager.d.ts +4 -0
- package/dist/infrastructure/stack-infra-manager.d.ts.map +1 -1
- package/dist/infrastructure/stack-infra-manager.js +38 -4
- package/dist/infrastructure/stack-infra-manager.js.map +1 -1
- package/dist/mcp/tool-groups/infra.tools.d.ts.map +1 -1
- package/dist/mcp/tool-groups/infra.tools.js +4 -1
- package/dist/mcp/tool-groups/infra.tools.js.map +1 -1
- package/dist/orchestrator/app-name.d.ts +33 -0
- package/dist/orchestrator/app-name.d.ts.map +1 -0
- package/dist/orchestrator/app-name.js +68 -0
- package/dist/orchestrator/app-name.js.map +1 -0
- package/dist/orchestrator/orchestrator.service.d.ts +1 -26
- package/dist/orchestrator/orchestrator.service.d.ts.map +1 -1
- package/dist/orchestrator/orchestrator.service.js +10 -89
- package/dist/orchestrator/orchestrator.service.js.map +1 -1
- package/dist/project/stack-diagnosis.d.ts.map +1 -1
- package/dist/project/stack-diagnosis.js +2 -3
- package/dist/project/stack-diagnosis.js.map +1 -1
- package/dist/release/artifact-store.d.ts +42 -7
- package/dist/release/artifact-store.d.ts.map +1 -1
- package/dist/release/artifact-store.js +176 -62
- package/dist/release/artifact-store.js.map +1 -1
- package/dist/release/configured-store.d.ts +6 -0
- package/dist/release/configured-store.d.ts.map +1 -0
- package/dist/release/configured-store.js +54 -0
- package/dist/release/configured-store.js.map +1 -0
- package/dist/release/load.d.ts +3 -0
- package/dist/release/load.d.ts.map +1 -1
- package/dist/release/load.js +8 -2
- package/dist/release/load.js.map +1 -1
- package/dist/services/infrastructure.rpc-service.d.ts +6 -2
- package/dist/services/infrastructure.rpc-service.d.ts.map +1 -1
- package/dist/services/infrastructure.rpc-service.js +43 -12
- package/dist/services/infrastructure.rpc-service.js.map +1 -1
- package/dist/services/node-deploy-lease.d.ts +4 -1
- package/dist/services/node-deploy-lease.d.ts.map +1 -1
- package/dist/services/node-deploy-lease.js +29 -4
- package/dist/services/node-deploy-lease.js.map +1 -1
- package/dist/services/node-manager.service.d.ts +5 -25
- package/dist/services/node-manager.service.d.ts.map +1 -1
- package/dist/services/node-manager.service.js +150 -139
- package/dist/services/node-manager.service.js.map +1 -1
- package/dist/services/project.service.d.ts +6 -0
- package/dist/services/project.service.d.ts.map +1 -1
- package/dist/services/project.service.js +89 -9
- package/dist/services/project.service.js.map +1 -1
- package/dist/services/release.rpc-service.d.ts +2 -1
- package/dist/services/release.rpc-service.d.ts.map +1 -1
- package/dist/services/release.rpc-service.js +19 -3
- package/dist/services/release.rpc-service.js.map +1 -1
- package/dist/services/release.service.d.ts +24 -11
- package/dist/services/release.service.d.ts.map +1 -1
- package/dist/services/release.service.js +162 -39
- package/dist/services/release.service.js.map +1 -1
- package/dist/services/remote-deployer.service.d.ts +1 -1
- package/dist/services/remote-deployer.service.d.ts.map +1 -1
- package/dist/services/remote-deployer.service.js.map +1 -1
- package/dist/services/secrets.service.d.ts +6 -0
- package/dist/services/secrets.service.d.ts.map +1 -1
- package/dist/services/secrets.service.js +95 -51
- package/dist/services/secrets.service.js.map +1 -1
- package/dist/shared/dto/nodes.d.ts +2 -0
- package/dist/shared/dto/nodes.d.ts.map +1 -1
- package/dist/shared/dto/project.d.ts +1 -1
- package/dist/shared/dto/project.d.ts.map +1 -1
- package/dist/shared/dto/releases.d.ts +8 -1
- package/dist/shared/dto/releases.d.ts.map +1 -1
- package/dist/shared/dto/services.d.ts +18 -1
- package/dist/shared/dto/services.d.ts.map +1 -1
- package/dist/shared/dto/services.js.map +1 -1
- package/dist/shared/release-reading.d.ts +6 -0
- package/dist/shared/release-reading.d.ts.map +1 -1
- package/dist/shared/release-reading.js +42 -0
- package/dist/shared/release-reading.js.map +1 -1
- package/package.json +16 -16
- package/webapp/dist/BUILD.json +2 -2
- package/webapp/dist/assets/{access-48hkC2-P.js → access-BvKK9dEv.js} +1 -1
- package/webapp/dist/assets/{access-jWkHxGc7.js → access-DUjabwNX.js} +1 -1
- package/webapp/dist/assets/{alerts-CuPQ9YQJ.js → alerts-CzN6OqX5.js} +1 -1
- package/webapp/dist/assets/{apps-Drio028B.js → apps-G_Lm6m4F.js} +1 -1
- package/webapp/dist/assets/{audit-npSFJECe.js → audit-CLMpdBzG.js} +1 -1
- package/webapp/dist/assets/{containers-Bl8gAyZX.js → containers-BsFwprq4.js} +1 -1
- package/webapp/dist/assets/{dashboard-UHlet3H9.js → dashboard-BN7rKE5n.js} +1 -1
- package/webapp/dist/assets/{dashboard-builder-67PZFqhE.js → dashboard-builder-BXFxWjXP.js} +1 -1
- package/webapp/dist/assets/deploy-progress-CUUwlYtQ.js +1 -0
- package/webapp/dist/assets/deploy-release-dialog-58lGZDNk.js +1 -0
- package/webapp/dist/assets/deployments-DEzjHerg.js +1 -0
- package/webapp/dist/assets/detail-CBn9pjJU.js +2 -0
- package/webapp/dist/assets/{detail-CYS81K6Y.js → detail-Dj3gxaH0.js} +1 -1
- package/webapp/dist/assets/{detail-B4TiBfxU.js → detail-pXPk4O0E.js} +1 -1
- package/webapp/dist/assets/index-Bo9An3pJ.js +1 -0
- package/webapp/dist/assets/{logs-BqHOufk8.js → logs-DrsBbLfb.js} +1 -1
- package/webapp/dist/assets/{metrics-QIQaF7iS.js → metrics-D5cDZTEo.js} +1 -1
- package/webapp/dist/assets/{mui-y44PQOfG.js → mui-59N0OVRa.js} +1 -1
- package/webapp/dist/assets/{mui-C_hromOc.js → mui-D5m7fDCh.js} +1 -1
- package/webapp/dist/assets/{mui-BIz4LSVs.js → mui-Db5J-QUd.js} +1 -1
- package/webapp/dist/assets/{mui-B1jrje6Z.js → mui-dLCwWoMw.js} +1 -1
- package/webapp/dist/assets/{nodes-BJPk02vv.js → nodes-CwwZZuu4.js} +1 -1
- package/webapp/dist/assets/{pipelines-T6Ch9LTw.js → pipelines-BrfTjf6Y.js} +1 -1
- package/webapp/dist/assets/project.store-DuCgv6Eq.js +1 -0
- package/webapp/dist/assets/{projects-YoBzcQ24.js → projects-TBAdpCeX.js} +1 -1
- package/webapp/dist/assets/{realtime.store-CBDO4Abj.js → realtime.store-hfxZD2DU.js} +1 -1
- package/webapp/dist/assets/release-bits-BJ6i23y0.js +1 -0
- package/webapp/dist/assets/release-build-panel-BNXkwNE1.js +1 -0
- package/webapp/dist/assets/release-deployment-state-gN8ZT3aq.js +1 -0
- package/webapp/dist/assets/releases-CXXKUh-v.js +2 -0
- package/webapp/dist/assets/{stack-start-notice-BVnMOwRQ.js → stack-start-notice-D-AH_bzn.js} +1 -1
- package/webapp/dist/assets/{stacks-IZ1mfizi.js → stacks-WY_ynkON.js} +1 -1
- package/webapp/dist/assets/{system-info-BFKNM-hf.js → system-info-DXMwo6gl.js} +1 -1
- package/webapp/dist/assets/{topology-CPey5dP6.js → topology-C_Qp1RqW.js} +1 -1
- package/webapp/dist/assets/{use-stack-context-UkBsF-l7.js → use-stack-context-8yaHaN8L.js} +1 -1
- package/webapp/dist/assets/{webapp-D-UhjFhS.js → webapp-BO_WoB_z.js} +3 -3
- package/webapp/dist/console-version.json +1 -1
- package/webapp/dist/index.html +12 -12
- package/webapp/dist/assets/deploy-release-dialog-BOXcD5Wo.js +0 -1
- package/webapp/dist/assets/deployments-qV20Ak0P.js +0 -1
- package/webapp/dist/assets/detail-B85-Wees.js +0 -2
- package/webapp/dist/assets/index-uq8Dkk4c.js +0 -1
- package/webapp/dist/assets/project.store--G5pIF-J.js +0 -1
- package/webapp/dist/assets/release-bits-B2a_wbft.js +0 -1
- package/webapp/dist/assets/release-build-panel-BQmIdKW9.js +0 -1
- package/webapp/dist/assets/release-deployment-state-DRrEI2pP.js +0 -1
- package/webapp/dist/assets/release-wire-f2VuBoBF.js +0 -1
- package/webapp/dist/assets/releases-Bp3CDgmo.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n}from"./rolldown-runtime-CNOWq4Kh.js";import{i as r,r as i,t as a}from"./react-BN8qLIAi.js";import{M as o,P as s,V as c,c as l,h as u,j as d,x as f,z as p}from"./client-DFnuv2z3.js";import{Vt as m,Yt as h}from"./mui-BTN91yBK.js";import{a as g,o as _}from"./mui-CdB_p2lt.js";import{F as v,H as y,I as b,Q as x,U as S,V as C,W as w,Z as T,c as ee,d as te,f as ne,g as E,h as re,m as ie,p as ae,s as oe}from"./mui-BXSXx9c9.js";import{B as se,F as D,I as ce,a as O,o as le,z as k}from"./mui-Cd711nOk.js";import{A as ue,C as de,H as fe,V as pe,it as me,k as he,l as ge,rt as A,u as _e,w as ve}from"./mui-AnEgAVjz.js";import{_ as j,v as ye}from"./mui-BwsIrivo.js";import{t as be}from"./dayjs.min-DHwAvH5f.js";import{a as xe,i as Se,n as Ce,o as we,r as Te,t as Ee}from"./mui-B1jrje6Z.js";import{h as De,j as Oe}from"./controls-C5W8gHU4.js";import{r as ke,t as Ae}from"./alert-uBG6r9NW.js";import{n as je,s as Me}from"./access-48hkC2-P.js";import{r as Ne,t as Pe}from"./use-polled-resource-B22hhr5L.js";import{n as Fe,t as Ie}from"./realtime.store-CBDO4Abj.js";import{a as Le,i as Re,o as ze,r as Be}from"./app-address-BCXfN59F.js";import{G as Ve,M as He,P as Ue,k as We,z as Ge}from"./icons-OboZgWSt.js";import{n as Ke,r as qe}from"./constants-CyhngVXh.js";import{n as Je,t as Ye}from"./table-BOWT6Y9d.js";import{n as Xe,t as Ze}from"./search-input-C0MHI8vO.js";import{n as Qe,t as $e}from"./page-breadcrumbs-fR7Jmpp4.js";import{a as et,s as tt}from"./formatters-RnRy4bXm.js";import{n as nt,t as rt}from"./use-stack-context-UkBsF-l7.js";import{r as it,t as at}from"./stack-health-status-BIv2C10x.js";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},st(e,t)}function ct(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,st(e,t)}function N(){return(N=t((()=>{})))()}function lt(e,t){return e.classList?!!t&&e.classList.contains(t):(` `+(e.className.baseVal||e.className)+` `).indexOf(` `+t+` `)!==-1}function ut(e,t){e.classList?e.classList.add(t):lt(e,t)||(typeof e.className==`string`?e.className=e.className+` `+t:e.setAttribute(`class`,(e.className&&e.className.baseVal||``)+` `+t))}function dt(){return(dt=t((()=>{})))()}function ft(e,t){return e.replace(RegExp(`(^|\\s)`+t+`(?:\\s|$)`,`g`),`$1`).replace(/\s+/g,` `).replace(/^\s*|\s*$/g,``)}function pt(e,t){e.classList?e.classList.remove(t):typeof e.className==`string`?e.className=ft(e.className,t):e.setAttribute(`class`,ft(e.className&&e.className.baseVal||``,t))}function mt(){return(mt=t((()=>{})))()}var ht;function gt(){return(gt=t((()=>{ht={disabled:!1}})))()}var _t;function vt(){return(vt=t((()=>{_t=function(e){return e.scrollTop}})))()}function P(){}var F,I,yt,L,R,z,B,V;function bt(){return(bt=t((()=>{N(),F=e(r()),I=e(i()),gt(),o(),vt(),yt=`unmounted`,L=`exited`,R=`entering`,z=`entered`,B=`exiting`,V=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this,i=n,a=i&&!i.isMounting?t.enter:t.appear,o;return r.appearStatus=null,t.in?a?(o=L,r.appearStatus=R):o=z:o=t.unmountOnExit||t.mountOnEnter?yt:L,r.state={status:o},r.nextCallback=null,r}t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===`unmounted`?{status:L}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==`entering`&&n!==`entered`&&(t=R):(n===`entering`||n===`entered`)&&(t=B)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=n=r=e,n,r;return e!=null&&typeof e!=`number`&&(t=e.exit,n=e.enter,r=e.appear===void 0?n:e.appear),{exit:t,enter:n,appear:r}},n.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null){if(this.cancelNextCallback(),t===`entering`){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this);n&&_t(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===`exited`&&this.setState({status:yt})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[I.default.findDOMNode(this),r],a=i[0],o=i[1],s=this.getTimeouts(),c=r?s.appear:s.enter;!e&&!n||ht.disabled?this.safeSetState({status:z},function(){t.props.onEntered(a)}):(this.props.onEnter(a,o),this.safeSetState({status:R},function(){t.props.onEntering(a,o),t.onTransitionEnd(c,function(){t.safeSetState({status:z},function(){t.props.onEntered(a,o)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:I.default.findDOMNode(this);!t||ht.disabled?this.safeSetState({status:L},function(){e.props.onExited(r)}):(this.props.onExit(r),this.safeSetState({status:B},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:L},function(){e.props.onExited(r)})})}))},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this),r=e==null&&!this.props.addEndListener;if(!n||r)setTimeout(this.nextCallback,0);else{if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=i[0],o=i[1];this.props.addEndListener(a,o)}e!=null&&setTimeout(this.nextCallback,e)}},n.render=function(){var e=this.state.status;if(e===`unmounted`)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=ot(t,[`children`,`in`,`mountOnEnter`,`unmountOnExit`,`appear`,`enter`,`exit`,`timeout`,`addEndListener`,`onEnter`,`onEntering`,`onEntered`,`onExit`,`onExiting`,`onExited`,`nodeRef`]);return F.createElement(d.Provider,{value:null},typeof n==`function`?n(e,r):F.cloneElement(F.Children.only(n),r))},t}(F.Component),V.contextType=d,V.propTypes={},V.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P},V.UNMOUNTED=yt,V.EXITED=L,V.ENTERING=R,V.ENTERED=z,V.EXITING=B})))()}var xt,St,H,Ct;function wt(){return(wt=t((()=>{N(),dt(),mt(),xt=e(r()),bt(),vt(),St=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return ut(e,t)})},H=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return pt(e,t)})},Ct=function(e){ct(t,e);function t(){var t,n=[...arguments];return t=e.call.apply(e,[this].concat(n))||this,t.appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1];t.removeClasses(i,`exit`),t.addClass(i,a?`appear`:`enter`,`base`),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.addClass(i,a,`active`),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.removeClasses(i,a),t.addClass(i,a,`done`),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`appear`),t.removeClasses(n,`enter`),t.addClass(n,`exit`,`base`),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,`exit`,`active`),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`exit`),t.addClass(n,`exit`,`done`),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r=typeof n==`string`,i=r&&n?n+`-`:``,a=r?``+i+e:n[e];return{baseClassName:a,activeClassName:r?a+`-active`:n[e+`Active`],doneClassName:r?a+`-done`:n[e+`Done`]}},t}var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+`ClassName`],i=this.getClassNames(`enter`).doneClassName;t===`appear`&&n===`done`&&i&&(r+=` `+i),n===`active`&&e&&_t(e),r&&(this.appliedClasses[t][n]=r,St(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,a=n.done;this.appliedClasses[t]={},r&&H(e,r),i&&H(e,i),a&&H(e,a)},n.render=function(){var e=this.props;e.classNames;var t=ot(e,[`classNames`]);return xt.createElement(V,M({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(xt.Component),Ct.defaultProps={classNames:``},Ct.propTypes={}})))()}function Tt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Et(e,t){var n=function(e){return t&&(0,W.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&W.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function Dt(e,t){e||={},t||={};function n(n){return n in t?t[n]:e[n]}var r=Object.create(null),i=[];for(var a in e)a in t?i.length&&(r[a]=i,i=[]):i.push(a);var o,s={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var l=r[c][o];s[r[c][o]]=n(l)}s[c]=n(c)}for(o=0;o<i.length;o++)s[i[o]]=n(i[o]);return s}function U(e,t,n){return n[t]==null?e.props[t]:n[t]}function Ot(e,t){return Et(e.children,function(n){return(0,W.cloneElement)(n,{onExited:t.bind(null,n),in:!0,appear:U(n,`appear`,e),enter:U(n,`enter`,e),exit:U(n,`exit`,e)})})}function kt(e,t,n){var r=Et(e.children),i=Dt(t,r);return Object.keys(i).forEach(function(a){var o=i[a];if((0,W.isValidElement)(o)){var s=a in t,c=a in r,l=t[a],u=(0,W.isValidElement)(l)&&!l.props.in;c&&(!s||u)?i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}):!c&&s&&!u?i[a]=(0,W.cloneElement)(o,{in:!1}):c&&s&&(0,W.isValidElement)(l)&&(i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:l.props.in,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}))}}),i}var W;function At(){return(At=t((()=>{W=r()})))()}var G,jt,Mt,Nt;function Pt(){return(Pt=t((()=>{N(),G=e(r()),o(),At(),jt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Mt={component:`div`,childFactory:function(e){return e}},Nt=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.state={contextValue:{isMounting:!0},handleExited:r.handleExited.bind(Tt(r)),firstRender:!0},r}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n=t.children,r=t.handleExited;return{children:t.firstRender?Ot(e,r):kt(e,n,r),firstRender:!1}},n.handleExited=function(e,t){var n=Et(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=M({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=ot(e,[`component`,`childFactory`]),i=this.state.contextValue,a=jt(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,t===null?G.createElement(d.Provider,{value:i},a):G.createElement(d.Provider,{value:i},G.createElement(t,r,a))},t}(G.Component),Nt.propTypes={},Nt.defaultProps=Mt})))()}function Ft({open:e,error:t,onClose:n,onSubmit:r,startDate:i,endDate:a,onChangeStartDate:o,onChangeEndDate:s,slotProps:c,variant:l=`input`,title:u,translations:d,selected:f,label:p,shortLabel:m,onOpen:h,onReset:g,setStartDate:y,setEndDate:b,...x}){let S=d?.title??u??`Select date range`,C=d?.startDate??`Start date`,w=d?.endDate??`End date`,T=d?.errorRange??`End date cannot be earlier than start date`,ee=d?.cancel??`Cancel`,ne=d?.apply??`Apply`,E=_(e=>e.breakpoints.up(`md`))&&l===`calendar`,ie=(0,It.useCallback)(()=>{n({},`backdropClick`),r?.()},[n,r]),se=(0,It.useCallback)(()=>{n({},`backdropClick`)},[n]),D=c?.paper?.sx;return(0,K.jsxs)(re,{fullWidth:!0,open:e,onClose:n,maxWidth:!E&&`xs`,slotProps:{...c,paper:{...c?.paper,sx:[{...E&&{maxWidth:720}},...Array.isArray(D)?D:D?[D]:[]]}},...x,children:[(0,K.jsx)(oe,{children:S}),(0,K.jsxs)(te,{sx:[e=>({gap:3,display:`flex`,overflow:`unset`,flexDirection:E?`row`:`column`,[`& .${xe.root}`]:{borderRadius:2,border:`dashed 1px ${e.palette.divider}`}})],children:[E?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{value:i,onChange:o}),(0,K.jsx)(Te,{value:a,onChange:s})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ee,{label:C,value:i,onChange:o}),(0,K.jsx)(Ee,{label:w,value:a,onChange:s})]}),t&&(0,K.jsx)(pe,{error:!0,sx:{px:2},children:T})]}),(0,K.jsxs)(ae,{children:[(0,K.jsx)(v,{variant:`outlined`,color:`inherit`,onClick:se,children:ee}),(0,K.jsx)(v,{disabled:t,variant:`contained`,onClick:ie,children:ne})]})]})}var It,K;function Lt(){return(Lt=t((()=>{It=r(),b(),E(),ee(),ie(),ne(),g(),fe(),Ce(),Se(),we(),K=a()})))()}function Rt(){return(0,Y.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,Y.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]})}function zt(){return(0,Y.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,Y.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function q(e){if(!e)return null;let t=(0,Ut.default)(e);return t.isValid()?t:null}function Bt(e){return!e||!e.isValid()?``:e.format(`YYYY-MM-DD`)}function Vt(e,t,n,r){if(!e&&!t)return``;let i=q(e),a=q(t);return i&&a?i.isSame(a,`day`)?a.format(`DD MMM YYYY`):i.isSame(a,`month`)?`${i.format(`DD`)} – ${a.format(`DD MMM YYYY`)}`:i.isSame(a,`year`)?`${i.format(`DD MMM`)} – ${a.format(`DD MMM YYYY`)}`:`${i.format(`DD MMM YYYY`)} – ${a.format(`DD MMM YYYY`)}`:i?`${n} ${i.format(`DD MMM YYYY`)}`:a?`${r} ${a.format(`DD MMM YYYY`)}`:``}function Ht({label:e=`Date range`,startDate:t,endDate:n,onChange:r,width:i=220,variant:a=`input`,size:o=`small`,translations:s,pickerTranslations:c}){let[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(q(t)),[p,m]=(0,J.useState)(q(n)),h=s?.placeholder??`Select dates...`,g=s?.from??`From`,_=s?.to??`To`,v=s?.clear??`Clear date range`,y=(0,J.useMemo)(()=>Vt(t,n,g,_),[t,n,g,_]),b=!!t||!!n,x=(0,J.useCallback)(()=>{f(q(t)),m(q(n)),u(!0)},[t,n]),S=(0,J.useCallback)(()=>{u(!1)},[]),C=(0,J.useCallback)(()=>{r(Bt(d),Bt(p)),u(!1)},[d,p,r]),w=(0,J.useCallback)(e=>{e.stopPropagation(),r(``,``)},[r]),T=!!(d&&p&&d.isAfter(p));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{size:o,label:e,value:y,placeholder:h,onClick:x,slotProps:{input:{readOnly:!0,sx:{cursor:`pointer`},startAdornment:(0,Y.jsx)(he,{position:`start`,sx:{color:`text.disabled`},children:(0,Y.jsx)(Rt,{})}),...b&&{endAdornment:(0,Y.jsx)(he,{position:`end`,children:(0,Y.jsx)(A,{size:`small`,onClick:w,"aria-label":v,sx:{p:.25},children:(0,Y.jsx)(zt,{})})})}},inputLabel:{shrink:!0}},sx:{minWidth:i,"& .MuiOutlinedInput-root":{borderRadius:1},"& .MuiInputBase-input":{cursor:`pointer`}}}),(0,Y.jsx)(Ft,{open:l,error:T,onClose:S,onSubmit:C,startDate:d,endDate:p,onChangeStartDate:f,onChangeEndDate:m,variant:a,translations:c,selected:!!(d&&p),label:``,shortLabel:``,onOpen:x,onReset:()=>{f(null),m(null)},setStartDate:f,setEndDate:m})]})}var J,Ut,Y;function Wt(){return(Wt=t((()=>{J=r(),Ut=e(be(),1),le(),ue(),me(),Lt(),Y=a()})))()}function Gt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kt(e,t){if(e.type===`date-range`)return!!(t[`${e.key}From`]||t[`${e.key}To`]);if(e.type===`number-range`)return[`Min`,`Max`].some(n=>{let r=t[`${e.key}${n}`];return r!=null&&r!==``});let n=t[e.key];return!(n==null||n===``||Array.isArray(n)&&n.length===0||e.type===`boolean`&&n===!1||e.type===`select`&&n===``)}function qt({filters:e,values:t,onChange:n,onReset:r,total:i,searchDebounce:a=300,compact:o=!1,sx:s,resetLabel:c=`Reset`,resultsLabel:l}){let[,u]=(0,X.useTransition)(),d=e.find(e=>e.type===`search`),[f,p]=(0,X.useState)(t[d?.key??`search`]??``),h=Gt(f,a),g=(0,X.useRef)(h);(0,X.useEffect)(()=>{if(h!==g.current){g.current=h;let e=d?.key??`search`;u(()=>{n({...t,[e]:h})})}},[h,d?.key,n,t]);let _=t[d?.key??`search`]??``;(0,X.useEffect)(()=>{_!==g.current&&(g.current=_,p(_))},[_]);let y=(0,X.useMemo)(()=>e.filter(e=>e.type!==`search`&&Kt(e,t)).length,[e,t]),b=(0,X.useMemo)(()=>e.some(e=>Kt(e,e.type===`search`?{[e.key]:f}:t)),[e,t,f]),x=(0,X.useCallback)((e,r)=>{u(()=>{n({...t,[e]:r})})},[n,t]),w=(0,X.useCallback)(()=>{if(p(``),r)r();else{let t={};for(let n of e)n.type===`search`?t[n.key]=``:n.type===`multi-select`?t[n.key]=[]:n.type===`boolean`?t[n.key]=!1:n.type===`date-range`?(t[`${n.key}From`]=``,t[`${n.key}To`]=``):n.type===`number-range`?(t[`${n.key}Min`]=``,t[`${n.key}Max`]=``):t[n.key]=``;n(t)}},[r,n,e]),ee=(0,X.useCallback)(e=>{let{key:r,type:i,label:a,placeholder:o,options:s}=e;switch(i){case`search`:return(0,Z.jsx)(Ze,{value:f,onChange:p,placeholder:o??`Search...`,"aria-label":a,fullWidth:!0},r);case`select`:return(0,Z.jsxs)(O,{select:!0,size:`small`,value:t[r]??``,onChange:e=>x(r,e.target.value),slotProps:{select:{displayEmpty:!0,"aria-label":a}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:[(0,Z.jsx)(ge,{value:``,children:(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a})}),s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))]},r);case`multi-select`:{let e=t[r]??[];return(0,Z.jsx)(O,{select:!0,size:`small`,value:e,onChange:e=>x(r,e.target.value),slotProps:{select:{multiple:!0,displayEmpty:!0,"aria-label":a,renderValue:e=>{let t=e;return t.length===0?(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a}):(0,Z.jsx)(j,{direction:`row`,spacing:.5,sx:{overflow:`hidden`},children:t.map(e=>{let t=s?.find(t=>t.value===e);return(0,Z.jsx)(T,{label:t?.label??e,size:`small`,sx:{height:20,fontSize:`0.75rem`}},e)})})}}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))},r)}case`date-range`:return(0,Z.jsx)(Ht,{label:a,startDate:t[`${r}From`]??``,endDate:t[`${r}To`]??``,onChange:(e,i)=>{u(()=>n({...t,[`${r}From`]:e,[`${r}To`]:i}))},width:`100%`,size:`small`},r);case`boolean`:return(0,Z.jsx)(T,{label:a,variant:t[r]?`filled`:`outlined`,color:t[r]?`primary`:`default`,onClick:()=>x(r,!t[r]),size:`small`,sx:{borderRadius:1,fontWeight:500,height:32,cursor:`pointer`,transition:e=>e.transitions.create([`background-color`,`color`,`border-color`],{duration:e.transitions.duration.shorter})}},r);case`number-range`:return(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} min`,value:t[`${r}Min`]??``,onChange:e=>x(`${r}Min`,e.target.value),sx:{flex:1,minWidth:0}}),(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.disabled`,px:.5},children:`—`}),(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} max`,value:t[`${r}Max`]??``,onChange:e=>x(`${r}Max`,e.target.value),sx:{flex:1,minWidth:0}})]},r);default:return null}},[f,t,x,n]);return(0,Z.jsxs)(j,{spacing:o?0:1.5,sx:{p:1.5,minWidth:0,borderRadius:1,border:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>m(e.palette.background.default,.5),...s},children:[(0,Z.jsxs)(j,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1.5},children:[e.map(e=>(0,Z.jsx)(C,{sx:{flex:e.type===`search`?`1 1 220px`:`0 1 auto`,width:e.width??(e.type===`number-range`?260:e.type===`boolean`?`auto`:180),minWidth:0,maxWidth:`100%`,"& > .MuiFormControl-root":{width:`100%`,minWidth:0}},children:ee(e)},e.key)),(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`,ml:`auto`},children:[y>0&&(0,Z.jsx)(S,{badgeContent:y,color:`primary`,sx:{"& .MuiBadge-badge":{fontSize:`0.65rem`}},children:(0,Z.jsx)(C,{sx:{color:`text.secondary`,display:`flex`,alignItems:`center`},children:(0,Z.jsx)(De,{})})}),b&&(0,Z.jsx)(v,{size:`small`,onClick:w,sx:{minWidth:0,px:1.5,fontSize:`0.75rem`,fontWeight:500,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:c})]})]}),i!==void 0&&!o&&(0,Z.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`,mt:.5},children:l?l(i):`${i.toLocaleString()} result${i===1?``:`s`}`})]})}var X,Z;function Jt(){return(Jt=t((()=>{Oe(),X=r(),ye(),le(),x(),_e(),y(),b(),se(),w(),h(),Wt(),Xe(),Z=a()})))()}var Yt=n({default:()=>Xt});function Xt(){let e=c(),[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!0),[a,o]=(0,Q.useState)(null),[u,d]=(0,Q.useState)({search:``,status:``}),[p,m]=(0,Q.useState)(null),{activeProject:h,activeStack:g}=nt(),_=(0,Q.useCallback)(async()=>{if(h)try{n(await f.getProjectApps({project:h})),o(null)}catch(e){o(e?.message??`Failed to fetch applications`)}finally{i(!1)}},[h]),v=Be(t,g),y=v.filter(e=>`${e.name} ${e.stack}`.toLowerCase().includes(String(u.search??``).toLowerCase())&&(!u.status||e.status===u.status)),b=Fe(e=>e.connected),x=Fe(e=>e.lastEvent),S=Fe(e=>e.initialize);(0,Q.useEffect)(()=>S(),[S]),Ne(()=>void _(),{intervalMs:b?15e3:5e3}),(0,Q.useEffect)(()=>{x&&_()},[x,_]);let C=async e=>{m(e);try{await l.restartApp({name:e}),await _()}catch(t){o(`Failed to restart ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},w=async e=>{m(e);try{let t=await l.stopApp({name:e});if(!t.success){o(`Failed to stop ${e}: ${t.error??`the daemon reported failure`}`);return}await _()}catch(t){o(`Failed to stop ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},ee=async e=>{m(e);try{await l.startApp({name:e}),await _()}catch(t){o(`Failed to start ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},te=[{id:`name`,label:`Name`,render:e=>ze(e)?(0,$.jsx)(de,{component:s,to:Re(e),variant:`body2`,underline:`hover`,sx:{fontWeight:600,color:`text.primary`},onClick:e=>e.stopPropagation(),children:e.name}):(0,$.jsx)(k,{variant:`body2`,sx:{fontWeight:600},children:e.name})},...g?[]:[{id:`stack`,label:`Stack`,render:e=>(0,$.jsx)(de,{component:s,to:`/stacks/${encodeURIComponent(e.stack)}`,variant:`body2`,underline:`hover`,onClick:e=>e.stopPropagation(),children:ze(e)?e.stack:`${e.stack} · ${e.stackType}`})}],{id:`status`,label:`Process`,render:e=>(0,$.jsx)(T,{label:e.status,size:`small`,color:Ke[e.status]||`default`,variant:`outlined`})},{id:`health`,label:`Health`,render:e=>(0,$.jsx)(at,{status:e.health})},{id:`instances`,label:`Instances`,align:`right`},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,$.jsx)(k,{variant:`body2`,sx:{fontFamily:`monospace`},children:e.pid??`--`})},{id:`uptime`,label:`Uptime`,render:e=>tt(e.uptime)},{id:`cpu`,label:`CPU %`,align:`right`,render:e=>e.cpu>0?e.cpu.toFixed(1):`--`},{id:`memory`,label:`Memory MB`,align:`right`,render:e=>et(e.memory)},{id:`actions`,label:`Actions`,align:`center`,render:e=>ze(e)?(0,$.jsx)(j,{direction:`row`,spacing:.5,sx:{justifyContent:`center`},onClick:e=>e.stopPropagation(),children:e.status===`stopped`||e.status===`crashed`||e.status===`errored`?(0,$.jsx)(je,{permission:`OmnitronDaemon.startApp`,children:(0,$.jsx)(D,{title:`Start`,children:(0,$.jsx)(A,{size:`small`,color:`success`,disabled:p===e.handleKey,onClick:()=>ee(e.handleKey),children:(0,$.jsx)(We,{sx:{fontSize:18}})})})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{permission:`OmnitronDaemon.restartApp`,children:(0,$.jsx)(D,{title:`Restart`,children:(0,$.jsx)(A,{size:`small`,color:`warning`,disabled:p===e.handleKey,onClick:()=>C(e.handleKey),children:(0,$.jsx)(Ue,{sx:{fontSize:18}})})})}),(0,$.jsx)(je,{permission:`OmnitronDaemon.stopApp`,children:(0,$.jsx)(D,{title:`Stop`,children:(0,$.jsx)(A,{size:`small`,color:`error`,disabled:p===e.handleKey,onClick:()=>w(e.handleKey),children:(0,$.jsx)(Ge,{sx:{fontSize:18}})})})})]})}):(0,$.jsx)(D,{title:`Runs on a node — started and stopped with its stack`,children:(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:`on node`})})}];return(0,$.jsxs)(j,{spacing:3,children:[(0,$.jsx)($e,{linkComponent:s,links:[{name:`Applications`}],action:(0,$.jsx)(A,{"data-console-command":`refresh`,onClick:_,title:`Refresh`,children:(0,$.jsx)(He,{})})}),a&&(0,$.jsx)(Ae,{closable:!0,severity:`error`,variant:`outlined`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,$.jsx)(qt,{filters:[{key:`search`,type:`search`,label:`Search applications`,placeholder:`Application or stack…`},{key:`status`,type:`select`,label:`All statuses`,options:[...new Set(v.map(e=>e.status))].map(e=>({value:e,label:e}))}],values:u,onChange:d,total:y.length}),(0,$.jsx)(Ye,{scrollLabel:`Applications`,sx:{minWidth:800},columns:te,data:y,rowKey:e=>`${e.stack}/${e.name}`,loading:r,loadingRows:3,onRowClick:t=>e(ze(t)?Re(t):`/stacks/${encodeURIComponent(t.stack)}`),emptyContent:(0,$.jsxs)(j,{spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:v.length?`No applications match these filters.`:`No applications deployed yet.`}),(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:v.length?`Change or reset the filters to see more applications.`:(0,$.jsxs)($.Fragment,{children:[`Use `,(0,$.jsx)(`code`,{children:`omnitron deploy`}),` to get started.`]})})]})})]})}var Q,$;function Zt(){return(Zt=t((()=>{it(),Me(),Q=r(),p(),se(),ye(),ke(),Qe(),Jt(),Je(),x(),me(),ce(),ve(),Ve(),u(),qe(),rt(),Ie(),Pe(),Le(),$=a()})))()}export{Ct as a,Pt as i,Zt as n,wt as o,Nt as r,Yt as t};
|
|
1
|
+
import{i as e,n as t,r as n}from"./rolldown-runtime-CNOWq4Kh.js";import{i as r,r as i,t as a}from"./react-BN8qLIAi.js";import{M as o,P as s,V as c,c as l,h as u,j as d,x as f,z as p}from"./client-DFnuv2z3.js";import{Vt as m,Yt as h}from"./mui-BTN91yBK.js";import{a as g,o as _}from"./mui-CdB_p2lt.js";import{F as v,H as y,I as b,Q as x,U as S,V as C,W as w,Z as T,c as ee,d as te,f as ne,g as E,h as re,m as ie,p as ae,s as oe}from"./mui-BXSXx9c9.js";import{B as se,F as D,I as ce,a as O,o as le,z as k}from"./mui-Cd711nOk.js";import{A as ue,C as de,H as fe,V as pe,it as me,k as he,l as ge,rt as A,u as _e,w as ve}from"./mui-AnEgAVjz.js";import{_ as j,v as ye}from"./mui-BwsIrivo.js";import{t as be}from"./dayjs.min-DHwAvH5f.js";import{a as xe,i as Se,n as Ce,o as we,r as Te,t as Ee}from"./mui-dLCwWoMw.js";import{h as De,j as Oe}from"./controls-C5W8gHU4.js";import{r as ke,t as Ae}from"./alert-uBG6r9NW.js";import{n as je,s as Me}from"./access-BvKK9dEv.js";import{r as Ne,t as Pe}from"./use-polled-resource-B22hhr5L.js";import{n as Fe,t as Ie}from"./realtime.store-hfxZD2DU.js";import{a as Le,i as Re,o as ze,r as Be}from"./app-address-BCXfN59F.js";import{G as Ve,M as He,P as Ue,k as We,z as Ge}from"./icons-OboZgWSt.js";import{n as Ke,r as qe}from"./constants-CyhngVXh.js";import{n as Je,t as Ye}from"./table-BOWT6Y9d.js";import{n as Xe,t as Ze}from"./search-input-C0MHI8vO.js";import{n as Qe,t as $e}from"./page-breadcrumbs-fR7Jmpp4.js";import{a as et,s as tt}from"./formatters-RnRy4bXm.js";import{n as nt,t as rt}from"./use-stack-context-8yaHaN8L.js";import{r as it,t as at}from"./stack-health-status-BIv2C10x.js";function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}function ot(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function st(e,t){return st=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},st(e,t)}function ct(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,st(e,t)}function N(){return(N=t((()=>{})))()}function lt(e,t){return e.classList?!!t&&e.classList.contains(t):(` `+(e.className.baseVal||e.className)+` `).indexOf(` `+t+` `)!==-1}function ut(e,t){e.classList?e.classList.add(t):lt(e,t)||(typeof e.className==`string`?e.className=e.className+` `+t:e.setAttribute(`class`,(e.className&&e.className.baseVal||``)+` `+t))}function dt(){return(dt=t((()=>{})))()}function ft(e,t){return e.replace(RegExp(`(^|\\s)`+t+`(?:\\s|$)`,`g`),`$1`).replace(/\s+/g,` `).replace(/^\s*|\s*$/g,``)}function pt(e,t){e.classList?e.classList.remove(t):typeof e.className==`string`?e.className=ft(e.className,t):e.setAttribute(`class`,ft(e.className&&e.className.baseVal||``,t))}function mt(){return(mt=t((()=>{})))()}var ht;function gt(){return(gt=t((()=>{ht={disabled:!1}})))()}var _t;function vt(){return(vt=t((()=>{_t=function(e){return e.scrollTop}})))()}function P(){}var F,I,yt,L,R,z,B,V;function bt(){return(bt=t((()=>{N(),F=e(r()),I=e(i()),gt(),o(),vt(),yt=`unmounted`,L=`exited`,R=`entering`,z=`entered`,B=`exiting`,V=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this,i=n,a=i&&!i.isMounting?t.enter:t.appear,o;return r.appearStatus=null,t.in?a?(o=L,r.appearStatus=R):o=z:o=t.unmountOnExit||t.mountOnEnter?yt:L,r.state={status:o},r.nextCallback=null,r}t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===`unmounted`?{status:L}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==`entering`&&n!==`entered`&&(t=R):(n===`entering`||n===`entered`)&&(t=B)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=n=r=e,n,r;return e!=null&&typeof e!=`number`&&(t=e.exit,n=e.enter,r=e.appear===void 0?n:e.appear),{exit:t,enter:n,appear:r}},n.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null){if(this.cancelNextCallback(),t===`entering`){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this);n&&_t(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===`exited`&&this.setState({status:yt})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[I.default.findDOMNode(this),r],a=i[0],o=i[1],s=this.getTimeouts(),c=r?s.appear:s.enter;!e&&!n||ht.disabled?this.safeSetState({status:z},function(){t.props.onEntered(a)}):(this.props.onEnter(a,o),this.safeSetState({status:R},function(){t.props.onEntering(a,o),t.onTransitionEnd(c,function(){t.safeSetState({status:z},function(){t.props.onEntered(a,o)})})}))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:I.default.findDOMNode(this);!t||ht.disabled?this.safeSetState({status:L},function(){e.props.onExited(r)}):(this.props.onExit(r),this.safeSetState({status:B},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:L},function(){e.props.onExited(r)})})}))},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:I.default.findDOMNode(this),r=e==null&&!this.props.addEndListener;if(!n||r)setTimeout(this.nextCallback,0);else{if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=i[0],o=i[1];this.props.addEndListener(a,o)}e!=null&&setTimeout(this.nextCallback,e)}},n.render=function(){var e=this.state.status;if(e===`unmounted`)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=ot(t,[`children`,`in`,`mountOnEnter`,`unmountOnExit`,`appear`,`enter`,`exit`,`timeout`,`addEndListener`,`onEnter`,`onEntering`,`onEntered`,`onExit`,`onExiting`,`onExited`,`nodeRef`]);return F.createElement(d.Provider,{value:null},typeof n==`function`?n(e,r):F.cloneElement(F.Children.only(n),r))},t}(F.Component),V.contextType=d,V.propTypes={},V.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P},V.UNMOUNTED=yt,V.EXITED=L,V.ENTERING=R,V.ENTERED=z,V.EXITING=B})))()}var xt,St,H,Ct;function wt(){return(wt=t((()=>{N(),dt(),mt(),xt=e(r()),bt(),vt(),St=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return ut(e,t)})},H=function(e,t){return e&&t&&t.split(` `).forEach(function(t){return pt(e,t)})},Ct=function(e){ct(t,e);function t(){var t,n=[...arguments];return t=e.call.apply(e,[this].concat(n))||this,t.appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1];t.removeClasses(i,`exit`),t.addClass(i,a?`appear`:`enter`,`base`),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.addClass(i,a,`active`),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],a=r[1]?`appear`:`enter`;t.removeClasses(i,a),t.addClass(i,a,`done`),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`appear`),t.removeClasses(n,`enter`),t.addClass(n,`exit`,`base`),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,`exit`,`active`),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,`exit`),t.addClass(n,`exit`,`done`),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r=typeof n==`string`,i=r&&n?n+`-`:``,a=r?``+i+e:n[e];return{baseClassName:a,activeClassName:r?a+`-active`:n[e+`Active`],doneClassName:r?a+`-done`:n[e+`Done`]}},t}var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+`ClassName`],i=this.getClassNames(`enter`).doneClassName;t===`appear`&&n===`done`&&i&&(r+=` `+i),n===`active`&&e&&_t(e),r&&(this.appliedClasses[t][n]=r,St(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,a=n.done;this.appliedClasses[t]={},r&&H(e,r),i&&H(e,i),a&&H(e,a)},n.render=function(){var e=this.props;e.classNames;var t=ot(e,[`classNames`]);return xt.createElement(V,M({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(xt.Component),Ct.defaultProps={classNames:``},Ct.propTypes={}})))()}function Tt(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Et(e,t){var n=function(e){return t&&(0,W.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&W.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function Dt(e,t){e||={},t||={};function n(n){return n in t?t[n]:e[n]}var r=Object.create(null),i=[];for(var a in e)a in t?i.length&&(r[a]=i,i=[]):i.push(a);var o,s={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var l=r[c][o];s[r[c][o]]=n(l)}s[c]=n(c)}for(o=0;o<i.length;o++)s[i[o]]=n(i[o]);return s}function U(e,t,n){return n[t]==null?e.props[t]:n[t]}function Ot(e,t){return Et(e.children,function(n){return(0,W.cloneElement)(n,{onExited:t.bind(null,n),in:!0,appear:U(n,`appear`,e),enter:U(n,`enter`,e),exit:U(n,`exit`,e)})})}function kt(e,t,n){var r=Et(e.children),i=Dt(t,r);return Object.keys(i).forEach(function(a){var o=i[a];if((0,W.isValidElement)(o)){var s=a in t,c=a in r,l=t[a],u=(0,W.isValidElement)(l)&&!l.props.in;c&&(!s||u)?i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}):!c&&s&&!u?i[a]=(0,W.cloneElement)(o,{in:!1}):c&&s&&(0,W.isValidElement)(l)&&(i[a]=(0,W.cloneElement)(o,{onExited:n.bind(null,o),in:l.props.in,exit:U(o,`exit`,e),enter:U(o,`enter`,e)}))}}),i}var W;function At(){return(At=t((()=>{W=r()})))()}var G,jt,Mt,Nt;function Pt(){return(Pt=t((()=>{N(),G=e(r()),o(),At(),jt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Mt={component:`div`,childFactory:function(e){return e}},Nt=function(e){ct(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.state={contextValue:{isMounting:!0},handleExited:r.handleExited.bind(Tt(r)),firstRender:!0},r}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n=t.children,r=t.handleExited;return{children:t.firstRender?Ot(e,r):kt(e,n,r),firstRender:!1}},n.handleExited=function(e,t){var n=Et(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=M({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=ot(e,[`component`,`childFactory`]),i=this.state.contextValue,a=jt(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,t===null?G.createElement(d.Provider,{value:i},a):G.createElement(d.Provider,{value:i},G.createElement(t,r,a))},t}(G.Component),Nt.propTypes={},Nt.defaultProps=Mt})))()}function Ft({open:e,error:t,onClose:n,onSubmit:r,startDate:i,endDate:a,onChangeStartDate:o,onChangeEndDate:s,slotProps:c,variant:l=`input`,title:u,translations:d,selected:f,label:p,shortLabel:m,onOpen:h,onReset:g,setStartDate:y,setEndDate:b,...x}){let S=d?.title??u??`Select date range`,C=d?.startDate??`Start date`,w=d?.endDate??`End date`,T=d?.errorRange??`End date cannot be earlier than start date`,ee=d?.cancel??`Cancel`,ne=d?.apply??`Apply`,E=_(e=>e.breakpoints.up(`md`))&&l===`calendar`,ie=(0,It.useCallback)(()=>{n({},`backdropClick`),r?.()},[n,r]),se=(0,It.useCallback)(()=>{n({},`backdropClick`)},[n]),D=c?.paper?.sx;return(0,K.jsxs)(re,{fullWidth:!0,open:e,onClose:n,maxWidth:!E&&`xs`,slotProps:{...c,paper:{...c?.paper,sx:[{...E&&{maxWidth:720}},...Array.isArray(D)?D:D?[D]:[]]}},...x,children:[(0,K.jsx)(oe,{children:S}),(0,K.jsxs)(te,{sx:[e=>({gap:3,display:`flex`,overflow:`unset`,flexDirection:E?`row`:`column`,[`& .${xe.root}`]:{borderRadius:2,border:`dashed 1px ${e.palette.divider}`}})],children:[E?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{value:i,onChange:o}),(0,K.jsx)(Te,{value:a,onChange:s})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ee,{label:C,value:i,onChange:o}),(0,K.jsx)(Ee,{label:w,value:a,onChange:s})]}),t&&(0,K.jsx)(pe,{error:!0,sx:{px:2},children:T})]}),(0,K.jsxs)(ae,{children:[(0,K.jsx)(v,{variant:`outlined`,color:`inherit`,onClick:se,children:ee}),(0,K.jsx)(v,{disabled:t,variant:`contained`,onClick:ie,children:ne})]})]})}var It,K;function Lt(){return(Lt=t((()=>{It=r(),b(),E(),ee(),ie(),ne(),g(),fe(),Ce(),Se(),we(),K=a()})))()}function Rt(){return(0,Y.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,Y.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,Y.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]})}function zt(){return(0,Y.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,Y.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function q(e){if(!e)return null;let t=(0,Ut.default)(e);return t.isValid()?t:null}function Bt(e){return!e||!e.isValid()?``:e.format(`YYYY-MM-DD`)}function Vt(e,t,n,r){if(!e&&!t)return``;let i=q(e),a=q(t);return i&&a?i.isSame(a,`day`)?a.format(`DD MMM YYYY`):i.isSame(a,`month`)?`${i.format(`DD`)} – ${a.format(`DD MMM YYYY`)}`:i.isSame(a,`year`)?`${i.format(`DD MMM`)} – ${a.format(`DD MMM YYYY`)}`:`${i.format(`DD MMM YYYY`)} – ${a.format(`DD MMM YYYY`)}`:i?`${n} ${i.format(`DD MMM YYYY`)}`:a?`${r} ${a.format(`DD MMM YYYY`)}`:``}function Ht({label:e=`Date range`,startDate:t,endDate:n,onChange:r,width:i=220,variant:a=`input`,size:o=`small`,translations:s,pickerTranslations:c}){let[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(q(t)),[p,m]=(0,J.useState)(q(n)),h=s?.placeholder??`Select dates...`,g=s?.from??`From`,_=s?.to??`To`,v=s?.clear??`Clear date range`,y=(0,J.useMemo)(()=>Vt(t,n,g,_),[t,n,g,_]),b=!!t||!!n,x=(0,J.useCallback)(()=>{f(q(t)),m(q(n)),u(!0)},[t,n]),S=(0,J.useCallback)(()=>{u(!1)},[]),C=(0,J.useCallback)(()=>{r(Bt(d),Bt(p)),u(!1)},[d,p,r]),w=(0,J.useCallback)(e=>{e.stopPropagation(),r(``,``)},[r]),T=!!(d&&p&&d.isAfter(p));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{size:o,label:e,value:y,placeholder:h,onClick:x,slotProps:{input:{readOnly:!0,sx:{cursor:`pointer`},startAdornment:(0,Y.jsx)(he,{position:`start`,sx:{color:`text.disabled`},children:(0,Y.jsx)(Rt,{})}),...b&&{endAdornment:(0,Y.jsx)(he,{position:`end`,children:(0,Y.jsx)(A,{size:`small`,onClick:w,"aria-label":v,sx:{p:.25},children:(0,Y.jsx)(zt,{})})})}},inputLabel:{shrink:!0}},sx:{minWidth:i,"& .MuiOutlinedInput-root":{borderRadius:1},"& .MuiInputBase-input":{cursor:`pointer`}}}),(0,Y.jsx)(Ft,{open:l,error:T,onClose:S,onSubmit:C,startDate:d,endDate:p,onChangeStartDate:f,onChangeEndDate:m,variant:a,translations:c,selected:!!(d&&p),label:``,shortLabel:``,onOpen:x,onReset:()=>{f(null),m(null)},setStartDate:f,setEndDate:m})]})}var J,Ut,Y;function Wt(){return(Wt=t((()=>{J=r(),Ut=e(be(),1),le(),ue(),me(),Lt(),Y=a()})))()}function Gt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Kt(e,t){if(e.type===`date-range`)return!!(t[`${e.key}From`]||t[`${e.key}To`]);if(e.type===`number-range`)return[`Min`,`Max`].some(n=>{let r=t[`${e.key}${n}`];return r!=null&&r!==``});let n=t[e.key];return!(n==null||n===``||Array.isArray(n)&&n.length===0||e.type===`boolean`&&n===!1||e.type===`select`&&n===``)}function qt({filters:e,values:t,onChange:n,onReset:r,total:i,searchDebounce:a=300,compact:o=!1,sx:s,resetLabel:c=`Reset`,resultsLabel:l}){let[,u]=(0,X.useTransition)(),d=e.find(e=>e.type===`search`),[f,p]=(0,X.useState)(t[d?.key??`search`]??``),h=Gt(f,a),g=(0,X.useRef)(h);(0,X.useEffect)(()=>{if(h!==g.current){g.current=h;let e=d?.key??`search`;u(()=>{n({...t,[e]:h})})}},[h,d?.key,n,t]);let _=t[d?.key??`search`]??``;(0,X.useEffect)(()=>{_!==g.current&&(g.current=_,p(_))},[_]);let y=(0,X.useMemo)(()=>e.filter(e=>e.type!==`search`&&Kt(e,t)).length,[e,t]),b=(0,X.useMemo)(()=>e.some(e=>Kt(e,e.type===`search`?{[e.key]:f}:t)),[e,t,f]),x=(0,X.useCallback)((e,r)=>{u(()=>{n({...t,[e]:r})})},[n,t]),w=(0,X.useCallback)(()=>{if(p(``),r)r();else{let t={};for(let n of e)n.type===`search`?t[n.key]=``:n.type===`multi-select`?t[n.key]=[]:n.type===`boolean`?t[n.key]=!1:n.type===`date-range`?(t[`${n.key}From`]=``,t[`${n.key}To`]=``):n.type===`number-range`?(t[`${n.key}Min`]=``,t[`${n.key}Max`]=``):t[n.key]=``;n(t)}},[r,n,e]),ee=(0,X.useCallback)(e=>{let{key:r,type:i,label:a,placeholder:o,options:s}=e;switch(i){case`search`:return(0,Z.jsx)(Ze,{value:f,onChange:p,placeholder:o??`Search...`,"aria-label":a,fullWidth:!0},r);case`select`:return(0,Z.jsxs)(O,{select:!0,size:`small`,value:t[r]??``,onChange:e=>x(r,e.target.value),slotProps:{select:{displayEmpty:!0,"aria-label":a}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:[(0,Z.jsx)(ge,{value:``,children:(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a})}),s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))]},r);case`multi-select`:{let e=t[r]??[];return(0,Z.jsx)(O,{select:!0,size:`small`,value:e,onChange:e=>x(r,e.target.value),slotProps:{select:{multiple:!0,displayEmpty:!0,"aria-label":a,renderValue:e=>{let t=e;return t.length===0?(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:a}):(0,Z.jsx)(j,{direction:`row`,spacing:.5,sx:{overflow:`hidden`},children:t.map(e=>{let t=s?.find(t=>t.value===e);return(0,Z.jsx)(T,{label:t?.label??e,size:`small`,sx:{height:20,fontSize:`0.75rem`}},e)})})}}},sx:{minWidth:0,width:`100%`,"& .MuiOutlinedInput-root":{borderRadius:1}},children:s?.map(e=>(0,Z.jsx)(ge,{value:e.value,children:e.label},e.value))},r)}case`date-range`:return(0,Z.jsx)(Ht,{label:a,startDate:t[`${r}From`]??``,endDate:t[`${r}To`]??``,onChange:(e,i)=>{u(()=>n({...t,[`${r}From`]:e,[`${r}To`]:i}))},width:`100%`,size:`small`},r);case`boolean`:return(0,Z.jsx)(T,{label:a,variant:t[r]?`filled`:`outlined`,color:t[r]?`primary`:`default`,onClick:()=>x(r,!t[r]),size:`small`,sx:{borderRadius:1,fontWeight:500,height:32,cursor:`pointer`,transition:e=>e.transitions.create([`background-color`,`color`,`border-color`],{duration:e.transitions.duration.shorter})}},r);case`number-range`:return(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} min`,value:t[`${r}Min`]??``,onChange:e=>x(`${r}Min`,e.target.value),sx:{flex:1,minWidth:0}}),(0,Z.jsx)(k,{variant:`body2`,sx:{color:`text.disabled`,px:.5},children:`—`}),(0,Z.jsx)(O,{type:`number`,size:`small`,label:`${a} max`,value:t[`${r}Max`]??``,onChange:e=>x(`${r}Max`,e.target.value),sx:{flex:1,minWidth:0}})]},r);default:return null}},[f,t,x,n]);return(0,Z.jsxs)(j,{spacing:o?0:1.5,sx:{p:1.5,minWidth:0,borderRadius:1,border:e=>`1px solid ${e.palette.divider}`,bgcolor:e=>m(e.palette.background.default,.5),...s},children:[(0,Z.jsxs)(j,{direction:`row`,sx:{alignItems:`center`,flexWrap:`wrap`,gap:1.5},children:[e.map(e=>(0,Z.jsx)(C,{sx:{flex:e.type===`search`?`1 1 220px`:`0 1 auto`,width:e.width??(e.type===`number-range`?260:e.type===`boolean`?`auto`:180),minWidth:0,maxWidth:`100%`,"& > .MuiFormControl-root":{width:`100%`,minWidth:0}},children:ee(e)},e.key)),(0,Z.jsxs)(j,{direction:`row`,spacing:1,sx:{alignItems:`center`,ml:`auto`},children:[y>0&&(0,Z.jsx)(S,{badgeContent:y,color:`primary`,sx:{"& .MuiBadge-badge":{fontSize:`0.65rem`}},children:(0,Z.jsx)(C,{sx:{color:`text.secondary`,display:`flex`,alignItems:`center`},children:(0,Z.jsx)(De,{})})}),b&&(0,Z.jsx)(v,{size:`small`,onClick:w,sx:{minWidth:0,px:1.5,fontSize:`0.75rem`,fontWeight:500,color:`text.secondary`,"&:hover":{color:`text.primary`}},children:c})]})]}),i!==void 0&&!o&&(0,Z.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`,mt:.5},children:l?l(i):`${i.toLocaleString()} result${i===1?``:`s`}`})]})}var X,Z;function Jt(){return(Jt=t((()=>{Oe(),X=r(),ye(),le(),x(),_e(),y(),b(),se(),w(),h(),Wt(),Xe(),Z=a()})))()}var Yt=n({default:()=>Xt});function Xt(){let e=c(),[t,n]=(0,Q.useState)([]),[r,i]=(0,Q.useState)(!0),[a,o]=(0,Q.useState)(null),[u,d]=(0,Q.useState)({search:``,status:``}),[p,m]=(0,Q.useState)(null),{activeProject:h,activeStack:g}=nt(),_=(0,Q.useCallback)(async()=>{if(h)try{n(await f.getProjectApps({project:h})),o(null)}catch(e){o(e?.message??`Failed to fetch applications`)}finally{i(!1)}},[h]),v=Be(t,g),y=v.filter(e=>`${e.name} ${e.stack}`.toLowerCase().includes(String(u.search??``).toLowerCase())&&(!u.status||e.status===u.status)),b=Fe(e=>e.connected),x=Fe(e=>e.lastEvent),S=Fe(e=>e.initialize);(0,Q.useEffect)(()=>S(),[S]),Ne(()=>void _(),{intervalMs:b?15e3:5e3}),(0,Q.useEffect)(()=>{x&&_()},[x,_]);let C=async e=>{m(e);try{await l.restartApp({name:e}),await _()}catch(t){o(`Failed to restart ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},w=async e=>{m(e);try{let t=await l.stopApp({name:e});if(!t.success){o(`Failed to stop ${e}: ${t.error??`the daemon reported failure`}`);return}await _()}catch(t){o(`Failed to stop ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},ee=async e=>{m(e);try{await l.startApp({name:e}),await _()}catch(t){o(`Failed to start ${e}: ${t?.message??`Unknown error`}`)}finally{m(null)}},te=[{id:`name`,label:`Name`,render:e=>ze(e)?(0,$.jsx)(de,{component:s,to:Re(e),variant:`body2`,underline:`hover`,sx:{fontWeight:600,color:`text.primary`},onClick:e=>e.stopPropagation(),children:e.name}):(0,$.jsx)(k,{variant:`body2`,sx:{fontWeight:600},children:e.name})},...g?[]:[{id:`stack`,label:`Stack`,render:e=>(0,$.jsx)(de,{component:s,to:`/stacks/${encodeURIComponent(e.stack)}`,variant:`body2`,underline:`hover`,onClick:e=>e.stopPropagation(),children:ze(e)?e.stack:`${e.stack} · ${e.stackType}`})}],{id:`status`,label:`Process`,render:e=>(0,$.jsx)(T,{label:e.status,size:`small`,color:Ke[e.status]||`default`,variant:`outlined`})},{id:`health`,label:`Health`,render:e=>(0,$.jsx)(at,{status:e.health})},{id:`instances`,label:`Instances`,align:`right`},{id:`pid`,label:`PID`,align:`right`,render:e=>(0,$.jsx)(k,{variant:`body2`,sx:{fontFamily:`monospace`},children:e.pid??`--`})},{id:`uptime`,label:`Uptime`,render:e=>tt(e.uptime)},{id:`cpu`,label:`CPU %`,align:`right`,render:e=>e.cpu>0?e.cpu.toFixed(1):`--`},{id:`memory`,label:`Memory MB`,align:`right`,render:e=>et(e.memory)},{id:`actions`,label:`Actions`,align:`center`,render:e=>ze(e)?(0,$.jsx)(j,{direction:`row`,spacing:.5,sx:{justifyContent:`center`},onClick:e=>e.stopPropagation(),children:e.status===`stopped`||e.status===`crashed`||e.status===`errored`?(0,$.jsx)(je,{permission:`OmnitronDaemon.startApp`,children:(0,$.jsx)(D,{title:`Start`,children:(0,$.jsx)(A,{size:`small`,color:`success`,disabled:p===e.handleKey,onClick:()=>ee(e.handleKey),children:(0,$.jsx)(We,{sx:{fontSize:18}})})})}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{permission:`OmnitronDaemon.restartApp`,children:(0,$.jsx)(D,{title:`Restart`,children:(0,$.jsx)(A,{size:`small`,color:`warning`,disabled:p===e.handleKey,onClick:()=>C(e.handleKey),children:(0,$.jsx)(Ue,{sx:{fontSize:18}})})})}),(0,$.jsx)(je,{permission:`OmnitronDaemon.stopApp`,children:(0,$.jsx)(D,{title:`Stop`,children:(0,$.jsx)(A,{size:`small`,color:`error`,disabled:p===e.handleKey,onClick:()=>w(e.handleKey),children:(0,$.jsx)(Ge,{sx:{fontSize:18}})})})})]})}):(0,$.jsx)(D,{title:`Runs on a node — started and stopped with its stack`,children:(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:`on node`})})}];return(0,$.jsxs)(j,{spacing:3,children:[(0,$.jsx)($e,{linkComponent:s,links:[{name:`Applications`}],action:(0,$.jsx)(A,{"data-console-command":`refresh`,onClick:_,title:`Refresh`,children:(0,$.jsx)(He,{})})}),a&&(0,$.jsx)(Ae,{closable:!0,severity:`error`,variant:`outlined`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,$.jsx)(qt,{filters:[{key:`search`,type:`search`,label:`Search applications`,placeholder:`Application or stack…`},{key:`status`,type:`select`,label:`All statuses`,options:[...new Set(v.map(e=>e.status))].map(e=>({value:e,label:e}))}],values:u,onChange:d,total:y.length}),(0,$.jsx)(Ye,{scrollLabel:`Applications`,sx:{minWidth:800},columns:te,data:y,rowKey:e=>`${e.stack}/${e.name}`,loading:r,loadingRows:3,onRowClick:t=>e(ze(t)?Re(t):`/stacks/${encodeURIComponent(t.stack)}`),emptyContent:(0,$.jsxs)(j,{spacing:1,sx:{alignItems:`center`},children:[(0,$.jsx)(k,{variant:`body2`,sx:{color:`text.secondary`},children:v.length?`No applications match these filters.`:`No applications deployed yet.`}),(0,$.jsx)(k,{variant:`caption`,sx:{color:`text.disabled`},children:v.length?`Change or reset the filters to see more applications.`:(0,$.jsxs)($.Fragment,{children:[`Use `,(0,$.jsx)(`code`,{children:`omnitron deploy`}),` to get started.`]})})]})})]})}var Q,$;function Zt(){return(Zt=t((()=>{it(),Me(),Q=r(),p(),se(),ye(),ke(),Qe(),Jt(),Je(),x(),me(),ce(),ve(),Ve(),u(),qe(),rt(),Ie(),Pe(),Le(),$=a()})))()}export{Ct as a,Pt as i,Zt as n,wt as o,Nt as r,Yt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,r as i}from"./client-DFnuv2z3.js";import{Vt as a,Yt as o}from"./mui-BTN91yBK.js";import{F as s,H as c,I as l,Q as u,St as d,V as f,Z as p,xt as m}from"./mui-BXSXx9c9.js";import{A as h,B as g,C as _,D as ee,F as v,I as y,O as b,a as x,b as S,d as C,f as w,k as te,o as T,w as E,y as ne,z as D}from"./mui-Cd711nOk.js";import{it as O,l as k,rt as A,u as j}from"./mui-AnEgAVjz.js";import{_ as M,v as N}from"./mui-BwsIrivo.js";import{d as P,j as F,l as I,o as L}from"./controls-C5W8gHU4.js";import{r as R,t as z}from"./alert-uBG6r9NW.js";import{n as B,t as re}from"./use-copy-to-clipboard-BWYpToS3.js";import{c as ie,s as V}from"./access-48hkC2-P.js";import{n as ae,t as H}from"./store-bqUBn2A4.js";import{n as oe,t as U}from"./use-polled-resource-B22hhr5L.js";import{D as se,G as ce,M as le,k as ue}from"./icons-OboZgWSt.js";import{n as de,t as fe}from"./table-viewport-Bp4pq-c_.js";import{n as pe,t as me}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as he,t as ge}from"./skeleton-BmWDJWF9.js";import{n as _e,t as W}from"./event-fields-CiyqrRO8.js";import{n as ve,t as ye}from"./empty-content-7jOFhG4C.js";function be(e,t=500){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var G;function xe(){return(xe=e((()=>{G=t()})))()}function Se(e){let t=e.details?.outcome;return t===`ok`||t===`partial`||t===`failed`?t:e.action.endsWith(`.failed`)?`failed`:null}function Ce(e){let t=(t,n=e=>e)=>{let r=e.details?.[t];return typeof r==`string`&&r!==``?{key:t,text:n(r)}:null};switch(Se(e)){case`partial`:return t(`notUp`,e=>`not up: ${e}`);case`failed`:return t(`error`)??t(`message`);default:return null}}function we(e,t){if(e===`omnitron-local`&&t===`user`)return{text:`Local client`,title:`omnitron-local: CLI or a local tool through the daemon's owner-only Unix socket; this record does not identify a person or a specific tool`,kind:`local`};if(e){let n=Ee.test(e)?`${e.slice(0,8)}…`:e;return{text:`${t===`user`?`User`:t===`service`?`Service`:t}: ${n}`,title:`${t}: ${e}`,kind:t===`user`||t===`service`||t===`system`?t:`unknown`}}return t===`service`?{text:`Service`,title:`Service identity recorded by the control plane; no account identifier was recorded`,kind:`service`}:t===`system`?{text:`System`,title:`Daemon system identity; no calling account was recorded. Historical records do not identify a specific initiator.`,kind:`system`}:{text:t||`Unknown`,title:t||`No actor kind recorded`,kind:`unknown`}}var Te,Ee;function K(){return(K=e((()=>{Te=`omnitron-local`,Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-/i})))()}function De(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return{date:`Invalid time`,time:``,exact:e};let n=(e,t=2)=>String(e).padStart(t,`0`);return{date:`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,time:`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`,exact:t.toISOString()}}function Oe({row:e}){let t=ae(e=>e.user),n=we(e.actorId,e.actorType),r=n.kind===`user`&&e.actorId===t?.id?`${t.username} (you)`:n.text;return(0,J.jsx)(v,{title:n.title,arrow:!0,children:(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:r,"data-actor-kind":n.kind,sx:{height:24,maxWidth:`100%`,fontSize:11,"& .MuiChip-label":{overflow:`hidden`,textOverflow:`ellipsis`}}})})}function ke({row:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1),o=(0,q.useRef)(null),c=(0,q.useId)(),l=B(),u=De(e.createdAt),d=Se(e),h=Ce(e),g=we(e.actorId,e.actorType),ee=()=>{n(!1),o.current?.focus()};return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(C,{hover:!0,sx:{verticalAlign:`top`,bgcolor:e=>t?a(e.palette.primary.main,.045):void 0},children:[(0,J.jsx)(_,{sx:{px:.5,width:40},children:(0,J.jsx)(A,{ref:o,size:`small`,"aria-label":`Details for ${e.action} at ${u.exact}`,"aria-expanded":t,"aria-controls":t?c:void 0,onClick:()=>n(e=>!e),children:(0,J.jsx)(I,{sx:{fontSize:18,transform:t?`rotate(90deg)`:void 0}})})}),(0,J.jsx)(_,{sx:{display:{xs:`none`,sm:`table-cell`},whiteSpace:`nowrap`,fontFamily:Y,fontSize:11},children:(0,J.jsx)(v,{title:u.exact,children:(0,J.jsxs)(f,{component:`time`,dateTime:e.createdAt,children:[(0,J.jsx)(f,{children:u.date}),(0,J.jsx)(f,{sx:{color:`text.secondary`},children:u.time})]})})}),(0,J.jsxs)(_,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(M,{direction:`row`,sx:{gap:.75,alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsx)(D,{variant:`body2`,sx:{fontFamily:Y,fontWeight:600,overflowWrap:`anywhere`},children:e.action}),d&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,color:X[d],label:d,sx:{height:20,fontSize:10}}),!d&&e.action.endsWith(`.requested`)&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:`Requested`,sx:{height:20,fontSize:10}})]}),(0,J.jsxs)(D,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,fontFamily:Y,overflowWrap:`anywhere`},children:[e.resourceType,e.resourceId?` · ${e.resourceId}`:``]}),h&&(0,J.jsx)(D,{variant:`caption`,sx:{display:`block`,color:d?`${X[d]}.main`:`text.secondary`,overflowWrap:`anywhere`},children:h.text}),(0,J.jsxs)(M,{direction:`row`,sx:{display:{xs:`flex`,md:`none`},gap:.75,flexWrap:`wrap`,alignItems:`center`,mt:.5},children:[(0,J.jsxs)(D,{component:`time`,dateTime:e.createdAt,variant:`caption`,title:u.exact,sx:{display:{xs:`inline`,sm:`none`},fontFamily:Y,color:`text.secondary`},children:[u.date,` `,u.time]}),(0,J.jsx)(Oe,{row:e})]})]}),(0,J.jsx)(_,{sx:{display:{xs:`none`,md:`table-cell`},minWidth:0},children:(0,J.jsx)(Oe,{row:e})})]}),t&&(0,J.jsx)(C,{children:(0,J.jsx)(_,{colSpan:4,sx:{p:0},children:(0,J.jsx)(m,{in:!0,timeout:0,children:(0,J.jsxs)(f,{id:c,role:`region`,"aria-label":`Audit details: ${e.action}`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ee())},sx:{px:{xs:1.5,sm:5},py:1.5,bgcolor:e=>a(e.palette.primary.main,.045),minWidth:0},children:[(0,J.jsx)(W,{values:[[`Recorded at (UTC)`,u.exact],[`Event ID`,e.id],[`Action`,e.action],[`Resource type`,e.resourceType],[`Resource ID`,e.resourceId??`Not recorded`],[`Actor type`,e.actorType],[`Actor ID`,e.actorId??`Not recorded`],[`Actor context`,g.title],[`Source IP`,e.ipAddress??`Not recorded`],[`Outcome`,d??(e.action.endsWith(`.requested`)?`Requested; completion is not recorded by this event`:`Not recorded`)]]}),Object.keys(e.details??{}).length>0&&(0,J.jsx)(f,{sx:{mt:1.25,pt:1.25,borderTop:`1px solid`,borderColor:`divider`},children:(0,J.jsx)(W,{values:Object.entries(e.details??{}).filter(([e,t])=>e!==`outcome`||t!==d)})}),(0,J.jsxs)(M,{direction:`row`,sx:{gap:1,mt:1,flexWrap:`wrap`},children:[(0,J.jsx)(s,{size:`small`,color:`inherit`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-controls":r?`${c}-raw`:void 0,startIcon:(0,J.jsx)(I,{sx:{transform:r?`rotate(90deg)`:void 0}}),children:`Raw event`}),(0,J.jsx)(s,{size:`small`,onClick:()=>void l.copy(JSON.stringify(e,null,2)),startIcon:l.state===`success`?(0,J.jsx)(L,{}):(0,J.jsx)(P,{}),children:l.state===`success`?`Copied`:l.state===`error`?`Retry copy JSON`:`Copy JSON`})]}),l.state===`error`&&(0,J.jsx)(D,{role:`status`,variant:`caption`,color:`error`,children:`Clipboard unavailable. Open Raw event to select the text.`}),r&&(0,J.jsx)(f,{component:`pre`,id:`${c}-raw`,tabIndex:0,"aria-label":`Raw audit event`,sx:{m:0,mt:1,pt:1,borderTop:`1px solid`,borderColor:`divider`,minWidth:0,fontFamily:Y,fontSize:11,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`}},children:JSON.stringify(e,null,2)})]})})})})]})}var q,J,Y,X;function Ae(){return(Ae=e((()=>{q=t(),c(),l(),u(),d(),O(),N(),E(),w(),y(),g(),o(),re(),F(),_e(),H(),K(),J=n(),Y=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,X={ok:`success`,partial:`warning`,failed:`error`}})))()}function je(){let[e,t]=(0,Z.useState)(100),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=be(c.trim(),300),[d,m]=(0,Z.useState)(!1),h=ae(e=>e.user),{can:g}=ie(),y=g(`OmnitronAudit.list`)&&g(`OmnitronAudit.available`),b=(0,Z.useMemo)(()=>({limit:e,...n&&{resourceType:n},...u&&{action:u},...a===`local`?{actorType:`user`,actorId:Te}:a?{actorType:a}:{}}),[e,n,a,u]),S=JSON.stringify([h?.id,y,b]),w=(0,Z.useRef)(S);w.current=S;let T=(0,Z.useRef)(null),[E,O]=(0,Z.useState)(null);(0,Z.useEffect)(()=>(O(null),()=>{T.current=null}),[S]);let j=E?.scope===S?E:null,N=(0,Z.useCallback)(async()=>(await i.available()).available?{available:!0,rows:await i.list(b)}:{available:!1,rows:[]},[b]),{data:P,error:F,loading:I,refresh:L}=oe(N,{intervalMs:15e3,paused:d,enabled:y,resourceKey:S,describeError:e=>`Could not read the audit trail: ${e instanceof Error?e.message:String(e)}`}),R=j?.rows??P?.rows??[],B=()=>{T.current=null,O(null),L()},re=()=>{d&&(T.current=null,O(null),L()),m(e=>!e)},V=async()=>{if(!y||T.current||j?.pending||!R.length)return;let t=Symbol(`audit-history`);T.current=t;let n=R;m(!0),O({scope:S,rows:n,pending:!0,exhausted:!1,error:null});try{let r=await i.list({...b,beforeId:n[n.length-1].id});if(T.current!==t||w.current!==S)return;let a=new Set(n.map(e=>e.id)),o=r.filter(e=>!a.has(e.id));if(r.length&&!o.length)throw Error(`History cursor did not advance. Refresh the latest events.`);O({scope:S,rows:[...n,...o],pending:!1,exhausted:r.length<e,error:null})}catch(e){if(T.current!==t||w.current!==S)return;O({scope:S,rows:n,pending:!1,exhausted:!1,error:`Could not read older events: ${e instanceof Error?e.message:String(e)}`})}finally{T.current===t&&(T.current=null)}},H=[...new Set([...Me,n,...R.map(e=>e.resourceType)])].filter(Boolean).sort(),U=!!(n||a||c);return(0,Q.jsxs)(f,{sx:{minWidth:0},children:[(0,Q.jsx)(me,{heading:`Audit`,links:[{name:`Console`,href:`/`},{name:`Audit`}],sx:{mb:2}}),(0,Q.jsxs)(M,{direction:`row`,sx:{gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,Q.jsx)(D,{variant:`body2`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:`Control-plane audit · all projects`}),y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`caption`,role:`status`,color:`text.secondary`,children:j?.pending?`Reading history…`:I&&!j?`Reading…`:P?.available?`${R.length} matching events${j?` · history`:` · latest`}`:`No reading`}),(0,Q.jsx)(v,{title:d?`Resume audit updates`:`Pause audit updates`,children:(0,Q.jsx)(A,{size:`small`,"aria-label":d?`Resume audit updates`:`Pause audit updates`,onClick:re,children:d?(0,Q.jsx)(ue,{}):(0,Q.jsx)(se,{})})}),(0,Q.jsx)(p,{size:`small`,variant:`outlined`,label:d?`Paused`:`Live`,sx:{height:22}}),(0,Q.jsx)(v,{title:`Refresh audit`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(A,{size:`small`,"aria-label":`Refresh audit`,disabled:I,loading:I,onClick:B,children:(0,Q.jsx)(le,{})})})})]})]}),y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(f,{component:`section`,"aria-label":`Audit filters`,sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 128px), 1fr))`,gap:1.5,mb:2},children:[(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Resource`,value:n,onChange:e=>r(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All resources`}),H.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]}),(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Actor`,value:a,onChange:e=>o(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All actors`}),(0,Q.jsx)(k,{value:`local`,children:`Local client`}),(0,Q.jsx)(k,{value:`user`,children:`User identities`}),(0,Q.jsx)(k,{value:`service`,children:`Service`}),(0,Q.jsx)(k,{value:`system`,children:`System`})]}),(0,Q.jsx)(x,{fullWidth:!0,size:`small`,label:`Action (exact)`,placeholder:`stack.start`,value:c,onChange:e=>l(e.target.value),sx:{minWidth:0}}),(0,Q.jsx)(x,{fullWidth:!0,select:!0,size:`small`,label:`Latest entries`,value:e,onChange:e=>t(Number(e.target.value)),sx:{minWidth:0},children:Ne.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]}),U&&(0,Q.jsx)(s,{size:`small`,sx:{mb:1},onClick:()=>{r(``),o(``),l(``)},children:`Reset filters`}),F&&(0,Q.jsxs)(z,{severity:`error`,sx:{mb:2},action:(0,Q.jsx)(s,{color:`inherit`,size:`small`,onClick:()=>void L(),children:`Retry`}),children:[F,P&&` The last reading is retained.`]}),I&&!P&&(0,Q.jsx)(ge,{variant:`rectangular`,height:280}),P&&!P.available&&(0,Q.jsx)(z,{severity:`info`,children:`This daemon has no audit storage. No event history is available.`}),P?.available&&R.length===0&&(0,Q.jsx)(ye,{title:U?`No matching events`:`Nothing recorded yet`,description:U?`Change the filters to read another part of the trail.`:`Recorded control-plane actions will appear here.`}),P?.available&&R.length>0&&(0,Q.jsx)(f,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:(0,Q.jsx)(fe,{label:`Audit events`,children:(0,Q.jsxs)(te,{size:`small`,"aria-label":`Audit events`,sx:{tableLayout:`fixed`},children:[(0,Q.jsx)(ne,{children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(_,{sx:{width:40,px:.5},children:(0,Q.jsx)(f,{component:`span`,sx:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:`Details`})}),(0,Q.jsx)(_,{sx:{width:132,display:{xs:`none`,sm:`table-cell`}},children:(0,Q.jsx)(v,{title:`Local time; exact UTC is available in the event details`,children:(0,Q.jsx)(`span`,{children:`Recorded`})})}),(0,Q.jsx)(_,{children:`Event / resource`}),(0,Q.jsx)(_,{sx:{width:192,display:{xs:`none`,md:`table-cell`}},children:`Actor`})]})}),(0,Q.jsx)(ee,{children:R.map(e=>(0,Q.jsx)(ke,{row:e},e.id))})]})})}),j?.error&&(0,Q.jsx)(z,{severity:`error`,sx:{mt:1},children:j.error}),P?.available&&R.length>0&&(0,Q.jsxs)(M,{direction:`row`,sx:{mt:1,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:j?`Updates paused while reading history. Resume to return to the latest events.`:`Newest first. This count is the current reading, not the entire trail.`}),(j?!j.exhausted:R.length===e)&&(0,Q.jsx)(s,{size:`small`,disabled:j?.pending,loading:j?.pending,onClick:()=>void V(),children:j?.error?`Retry older events`:`Load older`}),j?.exhausted&&(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,children:`Start of matching history`})]})]}):(0,Q.jsx)(z,{severity:`info`,children:`Your role cannot read the control-plane audit trail.`})]})}var Z,Q,Me,Ne;function $(){return($=e((()=>{Z=t(),c(),l(),u(),O(),j(),N(),h(),b(),E(),S(),w(),T(),y(),g(),de(),R(),ve(),he(),xe(),pe(),Ae(),ce(),r(),U(),H(),V(),K(),Q=n(),Me=[`stack`,`release`,`project`,`node`,`kernel-rollout`,`pipeline`,`secret`,`terminal`,`account`,`app`,`file`],Ne=[50,100,250,500]})))()}$();export{je as default};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{h as r,r as i}from"./client-DFnuv2z3.js";import{Vt as a,Yt as o}from"./mui-BTN91yBK.js";import{F as s,H as c,I as l,Q as u,St as d,V as f,Z as p,xt as m}from"./mui-BXSXx9c9.js";import{A as h,B as g,C as _,D as ee,F as v,I as y,O as b,a as x,b as S,d as C,f as w,k as te,o as T,w as E,y as ne,z as D}from"./mui-Cd711nOk.js";import{it as O,l as k,rt as A,u as j}from"./mui-AnEgAVjz.js";import{_ as M,v as N}from"./mui-BwsIrivo.js";import{d as P,j as F,l as I,o as L}from"./controls-C5W8gHU4.js";import{r as R,t as z}from"./alert-uBG6r9NW.js";import{n as B,t as re}from"./use-copy-to-clipboard-BWYpToS3.js";import{c as ie,s as V}from"./access-BvKK9dEv.js";import{n as ae,t as H}from"./store-bqUBn2A4.js";import{n as oe,t as U}from"./use-polled-resource-B22hhr5L.js";import{D as se,G as ce,M as le,k as ue}from"./icons-OboZgWSt.js";import{n as de,t as fe}from"./table-viewport-Bp4pq-c_.js";import{n as pe,t as me}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as he,t as ge}from"./skeleton-BmWDJWF9.js";import{n as _e,t as W}from"./event-fields-CiyqrRO8.js";import{n as ve,t as ye}from"./empty-content-7jOFhG4C.js";function be(e,t=500){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var G;function xe(){return(xe=e((()=>{G=t()})))()}function Se(e){let t=e.details?.outcome;return t===`ok`||t===`partial`||t===`failed`?t:e.action.endsWith(`.failed`)?`failed`:null}function Ce(e){let t=(t,n=e=>e)=>{let r=e.details?.[t];return typeof r==`string`&&r!==``?{key:t,text:n(r)}:null};switch(Se(e)){case`partial`:return t(`notUp`,e=>`not up: ${e}`);case`failed`:return t(`error`)??t(`message`);default:return null}}function we(e,t){if(e===`omnitron-local`&&t===`user`)return{text:`Local client`,title:`omnitron-local: CLI or a local tool through the daemon's owner-only Unix socket; this record does not identify a person or a specific tool`,kind:`local`};if(e){let n=Ee.test(e)?`${e.slice(0,8)}…`:e;return{text:`${t===`user`?`User`:t===`service`?`Service`:t}: ${n}`,title:`${t}: ${e}`,kind:t===`user`||t===`service`||t===`system`?t:`unknown`}}return t===`service`?{text:`Service`,title:`Service identity recorded by the control plane; no account identifier was recorded`,kind:`service`}:t===`system`?{text:`System`,title:`Daemon system identity; no calling account was recorded. Historical records do not identify a specific initiator.`,kind:`system`}:{text:t||`Unknown`,title:t||`No actor kind recorded`,kind:`unknown`}}var Te,Ee;function K(){return(K=e((()=>{Te=`omnitron-local`,Ee=/^[0-9a-f]{8}-[0-9a-f]{4}-/i})))()}function De(e){let t=new Date(e);if(!Number.isFinite(t.getTime()))return{date:`Invalid time`,time:``,exact:e};let n=(e,t=2)=>String(e).padStart(t,`0`);return{date:`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`,time:`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`,exact:t.toISOString()}}function Oe({row:e}){let t=ae(e=>e.user),n=we(e.actorId,e.actorType),r=n.kind===`user`&&e.actorId===t?.id?`${t.username} (you)`:n.text;return(0,J.jsx)(v,{title:n.title,arrow:!0,children:(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:r,"data-actor-kind":n.kind,sx:{height:24,maxWidth:`100%`,fontSize:11,"& .MuiChip-label":{overflow:`hidden`,textOverflow:`ellipsis`}}})})}function ke({row:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1),o=(0,q.useRef)(null),c=(0,q.useId)(),l=B(),u=De(e.createdAt),d=Se(e),h=Ce(e),g=we(e.actorId,e.actorType),ee=()=>{n(!1),o.current?.focus()};return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(C,{hover:!0,sx:{verticalAlign:`top`,bgcolor:e=>t?a(e.palette.primary.main,.045):void 0},children:[(0,J.jsx)(_,{sx:{px:.5,width:40},children:(0,J.jsx)(A,{ref:o,size:`small`,"aria-label":`Details for ${e.action} at ${u.exact}`,"aria-expanded":t,"aria-controls":t?c:void 0,onClick:()=>n(e=>!e),children:(0,J.jsx)(I,{sx:{fontSize:18,transform:t?`rotate(90deg)`:void 0}})})}),(0,J.jsx)(_,{sx:{display:{xs:`none`,sm:`table-cell`},whiteSpace:`nowrap`,fontFamily:Y,fontSize:11},children:(0,J.jsx)(v,{title:u.exact,children:(0,J.jsxs)(f,{component:`time`,dateTime:e.createdAt,children:[(0,J.jsx)(f,{children:u.date}),(0,J.jsx)(f,{sx:{color:`text.secondary`},children:u.time})]})})}),(0,J.jsxs)(_,{sx:{minWidth:0,overflowWrap:`anywhere`},children:[(0,J.jsxs)(M,{direction:`row`,sx:{gap:.75,alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsx)(D,{variant:`body2`,sx:{fontFamily:Y,fontWeight:600,overflowWrap:`anywhere`},children:e.action}),d&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,color:X[d],label:d,sx:{height:20,fontSize:10}}),!d&&e.action.endsWith(`.requested`)&&(0,J.jsx)(p,{size:`small`,variant:`outlined`,label:`Requested`,sx:{height:20,fontSize:10}})]}),(0,J.jsxs)(D,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,fontFamily:Y,overflowWrap:`anywhere`},children:[e.resourceType,e.resourceId?` · ${e.resourceId}`:``]}),h&&(0,J.jsx)(D,{variant:`caption`,sx:{display:`block`,color:d?`${X[d]}.main`:`text.secondary`,overflowWrap:`anywhere`},children:h.text}),(0,J.jsxs)(M,{direction:`row`,sx:{display:{xs:`flex`,md:`none`},gap:.75,flexWrap:`wrap`,alignItems:`center`,mt:.5},children:[(0,J.jsxs)(D,{component:`time`,dateTime:e.createdAt,variant:`caption`,title:u.exact,sx:{display:{xs:`inline`,sm:`none`},fontFamily:Y,color:`text.secondary`},children:[u.date,` `,u.time]}),(0,J.jsx)(Oe,{row:e})]})]}),(0,J.jsx)(_,{sx:{display:{xs:`none`,md:`table-cell`},minWidth:0},children:(0,J.jsx)(Oe,{row:e})})]}),t&&(0,J.jsx)(C,{children:(0,J.jsx)(_,{colSpan:4,sx:{p:0},children:(0,J.jsx)(m,{in:!0,timeout:0,children:(0,J.jsxs)(f,{id:c,role:`region`,"aria-label":`Audit details: ${e.action}`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ee())},sx:{px:{xs:1.5,sm:5},py:1.5,bgcolor:e=>a(e.palette.primary.main,.045),minWidth:0},children:[(0,J.jsx)(W,{values:[[`Recorded at (UTC)`,u.exact],[`Event ID`,e.id],[`Action`,e.action],[`Resource type`,e.resourceType],[`Resource ID`,e.resourceId??`Not recorded`],[`Actor type`,e.actorType],[`Actor ID`,e.actorId??`Not recorded`],[`Actor context`,g.title],[`Source IP`,e.ipAddress??`Not recorded`],[`Outcome`,d??(e.action.endsWith(`.requested`)?`Requested; completion is not recorded by this event`:`Not recorded`)]]}),Object.keys(e.details??{}).length>0&&(0,J.jsx)(f,{sx:{mt:1.25,pt:1.25,borderTop:`1px solid`,borderColor:`divider`},children:(0,J.jsx)(W,{values:Object.entries(e.details??{}).filter(([e,t])=>e!==`outcome`||t!==d)})}),(0,J.jsxs)(M,{direction:`row`,sx:{gap:1,mt:1,flexWrap:`wrap`},children:[(0,J.jsx)(s,{size:`small`,color:`inherit`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-controls":r?`${c}-raw`:void 0,startIcon:(0,J.jsx)(I,{sx:{transform:r?`rotate(90deg)`:void 0}}),children:`Raw event`}),(0,J.jsx)(s,{size:`small`,onClick:()=>void l.copy(JSON.stringify(e,null,2)),startIcon:l.state===`success`?(0,J.jsx)(L,{}):(0,J.jsx)(P,{}),children:l.state===`success`?`Copied`:l.state===`error`?`Retry copy JSON`:`Copy JSON`})]}),l.state===`error`&&(0,J.jsx)(D,{role:`status`,variant:`caption`,color:`error`,children:`Clipboard unavailable. Open Raw event to select the text.`}),r&&(0,J.jsx)(f,{component:`pre`,id:`${c}-raw`,tabIndex:0,"aria-label":`Raw audit event`,sx:{m:0,mt:1,pt:1,borderTop:`1px solid`,borderColor:`divider`,minWidth:0,fontFamily:Y,fontSize:11,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`}},children:JSON.stringify(e,null,2)})]})})})})]})}var q,J,Y,X;function Ae(){return(Ae=e((()=>{q=t(),c(),l(),u(),d(),O(),N(),E(),w(),y(),g(),o(),re(),F(),_e(),H(),K(),J=n(),Y=`'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace`,X={ok:`success`,partial:`warning`,failed:`error`}})))()}function je(){let[e,t]=(0,Z.useState)(100),[n,r]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u=be(c.trim(),300),[d,m]=(0,Z.useState)(!1),h=ae(e=>e.user),{can:g}=ie(),y=g(`OmnitronAudit.list`)&&g(`OmnitronAudit.available`),b=(0,Z.useMemo)(()=>({limit:e,...n&&{resourceType:n},...u&&{action:u},...a===`local`?{actorType:`user`,actorId:Te}:a?{actorType:a}:{}}),[e,n,a,u]),S=JSON.stringify([h?.id,y,b]),w=(0,Z.useRef)(S);w.current=S;let T=(0,Z.useRef)(null),[E,O]=(0,Z.useState)(null);(0,Z.useEffect)(()=>(O(null),()=>{T.current=null}),[S]);let j=E?.scope===S?E:null,N=(0,Z.useCallback)(async()=>(await i.available()).available?{available:!0,rows:await i.list(b)}:{available:!1,rows:[]},[b]),{data:P,error:F,loading:I,refresh:L}=oe(N,{intervalMs:15e3,paused:d,enabled:y,resourceKey:S,describeError:e=>`Could not read the audit trail: ${e instanceof Error?e.message:String(e)}`}),R=j?.rows??P?.rows??[],B=()=>{T.current=null,O(null),L()},re=()=>{d&&(T.current=null,O(null),L()),m(e=>!e)},V=async()=>{if(!y||T.current||j?.pending||!R.length)return;let t=Symbol(`audit-history`);T.current=t;let n=R;m(!0),O({scope:S,rows:n,pending:!0,exhausted:!1,error:null});try{let r=await i.list({...b,beforeId:n[n.length-1].id});if(T.current!==t||w.current!==S)return;let a=new Set(n.map(e=>e.id)),o=r.filter(e=>!a.has(e.id));if(r.length&&!o.length)throw Error(`History cursor did not advance. Refresh the latest events.`);O({scope:S,rows:[...n,...o],pending:!1,exhausted:r.length<e,error:null})}catch(e){if(T.current!==t||w.current!==S)return;O({scope:S,rows:n,pending:!1,exhausted:!1,error:`Could not read older events: ${e instanceof Error?e.message:String(e)}`})}finally{T.current===t&&(T.current=null)}},H=[...new Set([...Me,n,...R.map(e=>e.resourceType)])].filter(Boolean).sort(),U=!!(n||a||c);return(0,Q.jsxs)(f,{sx:{minWidth:0},children:[(0,Q.jsx)(me,{heading:`Audit`,links:[{name:`Console`,href:`/`},{name:`Audit`}],sx:{mb:2}}),(0,Q.jsxs)(M,{direction:`row`,sx:{gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,Q.jsx)(D,{variant:`body2`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:`Control-plane audit · all projects`}),y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(D,{variant:`caption`,role:`status`,color:`text.secondary`,children:j?.pending?`Reading history…`:I&&!j?`Reading…`:P?.available?`${R.length} matching events${j?` · history`:` · latest`}`:`No reading`}),(0,Q.jsx)(v,{title:d?`Resume audit updates`:`Pause audit updates`,children:(0,Q.jsx)(A,{size:`small`,"aria-label":d?`Resume audit updates`:`Pause audit updates`,onClick:re,children:d?(0,Q.jsx)(ue,{}):(0,Q.jsx)(se,{})})}),(0,Q.jsx)(p,{size:`small`,variant:`outlined`,label:d?`Paused`:`Live`,sx:{height:22}}),(0,Q.jsx)(v,{title:`Refresh audit`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(A,{size:`small`,"aria-label":`Refresh audit`,disabled:I,loading:I,onClick:B,children:(0,Q.jsx)(le,{})})})})]})]}),y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(f,{component:`section`,"aria-label":`Audit filters`,sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 128px), 1fr))`,gap:1.5,mb:2},children:[(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Resource`,value:n,onChange:e=>r(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All resources`}),H.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))]}),(0,Q.jsxs)(x,{fullWidth:!0,select:!0,size:`small`,label:`Actor`,value:a,onChange:e=>o(e.target.value),slotProps:{inputLabel:{shrink:!0},select:{displayEmpty:!0}},sx:{minWidth:0},children:[(0,Q.jsx)(k,{value:``,children:`All actors`}),(0,Q.jsx)(k,{value:`local`,children:`Local client`}),(0,Q.jsx)(k,{value:`user`,children:`User identities`}),(0,Q.jsx)(k,{value:`service`,children:`Service`}),(0,Q.jsx)(k,{value:`system`,children:`System`})]}),(0,Q.jsx)(x,{fullWidth:!0,size:`small`,label:`Action (exact)`,placeholder:`stack.start`,value:c,onChange:e=>l(e.target.value),sx:{minWidth:0}}),(0,Q.jsx)(x,{fullWidth:!0,select:!0,size:`small`,label:`Latest entries`,value:e,onChange:e=>t(Number(e.target.value)),sx:{minWidth:0},children:Ne.map(e=>(0,Q.jsx)(k,{value:e,children:e},e))})]}),U&&(0,Q.jsx)(s,{size:`small`,sx:{mb:1},onClick:()=>{r(``),o(``),l(``)},children:`Reset filters`}),F&&(0,Q.jsxs)(z,{severity:`error`,sx:{mb:2},action:(0,Q.jsx)(s,{color:`inherit`,size:`small`,onClick:()=>void L(),children:`Retry`}),children:[F,P&&` The last reading is retained.`]}),I&&!P&&(0,Q.jsx)(ge,{variant:`rectangular`,height:280}),P&&!P.available&&(0,Q.jsx)(z,{severity:`info`,children:`This daemon has no audit storage. No event history is available.`}),P?.available&&R.length===0&&(0,Q.jsx)(ye,{title:U?`No matching events`:`Nothing recorded yet`,description:U?`Change the filters to read another part of the trail.`:`Recorded control-plane actions will appear here.`}),P?.available&&R.length>0&&(0,Q.jsx)(f,{sx:{border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:(0,Q.jsx)(fe,{label:`Audit events`,children:(0,Q.jsxs)(te,{size:`small`,"aria-label":`Audit events`,sx:{tableLayout:`fixed`},children:[(0,Q.jsx)(ne,{children:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(_,{sx:{width:40,px:.5},children:(0,Q.jsx)(f,{component:`span`,sx:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:`Details`})}),(0,Q.jsx)(_,{sx:{width:132,display:{xs:`none`,sm:`table-cell`}},children:(0,Q.jsx)(v,{title:`Local time; exact UTC is available in the event details`,children:(0,Q.jsx)(`span`,{children:`Recorded`})})}),(0,Q.jsx)(_,{children:`Event / resource`}),(0,Q.jsx)(_,{sx:{width:192,display:{xs:`none`,md:`table-cell`}},children:`Actor`})]})}),(0,Q.jsx)(ee,{children:R.map(e=>(0,Q.jsx)(ke,{row:e},e.id))})]})})}),j?.error&&(0,Q.jsx)(z,{severity:`error`,sx:{mt:1},children:j.error}),P?.available&&R.length>0&&(0,Q.jsxs)(M,{direction:`row`,sx:{mt:1,gap:1,alignItems:`center`,flexWrap:`wrap`},children:[(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,sx:{flex:`1 1 180px`},children:j?`Updates paused while reading history. Resume to return to the latest events.`:`Newest first. This count is the current reading, not the entire trail.`}),(j?!j.exhausted:R.length===e)&&(0,Q.jsx)(s,{size:`small`,disabled:j?.pending,loading:j?.pending,onClick:()=>void V(),children:j?.error?`Retry older events`:`Load older`}),j?.exhausted&&(0,Q.jsx)(D,{variant:`caption`,color:`text.secondary`,children:`Start of matching history`})]})]}):(0,Q.jsx)(z,{severity:`info`,children:`Your role cannot read the control-plane audit trail.`})]})}var Z,Q,Me,Ne;function $(){return($=e((()=>{Z=t(),c(),l(),u(),O(),j(),N(),h(),b(),E(),S(),w(),T(),y(),g(),de(),R(),ve(),he(),xe(),pe(),Ae(),ce(),r(),U(),H(),V(),K(),Q=n(),Me=[`stack`,`release`,`project`,`node`,`kernel-rollout`,`pipeline`,`secret`,`terminal`,`account`,`app`,`file`],Ne=[50,100,250,500]})))()}$();export{je as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{O as r,P as i,h as a,m as o,z as s}from"./client-DFnuv2z3.js";import{n as c,r as ee}from"./services-BddvcFi8.js";import{Vt as l,Yt as u}from"./mui-BTN91yBK.js";import{D as d,F as te,H as f,I as p,M as m,O as h,Q as g,V as _,Z as v,c as y,d as b,f as x,g as S,h as C,j as w,m as T,p as E,s as D}from"./mui-BXSXx9c9.js";import{B as O,F as k,I as ne,z as A}from"./mui-Cd711nOk.js";import{B as j,C as re,it as M,rt as N,w as P,z as F}from"./mui-AnEgAVjz.js";import{_ as I,v as L}from"./mui-BwsIrivo.js";import{r as R,t as z}from"./alert-uBG6r9NW.js";import{c as ie,n as B,s as V}from"./access-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{O as r,P as i,h as a,m as o,z as s}from"./client-DFnuv2z3.js";import{n as c,r as ee}from"./services-BddvcFi8.js";import{Vt as l,Yt as u}from"./mui-BTN91yBK.js";import{D as d,F as te,H as f,I as p,M as m,O as h,Q as g,V as _,Z as v,c as y,d as b,f as x,g as S,h as C,j as w,m as T,p as E,s as D}from"./mui-BXSXx9c9.js";import{B as O,F as k,I as ne,z as A}from"./mui-Cd711nOk.js";import{B as j,C as re,it as M,rt as N,w as P,z as F}from"./mui-AnEgAVjz.js";import{_ as I,v as L}from"./mui-BwsIrivo.js";import{r as R,t as z}from"./alert-uBG6r9NW.js";import{c as ie,n as B,s as V}from"./access-BvKK9dEv.js";import{n as ae,t as H}from"./use-polled-resource-B22hhr5L.js";import{i as U,r as oe,t as W}from"./project.store-DuCgv6Eq.js";import{C as se,G,M as ce,k as le,l as ue,u as K,z as de}from"./icons-OboZgWSt.js";import{n as q,t as fe}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as pe,t as me}from"./admin-data-table-BKSDI8sU.js";import{n as J,t as he}from"./confirm-dialog-BbGsAz7_.js";import{n as Y,t as ge}from"./skeleton-BmWDJWF9.js";import{n as _e,t as ve}from"./use-stack-context-8yaHaN8L.js";function ye(e){let t=Object.entries(e??{});return t.length===0?`--`:t.sort(([,e],[,t])=>e-t).map(([e,t])=>`${e}→${t}`).join(`, `)}function X({title:e,value:t,icon:n,color:r,loading:i}){return(0,Q.jsx)(w,{variant:`outlined`,children:(0,Q.jsx)(d,{sx:{p:{xs:1.5,sm:2},"&:last-child":{pb:{xs:1.5,sm:2}}},children:(0,Q.jsxs)(I,{direction:`row`,spacing:2,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,Q.jsxs)(I,{spacing:.5,children:[(0,Q.jsx)(A,{variant:`body2`,sx:{color:`text.secondary`},children:e}),i?(0,Q.jsx)(ge,{width:60,height:40}):(0,Q.jsx)(A,{variant:`h4`,sx:{fontSize:{xs:24,sm:28}},children:t})]}),(0,Q.jsx)(_,{sx:{p:1.5,borderRadius:2,bgcolor:e=>l(e.palette[r].main,.12),color:`${r}.main`,display:{xs:`none`,sm:`flex`}},children:n})]})})})}function be({open:e,containerName:t,logs:n,onClose:r}){return(0,Q.jsxs)(C,{open:e,onClose:r,maxWidth:`md`,fullWidth:!0,children:[(0,Q.jsxs)(D,{sx:{fontFamily:`monospace`},children:[`Logs: `,t]}),(0,Q.jsx)(b,{dividers:!0,sx:{minHeight:0,maxHeight:`min(60dvh, 560px)`},children:(0,Q.jsx)(_,{component:`pre`,sx:{m:0,color:`text.primary`,fontFamily:`monospace`,fontSize:12,lineHeight:1.6,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:n.length===0?`No logs available.`:n.join(`
|
|
2
2
|
`)})}),(0,Q.jsx)(E,{children:(0,Q.jsx)(te,{onClick:r,size:`small`,children:`Close`})})]})}function xe(){let{activeProject:e,activeStack:t}=_e(),{can:n}=ie(),a=n(`OmnitronProject.listStacks`),s=U(e=>e.fetchStacks),c=U(t=>e?t.stacksByProject[e]:void 0),l=U(t=>e?t.stackReadErrors[e]:null);(0,Z.useEffect)(()=>{e&&a&&c===void 0&&s(e)},[e,a,c,s]);let u=oe().filter(e=>a&&e.type!==`local`&&(!t||e.name===t)),{data:d,loading:f,error:p,refresh:m}=ae(async()=>{let e=await o.listContainers();return Array.isArray(e)?e:[]},{intervalMs:1e4,describeError:e=>`Could not ask the container runtime: ${e instanceof Error?e.message:String(e)}`}),[h,g]=(0,Z.useState)(null),y=(0,Z.useRef)(new Set),[b,x]=(0,Z.useState)({}),S=async()=>{await Promise.all([m(),e&&a?s(e):null])},C=async(e,t,n,i=!0)=>{if(!y.current.has(e)){y.current.add(e),x(n=>({...n,[e]:t})),g(null);try{await n()}catch(n){g(i&&(r(n)||ee(n))?`${t} ${e}: acknowledgement unavailable. The operation may have completed. Check the current container state before retrying.`:`${t} ${e} failed: ${n instanceof Error?n.message:String(n)}`)}finally{i&&await m(),y.current.delete(e),x(t=>{let n={...t};return delete n[e],n})}}},[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(0),[O,ne]=(0,Z.useState)(25);(0,Z.useEffect)(()=>D(0),[e,t]);let j=(d??[]).filter(n=>!e||!n.project||n.project===e&&(!t||n.stack===t)),[M,P]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(``),[V,H]=(0,Z.useState)([]),W=d!==null,G=e=>W?e:`—`,q=j.length,pe=j.filter(e=>e.status===`running`).length,J=j.filter(e=>e.status===`exited`).length,Y=j.filter(e=>e.health===`unhealthy`||e.health===`starting`||e.error||e.provisioning&&e.provisioning!==`ready`).length,ge=e=>C(e,`Starting`,async()=>{await o.startContainer({name:e})}),ve=e=>C(e,`Stopping`,async()=>{await o.stopContainer({name:e})}),xe=async()=>{if(!w)return;let e=w;await C(e,`Removing`,async()=>{await o.removeContainer({name:e}),T(null)})},$=e=>C(e.name,`Loading logs`,async()=>{let{logs:t}=await o.getContainerLogs({name:e.name,tail:200});R(e.name),H(t?t.split(`
|
|
3
3
|
`):[]),P(!0)},!1),we=j.slice(E*O,E*O+O);return(0,Q.jsxs)(I,{spacing:3,children:[(0,Q.jsx)(B,{permission:`OmnitronInfra.removeContainer`,children:(0,Q.jsx)(he,{open:w!==null,onClose:()=>T(null),onConfirm:xe,title:`Remove container?`,content:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`b`,{children:w}),` will be removed. Data outside a named volume is lost, and the daemon recreates the container on the next `,(0,Q.jsx)(`code`,{children:`omnitron up`}),`.`]}),confirmLabel:`Remove`,confirmColor:`error`})}),(0,Q.jsx)(fe,{links:[{name:`Containers`}],action:(0,Q.jsx)(N,{"data-console-command":`refresh`,size:`small`,onClick:S,title:`Refresh`,"aria-label":`Refresh local containers and stack locations`,children:(0,Q.jsx)(ce,{})})}),(0,Q.jsxs)(I,{direction:`row`,spacing:1,useFlexGap:!0,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,Q.jsx)(v,{size:`small`,variant:`outlined`,label:`Local node`}),(0,Q.jsx)(A,{variant:`caption`,sx:{color:`text.secondary`},children:`This controller's Docker engine. Counts include the visible project, control-plane and unassigned containers, not remote nodes.`})]}),e&&(!a||c===void 0||l)&&(0,Q.jsxs)(z,{severity:l?`warning`:`info`,variant:`outlined`,children:[a?l?`Stack locations unavailable: ${l}`:`Loading stack locations… Remote infrastructure is not included in this local inventory.`:`Stack locations are unavailable with your current permissions.`,a&&l&&(0,Q.jsx)(te,{size:`small`,onClick:()=>void s(e),children:`Retry stack locations`})]}),h&&(0,Q.jsx)(z,{closable:!0,severity:`warning`,variant:`outlined`,onClose:()=>g(null),children:h}),u.length>0&&(0,Q.jsxs)(A,{variant:`body2`,sx:{color:`text.secondary`},children:[`Remote infrastructure:`,` `,u.map((e,t)=>(0,Q.jsxs)(`span`,{children:[t>0&&`, `,(0,Q.jsx)(re,{component:i,to:`/stacks/${encodeURIComponent(e.name)}`,children:e.name})]},e.name))]}),(0,Q.jsxs)(F,{container:!0,spacing:{xs:1.5,sm:3},children:[(0,Q.jsx)(F,{size:{xs:6,md:3},children:(0,Q.jsx)(X,{title:`Local total`,value:G(q),icon:(0,Q.jsx)(K,{}),color:`primary`,loading:f})}),(0,Q.jsx)(F,{size:{xs:6,md:3},children:(0,Q.jsx)(X,{title:`Running`,value:G(pe),icon:(0,Q.jsx)(K,{}),color:`success`,loading:f})}),(0,Q.jsx)(F,{size:{xs:6,md:3},children:(0,Q.jsx)(X,{title:`Stopped`,value:G(J),icon:(0,Q.jsx)(K,{}),color:J>0?`error`:`info`,loading:f})}),(0,Q.jsx)(F,{size:{xs:6,md:3},children:(0,Q.jsx)(X,{title:`Not ready`,value:G(Y),icon:(0,Q.jsx)(K,{}),color:Y>0?`error`:`success`,loading:f})})]}),(0,Q.jsx)(me,{minWidth:640,scrollLabel:`Local containers`,columns:[{key:`name`,header:`Name`,render:e=>(0,Q.jsxs)(_,{children:[(0,Q.jsx)(A,{variant:`body2`,sx:{fontWeight:600},children:e.name}),b[e.name]&&(0,Q.jsxs)(A,{variant:`caption`,role:`status`,sx:{color:`text.secondary`},children:[b[e.name],`…`]})]})},{key:`scope`,header:`Scope`,render:e=>(0,Q.jsx)(A,{variant:`caption`,sx:{color:`text.secondary`},children:e.project?`${e.project}${e.stack?` / ${e.stack}`:``}`:e.lifecycleRestriction?`Control plane`:`Unassigned`})},{key:`image`,header:`Image`,render:e=>(0,Q.jsx)(A,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:13},children:e.image})},{key:`status`,header:`Status`,render:e=>(0,Q.jsx)(v,{label:e.status,size:`small`,color:Se[e.status]??`default`,variant:`filled`,sx:{textTransform:`capitalize`,fontWeight:600}})},{key:`health`,header:`Health`,render:e=>(0,Q.jsx)(v,{label:!e.health||e.health===`none`?`Not reported`:e.health,size:`small`,color:Ce[e.health??`none`]??`default`,variant:`outlined`,sx:{textTransform:`capitalize`}})},{key:`provisioning`,header:`Setup`,render:e=>(0,Q.jsxs)(I,{spacing:.5,sx:{minWidth:120,maxWidth:320},children:[(0,Q.jsx)(v,{label:e.provisioning??`Not verified`,size:`small`,variant:`outlined`,color:e.provisioning===`ready`?`success`:e.provisioning===`failed`?`error`:e.provisioning===`pending`?`warning`:`default`,sx:{alignSelf:`flex-start`,textTransform:`capitalize`}}),e.error&&(0,Q.jsx)(A,{variant:`caption`,color:`error.main`,sx:{overflowWrap:`anywhere`},children:e.error})]})},{key:`ports`,header:`Ports`,render:e=>(0,Q.jsx)(A,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:12},children:ye(e.ports)})},{key:`actions`,header:`Actions`,align:`right`,render:e=>(0,Q.jsxs)(I,{direction:`row`,spacing:.5,sx:{justifyContent:`flex-end`},children:[e.lifecycleRestriction?(0,Q.jsx)(k,{title:e.lifecycleRestriction,children:(0,Q.jsx)(v,{tabIndex:0,size:`small`,variant:`outlined`,label:`Read only`,"aria-label":`Read only. ${e.lifecycleRestriction}`})}):(0,Q.jsx)(B,{permission:`OmnitronInfra.removeContainer`,children:(0,Q.jsx)(k,{title:`Remove`,children:(0,Q.jsx)(N,{size:`small`,color:`error`,disabled:!!b[e.name],loading:b[e.name]===`Removing`,"aria-label":`Remove container ${e.name}`,onClick:()=>T(e.name),sx:{marginInlineEnd:1},children:(0,Q.jsx)(ue,{fontSize:`small`})})})}),(0,Q.jsx)(k,{title:`Logs`,children:(0,Q.jsx)(N,{size:`small`,disabled:!!b[e.name],loading:b[e.name]===`Loading logs`,"aria-label":`Logs for ${e.name}`,onClick:()=>$(e),children:(0,Q.jsx)(se,{fontSize:`small`})})}),!e.lifecycleRestriction&&e.status!==`running`&&(0,Q.jsx)(B,{permission:`OmnitronInfra.startContainer`,children:(0,Q.jsx)(k,{title:`Start`,children:(0,Q.jsx)(N,{size:`small`,color:`success`,disabled:!!b[e.name],loading:b[e.name]===`Starting`,"aria-label":`Start container ${e.name}`,onClick:()=>ge(e.name),children:(0,Q.jsx)(le,{fontSize:`small`})})})}),!e.lifecycleRestriction&&e.status===`running`&&(0,Q.jsx)(B,{permission:`OmnitronInfra.stopContainer`,children:(0,Q.jsx)(k,{title:`Stop`,children:(0,Q.jsx)(N,{size:`small`,color:`warning`,disabled:!!b[e.name],loading:b[e.name]===`Stopping`,"aria-label":`Stop container ${e.name}`,onClick:()=>ve(e.name),children:(0,Q.jsx)(de,{fontSize:`small`})})})})]})}],data:we,total:j.length,loading:f,loadError:p??null,emptyMessage:`No local containers in this scope. Remote infrastructure is shown on its stack page.`,rowKey:e=>e.name,page:E,pageSize:O,onPageChange:D,onPageSizeChange:e=>{ne(e),D(0)},dense:!0}),(0,Q.jsx)(be,{open:M,containerName:L,logs:V,onClose:()=>P(!1)})]})}var Z,Q,Se,Ce;function $(){return($=e((()=>{V(),Z=t(),f(),j(),m(),h(),O(),L(),g(),p(),M(),ne(),S(),y(),x(),T(),u(),G(),pe(),R(),q(),J(),Y(),a(),s(),P(),ve(),W(),H(),c(),Q=n(),Se={running:`success`,exited:`error`,created:`default`,restarting:`warning`,paused:`info`},Ce={healthy:`success`,unhealthy:`error`,none:`default`,starting:`warning`}})))()}$();export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,c as i,h as a,v as ee,z as o}from"./client-DFnuv2z3.js";import{D as s,E as c,F as te,H as l,I as u,M as d,O as f,Q as p,T as m,V as h,Z as g,j as _}from"./mui-BXSXx9c9.js";import{B as v,a as ne,o as y,z as b}from"./mui-Cd711nOk.js";import{B as x,C as S,l as C,u as w,w as T,z as E}from"./mui-AnEgAVjz.js";import{_ as D,v as O}from"./mui-BwsIrivo.js";import{r as k,t as A}from"./alert-uBG6r9NW.js";import{r as re,t as j}from"./use-polled-resource-B22hhr5L.js";import{i as M,l as ie,r as ae,t as N,u as oe}from"./project.store
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,c as i,h as a,v as ee,z as o}from"./client-DFnuv2z3.js";import{D as s,E as c,F as te,H as l,I as u,M as d,O as f,Q as p,T as m,V as h,Z as g,j as _}from"./mui-BXSXx9c9.js";import{B as v,a as ne,o as y,z as b}from"./mui-Cd711nOk.js";import{B as x,C as S,l as C,u as w,w as T,z as E}from"./mui-AnEgAVjz.js";import{_ as D,v as O}from"./mui-BwsIrivo.js";import{r as k,t as A}from"./alert-uBG6r9NW.js";import{r as re,t as j}from"./use-polled-resource-B22hhr5L.js";import{i as M,l as ie,r as ae,t as N,u as oe}from"./project.store-DuCgv6Eq.js";import{n as P,t as F}from"./realtime.store-hfxZD2DU.js";import{a as I,u as se}from"./app-address-BCXfN59F.js";import{i as L,r as R}from"./constants-CyhngVXh.js";import{n as z,t as ce}from"./page-breadcrumbs-fR7Jmpp4.js";import{s as B}from"./formatters-RnRy4bXm.js";import{n as V,t as H}from"./use-stack-context-8yaHaN8L.js";import{i as U,n as W,r as G,s as K}from"./metric-series-WxePniyw.js";import{n as q,t as le}from"./comparison-bars-BtC0dHjF.js";import{n as J,r as ue}from"./card-DkH32gMY.js";function de({apps:e}){let[t,n]=(0,Y.useState)(`memory`),r=t===`memory`?W:G,i=e.filter(e=>Number.isFinite(e[t])&&e[t]>=0).sort((e,n)=>n[t]-e[t]).slice(0,6),a=i.map(n=>({id:n.key,name:e.some(e=>e.name===n.name&&e.key!==n.key)?`${n.name} · ${n.key}`:n.name,value:n[t]}));return(0,X.jsxs)(_,{variant:`outlined`,children:[(0,X.jsx)(m,{title:`Resource distribution`,subheader:i.length?`Top ${i.length} · latest readings, scaled to largest`:`Latest readings`,slotProps:{title:{variant:`subtitle2`},subheader:{variant:`caption`}},action:(0,X.jsxs)(ne,{select:!0,size:`small`,label:`Resource`,value:t,onChange:e=>n(e.target.value),sx:{minWidth:130},children:[(0,X.jsx)(C,{value:`memory`,children:`Memory`}),(0,X.jsx)(C,{value:`cpu`,children:`CPU`})]})}),(0,X.jsx)(s,{sx:{pt:0,px:{xs:1.5,sm:2}},children:i.length?(0,X.jsx)(le,{label:t===`memory`?`Resident memory by application`:`CPU by application`,items:a,format:r}):(0,X.jsx)(b,{variant:`body2`,color:`text.secondary`,children:`No resource readings available.`})})]})}var Y,X;function Z(){return(Z=e((()=>{Y=t(),d(),f(),c(),w(),y(),v(),q(),U(),X=n()})))()}function fe({app:e}){return(0,$.jsx)(_,{variant:`outlined`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}},children:(0,$.jsxs)(s,{sx:{p:2,"&:last-child":{pb:2}},children:[(0,$.jsxs)(D,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`,mb:1.5},children:[(0,$.jsx)(b,{variant:`subtitle2`,sx:{minWidth:0,flex:`1 1 100px`,overflowWrap:`anywhere`},children:e.remote?e.name:(0,$.jsx)(S,{component:r,to:`/apps/${encodeURIComponent(e.key)}`,color:`inherit`,underline:`hover`,children:e.name})}),(0,$.jsx)(g,{label:e.status,color:L(e.status),size:`small`,variant:`outlined`})]}),(0,$.jsx)(h,{sx:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:1.5},children:[{label:`CPU`,value:G(e.cpu)},{label:`Resident memory`,value:W(e.memory)},{label:`Uptime`,value:B(e.uptime)},{label:`Restarts`,value:e.restarts}].map(e=>(0,$.jsxs)(h,{sx:{minWidth:0},children:[(0,$.jsx)(b,{variant:`caption`,color:`text.secondary`,children:e.label}),(0,$.jsx)(b,{variant:`body2`,sx:{fontVariantNumeric:`tabular-nums`,overflowWrap:`anywhere`},children:e.value})]},e.label))}),!!e.processes?.length&&(0,$.jsxs)(b,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:1.5},children:[e.processes.filter(e=>e.status===`online`).length,`/`,e.processes.length,` processes online`]})]})})}function pe({apps:e,activeStack:t,activeProject:n}){if(t||e.every(e=>e.stack===null))return(0,$.jsx)(E,{container:!0,spacing:1.5,children:e.map(e=>(0,$.jsx)(E,{size:{xs:12,sm:6,md:4,lg:3},children:(0,$.jsx)(fe,{app:e})},e.key))});let r=new Map;for(let t of e){let e=n?t.stack??`default`:t.key.includes(`/`)?t.key.split(`/`).slice(0,2).join(`/`):`Local`;r.has(e)||r.set(e,[]),r.get(e).push(t)}return(0,$.jsx)(D,{spacing:3,children:Array.from(r.entries()).map(([e,t])=>(0,$.jsxs)(h,{children:[(0,$.jsxs)(D,{direction:`row`,sx:{alignItems:`center`,gap:1,flexWrap:`wrap`,mb:1.5},children:[(0,$.jsx)(h,{sx:{width:8,height:8,borderRadius:`50%`,bgcolor:t.every(e=>e.status===`online`)?`success.main`:`warning.main`}}),(0,$.jsxs)(b,{variant:`subtitle2`,sx:{fontWeight:700,textTransform:`uppercase`,letterSpacing:.5,overflowWrap:`anywhere`},children:[e,t.some(e=>e.remote)?` · remote`:``]}),(0,$.jsxs)(b,{variant:`caption`,sx:{color:`text.secondary`},children:[t.filter(e=>e.status===`online`).length,`/`,t.length,` online`]})]}),(0,$.jsx)(E,{container:!0,spacing:1.5,children:t.map(e=>(0,$.jsx)(E,{size:{xs:12,sm:6,md:4,lg:3},children:(0,$.jsx)(fe,{app:e})},e.key))})]},e))})}function me(){return(0,$.jsx)($.Fragment,{children:Array.from({length:4}).map((e,t)=>(0,$.jsx)(E,{size:{xs:6,sm:3},children:(0,$.jsx)(J,{label:``,value:``,loading:!0,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})},t))})}function he(){let{activeProject:e,activeStack:t}=V();return(0,$.jsx)(ge,{},JSON.stringify([e,t]))}function ge(){let[e,t]=(0,Q.useState)([]),[n,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(!0),d=(0,Q.useRef)(!1),[f,p]=(0,Q.useState)(null),{activeProject:m,activeStack:g}=V(),_=ae(),v=_.filter(e=>!g||e.name===g),ne=M(e=>!!m&&e.stacksByProject[m]!==void 0),y=(0,Q.useCallback)(async()=>{if(!d.current){d.current=!0;try{let[e,n,r]=await Promise.allSettled([m?M.getState().fetchStacks(m):Promise.resolve(null),i.list(),ee.getSnapshot()]);n.status===`fulfilled`&&t(n.value),r.status===`fulfilled`&&a(r.value);let o=[m&&(e.status===`rejected`||e.value===null)?`${m}'s apps`:null,n.status===`rejected`?`the app list`:null,r.status===`rejected`?`metrics`:null].filter(Boolean);if(o.length>0){let t=(e.status===`rejected`?e.reason?.message:m?M.getState().stackReadErrors[m]:null)??(n.status===`rejected`?n.reason?.message:null)??(r.status===`rejected`?r.reason?.message:null)??`the daemon did not answer`;l(`Could not refresh ${o.join(` and `)} — ${t}. Figures below are the last received.`);return}l(null),p(Date.now())}catch(e){l(e?.message??`Failed to connect to daemon`)}finally{d.current=!1,u.current&&=(s(!1),!1)}}},[m]),x=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{x.current?y():x.current=!0},[y]);let S=P(e=>e.connected),C=P(e=>e.lastEvent),w=P(e=>e.initialize);(0,Q.useEffect)(()=>w(),[w]),re(()=>void y(),{intervalMs:S?15e3:5e3}),(0,Q.useEffect)(()=>{C&&y()},[C,y]);let T=se(m,g,ne?ie(_):null,e),O=T??[],k=n?.apps??{},j=e=>e.remote||e.status!==`online`?void 0:k[e.key],N=O.length,F=O.filter(e=>e.status===`online`).length,I=O.filter(e=>e.status===`unknown`).length,L=N-F-I,R=O.map(e=>({...e,cpu:j(e)?.cpu??e.cpu,memory:j(e)?.memory??e.memory})),z=K(R.map(e=>e.cpu)),B=K(R.map(e=>e.memory)),{runningStacks:H,unknownStacks:U}=oe(v),q=M(e=>!!m&&e.stacksByProject[m]!==void 0);return(0,$.jsxs)(D,{spacing:2,sx:{minWidth:0},children:[(0,$.jsx)(ce,{heading:`Overview`,links:[{name:`Overview`}],action:m?(0,$.jsxs)(D,{direction:`row`,spacing:1,children:[(0,$.jsx)(te,{component:r,to:`/metrics`,size:`small`,children:`Metrics`}),(0,$.jsx)(te,{component:r,to:`/topology`,size:`small`,children:`Topology`})]}):void 0}),c&&(0,$.jsx)(A,{severity:`warning`,variant:`outlined`,children:c}),(0,$.jsx)(E,{container:!0,spacing:1.5,children:o||T===null?(0,$.jsx)(me,{}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{size:{xs:6,sm:3},children:(0,$.jsx)(J,{label:`Applications`,value:N===0?`0`:`${F}/${N}`,subtitle:N===0?`No apps yet`:[L>0?`${L} not online`:``,I>0?`${I} unknown`:``].filter(Boolean).join(` · `)||`All online`,color:N===0?`secondary`:L+I>0?`warning`:`success`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})}),(0,$.jsx)(E,{size:{xs:6,sm:3},children:(0,$.jsx)(J,{label:`Stacks`,value:m?q?`${H}/${v.length}`:`—`:new Set(O.map(e=>e.key.split(`/`).slice(0,-1).join(`/`)||`local`)).size,subtitle:m?`${H} running${U?` · ${U} unknown`:``}`:`On this daemon`,color:H>0?`primary`:`secondary`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})}),(0,$.jsx)(E,{size:{xs:6,sm:3},children:(0,$.jsx)(J,{label:`CPU`,value:G(z),subtitle:`Sum across selected apps`,color:`primary`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})}),(0,$.jsx)(E,{size:{xs:6,sm:3},children:(0,$.jsx)(J,{label:`Memory`,value:W(B),subtitle:`Resident bytes`,color:`info`,sx:{height:`100%`,"& h4":{fontSize:{xs:22,sm:26},overflowWrap:`anywhere`,fontVariantNumeric:`tabular-nums`}}})})]})}),f&&(0,$.jsxs)(b,{variant:`caption`,color:`text.secondary`,children:[m?`Selected deployments`:`This daemon’s applications`,` · received`,` `,new Date(f).toLocaleTimeString(),`. CPU can exceed 100%; memory has no inferred capacity limit.`]}),!o&&O.length>0&&(0,$.jsx)(de,{apps:R}),!o&&T!==null&&O.length===0&&(0,$.jsx)(A,{severity:`info`,variant:`outlined`,children:`No applications in this selection.`}),O.length>0&&(0,$.jsxs)(h,{children:[(0,$.jsx)(b,{variant:`h6`,sx:{fontWeight:700,mb:2},children:`Applications`}),(0,$.jsx)(pe,{apps:R,activeStack:g,activeProject:m})]})]})}var Q,$;function _e(){return(_e=e((()=>{z(),Q=t(),x(),d(),f(),v(),O(),l(),p(),T(),u(),o(),R(),U(),Z(),k(),ue(),a(),F(),j(),N(),H(),I(),$=n()})))()}_e();export{he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{c as r,h as i,n as a,v as o,x as s,y as c}from"./client-DFnuv2z3.js";import{F as l,H as u,I as d,Q as f,St as p,V as m,Z as h,c as g,d as _,f as v,g as y,h as b,i as x,m as S,p as C,r as w,s as T,xt as E}from"./mui-BXSXx9c9.js";import{B as D,a as O,o as k,z as A}from"./mui-Cd711nOk.js";import{B as j,U as ee,W as M,ct as N,d as te,f as ne,it as re,l as P,rt as ie,st as ae,u as oe,z as se}from"./mui-AnEgAVjz.js";import{S as ce,_ as F,n as le,t as ue,v as de,x as fe}from"./mui-BwsIrivo.js";import{r as pe,t as me}from"./alert-uBG6r9NW.js";import{n as he,t as ge}from"./error-boundary-CLLI8PWw.js";import{c as _e,s as ve}from"./access-48hkC2-P.js";import{n as I,t as ye}from"./use-polled-resource-B22hhr5L.js";import{a as be,n as xe}from"./storage-CKXnhqkt.js";import{a as Se,u as Ce}from"./app-address-BCXfN59F.js";import{A as we,G as Te,M as Ee,T as De,h as Oe}from"./icons-OboZgWSt.js";import{n as ke,t as Ae}from"./operation-status-Bm1x1wTz.js";import{n as je,t as Me}from"./page-breadcrumbs-fR7Jmpp4.js";import{i as Ne,s as Pe}from"./formatters-RnRy4bXm.js";import{n as Fe,t as Ie}from"./metric-chart-M-kI-XOt.js";import{n as Le,t as Re}from"./use-stack-context-UkBsF-l7.js";import{n as ze,t as Be}from"./empty-content-7jOFhG4C.js";import{n as Ve,r as He}from"./daemon-memory-BiEtr9jr.js";import{a as Ue,i as L,n as We,o as Ge,r as Ke,s as qe,t as R}from"./metric-series-WxePniyw.js";function Je(e=!1){let[t,n]=(0,z.useState)(e),r=(0,z.useCallback)(()=>{n(!0)},[]),i=(0,z.useCallback)(()=>{n(!1)},[]),a=(0,z.useCallback)(()=>{n(e=>!e)},[]);return(0,z.useMemo)(()=>({value:t,onTrue:r,onFalse:i,onToggle:a,setValue:n}),[t,r,i,a])}var z;function Ye(){return(Ye=e((()=>{z=t()})))()}function Xe(){let e=(0,B.useContext)(st);if(!e)throw Error(`useDashboardBlockContext must be used within DashboardBlock`);return e}function Ze({title:e,subtitle:t,icon:n,actions:r,sx:i}){let{collapsible:a,collapsed:o,toggleCollapse:s,size:c,labels:l}=Xe(),u=H[c];return(0,V.jsxs)(m,{"data-testid":`prism-dashboard-block-header`,sx:[{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2,px:u.headerPx,py:u.headerPy},...Array.isArray(i)?i:[i]],children:[(0,V.jsxs)(m,{sx:{display:`flex`,alignItems:`flex-start`,gap:1.5,flex:1,minWidth:0},children:[n&&(0,V.jsx)(m,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,mt:.25,color:`primary.main`},children:n}),(0,V.jsxs)(m,{sx:{flex:1,minWidth:0},children:[(0,V.jsx)(A,{variant:u.titleVariant,component:`h3`,sx:{fontWeight:600,lineHeight:1.4,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,overflowWrap:`anywhere`},children:e}),t&&(0,V.jsx)(A,{variant:u.subtitleVariant,sx:{color:`text.secondary`,mt:.25},children:t})]})]}),(0,V.jsxs)(m,{sx:{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0},children:[r,a&&(0,V.jsx)(ie,{size:`small`,onClick:s,"aria-expanded":!o,"aria-label":o?l.expand??`Expand block`:l.collapse??`Collapse block`,"data-testid":`prism-dashboard-block-collapse`,children:(0,V.jsx)(it,{direction:o?`down`:`up`})})]})]})}function Qe({children:e,disablePadding:t=!1,sx:n}){let{size:r}=Xe(),i=H[r];return(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-content`,sx:[{...!t&&{px:i.contentPx,py:i.contentPy}},...Array.isArray(n)?n:[n]],children:e})}function $e({children:e,divider:t=!0,sx:n}){let{collapsed:r,size:i}=Xe(),a=H[i];return r?null:(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(w,{}),(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-footer`,sx:[{px:a.contentPx,py:1.5},...Array.isArray(n)?n:[n]],children:e})]})}function et({rows:e=3,size:t}){let n=H[t];return(0,V.jsx)(m,{sx:{px:n.contentPx,py:n.contentPy},children:Array.from({length:e}).map((e,t)=>(0,V.jsx)(fe,{variant:`text`,animation:`wave`,sx:{height:20,mb:1}},t))})}function tt({message:e=`Failed to load data`,retryLabel:t=`Retry`,onRetry:n,size:r}){let i=H[r];return(0,V.jsxs)(m,{sx:{px:i.contentPx,py:i.contentPy,textAlign:`center`},children:[(0,V.jsx)(A,{color:`error`,variant:`body2`,sx:{mb:n?1.5:0},children:e}),n&&(0,V.jsx)(l,{size:`small`,onClick:n,children:t})]})}function nt({config:e,size:t}){let n=H[t];return e?.emptyComponent?e.emptyComponent:(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-empty`,sx:{px:n.contentPx,py:n.contentPy},children:(0,V.jsx)(Be,{compact:!0,icon:e?.icon,iconSize:48,title:e?.title,description:e?.description,action:e?.action})})}function rt({title:e,subtitle:t,icon:n,actions:r,children:i,footer:a,variant:o=`default`,size:s=`medium`,loading:c=!1,loadingConfig:l,error:u=!1,errorConfig:d,empty:f=!1,emptyConfig:p,labels:h=ot,catchErrors:g=!0,collapsible:_=!1,defaultCollapsed:v=!1,collapsed:y,onCollapseChange:b,disablePadding:x=!1,footerDivider:S=!0,sx:C,slotProps:T}){let D=Je(v),O=y!==void 0,k=O?y:D.value,A=(0,B.useCallback)(e=>{_&&e!==k&&(O||D.setValue(e),b?.(e))},[_,k,O,b,D]),j=(0,B.useCallback)(()=>A(!k),[k,A]),ee=(0,B.useMemo)(()=>({collapsible:_,collapsed:_?k:!1,toggleCollapse:_?j:at,setCollapsed:_?A:at,loading:c,error:u,variant:o,size:s,labels:h}),[k,_,j,A,c,u,o,s,h]),M=d?.message??h.error,N=c?l?.loadingComponent??(0,V.jsx)(et,{rows:l?.skeletonRows??3,size:s}):u?d?.errorComponent??(0,V.jsx)(tt,{message:M,retryLabel:h.retry,onRetry:d?.onRetry,size:s}):f?(0,V.jsx)(nt,{config:p,size:s}):i?(0,V.jsx)(Qe,{disablePadding:x,...T?.content,children:i}):null,te=o===`outlined`?`outlined`:`elevation`,ne=+(o==="default");return(0,V.jsx)(st.Provider,{value:ee,children:(0,V.jsxs)(ae,{"data-testid":`prism-dashboard-block`,variant:te,elevation:ne,sx:[{overflow:`hidden`,...o===`filled`&&{bgcolor:`action.hover`}},...Array.isArray(C)?C:[C]],children:[e&&(0,V.jsx)(Ze,{title:e,subtitle:t,icon:n,actions:r,...T?.header}),e&&(0,V.jsx)(w,{}),(0,V.jsx)(E,{in:!ee.collapsed,timeout:`auto`,children:(0,V.jsx)(m,{"aria-live":`polite`,"aria-busy":c,children:g?(0,V.jsx)(ge,{resetKeys:[c,u,f],fallback:({resetErrorBoundary:e})=>(0,V.jsx)(tt,{message:h.error,retryLabel:h.retry,onRetry:()=>{e(),d?.onRetry?.()},size:s}),children:N}):N})}),a&&!c&&!u&&(0,V.jsx)($e,{divider:S,...T?.footer,children:a})]})})}function it({direction:e}){return(0,V.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:e===`up`?`rotate(180deg)`:void 0,transition:`transform 0.2s ease`},children:(0,V.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}var B,V,at,ot,st,H;function ct(){return(ct=e((()=>{B=t(),u(),N(),D(),re(),p(),x(),ce(),d(),Ye(),he(),ze(),V=n(),at=()=>{},ot={},st=(0,B.createContext)(null),H={small:{headerPx:2,headerPy:1.5,contentPx:2,contentPy:1.5,titleVariant:`subtitle1`,subtitleVariant:`caption`},medium:{headerPx:2.5,headerPy:2,contentPx:2.5,contentPy:2,titleVariant:`h6`,subtitleVariant:`body2`},large:{headerPx:3,headerPy:2.5,contentPx:3,contentPy:2.5,titleVariant:`h5`,subtitleVariant:`body1`}}})))()}function U({label:e,value:t}){return(0,W.jsxs)(m,{sx:{display:`grid`,gridTemplateColumns:`minmax(0,1fr) auto`,alignItems:`baseline`,gap:1},children:[(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,sx:{overflowWrap:`anywhere`},children:e}),(0,W.jsx)(A,{component:`span`,variant:`body2`,sx:{fontVariantNumeric:`tabular-nums`},children:t})]})}function lt(e,t){switch(e){case`total_apps`:return t.length;case`online_apps`:return t.filter(e=>e.status===`online`).length;case`errored_apps`:return t.filter(e=>[`crashed`,`errored`].includes(e.status)).length;case`restarts`:return qe(t.map(e=>e.restarts))??`—`;case`total_cpu`:return Ke(qe(t.map(e=>e.cpu)));case`total_memory`:{let e=qe(t.map(e=>e.memory));return e===null?`—`:Ne(e)}default:return`—`}}function ut({panel:e,board:t,sources:n,actions:r}){let i=e.config.metric??`online_apps`,a=e.config.app,o=a?n.apps.data?.filter(e=>e.name===a):n.apps.data,s=a?`${n.subject} · ${a}`:n.subject;if(e.type===`cpu-chart`||e.type===`memory-chart`){let i=n.history,o=R[t.window],c=e.type===`cpu-chart`,l=(i.data?.series??[]).filter(e=>!a||e.app.split(`/`).at(-1)===a);return(0,W.jsx)(Ie,{title:e.title,actions:r,description:`${s} · ${o.label} · ${o.interval} averages`,lines:Ue(l,c?`cpu_percent`:`memory_bytes`,n.prefix,!1,i.data?.names??{},o.bucket,i.data?.scope),format:c?Ke:We,from:i.data?.from??Date.now()-o.duration,to:i.data?.to??Date.now(),loading:i.loading,error:i.error,height:220})}let c=e.type===`daemon-info`||e.type===`alert-summary`||e.type===`stat`&&i===`uptime`,l=e.type===`alert-summary`?n.alerts:c?n.status:n.apps,u;if(e.type===`stat`){let e=i===`uptime`?n.status.data?Pe(n.status.data.uptime):`—`:o&&(!a||o.length)?lt(i,o):`—`;u=(0,W.jsx)(A,{variant:`h4`,sx:{fontVariantNumeric:`tabular-nums`},children:e})}else if(e.type===`daemon-info`&&n.status.data){let e=n.status.data;u=(0,W.jsxs)(F,{spacing:.75,children:[(0,W.jsx)(U,{label:`Version`,value:e.version}),(0,W.jsx)(U,{label:`PID`,value:e.pid}),(0,W.jsx)(U,{label:`Uptime`,value:Pe(e.uptime)}),(0,W.jsx)(U,{label:`Resident memory`,value:Ne(Ve(e))})]})}else if(e.type===`alert-summary`&&n.alerts.data){let e=n.alerts.data;u=(0,W.jsxs)(F,{spacing:.75,children:[(0,W.jsx)(U,{label:`Firing`,value:e.firing}),(0,W.jsx)(U,{label:`Acknowledged`,value:e.acknowledged}),Object.entries(e.bySeverity).map(([e,t])=>(0,W.jsx)(U,{label:e,value:t},e))]})}else if(o&&(e.type===`app-grid`||e.type===`recent-errors`)){let t=e.type===`app-grid`?o:o.filter(e=>[`crashed`,`errored`].includes(e.status)||e.restarts>0);u=t.length?(0,W.jsx)(F,{spacing:.75,children:t.map(t=>(0,W.jsx)(U,{label:[t.stack,t.name].filter(Boolean).join(` / `),value:(0,W.jsxs)(F,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[e.type===`recent-errors`&&(0,W.jsxs)(`span`,{children:[t.restarts,` restarts`]}),(0,W.jsx)(h,{size:`small`,variant:`outlined`,label:t.status})]})},t.key))}):(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:e.type===`app-grid`?`No applications in this scope.`:`No observed failures or restarts in this scope.`})}return(0,W.jsxs)(rt,{title:e.title,subtitle:c?`Connected daemon`:s,actions:r,variant:`outlined`,size:`small`,sx:{height:`100%`,minWidth:0},loading:l.loading,error:!l.data&&!!l.error,errorConfig:{message:l.error??`Measurement unavailable`},children:[l.error&&l.data&&(0,W.jsxs)(A,{variant:`caption`,color:`warning.main`,children:[`Last observation · `,l.error]}),u]})}var W;function dt(){return(dt=e((()=>{u(),f(),de(),D(),ct(),Fe(),He(),L(),W=n()})))()}function G(e,t){return t?e:{data:null,loading:!1,error:`This session has no permission to read this source.`}}function ft(e,t){let{can:n}=_e(),{activeProject:i,activeStack:l,namespacePrefix:u}=Le(),d=n(`OmnitronDaemon.status`),f=i?n(`OmnitronProject.getProjectApps`):d,p=n(`OmnitronAlerts.getSummary`),m=n(`OmnitronNodes.listNodes`),h=n(`OmnitronMetrics.querySeries`)&&(!i||n(`OmnitronProject.listStacks`)&&m),g=e.panels.some(e=>e.type===`cpu-chart`||e.type===`memory-chart`),_=e.panels.some(e=>e.type===`alert-summary`),v=e.panels.some(e=>e.type===`app-grid`||e.type===`recent-errors`||e.type===`stat`&&e.config.metric!==`uptime`),y=!i&&v||e.panels.some(e=>e.type===`daemon-info`||e.type===`stat`&&e.config.metric===`uptime`),b=i?[i,l].filter(Boolean).join(` / `):`Connected daemon`,x=JSON.stringify([i,l]),S=e.refreshInterval,C=I(()=>r.status(),{intervalMs:S,paused:!t,enabled:y&&d,resourceKey:Number(d)}),w=I(async()=>{let e=await s.getProjectApps({project:i});return Ce(i,l,e,[])},{intervalMs:S,paused:!t,enabled:!!i&&v&&f,resourceKey:JSON.stringify([x,f])}),T=I(()=>a.getSummary(),{intervalMs:S,paused:!t,enabled:_&&p,resourceKey:Number(p)}),E=I(async()=>{let t=R[e.window],n=Date.now(),r=n-t.duration,[a,u,d]=await Promise.all([o.querySeries({names:[`cpu_percent`,`memory_bytes`],from:r,to:n,interval:t.interval,limit:120}),i?s.listStacks({project:i}):[],i?c.listNodes():[]]);return{series:i?a:a.filter(e=>!e.labels?.node),names:Object.fromEntries(d.map(e=>[e.id,e.name])),scope:i?Ge(i,l,u,d):void 0,from:r,to:n}},{intervalMs:S,paused:!t,enabled:g&&h,resourceKey:JSON.stringify([x,e.window,h])});return{sources:{subject:b,prefix:u,apps:G(i?w:{...C,data:C.data?Ce(null,null,null,C.data.apps):null},f),status:G(C,d),alerts:G(T,p),history:G(E,h)},refresh:()=>{let e=[],t=(t,n)=>{t&&e.push(n.refresh())};return t(g&&h,E),t(_&&p,T),t(y&&d,C),t(!!i&&v&&f,w),Promise.all(e)}}}function pt(){return(pt=e((()=>{ve(),i(),Re(),ye(),Se(),L()})))()}function mt(){let e=Ct(`Overview`),t=(e,t,n,r)=>({id:Z(),type:e,title:t,size:n,config:r?{metric:r}:{}});return e.panels=[t(`stat`,`Online`,`small`,`online_apps`),t(`stat`,`Errored`,`small`,`errored_apps`),t(`stat`,`CPU`,`small`,`total_cpu`),t(`stat`,`Memory`,`small`,`total_memory`),t(`cpu-chart`,`CPU history`,`large`),t(`memory-chart`,`Memory history`,`large`),t(`app-grid`,`Applications`,`large`),t(`daemon-info`,`Controller runtime`,`medium`),t(`recent-errors`,`Failures and restarts`,`medium`)],e}function K(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Expected a layout object.`);return e}function q(e,t,n=100){if(typeof e!=`string`||!e.trim()||e.trim().length>n)throw Error(`Invalid ${t} (1–${n} characters).`);return e.trim()}function J(e,t,n){if(typeof t!=`string`||!Object.hasOwn(e,t))throw Error(`Unsupported ${n}.`);return t}function ht(e){if(new Set(e.map(e=>e.id)).size!==e.length)throw Error(`Duplicate layout identifiers.`)}function gt(e){let t=K(e);if(!Array.isArray(t.panels)||t.panels.length>64)throw Error(`A dashboard supports up to 64 panels.`);let n=t.panels.map(e=>{let t=K(e),n=t.type===`uptime-chart`,r=n?`stat`:J(Y,t.type,`panel type`),i=K(t.config??{});return{id:q(t.id,`panel id`),title:q(t.title,`panel title`),type:r,size:J(bt,t.size,`panel size`),config:{...r===`stat`&&{metric:n?`uptime`:J(X,i.metric??`online_apps`,`statistic`)},...i.app&&typeof i.app==`string`?{app:q(i.app,`application`,256)}:{}}}});ht(n);let r=Number(t.refreshInterval??5e3);if(!xt.some(e=>e===r))throw Error(`Unsupported refresh interval.`);return{id:q(t.id,`dashboard id`),name:q(t.name,`dashboard name`),panels:n,refreshInterval:r,window:J(R,t.window??`15m`,`history window`)}}function _t(e){let t=JSON.parse(e);if(!Array.isArray(t)||!t.length||t.length>64)throw Error(`Expected 1–64 dashboard layouts.`);let n=t.map(gt);return ht(n),n}function vt(e){return JSON.stringify({format:`omnitron.dashboard`,version:1,board:e},null,2)}function yt(e){if(e.length>131072)throw Error(`Layout exceeds 128 KiB.`);let t=K(JSON.parse(e));if(t.format!==`omnitron.dashboard`||t.version!==1)throw Error(`Unsupported dashboard layout format or version.`);return{...gt(t.board),id:Z()}}var Y,X,bt,xt,St,Z,Ct;function wt(){return(wt=e((()=>{L(),Y={stat:`Metric`,"cpu-chart":`CPU history`,"memory-chart":`Memory history`,"app-grid":`Application status`,"daemon-info":`Controller runtime`,"alert-summary":`Controller alerts`,"recent-errors":`Application failures and restarts`},X={total_apps:`Applications`,online_apps:`Online`,errored_apps:`Errored`,total_cpu:`CPU`,total_memory:`Memory`,uptime:`Controller uptime`,restarts:`Restarts`},bt={small:`Compact`,medium:`Third width`,large:`Half width`,full:`Full width`},xt=[5e3,15e3,3e4,6e4],St=`omnitron_dashboards_v2`,Z=()=>crypto.randomUUID(),Ct=e=>({id:Z(),name:e,panels:[],refreshInterval:5e3,window:`15m`})})))()}function Tt(){let e=xe(St);try{return{raw:e,boards:e?_t(e):[mt()],error:null}}catch(t){return{raw:e,boards:[mt()],error:`Saved layouts could not be read. The original is preserved. ${Mt(t)}`}}}function Et({panel:e,edit:t,apps:n,onSave:r,onClose:i}){let[a,o]=(0,Q.useState)(e.type),[s,c]=(0,Q.useState)(e.title),[u,d]=(0,Q.useState)(e.size),[f,p]=(0,Q.useState)(e.config.metric??`online_apps`),[h,g]=(0,Q.useState)(e.config.app??``),v=a!==`daemon-info`&&a!==`alert-summary`&&(a!==`stat`||f!==`uptime`);return(0,$.jsx)(b,{open:!0,onClose:i,maxWidth:`xs`,fullWidth:!0,children:(0,$.jsxs)(m,{component:`form`,onSubmit:t=>{t.preventDefault(),r({id:e.id,type:a,size:u,title:s.trim()||(a===`stat`?X[f]:Y[a]),config:{...a===`stat`&&{metric:f},...v&&h.trim()&&{app:h.trim()}}})},children:[(0,$.jsx)(T,{children:t?`Edit panel`:`Add panel`}),(0,$.jsx)(_,{children:(0,$.jsxs)(F,{spacing:2,sx:{pt:1},children:[(0,$.jsx)(O,{select:!0,size:`small`,label:`Source`,value:a,onChange:e=>{let n=e.target.value;o(n),t||d(n===`stat`?`small`:`large`)},children:Object.entries(Y).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))}),a===`stat`&&(0,$.jsx)(O,{select:!0,size:`small`,label:`Metric`,value:f,onChange:e=>p(e.target.value),children:Object.entries(X).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))}),v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{size:`small`,label:`Application`,placeholder:`All applications in this scope`,value:h,onChange:e=>g(e.target.value),slotProps:{htmlInput:{list:`dashboard-app-names`,maxLength:256}},helperText:`An exact application name follows the selected workspace and stack.`}),(0,$.jsx)(`datalist`,{id:`dashboard-app-names`,children:n.map(e=>(0,$.jsx)(`option`,{value:e},e))})]}),(0,$.jsx)(O,{size:`small`,label:`Panel title`,placeholder:Y[a],value:s,onChange:e=>c(e.target.value),slotProps:{htmlInput:{maxLength:100}}}),(0,$.jsx)(O,{select:!0,size:`small`,label:`Width`,value:u,onChange:e=>d(e.target.value),children:Object.entries(bt).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))})]})}),(0,$.jsxs)(C,{children:[(0,$.jsx)(l,{onClick:i,children:`Cancel`}),(0,$.jsx)(l,{type:`submit`,variant:`contained`,children:`Save panel`})]})]})})}function Dt({mode:e,board:t,onSave:n,onClose:r}){let[i,a]=(0,Q.useState)(e===`create`?``:e===`duplicate`?`${t.name} copy`:t.name),[o,s]=(0,Q.useState)(t.refreshInterval),[c,u]=(0,Q.useState)(t.window),[d,f]=(0,Q.useState)(e===`export`?vt(t):``),[p,h]=(0,Q.useState)(``),g=e===`export`||e===`import`;return(0,$.jsx)(b,{open:!0,onClose:r,fullWidth:!0,maxWidth:g?`sm`:`xs`,children:(0,$.jsxs)(m,{component:`form`,onSubmit:a=>{a.preventDefault(),h(``);try{if(e===`export`){r();return}if(e===`delete`){n(null);return}if(e===`import`){n(yt(d));return}if(!i.trim())throw Error(`Enter a dashboard name.`);n({...e===`create`?Ct(i.trim()):{...t,id:e===`duplicate`?Z():t.id},name:i.trim(),refreshInterval:o,window:c})}catch(e){h(Mt(e))}},children:[(0,$.jsx)(T,{children:{create:`New dashboard`,settings:`Dashboard settings`,duplicate:`Duplicate dashboard`,delete:`Delete dashboard`,import:`Import layout`,export:`Export layout`}[e]}),(0,$.jsx)(_,{children:(0,$.jsxs)(F,{spacing:2,sx:{pt:1},children:[p&&(0,$.jsx)(me,{severity:`error`,children:p}),g?(0,$.jsx)(O,{multiline:!0,minRows:7,maxRows:16,size:`small`,label:`Layout JSON`,value:d,onChange:e=>f(e.target.value),slotProps:{input:{readOnly:e===`export`},htmlInput:{maxLength:131072,spellCheck:!1}},helperText:e===`export`?`Copy this versioned layout to another browser or workspace. Measurements are read at the destination.`:`A valid layout opens as a separate dashboard.`}):e===`delete`?(0,$.jsxs)(A,{children:[`Delete “`,t.name,`” and its `,t.panels.length,` panels from this browser?`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{label:`Dashboard name`,size:`small`,required:!0,value:i,onChange:e=>a(e.target.value),slotProps:{htmlInput:{maxLength:100}}}),(0,$.jsx)(O,{select:!0,size:`small`,label:`Refresh interval`,value:o,onChange:e=>s(Number(e.target.value)),children:xt.map(e=>(0,$.jsxs)(P,{value:e,children:[e/1e3,` seconds`]},e))}),(0,$.jsx)(O,{select:!0,size:`small`,label:`History window`,value:c,onChange:e=>u(e.target.value),children:Object.entries(R).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t.label},e))})]})]})}),(0,$.jsxs)(C,{children:[e!==`export`&&(0,$.jsx)(l,{onClick:r,children:`Cancel`}),(0,$.jsx)(l,{type:`submit`,variant:`contained`,color:e===`delete`?`error`:`primary`,children:e===`delete`?`Delete`:e===`export`?`Done`:e===`import`?`Import`:`Save`})]})]})})}function Ot(){let[e]=(0,Q.useState)(Tt),[t,n]=(0,Q.useState)(e.boards),[r,i]=(0,Q.useState)(()=>xe(kt)??``),a=t.find(e=>e.id===r)??t[0],[o,s]=(0,Q.useState)(e.error),c=(0,Q.useRef)(e.raw),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),{sources:C,refresh:w}=ft(a,f),T=e=>{i(e),be(kt,e)};(0,Q.useEffect)(()=>{let e=e=>{if(e.key===`omnitron_dashboards_v2`&&e.newValue!==c.current){if(y||x)s(`Layouts changed in another tab. Close the editor and reload before saving.`);else try{let t=e.newValue?_t(e.newValue):[mt()];c.current=e.newValue,n(t),s(null)}catch(e){s(Mt(e))}}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[y,x]);function E(t,r){if(e.error)return s(e.error),!1;if(xe(`omnitron_dashboards_v2`)!==c.current)return s(`Saved layouts changed. Reload before editing to preserve both versions.`),!1;let i=JSON.stringify(t),a=be(St,i);return a&&(c.current=i),s(a?null:`Browser storage unavailable. Changes apply to this session. Export the layout to keep it.`),n(t),T(r),!0}function D(e){return E(t.map(t=>t.id===a.id?{...t,panels:e}:t),a.id)}let k=e=>{v(null),b(e)},j=_?.panel,M=a.panels.findIndex(e=>e.id===j?.id),N=e=>{let t=[...a.panels],n=M+e;if(M>=0&&n>=0&&n<t.length){let[e]=t.splice(M,1);t.splice(n,0,e),D(t)}v(null)},ne=async()=>{g(!0);try{await w()}finally{g(!1)}};return(0,$.jsxs)(F,{spacing:2,sx:{minWidth:0},children:[(0,$.jsx)(Me,{links:[{name:`Dashboard Builder`}],action:(0,$.jsxs)(F,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[(0,$.jsx)(ee,{sx:{m:0},control:(0,$.jsx)(ue,{size:`small`,checked:f,onChange:e=>p(e.target.checked)}),label:`Live`}),(0,$.jsx)(ie,{size:`small`,"aria-label":`Refresh dashboard`,disabled:h,"data-console-command":`refresh`,onClick:()=>void ne(),children:(0,$.jsx)(Ee,{})}),(0,$.jsx)(l,{size:`small`,variant:u?`contained`:`text`,"aria-pressed":u,startIcon:(0,$.jsx)(Oe,{}),onClick:()=>d(!u),children:u?`Done`:`Edit layout`})]})}),(0,$.jsxs)(F,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(O,{select:!0,size:`small`,label:`Dashboard`,value:a.id,onChange:e=>T(e.target.value),sx:{minWidth:`10rem`,maxWidth:`100%`},children:t.map(e=>(0,$.jsx)(P,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(A,{variant:`caption`,color:`text.secondary`,children:[C.subject,` · `,R[a.window].label,` ·`,` `,f?`${a.refreshInterval/1e3} s refresh`:`Paused`]}),(0,$.jsx)(m,{sx:{flex:1}}),u&&(0,$.jsx)(l,{size:`small`,disabled:a.panels.length>=64,startIcon:(0,$.jsx)(we,{}),onClick:()=>S(jt()),children:`Add panel`}),(0,$.jsx)(ie,{size:`small`,"aria-label":`Dashboard options`,"aria-haspopup":`menu`,onClick:e=>v({anchor:e.currentTarget}),children:(0,$.jsx)(De,{})})]}),o&&(0,$.jsx)(me,{severity:`warning`,children:o}),(0,$.jsx)(Ae,{active:h,label:`Refreshing dashboard sources`}),!a.panels.length&&(0,$.jsxs)(me,{severity:`info`,children:[`This dashboard has no panels.`,` `,(0,$.jsx)(l,{size:`small`,onClick:()=>{d(!0),S(jt())},children:`Add panel`})]}),(0,$.jsx)(se,{container:!0,spacing:1.5,children:a.panels.map(e=>(0,$.jsx)(se,{size:At[e.size],sx:{minWidth:0},children:(0,$.jsx)(ut,{panel:e,board:a,sources:C,actions:u&&(0,$.jsx)(ie,{size:`small`,"aria-label":`Options for ${e.title}`,"aria-haspopup":`menu`,onClick:t=>v({anchor:t.currentTarget,panel:e}),children:(0,$.jsx)(De,{})})})},e.id))}),(0,$.jsx)(te,{open:!!_,anchorEl:_?.anchor??null,onClose:()=>v(null),children:j?[(0,$.jsx)(P,{onClick:()=>{S(j),v(null)},children:`Edit panel`},`edit`),(0,$.jsx)(P,{disabled:M<=0,onClick:()=>N(-1),children:`Move earlier`},`up`),(0,$.jsx)(P,{disabled:M===a.panels.length-1,onClick:()=>N(1),children:`Move later`},`down`),(0,$.jsx)(P,{onClick:()=>{D(a.panels.filter(e=>e.id!==j.id)),v(null)},children:`Remove from layout`},`remove`)]:[`settings`,`create`,`duplicate`,`import`,`export`,`delete`].map(e=>(0,$.jsx)(P,{disabled:e===`delete`&&t.length===1||[`create`,`duplicate`,`import`].includes(e)&&t.length>=64,onClick:()=>k(e),children:{settings:`Settings`,create:`New dashboard`,duplicate:`Duplicate`,import:`Import layout`,export:`Export layout`,delete:`Delete dashboard`}[e]},e))}),x&&(0,$.jsx)(Et,{panel:x,edit:a.panels.some(e=>e.id===x.id),apps:[...new Set(C.apps.data?.map(e=>e.name)??[])].sort(),onClose:()=>S(null),onSave:e=>{D(a.panels.some(t=>t.id===e.id)?a.panels.map(t=>t.id===e.id?e:t):[...a.panels,e])&&S(null)}}),y&&(0,$.jsx)(Dt,{mode:y,board:a,onClose:()=>b(null),onSave:e=>{let n=e?y===`settings`?t.map(t=>t.id===e.id?e:t):[...t,e]:t.filter(e=>e.id!==a.id);E(n,e?.id??n[0].id)&&(b(null),y===`create`&&d(!0))}})]})}var Q,$,kt,At,jt,Mt;function Nt(){return(Nt=e((()=>{Q=t(),u(),d(),y(),S(),v(),g(),M(),j(),re(),ne(),oe(),de(),le(),k(),D(),pe(),je(),dt(),ke(),pt(),Te(),L(),wt(),$=n(),kt=`omnitron_dashboard_active`,At={small:{xs:12,sm:6,lg:3},medium:{xs:12,sm:6,lg:4},large:{xs:12,md:6},full:{xs:12}},jt=()=>({id:Z(),type:`stat`,size:`small`,title:``,config:{metric:`online_apps`}}),Mt=e=>e instanceof Error?e.message:String(e)})))()}Nt();export{Ot as default};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{c as r,h as i,n as a,v as o,x as s,y as c}from"./client-DFnuv2z3.js";import{F as l,H as u,I as d,Q as f,St as p,V as m,Z as h,c as g,d as _,f as v,g as y,h as b,i as x,m as S,p as C,r as w,s as T,xt as E}from"./mui-BXSXx9c9.js";import{B as D,a as O,o as k,z as A}from"./mui-Cd711nOk.js";import{B as j,U as ee,W as M,ct as N,d as te,f as ne,it as re,l as P,rt as ie,st as ae,u as oe,z as se}from"./mui-AnEgAVjz.js";import{S as ce,_ as F,n as le,t as ue,v as de,x as fe}from"./mui-BwsIrivo.js";import{r as pe,t as me}from"./alert-uBG6r9NW.js";import{n as he,t as ge}from"./error-boundary-CLLI8PWw.js";import{c as _e,s as ve}from"./access-BvKK9dEv.js";import{n as I,t as ye}from"./use-polled-resource-B22hhr5L.js";import{a as be,n as xe}from"./storage-CKXnhqkt.js";import{a as Se,u as Ce}from"./app-address-BCXfN59F.js";import{A as we,G as Te,M as Ee,T as De,h as Oe}from"./icons-OboZgWSt.js";import{n as ke,t as Ae}from"./operation-status-Bm1x1wTz.js";import{n as je,t as Me}from"./page-breadcrumbs-fR7Jmpp4.js";import{i as Ne,s as Pe}from"./formatters-RnRy4bXm.js";import{n as Fe,t as Ie}from"./metric-chart-M-kI-XOt.js";import{n as Le,t as Re}from"./use-stack-context-8yaHaN8L.js";import{n as ze,t as Be}from"./empty-content-7jOFhG4C.js";import{n as Ve,r as He}from"./daemon-memory-BiEtr9jr.js";import{a as Ue,i as L,n as We,o as Ge,r as Ke,s as qe,t as R}from"./metric-series-WxePniyw.js";function Je(e=!1){let[t,n]=(0,z.useState)(e),r=(0,z.useCallback)(()=>{n(!0)},[]),i=(0,z.useCallback)(()=>{n(!1)},[]),a=(0,z.useCallback)(()=>{n(e=>!e)},[]);return(0,z.useMemo)(()=>({value:t,onTrue:r,onFalse:i,onToggle:a,setValue:n}),[t,r,i,a])}var z;function Ye(){return(Ye=e((()=>{z=t()})))()}function Xe(){let e=(0,B.useContext)(st);if(!e)throw Error(`useDashboardBlockContext must be used within DashboardBlock`);return e}function Ze({title:e,subtitle:t,icon:n,actions:r,sx:i}){let{collapsible:a,collapsed:o,toggleCollapse:s,size:c,labels:l}=Xe(),u=H[c];return(0,V.jsxs)(m,{"data-testid":`prism-dashboard-block-header`,sx:[{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:2,px:u.headerPx,py:u.headerPy},...Array.isArray(i)?i:[i]],children:[(0,V.jsxs)(m,{sx:{display:`flex`,alignItems:`flex-start`,gap:1.5,flex:1,minWidth:0},children:[n&&(0,V.jsx)(m,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,mt:.25,color:`primary.main`},children:n}),(0,V.jsxs)(m,{sx:{flex:1,minWidth:0},children:[(0,V.jsx)(A,{variant:u.titleVariant,component:`h3`,sx:{fontWeight:600,lineHeight:1.4,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,overflowWrap:`anywhere`},children:e}),t&&(0,V.jsx)(A,{variant:u.subtitleVariant,sx:{color:`text.secondary`,mt:.25},children:t})]})]}),(0,V.jsxs)(m,{sx:{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0},children:[r,a&&(0,V.jsx)(ie,{size:`small`,onClick:s,"aria-expanded":!o,"aria-label":o?l.expand??`Expand block`:l.collapse??`Collapse block`,"data-testid":`prism-dashboard-block-collapse`,children:(0,V.jsx)(it,{direction:o?`down`:`up`})})]})]})}function Qe({children:e,disablePadding:t=!1,sx:n}){let{size:r}=Xe(),i=H[r];return(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-content`,sx:[{...!t&&{px:i.contentPx,py:i.contentPy}},...Array.isArray(n)?n:[n]],children:e})}function $e({children:e,divider:t=!0,sx:n}){let{collapsed:r,size:i}=Xe(),a=H[i];return r?null:(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsx)(w,{}),(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-footer`,sx:[{px:a.contentPx,py:1.5},...Array.isArray(n)?n:[n]],children:e})]})}function et({rows:e=3,size:t}){let n=H[t];return(0,V.jsx)(m,{sx:{px:n.contentPx,py:n.contentPy},children:Array.from({length:e}).map((e,t)=>(0,V.jsx)(fe,{variant:`text`,animation:`wave`,sx:{height:20,mb:1}},t))})}function tt({message:e=`Failed to load data`,retryLabel:t=`Retry`,onRetry:n,size:r}){let i=H[r];return(0,V.jsxs)(m,{sx:{px:i.contentPx,py:i.contentPy,textAlign:`center`},children:[(0,V.jsx)(A,{color:`error`,variant:`body2`,sx:{mb:n?1.5:0},children:e}),n&&(0,V.jsx)(l,{size:`small`,onClick:n,children:t})]})}function nt({config:e,size:t}){let n=H[t];return e?.emptyComponent?e.emptyComponent:(0,V.jsx)(m,{"data-testid":`prism-dashboard-block-empty`,sx:{px:n.contentPx,py:n.contentPy},children:(0,V.jsx)(Be,{compact:!0,icon:e?.icon,iconSize:48,title:e?.title,description:e?.description,action:e?.action})})}function rt({title:e,subtitle:t,icon:n,actions:r,children:i,footer:a,variant:o=`default`,size:s=`medium`,loading:c=!1,loadingConfig:l,error:u=!1,errorConfig:d,empty:f=!1,emptyConfig:p,labels:h=ot,catchErrors:g=!0,collapsible:_=!1,defaultCollapsed:v=!1,collapsed:y,onCollapseChange:b,disablePadding:x=!1,footerDivider:S=!0,sx:C,slotProps:T}){let D=Je(v),O=y!==void 0,k=O?y:D.value,A=(0,B.useCallback)(e=>{_&&e!==k&&(O||D.setValue(e),b?.(e))},[_,k,O,b,D]),j=(0,B.useCallback)(()=>A(!k),[k,A]),ee=(0,B.useMemo)(()=>({collapsible:_,collapsed:_?k:!1,toggleCollapse:_?j:at,setCollapsed:_?A:at,loading:c,error:u,variant:o,size:s,labels:h}),[k,_,j,A,c,u,o,s,h]),M=d?.message??h.error,N=c?l?.loadingComponent??(0,V.jsx)(et,{rows:l?.skeletonRows??3,size:s}):u?d?.errorComponent??(0,V.jsx)(tt,{message:M,retryLabel:h.retry,onRetry:d?.onRetry,size:s}):f?(0,V.jsx)(nt,{config:p,size:s}):i?(0,V.jsx)(Qe,{disablePadding:x,...T?.content,children:i}):null,te=o===`outlined`?`outlined`:`elevation`,ne=+(o==="default");return(0,V.jsx)(st.Provider,{value:ee,children:(0,V.jsxs)(ae,{"data-testid":`prism-dashboard-block`,variant:te,elevation:ne,sx:[{overflow:`hidden`,...o===`filled`&&{bgcolor:`action.hover`}},...Array.isArray(C)?C:[C]],children:[e&&(0,V.jsx)(Ze,{title:e,subtitle:t,icon:n,actions:r,...T?.header}),e&&(0,V.jsx)(w,{}),(0,V.jsx)(E,{in:!ee.collapsed,timeout:`auto`,children:(0,V.jsx)(m,{"aria-live":`polite`,"aria-busy":c,children:g?(0,V.jsx)(ge,{resetKeys:[c,u,f],fallback:({resetErrorBoundary:e})=>(0,V.jsx)(tt,{message:h.error,retryLabel:h.retry,onRetry:()=>{e(),d?.onRetry?.()},size:s}),children:N}):N})}),a&&!c&&!u&&(0,V.jsx)($e,{divider:S,...T?.footer,children:a})]})})}function it({direction:e}){return(0,V.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:e===`up`?`rotate(180deg)`:void 0,transition:`transform 0.2s ease`},children:(0,V.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}var B,V,at,ot,st,H;function ct(){return(ct=e((()=>{B=t(),u(),N(),D(),re(),p(),x(),ce(),d(),Ye(),he(),ze(),V=n(),at=()=>{},ot={},st=(0,B.createContext)(null),H={small:{headerPx:2,headerPy:1.5,contentPx:2,contentPy:1.5,titleVariant:`subtitle1`,subtitleVariant:`caption`},medium:{headerPx:2.5,headerPy:2,contentPx:2.5,contentPy:2,titleVariant:`h6`,subtitleVariant:`body2`},large:{headerPx:3,headerPy:2.5,contentPx:3,contentPy:2.5,titleVariant:`h5`,subtitleVariant:`body1`}}})))()}function U({label:e,value:t}){return(0,W.jsxs)(m,{sx:{display:`grid`,gridTemplateColumns:`minmax(0,1fr) auto`,alignItems:`baseline`,gap:1},children:[(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,sx:{overflowWrap:`anywhere`},children:e}),(0,W.jsx)(A,{component:`span`,variant:`body2`,sx:{fontVariantNumeric:`tabular-nums`},children:t})]})}function lt(e,t){switch(e){case`total_apps`:return t.length;case`online_apps`:return t.filter(e=>e.status===`online`).length;case`errored_apps`:return t.filter(e=>[`crashed`,`errored`].includes(e.status)).length;case`restarts`:return qe(t.map(e=>e.restarts))??`—`;case`total_cpu`:return Ke(qe(t.map(e=>e.cpu)));case`total_memory`:{let e=qe(t.map(e=>e.memory));return e===null?`—`:Ne(e)}default:return`—`}}function ut({panel:e,board:t,sources:n,actions:r}){let i=e.config.metric??`online_apps`,a=e.config.app,o=a?n.apps.data?.filter(e=>e.name===a):n.apps.data,s=a?`${n.subject} · ${a}`:n.subject;if(e.type===`cpu-chart`||e.type===`memory-chart`){let i=n.history,o=R[t.window],c=e.type===`cpu-chart`,l=(i.data?.series??[]).filter(e=>!a||e.app.split(`/`).at(-1)===a);return(0,W.jsx)(Ie,{title:e.title,actions:r,description:`${s} · ${o.label} · ${o.interval} averages`,lines:Ue(l,c?`cpu_percent`:`memory_bytes`,n.prefix,!1,i.data?.names??{},o.bucket,i.data?.scope),format:c?Ke:We,from:i.data?.from??Date.now()-o.duration,to:i.data?.to??Date.now(),loading:i.loading,error:i.error,height:220})}let c=e.type===`daemon-info`||e.type===`alert-summary`||e.type===`stat`&&i===`uptime`,l=e.type===`alert-summary`?n.alerts:c?n.status:n.apps,u;if(e.type===`stat`){let e=i===`uptime`?n.status.data?Pe(n.status.data.uptime):`—`:o&&(!a||o.length)?lt(i,o):`—`;u=(0,W.jsx)(A,{variant:`h4`,sx:{fontVariantNumeric:`tabular-nums`},children:e})}else if(e.type===`daemon-info`&&n.status.data){let e=n.status.data;u=(0,W.jsxs)(F,{spacing:.75,children:[(0,W.jsx)(U,{label:`Version`,value:e.version}),(0,W.jsx)(U,{label:`PID`,value:e.pid}),(0,W.jsx)(U,{label:`Uptime`,value:Pe(e.uptime)}),(0,W.jsx)(U,{label:`Resident memory`,value:Ne(Ve(e))})]})}else if(e.type===`alert-summary`&&n.alerts.data){let e=n.alerts.data;u=(0,W.jsxs)(F,{spacing:.75,children:[(0,W.jsx)(U,{label:`Firing`,value:e.firing}),(0,W.jsx)(U,{label:`Acknowledged`,value:e.acknowledged}),Object.entries(e.bySeverity).map(([e,t])=>(0,W.jsx)(U,{label:e,value:t},e))]})}else if(o&&(e.type===`app-grid`||e.type===`recent-errors`)){let t=e.type===`app-grid`?o:o.filter(e=>[`crashed`,`errored`].includes(e.status)||e.restarts>0);u=t.length?(0,W.jsx)(F,{spacing:.75,children:t.map(t=>(0,W.jsx)(U,{label:[t.stack,t.name].filter(Boolean).join(` / `),value:(0,W.jsxs)(F,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[e.type===`recent-errors`&&(0,W.jsxs)(`span`,{children:[t.restarts,` restarts`]}),(0,W.jsx)(h,{size:`small`,variant:`outlined`,label:t.status})]})},t.key))}):(0,W.jsx)(A,{variant:`body2`,color:`text.secondary`,children:e.type===`app-grid`?`No applications in this scope.`:`No observed failures or restarts in this scope.`})}return(0,W.jsxs)(rt,{title:e.title,subtitle:c?`Connected daemon`:s,actions:r,variant:`outlined`,size:`small`,sx:{height:`100%`,minWidth:0},loading:l.loading,error:!l.data&&!!l.error,errorConfig:{message:l.error??`Measurement unavailable`},children:[l.error&&l.data&&(0,W.jsxs)(A,{variant:`caption`,color:`warning.main`,children:[`Last observation · `,l.error]}),u]})}var W;function dt(){return(dt=e((()=>{u(),f(),de(),D(),ct(),Fe(),He(),L(),W=n()})))()}function G(e,t){return t?e:{data:null,loading:!1,error:`This session has no permission to read this source.`}}function ft(e,t){let{can:n}=_e(),{activeProject:i,activeStack:l,namespacePrefix:u}=Le(),d=n(`OmnitronDaemon.status`),f=i?n(`OmnitronProject.getProjectApps`):d,p=n(`OmnitronAlerts.getSummary`),m=n(`OmnitronNodes.listNodes`),h=n(`OmnitronMetrics.querySeries`)&&(!i||n(`OmnitronProject.listStacks`)&&m),g=e.panels.some(e=>e.type===`cpu-chart`||e.type===`memory-chart`),_=e.panels.some(e=>e.type===`alert-summary`),v=e.panels.some(e=>e.type===`app-grid`||e.type===`recent-errors`||e.type===`stat`&&e.config.metric!==`uptime`),y=!i&&v||e.panels.some(e=>e.type===`daemon-info`||e.type===`stat`&&e.config.metric===`uptime`),b=i?[i,l].filter(Boolean).join(` / `):`Connected daemon`,x=JSON.stringify([i,l]),S=e.refreshInterval,C=I(()=>r.status(),{intervalMs:S,paused:!t,enabled:y&&d,resourceKey:Number(d)}),w=I(async()=>{let e=await s.getProjectApps({project:i});return Ce(i,l,e,[])},{intervalMs:S,paused:!t,enabled:!!i&&v&&f,resourceKey:JSON.stringify([x,f])}),T=I(()=>a.getSummary(),{intervalMs:S,paused:!t,enabled:_&&p,resourceKey:Number(p)}),E=I(async()=>{let t=R[e.window],n=Date.now(),r=n-t.duration,[a,u,d]=await Promise.all([o.querySeries({names:[`cpu_percent`,`memory_bytes`],from:r,to:n,interval:t.interval,limit:120}),i?s.listStacks({project:i}):[],i?c.listNodes():[]]);return{series:i?a:a.filter(e=>!e.labels?.node),names:Object.fromEntries(d.map(e=>[e.id,e.name])),scope:i?Ge(i,l,u,d):void 0,from:r,to:n}},{intervalMs:S,paused:!t,enabled:g&&h,resourceKey:JSON.stringify([x,e.window,h])});return{sources:{subject:b,prefix:u,apps:G(i?w:{...C,data:C.data?Ce(null,null,null,C.data.apps):null},f),status:G(C,d),alerts:G(T,p),history:G(E,h)},refresh:()=>{let e=[],t=(t,n)=>{t&&e.push(n.refresh())};return t(g&&h,E),t(_&&p,T),t(y&&d,C),t(!!i&&v&&f,w),Promise.all(e)}}}function pt(){return(pt=e((()=>{ve(),i(),Re(),ye(),Se(),L()})))()}function mt(){let e=Ct(`Overview`),t=(e,t,n,r)=>({id:Z(),type:e,title:t,size:n,config:r?{metric:r}:{}});return e.panels=[t(`stat`,`Online`,`small`,`online_apps`),t(`stat`,`Errored`,`small`,`errored_apps`),t(`stat`,`CPU`,`small`,`total_cpu`),t(`stat`,`Memory`,`small`,`total_memory`),t(`cpu-chart`,`CPU history`,`large`),t(`memory-chart`,`Memory history`,`large`),t(`app-grid`,`Applications`,`large`),t(`daemon-info`,`Controller runtime`,`medium`),t(`recent-errors`,`Failures and restarts`,`medium`)],e}function K(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Expected a layout object.`);return e}function q(e,t,n=100){if(typeof e!=`string`||!e.trim()||e.trim().length>n)throw Error(`Invalid ${t} (1–${n} characters).`);return e.trim()}function J(e,t,n){if(typeof t!=`string`||!Object.hasOwn(e,t))throw Error(`Unsupported ${n}.`);return t}function ht(e){if(new Set(e.map(e=>e.id)).size!==e.length)throw Error(`Duplicate layout identifiers.`)}function gt(e){let t=K(e);if(!Array.isArray(t.panels)||t.panels.length>64)throw Error(`A dashboard supports up to 64 panels.`);let n=t.panels.map(e=>{let t=K(e),n=t.type===`uptime-chart`,r=n?`stat`:J(Y,t.type,`panel type`),i=K(t.config??{});return{id:q(t.id,`panel id`),title:q(t.title,`panel title`),type:r,size:J(bt,t.size,`panel size`),config:{...r===`stat`&&{metric:n?`uptime`:J(X,i.metric??`online_apps`,`statistic`)},...i.app&&typeof i.app==`string`?{app:q(i.app,`application`,256)}:{}}}});ht(n);let r=Number(t.refreshInterval??5e3);if(!xt.some(e=>e===r))throw Error(`Unsupported refresh interval.`);return{id:q(t.id,`dashboard id`),name:q(t.name,`dashboard name`),panels:n,refreshInterval:r,window:J(R,t.window??`15m`,`history window`)}}function _t(e){let t=JSON.parse(e);if(!Array.isArray(t)||!t.length||t.length>64)throw Error(`Expected 1–64 dashboard layouts.`);let n=t.map(gt);return ht(n),n}function vt(e){return JSON.stringify({format:`omnitron.dashboard`,version:1,board:e},null,2)}function yt(e){if(e.length>131072)throw Error(`Layout exceeds 128 KiB.`);let t=K(JSON.parse(e));if(t.format!==`omnitron.dashboard`||t.version!==1)throw Error(`Unsupported dashboard layout format or version.`);return{...gt(t.board),id:Z()}}var Y,X,bt,xt,St,Z,Ct;function wt(){return(wt=e((()=>{L(),Y={stat:`Metric`,"cpu-chart":`CPU history`,"memory-chart":`Memory history`,"app-grid":`Application status`,"daemon-info":`Controller runtime`,"alert-summary":`Controller alerts`,"recent-errors":`Application failures and restarts`},X={total_apps:`Applications`,online_apps:`Online`,errored_apps:`Errored`,total_cpu:`CPU`,total_memory:`Memory`,uptime:`Controller uptime`,restarts:`Restarts`},bt={small:`Compact`,medium:`Third width`,large:`Half width`,full:`Full width`},xt=[5e3,15e3,3e4,6e4],St=`omnitron_dashboards_v2`,Z=()=>crypto.randomUUID(),Ct=e=>({id:Z(),name:e,panels:[],refreshInterval:5e3,window:`15m`})})))()}function Tt(){let e=xe(St);try{return{raw:e,boards:e?_t(e):[mt()],error:null}}catch(t){return{raw:e,boards:[mt()],error:`Saved layouts could not be read. The original is preserved. ${Mt(t)}`}}}function Et({panel:e,edit:t,apps:n,onSave:r,onClose:i}){let[a,o]=(0,Q.useState)(e.type),[s,c]=(0,Q.useState)(e.title),[u,d]=(0,Q.useState)(e.size),[f,p]=(0,Q.useState)(e.config.metric??`online_apps`),[h,g]=(0,Q.useState)(e.config.app??``),v=a!==`daemon-info`&&a!==`alert-summary`&&(a!==`stat`||f!==`uptime`);return(0,$.jsx)(b,{open:!0,onClose:i,maxWidth:`xs`,fullWidth:!0,children:(0,$.jsxs)(m,{component:`form`,onSubmit:t=>{t.preventDefault(),r({id:e.id,type:a,size:u,title:s.trim()||(a===`stat`?X[f]:Y[a]),config:{...a===`stat`&&{metric:f},...v&&h.trim()&&{app:h.trim()}}})},children:[(0,$.jsx)(T,{children:t?`Edit panel`:`Add panel`}),(0,$.jsx)(_,{children:(0,$.jsxs)(F,{spacing:2,sx:{pt:1},children:[(0,$.jsx)(O,{select:!0,size:`small`,label:`Source`,value:a,onChange:e=>{let n=e.target.value;o(n),t||d(n===`stat`?`small`:`large`)},children:Object.entries(Y).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))}),a===`stat`&&(0,$.jsx)(O,{select:!0,size:`small`,label:`Metric`,value:f,onChange:e=>p(e.target.value),children:Object.entries(X).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))}),v&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{size:`small`,label:`Application`,placeholder:`All applications in this scope`,value:h,onChange:e=>g(e.target.value),slotProps:{htmlInput:{list:`dashboard-app-names`,maxLength:256}},helperText:`An exact application name follows the selected workspace and stack.`}),(0,$.jsx)(`datalist`,{id:`dashboard-app-names`,children:n.map(e=>(0,$.jsx)(`option`,{value:e},e))})]}),(0,$.jsx)(O,{size:`small`,label:`Panel title`,placeholder:Y[a],value:s,onChange:e=>c(e.target.value),slotProps:{htmlInput:{maxLength:100}}}),(0,$.jsx)(O,{select:!0,size:`small`,label:`Width`,value:u,onChange:e=>d(e.target.value),children:Object.entries(bt).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t},e))})]})}),(0,$.jsxs)(C,{children:[(0,$.jsx)(l,{onClick:i,children:`Cancel`}),(0,$.jsx)(l,{type:`submit`,variant:`contained`,children:`Save panel`})]})]})})}function Dt({mode:e,board:t,onSave:n,onClose:r}){let[i,a]=(0,Q.useState)(e===`create`?``:e===`duplicate`?`${t.name} copy`:t.name),[o,s]=(0,Q.useState)(t.refreshInterval),[c,u]=(0,Q.useState)(t.window),[d,f]=(0,Q.useState)(e===`export`?vt(t):``),[p,h]=(0,Q.useState)(``),g=e===`export`||e===`import`;return(0,$.jsx)(b,{open:!0,onClose:r,fullWidth:!0,maxWidth:g?`sm`:`xs`,children:(0,$.jsxs)(m,{component:`form`,onSubmit:a=>{a.preventDefault(),h(``);try{if(e===`export`){r();return}if(e===`delete`){n(null);return}if(e===`import`){n(yt(d));return}if(!i.trim())throw Error(`Enter a dashboard name.`);n({...e===`create`?Ct(i.trim()):{...t,id:e===`duplicate`?Z():t.id},name:i.trim(),refreshInterval:o,window:c})}catch(e){h(Mt(e))}},children:[(0,$.jsx)(T,{children:{create:`New dashboard`,settings:`Dashboard settings`,duplicate:`Duplicate dashboard`,delete:`Delete dashboard`,import:`Import layout`,export:`Export layout`}[e]}),(0,$.jsx)(_,{children:(0,$.jsxs)(F,{spacing:2,sx:{pt:1},children:[p&&(0,$.jsx)(me,{severity:`error`,children:p}),g?(0,$.jsx)(O,{multiline:!0,minRows:7,maxRows:16,size:`small`,label:`Layout JSON`,value:d,onChange:e=>f(e.target.value),slotProps:{input:{readOnly:e===`export`},htmlInput:{maxLength:131072,spellCheck:!1}},helperText:e===`export`?`Copy this versioned layout to another browser or workspace. Measurements are read at the destination.`:`A valid layout opens as a separate dashboard.`}):e===`delete`?(0,$.jsxs)(A,{children:[`Delete “`,t.name,`” and its `,t.panels.length,` panels from this browser?`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{label:`Dashboard name`,size:`small`,required:!0,value:i,onChange:e=>a(e.target.value),slotProps:{htmlInput:{maxLength:100}}}),(0,$.jsx)(O,{select:!0,size:`small`,label:`Refresh interval`,value:o,onChange:e=>s(Number(e.target.value)),children:xt.map(e=>(0,$.jsxs)(P,{value:e,children:[e/1e3,` seconds`]},e))}),(0,$.jsx)(O,{select:!0,size:`small`,label:`History window`,value:c,onChange:e=>u(e.target.value),children:Object.entries(R).map(([e,t])=>(0,$.jsx)(P,{value:e,children:t.label},e))})]})]})}),(0,$.jsxs)(C,{children:[e!==`export`&&(0,$.jsx)(l,{onClick:r,children:`Cancel`}),(0,$.jsx)(l,{type:`submit`,variant:`contained`,color:e===`delete`?`error`:`primary`,children:e===`delete`?`Delete`:e===`export`?`Done`:e===`import`?`Import`:`Save`})]})]})})}function Ot(){let[e]=(0,Q.useState)(Tt),[t,n]=(0,Q.useState)(e.boards),[r,i]=(0,Q.useState)(()=>xe(kt)??``),a=t.find(e=>e.id===r)??t[0],[o,s]=(0,Q.useState)(e.error),c=(0,Q.useRef)(e.raw),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),{sources:C,refresh:w}=ft(a,f),T=e=>{i(e),be(kt,e)};(0,Q.useEffect)(()=>{let e=e=>{if(e.key===`omnitron_dashboards_v2`&&e.newValue!==c.current){if(y||x)s(`Layouts changed in another tab. Close the editor and reload before saving.`);else try{let t=e.newValue?_t(e.newValue):[mt()];c.current=e.newValue,n(t),s(null)}catch(e){s(Mt(e))}}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[y,x]);function E(t,r){if(e.error)return s(e.error),!1;if(xe(`omnitron_dashboards_v2`)!==c.current)return s(`Saved layouts changed. Reload before editing to preserve both versions.`),!1;let i=JSON.stringify(t),a=be(St,i);return a&&(c.current=i),s(a?null:`Browser storage unavailable. Changes apply to this session. Export the layout to keep it.`),n(t),T(r),!0}function D(e){return E(t.map(t=>t.id===a.id?{...t,panels:e}:t),a.id)}let k=e=>{v(null),b(e)},j=_?.panel,M=a.panels.findIndex(e=>e.id===j?.id),N=e=>{let t=[...a.panels],n=M+e;if(M>=0&&n>=0&&n<t.length){let[e]=t.splice(M,1);t.splice(n,0,e),D(t)}v(null)},ne=async()=>{g(!0);try{await w()}finally{g(!1)}};return(0,$.jsxs)(F,{spacing:2,sx:{minWidth:0},children:[(0,$.jsx)(Me,{links:[{name:`Dashboard Builder`}],action:(0,$.jsxs)(F,{direction:`row`,spacing:.75,sx:{alignItems:`center`},children:[(0,$.jsx)(ee,{sx:{m:0},control:(0,$.jsx)(ue,{size:`small`,checked:f,onChange:e=>p(e.target.checked)}),label:`Live`}),(0,$.jsx)(ie,{size:`small`,"aria-label":`Refresh dashboard`,disabled:h,"data-console-command":`refresh`,onClick:()=>void ne(),children:(0,$.jsx)(Ee,{})}),(0,$.jsx)(l,{size:`small`,variant:u?`contained`:`text`,"aria-pressed":u,startIcon:(0,$.jsx)(Oe,{}),onClick:()=>d(!u),children:u?`Done`:`Edit layout`})]})}),(0,$.jsxs)(F,{direction:`row`,useFlexGap:!0,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,$.jsx)(O,{select:!0,size:`small`,label:`Dashboard`,value:a.id,onChange:e=>T(e.target.value),sx:{minWidth:`10rem`,maxWidth:`100%`},children:t.map(e=>(0,$.jsx)(P,{value:e.id,children:e.name},e.id))}),(0,$.jsxs)(A,{variant:`caption`,color:`text.secondary`,children:[C.subject,` · `,R[a.window].label,` ·`,` `,f?`${a.refreshInterval/1e3} s refresh`:`Paused`]}),(0,$.jsx)(m,{sx:{flex:1}}),u&&(0,$.jsx)(l,{size:`small`,disabled:a.panels.length>=64,startIcon:(0,$.jsx)(we,{}),onClick:()=>S(jt()),children:`Add panel`}),(0,$.jsx)(ie,{size:`small`,"aria-label":`Dashboard options`,"aria-haspopup":`menu`,onClick:e=>v({anchor:e.currentTarget}),children:(0,$.jsx)(De,{})})]}),o&&(0,$.jsx)(me,{severity:`warning`,children:o}),(0,$.jsx)(Ae,{active:h,label:`Refreshing dashboard sources`}),!a.panels.length&&(0,$.jsxs)(me,{severity:`info`,children:[`This dashboard has no panels.`,` `,(0,$.jsx)(l,{size:`small`,onClick:()=>{d(!0),S(jt())},children:`Add panel`})]}),(0,$.jsx)(se,{container:!0,spacing:1.5,children:a.panels.map(e=>(0,$.jsx)(se,{size:At[e.size],sx:{minWidth:0},children:(0,$.jsx)(ut,{panel:e,board:a,sources:C,actions:u&&(0,$.jsx)(ie,{size:`small`,"aria-label":`Options for ${e.title}`,"aria-haspopup":`menu`,onClick:t=>v({anchor:t.currentTarget,panel:e}),children:(0,$.jsx)(De,{})})})},e.id))}),(0,$.jsx)(te,{open:!!_,anchorEl:_?.anchor??null,onClose:()=>v(null),children:j?[(0,$.jsx)(P,{onClick:()=>{S(j),v(null)},children:`Edit panel`},`edit`),(0,$.jsx)(P,{disabled:M<=0,onClick:()=>N(-1),children:`Move earlier`},`up`),(0,$.jsx)(P,{disabled:M===a.panels.length-1,onClick:()=>N(1),children:`Move later`},`down`),(0,$.jsx)(P,{onClick:()=>{D(a.panels.filter(e=>e.id!==j.id)),v(null)},children:`Remove from layout`},`remove`)]:[`settings`,`create`,`duplicate`,`import`,`export`,`delete`].map(e=>(0,$.jsx)(P,{disabled:e===`delete`&&t.length===1||[`create`,`duplicate`,`import`].includes(e)&&t.length>=64,onClick:()=>k(e),children:{settings:`Settings`,create:`New dashboard`,duplicate:`Duplicate`,import:`Import layout`,export:`Export layout`,delete:`Delete dashboard`}[e]},e))}),x&&(0,$.jsx)(Et,{panel:x,edit:a.panels.some(e=>e.id===x.id),apps:[...new Set(C.apps.data?.map(e=>e.name)??[])].sort(),onClose:()=>S(null),onSave:e=>{D(a.panels.some(t=>t.id===e.id)?a.panels.map(t=>t.id===e.id?e:t):[...a.panels,e])&&S(null)}}),y&&(0,$.jsx)(Dt,{mode:y,board:a,onClose:()=>b(null),onSave:e=>{let n=e?y===`settings`?t.map(t=>t.id===e.id?e:t):[...t,e]:t.filter(e=>e.id!==a.id);E(n,e?.id??n[0].id)&&(b(null),y===`create`&&d(!0))}})]})}var Q,$,kt,At,jt,Mt;function Nt(){return(Nt=e((()=>{Q=t(),u(),d(),y(),S(),v(),g(),M(),j(),re(),ne(),oe(),de(),le(),k(),D(),pe(),je(),dt(),ke(),pt(),Te(),L(),wt(),$=n(),kt=`omnitron_dashboard_active`,At={small:{xs:12,sm:6,lg:3},medium:{xs:12,sm:6,lg:4},large:{xs:12,md:6},full:{xs:12}},jt=()=>({id:Z(),type:`stat`,size:`small`,title:``,config:{metric:`online_apps`}}),Mt=e=>e instanceof Error?e.message:String(e)})))()}Nt();export{Ot as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{t}from"./react-BN8qLIAi.js";import{S as n,h as r,r as i}from"./client-DFnuv2z3.js";import{H as a,Q as o,V as s,Z as c}from"./mui-BXSXx9c9.js";import{B as l,z as u}from"./mui-Cd711nOk.js";import{E as d,T as f}from"./mui-AnEgAVjz.js";import{_ as p,v as m}from"./mui-BwsIrivo.js";import{d as h,f as g,m as _,y as v}from"./project.store-DuCgv6Eq.js";function y(e){let t=v(e.id);return{id:e.id,project:e.project??t.project,complete:e.complete??!1,...e.manifestError&&{manifestError:e.manifestError},builtAt:e.builtAt??null,builtBy:e.builtBy??null,builtWith:e.builtWith??null,projectCommit:e.projectCommit??t.projectCommit,omniCommit:e.omniCommit??t.omniCommit,projectRepo:e.projectRepo??null,omniRepo:e.omniRepo??null,onRemote:{project:e.onRemote?.project??null,omni:e.onRemote?.omni??null},gates:e.gates??{total:0,passed:0,failed:0,notRun:0},gateList:e.gateList??[],artifacts:e.artifacts??{count:0,bytes:0,apps:[],failed:[]},statics:e.statics??null,bytes:e.bytes??0,keptSource:e.keptSource??!1,machine:e.machine??null,verified:e.verified??[]}}function b(e){return{...e,history:e.history??[],gates:e.gates??[],request:e.request??{project:`(unknown)`}}}var x,S;function C(){return(C=e((()=>{_(),r(),x=new Map,S={async list(){let e=await n.list();return{root:e?.root??``,releases:(e?.releases??[]).map(y)}},async get(e){let t=await n.get({id:e});return{...y(t),manifest:t.manifest??null,manifestSha256:t.manifestSha256??null,artifactSources:t.artifactSources??null,logs:t.logs??[],root:t.root??``,attestations:t.attestations??[]}},async builds(){return(await n.builds()??[]).map(b)},async preflight(){let e=await n.preflight();return{...e.publish===1?{publish:1}:{},...e.store&&{store:e.store},...e.buildSlots&&{buildSlots:e.buildSlots},...e.frameworkSource===1?{frameworkSource:1}:{},root:e.root,canBuild:e.canBuild,missingTools:e.missingTools??[],path:e.path??[],load:Array.isArray(e.load)&&e.load.length===3?e.load:null,cpus:typeof e.cpus==`number`&&e.cpus>0?e.cpus:null}},async deployments(e=200){let t=x.get(e);if(t)return t;let r=Promise.all([i.available().catch(()=>null),n.deployments({limit:e})]).then(([e,t])=>{let n=(t??[]).map(e=>({...e,releaseUnnamed:e.releaseUnnamed??!1}));return g(e?.available===!0,n)}).finally(()=>{x.get(e)===r&&x.delete(e)});return x.set(e,r),r}}})))()}function w(e){return e!==`success`&&e!==`failed`}function T(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`time not reported`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<10)return`just now`;if(r<60)return`${r}s ago`;let i=Math.round(r/60);return i<60?`${i}m ago`:`${Math.round(i/60)}h ago`}function E(e,t,n){return w(e.status)&&(n||!Number.isFinite(Date.parse(e.at))||t-Date.parse(e.at)>9e4)}function D({record:e,now:t,unavailable:n}){let r=A[e.status]??{label:e.status,tone:`default`},i=E(e,t,n),a=w(e.status)&&!i;return(0,k.jsxs)(s,{sx:{py:1},children:[(0,k.jsxs)(p,{direction:`row`,spacing:1,sx:{mb:.5,alignItems:`center`,flexWrap:`wrap`,rowGap:.5},children:[(0,k.jsx)(u,{variant:`body2`,sx:{fontWeight:600,minWidth:0,overflowWrap:`anywhere`},children:e.app===`*`?`Node provisioning`:e.app}),(0,k.jsx)(u,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`,overflowWrap:`anywhere`},children:e.node}),(0,k.jsx)(s,{sx:{flex:1}}),(0,k.jsx)(c,{size:`small`,variant:`outlined`,color:r.tone,label:r.label,sx:{maxWidth:`100%`,fontWeight:600}}),(0,k.jsx)(u,{variant:`caption`,sx:{color:`text.secondary`},children:T(e.at,t)})]}),(0,k.jsx)(f,{"aria-label":`${e.app===`*`?`Node provisioning`:e.app} on ${e.node}`,variant:a?`indeterminate`:`determinate`,value:e.status===`success`?100:e.progress,color:i?`warning`:r.tone==="default"?`inherit`:r.tone,sx:{height:4,borderRadius:2}}),i&&(0,k.jsx)(u,{role:`status`,variant:`caption`,color:`warning.main`,children:`Awaiting an updated report; completion is unknown. A long phase may still be running.`}),e.message?(0,k.jsx)(u,{variant:`caption`,sx:{display:`block`,mt:.5,color:e.status===`failed`?`error.main`:`text.secondary`,wordBreak:`break-word`},children:e.message}):null,e.operationId&&(0,k.jsxs)(s,{component:`details`,sx:{mt:.5,typography:`caption`,color:`text.secondary`,overflowWrap:`anywhere`,"& summary":{cursor:`pointer`,width:`fit-content`}},children:[(0,k.jsx)(`summary`,{children:`Transfer details`}),(0,k.jsxs)(`div`,{children:[e.project,`/`,e.stack,` · `,e.at]}),(0,k.jsxs)(`div`,{children:[`Operation `,(0,k.jsx)(`code`,{children:e.operationId})]}),e.releaseId&&(0,k.jsxs)(`div`,{children:[`Release `,(0,k.jsx)(`code`,{children:e.releaseId})]})]})]})}function O({records:e,now:t=Date.now(),unavailable:n=!1}){if(e.length===0)return null;let r=e.filter(e=>w(e.status)&&!E(e,t,n)).length;return(0,k.jsxs)(s,{sx:{mb:3},children:[(0,k.jsxs)(p,{direction:`row`,spacing:1,sx:{mb:1,alignItems:`center`},children:[(0,k.jsx)(u,{variant:`subtitle2`,sx:{fontWeight:700},children:`Deployment progress`}),r>0?(0,k.jsx)(c,{size:`small`,color:`info`,variant:`filled`,label:`${r} in flight`,sx:{fontWeight:600}}):null]}),(0,k.jsx)(s,{sx:{border:1,borderColor:`divider`,borderRadius:1,px:2,py:.5},children:e.map(e=>(0,k.jsx)(D,{record:e,now:t,unavailable:n},h(e)))})]})}var k,A;function j(){return(j=e((()=>{a(),o(),d(),m(),l(),_(),k=t(),A={waiting:{label:`Waiting for node`,tone:`info`},pending:{label:`Connecting`,tone:`default`},transferring:{label:`Transferring artifact`,tone:`info`},extracting:{label:`Unpacking`,tone:`info`},installing:{label:`Installing dependencies on the node`,tone:`info`},restarting:{label:`Starting`,tone:`info`},verifying:{label:`Verifying`,tone:`info`},success:{label:`Deployed`,tone:`success`},failed:{label:`Failed`,tone:`error`}}})))()}export{S as i,j as n,C as r,O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{B as r,V as i,g as a,h as o,x as ee,z as s}from"./client-DFnuv2z3.js";import{F as c,H as l,I as te,Q as u,V as d,X as f,Y as ne,Z as p,at as m,c as h,ct as g,d as re,f as _,g as v,h as ie,m as y,ot as b,p as ae,s as oe,st as x}from"./mui-BXSXx9c9.js";import{B as S,a as se,o as C,z as w}from"./mui-Cd711nOk.js";import{l as T,u as E}from"./mui-AnEgAVjz.js";import{_ as D,v as O}from"./mui-BwsIrivo.js";import{h as ce,i as k,m as A,t as j}from"./project.store-DuCgv6Eq.js";import{G as M,m as le}from"./icons-OboZgWSt.js";import{i as ue,n as N,r as P,t as de}from"./deploy-progress-CUUwlYtQ.js";import{l as fe,o as pe,r as me,u as F}from"./release-bits-BJ6i23y0.js";function I({open:e,onClose:t,project:n,release:o,stack:s}){let l=i(),te=r(),u=e=>{let r=k.getState();r.activeProject!==n&&r.selectProject(n,te.pathname),t(),l(`/stacks/${encodeURIComponent(e)}`)},f=k(e=>e.stacksByProject),h=k(e=>e.fetchStacks),g=k(e=>e.startStack),_=f[n]??[],v=k(e=>e.stackReadErrors[n]),[y,b]=(0,L.useState)(!1),[S,C]=(0,L.useState)([]),[E,O]=(0,L.useState)(``),[A,j]=(0,L.useState)(s??``),[M,N]=(0,L.useState)(null),[P,F]=(0,L.useState)(!1),[I,z]=(0,L.useState)(!1),B=(0,L.useRef)(0),[V,H]=(0,L.useState)(!1),[U,W]=(0,L.useState)({records:[],available:!0}),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(null);(0,L.useEffect)(()=>{e&&_.length===0&&h(n)},[e,n,_.length,h]),(0,L.useEffect)(()=>{if(!e||o)return;let t=!0;return b(!0),C([]),O(``),ue.list().then(({releases:e})=>{if(!t)return;let r=e.filter(e=>e.project===n&&e.complete);C(r)}).catch(e=>{t&&J(`The release store could not be read: ${e.message}`)}).finally(()=>{t&&b(!1)}),()=>{t=!1}},[e,o,n]);let Y=o??S.find(e=>e.id===E)??null,X=o?.id??E.trim(),Z=JSON.stringify([n,A,X]),Q=M?.key===Z?M:null;(0,L.useEffect)(()=>{e&&(j(s??``),N(null),J(null))},[e,s,o?.id]),(0,L.useEffect)(()=>{let t=++B.current;if(N(null),z(!1),H(!1),W({records:[],available:!0}),K(!1),J(null),F(!1),!e||!X||!A)return;let r=!0;F(!0);let i=window.setTimeout(()=>{a(`checkRelease`,{project:n,stack:A,release:X}).then(e=>{r&&N({...e,key:Z})}).catch(e=>{r&&N({key:Z,ok:!1,because:`The daemon could not answer: ${e.message}`})}).finally(()=>{r&&F(!1)})},250);return()=>{r=!1,B.current=t+1,window.clearTimeout(i)}},[e,n,A,X,Z]);let he=async()=>{let e=B.current;z(!0),J(null);try{let t=await a(`checkRelease`,{project:n,stack:A,release:X,prepare:!0});e===B.current&&N({...t,key:Z})}catch(t){e===B.current&&J(t.message)}finally{e===B.current&&z(!1)}},ge=async()=>{if(!X||!A||!Q?.ok)return;H(!0),J(null);let e=B.current;try{let t=await ce({project:n,stack:A,release:X},()=>g(n,A,{release:X}),()=>ee.getDeployProgress({project:n,stack:A}),(t,n,r)=>{B.current===e&&W({records:t,available:r})});if(B.current!==e)return;if(t.state!==`confirmed`){J(t.message),K(t.state!==`failed`);return}u(A)}catch(t){B.current===e&&J(t.message)}finally{B.current===e&&H(!1)}},_e=_.find(e=>e.name===A),$=Q?.state===`unprepared`||Q?.state===`missing`,ve=_e?.config?.release?.mode===`required`;return(0,R.jsxs)(ie,{open:e,onClose:V?void 0:t,maxWidth:`sm`,fullWidth:!0,children:[(0,R.jsx)(oe,{children:`Deploy a release`}),(0,R.jsx)(re,{children:(0,R.jsxs)(D,{spacing:2.5,sx:{mt:1},children:[!o&&(0,R.jsx)(ne,{freeSolo:!0,size:`small`,disabled:V||I,loading:y,options:S.map(e=>e.id),value:E||null,inputValue:E,onChange:(e,t)=>O(t??``),onInputChange:(e,t)=>O(t),renderInput:e=>(0,R.jsx)(se,{...e,label:`Release ID`,placeholder:`Select or enter a release ID`})}),Y&&(0,R.jsxs)(d,{children:[(0,R.jsx)(w,{variant:`body2`,sx:{fontFamily:`monospace`,fontWeight:600},children:Y.id}),(0,R.jsxs)(D,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,mt:.75},children:[(0,R.jsx)(me,{projectCommit:Y.projectCommit,omniCommit:Y.omniCommit,onRemote:Y.onRemote,project:Y.project}),(0,R.jsx)(p,{size:`small`,variant:`outlined`,label:`${Y.artifacts.count} app${Y.artifacts.count===1?``:`s`}`,sx:{height:20,fontSize:11}}),Y.statics&&(0,R.jsx)(p,{size:`small`,variant:`outlined`,label:`statics: ${Y.statics.stack}`,sx:{height:20,fontSize:11}})]})]}),(0,R.jsxs)(se,{select:!0,label:`Stack`,value:A,onChange:e=>j(e.target.value),size:`small`,fullWidth:!0,disabled:V||I,helperText:_e?.type===`local`?`Local stacks keep the selected release across restarts. Stop their applications before changing it.`:void 0,children:[_.length===0&&(0,R.jsx)(T,{disabled:!0,value:``,children:v?`Stack inventory unavailable`:f[n]?`This project has no stacks`:`Reading stack inventory…`}),_.map(e=>(0,R.jsx)(T,{value:e.name,disabled:!!e.config?.managedOrigin,children:(0,R.jsxs)(D,{direction:`row`,spacing:1,sx:{alignItems:`center`,width:`100%`},children:[(0,R.jsx)(w,{variant:`body2`,children:e.name}),(0,R.jsx)(p,{label:e.type,size:`small`,variant:`outlined`,sx:{height:18,fontSize:10}}),e.config?.release?.mode===`required`&&(0,R.jsx)(p,{label:`releases only`,size:`small`,color:`info`,variant:`outlined`,sx:{height:18,fontSize:10}}),(0,R.jsx)(d,{sx:{flex:1}}),(0,R.jsx)(w,{variant:`caption`,sx:{color:`text.secondary`},children:e.status})]})},e.name))]}),Y&&Y.gates.total>0&&(0,R.jsxs)(d,{children:[(0,R.jsx)(w,{variant:`caption`,sx:{color:`text.secondary`},children:fe(Y.gateList)}),(0,R.jsx)(d,{sx:{mt:.5},children:(0,R.jsx)(pe,{gates:Y.gateList})})]}),(P||I)&&(0,R.jsxs)(D,{direction:`row`,spacing:1,role:`status`,sx:{alignItems:`center`},children:[(0,R.jsx)(x,{size:16}),(0,R.jsx)(w,{variant:`body2`,sx:{color:`text.secondary`},children:I?`Preparing and verifying release files…`:`Checking this release against the stack…`})]}),Q&&!I&&(0,R.jsx)(m,{severity:Q.ok?`success`:Q.state?`info`:`error`,children:(0,R.jsx)(w,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:Q.because})}),v&&(0,R.jsxs)(m,{severity:`warning`,children:[`Stack inventory unavailable · `,v]}),V&&!U.records.length&&(0,R.jsx)(w,{variant:`body2`,role:`status`,color:`text.secondary`,children:U.available?`Start submitted. Waiting for target observations…`:`Transfer observations unavailable. Waiting for the stack reply…`}),(0,R.jsx)(de,{records:U.records,unavailable:!U.available}),ve&&(0,R.jsxs)(w,{variant:`caption`,sx:{color:`text.secondary`},children:[A,` requires an immutable release.`]}),q&&(0,R.jsx)(m,{severity:G?`warning`:`error`,children:(0,R.jsx)(w,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:q})})]})}),(0,R.jsxs)(ae,{children:[(0,R.jsx)(c,{onClick:V?()=>u(A):t,size:`small`,children:V?`Open stack`:I?`Close`:`Cancel`}),(0,R.jsx)(c,{variant:`contained`,size:`small`,startIcon:V?(0,R.jsx)(x,{size:14,color:`inherit`}):(0,R.jsx)(le,{}),disabled:!X||!A||V||I||P||!G&&!$&&Q?.ok!==!0,onClick:G?()=>u(A):$?he:ge,children:V?`Deploying…`:I?`Preparing…`:G?`Inspect stack`:Q?.state===`missing`?`Fetch and verify`:$?`Prepare release`:`Deploy`})]})]})}var L,R;function z(){return(z=e((()=>{L=t(),s(),b(),l(),f(),te(),u(),g(),v(),y(),_(),h(),E(),O(),C(),S(),A(),o(),P(),j(),M(),F(),N(),R=n()})))()}export{z as n,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{P as r,h as i,u as a,x as o,z as s}from"./client-DFnuv2z3.js";import{F as c,I as l,Q as u,St as d,Z as f,xt as ee}from"./mui-BXSXx9c9.js";import{B as p,z as m}from"./mui-Cd711nOk.js";import{C as h,it as g,rt as _,w as v}from"./mui-AnEgAVjz.js";import{_ as y,v as b}from"./mui-BwsIrivo.js";import{r as x,t as S}from"./alert-uBG6r9NW.js";import{c as C,s as w}from"./access-BvKK9dEv.js";import{n as T,t as E}from"./use-polled-resource-B22hhr5L.js";import{g as D,i as O,m as k,t as A}from"./project.store-DuCgv6Eq.js";import{G as j,M}from"./icons-OboZgWSt.js";import{n as N,t as P}from"./page-breadcrumbs-fR7Jmpp4.js";import{n as F,t as I}from"./admin-data-table-BKSDI8sU.js";import{r as L,t as R}from"./formatters-RnRy4bXm.js";import{n as z,t as B}from"./use-stack-context-8yaHaN8L.js";import{n as te,r as V}from"./tabs-k5NPGLnJ.js";import{i as ne,n as H,r as U,t as W}from"./deploy-progress-CUUwlYtQ.js";function G(){let{activeProject:e,activeStack:t}=z();return(0,J.jsx)(K,{},JSON.stringify([e,t]))}function K(){let{activeProject:e,activeStack:t,matchesNamespace:n,extractStack:i}=z(),s=O(t=>t.projects.find(t=>t.name===e)),{can:l}=C(),u=l(`OmnitronRelease.deployments`),d=l(`OmnitronDeploy.getHistory`),p=l(`OmnitronProject.getDeployProgress`),[g,v]=(0,q.useState)(`stacks`),b=u&&(g===`stacks`||!d)?`stacks`:d?`legacy`:null,[x,w]=(0,q.useState)(!1),[E,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(0),[N,F]=(0,q.useState)(25),B=T(async()=>{if(!l(`OmnitronAudit.available`))throw Error(`Checking recorded stack starts requires access to audit availability.`);let e=await ne.deployments();if(!e.known)throw Error(e.why);return e},{intervalMs:15e3,enabled:b===`stacks`}),V=T(()=>a.getHistory({limit:Y}),{intervalMs:15e3,enabled:b===`legacy`}),H=T(()=>o.getDeployProgress(e?{project:e,...t&&{stack:t}}:void 0),{intervalMs:3e3,enabled:p,resourceKey:JSON.stringify([e,t,p])}),U=(B.data?.known?B.data.deployments:[]).filter(e=>n(`${e.project}/${e.stack}/_`)).sort((e,t)=>t.at.localeCompare(e.at)),G=(V.data??[]).filter(e=>n(e.app)),K=p?H.data??[]:[],{transfers:X,unscoped:Z}=e?D(K,s??{name:e},t):{transfers:K,unscoped:[]},re=b===`stacks`?U.length:G.length,Q=Math.min(A,Math.max(0,Math.ceil(re/N)-1)),ie=B.error,ae=async()=>{k(!0);try{await Promise.all([b===`stacks`&&B.refresh(),b===`legacy`&&V.refresh(),p&&H.refresh()])}finally{k(!1)}},$=e=>{F(e),j(0)};return(0,J.jsxs)(y,{spacing:2,sx:{minWidth:0},children:[(0,J.jsx)(P,{links:[{name:`Deployments`}],action:(0,J.jsxs)(y,{direction:`row`,spacing:1,useFlexGap:!0,sx:{flexWrap:`wrap`,alignItems:`center`},children:[(0,J.jsx)(_,{"data-console-command":`refresh`,"aria-label":`Refresh deployments`,size:`small`,onClick:ae,disabled:E,"aria-busy":E,children:(0,J.jsx)(M,{})}),l(`OmnitronProject.listStacks`)&&(0,J.jsx)(c,{component:r,to:`/stacks`,size:`small`,children:`Stacks`}),l(`OmnitronRelease.list`)&&(0,J.jsx)(c,{component:r,to:`/releases`,size:`small`,variant:`outlined`,children:l(`OmnitronProject.startStack`)?`Deploy a release`:`Releases`})]})}),p&&H.error&&(0,J.jsxs)(S,{severity:`warning`,variant:`outlined`,children:[`Transfer observations unavailable: `,H.error,`. Retained observations may be stale.`]}),p&&H.loading&&(0,J.jsx)(m,{role:`status`,variant:`caption`,children:`Reading transfer observations…`}),p&&!H.loading&&!H.error&&X.length===0&&(0,J.jsx)(m,{role:`status`,variant:`caption`,color:`text.secondary`,children:`No attributed transfer observations for this workspace.`}),(0,J.jsx)(W,{records:X,unavailable:!!H.error}),Z.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{size:`small`,onClick:()=>w(e=>!e),"aria-expanded":x,"aria-controls":`unscoped-transfers`,sx:{alignSelf:`flex-start`},children:[x?`Hide`:`Show`,` unscoped observations · `,Z.length]}),(0,J.jsxs)(ee,{id:`unscoped-transfers`,in:x,unmountOnExit:!0,children:[(0,J.jsx)(m,{variant:`caption`,color:`text.secondary`,children:`These controller reports have no recorded project or stack.`}),(0,J.jsx)(W,{records:Z,unavailable:!!H.error})]})]}),u&&d&&(0,J.jsx)(te,{value:b??`stacks`,onChange:e=>{v(e),j(0)},"aria-label":`Deployment records`,tabs:[{value:`stacks`,label:B.data&&!B.error?`Stack starts · ${U.length}`:`Stack starts`},{value:`legacy`,label:V.data&&!V.error?`App history · ${G.length}`:`App history`}]}),b===`stacks`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(m,{variant:`caption`,color:`text.secondary`,children:[`Latest recorded start per stack namespace. `,l(`OmnitronAudit.list`)&&(0,J.jsxs)(J.Fragment,{children:[`Full event history is in `,(0,J.jsx)(h,{component:r,to:`/audit`,children:`Audit`}),`.`]})]}),(0,J.jsx)(I,{minWidth:600,scrollLabel:`Recorded stack starts`,columns:[{key:`stack`,header:`Stack`,render:t=>{let n=i(`${t.project}/${t.stack}/_`)??t.stack;return e&&l(`OmnitronProject.getStack`)?(0,J.jsxs)(y,{children:[(0,J.jsx)(h,{component:r,to:`/stacks/${encodeURIComponent(n)}`,children:n}),(t.project!==e||t.stack!==n)&&(0,J.jsxs)(m,{variant:`caption`,color:`text.secondary`,children:[t.project,`/`,t.stack]})]}):(0,J.jsxs)(m,{variant:`body2`,children:[t.project,`/`,t.stack]})}},{key:`release`,header:`Recorded source`,render:e=>e.release?l(`OmnitronRelease.get`)?(0,J.jsx)(h,{component:r,to:`/releases/${encodeURIComponent(e.release)}`,sx:{overflowWrap:`anywhere`},children:e.release}):e.release:(0,J.jsx)(m,{variant:`body2`,children:e.releaseUnnamed?`Release identity missing from record`:`Working tree / source not recorded`})},{key:`at`,header:`Recorded at`,render:e=>R(e.at)},{key:`source`,header:`Trigger`,render:e=>e.source??`Not recorded`},{key:`actorId`,header:`Actor`,render:e=>(0,J.jsx)(m,{variant:`caption`,sx:{overflowWrap:`anywhere`},children:e.actorId??`Not recorded`})}],data:U.slice(Q*N,(Q+1)*N),total:U.length,loading:B.loading,loadError:ie,emptyMessage:`No stack start recorded for this workspace`,rowKey:e=>`${e.project}/${e.stack}`,page:Q,pageSize:N,onPageChange:j,onPageSizeChange:$,dense:!0})]}):b===`legacy`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(m,{variant:`caption`,color:`text.secondary`,children:[`Retained records from the retired per-app path. Its version labels and success statuses do not prove an artifact was installed. The latest `,Y,` controller records are filtered to this workspace.`]}),(0,J.jsx)(I,{minWidth:680,scrollLabel:`Legacy application operation records`,columns:[{key:`app`,header:`Application`,render:e=>(0,J.jsx)(m,{variant:`body2`,sx:{overflowWrap:`anywhere`},children:e.app})},{key:`version`,header:`Requested label`,render:e=>(0,J.jsx)(m,{variant:`caption`,sx:{fontFamily:`monospace`,overflowWrap:`anywhere`},children:e.version})},{key:`strategy`,header:`Requested strategy`,render:e=>e.strategy},{key:`status`,header:`Recorded outcome`,render:e=>(0,J.jsx)(f,{size:`small`,variant:`outlined`,label:e.status})},{key:`startedAt`,header:`Started`,render:e=>R(e.startedAt)},{key:`duration`,header:`Duration`,render:e=>{let t=e.completedAt?Date.parse(e.completedAt)-Date.parse(e.startedAt):NaN;return Number.isFinite(t)&&t>=0?L(t):`Not recorded`}},{key:`deployedBy`,header:`Recorded actor`,render:e=>e.deployedBy??`Not recorded`}],data:G.slice(Q*N,(Q+1)*N),total:G.length,loading:V.loading,loadError:V.error,emptyMessage:`No legacy app operation in this history window`,rowKey:e=>e.id,page:Q,pageSize:N,onPageChange:j,onPageSizeChange:$,dense:!0})]})]})}var q,J,Y;function X(){return(X=e((()=>{q=t(),s(),v(),p(),b(),u(),l(),g(),d(),j(),F(),x(),V(),N(),i(),U(),H(),E(),B(),w(),A(),k(),J=n(),Y=200})))()}X();export{G as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{i as t,t as n}from"./react-BN8qLIAi.js";import{H as r,O as i,S as a,h as o,l as s,z as c}from"./client-DFnuv2z3.js";import{Vt as l,Yt as u}from"./mui-BTN91yBK.js";import{D as d,F as f,H as p,I as m,M as h,O as g,Q as _,V as v,Z as y,at as b,ct as x,i as S,j as C,ot as w,r as T,st as E}from"./mui-BXSXx9c9.js";import{A as D,B as O,C as k,D as A,F as j,I as M,O as ee,S as te,a as ne,b as re,d as N,f as ie,k as ae,o as oe,w as se,x as ce,y as le,z as P}from"./mui-Cd711nOk.js";import{B as ue,it as de,l as fe,rt as pe,u as me,z as F}from"./mui-AnEgAVjz.js";import{_ as I,v as L}from"./mui-BwsIrivo.js";import{r as he,t as R}from"./alert-uBG6r9NW.js";import{c as z,l as ge,n as B,s as V,u as _e}from"./access-BvKK9dEv.js";import{n as ve,t as ye}from"./use-polled-resource-B22hhr5L.js";import{b as H,i as U,m as W,p as be,t as xe,x as Se}from"./project.store-DuCgv6Eq.js";import{G as Ce,M as we,m as Te}from"./icons-OboZgWSt.js";import{n as Ee,t as De}from"./operation-status-Bm1x1wTz.js";import{n as Oe,t as ke}from"./page-breadcrumbs-fR7Jmpp4.js";import{i as Ae,r as je}from"./deploy-progress-CUUwlYtQ.js";import{c as Me,d as Ne,f as Pe,i as G,o as Fe,p as Ie,s as K,u as Le}from"./release-bits-BJ6i23y0.js";import{n as Re,t as ze}from"./deploy-release-dialog-58lGZDNk.js";import{n as Be,t as Ve}from"./release-build-panel-BNXkwNE1.js";import{n as He,t as Ue}from"./release-deployment-state-gN8ZT3aq.js";function We(e,t){return s.invoke(`daemon`,`OmnitronRelease`,`attestOnNode`,[{release:e,stack:t}],{timeout:6e5})}function Ge({output:e}){let[t,n]=(0,q.useState)(!1);return(0,J.jsxs)(v,{sx:{pl:2,mb:.5},children:[(0,J.jsx)(f,{size:`small`,onClick:()=>n(e=>!e),sx:{minWidth:0,p:0,fontSize:11,textTransform:`none`},children:t?`hide what it printed`:`what it printed`}),t&&(0,J.jsx)(v,{component:`pre`,sx:{m:0,mt:.5,p:1,maxHeight:240,overflow:`auto`,borderRadius:1,bgcolor:`action.hover`,fontFamily:`monospace`,fontSize:11,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e})]})}function Ke({attestation:e}){let t=e.cleanup;if(!t&&!e.legalTextsUnread)return null;let n=Object.entries(t?.removed??{}).filter(([,e])=>e>0).map(([e,t])=>`${t} ${e}`),r=Object.entries(t?.retired??{}).filter(([,e])=>e>0).map(([e,t])=>`${t} ${e}`);return(0,J.jsxs)(v,{sx:{mt:.75,pl:1},"data-testid":`cleanup-${e.stack}`,children:[t&&(0,J.jsx)(P,{variant:`caption`,sx:{display:`block`,color:t.failed||t.run===null?`warning.main`:`text.secondary`},children:t.run===null?`cleanup not run — ${t.notRun??`the run had no name to remove by`}`:`cleanup: run ${t.run} removed ${n.length?n.join(`, `):`nothing — it had made nothing to remove`}`+(t.failed?` — FAILED: ${t.failed}`:``)}),r.length>0&&(0,J.jsxs)(P,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[`retired: `,r.join(`, `),` — blocked in place, their real-chain addresses still watched`]}),(t?.leftBehind??[]).map(e=>(0,J.jsxs)(P,{variant:`caption`,sx:{display:`block`,color:`warning.main`},children:[`left behind: `,e.what,` — `,e.why.join(`; `)||`no reason given`]},e.what)),e.legalTextsUnread&&(0,J.jsxs)(P,{variant:`caption`,sx:{display:`block`,color:`warning.main`},children:[`legal texts could not be read — `,e.legalTextsUnread]})]})}function qe({releaseId:e,project:t,attestations:n,onChanged:r}){let{can:a}=z(),o=a(`OmnitronRelease.attestOnNode`),s=a(`OmnitronProject.listStacks`),c=U(e=>e.stacksByProject),l=U(e=>e.fetchStacks),u=(0,q.useMemo)(()=>(c[t]??[]).filter(e=>e.type!==`local`),[c,t]),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(!1),[_,x]=(0,q.useState)(null),[S,w]=(0,q.useState)(null),[T,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(!1);(0,q.useEffect)(()=>{o&&s&&!c[t]&&l(t)},[o,s,t,c,l]),(0,q.useEffect)(()=>{!p&&u.length>0&&m(u[0].name)},[u,p]);let A=!!(T&&n.some(e=>e.stack===T.stack&&e.storedAt!==T.previous));(0,q.useEffect)(()=>{if(!T)return;if(A){D(null);return}let e=setInterval(r,5e3),t=setTimeout(()=>{k(!0),D(null)},6e5);return()=>{clearInterval(e),clearTimeout(t)}},[T,A,r]);let M=(0,q.useCallback)(async()=>{if(!p)return;let t=n.find(e=>e.stack===p)?.storedAt;k(!1),g(!0),w(null),x(null);try{x(await We(e,p)),r()}catch(e){let n=e.message;i(e)?D({stack:p,previous:t}):w(n)}finally{g(!1)}},[e,p,n,r]);return(0,J.jsx)(C,{variant:`outlined`,children:(0,J.jsxs)(d,{children:[(0,J.jsxs)(I,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,mb:1.5},children:[(0,J.jsx)(P,{variant:`subtitle2`,children:`Verified on stacks`}),(0,J.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`},children:`probes a running stack measured against this release`}),(0,J.jsx)(v,{sx:{flex:1}}),o&&s&&u.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ne,{select:!0,size:`small`,value:p,onChange:e=>m(e.target.value),disabled:h||T!==null,sx:{minWidth:120},children:u.map(e=>(0,J.jsx)(fe,{value:e.name,children:e.name},e.name))}),(0,J.jsx)(j,{title:`Uploads this release's own scripts to the stack's node and runs the probes there, under the node's deploy lease. The stack should be carrying this release — an attestation older than the last deployment is refused.`,arrow:!0,children:(0,J.jsx)(`span`,{children:(0,J.jsx)(f,{size:`small`,variant:`outlined`,onClick:()=>void M(),disabled:h||T!==null||!p,startIcon:h||T!==null?(0,J.jsx)(E,{size:14}):void 0,children:h?`Running on the node…`:T===null?`Run the probes`:`Awaiting result…`})})})]})]}),T!==null&&(0,J.jsxs)(b,{severity:`info`,sx:{mb:1.5},children:[`The gateway did not return a result. Checking for a new attestation on `,T.stack,` before another run.`]}),O&&(0,J.jsx)(b,{severity:`warning`,sx:{mb:1.5},children:`No new attestation was recorded within ten minutes. Inspect the node logs before retrying.`}),_&&(0,J.jsxs)(b,{severity:_.passed===_.gates?`success`:`warning`,sx:{mb:1.5},children:[_.passed,` of `,_.gates,` probes passed on `,_.node,` — probes from`,` `,_.scriptsFrom===`release`?`the release itself`:`the release's commit`,typeof _.sourceFiles==`number`&&(_.sourceFiles>0?`, with ${_.sourceFiles} application source files from that commit`:`, with no application sources — probes that read code said NOT RUN`),`.`,_.accounts?Je[_.accounts]:``]}),S&&(0,J.jsx)(b,{severity:`error`,sx:{mb:1.5},children:(0,J.jsx)(P,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:S})}),n.length===0?(0,J.jsxs)(P,{variant:`body2`,sx:{color:`text.secondary`},children:[`No stack has attested this release. A stack whose policy declares `,(0,J.jsx)(`code`,{children:`verifiedOn`}),` refuses it until one does.`]}):(0,J.jsx)(I,{spacing:2,children:n.map(e=>{let t=e.gates.filter(e=>e.status===`passed`).length;return(0,J.jsxs)(v,{children:[(0,J.jsxs)(I,{direction:`row`,spacing:1,sx:{alignItems:`center`,flexWrap:`wrap`},children:[(0,J.jsx)(y,{label:e.stack,size:`small`,variant:`outlined`,sx:{height:20,fontSize:11}}),(0,J.jsxs)(P,{variant:`body2`,sx:{fontWeight:600,fontFamily:`monospace`,color:t===e.gates.length?`success.main`:`error.main`},children:[t,`/`,e.gates.length]}),(0,J.jsx)(Fe,{gates:e.gates,size:9}),(0,J.jsx)(v,{sx:{flex:1}}),(0,J.jsxs)(P,{variant:`caption`,sx:{color:`text.secondary`},children:[`measured `,Ie(e.at),e.onNode.hosts.length>0?` on ${e.onNode.hosts.join(`, `)}`:``]}),e.onNode.claimed&&(0,J.jsx)(j,{title:e.onNode.matched===!0?`The producer confirmed it ran on one of the stack's nodes.`:`The producer could not confirm the machine it ran on.`,arrow:!0,children:(0,J.jsx)(y,{label:e.onNode.matched===!0?`on the node`:`node unconfirmed`,size:`small`,color:e.onNode.matched===!0?`success`:`warning`,variant:`outlined`,sx:{height:18,fontSize:10}})})]}),e.gates.some(e=>e.status!==`passed`)&&(0,J.jsx)(v,{sx:{mt:.75,pl:1},children:e.gates.filter(e=>e.status!==`passed`).map(e=>(0,J.jsxs)(v,{children:[(0,J.jsxs)(P,{variant:`caption`,sx:{display:`block`,color:`text.secondary`},children:[(0,J.jsx)(v,{component:`span`,sx:{color:G[e.status].color,fontWeight:600},children:G[e.status].label}),` `,(0,J.jsx)(v,{component:`span`,sx:{fontFamily:`monospace`},children:e.name}),e.detail?` — ${e.detail}`:``]}),e.output&&(0,J.jsx)(Ge,{output:e.output})]},e.name))}),(0,J.jsx)(Ke,{attestation:e})]},e.stack)})})]})})}var q,J,Je;function Y(){return(Y=e((()=>{V(),q=t(),w(),p(),m(),h(),g(),_(),x(),me(),L(),oe(),M(),O(),o(),xe(),Le(),J=n(),Je={provisioned:` Accounts were created by the run and removed at its end.`,"not-declared":` No accounts were provisioned — the stack does not declare release.attest.provision, so probes that sign in said NOT RUN.`,"producer-cannot":` No accounts were provisioned — the stack allows it, but this release's producer predates --provision.`}})))()}function Ye({source:e}){return!e||e.state===`invalid`?(0,X.jsx)(P,{variant:`caption`,color:`warning.main`,sx:{overflowWrap:`anywhere`},children:e?.reason??`Per-application provenance unavailable from this daemon`}):(0,X.jsxs)(v,{component:`details`,sx:{minWidth:0,overflowWrap:`anywhere`,"& > summary":{cursor:`pointer`,fontSize:12,color:`text.secondary`,borderRadius:.5,"&:focus-visible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:2}}},children:[(0,X.jsx)(v,{component:`summary`,children:e.via.length?`Imported · ${e.producerApp}`:`Built in this release`}),(0,X.jsxs)(I,{spacing:.75,sx:{mt:1},children:[(0,X.jsx)(P,{variant:`caption`,children:e.releaseId}),(0,X.jsxs)(P,{variant:`caption`,children:[`Project · `,e.project.repo,(0,X.jsx)(`br`,{}),e.project.commit]}),e.packageDirectory&&(0,X.jsxs)(P,{variant:`caption`,children:[`Package · `,e.packageDirectory]}),(0,X.jsxs)(P,{variant:`caption`,children:[`SDK · `,e.framework.repo,(0,X.jsx)(`br`,{}),e.framework.commit]}),(0,X.jsx)(P,{variant:`caption`,children:Se(e.target)}),e.via.map((e,t)=>(0,X.jsxs)(P,{variant:`caption`,children:[`Via `,e.release,`/`,e.app,(0,X.jsx)(`br`,{}),`Manifest · `,e.manifestSha256]},`${t}:${e.manifestSha256}:${e.app}`)),(0,X.jsx)(P,{variant:`caption`,color:`text.secondary`,children:`Recorded build inputs; current execution is shown in Deployment state.`})]})]})}var X;function Xe(){return(Xe=e((()=>{p(),L(),O(),W(),X=n()})))()}function Ze(){let{id:e=``}=r();return(0,Q.jsx)(Qe,{id:e},e)}function Qe({id:e}){let{can:t}=z(),n=t(`OmnitronRelease.builds`),r=t(`OmnitronRelease.getLog`),i=(0,Z.useRef)(0),[o,s]=(0,Z.useState)(null),[c,u]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),{data:_,loading:b,error:x,refresh:S}=ve(async()=>{let[t,r]=await Promise.all([Ae.get(e),n?Ae.builds().then(e=>({records:e,error:null})).catch(e=>({records:[],error:e.message})):{records:[],error:null}]);return{detail:t,builds:r}},{intervalMs:15e3,enabled:!!e,resourceKey:JSON.stringify([e,n])}),w=(0,Z.useCallback)(async t=>{let n=++i.current;s(t),m(null),g(null);try{let r=await a.getLog({id:e,name:t,lines:400});n===i.current&&m({name:r.name,tail:r.tail})}catch(e){n===i.current&&g(e.message)}finally{n===i.current&&s(null)}},[e]);if(b&&!_)return(0,Q.jsx)(ge,{});if(x&&!_)return(0,Q.jsxs)(I,{spacing:3,children:[(0,Q.jsx)(ke,{links:[{name:`Releases`,href:`/releases`},{name:e}]}),(0,Q.jsx)(R,{severity:`error`,variant:`outlined`,children:x})]});let E=_.detail,D=E.manifest,O=_.builds.records.find(t=>t.releaseId===e)??null;return(0,Q.jsxs)(I,{spacing:3,children:[(0,Q.jsx)(ke,{links:[{name:`Releases`,href:`/releases`},{name:e}],action:(0,Q.jsxs)(I,{direction:`row`,spacing:1,children:[(0,Q.jsx)(pe,{"data-console-command":`refresh`,size:`small`,onClick:()=>void S(),title:`Refresh`,children:(0,Q.jsx)(we,{})}),(0,Q.jsx)(B,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(f,{variant:`contained`,size:`small`,startIcon:(0,Q.jsx)(Te,{}),disabled:!E.complete,onClick:()=>u(!0),children:`Deploy…`})})]})}),x&&(0,Q.jsxs)(R,{severity:`warning`,children:[`Last confirmed manifest · `,x]}),_?.builds.error&&(0,Q.jsxs)(R,{severity:`warning`,children:[`Build activity unavailable · `,_.builds.error]}),!E.complete&&(0,Q.jsx)(R,{severity:E.manifestError?`error`:`warning`,variant:`outlined`,children:E.manifestError??`This directory holds no manifest: the build did not finish, and what is here is its logs. Nothing can be deployed from it.`}),O&&(0,Q.jsx)(Ve,{record:O,compact:O.state!==`running`}),(0,Q.jsx)(Ue,{project:E.project},E.project),(0,Q.jsxs)(F,{container:!0,spacing:2,children:[(0,Q.jsx)(F,{size:{xs:12,md:6},children:(0,Q.jsx)(C,{variant:`outlined`,sx:{height:`100%`},children:(0,Q.jsxs)(d,{children:[(0,Q.jsx)(P,{variant:`subtitle2`,sx:{mb:1.5},children:`Built from`}),(0,Q.jsx)(I,{spacing:1.5,children:[[`project`,E.projectCommit,E.projectRepo,E.onRemote.project],[`omni`,E.omniCommit,E.omniRepo,E.onRemote.omni]].map(([e,t,n,r])=>(0,Q.jsxs)(v,{children:[(0,Q.jsxs)(I,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,Q.jsx)(P,{variant:`body2`,sx:{fontWeight:600,minWidth:56},children:e===`project`?E.project:`omni`}),(0,Q.jsx)(P,{variant:`body2`,sx:{fontFamily:`monospace`},children:t?.slice(0,12)??`—`}),r===!1&&(0,Q.jsx)(j,{title:H({project:r,omni:!0},e===`project`?E.project:`omni`).detail,children:(0,Q.jsx)(y,{label:`Git: unpublished source`,size:`small`,color:`warning`,variant:`outlined`})}),r===null&&(0,Q.jsx)(j,{title:H({project:r,omni:!0},e===`project`?E.project:`omni`).detail,children:(0,Q.jsx)(y,{label:`Git: unverified`,size:`small`,variant:`outlined`})})]}),(0,Q.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`},children:n??`—`}),E.manifest?.[e]?.ref&&(0,Q.jsxs)(P,{component:`div`,variant:`caption`,sx:{color:`text.secondary`,overflowWrap:`anywhere`},children:[`Required ref: `,E.manifest[e].ref]})]},e))})]})})}),(0,Q.jsx)(F,{size:{xs:12,md:6},children:(0,Q.jsx)(C,{variant:`outlined`,sx:{height:`100%`},children:(0,Q.jsxs)(d,{children:[(0,Q.jsx)(P,{variant:`subtitle2`,sx:{mb:1.5},children:`Built with`}),(0,Q.jsxs)(I,{spacing:.75,children:[E.manifestSha256&&(0,Q.jsxs)(v,{component:`details`,sx:{overflowWrap:`anywhere`},children:[(0,Q.jsx)(P,{component:`summary`,variant:`caption`,sx:{cursor:`pointer`,color:`text.secondary`},children:`Manifest SHA-256`}),(0,Q.jsx)(P,{component:`code`,variant:`caption`,sx:{userSelect:`all`},children:E.manifestSha256})]}),(0,Q.jsxs)(P,{variant:`body2`,children:[Ie(E.builtAt),` · `,E.builtBy??`—`]}),(0,Q.jsxs)(P,{variant:`body2`,sx:{fontFamily:`monospace`,fontSize:13},children:[`omnitron `,E.builtWith??`—`]}),(0,Q.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`},children:Se(D?.builtWith?.target)}),(0,Q.jsxs)(P,{variant:`caption`,sx:{color:`text.secondary`},children:[D&&(0,Q.jsxs)(Q.Fragment,{children:[be(D),` · `]}),K(E.bytes),` on disk at `,E.root]}),E.statics&&(0,Q.jsxs)(P,{variant:`caption`,sx:{color:`text.secondary`},children:[`statics for `,(0,Q.jsx)(`strong`,{children:E.statics.stack}),` — `,E.statics.files,` files,`,` `,K(E.statics.bytes),` from `,D?.statics?.dir]}),E.machine&&(0,Q.jsxs)(P,{variant:`caption`,sx:{color:Pe(E.machine)?`warning.main`:`text.secondary`},children:[`machine while the gates ran: `,Ne(E.machine),Pe(E.machine)?` — load exceeded core count; inspect the gate logs for failure causes`:``]})]})]})})})]}),(0,Q.jsx)(C,{variant:`outlined`,children:(0,Q.jsxs)(d,{children:[(0,Q.jsxs)(I,{direction:`row`,spacing:1.5,sx:{alignItems:`center`,mb:1.5},children:[(0,Q.jsx)(P,{variant:`subtitle2`,children:`Gates`}),(0,Q.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`},children:E.gates.total===0?`none recorded — a stack that requires any refuses this release`:`${E.gates.passed} of ${E.gates.total} passed`}),(0,Q.jsx)(v,{sx:{flex:1}}),(0,Q.jsx)(Fe,{gates:E.gateList})]}),E.gateList.length>0&&(0,Q.jsx)(ce,{children:(0,Q.jsxs)(ae,{size:`small`,children:[(0,Q.jsx)(le,{children:(0,Q.jsxs)(N,{children:[(0,Q.jsx)(k,{children:`Gate`}),(0,Q.jsx)(k,{children:`Outcome`}),(0,Q.jsx)(k,{align:`right`,children:`Took`}),(0,Q.jsx)(k,{children:`Detail`})]})}),(0,Q.jsx)(A,{children:E.gateList.map((e,t)=>(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{sx:{fontFamily:`monospace`,fontSize:13},children:[e.name,e.checks!=null&&(0,Q.jsxs)(P,{component:`span`,variant:`caption`,sx:{color:`text.secondary`,ml:1},children:[e.checks,` checks`]})]}),(0,Q.jsx)(k,{children:(0,Q.jsx)(P,{variant:`caption`,sx:{color:G[e.status].color,fontWeight:600},children:G[e.status].label})}),(0,Q.jsx)(k,{align:`right`,children:(0,Q.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`,fontFamily:`monospace`},children:e.durationMs?Me(e.durationMs):`—`})}),(0,Q.jsx)(k,{children:(0,Q.jsx)(P,{variant:`caption`,sx:{color:`text.secondary`,whiteSpace:`pre-wrap`},children:e.detail??``})})]},`${e.name}-${t}`))})]})})]})}),E.complete&&(0,Q.jsx)(qe,{releaseId:E.id,project:E.project,attestations:E.attestations,onChanged:S}),(0,Q.jsx)(C,{variant:`outlined`,children:(0,Q.jsxs)(d,{children:[(0,Q.jsx)(P,{variant:`subtitle2`,sx:{mb:1.5},children:`Artifacts`}),(D?.artifacts??[]).length===0?(0,Q.jsx)(P,{variant:`body2`,sx:{color:`text.secondary`},children:`None.`}):(0,Q.jsx)(ce,{children:(0,Q.jsxs)(ae,{size:`small`,sx:{minWidth:540},children:[(0,Q.jsx)(le,{children:(0,Q.jsxs)(N,{children:[(0,Q.jsx)(k,{children:`App`}),(0,Q.jsx)(k,{children:`Source`}),(0,Q.jsx)(k,{align:`right`,children:`Size`}),(0,Q.jsx)(k,{children:`sha256`})]})}),(0,Q.jsx)(A,{children:(D?.artifacts??[]).map(e=>(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(k,{sx:{verticalAlign:`top`,maxWidth:200,overflowWrap:`anywhere`},children:[(0,Q.jsx)(P,{variant:`body2`,sx:{fontWeight:600},children:e.app}),(0,Q.jsx)(P,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`},children:e.version})]}),(0,Q.jsx)(k,{sx:{verticalAlign:`top`,maxWidth:360},children:(0,Q.jsx)(Ye,{source:E.artifactSources?.find(t=>t.app===e.app)})}),(0,Q.jsx)(k,{align:`right`,sx:{fontFamily:`monospace`,fontSize:13},children:K(e.bytes)}),(0,Q.jsx)(k,{children:(0,Q.jsx)(j,{title:e.sha256||`none recorded`,arrow:!0,children:(0,Q.jsx)(P,{variant:`caption`,sx:{fontFamily:`monospace`,color:`text.secondary`},children:e.sha256?`${e.sha256.slice(0,16)}…`:`—`})})})]},`${e.app}-${e.version}`))})]})}),(D?.artifactFailures??[]).map(e=>(0,Q.jsx)(R,{severity:`error`,variant:`outlined`,sx:{mt:1},children:(0,Q.jsxs)(P,{variant:`body2`,sx:{whiteSpace:`pre-wrap`},children:[(0,Q.jsx)(`strong`,{children:e.app}),` did not build — `,e.error.split(`
|
|
2
|
+
`)[0]]})},e.app))]})}),(0,Q.jsx)(C,{variant:`outlined`,children:(0,Q.jsxs)(d,{children:[(0,Q.jsx)(P,{variant:`subtitle2`,sx:{mb:1.5},children:`Build logs`}),E.logs.length===0?(0,Q.jsx)(P,{variant:`body2`,sx:{color:`text.secondary`},children:`This build wrote no logs.`}):(0,Q.jsx)(I,{direction:`row`,spacing:1,sx:{flexWrap:`wrap`},children:E.logs.map(e=>(0,Q.jsx)(y,{label:`${e.name} · ${K(e.bytes)}`,size:`small`,variant:p?.name===e.name?`filled`:`outlined`,disabled:!r,onClick:()=>void w(e.name),sx:{fontFamily:`monospace`,fontSize:11}},e.name))}),(0,Q.jsx)(De,{active:r&&!!o,label:`Reading ${o??``}`}),r&&h&&(0,Q.jsx)(R,{severity:`warning`,variant:`outlined`,sx:{mt:1.5},children:h}),r&&p&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{sx:{my:1.5}}),(0,Q.jsx)(v,{sx:{maxHeight:420,overflow:`auto`,p:1.5,borderRadius:1,bgcolor:e=>l(e.palette.text.primary,.04)},children:(0,Q.jsx)(P,{variant:`caption`,sx:{fontFamily:`monospace`,whiteSpace:`pre`,display:`block`},children:p.tail})})]})]})}),(0,Q.jsx)(B,{permission:`OmnitronProject.startStack`,children:(0,Q.jsx)(ze,{open:c,onClose:()=>u(!1),project:E.project,release:E})})]})}var Z,Q;function $(){return($=e((()=>{Z=t(),c(),p(),m(),h(),g(),_(),S(),ue(),de(),L(),D(),ee(),se(),te(),re(),ie(),M(),O(),u(),he(),Oe(),_e(),Ce(),Re(),Y(),Be(),He(),Xe(),W(),Le(),ye(),V(),Ee(),o(),je(),Q=n()})))()}$();export{Ze as default};
|