@lacneu/atrium 0.10.10 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-MJXVZGou.js +1 -0
- package/dist/assets/AdvancedFilter-t3zpDtnl.js +1 -0
- package/dist/assets/AgentFilesTab-z1c-GxXi.js +3 -0
- package/dist/assets/AnomaliesTab-BmwnNIbl.js +1 -0
- package/dist/assets/AuditTab-RXqDV_Yh.js +1 -0
- package/dist/assets/BridgeTab-DPYvTS38.js +1 -0
- package/dist/assets/ChatDefaultsTab-JlbFiV__.js +1 -0
- package/dist/assets/DataTableShell-DI2wUkxk.js +1 -0
- package/dist/assets/DetailChips-CgOS7kpk.js +1 -0
- package/dist/assets/FeedbacksTab-ZiKOPQ0R.js +1 -0
- package/dist/assets/FilesTab-DNvPAT7B.js +1 -0
- package/dist/assets/FilterBar-9k1La5AD.js +1 -0
- package/dist/assets/GroupsTab-TH3ZNuR7.js +1 -0
- package/dist/assets/InstancesTab-wASLef_U.js +1 -0
- package/dist/assets/IntegrationsTab-Cy0cPAse.js +1 -0
- package/dist/assets/KpiTab-BTD6oTyg.js +1 -0
- package/dist/assets/PreferencesTab--2YDaPN7.js +1 -0
- package/dist/assets/RolesTab-Cp5JtW0-.js +1 -0
- package/dist/assets/ServiceAccountsTab-BRofYmYQ.js +1 -0
- package/dist/assets/ThemeShowroom-DFMEaYmX.js +1 -0
- package/dist/assets/TimeRangePicker-ytbfLYAK.js +1 -0
- package/dist/assets/TracesTab-DNliGoeU.js +1 -0
- package/dist/assets/UsersTab-WK8-Dn2m.js +1 -0
- package/dist/assets/bundle-mjs-C73ZY4La.js +1 -0
- package/dist/assets/button-CugigrXc.js +1 -0
- package/dist/assets/card-6mfv2y9A.js +1 -0
- package/dist/assets/chevrons-up-down-C73YlC2o.js +1 -0
- package/dist/assets/compatView-dra_1R7u.js +1 -0
- package/dist/assets/confTabs-O2Cp4dmA.css +1 -0
- package/dist/assets/dispatchErrorInfo-4DotGcUz.js +1 -0
- package/dist/assets/dist-CZW3hxVF.js +44 -0
- package/dist/assets/dist-STr4vxtr.js +5 -0
- package/dist/assets/highlighted-body-OFNGDK62-Bulh0GF5.js +1 -0
- package/dist/assets/index-BMkJqrBA.js +220 -0
- package/dist/assets/index-CDcNRXdD.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-DjKrGUeH.js +1 -0
- package/dist/assets/roleDescriptions-DN8eyhnx.js +1 -0
- package/dist/assets/table-C3YR2wAA.js +1 -0
- package/dist/assets/x-Bol-Z6zU.js +1 -0
- package/dist/index.html +7 -2
- package/package.json +1 -1
- package/dist/assets/highlighted-body-OFNGDK62-bt3ucuhQ.js +0 -1
- package/dist/assets/index-H8yz6a5P.js +0 -268
- package/dist/assets/index-yQOsGOrG.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-AdR6Q7xN.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cr as r,Dr as i,Er as a,HS as o,SC as s,Sr as c,Tr as l,_r as u,br as d,gr as f,hC as p,hr as m,mr as h,pr as g,vr as _,wr as v,xr as y,yr as b}from"./dist-CZW3hxVF.js";import{C as x,S,b as C,m as w,x as T,y as E}from"./index-BMkJqrBA.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?f():m({group:e.group})}function k(e){return e===`common`?h():e===`owner`?g():m({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=s(p.admin.listUsers,{}),[t,n]=(0,D.useState)(``),u=s(p.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":a(),children:(0,A.jsx)(x,{placeholder:a()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):u===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:u.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:u.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),u.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),u.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:_()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:y()}),u.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:u.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),u.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:u.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fa as r,Ia as i,La as a,Ma as o,Na as s,Pa as c,Ra as l}from"./dist-CZW3hxVF.js";import{r as u}from"./TimeRangePicker-ytbfLYAK.js";import{t as d}from"./x-Bol-Z6zU.js";import{t as f}from"./button-CugigrXc.js";import{C as p,S as m,b as h,bt as g,kt as _,q as v,x as y,y as b}from"./index-BMkJqrBA.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:u(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(_,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(b,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:r()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(b,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(v,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(g,{}),o()]})]}):null]})}export{D as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,B as i,F as a,F_ as o,G as s,Gt as c,H as l,HS as u,I as d,J as f,K as p,L as m,Q as ee,R as h,SC as g,U as _,Ut as te,V as v,W as y,WS as ne,X as re,Y as b,Z as x,at as S,ct as ie,et as ae,hC as C,it as w,lt as oe,nt as se,ot as T,q as E,rt as D,st as O,tt as ce,ut as k,yC as A,z as j}from"./dist-CZW3hxVF.js";import{t as M}from"./button-CugigrXc.js";import{A as N,B as P,C as F,F as I,G as le,H as ue,K as de,L as fe,N as pe,P as me,R as he,S as L,U as ge,V as _e,W as ve,_ as R,at as z,b as B,m as V,mt as H,x as U,y as W,z as ye}from"./index-BMkJqrBA.js";import{i as G}from"./compatView-dra_1R7u.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
+
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
+
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=g(C.me.getMe,{host:z}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=g(C.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=g(C.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=g(C.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[d,f]=(0,K.useState)(null);(0,K.useEffect)(()=>{!l||l.length===0||(!d||!l.some(e=>$(e)===d))&&f($(l[0]))},[l,d]);let p=l?.find(e=>$(e)===d)??null,m=A(C.agentFiles.listAgentFiles),[h,_]=(0,K.useState)({status:`idle`}),v=p?.instanceName??null,y=p?.agentId??null,re=g(C.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),b=n&&v!==null?R(re,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,E=(0,K.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[m,v,y]);(0,K.useEffect)(()=>{x===!1&&E()},[E,x]);let[j,N]=(0,K.useState)(null),P=ne(),I=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":oe(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:(i??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(W,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":ie(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:l.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()})]}),p===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(H,{size:14,"aria-hidden":!0}),` `,G(b.gatewayVersion)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[S(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:te()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Y(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(V,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:D({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:se({pct:I.format(n)})}),i?(0,Q.jsx)(H,{size:14,className:`oc-afiles__warn`,"aria-label":ce()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?r():ee()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ae({used:Z(be(h.files),P),total:Z(J,P),pct:I.format(X(be(h.files)))})})]}),j&&p?(0,Q.jsx)(Te,{instanceName:p.instanceName,agentId:p.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void E()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:ee,onSaved:g}){let S=A(C.agentFiles.getAgentFile),ie=A(C.agentFiles.setAgentFile),ae=N(),[w,oe]=(0,K.useState)(null),[se,T]=(0,K.useState)(!1),[D,O]=(0,K.useState)(``),[ce,k]=(0,K.useState)(!1),[F,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{T(!1);try{let i=await S({instanceName:e,agentId:t,name:n});oe({content:i.content,updatedAtMs:i.updatedAtMs}),r||O(i.content),z(!1)}catch{T(!0)}},[S,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(w!==null){L(!0),V(!1);try{await ie({instanceName:e,agentId:t,name:n,content:D,baseUpdatedAtMs:w.updatedAtMs??void 0}),ae.success(s({name:n})),g(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=w!==null&&D!==w.content,G=(0,K.useMemo)(()=>w===null?null:Se(w.content,D),[w,D]),J=D.length>q,Y=ne(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(me,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(he,{children:x({name:n})}),(0,Q.jsxs)(I,{children:[re({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,b()]})]})]}),se?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:te()})]}):w===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:D,readOnly:!r,spellCheck:!1,onChange:e=>O(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:f()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[l(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:v()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:y()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:E({count:X.format(D.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||F||R,onClick:()=>k(!0),children:F?c():p()}):null]})]}),(0,Q.jsx)(ye,{open:ce,onOpenChange:k,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(le,{children:[(0,Q.jsx)(de,{children:i({name:n})}),(0,Q.jsx)(ge,{children:j({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:h({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:m()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:d()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(_e,{children:o()}),(0,Q.jsx)(P,{onClick:()=>void U(),children:a()})]})]})})]})})}export{we as AgentFilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Bu as i,Cu as ee,Du as a,Eu as te,Fu as ne,Gu as o,Hu as re,Iu as ie,Lu as ae,Mu as oe,Nu as s,Ou as c,Pu as l,Ru as u,SC as d,Su as f,Tu as se,Uu as p,Vu as ce,Wu as m,_u as le,au as h,bu as g,cu as ue,du as de,fu as fe,gu as pe,hC as _,hu as me,iu as v,ju as he,ku as ge,lu as y,mu as b,ou as x,pu as S,ru as C,su as w,uu as T,vu as E,wu as D,xC as O,xu as k,yu as A,zu as j}from"./dist-CZW3hxVF.js";import{n as M}from"./TimeRangePicker-ytbfLYAK.js";import{A as N,C as P,Mt as F,S as I,a as L,at as _e,b as R,j as ve,jt as z,m as B,r as ye,x as V,y as H}from"./index-BMkJqrBA.js";import{t as be}from"./FilterBar-9k1La5AD.js";import{t as xe}from"./DataTableShell-DI2wUkxk.js";import{t as U}from"./dispatchErrorInfo-4DotGcUz.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?o():e===`acknowledged`?m():p()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=F({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,o=e.status===q?K:e.status,p=e.severity??K,m=e.kind??K,[h,v]=(0,W.useState)(K),x=ye(e.from,e.to),{from:C,to:U}=M(x),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),Me=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=ve(),Z=N(),Q=O(_.anomalies.resolveAnomaly),Fe=(d(_.me.getMe,{host:_e})?.permissions??[]).includes(`admin.manage`),$=d(_.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:C,to:U,anomalyStatus:o===K?void 0:o,severity:p===K?void 0:p,source:h===K?void 0:h,kind:m===K?void 0:m}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||p!==K||h!==K||m!==K||x.kind!==`relative`||x.from!==Ee.from;function Re(){v(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:re(),description:(0,G.jsxs)(G.Fragment,{children:[ce(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,i(),` `,(0,G.jsx)(`strong`,{children:j()}),`.`,` `,u()]}),confirmLabel:ae()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(ie(),e.kind)}catch(e){Z.error(ne(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(l(),e.kind)}catch(e){Z.error(s(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,G.jsx)(`strong`,{children:he()}),` `,r(),` `,(0,G.jsx)(`strong`,{children:ge()}),` `,c(),` `,(0,G.jsx)(`strong`,{children:a()}),` `,te(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:se()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:D(),timeRange:x,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,G.jsxs)(H,{value:o,onValueChange:Y,children:[(0,G.jsx)(I,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(V,{value:K,children:ee()}),Se.map(e=>(0,G.jsx)(V,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(H,{value:p,onValueChange:Me,children:[(0,G.jsx)(I,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{placeholder:f()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(V,{value:K,children:k()}),we.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]}),(0,G.jsxs)(H,{value:h,onValueChange:v,children:[(0,G.jsx)(I,{size:`sm`,className:`w-32`,children:(0,G.jsx)(P,{placeholder:g()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(V,{value:K,children:A()}),Te.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]}),(0,G.jsxs)(H,{value:m,onValueChange:Ne,children:[(0,G.jsx)(I,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{placeholder:E()})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(V,{value:K,children:le()}),Ie.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:pe(),rows:$,emptyHint:o===`open`?me():b(),rowActions:e=>Fe&&e.status===`open`?[{label:S(),onSelect:()=>void ze(e)},{label:fe(),onSelect:()=>void Be(e)}]:[],columns:[{header:de(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:E(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:f(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:T(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,G.jsx)(B,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:y(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:ue(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:w(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Oe({row:e}){let t=z(),n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,x()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(B,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,G.jsx)(B,{variant:`secondary`,children:v()}):(0,G.jsx)(B,{variant:`outline`,children:C()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Gd as i,Hd as a,Id as o,Jd as s,Kd as c,Ld as l,Rd as u,SC as ee,Ud as d,Vd as f,Wd as p,Xd as m,Yd as h,hC as g,qd as _,zd as v}from"./dist-CZW3hxVF.js";import{n as y}from"./TimeRangePicker-ytbfLYAK.js";import{C as b,Mt as x,S,a as C,b as w,i as T,jt as E,o as D,r as O,t as k,x as A,y as j}from"./index-BMkJqrBA.js";import{t as M}from"./FilterBar-9k1La5AD.js";import{t as N}from"./AdvancedFilter-t3zpDtnl.js";import{t as P}from"./DataTableShell-DI2wUkxk.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=x({from:`/settings/audit`}),t=E({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...C(e)})}),Z=e=>void t({search:t=>({...t,adv:T(e)}),replace:!0}),Q=ee(g.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:s(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:_()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:c()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:i()}),(0,I.jsx)(A,{value:`yes`,children:p()}),(0,I.jsx)(A,{value:`no`,children:d()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:a()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:f()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:r(),rows:Q,emptyHint:v(),columns:[{header:u(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:_(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,As as i,Bs as a,Cs as o,Ds as s,Es as c,Fs as l,Gs as u,Hs as d,Is as f,Js as p,Ks as m,Ls as h,Ms as g,Ns as ee,Os as _,Ps as v,Qs as te,Rs as ne,SC as y,Ss as b,Ts as x,Us as re,Vs as ie,Ws as ae,Xs as oe,Ys as se,Zs as ce,_ as S,_s as C,a as w,ac as le,as as T,b as ue,bs as de,cs as fe,d as pe,ds as me,ec as he,f as ge,fs as _e,g as ve,gC as E,gs as ye,h as be,hC as D,hs as xe,ic as O,is as Se,js as Ce,kC as k,ks as we,l as Te,ls as Ee,m as De,ms as Oe,os as ke,p as Ae,ps as je,qs as Me,rc as Ne,rs as Pe,ss as Fe,tc as Ie,u as Le,us as Re,v as ze,vs as Be,ws as Ve,xC as He,xs as Ue,y as We,yC as Ge,ys as Ke,zs as qe}from"./dist-CZW3hxVF.js";import{t as Je}from"./chevrons-up-down-C73YlC2o.js";import{t as A}from"./button-CugigrXc.js";import{$ as Ye,A as Xe,C as j,Ct as Ze,Dt as Qe,Et as $e,F as et,J as tt,L as nt,N as rt,O as it,Ot as at,P as ot,Q as st,R as ct,S as M,St as lt,X as ut,Y as dt,Z as ft,_t as pt,at as mt,b as N,c as ht,jt as gt,kt as P,l as _t,m as F,mt as I,nt as vt,q as L,s as yt,u as bt,x as R,y as z}from"./index-BMkJqrBA.js";import{a as xt,i as B,n as St,o as V,r as H,t as Ct}from"./table-C3YR2wAA.js";import{t as wt}from"./FilterBar-9k1La5AD.js";import{a as U,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./compatView-dra_1R7u.js";import{t as W}from"./dispatchErrorInfo-4DotGcUz.js";var At=E(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),jt=E(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Mt=E(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1),Nt=[`gateway-http`,`shared-fs`,`off`],Pt=[`inline`,`shared-fs`];k.object({mediaMode:k.optional(k.union(k.literal(`gateway-http`),k.literal(`shared-fs`),k.literal(`off`))),inboundMediaMode:k.optional(k.union(k.literal(`inline`),k.literal(`shared-fs`))),rehydration:k.optional(k.boolean()),mediaMaxMb:k.optional(k.number()),inboundAgentMount:k.optional(k.string()),outboundAgentMount:k.optional(k.string())});var K={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function Ft(e){return{mediaMode:e.mediaMode??K.mediaMode,inboundMediaMode:e.inboundMediaMode??K.inboundMediaMode,rehydration:e.rehydration??K.rehydration,mediaMaxMb:e.mediaMaxMb??K.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??K.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??K.outboundAgentMount}}function It(e,t){let n={},r=r=>{(e[r]!==K[r]||t[r]!==void 0)&&(n[r]=e[r])};return r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`),n}function Lt(e){return e.filter(e=>e.state===`error`)}function Rt(e){return e.reachable&&Lt(e.targets).length===0}function zt(e){return e.state===`error`&&e.lastErrorCode!==null}function Bt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Vt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Ht(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Vt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function Ut(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Wt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Gt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Kt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function qt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Jt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Et(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Yt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=qt(t.key,e),a=qt(t.key,r);return i&&a?0:i?1:a?-1:n*Jt(t.key,e,r)})}function Xt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Zt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Qt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Et(e,t)??X(e,t))}var Z=n();function $t({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Wt),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,G.useMemo)(()=>Xt(o),[o]),c=(0,G.useMemo)(()=>Zt(o),[o]),l=(0,G.useMemo)(()=>Qt(o),[o]),u=(0,G.useMemo)(()=>Yt(Kt(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(wt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Be(),onReset:()=>r(Wt),canReset:Gt(n),children:[(0,Z.jsxs)(z,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:ye()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(R,{value:J,children:C()}),s.map(e=>(0,Z.jsx)(R,{value:e,children:tn(e)},e))]})]}),(0,Z.jsxs)(z,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:xe()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(R,{value:J,children:C()}),c.map(e=>(0,Z.jsx)(R,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(z,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Oe()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(R,{value:J,children:C()}),l.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):(0,Z.jsxs)(Ct,{className:`oc-conn__table`,children:[(0,Z.jsx)(xt,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:me(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Re(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ee(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:fe(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:Fe()}),(0,Z.jsx)(Q,{label:ke(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(St,{children:u.map(e=>(0,Z.jsx)(en,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Z.jsx)(P,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function en({r:e}){let t=zt(e)?W(e.lastErrorCode):null,n=Bt(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(nn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:de({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ke({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function tn(e){return e===`connected`?T():e===`error`?Se():Pe()}function nn({state:e}){return e===`connected`?(0,Z.jsx)(F,{variant:`secondary`,children:T()}):e===`error`?(0,Z.jsx)(F,{variant:`destructive`,children:Se()}):(0,Z.jsx)(F,{variant:`outline`,children:Pe()})}function rn(){return y(D.bridgeHealth.getBridgeHealth,{})}function an(){let e=rn(),t=y(D.compat.getBridgeCompat,{}),n=y(D.me.getMe,{host:mt})?.role===`admin`,r=y(D.admin.listInstances,n?{}:`skip`),i=gt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Ht(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Tt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(on,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ce()}),o.map(e=>(0,Z.jsx)(sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):null]})}function on({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(t.bridgeVersion)}),` · `,ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:we()});let a=Lt(e.targets),l=!e.reachable,u=Rt(e),d=u?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Z.jsx)($e,{size:22}):l?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?_():l?s():c({count:a.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,x({time:f})]}),p?(0,Z.jsx)(`span`,{children:Ve({time:p})}):null,r]}),l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:o()})]})}function sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Ot(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:kt(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=m===null?null:n.find(e=>e.name===m)??null,ee=new Set(n.map(e=>e.name));return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Ut(e)}),d?(0,Z.jsx)(F,{variant:d===`beyond`?`destructive`:`secondary`,children:Dt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Z.jsx)(cn,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c,canConfigure:e=>ee.has(e),onConfigure:h}),(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(P,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0}),b({count:t.length})]}),f?(0,Z.jsx)($t,{connections:t,displayByInstance:s}):null,g?(0,Z.jsx)(ln,{instance:g,onClose:()=>h(null)},g._id):null]})}function cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:a,canConfigure:o,onConfigure:s}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:De()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Ae({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(pn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(e.version)}),(0,Z.jsx)(F,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Dt(e.state)}),o(e.instanceName)?(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(vt,{asChild:!0,children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,className:`oc-compat__target-menu`,"aria-label":O(),children:(0,Z.jsx)(Ze,{size:16,"aria-hidden":!0})})}),(0,Z.jsx)(st,{align:`end`,children:(0,Z.jsx)(Ye,{onSelect:()=>s(e.instanceName),children:O()})})]}):null]},e.instanceName))})]})}function ln({instance:e,onClose:t}){return(0,Z.jsx)(rt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ot,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(nt,{children:[(0,Z.jsx)(ct,{children:le({instance:e.displayName??e.name})}),(0,Z.jsx)(et,{children:Ne()})]}),(0,Z.jsx)(fn,{instance:e,onClose:t})]})})}function un({text:e}){return(0,Z.jsx)(_t,{delayDuration:150,children:(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,Z.jsx)(At,{"aria-hidden":!0})})}),(0,Z.jsx)(ht,{className:`max-w-xs text-pretty`,children:e})]})})}function $({label:e,help:t}){return(0,Z.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,Z.jsx)(un,{text:t})]})}function dn({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)($e,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?l():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function fn({instance:e,onClose:t}){let n=He(D.admin.upsertInstanceConfig),i=Ge(D.bridge.validateMediaPaths),o=Xe(),[s,c]=(0,G.useState)(()=>Ft(e.config??{})),[l,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(null),S=s.inboundMediaMode===`shared-fs`,C=s.mediaMode===`shared-fs`,w=S||C;async function le(){y(!0),x(null);try{x(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){o.error(qe(),e)}finally{y(!1)}}async function T(){_(!0);try{let r=e.config??{};await n({instanceId:e._id,config:It(s,r)}),t()}catch(e){o.error(oe(),e)}finally{_(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)($,{label:Ie(),help:se()}),(0,Z.jsxs)(z,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:Nt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)($,{label:he(),help:p()}),(0,Z.jsxs)(z,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(N,{children:Pt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)($,{label:r(),help:Me()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),w&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[S&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)($,{label:u(),help:ae()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),C&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)($,{label:re(),help:d()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(it,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)($,{label:te(),help:m()})]}),w&&b!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:b.reachable?!b.inbound&&!b.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),g({reason:b.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dn,{label:h(),result:b.inbound}),(0,Z.jsx)(dn,{label:f(),result:b.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),ee()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[w&&(0,Z.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void le(),disabled:v,children:[v?(0,Z.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,v?a():ie()]}),(0,Z.jsx)(A,{size:`sm`,onClick:()=>void T(),disabled:l,children:ce()})]})]})})}function pn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(ut,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ge():pe({count:e.length}),(0,Z.jsx)(P,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Le()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(F,{variant:`secondary`,children:e},e))})]})]})}export{an as BridgeTab,ln as InstanceConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,C as i,D as a,E as o,F_ as s,Gt as c,HS as l,M as ee,N as te,O as ne,Rt as re,S as ie,SC as u,T as d,Ut as f,hC as p,j as ae,k as oe,lt as m,nc as h,w as g,x as se,yC as _,zt as ce}from"./dist-CZW3hxVF.js";import{t as v}from"./button-CugigrXc.js";import{A as le,B as ue,C as de,G as fe,H as pe,K as me,S as he,U as y,V as b,W as x,_ as S,b as C,g as w,mt as T,v as E,x as D,y as O,z as k}from"./index-BMkJqrBA.js";import{i as A}from"./compatView-dra_1R7u.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var P=n();function F(){let e=_(p.agentFiles.getChatDefaults),t=_(p.agentFiles.setChatDefaults),n=le(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=u(p.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=u(p.compat.forInstance,U?{instanceName:U}:`skip`),K=U?S(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(o()),await X()}catch(e){n.error(d(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:E(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ce()},{id:`standard`,label:re()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsxs)(O,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(he,{size:`sm`,"aria-label":m(),children:(0,P.jsx)(de,{})}),(0,P.jsx)(C,{children:(H??[]).map(e=>(0,P.jsx)(D,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,P.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:f()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(v,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?c():a()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:g()})]}),(0,P.jsx)(k,{open:ge,onOpenChange:z,children:(0,P.jsxs)(pe,{children:[(0,P.jsxs)(fe,{children:[(0,P.jsx)(me,{children:i()}),(0,P.jsx)(y,{children:ie()})]}),(0,P.jsxs)(x,{children:[(0,P.jsx)(b,{children:s()}),(0,P.jsx)(ue,{onClick:()=>void be(),children:se()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gi as r,Ji as i,Ki as a,Wi as o,Xi as s,Yi as c,qi as l}from"./dist-CZW3hxVF.js";import{t as u}from"./chevrons-up-down-C73YlC2o.js";import{t as d}from"./button-CugigrXc.js";import{$ as f,Ct as p,Dt as m,O as h,Q as g,Z as _,bt as v,ht as y,kt as b,nt as x,tt as S}from"./index-BMkJqrBA.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C3YR2wAA.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(v,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(m,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(b,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(h,{"aria-label":a(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(x,{asChild:!0,children:(0,M.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(p,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(S,{}):null,(0,M.jsx)(f,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{m as t}from"./index-BMkJqrBA.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,Bm as a,Cm as o,Dm as s,Em as c,Fm as l,Gm as u,Hm as d,Im as f,Jm as p,Km as m,Lm as h,Mm as g,Nm as _,Om as v,Pm as y,Qm as ee,Rm as te,SC as ne,Sm as re,Tm as ie,Um as ae,Vm as b,Wm as x,Xm as S,Ym as C,Zm as w,_m as T,ah as E,bm as D,ch as O,dh as k,dm as A,eh as j,fh as M,fm as N,gm as P,hC as F,hm as I,ih as L,jm as R,km as z,lh as oe,mm as B,nh as V,oh as H,pm as U,qm as W,rh as G,sh as K,th as q,uh as se,vm as ce,wm as le,xC as J,xm as ue,ym as de,zm as fe}from"./dist-CZW3hxVF.js";import{t as pe}from"./button-CugigrXc.js";import{j as me}from"./index-BMkJqrBA.js";import{t as he}from"./DataTableShell-DI2wUkxk.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>M(),incorrect:()=>k(),incoherence:()=>se(),formatting:()=>oe(),latency:()=>O(),api_error:()=>K(),other:()=>H()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:L()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:G()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=J(F.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1);async function v(){let t=c.trim();if(!(!t||g)){_(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{_(!1)}}}let y=[];try{y=n.contextJson?JSON.parse(n.contextJson):[]}catch{y=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${V()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?r():ee()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:w()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:S(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void v(),disabled:!c.trim()||g,children:g?C():p()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||m()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||m()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,y.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae({count:n.contextCount??y.length,truncated:n.contextTruncated?d():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?te({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,f()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=ne(F.feedback.listForAdmin,{}),t=J(F.feedback.readSnapshot),n=J(F.feedback.deleteFeedback),r=me(),[a,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({});async function p(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}u(e._id)}async function m(e){await r({title:U(),description:N(),confirmLabel:A(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,X.jsx)(`strong`,{children:y()}),` `,_()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,X.jsx)(ge,{data:d[e._id],closeReason:e.userCloseReason}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:v(),cell:e=>e.messageRole===`user`?s():c(),sort:e=>e.messageRole},{header:ie(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${le({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:o(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:re(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ue(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:de()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ce()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?P():I(),onSelect:()=>void p(e)},{label:B(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as ee,Bx as te,F_ as ne,Gx as re,HS as ie,Hx as ae,Jx as oe,Kx as se,Qx as ce,SC as r,Ux as i,Vx as a,WS as o,Wx as s,Xx as c,Yx as le,Zx as ue,_S as l,aS as u,bS as de,cS as d,dS as fe,eS as pe,fS as me,gS as f,hC as p,hS as he,iS as m,lS as h,mS as ge,nS as _e,oS as g,pS as ve,qx as _,rS as v,sS as y,tS as b,uS as x,vS as S,xC as C,yS as w,zx as T}from"./dist-CZW3hxVF.js";import{t as E}from"./button-CugigrXc.js";import{$ as D,A as O,B as k,C as A,Ct as j,G as M,H as N,K as P,Q as F,S as I,U as ye,V as be,W as xe,Z as Se,b as L,ht as Ce,m as we,nt as Te,wt as R,x as z,y as B,yt as Ee,z as De}from"./index-BMkJqrBA.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-C3YR2wAA.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return h();case`audio`:return d();case`video`:return y();case`pdf`:return g();case`document`:return u();case`archive`:return m();default:return v()}}function J(){let[e,t]=(0,W.useState)(K),[n,u]=(0,W.useState)(K),[d,m]=(0,W.useState)(K),[h,g]=(0,W.useState)(K),[v,y]=(0,W.useState)(null),J=C(p.files.softDelete),Y=O();function je(){t(K),u(K),m(K),g(K)}async function Me(){let e=v;if(y(null),e)try{await J({fileId:e.id}),Y.success(se())}catch(e){Y.error(re(),e)}}let X=r(p.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:d===K?void 0:d,category:h===K?void 0:h}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||d!==K||h!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":w(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(L,{children:[(0,G.jsx)(z,{value:K,children:S()}),(0,G.jsx)(z,{value:`inbound`,children:l()}),(0,G.jsx)(z,{value:`outbound`,children:f()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:u,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":he(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(L,{children:[(0,G.jsx)(z,{value:K,children:ge()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:d,onValueChange:m,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":ve(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(L,{children:[(0,G.jsx)(z,{value:K,children:me()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:h,onValueChange:g,children:[(0,G.jsx)(I,{size:`sm`,"aria-label":fe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(L,{children:[(0,G.jsx)(z,{value:K,children:x()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),le()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?te():a()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:_e()}),(0,G.jsx)(V,{children:b()}),(0,G.jsx)(V,{children:pe()}),(0,G.jsx)(V,{children:ee()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{className:`text-right`,children:ue()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?l():f()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(Te,{asChild:!0,children:(0,G.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":oe(),children:(0,G.jsx)(j,{size:16})})}),(0,G.jsxs)(F,{align:`end`,children:[e.url?(0,G.jsx)(D,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(R,{size:14}),c()]})}):(0,G.jsxs)(D,{disabled:!0,children:[(0,G.jsx)(R,{size:14}),ae()]}),(0,G.jsxs)(D,{variant:`destructive`,onSelect:()=>y({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Ce,{size:14}),_()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:T({cap:Fe})}):null]}),(0,G.jsx)(De,{open:v!==null,onOpenChange:e=>!e&&y(null),children:(0,G.jsxs)(N,{children:[(0,G.jsxs)(M,{children:[(0,G.jsx)(P,{children:s()}),(0,G.jsx)(ye,{children:i()})]}),(0,G.jsxs)(xe,{children:[(0,G.jsx)(be,{children:ne()}),(0,G.jsx)(k,{onClick:()=>void Me(),children:_()})]})]})})]})}export{J as FilesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Qi as r,Zi as i}from"./dist-CZW3hxVF.js";import{t as a}from"./TimeRangePicker-ytbfLYAK.js";import{t as o}from"./button-CugigrXc.js";import{q as s,vt as c,yt as l}from"./index-BMkJqrBA.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(a,{value:m,onChange:h}):null,(0,d.jsxs)(o,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(l,{}),i()]})]})}export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$n as i,An as a,Bn as o,Cn as s,Dn as c,En as l,Fn as u,Gn as d,Hn as f,In as p,Jn as m,Kn as h,Ln as g,Mn as _,Nn as v,On as y,Pn as b,Qn as x,Rn as ee,SC as S,Sn as C,Tn as te,Un as ne,Vn as re,Wn as ie,Xn as w,Yn as ae,Zn as T,_n as oe,an as se,ar as E,bn as D,cC as O,cn as ce,cr as le,dn as ue,dr as k,eC as A,er as de,fn as fe,fr as j,gC as M,gn as N,hC as P,hn as F,iC as pe,in as me,ir as he,jn as ge,kn as _e,ln as ve,lr as ye,mn as be,n as I,nr as xe,on as Se,or as Ce,pn as we,qn as Te,rn as Ee,rr as De,sC as L,sn as R,sr as Oe,t as ke,tC as Ae,tr as je,un as Me,ur as Ne,vn as Pe,wn as Fe,xC as z,xn as Ie,yn as Le,zn as Re}from"./dist-CZW3hxVF.js";import{t as ze}from"./x-Bol-Z6zU.js";import{t as B}from"./button-CugigrXc.js";import{A as V,C as Be,F as Ve,L as He,N as Ue,O as H,Ot as We,P as Ge,R as Ke,S as qe,_t as U,at as Je,b as Ye,dt as Xe,ft as Ze,gt as W,h as Qe,j as $e,m as G,pt as et,q as K,ut as tt,x as nt,y as rt}from"./index-BMkJqrBA.js";import{t as it}from"./FilterBar-9k1La5AD.js";import{t as at}from"./DataTableShell-DI2wUkxk.js";import{t as q}from"./DetailChips-CgOS7kpk.js";var ot=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),st=M(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),J=M(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ct=M(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Y=t(e(),1),X=n(),Z=`Tabs`,[lt,ut]=pe(Z,[Ze]),dt=Ze(),[ft,Q]=lt(Z),pt=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:c,activationMode:l=`automatic`,...u}=e,d=et(c),[f,p]=Ae({prop:i,onChange:a,defaultProp:o??``,caller:Z});return(0,X.jsx)(ft,{scope:n,baseId:r(),value:f,onValueChange:p,orientation:s,dir:d,activationMode:l,children:(0,X.jsx)(O.div,{dir:d,"data-orientation":s,...u,ref:t})})});pt.displayName=Z;var mt=`TabsList`,ht=Y.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Q(mt,n),o=dt(n);return(0,X.jsx)(Xe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(O.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ht.displayName=mt;var gt=`TabsTrigger`,_t=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Q(gt,n),s=dt(n),c=bt(o.baseId,r),l=xt(o.baseId,r),u=r===o.value;return(0,X.jsx)(tt,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(O.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:L(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:L(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:L(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});_t.displayName=gt;var vt=`TabsContent`,yt=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Q(vt,n),c=bt(s.baseId,r),l=xt(s.baseId,r),u=r===s.value,d=Y.useRef(u);return Y.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(A,{present:i||u,children:({present:n})=>(0,X.jsx)(O.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});yt.displayName=vt;function bt(e,t){return`${e}-trigger-${t}`}function xt(e,t){return`${e}-content-${t}`}var St=pt,Ct=ht,wt=_t,Tt=yt;function Et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function Dt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function Ot(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function kt(e){switch(e){case`admin`:return v();case`user`:return _();case`pending`:return ge();default:return e}}function At(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function jt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}function Mt({className:e,orientation:t=`horizontal`,...n}){return(0,X.jsx)(St,{"data-slot":`tabs`,"data-orientation":t,className:I(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Nt=ke(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Pt({className:e,variant:t=`default`,...n}){return(0,X.jsx)(Ct,{"data-slot":`tabs-list`,"data-variant":t,className:I(Nt({variant:t}),e),...n})}function Ft({className:e,...t}){return(0,X.jsx)(wt,{"data-slot":`tabs-trigger`,className:I(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function It({className:e,...t}){return(0,X.jsx)(Tt,{"data-slot":`tabs-content`,className:I(`flex-1 text-sm outline-none`,e),...t})}var $={name:``,description:``};function Lt(){let e=S(P.groups.listGroups,{}),t=S(P.me.getMe,{host:Je})?.role===`admin`,n=z(P.groups.createGroup),r=z(P.groups.updateGroup),a=z(P.groups.deleteGroup),o=$e(),s=V(),[c,l]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(null),[p,g]=(0,Y.useState)($),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(``),ee=(0,Y.useMemo)(()=>{if(!e)return e;let t=y.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,y]);function C(){f(null),g($),l(!0)}function te(e){f(e),g({name:e.name,description:e.description??``}),l(!0)}async function ne(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),g($),f(null),l(!1)}catch(e){s.error(Se(),e)}}async function re(e){if(await o({title:Te({name:e.name}),description:h(),confirmWord:e.name,confirmLabel:d(),cancelLabel:i(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(se(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}),(0,X.jsx)(it,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:he()}),(0,X.jsx)(at,{title:j(),rows:ee,addLabel:Ne(),onAdd:t?C:void 0,emptyHint:ye(),columns:[{header:le(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(ct,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,X.jsx)(J,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:Ce(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:E(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(st,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,X.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:xe(),onSelect:()=>te(e)},{label:je(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,X.jsx)(Qe,{open:c,onOpenChange:l,title:u?T():x(),description:w(),canSubmit:!!p.name.trim(),onSubmit:ne,submitLabel:de(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(K,{value:p.name,onChange:e=>g({...p,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:m()}),(0,X.jsx)(K,{value:p.description,onChange:e=>g({...p,description:e.target.value})})]})]})}),(0,X.jsx)(Bt,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,X.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,X.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,X.jsx)(ot,{size:14,"aria-hidden":!0}),p()]}),(0,X.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":b({page:e,pages:t}),children:[e,` / `,t]}),(0,X.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[u(),(0,X.jsx)(We,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=S(P.groups.getGroup,n&&e?{groupId:e}:`skip`),s=S(P.groups.listAssignableInstances,n?{}:`skip`),c=S(P.groups.listAssignableUsers,n?{}:`skip`),u=z(P.groups.addMember),d=z(P.groups.removeMember),p=z(P.groups.bulkSetMembers),m=z(P.groups.setGroupManager),h=V(),[_,v]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(`members`),[ae,T]=(0,Y.useState)(1),[oe,se]=(0,Y.useState)(new Set),E=(0,Y.useRef)(null),D=(0,Y.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),O=(0,Y.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),le=i?.viewerIsAdmin===!0,k=(0,Y.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Y.useEffect)(()=>{v(``),x(``),w(`members`),T(1),E.current=null},[n,e]),(0,Y.useEffect)(()=>{T(1)},[_]),(0,Y.useEffect)(()=>{n&&i&&e&&E.current!==e&&(E.current=e,se(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Y.useMemo)(()=>c?Et(c,_,oe):[],[c,_,oe]);async function de(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(me(),e)}}async function fe(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(ce(),e)}}let j=At(A,e=>D.has(e.userId)),M=A.filter(e=>D.has(e.userId)).length,N=jt(A,ae,Rt);async function F(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:j!==`all`})}catch(e){h.error(me(),e)}}return(0,X.jsx)(Ue,{open:n,onOpenChange:r,children:(0,X.jsxs)(Ge,{className:`oc-access`,children:[(0,X.jsxs)(He,{children:[(0,X.jsx)(Ke,{children:ie({name:t})}),(0,X.jsx)(Ve,{children:ne()})]}),(0,X.jsxs)(Mt,{value:C,onValueChange:w,className:`oc-access__tabs`,children:[(0,X.jsxs)(Pt,{className:`w-full`,children:[(0,X.jsxs)(Ft,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(ct,{size:13,"aria-hidden":!0}),f(),i?(0,X.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,X.jsxs)(Ft,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(U,{size:13,"aria-hidden":!0}),o(),i?(0,X.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,X.jsxs)(Ft,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(st,{size:13,"aria-hidden":!0}),Le(),i?(0,X.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,X.jsx)(It,{value:`members`,children:c===void 0||i===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:y()}):c.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{value:_,onChange:e=>v(e.target.value),placeholder:re(),className:`oc-access__search`}),A.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,X.jsxs)(X.Fragment,{children:[A.length>1?(0,X.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,X.jsx)(H,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void F(),"aria-label":g()}),(0,X.jsx)(`span`,{className:`oc-access__label`,children:g()}),(0,X.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[M,` / `,A.length]})]}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=D.has(e.userId),n=Ot(e),r=O.has(e.userId);return(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:t,onCheckedChange:()=>void de(e.userId,t),"aria-label":a({user:n.primary})}),(0,X.jsxs)(`span`,{className:`oc-access__who`,children:[(0,X.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,X.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,X.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:kt(e.role)}),(0,X.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&le?(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ve():Me(),title:r?ve():Me(),onClick:()=>void fe(e.userId,r),children:(0,X.jsx)(J,{size:15,"aria-hidden":!0})}):t&&r?(0,X.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ue(),title:ue(),children:(0,X.jsx)(J,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,X.jsx)(zt,{page:N.page,pageCount:N.pageCount,onPage:T})]})]})}),(0,X.jsx)(It,{value:`agents`,children:s===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:y()}):s.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{value:b,onChange:e=>x(e.target.value),placeholder:Re(),className:`oc-access__search`}),(0,X.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,X.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:b},`${e}-${t._id}`))})]})}),(0,X.jsx)(It,{value:`charts`,children:(0,X.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=S(P.groups.listAssignableAgents,{instanceName:t}),o=z(P.groups.assignAgentToGroup),l=z(P.groups.removeAgentFromGroup),u=z(P.groups.bulkSetGroupAgents),d=V(),[f,p]=(0,Y.useState)(1);if((0,Y.useEffect)(()=>{p(1)},[i]),!e)return null;let m=Dt(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let _=m.filter(e=>e.presentInLastOk!==!1),v=At(_,e=>r.has(`${t}/${e.agentId}`)),y=jt(m,f,Rt);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(Ee(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(Ee(),e)}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(U,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,X.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:C()}):null]}),a===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:c()}):m.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:h?s():Fe()}):(0,X.jsxs)(X.Fragment,{children:[_.length>1?(0,X.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,X.jsx)(H,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":g()}),(0,X.jsx)(`span`,{className:`oc-access__label`,children:g()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":_e({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":D(),title:D(),children:(0,X.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,X.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Ie()}):null]},e.agentId)}),(0,X.jsx)(zt,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function Ht({groupId:e}){let t=S(P.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(P.charts.assignChartToGroup),r=z(P.charts.removeChartFromGroup),i=z(P.charts.setGroupDefaultChart),a=z(P.charts.addChartToGroupPool),o=z(P.charts.removeChartFromGroupPool),s=V();if(!e)return null;if(t===void 0)return(0,X.jsx)(`p`,{className:`oc-access__hint`,children:y()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Pe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":be({name:e.name})}),(0,X.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":we(),title:we(),children:(0,X.jsx)(W,{size:14,fill:`currentColor`})}):(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:fe()}):null,u?(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":F({name:e.name}),title:F({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,X.jsx)(ze,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,X.jsxs)(rt,{value:``,onValueChange:e=>void p(e),children:[(0,X.jsx)(qe,{size:`sm`,className:`oc-access__search`,children:(0,X.jsx)(Be,{placeholder:N()})}),(0,X.jsx)(Ye,{children:l.map(e=>(0,X.jsx)(nt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):null:null]})}export{Lt as GroupsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$f as i,Af as a,Ap as o,Bf as s,Cf as c,Cp as l,Cv as u,Df as d,Dp as f,Ef as p,Ep as m,Ff as h,Fp as g,Gf as _,Hf as v,If as y,Ip as b,Jf as x,Kf as S,Lf as C,Lp as w,Mf as ee,Mp as T,Nf as E,Np as D,Of as te,Op as ne,Pf as re,Pp as ie,Qd as ae,Qf as oe,Rf as se,SC as O,Sf as ce,Sp as le,Sv as k,Tf as ue,Tp as de,Uf as A,Vf as fe,Wf as pe,Xf as me,Yf as he,Zd as ge,Zf as _e,_f as ve,_p as ye,af as be,ap as xe,bf as Se,bp as Ce,cf as we,cp as Te,df as Ee,dp as De,ef as Oe,ep as j,ff as ke,fp as Ae,gf as je,gp as Me,hC as M,hf as Ne,hp as Pe,if as Fe,ip as Ie,jf as Le,jp as Re,kf as ze,kp as Be,lf as Ve,lp as He,mf as Ue,mp as We,nf as Ge,np as Ke,of as qe,op as Je,pf as Ye,pp as Xe,qf as N,rf as Ze,rp as Qe,sf as $e,sp as et,tf as tt,tp as nt,uf as rt,up as it,vf as P,vp as at,wf as ot,wp as st,xC as F,xf as I,xp as ct,yC as L,yf as lt,yp as ut,zf as dt}from"./dist-CZW3hxVF.js";import{t as R}from"./button-CugigrXc.js";import{A as z,C as ft,F as B,J as pt,L as V,N as H,O as U,P as W,R as G,S as mt,X as ht,Y as gt,b as _t,h as vt,j as yt,m as K,q,x as J,y as bt}from"./index-BMkJqrBA.js";import{t as xt}from"./DataTableShell-DI2wUkxk.js";import{InstanceConfigDialog as St}from"./BridgeTab-DPYvTS38.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Ct=new Set(X),wt=`conversational`;function Tt(e){let t=new Set((e??[]).filter(e=>Ct.has(e)));return t.size===0?[wt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``},Et={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Dt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``}}function Ot(){let e=O(M.admin.listInstances,{}),t=O(M.agents.listAllInstanceAgents,{}),n=F(M.admin.upsertInstance),r=F(M.admin.deleteInstance),i=z(),[a,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,p]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:x??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0}),u(Q),S(null),s(!1)}catch(e){i.error(g(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),(0,Z.jsx)(`strong`,{children:D()}),T()]}),(0,Z.jsx)(xt,{title:Re(),rows:e,addLabel:o(),onAdd:()=>{S(null),u(Q),s(!0)},emptyHint:Be(),columns:[{header:ne(),cell:e=>e.name,sort:e=>e.name},{header:f(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:m(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:de(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:w(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(K,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ae():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ct(),onSelect:()=>{S(e._id),u(Dt(e)),s(!0)}},{label:b(),onSelect:()=>p(e.name)},{label:Je(),onSelect:()=>y(e)},{label:st(),onSelect:()=>_(e)},{label:l(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:l(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(vt,{open:a,onOpenChange:s,title:x?Ce():le(),description:at(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:C,submitLabel:ye(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(q,{value:c.name,disabled:x!==null,onChange:e=>u({...c,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ut()}):null]}),(0,Z.jsx)($,{label:Pe(),children:(0,Z.jsxs)(bt,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(mt,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(ft,{})}),(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(q,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(q,{value:c.bridgeUrl,placeholder:Ae(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:De(),children:(0,Z.jsx)(q,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsx)($,{label:it(),children:(0,Z.jsx)(q,{value:c.gatewayVersion,placeholder:He(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(q,{value:c.gatewayHttpUrl,placeholder:et(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Rt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||p(null)}}),h?(0,Z.jsx)(St,{instance:h,onClose:()=>_(null)},h._id):null,v?(0,Z.jsx)(kt,{instance:v,onClose:()=>y(null)},v._id):null]})}function kt({instance:e,onClose:t}){let n=O(M.instanceSecrets.listInstanceSecretStatus,{}),r=Et[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(H,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:xe({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:Ie()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Mt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(jt,{instance:e})}),(0,Z.jsx)(At,{instance:e})]})})}function At({instance:e}){let t=L(M.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(se());break;case`no_agents`:n.success(y());break;case`no_bridge_url`:n.error(h());break;case`deploy_misconfigured`:n.error(re());break;case`unauthorized`:n.error(ee());break;case`not_served`:n.error(Le());break;default:n.error(E());break}}catch(e){n.error(C(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?dt():s()})})]})}function jt({instance:e}){let t=O(M.bridgeAuth.listBridgeAuthStatus,{}),n=L(M.bridgeAuth.mintBridgeSecret),r=F(M.bridgeAuth.revokeBridgeSecret),a=z(),[o,s]=(0,Y.useState)(!1),[l,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!o){s(!0);try{f((await n({instanceId:e._id})).plaintext),h(!1)}catch(e){a.error(c(),e)}finally{s(!1)}}}async function y(){if(!o){s(!0);try{await r({instanceId:e._id}),f(null),a.success(ot())}catch(e){a.error(c(),e)}finally{s(!1)}}}async function b(){if(l)try{await navigator.clipboard.writeText(l),h(!0)}catch{}}return(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:_?`outline`:`secondary`,children:_?`${j()} · ${g.prefix}…${g.lastFour}`:i()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void v(),disabled:o,children:_?p():d()}),_?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:o,children:ue()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ce()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:m?u():k()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),h(!1)},children:I()})]}):null]})}function Mt({instanceId:e,field:t,updatedAt:n}){let r=L(M.instanceSecrets.setInstanceSecret),a=F(M.instanceSecrets.clearInstanceSecret),o=L(M.deviceIdentity.generateDeviceIdentity),s=z(),[c,l]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,C=t===`token`?Qe():t===`deviceIdentity`?Ke():nt();async function w(){if(!(!c.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(x())}catch(e){s.error(N(),e)}finally{f(!1)}}}async function ee(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(S())}catch(e){s.error(N(),e)}finally{f(!1)}}}async function T(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(A())}catch(e){s.error(fe(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:y?`outline`:`secondary`,children:y?j():i()}),(0,Z.jsx)(q,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:y?_e():oe(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void w(),disabled:d||c.trim().length===0,children:me()}),b?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:d,children:_()}):null,y?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:d,children:he()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:A()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:h?u():k()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:I()})]}):null]})}var Nt={conversational:Ye,documentary:Ee},Pt={conversational:ke,documentary:rt},Ft=e=>(Nt[e]??(()=>e))(),It=e=>(Pt[e]??(()=>``))();function Lt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ve()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:It(e),children:Ft(e)},e)),(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ht,{asChild:!0,children:(0,Z.jsx)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:je()})}),(0,Z.jsxs)(gt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ne()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ue()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Ft(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:It(r)})]})]},r)})})]})]})]})}function Rt({instanceName:e,open:t,onOpenChange:n}){let i=O(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=F(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=F(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=F(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Tt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=F(M.agents.removeInstanceAgent),l=yt(),u=z();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(P(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(P(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(P(),e)}}async function m(t,n){if(e&&await l({title:$e({name:n}),description:qe(),confirmLabel:be(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Fe())}catch(e){u.error(P(),e)}}return(0,Z.jsx)(H,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:Se({name:e??``})}),(0,Z.jsx)(B,{children:lt()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?Ge():i.discovery.lastPollOk?tt():Oe({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:r()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(e=>{let t=e.presentInLastOk===!1,n=i.defaultAgentId===e.agentId,r=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(U,{checked:e.enabled,disabled:t,"aria-label":r,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:r,children:[e.emoji?`${e.emoji} `:``,r]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:ge()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,r),children:we()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:ae()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Ve()})]}),e.enabled?(0,Z.jsx)(Lt,{agentId:e.agentId,types:a,onToggle:t=>void p(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Ot as InstancesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Ah as i,Bh as ee,Ch as te,Dh as a,Eh as o,Fh as s,Gh as c,Hh as l,Ih as u,Jh as ne,Kh as re,Lh as ie,Mh as ae,Nh as oe,Oh as se,Ph as d,Qh as f,Rh as ce,SC as le,Sh as p,Th as m,Uh as h,Vh as g,Wh as _,Xh as v,Yh as y,Zh as b,_h as x,ag as S,bh as C,eg as w,gh as T,hC as E,hh as D,ig as O,jh as k,kh as A,mh as j,ng as M,ph as ue,qh as N,rg as P,tg as F,vh as I,wh as L,xC as R,xh as z,yh as B,zh as V}from"./dist-CZW3hxVF.js";import{C as H,O as U,S as W,b as G,m as K,q,x as de,y as fe}from"./index-BMkJqrBA.js";import{t as pe}from"./DataTableShell-DI2wUkxk.js";var J=t(e(),1),Y=n();function me(){let e=le(E.integrations.status.status,{}),t=R(E.admin.setIntegrationConfig),[n,H]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&H(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let U=n,W=(e,t,n)=>H({...U,[e]:{...U[e],[t]:n}}),G=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[O(),` `,(0,Y.jsx)(`strong`,{children:P()}),` `,M()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:F()}):(0,Y.jsx)(K,{variant:`outline`,children:w()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:b(),children:[(0,Y.jsx)(Z,{label:y(),children:(0,Y.jsx)(q,{value:U.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>W(`langfuse`,`host`,e.target.value),onBlur:()=>G(`langfuse`,{host:U.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:c(),checked:U.langfuse.enabled??!0,onChange:e=>{W(`langfuse`,`enabled`,e),G(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:F()}):(0,Y.jsx)(K,{variant:`outline`,children:w()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:v(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(q,{value:U.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>W(`opik`,`baseUrl`,e.target.value),onBlur:()=>G(`opik`,{baseUrl:U.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(q,{value:U.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||re(),onChange:e=>W(`opik`,`workspace`,e.target.value),onBlur:()=>G(`opik`,{workspace:U.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:c(),checked:U.opik.enabled??!0,onChange:e=>{W(`opik`,`enabled`,e),G(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:_(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:h(),children:[(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)($,{value:U.tts.auto??`off`,options:[[`off`,g()],[`always`,ee()],[`inbound`,V()],[`tagged`,ce()]],onChange:e=>{W(`tts`,`auto`,e),G(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:U.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,u()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{W(`tts`,`provider`,e),G(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:U.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>W(`tts`,`model`,e.target.value),onBlur:()=>G(`tts`,{model:U.tts.model??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:U.tts.voice??``,placeholder:oe(),onChange:e=>W(`tts`,`voice`,e.target.value),onBlur:()=>G(`tts`,{voice:U.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:f()}),note:e.secrets.openai?k():i(),children:[(0,Y.jsx)(Q,{label:A(),checked:U.talk.enabled??!1,onChange:e=>{W(`talk`,`enabled`,e),G(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)($,{value:U.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{W(`talk`,`realtimeProvider`,e),G(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:U.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>W(`talk`,`realtimeModel`,e.target.value),onBlur:()=>G(`talk`,{realtimeModel:U.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:U.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>W(`talk`,`voice`,e.target.value),onBlur:()=>G(`talk`,{voice:U.talk.voice??``})})}),(0,Y.jsx)(Z,{label:o(),children:(0,Y.jsx)($,{value:U.talk.transport??`webrtc`,options:[[`webrtc`,m()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{W(`talk`,`transport`,e),G(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:L(),children:(0,Y.jsx)(q,{value:U.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>W(`talk`,`speechLocale`,e.target.value),onBlur:()=>G(`talk`,{speechLocale:U.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:te(),checked:U.talk.interruptOnSpeech??!0,onChange:e=>{W(`talk`,`interruptOnSpeech`,e),G(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:p()}),(0,Y.jsx)(K,{variant:`outline`,children:z()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[C(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:B(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:I(),columns:[{header:x(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:T(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:D(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:j(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ue(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(U,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(fe,{value:e,onValueChange:n,children:[(0,Y.jsx)(W,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:t.map(([e,t])=>(0,Y.jsx)(de,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Ho as a,Io as o,Lo as s,Mo as c,No as l,Po as u,Ro as d,SC as f,Uo as p,Vo as m,Wo as h,hC as g,jo as _,zo as v}from"./dist-CZW3hxVF.js";import{n as y,t as b}from"./TimeRangePicker-ytbfLYAK.js";import{Mt as x,a as S,jt as C,n as w,r as T}from"./index-BMkJqrBA.js";import{a as E,n as D,o as O,r as k,t as A}from"./card-6mfv2y9A.js";var j=t(e(),1),M=n(),N=[{metric:`api.calls`,label:h(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:p(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:a(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:m(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],P=N.length,F=[`API`,`OpenClaw`,`Chat`,`Assistant`],I=1e3,L=36e5;function R(e,t){let n=Math.max(1,Math.ceil((t-e)/L)),r=Math.min(n*P,I);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/P))}}function z(){let e=x({from:`/settings/kpi`}),t=C({from:`/settings/kpi`}),n=T(e.from,e.to,w,`now`),r=e=>void t({search:t=>({...t,...S(e)})}),{from:a,to:c}=y(n),{rowLimit:l,buckets:u}=R(a,c),p=f(g.kpi.listKpis,{limit:l,filter:{from:a,to:c}}),m=(0,j.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[p,u]),h=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,M.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,M.jsx)(B,{value:n,onChange:r})]});return p===void 0?(0,M.jsxs)(M.Fragment,{children:[h,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):p.length===0?(0,M.jsxs)(M.Fragment,{children:[h,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):(0,M.jsxs)(M.Fragment,{children:[h,F.map(e=>{let t=N.filter(t=>t.group===e);return t.some(e=>(m.get(e.metric)??[]).length>0)?(0,M.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,M.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,M.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,M.jsx)(V,{config:e,series:m.get(e.metric)??[]},e.metric))})]},e):null})]})}function B({value:e,onChange:t}){return(0,M.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,M.jsx)(b,{value:e,onChange:t})})}function V({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,M.jsxs)(A,{size:`sm`,className:`oc-kpi__card`,children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{className:`oc-kpi__card-title`,children:e.label}),(0,M.jsx)(k,{className:`oc-kpi__card-metric`,children:(0,M.jsx)(`code`,{children:e.metric})})]}),(0,M.jsxs)(D,{className:`oc-kpi__card-body`,children:[(0,M.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,M.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:K(r)}),(0,M.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,M.jsx)(G,{series:t,isError:e.isError,unit:e.unit}),(0,M.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,M.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:u({value:q(n.bucket)})}):(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:l()}),(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:c({count:t.length})})]})]})]})}var H=240,U=48,W=1;function G({series:e,isError:t,unit:n}){if(e.length===0)return(0,M.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=H/e.length,a=Math.max(i-W,1);return(0,M.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,role:`img`,"aria-label":_({max:K(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(U-1):0,c=o*i,l=U-s;return(0,M.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,M.jsxs)(`title`,{children:[q(e.bucket),` · `,K(e.value),` `,n]})},e.bucket)})})}function K(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function q(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{z as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,AS as i,By as a,CS as o,DS as s,ES as c,Fy as l,Gy as u,HS as d,Hy as f,Iy as p,Jy as m,Ky as ee,LS as te,Ly as ne,MS as h,NS as g,OS as re,PS as ie,Qy as ae,Ry as oe,SC as _,SS as se,TS as ce,Uy as le,Vy as ue,Wy as v,Xy as de,Yy as y,Zy as fe,_p as b,ab as x,cb as S,db as C,eb as w,fb as T,hC as E,ib as D,jS as O,kS as k,lb as A,mb as j,nb as M,ob as N,pb as P,qy as F,rb as I,sb as L,tb as R,ub as z,wS as B,xC as V,zy as pe}from"./dist-CZW3hxVF.js";import{t as H}from"./button-CugigrXc.js";import{A as me,C as he,O as U,S as ge,at as W,b as _e,k as ve,q as G,x as K,y as ye}from"./index-BMkJqrBA.js";var q=t(e(),1),J=[{id:`messages`,label:()=>j()},{id:`composer`,label:()=>P()},{id:`sidebar`,label:()=>T()},{id:`other`,label:()=>C()}],Y={showSource:{category:`messages`,label:()=>z(),help:()=>A()},showReport:{category:`messages`,label:()=>S(),help:()=>L()},copyAssistant:{category:`messages`,label:()=>N()},copyUser:{category:`messages`,label:()=>x()},showDelete:{category:`messages`,label:()=>D()},showTools:{category:`messages`,label:()=>I(),help:()=>M()},voiceInput:{category:`composer`,label:()=>R(),help:()=>w()},showChatAge:{category:`sidebar`,label:()=>r(),help:()=>ae()},showChatProvider:{category:`sidebar`,label:()=>fe(),help:()=>de()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>pe()};function De({prefKey:e,ui:t}){let n=V(E.admin.setUiPrefDefault),r=V(E.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:le()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(ge,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(_e,{children:[(0,$.jsx)(K,{value:`on`,children:ne()}),(0,$.jsx)(K,{value:`off`,children:p()}),(0,$.jsx)(K,{value:`inherit`,children:l()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(U,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":f()}),f()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(E.me.getMe,{host:W}),o=i?.ui,s=Z(i?.role)&&n,c=V(E.me.setUiPref).withOptimisticUpdate(ve),l=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":v()}),v()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:ue()}),(0,$.jsx)(`p`,{children:a()}),(0,$.jsx)(`p`,{children:oe()})]}):null,(0,$.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:m()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:F()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ee()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:u()}):null,(0,$.jsx)(U,{checked:a,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:d()})}function ke(){let e=_(E.me.getMe,{host:W}),t=V(E.me.setLocale),n=V(E.me.setMyName),r=me(),a=e?.locale??`default`,l=e?.name??``,[u,d]=(0,q.useState)(null),f=u??l,p=f.trim()!==l.trim();async function m(){try{await n({name:f}),d(null),r.success(i())}catch(e){r.error(k(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ie()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(G,{className:`max-w-xs`,value:f,maxLength:120,placeholder:h(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void m(),children:b()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?o():e===`en`?se():te()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:B()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Ad as i,Cd as a,Dd as o,Ed as s,Fd as c,Ju as l,Ku as u,Md as d,Nd as f,Od as p,Pd as m,Qu as h,SC as g,Sd as _,Td as v,Xu as y,Yu as b,Zu as x,_d as S,bd as ee,cd as te,dd as ne,ed as re,fd as ie,gd as ae,hC as C,hd as w,jd as T,kd as E,ld as D,md as O,od as k,pd as A,qu as j,sd as M,ud as N,vd as P,wd as F,xC as I,xd as L,yd as R}from"./dist-CZW3hxVF.js";import{t as z}from"./button-CugigrXc.js";import{A as B,O as V,h as H,j as U,m as W,q as G,xt as K}from"./index-BMkJqrBA.js";import{t as q}from"./roleDescriptions-DN8eyhnx.js";var J=t(e(),1),Y=n(),X=[{group:()=>c(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>E(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>m(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>p()}]},{group:()=>f(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>v()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()}]},{group:()=>T(),keys:[{key:`admin.manage`,label:()=>F()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=g(C.apiKeys.listRoles,{}),t=I(C.apiKeys.createRole),n=I(C.apiKeys.ensureRolesSeeded),i=I(C.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(C.apiKeys.listRoles,{});r&&e.setQuery(C.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=U(),o=B(),[s,c]=(0,J.useState)(!1),[d,f]=(0,J.useState)(Q),[p,m]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{o.error(L(),e)})},[n,o]);let v=e??[];async function T(e,t){if(Z(e.permissions)||p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:ee({name:e.name}),description:R(),confirmLabel:P()}))){m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(S(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function E(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f(Q),c(!1)}catch(e){o.error(ae(),e)}}let F=e===void 0,$=!F&&v.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,O(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:ie()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{f(Q),c(!0)},children:ne()})})]}),F?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:te()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?_({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:v.map(e=>{let t=Z(e.permissions),n=p.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(W,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,M()]}):(0,Y.jsx)(W,{variant:`secondary`,children:k()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(i=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(V,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?re():n?r():i,onCheckedChange:()=>void T(e,i)})},i))]},e.key)})})]})})]}),(0,Y.jsx)(H,{open:s,onOpenChange:c,title:h(),description:x(),canSubmit:!!(d.key&&d.name),onSubmit:E,submitLabel:y(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,Y.jsx)(G,{value:d.key,placeholder:l(),onChange:e=>f({...d,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(G,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,Y.jsx)(G,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Ay as ee,Bv as te,Cv as a,Cy as ne,Dv as o,Dy as re,Ev as ie,Ey as ae,Fv as oe,Gv as se,Hv as ce,Iv as s,Jv as le,Kv as ue,Lv as c,Mv as l,My as de,Nv as u,Ny as fe,Ov as d,Oy as f,Pv as p,Py as pe,Qv as me,Rv as he,SC as m,Sv as h,Sy as ge,Tv as g,Ty as _e,Uv as ve,Vv as ye,Wv as be,Xv as xe,Yv as Se,Zv as Ce,_v as _,_y as we,ay as Te,bv as v,by as Ee,cy as De,dy as Oe,ey as ke,fy as Ae,gv as y,gy as je,hC as b,hv as x,hy as Me,iy as Ne,jv as S,jy as Pe,kv as C,ky as w,ly as Fe,mv as T,my as Ie,ny as Le,oy as Re,py as ze,qv as Be,ry as Ve,sy as He,ty as Ue,uy as We,vv as E,vy as Ge,wv as D,wy as Ke,xC as O,xv as k,xy as qe,yC as Je,yv as A,yy as Ye,zv as Xe}from"./dist-CZW3hxVF.js";import{t as j}from"./button-CugigrXc.js";import{A as Ze,At as M,C as N,F as P,I as F,L as I,Mt as Qe,N as L,Ot as $e,P as R,R as z,S as B,Tt as V,b as H,h as et,j as tt,jt as nt,kt as rt,m as U,q as it,x as W,y as G}from"./index-BMkJqrBA.js";import{t as at}from"./FilterBar-9k1La5AD.js";import{t as ot}from"./DataTableShell-DI2wUkxk.js";import{t as st}from"./roleDescriptions-DN8eyhnx.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>A(),days:30},{value:`90`,label:()=>E(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=Qe({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,K.useState)(J),ie=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),oe=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),s=m(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),c=m(b.apiKeys.listKeys,{}),l=m(b.apiKeys.listRoles,{}),u=O(b.apiKeys.createServiceAccount),d=O(b.apiKeys.updateServiceAccount),p=O(b.apiKeys.deleteServiceAccount),h=Je(b.apiKeys.mintApiKey),g=O(b.apiKeys.revokeApiKey),_=tt(),v=Ze(),y=n!==``||a!==J||i!==J;function x(){o(J),t({search:{},replace:!0})}let[S,C]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Y),[D,k]=(0,K.useState)(null),[A,M]=(0,K.useState)(new Set),[P,F]=(0,K.useState)(null),I=(0,K.useRef)(!1),[L,R]=(0,K.useState)(new Set),[z,V]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function Q(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await d({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(me())):await u({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),k(null),C(!1)}catch(e){v.error(D?r():ke(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function $(e){if(I.current)return;I.current=!0;let t=z[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Ce(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await _({title:xe(),description:(0,q.jsxs)(q.Fragment,{children:[Se(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,le(),` `,(0,q.jsx)(`strong`,{children:Be()}),` `,ue()]}),confirmWord:e.name,confirmLabel:se(),destructive:!0}))try{await p({serviceAccountId:e._id}),v.success(be(),e.name)}catch(e){v.error(ve(),e)}}async function ht(e){if(await _({title:ce(),description:(0,q.jsxs)(q.Fragment,{children:[ye(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,te()]}),confirmLabel:Xe(),destructive:!0})&&!L.has(e._id)){R(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(he(),e)}finally{R(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,q.jsxs)(at,{q:n,onQChange:ie,searchPlaceholder:fe(),onReset:x,canReset:y,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(B,{size:`sm`,className:`w-40`,children:(0,q.jsx)(N,{placeholder:de()})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:Pe()}),(l??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:oe,children:[(0,q.jsx)(B,{size:`sm`,className:`w-36`,children:(0,q.jsx)(N,{})}),(0,q.jsxs)(H,{children:[(0,q.jsx)(W,{value:J,children:ee()}),(0,q.jsx)(W,{value:`active`,children:w()}),(0,q.jsx)(W,{value:`disabled`,children:f()})]})]})]}),(0,q.jsx)(ot,{title:re(),rows:s,addLabel:ae(),onAdd:()=>{E(Y),k(null),C(!0)},emptyHint:_e(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[{label:qe(),onSelect:()=>pt(e)},{label:Ke(),onSelect:()=>void $(e)},{label:A.has(e._id)?ne():ge(),onSelect:()=>Q(e._id)},{label:Ee(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Ye():Ge(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(rt,{}):(0,q.jsx)($e,{})})},{header:we(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:je(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:Me(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(U,{variant:`destructive`,children:f()}):(0,q.jsx)(U,{variant:`outline`,children:w()})},{header:Ie(),cell:e=>(0,q.jsxs)(G,{value:z[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(B,{size:`sm`,className:`w-32`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(H,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:ze(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?Ae():Oe({count:t})})}}]}),(0,q.jsx)(et,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:D?We():He(),description:D?Fe():Re(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?De():Te(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(it,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ve()}),(0,q.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(B,{className:`w-full`,children:(0,q.jsx)(N,{placeholder:Le()})}),(0,q.jsx)(H,{children:(l??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(l??[]).find(e=>e.key===T.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ue()}),(0,q.jsx)(it,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[c(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:oe()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:i()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(U,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?C():d()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(I,{children:[(0,q.jsx)(z,{children:o()}),(0,q.jsx)(P,{children:ie({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:g()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":D(),children:[n?(0,q.jsx)(M,{}):(0,q.jsx)(V,{}),n?a():h()]})]}),(0,q.jsx)(F,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:k()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?_():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(U,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(U,{variant:`outline`,children:x()}):(0,q.jsx)(U,{variant:`outline`,children:T()})}export{X as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Ax as a,BS as o,Bb as s,CS as c,Cb as l,Cx as u,Db as d,Dx as f,Eb as p,Ex as m,Fb as h,Fx as g,Gb as _,Hb as v,Ib as ee,Ix as te,Jb as ne,Kb as re,Lb as ie,Lx as ae,Mb as oe,Mx as se,Nb as ce,Nx as le,Ob as ue,Ox as de,Pb as fe,Px as pe,Qb as me,RS as he,Rb as ge,SC as y,SS as _e,Sb as ve,Sx as ye,Tb as be,Tx as xe,Ub as Se,Vb as Ce,Wb as we,Xb as Te,Yb as Ee,Zb as De,_b as Oe,_x as ke,ax as Ae,bb as je,bx as Me,cx as Ne,dx as Pe,ex as b,fx as Fe,gC as Ie,gb as Le,gx as Re,hC as x,hb as ze,hx as Be,ix as Ve,jb as He,jx as Ue,kb as We,kx as Ge,lx as Ke,mx as qe,n as Je,nx as Ye,ox as Xe,px as Ze,qb as Qe,rx as $e,sx as et,tx as tt,ux as nt,vb as rt,vx as it,wb as at,wx as ot,xC as S,xb as st,xx as ct,yC as lt,yb as C,yx as ut,zS as dt,zb as ft}from"./dist-CZW3hxVF.js";import{t as pt}from"./TimeRangePicker-ytbfLYAK.js";import{t as w}from"./x-Bol-Z6zU.js";import{t as T}from"./button-CugigrXc.js";import{$ as E,At as D,C as O,Ct as k,O as A,Q as mt,S as j,Z as ht,at as M,b as N,et as gt,it as _t,m as P,nt as vt,q as F,rt as yt,tt as I,x as L,y as R}from"./index-BMkJqrBA.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-6mfv2y9A.js";import{a as Et,i as z,n as Dt,o as B,r as V,t as Ot}from"./table-C3YR2wAA.js";import{t as kt}from"./FilterBar-9k1La5AD.js";import{t as At}from"./AdvancedFilter-t3zpDtnl.js";var H=Ie(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),U=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function W(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ge());if(e.size>Rt)throw Error(ie());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(h());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(h());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);W(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=W(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),g=await K(f,`image/webp`,Vt)??await K(f,`image/png`);if(!g)throw Error(fe());return{blob:g,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return G(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return G(e)}async function G(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ee())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function K(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var q=n(),J=`__all__`,Y={kind:`relative`,from:`now-24h`,to:`now`},X=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,q.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?o():e===`dark`?dt():he()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,q.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,q.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,q.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,q.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,q.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,q.jsx)(Kt,{tokens:r,mode:i}):(0,q.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,q.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=y(x.charts.listMyCharts),r=S(x.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:Ge()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,q.jsx)(Q,{selected:e===null,title:f(),subtitle:m(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?xe():n.via===`owner`?ot():u({group:n.via.group});return(0,q.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):null]})}function Jt(){let e=S(x.charts.importChart),[t,n]=(0,U.useState)(``),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(b())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(me());return}let r;try{r=JSON.parse(i)}catch{s(b());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:Xe()}),(0,q.jsx)(F,{value:t,onChange:e=>n(e.target.value),placeholder:Ae(),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:Ve()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:$e(),rows:8,spellCheck:!1})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(T,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),Ye(),(0,q.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,q.jsx)(T,{size:`sm`,disabled:u,onClick:()=>void p(),children:tt()})]}),o?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,q.jsx)(`p`,{className:`oc-chart-import__ok`,children:r()}):null]})]})}function Yt({chart:e}){let t=lt(x.charts.setChartLogo),n=S(x.charts.removeChartLogo),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?_():we()}),(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,q.jsx)(`img`,{src:t,alt:``}):null}),(0,q.jsx)(T,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),t?v():Se(),(0,q.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,q.jsx)(T,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:s()}):null,t?(0,q.jsx)(T,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ce()}):null]})}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:re()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,q.jsx)(p,{mode:`light`}),(0,q.jsx)(p,{mode:`dark`})]}),r?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:ft()}):null,a?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=y(x.me.getMe,{host:M}),n=S(x.charts.addChartDomain),r=S(x.charts.removeChartDomain),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:We()}):d.map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ue({domain:e}),onClick:()=>void p(e),children:(0,q.jsx)(w,{className:`size-3`})})]},e))}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(F,{value:a,onChange:e=>o(e.target.value),placeholder:He(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,q.jsx)(T,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:i()})]}),(0,q.jsx)(`span`,{className:`oc-show__desc`,children:oe()}),s?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function Xt({chart:e}){let t=S(x.charts.updateChart),n=S(x.charts.deleteChart),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(e.name),[s,c]=(0,U.useState)(()=>JSON.stringify(e.tokens,null,2)),[u,f]=(0,U.useState)(null),[m,h]=(0,U.useState)(!1);function g(){o(e.name),c(JSON.stringify(e.tokens,null,2)),f(null),i(!0)}async function _(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(b());return}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(l()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(T,{variant:`outline`,size:`sm`,onClick:g,children:ne()}),(0,q.jsx)(T,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:Qe()})]})})]}),r?(0,q.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,q.jsx)(F,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:at()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),u?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:u}):null,(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(T,{size:`sm`,disabled:m,onClick:()=>void _(),children:d()}),(0,q.jsx)(T,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:p()})]})]}):null,(0,q.jsx)(Yt,{chart:e}),(0,q.jsx)($,{chart:e})]})}function Zt(){let e=y(x.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:De()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),e!==void 0&&t.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ee()}):(0,q.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,q.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=S(x.charts.addChartToGroupPool),r=S(x.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?qe():e.kind===`custom`&&e.scope===`personal`?C():Be()}),e.isGlobalDefault?(0,q.jsx)(P,{variant:`default`,children:Ze()}):null]}),(0,q.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(a??[]).map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ke({group:e.name}),onClick:()=>void l(e.groupId),children:(0,q.jsx)(w,{className:`size-3`})})]},e.groupId)),s.length>0?(0,q.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,q.jsx)(j,{size:`sm`,className:`w-56`,children:(0,q.jsx)(O,{placeholder:nt()})}),(0,q.jsx)(N,{children:s.map(e=>(0,q.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:Fe()}):null]})]})}function $t({chart:e}){let t=S(x.charts.promoteChartToCommon),n=S(x.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(l()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?rt():C()}),e.ownerLabel?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:je({owner:e.ownerLabel})}):null]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,q.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Oe()}):null,(0,q.jsx)(T,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Le()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(x.admin.setDefaultThemeMode),i=S(x.admin.setDefaultLocale),o=S(x.charts.setDefaultChart),s=y(x.charts.listChartsAdmin),l=y(x.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,q.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ct()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(T,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:f()}),_t.map(e=>(0,q.jsx)(T,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,q.jsx)(T,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ut()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,q.jsx)(Qt,{chart:e,groups:l??[]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ke()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,q.jsx)($,{chart:e})]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ze()}):(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,q.jsx)($t,{chart:e},e.key))})})()]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ae()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,q.jsx)(T,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:g()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,q.jsx)(T,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?c():_e()},e))}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:le()})]})]})}function tn(){let e=y(x.me.getMe,{host:M}),t=yt(e?.resolvedThemeMode);return(0,q.jsxs)(`div`,{className:`oc-appearance`,children:[(0,q.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,q.jsx)(Jt,{}),(0,q.jsx)(Zt,{}),e?.role===`admin`?(0,q.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,U.useState)(!0),[n,r]=(0,U.useState)(`per-user`),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(J),[c,l]=(0,U.useState)(J),[u,d]=(0,U.useState)(Y),f=i!==``||o!==J||c!==J;function p(){a(``),s(J),l(J),d(Y)}return(0,q.jsxs)(`div`,{className:`oc-show`,children:[(0,q.jsx)(tn,{}),(0,q.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,q.jsx)(`summary`,{className:`oc-show__title`,children:se()}),(0,q.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(T,{children:`Default`}),(0,q.jsx)(T,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(T,{variant:`outline`,children:`Outline`}),(0,q.jsx)(T,{variant:`ghost`,children:`Ghost`}),(0,q.jsx)(T,{variant:`destructive`,children:`Destructive`}),(0,q.jsx)(T,{variant:`link`,children:`Link`})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(T,{size:`sm`,children:`Small`}),(0,q.jsx)(T,{children:`Default`}),(0,q.jsx)(T,{size:`lg`,children:`Large`}),(0,q.jsx)(T,{size:`icon`,"aria-label":`more`,children:(0,q.jsx)(k,{})}),(0,q.jsx)(T,{disabled:!0,children:`Disabled`})]})]}),(0,q.jsx)(Z,{title:`Badges`,children:(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(P,{children:`Default`}),(0,q.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(P,{variant:`outline`,children:`Outline`}),(0,q.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,q.jsx)(Z,{title:`Inputs & selection`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(F,{placeholder:`Text input…`}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsxs)(R,{value:n,onValueChange:r,children:[(0,q.jsx)(j,{className:`w-56`,children:(0,q.jsx)(O,{placeholder:`Select…`})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,q.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,q.jsxs)(`label`,{className:`oc-show__check`,children:[(0,q.jsx)(A,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,q.jsx)(Z,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,q.jsxs)(R,{value:o,onValueChange:s,children:[(0,q.jsx)(j,{size:`sm`,children:(0,q.jsx)(O,{})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:J,children:`Toutes directions`}),(0,q.jsx)(L,{value:`inbound`,children:`inbound`}),(0,q.jsx)(L,{value:`outbound`,children:`outbound`}),(0,q.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,q.jsxs)(R,{value:c,onValueChange:l,children:[(0,q.jsx)(j,{size:`sm`,children:(0,q.jsx)(O,{})}),(0,q.jsxs)(N,{children:[(0,q.jsx)(L,{value:J,children:`Toutes sévérités`}),(0,q.jsx)(L,{value:`info`,children:`info`}),(0,q.jsx)(L,{value:`warn`,children:`warn`}),(0,q.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,q.jsx)(At,{fields:X,onChange:()=>{}}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,q.jsx)(pt,{value:u,onChange:d})]})]})}),(0,q.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,q.jsxs)(ht,{children:[(0,q.jsx)(vt,{asChild:!0,children:(0,q.jsx)(T,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,q.jsx)(k,{})})}),(0,q.jsxs)(mt,{align:`start`,children:[(0,q.jsx)(gt,{children:`Actions`}),(0,q.jsx)(I,{}),(0,q.jsx)(E,{children:`Edit`}),(0,q.jsx)(E,{children:`Duplicate`}),(0,q.jsx)(I,{}),(0,q.jsx)(E,{variant:`destructive`,children:`Delete`})]})]})}),(0,q.jsx)(Z,{title:`Card`,children:(0,q.jsxs)(Tt,{className:`w-80`,children:[(0,q.jsxs)(bt,{children:[(0,q.jsx)(Ct,{children:`Instance`}),(0,q.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,q.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,q.jsxs)(xt,{className:`gap-2`,children:[(0,q.jsx)(T,{size:`sm`,children:`Save`}),(0,q.jsx)(T,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,q.jsx)(Z,{title:`Table`,children:(0,q.jsxs)(Ot,{children:[(0,q.jsx)(Et,{children:(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{className:`w-8`,children:(0,q.jsx)(A,{"aria-label":`select all`})}),(0,q.jsx)(z,{children:`Name`}),(0,q.jsx)(z,{children:`Mode`}),(0,q.jsx)(z,{className:`text-right`,children:`Status`}),(0,q.jsx)(z,{className:`w-8`})]})}),(0,q.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{children:(0,q.jsx)(A,{"aria-label":`select ${e.n}`})}),(0,q.jsx)(V,{className:`font-medium`,children:e.n}),(0,q.jsx)(V,{children:(0,q.jsx)(P,{variant:`secondary`,children:e.m})}),(0,q.jsx)(V,{className:`text-right`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,q.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,q.jsx)(V,{children:(0,q.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,q.jsx)(k,{})})})]},e.n))})]})}),(0,q.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,q.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,q.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,q.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,q.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,q.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,q.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,q.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,q.jsx)(`span`,{className:`oc-run-status__dot`}),(0,q.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Go as i,Jo as a,Ko as o,Qo as s,Xo as c,Yo as l,Zo as u,es as d,gC as f,ns as p,qo as m,ts as h}from"./dist-CZW3hxVF.js";import{t as g}from"./button-CugigrXc.js";import{ct as _,lt as v,ot as y,q as b,st as x,vt as S}from"./index-BMkJqrBA.js";var C=f(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:p(),from:`now-5m`},{label:h(),from:`now-15m`},{label:d(),from:`now-30m`},{label:r(),from:`now-1h`},{label:s(),from:`now-3h`},{label:u(),from:`now-6h`},{label:c(),from:`now-12h`},{label:l(),from:`now-24h`},{label:a(),from:`now-2d`},{label:m(),from:`now-7d`},{label:o(),from:`now-30d`},{label:i(),from:`now-90d`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(_,{open:n,onOpenChange:d,children:[(0,P.jsx)(v,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(C,{}),A(e)]})}),(0,P.jsx)(x,{children:(0,P.jsx)(y,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(b,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(b,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(S,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(b,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Cl as i,Dl as a,El as o,Gc as s,Jc as c,Kc as l,Ol as u,Qc as d,SC as f,Sl as ee,Tl as te,Xc as ne,Yc as re,Zc as ie,_l as ae,al as oe,bl as se,cl as ce,dl as le,el as ue,fl as p,gl as de,hC as m,hl as fe,il as pe,kl as me,ll as he,ml as ge,nl as h,ol as g,pl as _,qc as v,rl as y,sl as b,tl as x,ul as S,vl as C,wl as w,xl as T,yl as E}from"./dist-CZW3hxVF.js";import{n as D}from"./TimeRangePicker-ytbfLYAK.js";import{t as O}from"./x-Bol-Z6zU.js";import{t as k}from"./button-CugigrXc.js";import{C as A,F as j,L as M,Mt as N,N as P,P as F,R as I,S as L,a as _e,b as R,i as ve,jt as ye,m as z,o as be,r as xe,x as B,y as V}from"./index-BMkJqrBA.js";import{t as Se}from"./FilterBar-9k1La5AD.js";import{t as H}from"./AdvancedFilter-t3zpDtnl.js";import{t as Ce}from"./DataTableShell-DI2wUkxk.js";var U=t(e(),1),W=n(),we=[50,100,200,500],G=`all`,K=`__all__`,Te=[`2xx`,`4xx`,`5xx`],Ee=[`user`,`service`,`system`],De=[`inbound`,`outbound`,`internal`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function q(){let e=N({from:`/settings/traces`}),t=ye({from:`/settings/traces`}),n=e.limit,s=e.kind,l=e.statusClass??K,v=e.principalType??K,j=e.direction??K,M=e.roleKey??K,P=e.q??``,F=xe(e.from,e.to),I=(0,U.useMemo)(()=>be(e.adv),[e.adv]),{from:q,to:Me}=D(F),[X,Z]=(0,U.useState)(null),[Ne,Q]=(0,U.useState)(null),Pe=e=>void t({search:t=>({...t,limit:e})}),Fe=e=>void t({search:t=>({...t,kind:e})}),Ie=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Le=e=>void t({search:t=>({...t,statusClass:e===K?void 0:e})}),Re=e=>void t({search:t=>({...t,principalType:e===K?void 0:e})}),ze=e=>void t({search:t=>({...t,direction:e===K?void 0:e})}),Be=e=>void t({search:t=>({...t,roleKey:e===K?void 0:e})}),Ve=e=>void t({search:t=>({...t,..._e(e)})}),He=e=>void t({search:t=>({...t,adv:ve(e)}),replace:!0}),$=f(m.observability.listEvents,{limit:n}),Ue=f(m.observability.listEvents,{limit:n,kind:s===G?void 0:s,filter:{q:P||void 0,from:q,to:Me,statusClass:l===K?void 0:l,principalType:v===K?void 0:v,direction:j===K?void 0:j,roleKey:M===K?void 0:M,advanced:I.length>0?I:void 0}}),We=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Ge=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[$]),Ke=P!==``||l!==K||v!==K||j!==K||M!==K||I.length>0||F.kind!==`relative`||F.from!==Oe.from;function qe(){t({search:{limit:100,kind:`all`},replace:!0})}let Je=X?$?.filter(e=>e.correlationId===X):Ue;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),(0,W.jsx)(`strong`,{children:u()}),a(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,W.jsxs)(Se,{q:P,onQChange:Ie,searchPlaceholder:te(),timeRange:F,onTimeRangeChange:Ve,onReset:qe,canReset:Ke,children:[(0,W.jsxs)(V,{value:l,onValueChange:Le,children:[(0,W.jsx)(L,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:w()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:K,children:i()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Re,children:[(0,W.jsx)(L,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:ee()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:K,children:T()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:j,onValueChange:ze,children:[(0,W.jsx)(L,{size:`sm`,className:`w-32`,children:(0,W.jsx)(A,{placeholder:se()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:K,children:E()}),De.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:M,onValueChange:Be,children:[(0,W.jsx)(L,{size:`sm`,className:`w-36`,children:(0,W.jsx)(A,{placeholder:C()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:K,children:ae()}),Ge.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:s,onValueChange:Fe,children:[(0,W.jsx)(L,{size:`sm`,className:`w-44`,children:(0,W.jsx)(A,{placeholder:de()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:fe()}),We.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:String(n),onValueChange:e=>Pe(Number(e)),children:[(0,W.jsx)(L,{size:`sm`,className:`w-28`,children:(0,W.jsx)(A,{})}),(0,W.jsx)(R,{children:we.map(e=>(0,W.jsx)(B,{value:String(e),children:ge({count:e})},e))})]})]}),(0,W.jsx)(H,{fields:ke,seed:I,onChange:He}),X?(0,W.jsx)(`div`,{className:`oc-traces__followline`,children:(0,W.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>Z(null),title:_(),children:[(0,W.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[p(),(0,W.jsx)(`code`,{children:J(X)})]}),(0,W.jsx)(O,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`sr-only`,children:le()})]})}):null,(0,W.jsx)(Ce,{title:S(),rows:Je,emptyHint:X?he():ce(),columns:[{header:b(),sort:e=>e.at,cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:g(),sort:e=>e.kind,cell:e=>(0,W.jsx)(z,{variant:`secondary`,children:e.kind})},{header:oe(),sort:e=>Y(e)??null,cell:e=>{let t=Y(e);return t?(0,W.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,W.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":pe(),children:`✓`})}},{header:y(),sort:e=>e.direction,cell:e=>e.direction?(0,W.jsx)(z,{variant:`outline`,children:e.direction}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:h(),sort:e=>e.principalType,cell:e=>(0,W.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,W.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:J(e.principalId)}):null]})},{header:x(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,W.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.route,cell:e=>e.route?(0,W.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,W.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:r(),sort:e=>e.status,cell:e=>e.status===null?(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,W.jsx)(`span`,{className:`oc-traces__status ${Ae(e.status)}`,children:e.status})},{header:d(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,W.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:ie(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,W.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ne(),onClick:()=>Z(e.correlationId),children:J(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:re(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,W.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>Q(e),children:c()}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,W.jsx)(je,{row:Ne,onClose:()=>Q(null)})]})}function Ae(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function J(e){return e.length>8?e.slice(0,8):e}function Y(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function je({row:e,onClose:t}){let n=(0,U.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,W.jsx)(P,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,W.jsxs)(F,{className:`max-w-lg`,children:[(0,W.jsxs)(M,{children:[(0,W.jsxs)(I,{className:`oc-traces__meta-title`,children:[v(),` `,(0,W.jsx)(`code`,{children:e.kind}),(0,W.jsx)(z,{variant:`outline`,children:l()})]}),(0,W.jsx)(j,{children:s()})]}),(0,W.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{q as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Bp as i,Gp as a,Hp as o,Ip as s,Jp as c,Kp as l,Lp as u,Qp as d,Rp as ee,SC as f,Up as p,Vp as te,Wp as ne,Xp as re,Yp as ie,Zp as ae,_c as m,_p as oe,am as se,cc as h,cm as g,dc as _,em as ce,fc as v,gc as y,hC as b,hc as x,im as le,lc as S,lm as C,mc as w,nm as ue,oc as T,om as de,pc as E,qp as D,rm as O,sc as k,sm as fe,tm as pe,uc as A,um as j,vc as M,xC as N,zp as me}from"./dist-CZW3hxVF.js";import{t as P}from"./button-CugigrXc.js";import{$ as F,A as I,C as L,F as R,L as z,M as he,Mt as ge,N as B,O as V,P as _e,Q as ve,R as ye,S as H,Z as be,_t as U,at as xe,b as W,d as G,et as Se,f as Ce,gt as K,j as we,jt as Te,m as q,nt as Ee,p as J,x as Y,y as X}from"./index-BMkJqrBA.js";import{t as De}from"./FilterBar-9k1La5AD.js";import{t as Oe}from"./DataTableShell-DI2wUkxk.js";import{t as ke}from"./DetailChips-CgOS7kpk.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=f(b.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=f(b.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Q.jsx)(B,{open:n,onOpenChange:r,children:(0,Q.jsxs)(_e,{className:`oc-access`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsx)(ye,{children:M({user:t})}),(0,Q.jsx)(R,{children:m()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?y():x()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):[...d.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=N(b.agents.assignAgent),s=N(b.agents.removeAgent),c=N(b.agents.setDefaultAgent),l=I();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(E(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(v(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(V,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":A({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:S()}):null,e.outOfPool?(0,Q.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:h()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":k(),title:k(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":T(),title:T(),onClick:()=>void d(e.agentId),children:(0,Q.jsx)(K,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(be,{children:[(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?j():C({count:r})})}),(0,Q.jsxs)(ve,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Se,{children:g()}),G.map(e=>{let r=J[e];return(0,Q.jsxs)(F,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(V,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:Ce[e]??e})]},e)})]})]})}function Ne(){let e=ge({from:`/settings/users`}),t=Te({from:`/settings/users`}),n=e.q??``,m=e.role??$,h=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),g=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),_=f(b.admin.listUsers,{filter:{q:n||void 0,role:m===$?void 0:m},withAgents:!0}),v=f(b.me.getMe,{host:xe}),y=N(b.admin.setRole),x=N(b.admin.setUserPermissions),S=N(b.admin.startImpersonation),C=N(b.admin.deleteUser),w=N(b.admin.setUserName),T=we(),E=he(),k=I(),[A,j]=(0,Z.useState)(null),M=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of _??[])e.add(t.role);return[...e]},[_]),P=n!==``||m!==$;function F(){t({search:{},replace:!0})}async function R(e){try{await y(e)}catch(e){k.error(fe(),e)}}async function z(e){try{await x(e)}catch(e){k.error(de(),e)}}async function B(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await T({title:r(),description:d({user:t}),confirmWord:ae(),confirmLabel:re(),destructive:!0}))try{await C({profileId:e._id}),k.success(c({user:t}))}catch(e){k.error(ie(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:l(),label:a({user:t}),placeholder:ne(),defaultValue:e.name??``,confirmLabel:oe()});if(n!==null)try{await w({profileId:e._id,name:n}),k.success(p())}catch(e){k.error(o(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:h,searchPlaceholder:se(),onReset:F,canReset:P,children:(0,Q.jsxs)(X,{value:m,onValueChange:g,children:[(0,Q.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(L,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:$,children:le()}),M.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:O(),rows:_,emptyHint:ue(),rowActions:e=>{let t=[{label:s(),onSelect:()=>j({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:D(),onSelect:()=>void V(e)}];return e.userId!==v?.userId&&t.push({label:pe(),onSelect:()=>void S({profileId:e._id})},{label:ce(),variant:`destructive`,onSelect:()=>void B(e)}),t},columns:[{header:te(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:i(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(X,{value:e.role,onValueChange:t=>void R({profileId:e._id,role:t}),children:[(0,Q.jsx)(H,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(L,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:me(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ee()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),z({profileId:e._id,permissions:[...n]})}})},{header:u(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:A?.profileId??null,userLabel:A?.label??``,open:A!==null,onOpenChange:e=>{e||j(null)}})]})}export{Ne as UsersTab};
|