@objectstack/console 11.9.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-DVX_k0gB.js → AdapterProvider-BIB-F0Qa.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-La6Ze-fz.js → AiPendingActionsPage-CMVG4Uuj.js} +1 -1
- package/dist/assets/ApiConsolePage-BpBKlVk6.js +1 -0
- package/dist/assets/{AppDocsIndex-B04zB99i.js → AppDocsIndex-35urFMpk.js} +1 -1
- package/dist/assets/{AppManagementPage-DJchVHa5.js → AppManagementPage-Q8hLq3cQ.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-Cjd1esAG.js +1 -0
- package/dist/assets/AuditLogPage-C2lQmF3X.js +1 -0
- package/dist/assets/{ComponentNavView-DbfuUNGc.js → ComponentNavView-BuEXrmXR.js} +1 -1
- package/dist/assets/{ConsoleFloatingChatbot-BAW-WlIf.js → ConsoleFloatingChatbot-XMVIlmjf.js} +1 -1
- package/dist/assets/{DashboardView-Djw0MggX.js → DashboardView-cKnnhVZW.js} +1 -1
- package/dist/assets/DashboardWidgetInspector-DQzulo-e.js +1 -0
- package/dist/assets/{DeveloperHubPage-DlfRVfB3.js → DeveloperHubPage-DO4z3Sj9.js} +1 -1
- package/dist/assets/{ExpressionProvider-DGF3MugJ.js → ExpressionProvider-BI-jCA0B.js} +1 -1
- package/dist/assets/FlowRunsPage-DVvg_WMt.js +1 -0
- package/dist/assets/{IntegrationsPage-sLCzz4vL.js → IntegrationsPage-kF55v0ix.js} +2 -2
- package/dist/assets/InterfaceListPage-CH9wtpOt.js +1 -0
- package/dist/assets/{ManagedByBadge-CDDSvYHn.js → ManagedByBadge-DtZfR2w_.js} +1 -1
- package/dist/assets/{MarketplaceAccessDenied-D_tpevwJ.js → MarketplaceAccessDenied-JR0ElPYV.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-CkUEaBR9.js → MarketplaceInstalledPage-c1qqM0m9.js} +1 -1
- package/dist/assets/MarketplacePackagePage-CT5bU1QW.js +4 -0
- package/dist/assets/MarketplacePage-BkOByUub.js +1 -0
- package/dist/assets/{MetadataInspector-Cgk4Y1A7.js → MetadataInspector-FQJn-0mY.js} +1 -1
- package/dist/assets/{MetadataProvider-Cu56xdi9.js → MetadataProvider-DlGQbrYS.js} +1 -1
- package/dist/assets/PageView-BR-dytGp.js +1 -0
- package/dist/assets/ProfilePage-BfNhQTic.js +1 -0
- package/dist/assets/PublicFormsPage-D5HXZ9gs.js +1 -0
- package/dist/assets/RecordDetailView-BUBX12o3.js +9 -0
- package/dist/assets/RecordFormPage-dOx4tkq3.js +1 -0
- package/dist/assets/ReportDefaultInspector-DQlvnczB.js +11 -0
- package/dist/assets/{ReportView-DqC6GJsU.js → ReportView-BoYtuwGU.js} +1 -1
- package/dist/assets/{SearchResultsPage-DoTdiqLP.js → SearchResultsPage-Dn6Lg7cm.js} +1 -1
- package/dist/assets/{SettingsHub-BMclJbZT.js → SettingsHub-BIUh_NaE.js} +1 -1
- package/dist/assets/{SettingsView-BriYkHIM.js → SettingsView-iFSFGurq.js} +1 -1
- package/dist/assets/{SystemHubPage-u4cJwRz3.js → SystemHubPage-BbYZjpSv.js} +1 -1
- package/dist/assets/data-adapter-BJMUjXWO.js +7 -0
- package/dist/assets/{framework-WZr4krBC.js → framework-Bn8ShCi0.js} +5 -5
- package/dist/assets/{highlighted-body-OFNGDK62-De1Z23h7.js → highlighted-body-OFNGDK62-CLYrkLJN.js} +1 -1
- package/dist/assets/index-BecTd5hZ.js +2 -0
- package/dist/assets/index-Ci5dbUDe.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-B7A4_dsH.js +1 -0
- package/dist/assets/metadata-admin-CwGCDJE1.js +22 -0
- package/dist/assets/plugin-calendar-DJ1vxgSA.js +1 -0
- package/dist/assets/plugin-charts-vp7sTLa2.js +7 -0
- package/dist/assets/plugin-chatbot-DCC-44Dt.js +120 -0
- package/dist/assets/plugin-dashboard-z2hSPvkm.js +6 -0
- package/dist/assets/plugin-form-BUDPowXG.js +1 -0
- package/dist/assets/plugin-gantt-BJIjCj1A.js +93 -0
- package/dist/assets/plugin-grid-ieKf1CBn.js +8 -0
- package/dist/assets/plugin-kanban-DhARoJCa.js +1 -0
- package/dist/assets/plugin-map-C2xGbkMv.js +1 -0
- package/dist/assets/{plugin-markdown-DN5tgnpR.js → plugin-markdown-DXEq1goV.js} +1 -1
- package/dist/assets/plugin-report-Cho-TzT3.js +59 -0
- package/dist/assets/plugin-timeline-6gVRcvzs.js +1 -0
- package/dist/assets/plugin-tree-_9p0xC9K.js +1 -0
- package/dist/assets/plugin-view-vYQlhE3F.js +1 -0
- package/dist/assets/plugins-views-ycDq-ZXC.js +4 -0
- package/dist/assets/{skeletons-DQtGqEIo.js → skeletons-C2aQsjPE.js} +1 -1
- package/dist/assets/{src-Dt23JboC.js → src-B4OzWw0f.js} +1 -1
- package/dist/assets/src-CbqgiuxM.js +15 -0
- package/dist/assets/{types-C_3ZSSQo.js → types-B0Soeu38.js} +1 -1
- package/dist/assets/ui-components-DlauVk27.js +42 -0
- package/dist/assets/ui-layout-DnHby9xU.js +1 -0
- package/dist/assets/{useOpenRecordList-CiUIxuVn.js → useOpenRecordList-DWDU_kYn.js} +1 -1
- package/dist/assets/useReconcileOnError-B9komLeJ.js +1 -0
- package/dist/assets/useRecordApprovals-B_jxSZvZ.js +1 -0
- package/dist/assets/utils-Bixzg6Bz.js +1 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ApiConsolePage-CBAIJWJ_.js +0 -1
- package/dist/assets/ApprovalsInboxPage-Ddy3SDqP.js +0 -1
- package/dist/assets/AuditLogPage-r6ifzD0U.js +0 -1
- package/dist/assets/DashboardWidgetInspector-BVvGLv7b.js +0 -1
- package/dist/assets/FlowRunsPage-C4_71jyO.js +0 -1
- package/dist/assets/InterfaceListPage-CxfEqY2Z.js +0 -1
- package/dist/assets/MarketplacePackagePage-CKZ9QH3r.js +0 -4
- package/dist/assets/MarketplacePage-BdxwjGoT.js +0 -1
- package/dist/assets/PageView-C1patuLx.js +0 -1
- package/dist/assets/ProfilePage-Bd6u25mD.js +0 -1
- package/dist/assets/PublicFormsPage-DMSTg6WT.js +0 -1
- package/dist/assets/RecordDetailView-CXltbudR.js +0 -9
- package/dist/assets/RecordFormPage-C3okBT1R.js +0 -1
- package/dist/assets/ReportDefaultInspector-CssrqnGI.js +0 -11
- package/dist/assets/data-adapter-D0RtPrPs.js +0 -7
- package/dist/assets/index-CN2ZOfrA.css +0 -2
- package/dist/assets/index-DoXSjQ3z.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-aGLnXuPV.js +0 -1
- package/dist/assets/metadata-admin-G3YkfiAa.js +0 -22
- package/dist/assets/plugin-calendar-_Py45vU-.js +0 -1
- package/dist/assets/plugin-charts-Bchg0hAC.js +0 -7
- package/dist/assets/plugin-chatbot-DoDgOZ1X.js +0 -120
- package/dist/assets/plugin-dashboard-CqUaEqJ2.js +0 -6
- package/dist/assets/plugin-form-CUnJuXVB.js +0 -1
- package/dist/assets/plugin-gantt-nPjFN--f.js +0 -93
- package/dist/assets/plugin-grid-Ber_5UtY.js +0 -8
- package/dist/assets/plugin-kanban-Cng34wUx.js +0 -1
- package/dist/assets/plugin-map-DMseuRbE.js +0 -1
- package/dist/assets/plugin-report-BzdS88ls.js +0 -59
- package/dist/assets/plugin-timeline-CFOn7Ntr.js +0 -1
- package/dist/assets/plugin-tree-DRaXkomQ.js +0 -1
- package/dist/assets/plugin-view-B0FdLoWA.js +0 -1
- package/dist/assets/plugins-views-BKj7GUfw.js +0 -4
- package/dist/assets/src-hN5UFV3j.js +0 -12
- package/dist/assets/ui-components-BTSIX9CP.js +0 -42
- package/dist/assets/ui-layout-B6R0dB1y.js +0 -1
- package/dist/assets/useActionModal-B60Ph5_U.js +0 -1
- package/dist/assets/useReconcileOnError-BUw6x-9Q.js +0 -1
- package/dist/assets/utils-CFXe_XCU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,p as i,r as a,t as o}from"./vendor-react-slxo-5GC.js";import{f as s}from"./infrastructure-BySW-NB0.js";import{
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,p as i,r as a,t as o}from"./vendor-react-slxo-5GC.js";import{f as s}from"./infrastructure-BySW-NB0.js";import{P as c,a as l}from"./framework-Bn8ShCi0.js";import{Io as u,Qs as d,Za as f,cn as p,er as m,ki as h,or as g,rs as _,tr as v,wc as y}from"./ui-components-DlauVk27.js";import"./MetadataProvider-DlGQbrYS.js";import{n as b}from"./ui-layout-DnHby9xU.js";import{n as x}from"./appRoute-D5vwtoc_.js";var S=t({SearchResultsPage:()=>O}),C=e(n(),1),w=o();function T(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...T(n.children)):t.push(n);return t}var E={object:_,dashboard:f,page:u,report:d},D={object:`bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200`,dashboard:`bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200`,page:`bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200`,report:`bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200`};function O(){let{t:e}=l(),{appName:t}=r(),[n,o]=i(),[u,d]=(0,C.useState)(n.get(`q`)||``),{apps:f}=c(),S=f||[],O=x(S,t)||S[0],k=`/apps/${t}`,{user:A}=s(),j=(0,C.useMemo)(()=>{if(!O)return[];let e=T(O.navigation||[]),t={currentUserId:A?.id??null};return e.map(e=>{let{href:n}=b(e,k,t);return{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:n,type:e.type,description:e.description}}).filter(e=>e.href!==`#`)},[O,k,A?.id]),M=(0,C.useMemo)(()=>{if(!u.trim())return j;let e=u.toLowerCase();return j.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[j,u]),N=e=>{d(e),o(e?{q:e}:{})},P=(0,C.useMemo)(()=>{let e={};for(let t of M)(e[t.type]||=[]).push(t);return e},[M]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(a,{to:k,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,w.jsx)(y,{className:`h-4 w-4`}),e(`search.back`)]}),(0,w.jsx)(`h1`,{className:`text-xl font-semibold`,children:e(`search.title`)})]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`label`,{htmlFor:`search-results-input`,className:`sr-only`,children:e(`search.placeholder`)}),(0,w.jsx)(h,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,w.jsx)(p,{id:`search-results-input`,value:u,onChange:e=>N(e.target.value),placeholder:e(`search.placeholder`),className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:u.trim()?e(M.length===1?`search.resultsCount`:`search.resultsCountPlural`,{count:M.length,query:u}):e(`search.itemsAvailable`,{count:j.length})}),M.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,w.jsx)(h,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,w.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:e(`search.noResults`)}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:e(`search.noResultsHint`)})]}):(0,w.jsx)(`div`,{className:`space-y-6`,children:Object.entries(P).map(([t,n])=>{let r=E[t]||_,i=`search.type${t.charAt(0).toUpperCase()}${t.slice(1)}s`;return`${t.charAt(0).toUpperCase()}${t.slice(1)}`,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,w.jsx)(r,{className:`h-4 w-4`}),e(i),(0,w.jsx)(g,{variant:`secondary`,className:`ml-1 text-xs`,children:n.length})]}),(0,w.jsx)(`div`,{className:`grid gap-2`,children:n.map(t=>{let n=E[t.type]||_,r=`search.badge${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}`;return(0,w.jsx)(a,{to:t.href,className:`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:(0,w.jsx)(m,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,w.jsxs)(v,{className:`flex items-center gap-3 p-3`,children:[(0,w.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${D[t.type]||``}`,children:(0,w.jsx)(n,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),t.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.description})]}),(0,w.jsx)(g,{variant:`outline`,className:`text-xs shrink-0`,children:e(r)})]})})},t.id)})})]},t)})})]})}export{S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n,u as r}from"./vendor-react-slxo-5GC.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n,u as r}from"./vendor-react-slxo-5GC.js";import{Ei as i,Rt as a,er as o,ir as s,nr as c,or as l,rr as u,tr as d}from"./ui-components-DlauVk27.js";import{o as f,r as p,t as m}from"./types-B0Soeu38.js";var h=e(t(),1),g=n();function _(){let e=r(),[t,n]=(0,h.useState)(null),[_,v]=(0,h.useState)(null);(0,h.useEffect)(()=>{p().then(e=>n(e.manifests??[])).catch(e=>v(e?.message??`Failed to load settings`))},[]);let y=(0,h.useMemo)(()=>{if(!t)return null;let e=new Map;for(let n of[...t].sort((e,t)=>(e.order??999)-(t.order??999))){let t=n.category??`Other`,r=e.get(t)??[];r.push(n),e.set(t,r)}return e},[t]);return(0,g.jsxs)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,g.jsx)(i,{className:`h-7 w-7 text-muted-foreground`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Settings`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Configure your workspace, integrations, and feature flags.`})]})]}),_?(0,g.jsx)(o,{children:(0,g.jsx)(d,{className:`py-8 text-center text-sm text-destructive`,children:_})}):null,t?t.length===0?(0,g.jsx)(o,{children:(0,g.jsx)(d,{className:`py-12 text-center text-sm text-muted-foreground`,children:`No settings registered. Plugins can register settings manifests via the SettingsService.`})}):Array.from(y??[]).map(([t,n])=>(0,g.jsxs)(`section`,{className:`mb-8`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold tracking-wide uppercase text-muted-foreground mb-3`,children:t}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:n.map(t=>(0,g.jsxs)(o,{className:`cursor-pointer hover:border-primary/50 hover:shadow-sm transition-all`,onClick:()=>e(`/system/settings/${t.namespace}`),children:[(0,g.jsxs)(u,{className:`pb-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(t.icon?f(t.icon):i,{className:`h-6 w-6 text-muted-foreground`}),t.beta?(0,g.jsx)(l,{variant:`secondary`,className:`text-[10px]`,children:`Beta`}):null]}),(0,g.jsx)(s,{className:`text-base mt-2`,children:m(t.label)}),t.description?(0,g.jsx)(c,{className:`text-xs`,children:t.description}):null]}),(0,g.jsx)(d,{className:`pt-0`,children:(0,g.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[t.specifiers.length,` setting`,t.specifiers.length===1?``:`s`]})})]},t.namespace))})]},t)):(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(a,{className:`h-6 w-32`}),(0,g.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:3}).map((e,t)=>(0,g.jsx)(a,{className:`h-32 w-full`},t))})]})]})}export{_ as SettingsHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{a}from"./framework-WZr4krBC.js";import{Ba as o,Cr as s,Hs as c,Jt as l,Kt as u,Ri as d,Tc as f,Va as p,Xt as m,Yt as h,Zt as g,bt as _,ct as v,dr as y,er as b,fr as x,in as S,ln as C,nr as w,oo as T,pn as E,pr as D,qt as O,rn as k,sr as A,tr as j,yt as M,zt as N}from"./ui-components-BTSIX9CP.js";import{r as P}from"./vendor-ui-utils-C1OpMExs.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-C_3ZSSQo.js";var B=e(t(),1),V=r();function H({reason:e,className:t}){return(0,V.jsxs)(A,{variant:`outline`,className:`gap-1 border-amber-300 bg-amber-50 text-amber-900 ${t??``}`,title:e??`Pinned by environment variable — cannot be edited from the UI.`,children:[(0,V.jsx)(o,{className:`h-3 w-3`}),`Locked by env`]})}function U({resolved:e,labels:t}){let n=e.cascadeChain;if(!n||n.length===0)return null;let r=n.find(e=>e.effective)??n[n.length-1],i=n.find(e=>e!==r&&e.value!==null&&e.value!==void 0),a=e=>t?.sourceLabel?.(e)??e;return r.scope!=="default"&&r.scope!==`user`&&r.scope!==`tenant`?(0,V.jsxs)(A,{variant:`outline`,className:`text-blue-700 border-blue-300 text-[10px]`,children:[`Inherited from `,a(r.scope)]}):i?(0,V.jsxs)(A,{variant:`outline`,className:`text-amber-700 border-amber-300 text-[10px]`,children:[`Overrides `,a(i.scope)]}):null}function W({spec:e,resolved:t,labelText:n,labels:r}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(E,{className:`text-sm font-medium`,children:[n,e.required?(0,V.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`}):null]}),e.deprecated?(0,V.jsxs)(A,{variant:`outline`,className:`text-amber-700 border-amber-300`,children:[`Deprecated`,e.replacedBy?` → ${e.replacedBy}`:``]}):null,t?.locked?(0,V.jsx)(H,{reason:t.lockedReason}):null,t&&!t.locked?(0,V.jsx)(U,{resolved:t,labels:r}):null,t?.source&&t.source!=="default"&&!t.locked?(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r?.sourceLabel?.(t.source)??t.source}):null]})}function G({description:e}){return e?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e}):null}function K(e){let{spec:t,resolved:n,value:r,onChange:i,onAction:a,locked:o,saving:d,labels:f}=e,p=(0,B.useId)(),w=!!(o||d),A=z(t.label),j=t.key&&f?f.fieldLabel(t.key,A):A,N=t.key&&f?f.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&f?f.groupTitle(t.id,A):A,n=t.id&&f?f.groupDescription(t.id,t.description):t.description;return(0,V.jsxs)(`div`,{className:`pt-6 pb-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold tracking-tight text-foreground/90`,children:e}),n?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n}):null,(0,V.jsx)(u,{className:`mt-3`})]})}if(t.type===`info_banner`)return(0,V.jsxs)(y,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(T,{className:`h-4 w-4`}),(0,V.jsx)(D,{children:A}),t.bannerText?(0,V.jsx)(x,{children:t.bannerText}):null]});if(t.type===`child_pane`)return(0,V.jsxs)(`a`,{href:`#/settings/${t.childNamespace}`,className:`flex items-center justify-between rounded-md border border-border bg-card px-4 py-3 hover:bg-accent transition-colors`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:A}),t.description?(0,V.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description}):null]}),(0,V.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})]});if(t.type===`title_value`)return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),(0,V.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:String(r??`—`)})]});if(t.type===`action_button`){let e=t.icon?R(t.icon):null,n=t.id??t.key??`test`,r=f?f.actionLabel(n,A):A;return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:r}),t.description?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:t.description}):null]}),(0,V.jsxs)(s,{size:`sm`,variant:`secondary`,onClick:a,disabled:d,children:[e?(0,V.jsx)(e,{className:`h-4 w-4 mr-1.5`}):null,r]})]})}let P=e=>(0,V.jsxs)(`div`,{className:`space-y-1.5 py-2`,children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),e,(0,V.jsx)(G,{description:N})]}),F=e=>{let n=typeof e.label==`string`?e.label:e.label?.defaultValue??String(e.value);return!t.key||!f?n:f.optionLabel(t.key,String(e.value),n)};switch(t.type){case`text`:case`email`:case`url`:case`phone`:return P((0,V.jsx)(C,{id:p,type:t.type===`email`?`email`:t.type===`url`?`url`:`text`,value:r??``,minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,disabled:w,onChange:e=>i(e.target.value)}));case`password`:return P((0,V.jsx)(C,{id:p,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:w,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(v,{id:p,rows:t.rows??4,value:r??``,minLength:t.minLength,maxLength:t.maxLength,disabled:w,onChange:e=>i(e.target.value)}));case`number`:return P((0,V.jsx)(C,{id:p,type:`number`,value:r,min:t.min,max:t.max,step:t.step,disabled:w,onChange:e=>i(e.target.value===``?null:Number(e.target.value))}));case`toggle`:return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),(0,V.jsx)(G,{description:N})]}),(0,V.jsx)(M,{id:p,checked:!!r,disabled:w,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(O,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:w,children:[(0,V.jsx)(m,{id:p,children:(0,V.jsx)(g,{placeholder:`Select…`})}),(0,V.jsx)(l,{children:t.options?.map(e=>(0,V.jsx)(h,{value:String(e.value),children:F(e)},String(e.value)))})]}));case`radio`:return P((0,V.jsx)(k,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:w,children:t.options?.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(S,{value:String(e.value),id:`${p}-${e.value}`}),(0,V.jsx)(E,{htmlFor:`${p}-${e.value}`,className:`text-sm font-normal`,children:F(e)})]},String(e.value)))}));case`multiselect`:{let e=Array.isArray(r)?r:[];return P((0,V.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:t.options?.map(t=>{let n=String(t.value);return(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(b,{checked:e.map(String).includes(n),disabled:w,onCheckedChange:t=>{let r=new Set(e.map(String));t?r.add(n):r.delete(n),i(Array.from(r))}}),F(t)]},n)})}))}case`slider`:return P((0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(_,{value:[Number(r??t.min??0)],min:t.min??0,max:t.max??100,step:t.step??1,disabled:w,onValueChange:e=>i(e[0]),className:`flex-1`}),(0,V.jsx)(`span`,{className:`text-sm tabular-nums w-12 text-right`,children:String(r??t.min??0)})]}));case`color`:return P((0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(C,{id:p,type:`color`,value:r??`#000000`,disabled:w,onChange:e=>i(e.target.value),className:`w-16 h-9 p-1`}),(0,V.jsx)(C,{value:r??``,disabled:w,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(v,{id:p,rows:t.rows??6,className:`font-mono text-xs`,value:typeof r==`string`?r:JSON.stringify(r??null,null,2),disabled:w,onChange:e=>i(e.target.value)}));default:return P((0,V.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Unsupported specifier type: `,t.type]}))}}var q=new Set([`common`,`validation`,`errors`,`system`,`auth`]);function J(e){let{t,i18n:n}=a();return(0,B.useMemo)(()=>{let r=()=>{if(!n||typeof n.getResourceBundle!=`function`)return[];let e=n.language||`en`,t=n.getResourceBundle(e,`translation`);return t?Object.keys(t).filter(e=>!q.has(e)&&t[e]&&typeof t[e]==`object`&&t[e].settings):[]},i=(n,i)=>{if(!e)return i;try{let i=r();for(let r of i){let i=`${r}.settings.${e}.${n}`,a=t(i,{defaultValue:``});if(a&&a!==i&&a!==``)return a}}catch{}return i},a=(e,r)=>{try{if(!n||typeof n.getResourceBundle!=`function`)return r;let i=n.language||`en`,a=n.getResourceBundle(i,`translation`);if(!a)return r;for(let n of Object.keys(a)){if(q.has(n))continue;let r=a[n];if(!r||typeof r!=`object`||!(`settingsCommon`in r))continue;let i=`${n}.settingsCommon.${e}`,o=t(i,{defaultValue:``});if(o&&o!==i&&o!==``)return o}}catch{}return r},o={env:`Env`,global:`Global`,tenant:`Tenant`,user:`User`,default:`Default`};return{title:e=>i(`title`,e)??e,description:e=>i(`description`,e),groupTitle:(e,t)=>i(`groups.${e}.title`,t)??t,groupDescription:(e,t)=>i(`groups.${e}.description`,t),fieldLabel:(e,t)=>i(`keys.${e}.label`,t)??t,fieldHelp:(e,t)=>i(`keys.${e}.help`,t),fieldPlaceholder:(e,t)=>i(`keys.${e}.placeholder`,t),optionLabel:(e,t,n)=>i(`keys.${e}.options.${t}`,n)??n,actionLabel:(e,t)=>i(`actions.${e}.label`,t)??t,actionConfirm:(e,t)=>i(`actions.${e}.confirmText`,t),actionSuccess:(e,t)=>i(`actions.${e}.successMessage`,t),sourceLabel:e=>a(`sourceLabels.${e}`,o[e]??e)}},[e,t,n,n?.language])}function Y(e,t){if(!e)return!0;let n=e.trim().match(/^\$\{(.+)\}$/);if(!n)return!0;try{return!!Function(`data`,`with (data) { return (${n[1]}); }`)(t)}catch{return!0}}function X(){let e=n(),t=i(),r=e.namespace??``,[a,o]=(0,B.useState)(null),[c,l]=(0,B.useState)(!0),[u,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)({}),y=(0,B.useCallback)(async()=>{l(!0),g(null);try{o(await L(r)),v({})}catch(e){g(e?.message??`Failed to load settings`)}finally{l(!1)}},[r]);(0,B.useEffect)(()=>{r&&y()},[r,y]);let b=(0,B.useMemo)(()=>{let e={};if(!a)return e;for(let[t,n]of Object.entries(a.values))e[t]=n.value;return{...e,..._}},[a,_]),x=(0,B.useMemo)(()=>Object.keys(_),[_]),S=J(r);if(!r)return(0,V.jsx)(`div`,{className:`p-6 text-muted-foreground`,children:`No namespace selected.`});if(c)return(0,V.jsxs)(`div`,{className:`p-6 space-y-3 max-w-3xl`,children:[(0,V.jsx)(N,{className:`h-8 w-1/3`}),(0,V.jsx)(N,{className:`h-4 w-2/3`}),(0,V.jsx)(N,{className:`h-32 w-full`}),(0,V.jsx)(N,{className:`h-32 w-full`})]});if(h)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(s,{variant:`ghost`,size:`sm`,onClick:()=>t(-1),children:[(0,V.jsx)(f,{className:`h-4 w-4 mr-1`}),` Back`]}),(0,V.jsx)(j,{className:`mt-3`,children:(0,V.jsx)(w,{className:`py-8 text-center text-sm text-destructive`,children:h})})]});if(!a)return null;let{manifest:C,values:T}=a,E=C.icon?R(C.icon):null,D=S.title(z(C.label)),O=S.description(C.description),k=async()=>{if(x.length!==0){m(!0);try{let e=await F(r,_);o({...a,values:{...T,...e.values}}),v({}),P.success(`Settings saved`)}catch(e){e?.payload?.error?.code===`SETTINGS_LOCKED`?P.error(`Locked by environment: ${e.payload.error.key}`):P.error(e?.message??`Save failed`)}finally{m(!1)}}},M=async e=>{m(!0);try{let t=await I(r,e,_);t.ok?P.success(t.message??`Action succeeded`):P.error(t.message??`Action failed`)}catch(e){P.error(e?.message??`Action failed`)}finally{m(!1)}};return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl mx-auto pb-32`,children:[(0,V.jsxs)(s,{variant:`ghost`,size:`sm`,onClick:()=>t(`/system/settings`),children:[(0,V.jsx)(f,{className:`h-4 w-4 mr-1`}),` All settings`]}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-3`,children:[E?(0,V.jsx)(E,{className:`h-7 w-7 mt-0.5 text-muted-foreground`}):null,(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:D}),C.beta?(0,V.jsx)(A,{variant:`secondary`,children:`Beta`}):null]}),O?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:O}):null]})]}),C.helpText?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-4 whitespace-pre-wrap`,children:C.helpText}):null,(0,V.jsx)(`div`,{className:`mt-6 divide-y`,children:C.specifiers.filter(e=>Y(e.visible,b)).map((e,t)=>{let n=e.key,r=n?T[n]:void 0;return(0,V.jsx)(K,{spec:e,resolved:r,value:n?n in _?_[n]:r?.value:void 0,onChange:e=>n&&v(t=>({...t,[n]:e})),onAction:e.type===`action_button`?()=>M(e.id??n??`test`):void 0,locked:r?.locked,saving:u,labels:S},(n??`_layout_${t}`)+t)})}),x.length>0?(0,V.jsx)(`div`,{className:`fixed bottom-0 inset-x-0 bg-background/95 backdrop-blur border-t shadow-lg z-40`,children:(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto px-6 py-3 flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[x.length,` unsaved change`,x.length>1?`s`:``]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(s,{variant:`ghost`,size:`sm`,onClick:()=>v({}),disabled:u,children:[(0,V.jsx)(d,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(s,{onClick:k,disabled:u,children:[u?(0,V.jsx)(p,{className:`h-4 w-4 mr-1 animate-spin`}):null,`Save changes`]})]})]})}):null]})}export{X as SettingsView};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{a}from"./framework-Bn8ShCi0.js";import{$n as o,Ba as s,Gt as c,Jt as l,Kt as u,Li as d,Rt as f,Sr as p,Vs as m,Xt as h,Yt as g,ao as _,cn as v,dr as y,er as b,fn as x,fr as S,nn as C,or as w,qt as T,rn as E,st as D,tr as O,ur as k,vt as A,wc as j,yt as M,za as N}from"./ui-components-DlauVk27.js";import{r as P}from"./vendor-ui-utils-C1OpMExs.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-B0Soeu38.js";var B=e(t(),1),V=r();function H({reason:e,className:t}){return(0,V.jsxs)(w,{variant:`outline`,className:`gap-1 border-amber-300 bg-amber-50 text-amber-900 ${t??``}`,title:e??`Pinned by environment variable — cannot be edited from the UI.`,children:[(0,V.jsx)(N,{className:`h-3 w-3`}),`Locked by env`]})}function U({resolved:e,labels:t}){let n=e.cascadeChain;if(!n||n.length===0)return null;let r=n.find(e=>e.effective)??n[n.length-1],i=n.find(e=>e!==r&&e.value!==null&&e.value!==void 0),a=e=>t?.sourceLabel?.(e)??e;return r.scope!=="default"&&r.scope!==`user`&&r.scope!==`tenant`?(0,V.jsxs)(w,{variant:`outline`,className:`text-blue-700 border-blue-300 text-[10px]`,children:[`Inherited from `,a(r.scope)]}):i?(0,V.jsxs)(w,{variant:`outline`,className:`text-amber-700 border-amber-300 text-[10px]`,children:[`Overrides `,a(i.scope)]}):null}function W({spec:e,resolved:t,labelText:n,labels:r}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(x,{className:`text-sm font-medium`,children:[n,e.required?(0,V.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`}):null]}),e.deprecated?(0,V.jsxs)(w,{variant:`outline`,className:`text-amber-700 border-amber-300`,children:[`Deprecated`,e.replacedBy?` → ${e.replacedBy}`:``]}):null,t?.locked?(0,V.jsx)(H,{reason:t.lockedReason}):null,t&&!t.locked?(0,V.jsx)(U,{resolved:t,labels:r}):null,t?.source&&t.source!=="default"&&!t.locked?(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r?.sourceLabel?.(t.source)??t.source}):null]})}function G({description:e}){return e?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e}):null}function K(e){let{spec:t,resolved:n,value:r,onChange:i,onAction:a,locked:s,saving:d,labels:f}=e,b=(0,B.useId)(),w=!!(s||d),O=z(t.label),j=t.key&&f?f.fieldLabel(t.key,O):O,N=t.key&&f?f.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&f?f.groupTitle(t.id,O):O,n=t.id&&f?f.groupDescription(t.id,t.description):t.description;return(0,V.jsxs)(`div`,{className:`pt-6 pb-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold tracking-tight text-foreground/90`,children:e}),n?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n}):null,(0,V.jsx)(c,{className:`mt-3`})]})}if(t.type===`info_banner`)return(0,V.jsxs)(k,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(_,{className:`h-4 w-4`}),(0,V.jsx)(S,{children:O}),t.bannerText?(0,V.jsx)(y,{children:t.bannerText}):null]});if(t.type===`child_pane`)return(0,V.jsxs)(`a`,{href:`#/settings/${t.childNamespace}`,className:`flex items-center justify-between rounded-md border border-border bg-card px-4 py-3 hover:bg-accent transition-colors`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:O}),t.description?(0,V.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description}):null]}),(0,V.jsx)(m,{className:`h-4 w-4 text-muted-foreground`})]});if(t.type===`title_value`)return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),(0,V.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:String(r??`—`)})]});if(t.type===`action_button`){let e=t.icon?R(t.icon):null,n=t.id??t.key??`test`,r=f?f.actionLabel(n,O):O;return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:r}),t.description?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:t.description}):null]}),(0,V.jsxs)(p,{size:`sm`,variant:`secondary`,onClick:a,disabled:d,children:[e?(0,V.jsx)(e,{className:`h-4 w-4 mr-1.5`}):null,r]})]})}let P=e=>(0,V.jsxs)(`div`,{className:`space-y-1.5 py-2`,children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),e,(0,V.jsx)(G,{description:N})]}),F=e=>{let n=typeof e.label==`string`?e.label:e.label?.defaultValue??String(e.value);return!t.key||!f?n:f.optionLabel(t.key,String(e.value),n)};switch(t.type){case`text`:case`email`:case`url`:case`phone`:return P((0,V.jsx)(v,{id:b,type:t.type===`email`?`email`:t.type===`url`?`url`:`text`,value:r??``,minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,disabled:w,onChange:e=>i(e.target.value)}));case`password`:return P((0,V.jsx)(v,{id:b,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:w,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(D,{id:b,rows:t.rows??4,value:r??``,minLength:t.minLength,maxLength:t.maxLength,disabled:w,onChange:e=>i(e.target.value)}));case`number`:return P((0,V.jsx)(v,{id:b,type:`number`,value:r,min:t.min,max:t.max,step:t.step,disabled:w,onChange:e=>i(e.target.value===``?null:Number(e.target.value))}));case`toggle`:return(0,V.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(W,{spec:t,resolved:n,labelText:j,labels:f}),(0,V.jsx)(G,{description:N})]}),(0,V.jsx)(A,{id:b,checked:!!r,disabled:w,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(u,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:w,children:[(0,V.jsx)(g,{id:b,children:(0,V.jsx)(h,{placeholder:`Select…`})}),(0,V.jsx)(T,{children:t.options?.map(e=>(0,V.jsx)(l,{value:String(e.value),children:F(e)},String(e.value)))})]}));case`radio`:return P((0,V.jsx)(C,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:w,children:t.options?.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(E,{value:String(e.value),id:`${b}-${e.value}`}),(0,V.jsx)(x,{htmlFor:`${b}-${e.value}`,className:`text-sm font-normal`,children:F(e)})]},String(e.value)))}));case`multiselect`:{let e=Array.isArray(r)?r:[];return P((0,V.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:t.options?.map(t=>{let n=String(t.value);return(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(o,{checked:e.map(String).includes(n),disabled:w,onCheckedChange:t=>{let r=new Set(e.map(String));t?r.add(n):r.delete(n),i(Array.from(r))}}),F(t)]},n)})}))}case`slider`:return P((0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(M,{value:[Number(r??t.min??0)],min:t.min??0,max:t.max??100,step:t.step??1,disabled:w,onValueChange:e=>i(e[0]),className:`flex-1`}),(0,V.jsx)(`span`,{className:`text-sm tabular-nums w-12 text-right`,children:String(r??t.min??0)})]}));case`color`:return P((0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(v,{id:b,type:`color`,value:r??`#000000`,disabled:w,onChange:e=>i(e.target.value),className:`w-16 h-9 p-1`}),(0,V.jsx)(v,{value:r??``,disabled:w,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(D,{id:b,rows:t.rows??6,className:`font-mono text-xs`,value:typeof r==`string`?r:JSON.stringify(r??null,null,2),disabled:w,onChange:e=>i(e.target.value)}));default:return P((0,V.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Unsupported specifier type: `,t.type]}))}}var q=new Set([`common`,`validation`,`errors`,`system`,`auth`]);function J(e){let{t,i18n:n}=a();return(0,B.useMemo)(()=>{let r=()=>{if(!n||typeof n.getResourceBundle!=`function`)return[];let e=n.language||`en`,t=n.getResourceBundle(e,`translation`);return t?Object.keys(t).filter(e=>!q.has(e)&&t[e]&&typeof t[e]==`object`&&t[e].settings):[]},i=(n,i)=>{if(!e)return i;try{let i=r();for(let r of i){let i=`${r}.settings.${e}.${n}`,a=t(i,{defaultValue:``});if(a&&a!==i&&a!==``)return a}}catch{}return i},a=(e,r)=>{try{if(!n||typeof n.getResourceBundle!=`function`)return r;let i=n.language||`en`,a=n.getResourceBundle(i,`translation`);if(!a)return r;for(let n of Object.keys(a)){if(q.has(n))continue;let r=a[n];if(!r||typeof r!=`object`||!(`settingsCommon`in r))continue;let i=`${n}.settingsCommon.${e}`,o=t(i,{defaultValue:``});if(o&&o!==i&&o!==``)return o}}catch{}return r},o={env:`Env`,global:`Global`,tenant:`Tenant`,user:`User`,default:`Default`};return{title:e=>i(`title`,e)??e,description:e=>i(`description`,e),groupTitle:(e,t)=>i(`groups.${e}.title`,t)??t,groupDescription:(e,t)=>i(`groups.${e}.description`,t),fieldLabel:(e,t)=>i(`keys.${e}.label`,t)??t,fieldHelp:(e,t)=>i(`keys.${e}.help`,t),fieldPlaceholder:(e,t)=>i(`keys.${e}.placeholder`,t),optionLabel:(e,t,n)=>i(`keys.${e}.options.${t}`,n)??n,actionLabel:(e,t)=>i(`actions.${e}.label`,t)??t,actionConfirm:(e,t)=>i(`actions.${e}.confirmText`,t),actionSuccess:(e,t)=>i(`actions.${e}.successMessage`,t),sourceLabel:e=>a(`sourceLabels.${e}`,o[e]??e)}},[e,t,n,n?.language])}function Y(e,t){if(!e)return!0;let n=e.trim().match(/^\$\{(.+)\}$/);if(!n)return!0;try{return!!Function(`data`,`with (data) { return (${n[1]}); }`)(t)}catch{return!0}}function X(){let e=n(),t=i(),r=e.namespace??``,[a,o]=(0,B.useState)(null),[c,l]=(0,B.useState)(!0),[u,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)({}),y=(0,B.useCallback)(async()=>{l(!0),g(null);try{o(await L(r)),v({})}catch(e){g(e?.message??`Failed to load settings`)}finally{l(!1)}},[r]);(0,B.useEffect)(()=>{r&&y()},[r,y]);let x=(0,B.useMemo)(()=>{let e={};if(!a)return e;for(let[t,n]of Object.entries(a.values))e[t]=n.value;return{...e,..._}},[a,_]),S=(0,B.useMemo)(()=>Object.keys(_),[_]),C=J(r);if(!r)return(0,V.jsx)(`div`,{className:`p-6 text-muted-foreground`,children:`No namespace selected.`});if(c)return(0,V.jsxs)(`div`,{className:`p-6 space-y-3 max-w-3xl`,children:[(0,V.jsx)(f,{className:`h-8 w-1/3`}),(0,V.jsx)(f,{className:`h-4 w-2/3`}),(0,V.jsx)(f,{className:`h-32 w-full`}),(0,V.jsx)(f,{className:`h-32 w-full`})]});if(h)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(p,{variant:`ghost`,size:`sm`,onClick:()=>t(-1),children:[(0,V.jsx)(j,{className:`h-4 w-4 mr-1`}),` Back`]}),(0,V.jsx)(b,{className:`mt-3`,children:(0,V.jsx)(O,{className:`py-8 text-center text-sm text-destructive`,children:h})})]});if(!a)return null;let{manifest:T,values:E}=a,D=T.icon?R(T.icon):null,k=C.title(z(T.label)),A=C.description(T.description),M=async()=>{if(S.length!==0){m(!0);try{let e=await F(r,_);o({...a,values:{...E,...e.values}}),v({}),P.success(`Settings saved`)}catch(e){e?.payload?.error?.code===`SETTINGS_LOCKED`?P.error(`Locked by environment: ${e.payload.error.key}`):P.error(e?.message??`Save failed`)}finally{m(!1)}}},N=async e=>{m(!0);try{let t=await I(r,e,_);t.ok?P.success(t.message??`Action succeeded`):P.error(t.message??`Action failed`)}catch(e){P.error(e?.message??`Action failed`)}finally{m(!1)}};return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl mx-auto pb-32`,children:[(0,V.jsxs)(p,{variant:`ghost`,size:`sm`,onClick:()=>t(`/system/settings`),children:[(0,V.jsx)(j,{className:`h-4 w-4 mr-1`}),` All settings`]}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-3`,children:[D?(0,V.jsx)(D,{className:`h-7 w-7 mt-0.5 text-muted-foreground`}):null,(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:k}),T.beta?(0,V.jsx)(w,{variant:`secondary`,children:`Beta`}):null]}),A?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:A}):null]})]}),T.helpText?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-4 whitespace-pre-wrap`,children:T.helpText}):null,(0,V.jsx)(`div`,{className:`mt-6 divide-y`,children:T.specifiers.filter(e=>Y(e.visible,x)).map((e,t)=>{let n=e.key,r=n?E[n]:void 0;return(0,V.jsx)(K,{spec:e,resolved:r,value:n?n in _?_[n]:r?.value:void 0,onChange:e=>n&&v(t=>({...t,[n]:e})),onAction:e.type===`action_button`?()=>N(e.id??n??`test`):void 0,locked:r?.locked,saving:u,labels:C},(n??`_layout_${t}`)+t)})}),S.length>0?(0,V.jsx)(`div`,{className:`fixed bottom-0 inset-x-0 bg-background/95 backdrop-blur border-t shadow-lg z-40`,children:(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto px-6 py-3 flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[S.length,` unsaved change`,S.length>1?`s`:``]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(p,{variant:`ghost`,size:`sm`,onClick:()=>v({}),disabled:u,children:[(0,V.jsx)(d,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(p,{onClick:M,disabled:u,children:[u?(0,V.jsx)(s,{className:`h-4 w-4 mr-1 animate-spin`}):null,`Save changes`]})]})]})}):null]})}export{X as SettingsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{d as a}from"./infrastructure-BySW-NB0.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{d as a}from"./infrastructure-BySW-NB0.js";import{N as o}from"./framework-Bn8ShCi0.js";import{Ai as s,Ba as c,Ei as l,Lr as u,Rr as d,Xa as f,er as p,ir as m,lc as h,nc as g,nr as _,or as v,rr as y,rs as b,sc as x,si as S,ti as C,to as w,tr as T,xi as E}from"./ui-components-DlauVk27.js";import"./src-CbqgiuxM.js";var D=e(t(),1),O=r();function k(){let e=i(),{appName:t}=n(),r=t?`/apps/${t}`:``,k=o(),A=a(),[j,M]=(0,D.useState)({users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[N,P]=(0,D.useState)(!0),F=(0,D.useCallback)(async()=>{if(k){P(!0);try{let[e,t,n,r,i]=await Promise.all([k.find(`sys_user`).catch(()=>({data:[]})),k.find(`sys_org`).catch(()=>({data:[]})),k.find(`sys_role`).catch(()=>({data:[]})),k.find(`sys_permission`).catch(()=>({data:[]})),k.find(`sys_audit_log`).catch(()=>({data:[]}))]);M({users:e.data?.length??0,orgs:t.data?.length??0,roles:n.data?.length??0,permissions:r.data?.length??0,auditLogs:i.data?.length??0})}catch{}finally{P(!1)}}},[k]);(0,D.useEffect)(()=>{F()},[F]);let I=[{title:`Applications`,description:`Manage all configured applications`,icon:f,href:`${r}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:b,href:`${r}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:x,href:`${r}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:u,href:`${r}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:g,href:`${r}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:E,href:`${r}/system/roles`,countLabel:`roles`,count:j.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:w,href:`${r}/system/permissions`,countLabel:`permissions`,count:j.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:s,href:`${r}/system/audit-log`,countLabel:`entries`,count:j.auditLogs},{title:`AI Approvals`,description:`Review actions AI agents propose before they execute`,icon:h,href:`${r}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:S,href:`${r}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:l,href:`${r}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:C,href:`${r}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:d,href:`${r}/system/profile`,countLabel:``,count:null}],R=[...I,...L].filter(e=>!e.adminOnly||A);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),N&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),`Loading statistics...`]}),(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(t=>{let n=t.icon;return(0,O.jsxs)(p,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${t.title}: ${t.description}`,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(t.href))},children:[(0,O.jsxs)(y,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,O.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,O.jsx)(n,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(m,{className:`text-base`,children:t.title}),(0,O.jsx)(_,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(T,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(v,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};
|