@objectstack/console 15.1.1 → 16.0.0-rc.1
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-BFaddpzn.js → AdapterProvider-DkXaFA1A.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-CvBOdCmI.js → AiPendingActionsPage-C1pkyzWu.js} +1 -1
- package/dist/assets/ApiConsolePage-BCujjvCA.js +1 -0
- package/dist/assets/{AppDocsIndex-BYY7DwDn.js → AppDocsIndex-DwtDfwnR.js} +1 -1
- package/dist/assets/{AppManagementPage-ct829ZDs.js → AppManagementPage-KPrmIA-f.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-DFQUv0F_.js +1 -0
- package/dist/assets/AuditLogPage-BNkFvefV.js +1 -0
- package/dist/assets/ComponentNavView-FTFk3uvC.js +1 -0
- package/dist/assets/{CreateViewDialog-C1plmcyi.js → CreateViewDialog-DTzKynzF.js} +1 -1
- package/dist/assets/DashboardView-Y6nIjjJB.js +1 -0
- package/dist/assets/{DeveloperHubPage-Cv1WYOxY.js → DeveloperHubPage-CYPM3AvL.js} +1 -1
- package/dist/assets/{DocShell-CLtiW77i.js → DocShell-DnXj6ocC.js} +1 -1
- package/dist/assets/{ExpressionProvider-E8d0a2zy.js → ExpressionProvider-BrbZIz2M.js} +1 -1
- package/dist/assets/FlowRunsPage-BAbmqrqx.js +1 -0
- package/dist/assets/{IntegrationsPage-3Mmj9WPX.js → IntegrationsPage-CyD9iolE.js} +2 -2
- package/dist/assets/InterfaceListPage-DdaX7c_c.js +1 -0
- package/dist/assets/ManagedByBadge-DbYycO1m.js +1 -0
- package/dist/assets/{MarketplaceAccessDenied-BBrk9Zzt.js → MarketplaceAccessDenied-Csr3Jh7C.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-Baul16n9.js → MarketplaceInstalledPage-BtD9NMRl.js} +1 -1
- package/dist/assets/MarketplacePackagePage-DHrjr3jY.js +4 -0
- package/dist/assets/{MarketplacePage-CIiUcu2P.js → MarketplacePage-Dw2yHsdE.js} +1 -1
- package/dist/assets/{MetadataInspector-Ty_bVFlI.js → MetadataInspector-C6pU5_lx.js} +1 -1
- package/dist/assets/{MetadataProvider-Dw6hFBw2.js → MetadataProvider-BnfG1pyl.js} +1 -1
- package/dist/assets/ObjectDataPage-BA93ldBf.js +1 -0
- package/dist/assets/PageView-jtsz_IPE.js +1 -0
- package/dist/assets/ProfilePage-BhlwjGUP.js +1 -0
- package/dist/assets/{PublicFormsPage-DIXBuC2U.js → PublicFormsPage-D5kg7qJa.js} +1 -1
- package/dist/assets/RecordDetailView-F0k3QMTV.js +9 -0
- package/dist/assets/RecordFormPage-BRDfPdPg.js +1 -0
- package/dist/assets/ReportDefaultInspector-CYCJDOVb.js +3 -0
- package/dist/assets/ReportView-Dtz9IJbH.js +2 -0
- package/dist/assets/{SearchResultsPage-BXtahiUa.js → SearchResultsPage-0pCQZ9_u.js} +1 -1
- package/dist/assets/{SettingsHub-Cbb36Ak1.js → SettingsHub-DqS8nfs-.js} +1 -1
- package/dist/assets/{SettingsView-MqDu9fQ0.js → SettingsView-DHrrHsbU.js} +1 -1
- package/dist/assets/{SystemHubPage-CRlHp6zs.js → SystemHubPage-BWPXrnc9.js} +1 -1
- package/dist/assets/data-adapter-BR5P3Htq.js +9 -0
- package/dist/assets/drillUrlFilters-BL8PeMrH.js +1 -0
- package/dist/assets/framework-brxTxzwx.js +8 -0
- package/dist/assets/getIcon-EzAarNT8.js +1 -0
- package/dist/assets/{highlighted-body-OFNGDK62-CmEyqxRh.js → highlighted-body-OFNGDK62-3tGE6imP.js} +1 -1
- package/dist/assets/i18n-CWIk44wT.js +9 -0
- package/dist/assets/index-D3TWmLHH.css +2 -0
- package/dist/assets/index-LuGaXtX0.js +2 -0
- package/dist/assets/infrastructure-C6pQBkbt.js +3 -0
- package/dist/assets/mermaid-GHXKKRXX-btdeklf1.js +1 -0
- package/dist/assets/metadata-admin-Buf34qxl.js +25 -0
- package/dist/assets/plugin-calendar-Bx_Bsdae.js +1 -0
- package/dist/assets/plugin-charts-DqND8tT3.js +7 -0
- package/dist/assets/plugin-chatbot-DwbSyUax.js +120 -0
- package/dist/assets/plugin-dashboard-D2VhHDxA.js +6 -0
- package/dist/assets/plugin-form-HMQsT2Tp.js +1 -0
- package/dist/assets/plugin-gantt-CMpG3oO4.js +63 -0
- package/dist/assets/plugin-grid-Dz4WW_sQ.js +8 -0
- package/dist/assets/plugin-kanban-fgScBnfP.js +1 -0
- package/dist/assets/plugin-map-zagD7Zuk.js +1 -0
- package/dist/assets/{plugin-markdown-CeSEfSMe.js → plugin-markdown-DtcSX8M_.js} +1 -1
- package/dist/assets/plugin-report-BRs6v5vb.js +59 -0
- package/dist/assets/plugin-timeline-Cl8J9HYj.js +1 -0
- package/dist/assets/plugin-tree-B3zTpUOf.js +1 -0
- package/dist/assets/plugin-view-BDYhOlHx.js +1 -0
- package/dist/assets/plugins-views-Dc4ARhcP.js +4 -0
- package/dist/assets/{skeletons-DGSWW9zt.js → skeletons-CPF9cI6N.js} +1 -1
- package/dist/assets/{src-2Uisncjb.js → src-A4S4Zx5p.js} +1 -1
- package/dist/assets/src-By-rFjBo.js +1 -0
- package/dist/assets/src-CRFYUj2Z.js +19 -0
- package/dist/assets/{types-C7NHW0h6.js → types-CtGENai_.js} +1 -1
- package/dist/assets/ui-components-D1psd5qA.js +72 -0
- package/dist/assets/ui-layout-UgL2qgLW.js +1 -0
- package/dist/assets/{use-book-data-BwZnHc4z.js → use-book-data-CWCLCSUn.js} +1 -1
- package/dist/assets/{useMetadata-IV9x2kG3.js → useMetadata-Byeqylbl.js} +1 -1
- package/dist/assets/useOpenRecordList-BfKYZKMn.js +1 -0
- package/dist/assets/vendor-objectstack-CjHQG7Oa.js +114 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ApiConsolePage-BETRFRmt.js +0 -1
- package/dist/assets/ApprovalsInboxPage-CLRfOCfN.js +0 -1
- package/dist/assets/AuditLogPage-DrVbfMwo.js +0 -1
- package/dist/assets/ComponentNavView-BdBCf414.js +0 -1
- package/dist/assets/DashboardView-YwIvqU1F.js +0 -1
- package/dist/assets/FlowRunsPage-Kk2pQjuI.js +0 -1
- package/dist/assets/InterfaceListPage-BEv_Whkh.js +0 -1
- package/dist/assets/ManagedByBadge-h6zYSYEw.js +0 -1
- package/dist/assets/MarketplacePackagePage-C4BoxM9O.js +0 -4
- package/dist/assets/ObjectDataPage-C0VN22jG.js +0 -1
- package/dist/assets/PageView-9Qd343Y8.js +0 -1
- package/dist/assets/ProfilePage-DotFPbJV.js +0 -1
- package/dist/assets/RecordDetailView-WbRO9Qfl.js +0 -2
- package/dist/assets/RecordFormPage-CVM9R6n6.js +0 -1
- package/dist/assets/ReportDefaultInspector-Dfj5Pq4K.js +0 -3
- package/dist/assets/ReportView-BuAo4KRU.js +0 -2
- package/dist/assets/data-adapter-BaT0fWzy.js +0 -9
- package/dist/assets/framework-CavAJOoG.js +0 -6
- package/dist/assets/getIcon-CJv2JJRu.js +0 -1
- package/dist/assets/i18n--Ef6MgVx.js +0 -9
- package/dist/assets/index-DwHOkKSZ.css +0 -2
- package/dist/assets/index-sUYxMYg4.js +0 -2
- package/dist/assets/infrastructure-1EBA2wrr.js +0 -3
- package/dist/assets/mermaid-GHXKKRXX-B608OHDp.js +0 -1
- package/dist/assets/metadata-admin-CaWsYPuu.js +0 -25
- package/dist/assets/plugin-calendar-lTyyzuqa.js +0 -1
- package/dist/assets/plugin-charts-CXDDqZeY.js +0 -7
- package/dist/assets/plugin-chatbot-CGYrsTXi.js +0 -120
- package/dist/assets/plugin-dashboard-oozFEUjN.js +0 -6
- package/dist/assets/plugin-form-Hw4-ReuX.js +0 -1
- package/dist/assets/plugin-gantt-DIrw5DOt.js +0 -102
- package/dist/assets/plugin-grid-QB7O_mff.js +0 -8
- package/dist/assets/plugin-kanban-C3U_tMs4.js +0 -1
- package/dist/assets/plugin-map-Lz3zZGqA.js +0 -1
- package/dist/assets/plugin-report-CMTOJSLw.js +0 -59
- package/dist/assets/plugin-timeline-CKcNCEwi.js +0 -1
- package/dist/assets/plugin-tree-BLG1qg4e.js +0 -1
- package/dist/assets/plugin-view-CwV64XEY.js +0 -1
- package/dist/assets/plugins-views-CoEgR96I.js +0 -4
- package/dist/assets/src-1qbKZhoo.js +0 -1
- package/dist/assets/src-DXuM24AK.js +0 -18
- package/dist/assets/ui-components-CHaxvtjc.js +0 -72
- package/dist/assets/ui-layout-BLgfeXIq.js +0 -1
- package/dist/assets/useOpenRecordList-C75NAaDm.js +0 -1
- package/dist/assets/vendor-objectstack-BTM1m7k5.js +0 -104
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BKSb6vFP.js";import{p as s}from"./infrastructure-
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BKSb6vFP.js";import{p as s}from"./infrastructure-C6pQBkbt.js";import{M as c}from"./framework-brxTxzwx.js";import{Ec as l,Ho as u,Ii as d,Uc as f,fr as p,io as m,ls as h,mn as g,or as _,sr as v,tc as y}from"./ui-components-D1psd5qA.js";import"./MetadataProvider-BnfG1pyl.js";import{n as b}from"./ui-layout-UgL2qgLW.js";import{r as x}from"./appRoute-C7XNGt8B.js";var S=t({SearchResultsPage:()=>O}),C=e(o(),1),w=a();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:h,dashboard:m,page:u,report:y},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}=f(),{appName:t}=i(),[a,o]=r(),[u,m]=(0,C.useState)(a.get(`q`)||``),{apps:y}=c(),S=y||[],O=x(S,t)||S[0],k=`/apps/${t}`,{user:A,activeOrganization:j}=s(),M=(0,C.useMemo)(()=>{if(!O)return[];let e=T(O.navigation||[]),t={currentUserId:A?.id??null,currentOrgId:j?.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]),N=(0,C.useMemo)(()=>{if(!u.trim())return M;let e=u.toLowerCase();return M.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[M,u]),P=e=>{m(e),o(e?{q:e}:{})},F=(0,C.useMemo)(()=>{let e={};for(let t of N)(e[t.type]||=[]).push(t);return e},[N]);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)(n,{to:k,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,w.jsx)(l,{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)(d,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,w.jsx)(g,{id:`search-results-input`,value:u,onChange:e=>P(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(N.length===1?`search.resultsCount`:`search.resultsCountPlural`,{count:N.length,query:u}):e(`search.itemsAvailable`,{count:M.length})}),N.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,w.jsx)(d,{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(F).map(([t,r])=>{let i=E[t]||h,a=`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)(i,{className:`h-4 w-4`}),e(a),(0,w.jsx)(p,{variant:`secondary`,className:`ml-1 text-xs`,children:r.length})]}),(0,w.jsx)(`div`,{className:`grid gap-2`,children:r.map(t=>{let r=E[t.type]||h,i=`search.badge${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}`;return(0,w.jsx)(n,{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)(_,{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)(r,{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)(p,{variant:`outline`,className:`text-xs shrink-0`,children:e(i)})]})})},t.id)})})]},t)})})]})}export{S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,r as n,y as r}from"./vendor-react-BKSb6vFP.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,r as n,y as r}from"./vendor-react-BKSb6vFP.js";import{Gt as i,Ni as a,cr as o,fr as s,lr as c,or as l,sr as u,ur as d}from"./ui-components-D1psd5qA.js";import{o as f,r as p,t as m}from"./types-CtGENai_.js";var h=e(r(),1),g=n();function _(){let e=t(),[n,r]=(0,h.useState)(null),[_,v]=(0,h.useState)(null);(0,h.useEffect)(()=>{p().then(e=>r(e.manifests??[])).catch(e=>v(e?.message??`Failed to load settings`))},[]);let y=(0,h.useMemo)(()=>{if(!n)return null;let e=new Map;for(let t of[...n].sort((e,t)=>(e.order??999)-(t.order??999))){let n=t.category??`Other`,r=e.get(n)??[];r.push(t),e.set(n,r)}return e},[n]);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)(a,{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)(l,{children:(0,g.jsx)(u,{className:`py-8 text-center text-sm text-destructive`,children:_})}):null,n?n.length===0?(0,g.jsx)(l,{children:(0,g.jsx)(u,{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)(l,{className:`cursor-pointer hover:border-primary/50 hover:shadow-sm transition-all`,onClick:()=>e(`/system/settings/${t.namespace}`),children:[(0,g.jsxs)(c,{className:`pb-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsx)(t.icon?f(t.icon):a,{className:`h-6 w-6 text-muted-foreground`}),t.beta?(0,g.jsx)(s,{variant:`secondary`,className:`text-[10px]`,children:`Beta`}):null]}),(0,g.jsx)(d,{className:`text-base mt-2`,children:m(t.label)}),t.description?(0,g.jsx)(o,{className:`text-xs`,children:t.description}):null]}),(0,g.jsx)(u,{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)(i,{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)(i,{className:`h-32 w-full`},t))})]})]})}export{_ as SettingsHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BKSb6vFP.js";import{$t as a,Ct as o,Ec as s,Er as c,Ga as l,Hi as u,Qt as d,Uc as f,Us as p,Ut as m,Wa as h,Xt as g,Zt as _,ar as v,en as y,fn as b,ft as x,gn as S,gr as C,hr as w,ir as T,mr as E,on as D,rr as O,sn as k,tn as A,uo as j,ur as M,wt as N}from"./ui-components-CHaxvtjc.js";import{r as P}from"./vendor-ui-utils-D-WJ115h.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-C7NHW0h6.js";var B=e(i(),1),V=r();function H({reason:e,className:t}){return(0,V.jsxs)(M,{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)(h,{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)(M,{variant:`outline`,className:`text-blue-700 border-blue-300 text-[10px]`,children:[`Inherited from `,a(r.scope)]}):i?(0,V.jsxs)(M,{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)(S,{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)(M,{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:s,locked:l,saving:u,labels:f}=e,m=(0,B.useId)(),h=!!(l||u),v=z(t.label),T=t.key&&f?f.fieldLabel(t.key,v):v,M=t.key&&f?f.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&f?f.groupTitle(t.id,v):v,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)(g,{className:`mt-3`})]})}if(t.type===`info_banner`)return(0,V.jsxs)(E,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(j,{className:`h-4 w-4`}),(0,V.jsx)(C,{children:v}),t.bannerText?(0,V.jsx)(w,{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:v}),t.description?(0,V.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description}):null]}),(0,V.jsx)(p,{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:T,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,v):v;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)(c,{size:`sm`,variant:`secondary`,onClick:s,disabled:u,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:T,labels:f}),e,(0,V.jsx)(G,{description:M})]}),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)(b,{id:m,type:t.type===`email`?`email`:t.type===`url`?`url`:`text`,value:r??``,minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,disabled:h,onChange:e=>i(e.target.value)}));case`password`:return P((0,V.jsx)(b,{id:m,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:h,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(x,{id:m,rows:t.rows??4,value:r??``,minLength:t.minLength,maxLength:t.maxLength,disabled:h,onChange:e=>i(e.target.value)}));case`number`:return P((0,V.jsx)(b,{id:m,type:`number`,value:r,min:t.min,max:t.max,step:t.step,disabled:h,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:T,labels:f}),(0,V.jsx)(G,{description:M})]}),(0,V.jsx)(o,{id:m,checked:!!r,disabled:h,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(_,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:h,children:[(0,V.jsx)(y,{id:m,children:(0,V.jsx)(A,{placeholder:`Select…`})}),(0,V.jsx)(d,{children:t.options?.map(e=>(0,V.jsx)(a,{value:String(e.value),children:F(e)},String(e.value)))})]}));case`radio`:return P((0,V.jsx)(D,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:h,children:t.options?.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(k,{value:String(e.value),id:`${m}-${e.value}`}),(0,V.jsx)(S,{htmlFor:`${m}-${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:h,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)(N,{value:[Number(r??t.min??0)],min:t.min??0,max:t.max??100,step:t.step??1,disabled:h,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)(b,{id:m,type:`color`,value:r??`#000000`,disabled:h,onChange:e=>i(e.target.value),className:`w-16 h-9 p-1`}),(0,V.jsx)(b,{value:r??``,disabled:h,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(x,{id:m,rows:t.rows??6,className:`font-mono text-xs`,value:typeof r==`string`?r:JSON.stringify(r??null,null,2),disabled:h,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}=f();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(),r=t(),i=e.namespace??``,[a,o]=(0,B.useState)(null),[d,f]=(0,B.useState)(!0),[p,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),[y,b]=(0,B.useState)({}),x=(0,B.useCallback)(async()=>{f(!0),_(null);try{let e=await L(i);o(e),b({})}catch(e){_(e?.message??`Failed to load settings`)}finally{f(!1)}},[i]);(0,B.useEffect)(()=>{i&&x()},[i,x]);let S=(0,B.useMemo)(()=>{let e={};if(!a)return e;for(let[t,n]of Object.entries(a.values))e[t]=n.value;return{...e,...y}},[a,y]),C=(0,B.useMemo)(()=>Object.keys(y),[y]),w=J(i);if(!i)return(0,V.jsx)(`div`,{className:`p-6 text-muted-foreground`,children:`No namespace selected.`});if(d)return(0,V.jsxs)(`div`,{className:`p-6 space-y-3 max-w-3xl`,children:[(0,V.jsx)(m,{className:`h-8 w-1/3`}),(0,V.jsx)(m,{className:`h-4 w-2/3`}),(0,V.jsx)(m,{className:`h-32 w-full`}),(0,V.jsx)(m,{className:`h-32 w-full`})]});if(g)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:()=>r(-1),children:[(0,V.jsx)(s,{className:`h-4 w-4 mr-1`}),` Back`]}),(0,V.jsx)(T,{className:`mt-3`,children:(0,V.jsx)(v,{className:`py-8 text-center text-sm text-destructive`,children:g})})]});if(!a)return null;let{manifest:E,values:D}=a,O=E.icon?R(E.icon):null,k=w.title(z(E.label)),A=w.description(E.description),j=async()=>{if(C.length!==0){h(!0);try{let e=await F(i,y);o({...a,values:{...D,...e.values}}),b({}),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{h(!1)}}},N=async e=>{h(!0);try{let t=await I(i,e,y);t.ok?P.success(t.message??`Action succeeded`):P.error(t.message??`Action failed`)}catch(e){P.error(e?.message??`Action failed`)}finally{h(!1)}};return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl mx-auto pb-32`,children:[(0,V.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:()=>r(`/system/settings`),children:[(0,V.jsx)(s,{className:`h-4 w-4 mr-1`}),` All settings`]}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-3`,children:[O?(0,V.jsx)(O,{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}),E.beta?(0,V.jsx)(M,{variant:`secondary`,children:`Beta`}):null]}),A?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:A}):null]})]}),E.helpText?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-4 whitespace-pre-wrap`,children:E.helpText}):null,(0,V.jsx)(`div`,{className:`mt-6 divide-y`,children:E.specifiers.filter(e=>Y(e.visible,S)).map((e,t)=>{let n=e.key,r=n?D[n]:void 0;return(0,V.jsx)(K,{spec:e,resolved:r,value:n?n in y?y[n]:r?.value:void 0,onChange:e=>n&&b(t=>({...t,[n]:e})),onAction:e.type===`action_button`?()=>N(e.id??n??`test`):void 0,locked:r?.locked,saving:p,labels:w},(n??`_layout_${t}`)+t)})}),C.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:[C.length,` unsaved change`,C.length>1?`s`:``]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:()=>b({}),disabled:p,children:[(0,V.jsx)(u,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(c,{onClick:j,disabled:p,children:[p?(0,V.jsx)(l,{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{f as t,m as n,r,y as i}from"./vendor-react-BKSb6vFP.js";import{$t as a,Ec as o,Et as s,Gt as c,Ka as l,Or as u,Qt as d,Tt as f,Uc as p,Wi as m,Ws as h,_r as g,ar as _,cn as v,en as y,fo as b,fr as x,gr as S,ln as C,mn as w,mt as T,nn as E,or as D,qa as O,rn as k,sr as A,tn as j,vn as M,vr as N}from"./ui-components-D1psd5qA.js";import{r as P}from"./vendor-ui-utils-D-WJ115h.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-CtGENai_.js";var B=e(i(),1),V=r();function H({reason:e,className:t}){return(0,V.jsxs)(x,{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)(l,{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)(x,{variant:`outline`,className:`text-blue-700 border-blue-300 text-[10px]`,children:[`Inherited from `,a(r.scope)]}):i?(0,V.jsxs)(x,{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)(M,{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)(x,{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:o,locked:c,saving:l,labels:p}=e,m=(0,B.useId)(),x=!!(c||l),D=z(t.label),O=t.key&&p?p.fieldLabel(t.key,D):D,A=t.key&&p?p.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&p?p.groupTitle(t.id,D):D,n=t.id&&p?p.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)(d,{className:`mt-3`})]})}if(t.type===`info_banner`)return(0,V.jsxs)(S,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(b,{className:`h-4 w-4`}),(0,V.jsx)(N,{children:D}),t.bannerText?(0,V.jsx)(g,{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:D}),t.description?(0,V.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description}):null]}),(0,V.jsx)(h,{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:O,labels:p}),(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=p?p.actionLabel(n,D):D;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)(u,{size:`sm`,variant:`secondary`,onClick:o,disabled:l,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:O,labels:p}),e,(0,V.jsx)(G,{description:A})]}),F=e=>{let n=typeof e.label==`string`?e.label:e.label?.defaultValue??String(e.value);return!t.key||!p?n:p.optionLabel(t.key,String(e.value),n)};switch(t.type){case`text`:case`email`:case`url`:case`phone`:return P((0,V.jsx)(w,{id:m,type:t.type===`email`?`email`:t.type===`url`?`url`:`text`,value:r??``,minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,disabled:x,onChange:e=>i(e.target.value)}));case`password`:return P((0,V.jsx)(w,{id:m,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:x,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(T,{id:m,rows:t.rows??4,value:r??``,minLength:t.minLength,maxLength:t.maxLength,disabled:x,onChange:e=>i(e.target.value)}));case`number`:return P((0,V.jsx)(w,{id:m,type:`number`,value:r,min:t.min,max:t.max,step:t.step,disabled:x,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:O,labels:p}),(0,V.jsx)(G,{description:A})]}),(0,V.jsx)(f,{id:m,checked:!!r,disabled:x,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(a,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:x,children:[(0,V.jsx)(E,{id:m,children:(0,V.jsx)(k,{placeholder:`Select…`})}),(0,V.jsx)(y,{children:t.options?.map(e=>(0,V.jsx)(j,{value:String(e.value),children:F(e)},String(e.value)))})]}));case`radio`:return P((0,V.jsx)(v,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:x,children:t.options?.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(C,{value:String(e.value),id:`${m}-${e.value}`}),(0,V.jsx)(M,{htmlFor:`${m}-${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)(_,{checked:e.map(String).includes(n),disabled:x,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)(s,{value:[Number(r??t.min??0)],min:t.min??0,max:t.max??100,step:t.step??1,disabled:x,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)(w,{id:m,type:`color`,value:r??`#000000`,disabled:x,onChange:e=>i(e.target.value),className:`w-16 h-9 p-1`}),(0,V.jsx)(w,{value:r??``,disabled:x,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(T,{id:m,rows:t.rows??6,className:`font-mono text-xs`,value:typeof r==`string`?r:JSON.stringify(r??null,null,2),disabled:x,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}=p();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(),r=t(),i=e.namespace??``,[a,s]=(0,B.useState)(null),[l,d]=(0,B.useState)(!0),[f,p]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)({}),y=(0,B.useCallback)(async()=>{d(!0),g(null);try{let e=await L(i);s(e),v({})}catch(e){g(e?.message??`Failed to load settings`)}finally{d(!1)}},[i]);(0,B.useEffect)(()=>{i&&y()},[i,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,_]),S=(0,B.useMemo)(()=>Object.keys(_),[_]),C=J(i);if(!i)return(0,V.jsx)(`div`,{className:`p-6 text-muted-foreground`,children:`No namespace selected.`});if(l)return(0,V.jsxs)(`div`,{className:`p-6 space-y-3 max-w-3xl`,children:[(0,V.jsx)(c,{className:`h-8 w-1/3`}),(0,V.jsx)(c,{className:`h-4 w-2/3`}),(0,V.jsx)(c,{className:`h-32 w-full`}),(0,V.jsx)(c,{className:`h-32 w-full`})]});if(h)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:()=>r(-1),children:[(0,V.jsx)(o,{className:`h-4 w-4 mr-1`}),` Back`]}),(0,V.jsx)(D,{className:`mt-3`,children:(0,V.jsx)(A,{className:`py-8 text-center text-sm text-destructive`,children:h})})]});if(!a)return null;let{manifest:w,values:T}=a,E=w.icon?R(w.icon):null,k=C.title(z(w.label)),j=C.description(w.description),M=async()=>{if(S.length!==0){p(!0);try{let e=await F(i,_);s({...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{p(!1)}}},N=async e=>{p(!0);try{let t=await I(i,e,_);t.ok?P.success(t.message??`Action succeeded`):P.error(t.message??`Action failed`)}catch(e){P.error(e?.message??`Action failed`)}finally{p(!1)}};return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl mx-auto pb-32`,children:[(0,V.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:()=>r(`/system/settings`),children:[(0,V.jsx)(o,{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:k}),w.beta?(0,V.jsx)(x,{variant:`secondary`,children:`Beta`}):null]}),j?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:j}):null]})]}),w.helpText?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-4 whitespace-pre-wrap`,children:w.helpText}):null,(0,V.jsx)(`div`,{className:`mt-6 divide-y`,children:w.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`?()=>N(e.id??n??`test`):void 0,locked:r?.locked,saving:f,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)(u,{variant:`ghost`,size:`sm`,onClick:()=>v({}),disabled:f,children:[(0,V.jsx)(m,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(u,{onClick:M,disabled:f,children:[f?(0,V.jsx)(O,{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{f as t,m as n,r,y as i}from"./vendor-react-BKSb6vFP.js";import{f as a}from"./infrastructure-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BKSb6vFP.js";import{f as a}from"./infrastructure-C6pQBkbt.js";import{j as o}from"./framework-brxTxzwx.js";import{Di as s,Li as c,Ni as l,Ur as u,Wr as d,ac as f,co as p,cr as m,fc as h,fr as g,lr as _,ls as v,or as y,pi as b,qa as x,ro as S,si as C,sr as w,uc as T,ur as E}from"./ui-components-D1psd5qA.js";import"./src-CRFYUj2Z.js";var D=e(i(),1),O=r();function k(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,k=o(),A=a(),[j,M]=(0,D.useState)({users:null,orgs:null,positions: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_position`).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,positions: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:S,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:v,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:T,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:u,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:f,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Positions`,description:`Configure positions and access levels`,icon:s,href:`${i}/system/positions`,countLabel:`positions`,count:j.positions},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:p,href:`${i}/system/permissions`,countLabel:`permissions`,count:j.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:c,href:`${i}/system/audit-log`,countLabel:`entries`,count:j.auditLogs},{title:`AI Approvals`,description:`Review actions AI agents propose before they execute`,icon:h,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:b,href:`${i}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:l,href:`${i}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:C,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:d,href:`${i}/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, positions, 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)(x,{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)(y,{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)(_,{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)(E,{className:`text-base`,children:t.title}),(0,O.jsx)(m,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(w,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(g,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};
|