@objectstack/console 14.3.0 → 14.6.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.
Files changed (111) hide show
  1. package/dist/.objectui-sha +1 -1
  2. package/dist/assets/{AdapterProvider-BdI1AL8R.js → AdapterProvider-cnK1q1oP.js} +1 -1
  3. package/dist/assets/{AiPendingActionsPage-C9rOGWO9.js → AiPendingActionsPage-mX_Izb42.js} +1 -1
  4. package/dist/assets/{ApiConsolePage-CTk6_qVK.js → ApiConsolePage-fUV9bmEg.js} +1 -1
  5. package/dist/assets/{AppDocsIndex-BL_J__HY.js → AppDocsIndex-Bzh_4ehZ.js} +1 -1
  6. package/dist/assets/{AppManagementPage-Co5xg-gQ.js → AppManagementPage-BRmzB5eR.js} +1 -1
  7. package/dist/assets/ApprovalsInboxPage-DKgnvZ-2.js +1 -0
  8. package/dist/assets/AuditLogPage-REsiCTKG.js +1 -0
  9. package/dist/assets/{ComponentNavView-2bXBqHvo.js → ComponentNavView-B4EBSM-o.js} +1 -1
  10. package/dist/assets/ConsoleFloatingChatbot-BW-g5YTu.js +1 -0
  11. package/dist/assets/{CreateViewDialog-BQ1-ZWYN.js → CreateViewDialog-BhCe1ZPc.js} +1 -1
  12. package/dist/assets/{DashboardView-Cns3m8MX.js → DashboardView-CUXRWKPH.js} +1 -1
  13. package/dist/assets/{DeveloperHubPage-xHzPIDex.js → DeveloperHubPage-B6pD0HUk.js} +1 -1
  14. package/dist/assets/{ExpressionProvider-BdMK_o7f.js → ExpressionProvider-D94jBDAc.js} +1 -1
  15. package/dist/assets/FlowRunsPage-C4Setjuz.js +1 -0
  16. package/dist/assets/{IntegrationsPage-B8IBLh_r.js → IntegrationsPage-EOVS24Ho.js} +2 -2
  17. package/dist/assets/{InterfaceListPage-DAkJEFCf.js → InterfaceListPage-BFlwb0U7.js} +1 -1
  18. package/dist/assets/{ManagedByBadge-C8RoPUEX.js → ManagedByBadge-Dpgfl255.js} +1 -1
  19. package/dist/assets/{MarketplaceAccessDenied-D3JunScQ.js → MarketplaceAccessDenied-DuO_FDoh.js} +1 -1
  20. package/dist/assets/{MarketplaceInstalledPage-IjVxon4M.js → MarketplaceInstalledPage-4MFyBXDW.js} +1 -1
  21. package/dist/assets/MarketplacePackagePage-BDeaeKiT.js +4 -0
  22. package/dist/assets/{MarketplacePage-aoYsZs4L.js → MarketplacePage-DXMWpCHb.js} +1 -1
  23. package/dist/assets/{MetadataInspector-BD4Mhmpt.js → MetadataInspector-YoFTAkMA.js} +1 -1
  24. package/dist/assets/MetadataProvider-C8ABa_gQ.js +1 -0
  25. package/dist/assets/ObjectDataPage-BSvqdmym.js +1 -0
  26. package/dist/assets/PageView-Dlpz3HgH.js +1 -0
  27. package/dist/assets/ProfilePage-2H6e2j4o.js +1 -0
  28. package/dist/assets/{PublicFormsPage-CkKQzpw_.js → PublicFormsPage-DXYBK10A.js} +1 -1
  29. package/dist/assets/RecordDetailView-CEdkDgV8.js +9 -0
  30. package/dist/assets/{RecordFormPage-DPml60ze.js → RecordFormPage-Bj3lDGqC.js} +1 -1
  31. package/dist/assets/ReportDefaultInspector-BNtsE5kW.js +3 -0
  32. package/dist/assets/ReportView-COxfnluU.js +2 -0
  33. package/dist/assets/{SearchResultsPage-CiSIs_M4.js → SearchResultsPage-B3ShD29d.js} +1 -1
  34. package/dist/assets/{SettingsHub-PlVT_0zU.js → SettingsHub-DgLunUQU.js} +1 -1
  35. package/dist/assets/{SettingsView-PA2_5adN.js → SettingsView-DFfL8vn4.js} +1 -1
  36. package/dist/assets/{SystemHubPage-DN6WDMNI.js → SystemHubPage-A9Z1FplZ.js} +1 -1
  37. package/dist/assets/data-adapter-CAqKExcJ.js +7 -0
  38. package/dist/assets/{framework-Itfj9AWQ.js → framework-CWU64Lvg.js} +3 -3
  39. package/dist/assets/getIcon-p-vXfFiY.js +1 -0
  40. package/dist/assets/{highlighted-body-OFNGDK62-DyDg64aM.js → highlighted-body-OFNGDK62-CcYD5yKj.js} +1 -1
  41. package/dist/assets/i18n-DGsfMUMn.js +9 -0
  42. package/dist/assets/index-BhMd7RVY.js +2 -0
  43. package/dist/assets/index-Dt-GIgSI.css +2 -0
  44. package/dist/assets/infrastructure-DexdbqHf.js +3 -0
  45. package/dist/assets/marketplaceApi-1mMRJWDq.js +1 -0
  46. package/dist/assets/mermaid-GHXKKRXX-DWvjDOK-.js +1 -0
  47. package/dist/assets/metadata-admin-R79BWSDJ.js +23 -0
  48. package/dist/assets/plugin-calendar-GOvhSPjZ.js +1 -0
  49. package/dist/assets/plugin-charts-DPNohuuV.js +7 -0
  50. package/dist/assets/plugin-chatbot-BT49v2CR.js +120 -0
  51. package/dist/assets/plugin-dashboard-N2kUovsm.js +6 -0
  52. package/dist/assets/plugin-form-QFhBvb96.js +1 -0
  53. package/dist/assets/plugin-gantt-2HGBxhYq.js +93 -0
  54. package/dist/assets/plugin-grid-qkHiovZ2.js +8 -0
  55. package/dist/assets/plugin-kanban-D8kWLfql.js +1 -0
  56. package/dist/assets/plugin-map-CXsqUoPv.js +1 -0
  57. package/dist/assets/{plugin-markdown-ByE3Dezt.js → plugin-markdown-CFO9Lenx.js} +1 -1
  58. package/dist/assets/plugin-report-CH4uZunJ.js +59 -0
  59. package/dist/assets/plugin-timeline-3MSv2v9S.js +1 -0
  60. package/dist/assets/{plugin-tree-D7mdTkuW.js → plugin-tree-_3HdWuAy.js} +1 -1
  61. package/dist/assets/plugin-view-CTBpbehM.js +1 -0
  62. package/dist/assets/plugins-views-BxKprmRN.js +4 -0
  63. package/dist/assets/{skeletons-Ch9F6pA8.js → skeletons-ySdMMgAT.js} +1 -1
  64. package/dist/assets/src-TG89vY9R.js +18 -0
  65. package/dist/assets/{src-w44Q32YY.js → src-X8yirhNO.js} +1 -1
  66. package/dist/assets/surfaceAgent-qmokOosD.js +1 -0
  67. package/dist/assets/{types-GmZjwWOe.js → types-B99y2QyO.js} +1 -1
  68. package/dist/assets/{ui-components-DTwfkSDm.js → ui-components-DHIW7RSX.js} +9 -9
  69. package/dist/assets/{ui-layout-BHkbFI8f.js → ui-layout-DeDkO2oG.js} +1 -1
  70. package/dist/assets/useMetadata-DemWIEqg.js +1 -0
  71. package/dist/assets/{useRecordApprovals-Bo4WTft1.js → useRecordApprovals-R3Q7Bt7f.js} +1 -1
  72. package/dist/assets/vendor-objectstack-6Mgxtaa1.js +96 -0
  73. package/dist/index.html +34 -6
  74. package/package.json +1 -1
  75. package/dist/assets/ApprovalsInboxPage-DkfJVIDO.js +0 -1
  76. package/dist/assets/AuditLogPage-Ctj0habt.js +0 -1
  77. package/dist/assets/ConsoleFloatingChatbot-C_zzIjTL.js +0 -1
  78. package/dist/assets/FlowRunsPage-v43ayfID.js +0 -1
  79. package/dist/assets/MarketplacePackagePage-BivOR4dD.js +0 -4
  80. package/dist/assets/MetadataProvider-C9mhBo6s.js +0 -1
  81. package/dist/assets/ObjectDataPage-C1AX0mJW.js +0 -1
  82. package/dist/assets/PageView-CAAHjJzX.js +0 -1
  83. package/dist/assets/ProfilePage-tQyqenRR.js +0 -1
  84. package/dist/assets/RecordDetailView-DcyCqWcp.js +0 -9
  85. package/dist/assets/ReportDefaultInspector-De2iFQ0s.js +0 -11
  86. package/dist/assets/ReportView-BF5_XOtk.js +0 -2
  87. package/dist/assets/conversationLanguage-b5go1PfT.js +0 -1
  88. package/dist/assets/data-adapter-CbYJeapt.js +0 -7
  89. package/dist/assets/getIcon-DjDksPei.js +0 -1
  90. package/dist/assets/index-C31fE0Ro.js +0 -2
  91. package/dist/assets/index-N4ZfDXur.css +0 -2
  92. package/dist/assets/infrastructure-ASGyCRMg.js +0 -3
  93. package/dist/assets/marketplaceApi-N63OOXW-.js +0 -1
  94. package/dist/assets/mermaid-GHXKKRXX-Bdn3wVYM.js +0 -1
  95. package/dist/assets/metadata-admin-Chw3a2T4.js +0 -23
  96. package/dist/assets/plugin-calendar-C7XgGNhj.js +0 -1
  97. package/dist/assets/plugin-charts-DZcrIrvB.js +0 -7
  98. package/dist/assets/plugin-chatbot-D0Od_WLT.js +0 -120
  99. package/dist/assets/plugin-dashboard-CGXhP3SP.js +0 -6
  100. package/dist/assets/plugin-form-BxGl_G-P.js +0 -1
  101. package/dist/assets/plugin-gantt-DIXK_GFE.js +0 -93
  102. package/dist/assets/plugin-grid-BusTOlSB.js +0 -8
  103. package/dist/assets/plugin-kanban-BORORRbu.js +0 -1
  104. package/dist/assets/plugin-map-DhKLo0DD.js +0 -1
  105. package/dist/assets/plugin-report-CJmiocGk.js +0 -59
  106. package/dist/assets/plugin-timeline-B5L8EK0C.js +0 -1
  107. package/dist/assets/plugin-view-CMNOvn0A.js +0 -1
  108. package/dist/assets/plugins-views-BmubW-ty.js +0 -4
  109. package/dist/assets/src-DrSomF2I.js +0 -16
  110. package/dist/assets/useMetadata-DSuQLgo1.js +0 -1
  111. package/dist/assets/vendor-objectstack-BlgvvNrN.js +0 -108
@@ -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-BGDDiZfJ.js";import{l as a}from"./framework-Itfj9AWQ.js";import{$n as o,Ba as s,Gt as c,Jt as l,Kt as u,Li as d,Qn as f,Rt as p,Sc as m,Xt as h,Yt as g,ao as _,ar as v,dn as y,dr as b,er as x,lr as S,nn as C,qt as w,sn as T,st as E,tn as D,ur as O,vt as k,xr as A,yt as j,za as M,zs as N}from"./ui-components-DTwfkSDm.js";import{r as P}from"./vendor-ui-utils-BzQBRdq3.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-GmZjwWOe.js";var B=e(i(),1),V=r();function H({reason:e,className:t}){return(0,V.jsxs)(v,{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)(M,{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)(v,{variant:`outline`,className:`text-blue-700 border-blue-300 text-[10px]`,children:[`Inherited from `,a(r.scope)]}):i?(0,V.jsxs)(v,{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)(y,{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)(v,{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:s,labels:d}=e,p=(0,B.useId)(),m=!!(o||s),v=z(t.label),x=t.key&&d?d.fieldLabel(t.key,v):v,M=t.key&&d?d.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&d?d.groupTitle(t.id,v):v,n=t.id&&d?d.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)(S,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(_,{className:`h-4 w-4`}),(0,V.jsx)(b,{children:v}),t.bannerText?(0,V.jsx)(O,{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)(N,{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:x,labels:d}),(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=d?d.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)(A,{size:`sm`,variant:`secondary`,onClick:a,disabled:s,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:x,labels:d}),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||!d?n:d.optionLabel(t.key,String(e.value),n)};switch(t.type){case`text`:case`email`:case`url`:case`phone`:return P((0,V.jsx)(T,{id:p,type:t.type===`email`?`email`:t.type===`url`?`url`:`text`,value:r??``,minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,disabled:m,onChange:e=>i(e.target.value)}));case`password`:return P((0,V.jsx)(T,{id:p,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:m,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(E,{id:p,rows:t.rows??4,value:r??``,minLength:t.minLength,maxLength:t.maxLength,disabled:m,onChange:e=>i(e.target.value)}));case`number`:return P((0,V.jsx)(T,{id:p,type:`number`,value:r,min:t.min,max:t.max,step:t.step,disabled:m,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:x,labels:d}),(0,V.jsx)(G,{description:M})]}),(0,V.jsx)(k,{id:p,checked:!!r,disabled:m,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(u,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:m,children:[(0,V.jsx)(g,{id:p,children:(0,V.jsx)(h,{placeholder:`Select…`})}),(0,V.jsx)(w,{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)(D,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:m,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:`${p}-${e.value}`}),(0,V.jsx)(y,{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)(f,{checked:e.map(String).includes(n),disabled:m,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)(j,{value:[Number(r??t.min??0)],min:t.min??0,max:t.max??100,step:t.step??1,disabled:m,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)(T,{id:p,type:`color`,value:r??`#000000`,disabled:m,onChange:e=>i(e.target.value),className:`w-16 h-9 p-1`}),(0,V.jsx)(T,{value:r??``,disabled:m,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(E,{id:p,rows:t.rows??6,className:`font-mono text-xs`,value:typeof r==`string`?r:JSON.stringify(r??null,null,2),disabled:m,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(),r=t(),i=e.namespace??``,[a,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(!0),[f,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),[y,b]=(0,B.useState)({}),S=(0,B.useCallback)(async()=>{u(!0),_(null);try{let e=await L(i);c(e),b({})}catch(e){_(e?.message??`Failed to load settings`)}finally{u(!1)}},[i]);(0,B.useEffect)(()=>{i&&S()},[i,S]);let C=(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]),w=(0,B.useMemo)(()=>Object.keys(y),[y]),T=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)(p,{className:`h-8 w-1/3`}),(0,V.jsx)(p,{className:`h-4 w-2/3`}),(0,V.jsx)(p,{className:`h-32 w-full`}),(0,V.jsx)(p,{className:`h-32 w-full`})]});if(g)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(A,{variant:`ghost`,size:`sm`,onClick:()=>r(-1),children:[(0,V.jsx)(m,{className:`h-4 w-4 mr-1`}),` Back`]}),(0,V.jsx)(o,{className:`mt-3`,children:(0,V.jsx)(x,{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=T.title(z(E.label)),j=T.description(E.description),M=async()=>{if(w.length!==0){h(!0);try{let e=await F(i,y);c({...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)(A,{variant:`ghost`,size:`sm`,onClick:()=>r(`/system/settings`),children:[(0,V.jsx)(m,{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)(v,{variant:`secondary`,children:`Beta`}):null]}),j?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:j}):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,C)).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:f,labels:T},(n??`_layout_${t}`)+t)})}),w.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:[w.length,` unsaved change`,w.length>1?`s`:``]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(A,{variant:`ghost`,size:`sm`,onClick:()=>b({}),disabled:f,children:[(0,V.jsx)(d,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(A,{onClick:M,disabled:f,children:[f?(0,V.jsx)(s,{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-BGDDiZfJ.js";import{l as a}from"./framework-CWU64Lvg.js";import{Bs as o,Bt as s,Cc as c,Cr as l,Ha as u,Jt as d,Qt as f,Va as p,Xt as m,Yt as h,Zt as g,bt as _,dr as v,er as y,fr as b,in as x,ln as S,lt as C,nr as w,pn as T,pr as E,qt as D,rn as O,so as k,sr as A,tr as j,xt as M,zi as N}from"./ui-components-DHIW7RSX.js";import{r as P}from"./vendor-ui-utils-BzQBRdq3.js";import{a as F,i as I,n as L,o as R,t as z}from"./types-B99y2QyO.js";var B=e(i(),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)(p,{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)(T,{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:s,saving:c,labels:u}=e,p=(0,B.useId)(),w=!!(s||c),A=z(t.label),j=t.key&&u?u.fieldLabel(t.key,A):A,N=t.key&&u?u.fieldHelp(t.key,t.description):t.description;if(t.type===`group`){let e=t.id&&u?u.groupTitle(t.id,A):A,n=t.id&&u?u.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)(v,{variant:t.bannerSeverity===`error`?`destructive`:`default`,className:`my-2`,children:[(0,V.jsx)(k,{className:`h-4 w-4`}),(0,V.jsx)(E,{children:A}),t.bannerText?(0,V.jsx)(b,{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)(o,{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:u}),(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=u?u.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)(l,{size:`sm`,variant:`secondary`,onClick:a,disabled:c,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:u}),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||!u?n:u.optionLabel(t.key,String(e.value),n)};switch(t.type){case`text`:case`email`:case`url`:case`phone`:return P((0,V.jsx)(S,{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)(S,{id:p,type:`password`,autoComplete:`new-password`,placeholder:r?`••••••••`:``,disabled:w,onChange:e=>i(e.target.value)}));case`textarea`:return P((0,V.jsx)(C,{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)(S,{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:u}),(0,V.jsx)(G,{description:N})]}),(0,V.jsx)(_,{id:p,checked:!!r,disabled:w,onCheckedChange:e=>i(e)})]});case`select`:return P((0,V.jsxs)(d,{value:r==null?void 0:String(r),onValueChange:e=>i(e),disabled:w,children:[(0,V.jsx)(g,{id:p,children:(0,V.jsx)(f,{placeholder:`Select…`})}),(0,V.jsx)(h,{children:t.options?.map(e=>(0,V.jsx)(m,{value:String(e.value),children:F(e)},String(e.value)))})]}));case`radio`:return P((0,V.jsx)(O,{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)(x,{value:String(e.value),id:`${p}-${e.value}`}),(0,V.jsx)(T,{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)(y,{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)(S,{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)(S,{value:r??``,disabled:w,onChange:e=>i(e.target.value),className:`flex-1 font-mono text-sm`})]}));case`json`:return P((0,V.jsx)(C,{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(),r=t(),i=e.namespace??``,[a,o]=(0,B.useState)(null),[d,f]=(0,B.useState)(!0),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)({}),y=(0,B.useCallback)(async()=>{f(!0),g(null);try{let e=await L(i);o(e),v({})}catch(e){g(e?.message??`Failed to load settings`)}finally{f(!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,_]),x=(0,B.useMemo)(()=>Object.keys(_),[_]),S=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)(s,{className:`h-8 w-1/3`}),(0,V.jsx)(s,{className:`h-4 w-2/3`}),(0,V.jsx)(s,{className:`h-32 w-full`}),(0,V.jsx)(s,{className:`h-32 w-full`})]});if(h)return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl`,children:[(0,V.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:()=>r(-1),children:[(0,V.jsx)(c,{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(i,_);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(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{m(!1)}};return(0,V.jsxs)(`div`,{className:`p-6 max-w-3xl mx-auto pb-32`,children:[(0,V.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:()=>r(`/system/settings`),children:[(0,V.jsx)(c,{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:p,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)(l,{variant:`ghost`,size:`sm`,onClick:()=>v({}),disabled:p,children:[(0,V.jsx)(N,{className:`h-4 w-4 mr-1`}),` Discard`]}),(0,V.jsxs)(l,{onClick:k,disabled:p,children:[p?(0,V.jsx)(u,{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-BGDDiZfJ.js";import{d as a}from"./infrastructure-ASGyCRMg.js";import{L as o}from"./framework-Itfj9AWQ.js";import{$n as s,Ai as c,Ba as l,Ei as u,Ir as d,Lr as f,Xa as p,ac as m,ar as h,bi as g,ec as _,ei as v,er as y,nr as b,ns as x,oi as S,rr as C,sc as w,to as T,tr as E}from"./ui-components-DTwfkSDm.js";import"./src-DrSomF2I.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:p,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:x,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:m,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:d,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:_,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Positions`,description:`Configure positions and access levels`,icon:g,href:`${i}/system/positions`,countLabel:`positions`,count:j.positions},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:T,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:w,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:S,href:`${i}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:u,href:`${i}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:v,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:f,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)(l,{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)(s,{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)(b,{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)(C,{className:`text-base`,children:t.title}),(0,O.jsx)(E,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(y,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(h,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a}from"./infrastructure-DexdbqHf.js";import{L as o}from"./framework-CWU64Lvg.js";import{Ha as s,Mi as c,Oi as l,Qa as u,Rr as d,Si as f,ar as p,cc as m,ci as h,ir as g,ni as _,nr as v,oc as y,ro as b,rr as x,rs as S,sr as C,tc as w,tr as T,zr as E}from"./ui-components-DHIW7RSX.js";import"./src-TG89vY9R.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:u,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:S,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:y,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:d,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:w,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Positions`,description:`Configure positions and access levels`,icon:f,href:`${i}/system/positions`,countLabel:`positions`,count:j.positions},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:b,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:m,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:h,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:_,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:E,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)(s,{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)(T,{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)(g,{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)(p,{className:`text-base`,children:t.title}),(0,O.jsx)(x,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(v,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(C,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};