@hotmeshio/long-tail 0.7.2 → 0.7.4
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/dashboard/dist/assets/{AdminDashboard-rZDVS2G_.js → AdminDashboard-C9eE1VEp.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-rZDVS2G_.js.map → AdminDashboard-C9eE1VEp.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-CbyyCjCT.js → AgentConfigPage-Ba8QfXM2.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-CbyyCjCT.js.map → AgentConfigPage-Ba8QfXM2.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-DMeHvidT.js → AgentDetailPage-DVmec0CP.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-DMeHvidT.js.map → AgentDetailPage-DVmec0CP.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-C8fKLxh-.js → AgentsPage-DNiCYMh3.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-C8fKLxh-.js.map → AgentsPage-DNiCYMh3.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-CUHcybKU.js → AvailableEscalationsPage-gDIF8ocC.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-CUHcybKU.js.map → AvailableEscalationsPage-gDIF8ocC.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-DGhniNcy.js → BotPicker-3wBcBavT.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DGhniNcy.js.map → BotPicker-3wBcBavT.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-ClfuW4ya.js → CapabilitiesPage-WoPkND2y.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-ClfuW4ya.js.map → CapabilitiesPage-WoPkND2y.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-DnECdKEY.js → CollapsibleSection-Cx99mqNN.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-DnECdKEY.js.map → CollapsibleSection-Cx99mqNN.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-DdZ-jyyc.js → CredentialsPage-DbNaoPbF.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-DdZ-jyyc.js.map → CredentialsPage-DbNaoPbF.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CymxLvY0.js → CronLabel-DLW4_Zg4.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CymxLvY0.js.map → CronLabel-DLW4_Zg4.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-8JHvVWD2.js → CustomDurationPicker-BRUFjkiu.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-8JHvVWD2.js.map → CustomDurationPicker-BRUFjkiu.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-BRZfw_Af.js → ElapsedCell-BtmDQaym.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-BRZfw_Af.js.map → ElapsedCell-BtmDQaym.js.map} +1 -1
- package/dashboard/dist/assets/EscalationSchemaPage-Bm4yBEGN.js +9 -0
- package/dashboard/dist/assets/EscalationSchemaPage-Bm4yBEGN.js.map +1 -0
- package/dashboard/dist/assets/{EscalationsOverview-CiQO3ntf.js → EscalationsOverview-B3xZwTQA.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-CiQO3ntf.js.map → EscalationsOverview-B3xZwTQA.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CLuAbba_.js → EventTable-Bh9FKXLI.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CLuAbba_.js.map → EventTable-Bh9FKXLI.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-BFRi6Nny.js → GraphInvokePage-ov_ANlaE.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-BFRi6Nny.js.map → GraphInvokePage-ov_ANlaE.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-m1pnxilb.js → HomePage-D0DV6izb.js} +2 -2
- package/dashboard/dist/assets/{HomePage-m1pnxilb.js.map → HomePage-D0DV6izb.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-D4Y-M7wN.js → ListToolbar-FpcvqNkN.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-D4Y-M7wN.js.map → ListToolbar-FpcvqNkN.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-mfJpETsW.js → McpOverview-DcuRiAff.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-mfJpETsW.js.map → McpOverview-DcuRiAff.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-Cb99vI7v.js → McpQueryDetailPage-BcYl67KP.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-Cb99vI7v.js.map → McpQueryDetailPage-BcYl67KP.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-CKKOxks0.js → McpQueryPage-C3GDzqZM.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-CKKOxks0.js.map → McpQueryPage-C3GDzqZM.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CyTbHs0J.js → McpRunDetailPage-SzOyhDBW.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CyTbHs0J.js.map → McpRunDetailPage-SzOyhDBW.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-MIwmK-Ky.js → McpRunsPage-BwgB6mRV.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-MIwmK-Ky.js.map → McpRunsPage-BwgB6mRV.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-DPesph0U.js → OperationsPage-BCr21p8I.js} +2 -2
- package/dashboard/dist/assets/{OperationsPage-DPesph0U.js.map → OperationsPage-BCr21p8I.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-K1gzULr7.js → OperatorDashboard-DSXh-yYw.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-K1gzULr7.js.map → OperatorDashboard-DSXh-yYw.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-DBIrY6Vd.js → ProcessDetailPage-iIB1rwEt.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-DBIrY6Vd.js.map → ProcessDetailPage-iIB1rwEt.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-CrLGDCAD.js → ProcessesListPage-BrqWR2zr.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-CrLGDCAD.js.map → ProcessesListPage-BrqWR2zr.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js +11 -0
- package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js.map +1 -0
- package/dashboard/dist/assets/RolesPage-Bzp9FhAl.js +2 -0
- package/dashboard/dist/assets/{RolesPage-B0ZgjB2V.js.map → RolesPage-Bzp9FhAl.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-DA0h41ml.js → RunAsSelector-DXbHRxQs.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-DA0h41ml.js.map → RunAsSelector-DXbHRxQs.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-t5B71hwd.js → StickyPagination-D8XuMSWD.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-t5B71hwd.js.map → StickyPagination-D8XuMSWD.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-CYFnZsYA.js → StreamMessageDetail-D5v95pmz.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-CYFnZsYA.js.map → StreamMessageDetail-D5v95pmz.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CY18gBek.js → SwimlaneTimeline-CUEf2R5R.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CY18gBek.js.map → SwimlaneTimeline-CUEf2R5R.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-B9owzuhV.js → TaskDetailPage-BJvKNwEe.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-B9owzuhV.js.map → TaskDetailPage-BJvKNwEe.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-Dlsu7cWG.js → TasksListPage-CM7BWh_h.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-Dlsu7cWG.js.map → TasksListPage-CM7BWh_h.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-CSzifQXB.js → TimeAgo-D1K7xKq5.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-CSzifQXB.js.map → TimeAgo-D1K7xKq5.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-CIxgN57O.js → TimestampCell-7G0echgP.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-CIxgN57O.js.map → TimestampCell-7G0echgP.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-Bw844EW3.js → ToolTestPanel-LxuJvURK.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-Bw844EW3.js.map → ToolTestPanel-LxuJvURK.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-HuDx2oAW.js → TopicDetailPage-JvAX6rrR.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-HuDx2oAW.js.map → TopicDetailPage-JvAX6rrR.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-CAG0RhAK.js → TopicsPage-tFT2AcTz.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-CAG0RhAK.js.map → TopicsPage-tFT2AcTz.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-CoGYeig8.js → UserName-Djz0nmaZ.js} +2 -2
- package/dashboard/dist/assets/{UserName-CoGYeig8.js.map → UserName-Djz0nmaZ.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-Dhb9EWgI.js → WorkflowExecutionPage-f53hilbI.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-Dhb9EWgI.js.map → WorkflowExecutionPage-f53hilbI.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-bJ6Zebfv.js → WorkflowsDashboard-DM9Xe665.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-bJ6Zebfv.js.map → WorkflowsDashboard-DM9Xe665.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-B8262fVx.js → WorkflowsOverview-CUGSrx9N.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-B8262fVx.js.map → WorkflowsOverview-CUGSrx9N.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DhW3q2cO.js → YamlWorkflowDetailPage-B1_yqxAw.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DhW3q2cO.js.map → YamlWorkflowDetailPage-B1_yqxAw.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-C8hBjSn_.js → YamlWorkflowsPage-NtGvqiu7.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-C8hBjSn_.js.map → YamlWorkflowsPage-NtGvqiu7.js.map} +1 -1
- package/dashboard/dist/assets/{agents-j2YErVp4.js → agents-tML6AjDj.js} +2 -2
- package/dashboard/dist/assets/{agents-j2YErVp4.js.map → agents-tML6AjDj.js.map} +1 -1
- package/dashboard/dist/assets/{bots-CD8Bl5pL.js → bots-Cb0WTwhY.js} +2 -2
- package/dashboard/dist/assets/{bots-CD8Bl5pL.js.map → bots-Cb0WTwhY.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-Dz190EAa.js → capabilities-BGZogsi_.js} +2 -2
- package/dashboard/dist/assets/{capabilities-Dz190EAa.js.map → capabilities-BGZogsi_.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-CkUHGPA3.js → controlplane-B7VJTlZD.js} +2 -2
- package/dashboard/dist/assets/{controlplane-CkUHGPA3.js.map → controlplane-B7VJTlZD.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-BXTwi4J1.js → escalation-Bl-SQV_u.js} +2 -2
- package/dashboard/dist/assets/{escalation-BXTwi4J1.js.map → escalation-Bl-SQV_u.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-GxxwSbDk.js → escalation-columns-BlJOswRx.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-GxxwSbDk.js.map → escalation-columns-BlJOswRx.js.map} +1 -1
- package/dashboard/dist/assets/{index-NfVWOFbF.js → index--WeZDfeN.js} +2 -2
- package/dashboard/dist/assets/{index-NfVWOFbF.js.map → index--WeZDfeN.js.map} +1 -1
- package/dashboard/dist/assets/{index-BK3PVYcd.js → index-0o71lRuY.js} +2 -2
- package/dashboard/dist/assets/{index-BK3PVYcd.js.map → index-0o71lRuY.js.map} +1 -1
- package/dashboard/dist/assets/{index-DGKgXObc.js → index-3A_5CL81.js} +2 -2
- package/dashboard/dist/assets/{index-DGKgXObc.js.map → index-3A_5CL81.js.map} +1 -1
- package/dashboard/dist/assets/{index-DTrcYOM2.js → index-BorpZbZA.js} +2 -2
- package/dashboard/dist/assets/{index-DTrcYOM2.js.map → index-BorpZbZA.js.map} +1 -1
- package/dashboard/dist/assets/{index-BkwsJ-0v.js → index-CBv3UxF2.js} +2 -2
- package/dashboard/dist/assets/{index-BkwsJ-0v.js.map → index-CBv3UxF2.js.map} +1 -1
- package/dashboard/dist/assets/{index-CkL8bpdH.js → index-D0-8byNu.js} +2 -2
- package/dashboard/dist/assets/{index-CkL8bpdH.js.map → index-D0-8byNu.js.map} +1 -1
- package/dashboard/dist/assets/{index-qT7eB_Hk.js → index-DcbEIXit.js} +2 -2
- package/dashboard/dist/assets/{index-qT7eB_Hk.js.map → index-DcbEIXit.js.map} +1 -1
- package/dashboard/dist/assets/{index-YliQ4kW_.js → index-DfDfJivY.js} +2 -2
- package/dashboard/dist/assets/{index-YliQ4kW_.js.map → index-DfDfJivY.js.map} +1 -1
- package/dashboard/dist/assets/{index-D-7W2AHB.js → index-Dgw1KKpq.js} +3 -3
- package/dashboard/dist/assets/{index-D-7W2AHB.js.map → index-Dgw1KKpq.js.map} +1 -1
- package/dashboard/dist/assets/{index-CoGkgm9-.js → index-Il_g7kw5.js} +2 -2
- package/dashboard/dist/assets/{index-CoGkgm9-.js.map → index-Il_g7kw5.js.map} +1 -1
- package/dashboard/dist/assets/{index-CaMVn0kW.js → index-SCrD3l-K.js} +2 -2
- package/dashboard/dist/assets/{index-CaMVn0kW.js.map → index-SCrD3l-K.js.map} +1 -1
- package/dashboard/dist/assets/{index-n-lZY5S6.js → index-TiKh2Ctj.js} +2 -2
- package/dashboard/dist/assets/{index-n-lZY5S6.js.map → index-TiKh2Ctj.js.map} +1 -1
- package/dashboard/dist/assets/{index-eLRh-2NW.js → index-e97M6GoI.js} +2 -2
- package/dashboard/dist/assets/{index-eLRh-2NW.js.map → index-e97M6GoI.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-CSAbLtk7.js → knowledge-CDzw4E6q.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CSAbLtk7.js.map → knowledge-CDzw4E6q.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-D0Ha3aEo.js → mcp-D_-NQtnG.js} +2 -2
- package/dashboard/dist/assets/{mcp-D0Ha3aEo.js.map → mcp-D_-NQtnG.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-BySmvmuS.js → mcp-query-BqZXdf9A.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-BySmvmuS.js.map → mcp-query-BqZXdf9A.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DiqWgxJd.js → pipelines-CNLhgj8b.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DiqWgxJd.js.map → pipelines-CNLhgj8b.js.map} +1 -1
- package/dashboard/dist/assets/{roles-BdtnzLsL.js → roles-CFD2eYap.js} +2 -2
- package/dashboard/dist/assets/{roles-BdtnzLsL.js.map → roles-CFD2eYap.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-DYCUi5nZ.js → tasks-DcSvF636.js} +2 -2
- package/dashboard/dist/assets/{tasks-DYCUi5nZ.js.map → tasks-DcSvF636.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CA7i8ymr.js → topics-DI8TFSZv.js} +2 -2
- package/dashboard/dist/assets/{topics-CA7i8ymr.js.map → topics-DI8TFSZv.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-SfWdyc5L.js → useEventHooks-DcIgMDh3.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-SfWdyc5L.js.map → useEventHooks-DcIgMDh3.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-CZUsk5Vv.js → useNamespace-C88ZxGoX.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-CZUsk5Vv.js.map → useNamespace-C88ZxGoX.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-DKQ5dREx.js → useYamlActivityEvents-D2-yVjJ7.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-DKQ5dREx.js.map → useYamlActivityEvents-D2-yVjJ7.js.map} +1 -1
- package/dashboard/dist/assets/{users-BxKf5dAX.js → users-C0WV36X8.js} +2 -2
- package/dashboard/dist/assets/{users-BxKf5dAX.js.map → users-C0WV36X8.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-DNPQ-j-7.js → workflows-CkPv7xk-.js} +2 -2
- package/dashboard/dist/assets/{workflows-DNPQ-j-7.js.map → workflows-CkPv7xk-.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CA8BrFxc.js → yaml-workflows-BjrMQLTK.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CA8BrFxc.js.map → yaml-workflows-BjrMQLTK.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/docs/dashboard.md +65 -23
- package/package.json +2 -2
- package/dashboard/dist/assets/EscalationSchemaPage-Do2iPKUl.js +0 -9
- package/dashboard/dist/assets/EscalationSchemaPage-Do2iPKUl.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-7j6Mk780.js +0 -11
- package/dashboard/dist/assets/RoleDetailPage-7j6Mk780.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-B0ZgjB2V.js +0 -2
package/dashboard/dist/assets/{YamlWorkflowsPage-C8hBjSn_.js → YamlWorkflowsPage-NtGvqiu7.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-
|
|
2
|
-
//# sourceMappingURL=YamlWorkflowsPage-
|
|
1
|
+
import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-BjrMQLTK.js";import{u}from"./index-Dgw1KKpq.js";import{u as f}from"./useFilterParams-x-Dg0Vgz.js";import{P as p}from"./PageHeader-BhaWTWcM.js";import{F as g,a as j,b}from"./FilterBar-BQ2JGg8U.js";import{E as d}from"./EmptyState-BcsfPq9T.js";import{T as w}from"./ToolPill-uVqcbHPE.js";import{N as v}from"./NamespacePill-CwKdoyRM.js";import{S as y}from"./StatusBadge-D9MeQHrh.js";import{c as N,W as k}from"./vendor-icons-CEWCGPeJ.js";import{c as F}from"./vendor-react-CXumBFUA.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:s,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:s.status||void 0,search:s.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((t,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(j,{label:"Search",value:s.search,onChange:t=>l("search",t),placeholder:"Flow or namespace…"}),e.jsx(b,{label:"Status",value:s.status,onChange:t=>l("status",t),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(d,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(d,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${t.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(w,{name:t.graph_topic,size:"md"}),t.description&&e.jsx("p",{className:"text-[11px] leading-snug text-text-quaternary mt-0.5",children:t.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:t.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap",children:["v",t.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:t.status})})]},t.id))})]})]})}export{O as YamlWorkflowsPage};
|
|
2
|
+
//# sourceMappingURL=YamlWorkflowsPage-NtGvqiu7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YamlWorkflowsPage-
|
|
1
|
+
{"version":3,"file":"YamlWorkflowsPage-NtGvqiu7.js","sources":["../../src/pages/workflows/YamlWorkflowsPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { Wand2, Workflow } from 'lucide-react';\nimport { useYamlWorkflows } from '../../api/yaml-workflows';\nimport { useSettings } from '../../api/settings';\nimport { useFilterParams } from '../../hooks/useFilterParams';\n\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { EmptyState } from '../../components/common/display/EmptyState';\nimport { ToolPill } from '../../components/common/display/ToolPill';\nimport { NamespacePill } from '../../components/common/display/NamespacePill';\nimport { StatusBadge } from '../../components/common/display/StatusBadge';\n\n// ── Page: Graph › Configure ─────────────────────────────────────────────────\n\nexport function YamlWorkflowsPage() {\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const { filters, setFilter } = useFilterParams({\n filters: { status: '', search: '' },\n });\n\n const { data, isLoading } = useYamlWorkflows({\n status: (filters.status || undefined) as any,\n search: filters.search || undefined,\n limit: 200,\n offset: 0,\n });\n\n const flows = data?.workflows ?? [];\n\n if (isLoading) {\n return (\n <div>\n <PageHeader title=\"Configure\" docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\" />\n <div className=\"animate-pulse space-y-0\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"h-14 border-b last:border-b-0 px-6 flex items-center\">\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader\n title=\"Configure\"\n docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\"\n actions={\n aiEnabled ? (\n <button onClick={() => navigate('/mcp/queries/new')} className=\"btn-primary text-xs\">\n Design Flow\n </button>\n ) : undefined\n }\n />\n\n <p className=\"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed\">\n The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each\n flow is a graph the router discovers and runs on demand. Open one to inspect or run it\n {aiEnabled ? ', or design a new one from a description.' : '.'}\n </p>\n\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"Flow or namespace…\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'draft', label: 'Draft' },\n { value: 'deployed', label: 'Deployed' },\n { value: 'active', label: 'Active' },\n { value: 'archived', label: 'Archived' },\n ]}\n />\n </FilterBar>\n\n {flows.length === 0 ? (\n aiEnabled ? (\n <div className=\"cursor-pointer\" onClick={() => navigate('/mcp/queries/new')}>\n <EmptyState\n icon={Wand2}\n title=\"No graph flows yet\"\n description=\"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config.\"\n />\n </div>\n ) : (\n <EmptyState\n icon={Workflow}\n title=\"No graph flows yet\"\n description=\"Register graph flows at startup with the graphWorkflows config — see the docs for an example.\"\n />\n )\n ) : (\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b\">\n <th className=\"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary\">\n Flow\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40\">\n Namespace\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20\">\n Version\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28\">\n Status\n </th>\n </tr>\n </thead>\n <tbody>\n {flows.map((flow) => (\n <tr\n key={flow.id}\n onClick={() => navigate(`/mcp/workflows/${flow.id}`)}\n className=\"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer\"\n >\n <td className=\"px-6 py-2.5\">\n <ToolPill name={flow.graph_topic} size=\"md\" />\n {flow.description && (\n <p className=\"text-[11px] leading-snug text-text-quaternary mt-0.5\">{flow.description}</p>\n )}\n </td>\n <td className=\"px-4 py-2.5\">\n <NamespacePill namespace={flow.app_id} />\n </td>\n <td className=\"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap\">\n v{flow.content_version}\n </td>\n <td className=\"px-4 py-2.5 whitespace-nowrap\">\n <StatusBadge status={flow.status} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </div>\n );\n}\n"],"names":["YamlWorkflowsPage","navigate","useNavigate","settings","useSettings","aiEnabled","_a","filters","setFilter","useFilterParams","data","isLoading","useYamlWorkflows","flows","jsx","PageHeader","_","i","jsxs","FilterBar","FilterInput","v","FilterSelect","EmptyState","Wand2","Workflow","flow","ToolPill","NamespacePill","StatusBadge"],"mappings":"kjBAeO,SAASA,GAAoB,OAClC,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAMC,CAAA,EAAaC,EAAA,EACrBC,EAAY,CAAC,GAACC,EAAAH,GAAA,YAAAA,EAAU,KAAV,MAAAG,EAAc,SAC5B,CAAE,QAAAC,EAAS,UAAAC,CAAA,EAAcC,EAAgB,CAC7C,QAAS,CAAE,OAAQ,GAAI,OAAQ,EAAA,CAAG,CACnC,EAEK,CAAE,KAAAC,EAAM,UAAAC,CAAA,EAAcC,EAAiB,CAC3C,OAASL,EAAQ,QAAU,OAC3B,OAAQA,EAAQ,QAAU,OAC1B,MAAO,IACP,OAAQ,CAAA,CACT,EAEKM,GAAQH,GAAA,YAAAA,EAAM,YAAa,CAAA,EAEjC,OAAIC,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
|
|
1
|
-
import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-
|
|
2
|
-
//# sourceMappingURL=agents-
|
|
1
|
+
import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-Dgw1KKpq.js";function g(e={}){const n=new URLSearchParams;e.status&&n.set("status",e.status),e.knowledge_domain&&n.set("knowledge_domain",e.knowledge_domain),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const s=n.toString();return o({queryKey:["agents",e],queryFn:()=>t(`/agents${s?`?${s}`:""}`)})}function y(e){return o({queryKey:["agents",e],queryFn:()=>t(`/agents/${e}`),enabled:!!e})}function c(){const e=u();return a({mutationFn:n=>t("/agents",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function m(){const e=u();return a({mutationFn:({id:n,...s})=>t(`/agents/${n}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function d(){const e=u();return a({mutationFn:n=>t(`/agents/${n}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}export{y as a,m as b,d as c,c as d,g as u};
|
|
2
|
+
//# sourceMappingURL=agents-tML6AjDj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-
|
|
1
|
+
{"version":3,"file":"agents-tML6AjDj.js","sources":["../../src/api/agents.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface AgentCapability {\n serverId: string;\n toolNames?: string[];\n}\n\nexport interface AgentTrigger {\n event: string;\n filter?: Record<string, any>;\n}\n\nexport interface AgentSchedule {\n cron: string;\n workflow_type: string;\n envelope?: Record<string, any>;\n execute_as?: string;\n}\n\nexport interface AgentBehaviors {\n cron?: string;\n triggers?: AgentTrigger[];\n schedules?: AgentSchedule[];\n escalationRules?: Record<string, any>;\n}\n\nexport interface Agent {\n /** Agent identifier — human-readable kebab-case name (e.g. 'content-triage') */\n id: string;\n description?: string;\n status: 'inactive' | 'active' | 'paused' | 'error';\n user_id?: string;\n knowledge_domain?: string;\n capabilities: AgentCapability[];\n behaviors: AgentBehaviors;\n goals?: string;\n rules?: string;\n workflow_type?: string;\n pipeline_id?: string;\n metadata: Record<string, any>;\n last_run_at?: string;\n subscription_count?: number;\n sub_topics?: string[];\n created_at: string;\n updated_at: string;\n stats?: {\n knowledge_count: number;\n escalation_count: number;\n last_execution_at?: string;\n };\n}\n\ninterface AgentListResponse {\n agents: Agent[];\n total: number;\n}\n\ninterface AgentFilters {\n status?: string;\n knowledge_domain?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useAgents(filters: AgentFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.knowledge_domain) params.set('knowledge_domain', filters.knowledge_domain);\n if (filters.limit != null) params.set('limit', String(filters.limit));\n if (filters.offset != null) params.set('offset', String(filters.offset));\n const qs = params.toString();\n\n return useQuery<AgentListResponse>({\n queryKey: ['agents', filters],\n queryFn: () => apiFetch(`/agents${qs ? `?${qs}` : ''}`),\n });\n}\n\nexport function useAgent(id: string | null) {\n return useQuery<Agent>({\n queryKey: ['agents', id],\n queryFn: () => apiFetch(`/agents/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, Partial<Agent> & { id: string }>({\n mutationFn: (body) =>\n apiFetch('/agents', {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useUpdateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, { id: string } & Partial<Agent>>({\n mutationFn: ({ id, ...body }) =>\n apiFetch(`/agents/${id}`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useDeleteAgent() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean }, Error, string>({\n mutationFn: (id) =>\n apiFetch(`/agents/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n"],"names":["useAgents","filters","params","qs","useQuery","apiFetch","useAgent","id","useCreateAgent","queryClient","useQueryClient","useMutation","body","useUpdateAgent","useDeleteAgent"],"mappings":"qGAiEO,SAASA,EAAUC,EAAwB,GAAI,CACpD,MAAMC,EAAS,IAAI,gBACfD,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,kBAAkBC,EAAO,IAAI,mBAAoBD,EAAQ,gBAAgB,EACjFA,EAAQ,OAAS,MAAMC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EAChEA,EAAQ,QAAU,MAAMC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EACvE,MAAME,EAAKD,EAAO,SAAA,EAElB,OAAOE,EAA4B,CACjC,SAAU,CAAC,SAAUH,CAAO,EAC5B,QAAS,IAAMI,EAAS,UAAUF,EAAK,IAAIA,CAAE,GAAK,EAAE,EAAE,CAAA,CACvD,CACH,CAEO,SAASG,EAASC,EAAmB,CAC1C,OAAOH,EAAgB,CACrB,SAAU,CAAC,SAAUG,CAAE,EACvB,QAAS,IAAMF,EAAS,WAAWE,CAAE,EAAE,EACvC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAiB,CAC/B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAaC,GACXP,EAAS,UAAW,CAClB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASI,GAAiB,CAC/B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACpBP,EAAS,WAAWE,CAAE,GAAI,CACxB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASK,GAAiB,CAC/B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAiD,CACtD,WAAaJ,GACXF,EAAS,WAAWE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAChD,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-
|
|
2
|
-
//# sourceMappingURL=bots-
|
|
1
|
+
import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-Dgw1KKpq.js";function y(e={}){const t=new URLSearchParams;return e.limit&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),a({queryKey:["bots",e],queryFn:()=>n(`/bot-accounts?${t}`)})}function d(e){return a({queryKey:["bots",e,"api-keys"],queryFn:()=>n(`/bot-accounts/${e}/api-keys`),enabled:!!e})}function b(){const e=s();return u({mutationFn:t=>n("/bot-accounts",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function m(){const e=s();return u({mutationFn:({id:t,...o})=>n(`/bot-accounts/${t}`,{method:"PUT",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function f(){const e=s();return u({mutationFn:t=>n(`/bot-accounts/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function l(){const e=s();return u({mutationFn:({botId:t,name:o,scopes:i})=>n(`/bot-accounts/${t}/api-keys`,{method:"POST",body:JSON.stringify({name:o,scopes:i})}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function q(){const e=s();return u({mutationFn:({botId:t,keyId:o})=>n(`/bot-accounts/${t}/api-keys/${o}`,{method:"DELETE"}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function S(){const e=s();return u({mutationFn:({botId:t,role:o,type:i})=>n(`/bot-accounts/${t}/roles`,{method:"POST",body:JSON.stringify({role:o,type:i})}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function p(){const e=s();return u({mutationFn:({botId:t,role:o})=>n(`/bot-accounts/${t}/roles/${encodeURIComponent(o)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}export{m as a,d as b,l as c,q as d,S as e,p as f,f as g,y as h,b as u};
|
|
2
|
+
//# sourceMappingURL=bots-Cb0WTwhY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bots-
|
|
1
|
+
{"version":3,"file":"bots-Cb0WTwhY.js","sources":["../../src/api/bots.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { BotRecord, BotApiKeyRecord } from './types';\nimport type { LTRoleType } from './types';\n\ninterface BotListResponse {\n bots: BotRecord[];\n total: number;\n}\n\ninterface BotFilters {\n limit?: number;\n offset?: number;\n}\n\n// ── Query hooks ──────────────────────────────────────────────────────────────\n\nexport function useBots(filters: BotFilters = {}) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<BotListResponse>({\n queryKey: ['bots', filters],\n queryFn: () => apiFetch(`/bot-accounts?${params}`),\n });\n}\n\nexport function useBotApiKeys(botId: string) {\n return useQuery<{ keys: BotApiKeyRecord[] }>({\n queryKey: ['bots', botId, 'api-keys'],\n queryFn: () => apiFetch(`/bot-accounts/${botId}/api-keys`),\n enabled: !!botId,\n });\n}\n\n// ── Mutation hooks ───────────────────────────────────────────────────────────\n\nexport function useCreateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n name: string;\n description?: string;\n display_name?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/bot-accounts', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useUpdateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n display_name?: string;\n description?: string;\n status?: string;\n }) =>\n apiFetch(`/bot-accounts/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useDeleteBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/bot-accounts/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useCreateBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n name,\n scopes,\n }: {\n botId: string;\n name: string;\n scopes?: string[];\n }) =>\n apiFetch<{ id: string; rawKey: string }>(`/bot-accounts/${botId}/api-keys`, {\n method: 'POST',\n body: JSON.stringify({ name, scopes }),\n }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useRevokeBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, keyId }: { botId: string; keyId: string }) =>\n apiFetch(`/bot-accounts/${botId}/api-keys/${keyId}`, { method: 'DELETE' }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useAddBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n role,\n type,\n }: {\n botId: string;\n role: string;\n type: LTRoleType;\n }) =>\n apiFetch(`/bot-accounts/${botId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useRemoveBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, role }: { botId: string; role: string }) =>\n apiFetch(`/bot-accounts/${botId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n"],"names":["useBots","filters","params","useQuery","apiFetch","useBotApiKeys","botId","useCreateBot","queryClient","useQueryClient","useMutation","data","useUpdateBot","id","useDeleteBot","useCreateBotApiKey","name","scopes","_data","vars","useRevokeBotApiKey","keyId","useAddBotRole","role","type","useRemoveBotRole"],"mappings":"qGAiBO,SAASA,EAAQC,EAAsB,GAAI,CAChD,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAA0B,CAC/B,SAAU,CAAC,OAAQF,CAAO,EAC1B,QAAS,IAAMG,EAAS,iBAAiBF,CAAM,EAAE,CAAA,CAClD,CACH,CAEO,SAASG,EAAcC,EAAe,CAC3C,OAAOH,EAAsC,CAC3C,SAAU,CAAC,OAAQG,EAAO,UAAU,EACpC,QAAS,IAAMF,EAAS,iBAAiBE,CAAK,WAAW,EACzD,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAIO,SAASC,GAAe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BjB,EAAS,iBAAiBE,CAAK,aAAae,CAAK,GAAI,CAAE,OAAQ,SAAU,EAC3E,UAAW,CAACH,EAAOC,IAAS,CAC1BX,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAQW,EAAK,MAAO,UAAU,EAAG,CAC9E,CAAA,CACD,CACH,CAEO,SAASG,GAAgB,CAC9B,MAAMd,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CACX,MAAAJ,EACA,KAAAiB,EACA,KAAAC,CAAA,IAMApB,EAAS,iBAAiBE,CAAK,SAAU,CACvC,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAiB,EAAM,KAAAC,EAAM,CAAA,CACpC,EACH,UAAW,IAAM,CACfhB,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH,CAEO,SAASiB,GAAmB,CACjC,MAAMjB,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,MAAAJ,EAAO,KAAAiB,CAAA,IACpBnB,EAAS,iBAAiBE,CAAK,UAAU,mBAAmBiB,CAAI,CAAC,GAAI,CACnE,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACff,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,CACtD,CAAA,CACD,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-
|
|
2
|
-
//# sourceMappingURL=capabilities-
|
|
1
|
+
import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-Dgw1KKpq.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
|
|
2
|
+
//# sourceMappingURL=capabilities-BGZogsi_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities-
|
|
1
|
+
{"version":3,"file":"capabilities-BGZogsi_.js","sources":["../../src/api/capabilities.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface CapabilityTool {\n name: string;\n description: string;\n inputSchema: Record<string, any>;\n serverName: string;\n serverId: string;\n}\n\nexport interface CapabilityCategory {\n name: string;\n tools: CapabilityTool[];\n}\n\nexport interface CapabilitiesResponse {\n categories: CapabilityCategory[];\n totalTools: number;\n}\n\nexport function useCapabilities() {\n return useQuery<CapabilitiesResponse>({\n queryKey: ['capabilities'],\n queryFn: () => apiFetch('/capabilities'),\n });\n}\n"],"names":["useCapabilities","useQuery","apiFetch"],"mappings":"uFAqBO,SAASA,GAAkB,CAChC,OAAOC,EAA+B,CACpC,SAAU,CAAC,cAAc,EACzB,QAAS,IAAMC,EAAS,eAAe,CAAA,CACxC,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-
|
|
2
|
-
//# sourceMappingURL=controlplane-
|
|
1
|
+
import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-Dgw1KKpq.js";function s(){return n("/controlplane/apps")}function c(e){return n(`/controlplane/rollcall?app_id=${encodeURIComponent(e)}`)}function i(e){return n("/controlplane/throttle",{method:"POST",body:JSON.stringify(e)})}function m(e){return n("/controlplane/subscribe",{method:"POST",body:JSON.stringify(e)})}function f(e,t,u){let r=`/controlplane/streams?app_id=${encodeURIComponent(e)}&duration=${encodeURIComponent(t)}`;return n(r)}function b(e){return o({queryKey:["controlplane","apps"],queryFn:s,staleTime:6e4,enabled:(e==null?void 0:e.enabled)??!0})}function d(e,t){return o({queryKey:["controlplane","rollcall",e],queryFn:()=>c(e),enabled:!!e,refetchInterval:t})}function h(){const e=a();return l({mutationFn:i,onSuccess:()=>{setTimeout(()=>{e.invalidateQueries({queryKey:["controlplane","rollcall"]})},1500)}})}function S(e,t,u,r){return o({queryKey:["controlplane","streams",e,t,""],queryFn:()=>f(e,t),enabled:!!e,staleTime:15e3,refetchInterval:r})}function q(){return l({mutationFn:m})}export{h as a,q as b,d as c,S as d,b as u};
|
|
2
|
+
//# sourceMappingURL=controlplane-B7VJTlZD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controlplane-
|
|
1
|
+
{"version":3,"file":"controlplane-B7VJTlZD.js","sources":["../../src/api/controlplane.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ControlPlaneApp {\n appId: string;\n version: string;\n}\n\nexport interface QuorumProfile {\n namespace: string;\n app_id: string;\n engine_id: string;\n entity?: string;\n worker_topic?: string;\n stream?: string;\n stream_depth?: number;\n counts?: Record<string, number>;\n inited?: string;\n timestamp?: string;\n throttle?: number;\n reclaimDelay?: number;\n reclaimCount?: number;\n system?: {\n TotalMemoryGB: string;\n FreeMemoryGB: string;\n UsedMemoryGB: string;\n CPULoad: Array<Record<string, string>>;\n NetworkStats: Array<Record<string, unknown>>;\n };\n is_scout?: boolean;\n signature?: string;\n}\n\n// ── API functions ───────────────────────────────────────────────────────────\n\nfunction fetchApps() {\n return apiFetch<{ apps: ControlPlaneApp[] }>('/controlplane/apps');\n}\n\nfunction fetchRollCall(appId: string) {\n return apiFetch<{ profiles: QuorumProfile[] }>(`/controlplane/rollcall?app_id=${encodeURIComponent(appId)}`);\n}\n\nfunction postThrottle(body: { appId: string; throttle: number; topic?: string; guid?: string; scope?: 'engines' | 'workers' | 'all' }) {\n return apiFetch<{ success: boolean }>('/controlplane/throttle', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nfunction postSubscribe(body: { appId: string }) {\n return apiFetch<{ subscribed: boolean; appId: string }>('/controlplane/subscribe', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nexport interface StreamStats {\n pending: number;\n processed: number;\n byStream: Array<{ stream_type: 'engine' | 'worker'; stream_name: string; count: number }>;\n}\n\nfunction fetchStreamStats(appId: string, duration: string, stream?: string) {\n let url = `/controlplane/streams?app_id=${encodeURIComponent(appId)}&duration=${encodeURIComponent(duration)}`;\n if (stream) url += `&stream=${encodeURIComponent(stream)}`;\n return apiFetch<StreamStats>(url);\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\nexport function useControlPlaneApps(options?: { enabled?: boolean }) {\n return useQuery({\n queryKey: ['controlplane', 'apps'],\n queryFn: fetchApps,\n staleTime: 60_000,\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useRollCall(appId: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'rollcall', appId],\n queryFn: () => fetchRollCall(appId),\n enabled: !!appId,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useThrottle() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: postThrottle,\n onSuccess: () => {\n // Delay refetch so mesh members have time to process the throttle message\n setTimeout(() => {\n qc.invalidateQueries({ queryKey: ['controlplane', 'rollcall'] });\n }, 1500);\n },\n });\n}\n\nexport function useStreamStats(appId: string, duration: string, stream?: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'streams', appId, duration, stream ?? ''],\n queryFn: () => fetchStreamStats(appId, duration, stream),\n enabled: !!appId,\n staleTime: 15_000,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useSubscribeMesh() {\n return useMutation({\n mutationFn: postSubscribe,\n });\n}\n"],"names":["fetchApps","apiFetch","fetchRollCall","appId","postThrottle","body","postSubscribe","fetchStreamStats","duration","stream","url","useControlPlaneApps","options","useQuery","useRollCall","refetchInterval","useThrottle","qc","useQueryClient","useMutation","useStreamStats","useSubscribeMesh"],"mappings":"qGAqCA,SAASA,GAAY,CACnB,OAAOC,EAAsC,oBAAoB,CACnE,CAEA,SAASC,EAAcC,EAAe,CACpC,OAAOF,EAAwC,iCAAiC,mBAAmBE,CAAK,CAAC,EAAE,CAC7G,CAEA,SAASC,EAAaC,EAAiH,CACrI,OAA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|
|
|
1
|
-
import{a,j as r}from"./vendor-query-B2UbickB.js";import{G as l,H as c,I as m}from"./index-
|
|
2
|
-
//# sourceMappingURL=escalation-
|
|
1
|
+
import{a,j as r}from"./vendor-query-B2UbickB.js";import{G as l,H as c,I as m}from"./index-Dgw1KKpq.js";const n=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function u(t){if(t<=0)return n[0].color;for(const e of n)if(t<e.maxMs)return e.color;return n[n.length-1].color}function w({until:t}){const[e,s]=a.useState(()=>new Date(t).getTime()-Date.now());a.useEffect(()=>{const o=setInterval(()=>{s(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(o)},[t]);const i=a.useMemo(()=>{const o=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:o.toISOString()},{label:"local",value:l(o,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return r.jsx(c,{options:i,children:r.jsx("span",{className:`text-xs font-mono ${u(e)}`,children:m(e)})})}function d(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function g(t){return!t.workflow_type}export{w as C,d as a,g as i};
|
|
2
|
+
//# sourceMappingURL=escalation-Bl-SQV_u.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escalation-
|
|
1
|
+
{"version":3,"file":"escalation-Bl-SQV_u.js","sources":["../../src/components/common/display/CountdownTimer.tsx","../../src/lib/escalation.ts"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { format as fnsFormat } from 'date-fns';\nimport { formatRemaining } from '../../../lib/format';\nimport { DateTooltip } from './DateTooltip';\n\nconst COUNTDOWN_THRESHOLDS = [\n { maxMs: 0, color: 'text-status-error' },\n { maxMs: 5 * 60 * 1000, color: 'text-status-error' },\n { maxMs: 15 * 60 * 1000, color: 'text-status-warning' },\n { maxMs: Infinity, color: 'text-text-secondary' },\n] as const;\n\nfunction countdownColor(remainingMs: number): string {\n if (remainingMs <= 0) return COUNTDOWN_THRESHOLDS[0].color;\n for (const t of COUNTDOWN_THRESHOLDS) {\n if (remainingMs < t.maxMs) return t.color;\n }\n return COUNTDOWN_THRESHOLDS[COUNTDOWN_THRESHOLDS.length - 1].color;\n}\n\nexport function CountdownTimer({ until }: { until: string }) {\n const [remaining, setRemaining] = useState(() => new Date(until).getTime() - Date.now());\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(new Date(until).getTime() - Date.now());\n }, 1000);\n return () => clearInterval(interval);\n }, [until]);\n\n const options = useMemo(() => {\n const d = new Date(until);\n return [\n { label: 'ms', value: String(Math.max(0, remaining)) },\n { label: 'until', value: d.toISOString() },\n { label: 'local', value: fnsFormat(d, 'MMM d, yyyy h:mm:ss a') },\n ];\n }, [until, remaining]);\n\n return (\n <DateTooltip options={options}>\n <span className={`text-xs font-mono ${countdownColor(remaining)}`}>\n {formatRemaining(remaining)}\n </span>\n </DateTooltip>\n );\n}\n","import type { LTEscalationRecord } from '../api/types';\n\nexport function isEffectivelyClaimed(esc: LTEscalationRecord): boolean {\n return !!(\n esc.assigned_to &&\n esc.assigned_until &&\n new Date(esc.assigned_until) > new Date()\n );\n}\n\n/** An ACK escalation has no associated workflow — it's a notification, not a task. */\nexport function isAckEscalation(esc: LTEscalationRecord): boolean {\n return !esc.workflow_type;\n}\n\nexport function isAvailable(esc: LTEscalationRecord): boolean {\n return (\n esc.status === 'pending' &&\n (!esc.assigned_to ||\n !esc.assigned_until ||\n new Date(esc.assigned_until) <= new Date())\n );\n}\n"],"names":["COUNTDOWN_THRESHOLDS","countdownColor","remainingMs","t","CountdownTimer","until","remaining","setRemaining","useState","useEffect","interval","options","useMemo","d","fnsFormat","jsx","DateTooltip","formatRemaining","isEffectivelyClaimed","esc","isAckEscalation"],"mappings":"uGAKA,MAAMA,EAAuB,CAC3B,CAAE,MAAO,EAAgB,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAS,IAA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,SAASC,EAAgBD,EAAkC,CAChE,MAAO,CAACA,EAAI,aACd"}
|
package/dashboard/dist/assets/{escalation-columns-GxxwSbDk.js → escalation-columns-BlJOswRx.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,a as p}from"./vendor-query-B2UbickB.js";import{F as u,b as n,c as o,a as h}from"./FilterBar-BQ2JGg8U.js";import{P as j}from"./PriorityBadge-B4ykBH7f.js";import{R as f}from"./RolePill-Cl71eDUA.js";import{W as v}from"./WorkflowPill-IDjTRfQ8.js";import{C as w,i as y,a as N}from"./escalation-
|
|
2
|
-
//# sourceMappingURL=escalation-columns-
|
|
1
|
+
import{j as e,a as p}from"./vendor-query-B2UbickB.js";import{F as u,b as n,c as o,a as h}from"./FilterBar-BQ2JGg8U.js";import{P as j}from"./PriorityBadge-B4ykBH7f.js";import{R as f}from"./RolePill-Cl71eDUA.js";import{W as v}from"./WorkflowPill-IDjTRfQ8.js";import{C as w,i as y,a as N}from"./escalation-Bl-SQV_u.js";import{x as b,y as g,J as k}from"./index-Dgw1KKpq.js";import{a6 as C,a7 as _,a8 as c,o as P}from"./vendor-icons-CEWCGPeJ.js";const l="text-text-secondary transition-colors group-hover/row:text-text-primary";function T({row:a}){if(y(a)){const t=a.status==="resolved"?"text-status-success":"text-text-tertiary";return e.jsx(_,{className:`w-3 h-3 shrink-0 ${t}`})}return a.status==="resolved"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success"}):a.status==="cancelled"?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error"}):N(a)?e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning"}):e.jsx(c,{className:"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active"})}function E({metadata:a}){const[t,x]=p.useState(!1);if(!a||Object.keys(a).length===0)return e.jsx("span",{className:"text-[11px] text-text-tertiary",children:"—"});const r=Object.keys(a),m=`${r.slice(0,2).join(", ")}${r.length>2?` +${r.length-2}`:""}`;return e.jsxs("div",{className:"w-full",children:[e.jsxs("button",{onClick:i=>{i.stopPropagation(),x(d=>!d)},className:`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${l}`,title:t?"Collapse metadata":"Expand metadata",children:[e.jsx(P,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`}),e.jsx("span",{className:"truncate",children:`{ ${m} }`})]}),e.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${t?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"mt-1 overflow-x-auto",onClick:i=>i.stopPropagation(),children:e.jsx(k,{data:a,defaultCollapsed:!0})})})})]})}const D=[{key:"description",label:"Summary",render:a=>e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{className:"shrink-0",children:e.jsx(T,{row:a})}),e.jsx("span",{className:`truncate text-xs ${l}`,children:a.description||a.type})]}),className:"max-w-0"},{key:"workflow_type",label:"Workflow",render:a=>e.jsx(v,{type:a.workflow_type||a.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",render:a=>e.jsx(E,{metadata:a.metadata}),className:"w-80 max-w-[19rem] align-top"},{key:"role",label:"Role",render:a=>e.jsx("span",{className:l,children:e.jsx(f,{role:a.role,size:"md",tone:"inherit"})}),className:"w-28"},{key:"priority",label:"Priority",render:a=>e.jsx("span",{className:l,children:e.jsx(j,{priority:a.priority,size:"sm",tone:"inherit"})}),className:"w-14",sortable:!0},{key:"created_time",label:"Created",render:a=>e.jsx("span",{className:`text-[11px] font-mono whitespace-nowrap ${l}`,title:a.created_at,children:b(a.created_at)}),className:"w-40 whitespace-nowrap"},{key:"created_at",label:"Ago",render:a=>e.jsx("span",{className:`text-xs tabular-nums ${l}`,title:a.created_at,children:g(a.created_at)}),className:"w-12 whitespace-nowrap",sortable:!0}],U={key:"expires",label:e.jsx(C,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:a=>a.assigned_until?e.jsx(w,{until:a.assigned_until}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap"},S=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],O=[{value:"all",label:"All"},{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}];function W({filters:a,setFilter:t,roles:x,types:r,showStatus:m=!1,showSearch:i=!0,actions:d}){return e.jsxs(u,{actions:d,children:[m&&e.jsxs(e.Fragment,{children:[e.jsx(n,{label:"Status",value:a.status??"",onChange:s=>t("status",s),options:O}),e.jsx(o,{})]}),e.jsx(n,{label:"Role",value:a.role,onChange:s=>t("role",s),options:x.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Type",value:a.type,onChange:s=>t("type",s),options:r.map(s=>({value:s,label:s}))}),e.jsx(o,{}),e.jsx(n,{label:"Priority",value:a.priority,onChange:s=>t("priority",s),options:S}),i&&e.jsxs(e.Fragment,{children:[e.jsx(o,{}),e.jsx(h,{label:"Search",value:a.search??"",onChange:s=>t("search",s),placeholder:"ID, workflow, origin…"})]})]})}export{D as E,U as T,W as a};
|
|
2
|
+
//# sourceMappingURL=escalation-columns-BlJOswRx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escalation-columns-GxxwSbDk.js","sources":["../../src/pages/operator/escalation-columns.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Circle, Bell, Clock, ChevronRight } from 'lucide-react';\nimport type { Column } from '../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect, FilterInput, FilterDivider } from '../../components/common/data/FilterBar';\nimport { PriorityBadge } from '../../components/common/display/PriorityBadge';\nimport { RolePill } from '../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { CountdownTimer } from '../../components/common/display/CountdownTimer';\nimport { JsonViewer } from '../../components/common/data/JsonViewer';\nimport { formatAgoCompact, formatDateTime } from '../../lib/format';\nimport { isEffectivelyClaimed, isAckEscalation } from '../../lib/escalation';\nimport type { LTEscalationRecord } from '../../api/types';\n\n// Shared cell text: a consistent resting shade for every cell, sharpening to\n// the primary text colour when the row is hovered. Cells (and pills via their\n// `inherit` tone) all read this single source so the whole row darkens as one.\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\n\n/** Status dot — rendered inline before summary. */\nfunction StatusDot({ row }: { row: LTEscalationRecord }) {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 shrink-0 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success\" />;\n }\n if (row.status === 'cancelled') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active\" />;\n}\n\n/**\n * Metadata cell — a compact `{ key, key +N }` preview that expands inline to the\n * pretty-printed JSON. The same metadata the faceted query filters on, visible per row.\n */\nfunction MetadataCell({ metadata }: { metadata: Record<string, unknown> | null }) {\n const [open, setOpen] = useState(false);\n if (!metadata || Object.keys(metadata).length === 0) {\n return <span className=\"text-[11px] text-text-tertiary\">—</span>;\n }\n const keys = Object.keys(metadata);\n const preview = `${keys.slice(0, 2).join(', ')}${keys.length > 2 ? ` +${keys.length - 2}` : ''}`;\n // Width is fixed by the wrapper so toggling never changes the column width —\n // the JSON viewer reveals with an animated row-height transition, and long\n // lines scroll horizontally inside the cell rather than widening it.\n return (\n <div className=\"w-full\">\n <button\n onClick={(e) => { e.stopPropagation(); setOpen((v) => !v); }}\n className={`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${CELL_TEXT}`}\n title={open ? 'Collapse metadata' : 'Expand metadata'}\n >\n <ChevronRight className={`h-3 w-3 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`} />\n <span className=\"truncate\">{`{ ${preview} }`}</span>\n </button>\n <div\n className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'}`}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-1 overflow-x-auto\" onClick={(e) => e.stopPropagation()}>\n {/* defaultCollapsed → root expanded, nested objects collapsed (one level). */}\n <JsonViewer data={metadata} defaultCollapsed />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** Base columns shared by all escalation list pages. */\nexport const ESCALATION_COLUMNS: Column<LTEscalationRecord>[] = [\n {\n key: 'description',\n label: 'Summary',\n render: (row) => (\n <div className=\"flex items-center gap-2 overflow-hidden\">\n <span className=\"shrink-0\"><StatusDot row={row} /></span>\n <span className={`truncate text-xs ${CELL_TEXT}`}>{row.description || row.type}</span>\n </div>\n ),\n className: 'max-w-0',\n },\n {\n key: 'workflow_type',\n label: 'Workflow',\n // The workflow function name (e.g. `richForm`, `basicSignal`) lives in\n // workflow_type; `type` is the escalation category. Fall back to type for\n // standalone escalations with no workflow.\n render: (row) => <WorkflowPill type={row.workflow_type || row.type} />,\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'metadata',\n label: 'Metadata',\n render: (row) => <MetadataCell metadata={row.metadata} />,\n // Fixed width — never grows on expand (the viewer reveals via row-height).\n // Given extra room (borrowed from priority/ago/actions) so JSON wraps less.\n className: 'w-80 max-w-[19rem] align-top',\n },\n {\n key: 'role',\n label: 'Role',\n render: (row) => (\n <span className={CELL_TEXT}>\n <RolePill role={row.role} size=\"md\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-28',\n },\n {\n key: 'priority',\n label: 'Priority',\n render: (row) => (\n <span className={CELL_TEXT}>\n <PriorityBadge priority={row.priority} size=\"sm\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-14',\n sortable: true,\n },\n {\n key: 'created_time',\n label: 'Created',\n render: (row) => (\n <span className={`text-[11px] font-mono whitespace-nowrap ${CELL_TEXT}`} title={row.created_at}>\n {formatDateTime(row.created_at)}\n </span>\n ),\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'created_at',\n label: 'Ago',\n render: (row) => (\n <span className={`text-xs tabular-nums ${CELL_TEXT}`} title={row.created_at}>\n {formatAgoCompact(row.created_at)}\n </span>\n ),\n className: 'w-12 whitespace-nowrap',\n sortable: true,\n },\n];\n\n/** Time-remaining column for claimed escalations — aligns with checkbox column on All Escalations. */\nexport const TIME_LEFT_COLUMN: Column<LTEscalationRecord> = {\n key: 'expires',\n label: (<Clock className=\"w-3.5 h-3.5 text-text-tertiary\" />) as any,\n render: (row) =>\n row.assigned_until ? (\n <CountdownTimer until={row.assigned_until} />\n ) : (\n <span className=\"text-xs text-text-tertiary\">—</span>\n ),\n className: 'w-16 whitespace-nowrap',\n};\n\n/** Status icon column — color-coded filled circle, or bell for ACK/notification escalations. */\nexport const STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) => {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 fill-status-success text-status-success\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 fill-text-tertiary text-text-tertiary\" />;\n },\n className: 'w-8',\n};\n\n/** Claimed-only status icon (always orange, or bell for ACK). */\nexport const CLAIMED_STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) =>\n isAckEscalation(row)\n ? <Bell className=\"w-3 h-3 text-status-warning\" />\n : <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />,\n className: 'w-8',\n};\n\n/** Priority filter options shared by both pages. */\nexport const PRIORITY_OPTIONS = [\n { value: '1', label: 'P1' },\n { value: '2', label: 'P2' },\n { value: '3', label: 'P3' },\n { value: '4', label: 'P4' },\n];\n\n/** Status filter options for escalation list pages. `all` spans every status so a\n * metadata search (e.g. one order id) returns its escalations regardless of status. */\nexport const STATUS_OPTIONS = [\n { value: 'all', label: 'All' },\n { value: 'available', label: 'Available' },\n { value: 'claimed', label: 'Claimed' },\n { value: 'resolved', label: 'Resolved' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'expired', label: 'Expired' },\n];\n\n/** Shared filter bar for escalation list pages. */\nexport function EscalationFilterBar({\n filters,\n setFilter,\n roles,\n types,\n showStatus = false,\n showSearch = true,\n actions,\n}: {\n filters: { role: string; type: string; priority: string; status?: string; search?: string };\n setFilter: (key: any, value: string) => void;\n roles: string[];\n types: string[];\n showStatus?: boolean;\n // Free-text search lives here by default, but the faceted page folds it into\n // the drawer instead so there's a single search surface.\n showSearch?: boolean;\n actions?: React.ReactNode;\n}) {\n return (\n <FilterBar actions={actions}>\n {showStatus && (\n <>\n <FilterSelect\n label=\"Status\"\n value={filters.status ?? ''}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n <FilterDivider />\n </>\n )}\n <FilterSelect\n label=\"Role\"\n value={filters.role}\n onChange={(v) => setFilter('role', v)}\n options={roles.map((r) => ({ value: r, label: r }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Type\"\n value={filters.type}\n onChange={(v) => setFilter('type', v)}\n options={types.map((t) => ({ value: t, label: t }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Priority\"\n value={filters.priority}\n onChange={(v) => setFilter('priority', v)}\n options={PRIORITY_OPTIONS}\n />\n {showSearch && (\n <>\n <FilterDivider />\n <FilterInput\n label=\"Search\"\n value={filters.search ?? ''}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"ID, workflow, origin…\"\n />\n </>\n )}\n </FilterBar>\n );\n}\n"],"names":["CELL_TEXT","StatusDot","row","isAckEscalation","color","jsx","Bell","Circle","isEffectivelyClaimed","MetadataCell","metadata","open","setOpen","useState","keys","preview","jsxs","e","v","ChevronRight","JsonViewer","ESCALATION_COLUMNS","WorkflowPill","RolePill","PriorityBadge","formatDateTime","formatAgoCompact","TIME_LEFT_COLUMN","Clock","CountdownTimer","PRIORITY_OPTIONS","STATUS_OPTIONS","EscalationFilterBar","filters","setFilter","roles","types","showStatus","showSearch","actions","FilterBar","Fragment","FilterSelect","FilterDivider","r","t","FilterInput"],"mappings":"ybAgBA,MAAMA,EAAY,0EAGlB,SAASC,EAAU,CAAE,IAAAC,GAAoC,CACvD,GAAIC,EAAgBD,CAAG,EAAG,CACxB,MAAME,EAAQF,EAAI,SAAW,WAAa,sBAAwB,qBAClE,OAAOG,EAAAA,IAACC,EAAA,CAAK,UAAW,oBAAoBF,CAAK,GAAI,CACvD,CACA,OAAIF,EAAI,SAAW,WACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAEtFL,EAAI,SAAW,YACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,0DAAA,CAA2D,EAElFC,EAAqBN,CAAG,EACnBG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAGnFF,EAAAA,IAACE,EAAA,CAAO,UAAU,4DAAA,CAA6D,CACxF,CAMA,SAASE,EAAa,CAAE,SAAAC,GAA0D,CAChF,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EACtC,GAAI,CAACH,GAAY,OAAO,KAAKA,CAAQ,EAAE,SAAW,EAChD,OAAOL,EAAAA,IAAC,OAAA,CAAK,UAAU,iCAAiC,SAAA,IAAC,EAE3D,MAAMS,EAAO,OAAO,KAAKJ,CAAQ,EAC3BK,EAAU,GAAGD,EAAK,MAAM,E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,SACN,MAAOb,EAAQ,QAAU,GACzB,SAAWf,GAAMgB,EAAU,SAAUhB,CAAC,EACtC,YAAY,uBAAA,CAAA,CACd,CAAA,CACF,CAAA,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"escalation-columns-BlJOswRx.js","sources":["../../src/pages/operator/escalation-columns.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Circle, Bell, Clock, ChevronRight } from 'lucide-react';\nimport type { Column } from '../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect, FilterInput, FilterDivider } from '../../components/common/data/FilterBar';\nimport { PriorityBadge } from '../../components/common/display/PriorityBadge';\nimport { RolePill } from '../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { CountdownTimer } from '../../components/common/display/CountdownTimer';\nimport { JsonViewer } from '../../components/common/data/JsonViewer';\nimport { formatAgoCompact, formatDateTime } from '../../lib/format';\nimport { isEffectivelyClaimed, isAckEscalation } from '../../lib/escalation';\nimport type { LTEscalationRecord } from '../../api/types';\n\n// Shared cell text: a consistent resting shade for every cell, sharpening to\n// the primary text colour when the row is hovered. Cells (and pills via their\n// `inherit` tone) all read this single source so the whole row darkens as one.\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\n\n/** Status dot — rendered inline before summary. */\nfunction StatusDot({ row }: { row: LTEscalationRecord }) {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 shrink-0 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success\" />;\n }\n if (row.status === 'cancelled') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active\" />;\n}\n\n/**\n * Metadata cell — a compact `{ key, key +N }` preview that expands inline to the\n * pretty-printed JSON. The same metadata the faceted query filters on, visible per row.\n */\nfunction MetadataCell({ metadata }: { metadata: Record<string, unknown> | null }) {\n const [open, setOpen] = useState(false);\n if (!metadata || Object.keys(metadata).length === 0) {\n return <span className=\"text-[11px] text-text-tertiary\">—</span>;\n }\n const keys = Object.keys(metadata);\n const preview = `${keys.slice(0, 2).join(', ')}${keys.length > 2 ? ` +${keys.length - 2}` : ''}`;\n // Width is fixed by the wrapper so toggling never changes the column width —\n // the JSON viewer reveals with an animated row-height transition, and long\n // lines scroll horizontally inside the cell rather than widening it.\n return (\n <div className=\"w-full\">\n <button\n onClick={(e) => { e.stopPropagation(); setOpen((v) => !v); }}\n className={`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${CELL_TEXT}`}\n title={open ? 'Collapse metadata' : 'Expand metadata'}\n >\n <ChevronRight className={`h-3 w-3 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`} />\n <span className=\"truncate\">{`{ ${preview} }`}</span>\n </button>\n <div\n className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'}`}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-1 overflow-x-auto\" onClick={(e) => e.stopPropagation()}>\n {/* defaultCollapsed → root expanded, nested objects collapsed (one level). */}\n <JsonViewer data={metadata} defaultCollapsed />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** Base columns shared by all escalation list pages. */\nexport const ESCALATION_COLUMNS: Column<LTEscalationRecord>[] = [\n {\n key: 'description',\n label: 'Summary',\n render: (row) => (\n <div className=\"flex items-center gap-2 overflow-hidden\">\n <span className=\"shrink-0\"><StatusDot row={row} /></span>\n <span className={`truncate text-xs ${CELL_TEXT}`}>{row.description || row.type}</span>\n </div>\n ),\n className: 'max-w-0',\n },\n {\n key: 'workflow_type',\n label: 'Workflow',\n // The workflow function name (e.g. `richForm`, `basicSignal`) lives in\n // workflow_type; `type` is the escalation category. Fall back to type for\n // standalone escalations with no workflow.\n render: (row) => <WorkflowPill type={row.workflow_type || row.type} />,\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'metadata',\n label: 'Metadata',\n render: (row) => <MetadataCell metadata={row.metadata} />,\n // Fixed width — never grows on expand (the viewer reveals via row-height).\n // Given extra room (borrowed from priority/ago/actions) so JSON wraps less.\n className: 'w-80 max-w-[19rem] align-top',\n },\n {\n key: 'role',\n label: 'Role',\n render: (row) => (\n <span className={CELL_TEXT}>\n <RolePill role={row.role} size=\"md\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-28',\n },\n {\n key: 'priority',\n label: 'Priority',\n render: (row) => (\n <span className={CELL_TEXT}>\n <PriorityBadge priority={row.priority} size=\"sm\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-14',\n sortable: true,\n },\n {\n key: 'created_time',\n label: 'Created',\n render: (row) => (\n <span className={`text-[11px] font-mono whitespace-nowrap ${CELL_TEXT}`} title={row.created_at}>\n {formatDateTime(row.created_at)}\n </span>\n ),\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'created_at',\n label: 'Ago',\n render: (row) => (\n <span className={`text-xs tabular-nums ${CELL_TEXT}`} title={row.created_at}>\n {formatAgoCompact(row.created_at)}\n </span>\n ),\n className: 'w-12 whitespace-nowrap',\n sortable: true,\n },\n];\n\n/** Time-remaining column for claimed escalations — aligns with checkbox column on All Escalations. */\nexport const TIME_LEFT_COLUMN: Column<LTEscalationRecord> = {\n key: 'expires',\n label: (<Clock className=\"w-3.5 h-3.5 text-text-tertiary\" />) as any,\n render: (row) =>\n row.assigned_until ? (\n <CountdownTimer until={row.assigned_until} />\n ) : (\n <span className=\"text-xs text-text-tertiary\">—</span>\n ),\n className: 'w-16 whitespace-nowrap',\n};\n\n/** Status icon column — color-coded filled circle, or bell for ACK/notification escalations. */\nexport const STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) => {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 fill-status-success text-status-success\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 fill-text-tertiary text-text-tertiary\" />;\n },\n className: 'w-8',\n};\n\n/** Claimed-only status icon (always orange, or bell for ACK). */\nexport const CLAIMED_STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) =>\n isAckEscalation(row)\n ? <Bell className=\"w-3 h-3 text-status-warning\" />\n : <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />,\n className: 'w-8',\n};\n\n/** Priority filter options shared by both pages. */\nexport const PRIORITY_OPTIONS = [\n { value: '1', label: 'P1' },\n { value: '2', label: 'P2' },\n { value: '3', label: 'P3' },\n { value: '4', label: 'P4' },\n];\n\n/** Status filter options for escalation list pages. `all` spans every status so a\n * metadata search (e.g. one order id) returns its escalations regardless of status. */\nexport const STATUS_OPTIONS = [\n { value: 'all', label: 'All' },\n { value: 'available', label: 'Available' },\n { value: 'claimed', label: 'Claimed' },\n { value: 'resolved', label: 'Resolved' },\n { value: 'cancelled', label: 'Cancelled' },\n { value: 'expired', label: 'Expired' },\n];\n\n/** Shared filter bar for escalation list pages. */\nexport function EscalationFilterBar({\n filters,\n setFilter,\n roles,\n types,\n showStatus = false,\n showSearch = true,\n actions,\n}: {\n filters: { role: string; type: string; priority: string; status?: string; search?: string };\n setFilter: (key: any, value: string) => void;\n roles: string[];\n types: string[];\n showStatus?: boolean;\n // Free-text search lives here by default, but the faceted page folds it into\n // the drawer instead so there's a single search surface.\n showSearch?: boolean;\n actions?: React.ReactNode;\n}) {\n return (\n <FilterBar actions={actions}>\n {showStatus && (\n <>\n <FilterSelect\n label=\"Status\"\n value={filters.status ?? ''}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n <FilterDivider />\n </>\n )}\n <FilterSelect\n label=\"Role\"\n value={filters.role}\n onChange={(v) => setFilter('role', v)}\n options={roles.map((r) => ({ value: r, label: r }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Type\"\n value={filters.type}\n onChange={(v) => setFilter('type', v)}\n options={types.map((t) => ({ value: t, label: t }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Priority\"\n value={filters.priority}\n onChange={(v) => setFilter('priority', v)}\n options={PRIORITY_OPTIONS}\n />\n {showSearch && (\n <>\n <FilterDivider />\n <FilterInput\n label=\"Search\"\n value={filters.search ?? ''}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"ID, workflow, origin…\"\n />\n </>\n )}\n </FilterBar>\n );\n}\n"],"names":["CELL_TEXT","StatusDot","row","isAckEscalation","color","jsx","Bell","Circle","isEffectivelyClaimed","MetadataCell","metadata","open","setOpen","useState","keys","preview","jsxs","e","v","ChevronRight","JsonViewer","ESCALATION_COLUMNS","WorkflowPill","RolePill","PriorityBadge","formatDateTime","formatAgoCompact","TIME_LEFT_COLUMN","Clock","CountdownTimer","PRIORITY_OPTIONS","STATUS_OPTIONS","EscalationFilterBar","filters","setFilter","roles","types","showStatus","showSearch","actions","FilterBar","Fragment","FilterSelect","FilterDivider","r","t","FilterInput"],"mappings":"ybAgBA,MAAMA,EAAY,0EAGlB,SAASC,EAAU,CAAE,IAAAC,GAAoC,CACvD,GAAIC,EAAgBD,CAAG,EAAG,CACxB,MAAME,EAAQF,EAAI,SAAW,WAAa,sBAAwB,qBAClE,OAAOG,EAAAA,IAACC,EAAA,CAAK,UAAW,oBAAoBF,CAAK,GAAI,CACvD,CACA,OAAIF,EAAI,SAAW,WACVG,EAAAA,IAACE,EAAA,CAAO,UAAU,8DAAA,CAA+D,EAEtFL,EAAI,S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EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDD,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,OACN,MAAOT,EAAQ,KACf,SAAWf,GAAMgB,EAAU,OAAQhB,CAAC,EACpC,QAASkB,EAAM,IAAKS,IAAO,CAAE,MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,QAEnDF,EAAA,EAAc,EACftC,EAAAA,IAACqC,EAAA,CACC,MAAM,WACN,MAAOT,EAAQ,SACf,SAAWf,GAAMgB,EAAU,WAAYhB,CAAC,EACxC,QAASY,CAAA,CAAA,EAEVQ,GACCtB,EAAAA,KAAAyB,WAAA,CACE,SAAA,CAAApC,EAAAA,IAACsC,EAAA,EAAc,EACftC,EAAAA,IAACyC,EAAA,CACC,MAAM,SACN,MAAOb,EAAQ,QAAU,GACzB,SAAWf,GAAMgB,EAAU,SAAUhB,CAAC,EACtC,YAAY,uBAAA,CAAA,CACd,CAAA,CACF,CAAA,EAEJ,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o,j as e}from"./vendor-query-B2UbickB.js";import{v as T}from"./index-D-7W2AHB.js";import{b as O,c as q,d as G,e as H,f as V,u as J}from"./users-BxKf5dAX.js";import{u as D}from"./useFilterParams-x-Dg0Vgz.js";import{D as F}from"./DataTable-ZWgVQg7F.js";import{S as K}from"./StickyPagination-t5B71hwd.js";import{F as Q,b as W}from"./FilterBar-BQ2JGg8U.js";import{T as M}from"./TimestampCell-CIxgN57O.js";import{C as R}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as I,a as k}from"./RowActions-BA9L9djf.js";import{P as $}from"./PageHeader-BhaWTWcM.js";import{R as A}from"./RolePill-Cl71eDUA.js";import{M as C}from"./Modal-CSrxpXeM.js";import{u as Y,a as X,b as Z,c as ee,d as te,e as se,f as ae,g as le,h as ne}from"./bots-CD8Bl5pL.js";import{u as z}from"./roles-BdtnzLsL.js";import{T as re}from"./TimeAgo-CSzifQXB.js";import{V as ie,Y as ce,ar as oe,p as U,l as de,ab as xe,Q as B,ah as me,U as L,b as pe}from"./vendor-icons-CEWCGPeJ.js";import{f as ue}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";function he({open:s,onClose:r}){const t=O(),[l,n]=o.useState({external_id:"",email:"",display_name:"",password:""}),[d,j]=o.useState(s);s!==d&&(j(s),s&&n({external_id:"",email:"",display_name:"",password:""}));const f=()=>{l.external_id.trim()&&t.mutate({external_id:l.external_id.trim(),email:l.email.trim()||void 0,display_name:l.display_name.trim()||void 0,password:l.password||void 0},{onSuccess:r})},m=(a,p)=>n(u=>({...u,[a]:p}));return e.jsx(C,{open:s,onClose:r,title:"Create User",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"External ID (required)"}),e.jsx("input",{type:"text",value:l.external_id,onChange:a=>m("external_id",a.target.value),placeholder:"e.g., john.doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:l.display_name,onChange:a=>m("display_name",a.target.value),placeholder:"John Doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:l.email,onChange:a=>m("email",a.target.value),placeholder:"john@example.com",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Password"}),e.jsx("input",{type:"password",value:l.password,onChange:a=>m("password",a.target.value),placeholder:"Leave blank for no password",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:!l.external_id.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function je({open:s,onClose:r,user:t}){const l=q(),[n,d]=o.useState({display_name:"",email:"",status:"active"}),[j,f]=o.useState(t);t!==j&&(f(t),t&&d({display_name:t.display_name??"",email:t.email??"",status:t.status}));const m=()=>{t&&l.mutate({id:t.id,display_name:n.display_name.trim()||void 0,email:n.email.trim()||void 0,status:n.status},{onSuccess:r})};return e.jsx(C,{open:s,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:a=>d(p=>({...p,display_name:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:n.email,onChange:a=>d(p=>({...p,email:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:n.status,onChange:a=>d(p=>({...p,status:a.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:l.isPending,className:"btn-primary text-xs",children:l.isPending?"Saving...":"Save"})]})]})})}function fe({open:s,onClose:r}){const t=Y(),[l,n]=o.useState({name:"",display_name:"",description:""}),[d,j]=o.useState(s);s!==d&&(j(s),s&&n({name:"",display_name:"",description:""}));const f=()=>{l.name.trim()&&t.mutate({name:l.name.trim(),display_name:l.display_name.trim()||void 0,description:l.description.trim()||void 0},{onSuccess:r})},m=(a,p)=>n(u=>({...u,[a]:p}));return e.jsx(C,{open:s,onClose:r,title:"Create Service Account",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Name (required)"}),e.jsx("input",{type:"text",value:l.name,onChange:a=>m("name",a.target.value.replace(/\s+/g,"-").toLowerCase()),placeholder:"e.g., ci-bot",className:"input text-xs w-full font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:l.display_name,onChange:a=>m("display_name",a.target.value),placeholder:"CI Bot",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:l.description,onChange:a=>m("description",a.target.value),placeholder:"Runs scheduled workflows",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:!l.name.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function ge({open:s,onClose:r,bot:t}){const l=X(),[n,d]=o.useState({display_name:"",description:"",status:"active"}),[j,f]=o.useState(t);t!==j&&(f(t),t&&d({display_name:t.display_name??"",description:t.description??"",status:t.status}));const m=()=>{t&&l.mutate({id:t.id,display_name:n.display_name.trim()||void 0,description:n.description.trim()||void 0,status:n.status},{onSuccess:r})};return e.jsx(C,{open:s,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:a=>d(p=>({...p,display_name:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:n.description,onChange:a=>d(p=>({...p,description:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:n.status,onChange:a=>d(p=>({...p,status:a.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:l.isPending,className:"btn-primary text-xs",children:l.isPending?"Saving...":"Save"})]})]})})}function ve({botId:s}){const{data:r}=Z(s),t=ee(),l=te(),[n,d]=o.useState(""),[j,f]=o.useState("read"),[m,a]=o.useState(null),[p,u]=o.useState(!1),[v,c]=o.useState(null),b=(r==null?void 0:r.keys)??[],i={read:{label:"Read only",scopes:["mcp:read"],hint:"Discovery and monitoring — read-safe tools only"},full:{label:"Full access",scopes:["mcp:read","mcp:full"],hint:"All tools — can modify state"}},y=()=>{n.trim()&&t.mutate({botId:s,name:n.trim(),scopes:i[j].scopes},{onSuccess:g=>{a(g.rawKey),d("")}})},N=()=>{m&&(navigator.clipboard.writeText(m),u(!0),setTimeout(()=>u(!1),2e3))},S=()=>{v&&l.mutate({botId:s,keyId:v.id},{onSuccess:()=>c(null)})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"API Keys"}),m&&e.jsxs("div",{className:"mb-3 p-3 bg-status-success/10 border border-status-success/30 rounded-md",children:[e.jsx("p",{className:"text-[10px] font-semibold text-status-success mb-1",children:"Key generated — copy now, it won't be shown again"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-[11px] font-mono text-text-primary bg-surface-sunken px-2 py-1 rounded flex-1 overflow-hidden text-ellipsis",children:m}),e.jsx("button",{onClick:N,className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Copy to clipboard",children:p?e.jsx(ie,{className:"w-3.5 h-3.5 text-status-success"}):e.jsx(ce,{className:"w-3.5 h-3.5"})})]})]}),b.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No API keys."}):e.jsx("div",{className:"space-y-1.5 mb-3",children:b.map(g=>e.jsxs("div",{className:"group/key flex items-center justify-between px-2.5 py-1.5 bg-surface-sunken rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(oe,{className:"w-3 h-3 text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-mono",children:g.name}),(g.scopes??[]).map(x=>e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${x.includes("full")?"bg-status-warning/15 text-status-warning":"bg-accent/10 text-accent"}`,children:x},x)),g.last_used_at&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["used ",e.jsx(re,{date:g.last_used_at})]})]}),e.jsx("button",{onClick:()=>c(g),className:"opacity-0 group-hover/key:opacity-100 transition-opacity text-text-tertiary hover:text-status-error",title:"Revoke key",children:e.jsx(U,{className:"w-3 h-3"})})]},g.id))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:n,onChange:g=>d(g.target.value),placeholder:"Key name...",className:"input text-xs flex-1 font-mono"}),e.jsx("div",{className:"flex rounded-md border border-surface-border overflow-hidden shrink-0",children:Object.entries(i).map(([g,x])=>e.jsx("button",{type:"button",onClick:()=>f(g),title:x.hint,className:`px-2.5 py-1 text-[10px] font-medium transition-colors ${j===g?"bg-accent text-white":"bg-surface text-text-secondary hover:bg-surface-hover"}`,children:x.label},g))}),e.jsxs("button",{onClick:y,disabled:!n.trim()||t.isPending,className:"btn-primary text-xs inline-flex items-center gap-1",children:[e.jsx(de,{className:"w-3 h-3"}),t.isPending?"...":"Generate"]})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message}),e.jsx(R,{open:!!v,onClose:()=>c(null),onConfirm:S,title:"Revoke API Key",description:e.jsxs(e.Fragment,{children:["Revoke API key"," ",e.jsx("span",{className:"font-medium text-text-primary font-mono",children:v==null?void 0:v.name}),"? This bot will no longer be able to authenticate with this key."]}),isPending:l.isPending,error:l.error})]})}function ye({bot:s}){const{data:r}=z(),t=se(),l=ae(),[n,d]=o.useState(""),[j,f]=o.useState("member"),m=(r==null?void 0:r.roles)??[],a=s.roles??[],p=o.useMemo(()=>{const c=new Set(a.map(b=>b.role));return m.filter(b=>!c.has(b))},[m,a]),u=()=>{n.trim()&&t.mutate({botId:s.id,role:n.trim(),type:j},{onSuccess:()=>{d(""),f("member")}})},v=c=>{l.mutate({botId:s.id,role:c})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"Roles"}),a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:a.map(c=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(A,{role:c.role}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:c.type}),e.jsx("button",{onClick:()=>v(c.role),className:"text-text-tertiary hover:text-status-error transition-colors ml-0.5",title:`Remove ${c.role}`,children:"×"})]},c.role))}),p.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:n,onChange:c=>d(c.target.value),className:"select text-xs font-mono flex-1",children:[e.jsx("option",{value:"",children:"Select a role..."}),p.map(c=>e.jsx("option",{value:c,children:c},c))]}),e.jsxs("select",{value:j,onChange:c=>f(c.target.value),className:"select text-xs w-24",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]}),e.jsx("button",{onClick:u,disabled:!n||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add"})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message})]})}function be({bot:s}){return s?e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:s.display_name||s.external_id}),s.description&&e.jsx("p",{className:"text-xs text-text-tertiary mt-0.5",children:s.description})]}),e.jsx(ve,{botId:s.id}),e.jsx(ye,{bot:s})]}):e.jsx("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a service account to manage its API keys and roles."})})}const Ne={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function we({embedded:s=!1}){const{pagination:r}=D({filters:{}}),t=le(),[l,n]=o.useState(!1),[d,j]=o.useState(null),[f,m]=o.useState(null),[a,p]=o.useState(null),[u,v]=o.useState(""),{data:c,isLoading:b}=ne({limit:r.pageSize,offset:r.offset}),i=(c==null?void 0:c.total)??0,y=(c==null?void 0:c.bots)??[],N=o.useMemo(()=>f?y.find(h=>h.id===f.id)??f:null,[y,f]),S=o.useMemo(()=>{if(!u.trim())return y;const h=u.toLowerCase();return y.filter(w=>(w.display_name??"").toLowerCase().includes(h)||w.external_id.toLowerCase().includes(h)||(w.description??"").toLowerCase().includes(h))},[y,u]),g=[{key:"display_name",label:"Service Account",render:h=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Ne[h.status]??"bg-status-pending"}`,title:h.status}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:h.display_name||h.external_id}),h.description&&e.jsx("p",{className:"text-xs text-text-tertiary",children:h.description})]})]})},{key:"roles",label:"Roles",render:h=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(h.roles??[]).map(w=>e.jsx(A,{role:w.role},w.role))})},{key:"created_at",label:"Created",render:h=>e.jsx(M,{date:h.created_at}),className:"w-44"},{key:"actions",label:"",render:h=>e.jsxs(I,{children:[e.jsx(k,{icon:B,title:"Edit service account",onClick:()=>j(h)}),e.jsx(k,{icon:U,title:"Delete service account",onClick:()=>p(h),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}],x=()=>{a&&t.mutate(a.id,{onSuccess:()=>{p(null),(f==null?void 0:f.id)===a.id&&m(null)}})};return e.jsxs("div",{children:[s?e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>n(!0),className:"btn-primary text-xs",children:"Add Service Account"})}):e.jsx($,{title:"Service Accounts",actions:e.jsx("button",{onClick:()=>n(!0),className:"btn-primary text-xs",children:"Add Service Account"})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx("div",{className:"sticky top-0 z-20 bg-surface pt-3 pb-3",children:e.jsx("div",{className:"bg-[#F7F7F7] rounded-lg px-5 py-2",children:e.jsxs("div",{className:"relative w-1/2",children:[e.jsx(xe,{className:"absolute left-0 top-1/2 -translate-y-1/2 w-3 h-3 text-text-quaternary"}),e.jsx("input",{type:"text",value:u,onChange:h=>v(h.target.value),placeholder:`Search ${y.length} service accounts…`,className:"w-full pl-5 py-1 text-sm bg-transparent border-b border-surface-border/60 text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-accent/50 transition-colors"})]})})}),e.jsx(F,{columns:g,data:S,keyFn:h=>h.id,isLoading:b,emptyMessage:"No service accounts yet",onRowClick:h=>m(h),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(K,{page:r.page,totalPages:r.totalPages(i),onPageChange:r.setPage,total:i,pageSize:r.pageSize,onPageSizeChange:r.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(be,{bot:N})})]}),e.jsx(fe,{open:l,onClose:()=>n(!1)}),e.jsx(ge,{open:!!d,onClose:()=>j(null),bot:d}),e.jsx(R,{open:!!a,onClose:()=>p(null),onConfirm:x,title:"Delete Service Account",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(a==null?void 0:a.display_name)||(a==null?void 0:a.external_id)}),"? This will also revoke all API keys. This action cannot be undone."]}),isPending:t.isPending,error:t.error})]})}const Se={self:"Self",all:"All"},ke={none:"None",self:"Self",all:"All"};function Ce({read:s,write:r,className:t=""}){return e.jsxs("span",{className:`inline-flex items-center gap-2.5 text-[10px] text-text-tertiary ${t}`,children:[e.jsxs("span",{className:"inline-flex items-center gap-1",title:"Can see",children:[e.jsx(me,{className:"w-3 h-3 shrink-0 opacity-70"}),e.jsx("span",{className:"w-7",children:Se[s]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",title:"Can act on",children:[e.jsx(B,{className:"w-3 h-3 shrink-0 opacity-70"}),e.jsx("span",{className:"w-7",children:ke[r]})]})]})}const P=[{value:"all|all",label:"See all · act on all",read_scope:"all",write_scope:"all"},{value:"all|self",label:"See all · act on self",read_scope:"all",write_scope:"self"},{value:"self|self",label:"See self · act on self",read_scope:"self",write_scope:"self"},{value:"all|none",label:"See all · read-only",read_scope:"all",write_scope:"none"},{value:"self|none",label:"See self · read-only",read_scope:"self",write_scope:"none"}],_="all|all";function E(s){return P.find(r=>r.value===s)??P[0]}function _e({user:s}){const{data:r}=z(),t=G(),l=H(),[n,d]=o.useState(""),[j,f]=o.useState("member"),[m,a]=o.useState(_),p=(r==null?void 0:r.roles)??[],u=(s==null?void 0:s.roles)??[],v=o.useMemo(()=>{const i=new Set(u.map(y=>y.role));return p.filter(y=>!i.has(y))},[p,u]),c=()=>{if(!s||!n.trim())return;const i=E(j==="member"?m:_);t.mutate({userId:s.id,role:n.trim(),type:j,read_scope:i.read_scope,write_scope:i.write_scope},{onSuccess:()=>{d(""),f("member"),a(_)}})},b=i=>{s&&l.mutate({userId:s.id,role:i})};return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Role Membership"}),s?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:s.display_name||s.external_id}),e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:"Member of:"})]}),u.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-col gap-2 items-start",children:u.map(i=>e.jsxs("span",{className:"flex items-center gap-2.5 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 w-24 shrink-0 min-w-0",children:[e.jsx(L,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),e.jsx("span",{className:"truncate",title:i.role,children:i.role})]}),e.jsx("span",{className:"w-14 shrink-0 text-[9px] uppercase tracking-wide text-text-tertiary",children:i.type}),i.type==="member"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-px h-3 bg-surface-border shrink-0","aria-hidden":!0}),e.jsx(Ce,{read:i.read_scope,write:i.write_scope})]}),e.jsx("button",{onClick:()=>b(i.role),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Remove ${i.role}`,children:"×"})]},i.role))}),v.length>0&&e.jsxs("div",{className:"pt-3 border-t border-surface-border",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Add Role"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:n,onChange:i=>d(i.target.value),className:"select text-xs font-mono flex-1","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),v.map(i=>e.jsx("option",{value:i,children:i},i))]}),e.jsxs("select",{value:j,onChange:i=>f(i.target.value),className:"select text-xs w-24","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]}),e.jsx("button",{onClick:c,disabled:!n||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add"})]}),j==="member"&&e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"block text-[10px] text-text-tertiary mb-1",children:"Scope"}),e.jsx("select",{value:m,onChange:i=>a(i.target.value),className:"select text-xs w-full","aria-label":"Work-surface scope",children:P.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message})]})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a user to manage their roles."})]})}function Pe({active:s,onChange:r}){const t=(l,n,d)=>e.jsxs("button",{onClick:()=>r(l),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${s===l?"bg-accent/10 text-accent font-medium":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[n,d]});return e.jsxs("div",{className:"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit",children:[t("users",e.jsx(L,{className:"w-3.5 h-3.5"}),"User Accounts"),t("service-accounts",e.jsx(pe,{className:"w-3.5 h-3.5"}),"Service Accounts")]})}const Re=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}],Ae={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function Ye(){const{isBuilder:s}=T(),[r,t]=ue(),l=r.get("tab"),n=s&&l==="service-accounts"?"service-accounts":"users",d=j=>{t(j==="users"?{}:{tab:j})};return e.jsxs("div",{children:[e.jsx($,{title:"Accounts",docsHash:"#docs:dashboard.md:accounts",actions:s?e.jsx(Pe,{active:n,onChange:d}):void 0}),n==="users"?e.jsx(Ue,{}):e.jsx(we,{embedded:!0})]})}function Ue(){const{isBuilder:s}=T(),{filters:r,setFilter:t,pagination:l}=D({filters:{status:""}}),n=V(),[d,j]=o.useState(!1),[f,m]=o.useState(null),[a,p]=o.useState(null),[u,v]=o.useState(null),{data:c,isLoading:b}=J({status:r.status||void 0,limit:l.pageSize,offset:l.offset}),i=(c==null?void 0:c.total)??0,y=(c==null?void 0:c.users)??[],N=o.useMemo(()=>a?y.find(x=>x.id===a.id)??a:null,[y,a]),S=[{key:"display_name",label:"User",render:x=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Ae[x.status]??"bg-status-pending"}`,title:x.status}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:x.display_name||x.external_id}),x.email&&e.jsx("p",{className:"text-xs text-text-tertiary",children:x.email})]})]})},{key:"roles",label:"Roles",render:x=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(x.roles??[]).map(h=>e.jsx(A,{role:h.role},h.role))})},{key:"created_at",label:"Created",render:x=>e.jsx(M,{date:x.created_at}),className:"w-44"},...s?[{key:"actions",label:"",render:x=>e.jsxs(I,{children:[e.jsx(k,{icon:B,title:"Edit user",onClick:()=>m(x)}),e.jsx(k,{icon:U,title:"Delete user",onClick:()=>v(x),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}]:[]],g=()=>{u&&n.mutate(u.id,{onSuccess:()=>v(null)})};return e.jsxs("div",{children:[s&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>j(!0),className:"btn-primary text-xs",children:"Add User"})}),e.jsx(Q,{children:e.jsx(W,{label:"Status",value:r.status,onChange:x=>t("status",x),options:Re})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(F,{columns:S,data:y,keyFn:x=>x.id,isLoading:b,emptyMessage:"No users found",onRowClick:x=>p(x),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(K,{page:l.page,totalPages:l.totalPages(i),onPageChange:l.setPage,total:i,pageSize:l.pageSize,onPageSizeChange:l.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(_e,{user:N})})]}),e.jsx(he,{open:d,onClose:()=>j(!1)}),e.jsx(je,{open:!!f,onClose:()=>m(null),user:f}),e.jsx(R,{open:!!u,onClose:()=>v(null),onConfirm:g,title:"Delete User",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(u==null?void 0:u.display_name)||(u==null?void 0:u.external_id)}),"? This action cannot be undone."]}),isPending:n.isPending,error:n.error})]})}export{Ye as UsersPage};
|
|
2
|
-
//# sourceMappingURL=index
|
|
1
|
+
import{a as o,j as e}from"./vendor-query-B2UbickB.js";import{v as T}from"./index-Dgw1KKpq.js";import{b as O,c as q,d as G,e as H,f as V,u as J}from"./users-C0WV36X8.js";import{u as D}from"./useFilterParams-x-Dg0Vgz.js";import{D as F}from"./DataTable-ZWgVQg7F.js";import{S as K}from"./StickyPagination-D8XuMSWD.js";import{F as Q,b as W}from"./FilterBar-BQ2JGg8U.js";import{T as M}from"./TimestampCell-7G0echgP.js";import{C as R}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as I,a as k}from"./RowActions-BA9L9djf.js";import{P as $}from"./PageHeader-BhaWTWcM.js";import{R as A}from"./RolePill-Cl71eDUA.js";import{M as C}from"./Modal-CSrxpXeM.js";import{u as Y,a as X,b as Z,c as ee,d as te,e as se,f as ae,g as le,h as ne}from"./bots-Cb0WTwhY.js";import{u as z}from"./roles-CFD2eYap.js";import{T as re}from"./TimeAgo-D1K7xKq5.js";import{V as ie,Y as ce,ar as oe,p as U,l as de,ab as xe,Q as B,ah as me,U as L,b as pe}from"./vendor-icons-CEWCGPeJ.js";import{f as ue}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";function he({open:s,onClose:r}){const t=O(),[l,n]=o.useState({external_id:"",email:"",display_name:"",password:""}),[d,j]=o.useState(s);s!==d&&(j(s),s&&n({external_id:"",email:"",display_name:"",password:""}));const f=()=>{l.external_id.trim()&&t.mutate({external_id:l.external_id.trim(),email:l.email.trim()||void 0,display_name:l.display_name.trim()||void 0,password:l.password||void 0},{onSuccess:r})},m=(a,p)=>n(u=>({...u,[a]:p}));return e.jsx(C,{open:s,onClose:r,title:"Create User",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"External ID (required)"}),e.jsx("input",{type:"text",value:l.external_id,onChange:a=>m("external_id",a.target.value),placeholder:"e.g., john.doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:l.display_name,onChange:a=>m("display_name",a.target.value),placeholder:"John Doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:l.email,onChange:a=>m("email",a.target.value),placeholder:"john@example.com",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Password"}),e.jsx("input",{type:"password",value:l.password,onChange:a=>m("password",a.target.value),placeholder:"Leave blank for no password",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:!l.external_id.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function je({open:s,onClose:r,user:t}){const l=q(),[n,d]=o.useState({display_name:"",email:"",status:"active"}),[j,f]=o.useState(t);t!==j&&(f(t),t&&d({display_name:t.display_name??"",email:t.email??"",status:t.status}));const m=()=>{t&&l.mutate({id:t.id,display_name:n.display_name.trim()||void 0,email:n.email.trim()||void 0,status:n.status},{onSuccess:r})};return e.jsx(C,{open:s,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:a=>d(p=>({...p,display_name:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:n.email,onChange:a=>d(p=>({...p,email:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:n.status,onChange:a=>d(p=>({...p,status:a.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:l.isPending,className:"btn-primary text-xs",children:l.isPending?"Saving...":"Save"})]})]})})}function fe({open:s,onClose:r}){const t=Y(),[l,n]=o.useState({name:"",display_name:"",description:""}),[d,j]=o.useState(s);s!==d&&(j(s),s&&n({name:"",display_name:"",description:""}));const f=()=>{l.name.trim()&&t.mutate({name:l.name.trim(),display_name:l.display_name.trim()||void 0,description:l.description.trim()||void 0},{onSuccess:r})},m=(a,p)=>n(u=>({...u,[a]:p}));return e.jsx(C,{open:s,onClose:r,title:"Create Service Account",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Name (required)"}),e.jsx("input",{type:"text",value:l.name,onChange:a=>m("name",a.target.value.replace(/\s+/g,"-").toLowerCase()),placeholder:"e.g., ci-bot",className:"input text-xs w-full font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:l.display_name,onChange:a=>m("display_name",a.target.value),placeholder:"CI Bot",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:l.description,onChange:a=>m("description",a.target.value),placeholder:"Runs scheduled workflows",className:"input text-xs w-full"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:f,disabled:!l.name.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function ge({open:s,onClose:r,bot:t}){const l=X(),[n,d]=o.useState({display_name:"",description:"",status:"active"}),[j,f]=o.useState(t);t!==j&&(f(t),t&&d({display_name:t.display_name??"",description:t.description??"",status:t.status}));const m=()=>{t&&l.mutate({id:t.id,display_name:n.display_name.trim()||void 0,description:n.description.trim()||void 0,status:n.status},{onSuccess:r})};return e.jsx(C,{open:s,onClose:r,title:`Edit — ${(t==null?void 0:t.display_name)||(t==null?void 0:t.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:n.display_name,onChange:a=>d(p=>({...p,display_name:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:n.description,onChange:a=>d(p=>({...p,description:a.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:n.status,onChange:a=>d(p=>({...p,status:a.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error",children:l.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:l.isPending,className:"btn-primary text-xs",children:l.isPending?"Saving...":"Save"})]})]})})}function ve({botId:s}){const{data:r}=Z(s),t=ee(),l=te(),[n,d]=o.useState(""),[j,f]=o.useState("read"),[m,a]=o.useState(null),[p,u]=o.useState(!1),[v,c]=o.useState(null),b=(r==null?void 0:r.keys)??[],i={read:{label:"Read only",scopes:["mcp:read"],hint:"Discovery and monitoring — read-safe tools only"},full:{label:"Full access",scopes:["mcp:read","mcp:full"],hint:"All tools — can modify state"}},y=()=>{n.trim()&&t.mutate({botId:s,name:n.trim(),scopes:i[j].scopes},{onSuccess:g=>{a(g.rawKey),d("")}})},N=()=>{m&&(navigator.clipboard.writeText(m),u(!0),setTimeout(()=>u(!1),2e3))},S=()=>{v&&l.mutate({botId:s,keyId:v.id},{onSuccess:()=>c(null)})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"API Keys"}),m&&e.jsxs("div",{className:"mb-3 p-3 bg-status-success/10 border border-status-success/30 rounded-md",children:[e.jsx("p",{className:"text-[10px] font-semibold text-status-success mb-1",children:"Key generated — copy now, it won't be shown again"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-[11px] font-mono text-text-primary bg-surface-sunken px-2 py-1 rounded flex-1 overflow-hidden text-ellipsis",children:m}),e.jsx("button",{onClick:N,className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Copy to clipboard",children:p?e.jsx(ie,{className:"w-3.5 h-3.5 text-status-success"}):e.jsx(ce,{className:"w-3.5 h-3.5"})})]})]}),b.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No API keys."}):e.jsx("div",{className:"space-y-1.5 mb-3",children:b.map(g=>e.jsxs("div",{className:"group/key flex items-center justify-between px-2.5 py-1.5 bg-surface-sunken rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(oe,{className:"w-3 h-3 text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-mono",children:g.name}),(g.scopes??[]).map(x=>e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-mono ${x.includes("full")?"bg-status-warning/15 text-status-warning":"bg-accent/10 text-accent"}`,children:x},x)),g.last_used_at&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["used ",e.jsx(re,{date:g.last_used_at})]})]}),e.jsx("button",{onClick:()=>c(g),className:"opacity-0 group-hover/key:opacity-100 transition-opacity text-text-tertiary hover:text-status-error",title:"Revoke key",children:e.jsx(U,{className:"w-3 h-3"})})]},g.id))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:n,onChange:g=>d(g.target.value),placeholder:"Key name...",className:"input text-xs flex-1 font-mono"}),e.jsx("div",{className:"flex rounded-md border border-surface-border overflow-hidden shrink-0",children:Object.entries(i).map(([g,x])=>e.jsx("button",{type:"button",onClick:()=>f(g),title:x.hint,className:`px-2.5 py-1 text-[10px] font-medium transition-colors ${j===g?"bg-accent text-white":"bg-surface text-text-secondary hover:bg-surface-hover"}`,children:x.label},g))}),e.jsxs("button",{onClick:y,disabled:!n.trim()||t.isPending,className:"btn-primary text-xs inline-flex items-center gap-1",children:[e.jsx(de,{className:"w-3 h-3"}),t.isPending?"...":"Generate"]})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message}),e.jsx(R,{open:!!v,onClose:()=>c(null),onConfirm:S,title:"Revoke API Key",description:e.jsxs(e.Fragment,{children:["Revoke API key"," ",e.jsx("span",{className:"font-medium text-text-primary font-mono",children:v==null?void 0:v.name}),"? This bot will no longer be able to authenticate with this key."]}),isPending:l.isPending,error:l.error})]})}function ye({bot:s}){const{data:r}=z(),t=se(),l=ae(),[n,d]=o.useState(""),[j,f]=o.useState("member"),m=(r==null?void 0:r.roles)??[],a=s.roles??[],p=o.useMemo(()=>{const c=new Set(a.map(b=>b.role));return m.filter(b=>!c.has(b))},[m,a]),u=()=>{n.trim()&&t.mutate({botId:s.id,role:n.trim(),type:j},{onSuccess:()=>{d(""),f("member")}})},v=c=>{l.mutate({botId:s.id,role:c})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"Roles"}),a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:a.map(c=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(A,{role:c.role}),e.jsx("span",{className:"text-[9px] text-text-tertiary",children:c.type}),e.jsx("button",{onClick:()=>v(c.role),className:"text-text-tertiary hover:text-status-error transition-colors ml-0.5",title:`Remove ${c.role}`,children:"×"})]},c.role))}),p.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:n,onChange:c=>d(c.target.value),className:"select text-xs font-mono flex-1",children:[e.jsx("option",{value:"",children:"Select a role..."}),p.map(c=>e.jsx("option",{value:c,children:c},c))]}),e.jsxs("select",{value:j,onChange:c=>f(c.target.value),className:"select text-xs w-24",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]}),e.jsx("button",{onClick:u,disabled:!n||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add"})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message})]})}function be({bot:s}){return s?e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:s.display_name||s.external_id}),s.description&&e.jsx("p",{className:"text-xs text-text-tertiary mt-0.5",children:s.description})]}),e.jsx(ve,{botId:s.id}),e.jsx(ye,{bot:s})]}):e.jsx("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a service account to manage its API keys and roles."})})}const Ne={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function we({embedded:s=!1}){const{pagination:r}=D({filters:{}}),t=le(),[l,n]=o.useState(!1),[d,j]=o.useState(null),[f,m]=o.useState(null),[a,p]=o.useState(null),[u,v]=o.useState(""),{data:c,isLoading:b}=ne({limit:r.pageSize,offset:r.offset}),i=(c==null?void 0:c.total)??0,y=(c==null?void 0:c.bots)??[],N=o.useMemo(()=>f?y.find(h=>h.id===f.id)??f:null,[y,f]),S=o.useMemo(()=>{if(!u.trim())return y;const h=u.toLowerCase();return y.filter(w=>(w.display_name??"").toLowerCase().includes(h)||w.external_id.toLowerCase().includes(h)||(w.description??"").toLowerCase().includes(h))},[y,u]),g=[{key:"display_name",label:"Service Account",render:h=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Ne[h.status]??"bg-status-pending"}`,title:h.status}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:h.display_name||h.external_id}),h.description&&e.jsx("p",{className:"text-xs text-text-tertiary",children:h.description})]})]})},{key:"roles",label:"Roles",render:h=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(h.roles??[]).map(w=>e.jsx(A,{role:w.role},w.role))})},{key:"created_at",label:"Created",render:h=>e.jsx(M,{date:h.created_at}),className:"w-44"},{key:"actions",label:"",render:h=>e.jsxs(I,{children:[e.jsx(k,{icon:B,title:"Edit service account",onClick:()=>j(h)}),e.jsx(k,{icon:U,title:"Delete service account",onClick:()=>p(h),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}],x=()=>{a&&t.mutate(a.id,{onSuccess:()=>{p(null),(f==null?void 0:f.id)===a.id&&m(null)}})};return e.jsxs("div",{children:[s?e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>n(!0),className:"btn-primary text-xs",children:"Add Service Account"})}):e.jsx($,{title:"Service Accounts",actions:e.jsx("button",{onClick:()=>n(!0),className:"btn-primary text-xs",children:"Add Service Account"})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx("div",{className:"sticky top-0 z-20 bg-surface pt-3 pb-3",children:e.jsx("div",{className:"bg-[#F7F7F7] rounded-lg px-5 py-2",children:e.jsxs("div",{className:"relative w-1/2",children:[e.jsx(xe,{className:"absolute left-0 top-1/2 -translate-y-1/2 w-3 h-3 text-text-quaternary"}),e.jsx("input",{type:"text",value:u,onChange:h=>v(h.target.value),placeholder:`Search ${y.length} service accounts…`,className:"w-full pl-5 py-1 text-sm bg-transparent border-b border-surface-border/60 text-text-primary placeholder:text-text-quaternary focus:outline-none focus:border-accent/50 transition-colors"})]})})}),e.jsx(F,{columns:g,data:S,keyFn:h=>h.id,isLoading:b,emptyMessage:"No service accounts yet",onRowClick:h=>m(h),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(K,{page:r.page,totalPages:r.totalPages(i),onPageChange:r.setPage,total:i,pageSize:r.pageSize,onPageSizeChange:r.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(be,{bot:N})})]}),e.jsx(fe,{open:l,onClose:()=>n(!1)}),e.jsx(ge,{open:!!d,onClose:()=>j(null),bot:d}),e.jsx(R,{open:!!a,onClose:()=>p(null),onConfirm:x,title:"Delete Service Account",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(a==null?void 0:a.display_name)||(a==null?void 0:a.external_id)}),"? This will also revoke all API keys. This action cannot be undone."]}),isPending:t.isPending,error:t.error})]})}const Se={self:"Self",all:"All"},ke={none:"None",self:"Self",all:"All"};function Ce({read:s,write:r,className:t=""}){return e.jsxs("span",{className:`inline-flex items-center gap-2.5 text-[10px] text-text-tertiary ${t}`,children:[e.jsxs("span",{className:"inline-flex items-center gap-1",title:"Can see",children:[e.jsx(me,{className:"w-3 h-3 shrink-0 opacity-70"}),e.jsx("span",{className:"w-7",children:Se[s]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",title:"Can act on",children:[e.jsx(B,{className:"w-3 h-3 shrink-0 opacity-70"}),e.jsx("span",{className:"w-7",children:ke[r]})]})]})}const P=[{value:"all|all",label:"See all · act on all",read_scope:"all",write_scope:"all"},{value:"all|self",label:"See all · act on self",read_scope:"all",write_scope:"self"},{value:"self|self",label:"See self · act on self",read_scope:"self",write_scope:"self"},{value:"all|none",label:"See all · read-only",read_scope:"all",write_scope:"none"},{value:"self|none",label:"See self · read-only",read_scope:"self",write_scope:"none"}],_="all|all";function E(s){return P.find(r=>r.value===s)??P[0]}function _e({user:s}){const{data:r}=z(),t=G(),l=H(),[n,d]=o.useState(""),[j,f]=o.useState("member"),[m,a]=o.useState(_),p=(r==null?void 0:r.roles)??[],u=(s==null?void 0:s.roles)??[],v=o.useMemo(()=>{const i=new Set(u.map(y=>y.role));return p.filter(y=>!i.has(y))},[p,u]),c=()=>{if(!s||!n.trim())return;const i=E(j==="member"?m:_);t.mutate({userId:s.id,role:n.trim(),type:j,read_scope:i.read_scope,write_scope:i.write_scope},{onSuccess:()=>{d(""),f("member"),a(_)}})},b=i=>{s&&l.mutate({userId:s.id,role:i})};return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Role Membership"}),s?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:s.display_name||s.external_id}),e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:"Member of:"})]}),u.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-col gap-2 items-start",children:u.map(i=>e.jsxs("span",{className:"flex items-center gap-2.5 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 w-24 shrink-0 min-w-0",children:[e.jsx(L,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),e.jsx("span",{className:"truncate",title:i.role,children:i.role})]}),e.jsx("span",{className:"w-14 shrink-0 text-[9px] uppercase tracking-wide text-text-tertiary",children:i.type}),i.type==="member"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-px h-3 bg-surface-border shrink-0","aria-hidden":!0}),e.jsx(Ce,{read:i.read_scope,write:i.write_scope})]}),e.jsx("button",{onClick:()=>b(i.role),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Remove ${i.role}`,children:"×"})]},i.role))}),v.length>0&&e.jsxs("div",{className:"pt-3 border-t border-surface-border",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Add Role"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:n,onChange:i=>d(i.target.value),className:"select text-xs font-mono flex-1","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),v.map(i=>e.jsx("option",{value:i,children:i},i))]}),e.jsxs("select",{value:j,onChange:i=>f(i.target.value),className:"select text-xs w-24","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]}),e.jsx("button",{onClick:c,disabled:!n||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Add"})]}),j==="member"&&e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"block text-[10px] text-text-tertiary mb-1",children:"Scope"}),e.jsx("select",{value:m,onChange:i=>a(i.target.value),className:"select text-xs w-full","aria-label":"Work-surface scope",children:P.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]}),t.error&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:t.error.message})]})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a user to manage their roles."})]})}function Pe({active:s,onChange:r}){const t=(l,n,d)=>e.jsxs("button",{onClick:()=>r(l),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors ${s===l?"bg-accent/10 text-accent font-medium":"text-text-tertiary hover:text-text-secondary hover:bg-surface-hover"}`,children:[n,d]});return e.jsxs("div",{className:"flex gap-1 p-0.5 bg-surface-sunken rounded-lg w-fit",children:[t("users",e.jsx(L,{className:"w-3.5 h-3.5"}),"User Accounts"),t("service-accounts",e.jsx(pe,{className:"w-3.5 h-3.5"}),"Service Accounts")]})}const Re=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}],Ae={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function Ye(){const{isBuilder:s}=T(),[r,t]=ue(),l=r.get("tab"),n=s&&l==="service-accounts"?"service-accounts":"users",d=j=>{t(j==="users"?{}:{tab:j})};return e.jsxs("div",{children:[e.jsx($,{title:"Accounts",docsHash:"#docs:dashboard.md:accounts",actions:s?e.jsx(Pe,{active:n,onChange:d}):void 0}),n==="users"?e.jsx(Ue,{}):e.jsx(we,{embedded:!0})]})}function Ue(){const{isBuilder:s}=T(),{filters:r,setFilter:t,pagination:l}=D({filters:{status:""}}),n=V(),[d,j]=o.useState(!1),[f,m]=o.useState(null),[a,p]=o.useState(null),[u,v]=o.useState(null),{data:c,isLoading:b}=J({status:r.status||void 0,limit:l.pageSize,offset:l.offset}),i=(c==null?void 0:c.total)??0,y=(c==null?void 0:c.users)??[],N=o.useMemo(()=>a?y.find(x=>x.id===a.id)??a:null,[y,a]),S=[{key:"display_name",label:"User",render:x=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Ae[x.status]??"bg-status-pending"}`,title:x.status}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:x.display_name||x.external_id}),x.email&&e.jsx("p",{className:"text-xs text-text-tertiary",children:x.email})]})]})},{key:"roles",label:"Roles",render:x=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(x.roles??[]).map(h=>e.jsx(A,{role:h.role},h.role))})},{key:"created_at",label:"Created",render:x=>e.jsx(M,{date:x.created_at}),className:"w-44"},...s?[{key:"actions",label:"",render:x=>e.jsxs(I,{children:[e.jsx(k,{icon:B,title:"Edit user",onClick:()=>m(x)}),e.jsx(k,{icon:U,title:"Delete user",onClick:()=>v(x),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}]:[]],g=()=>{u&&n.mutate(u.id,{onSuccess:()=>v(null)})};return e.jsxs("div",{children:[s&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>j(!0),className:"btn-primary text-xs",children:"Add User"})}),e.jsx(Q,{children:e.jsx(W,{label:"Status",value:r.status,onChange:x=>t("status",x),options:Re})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(F,{columns:S,data:y,keyFn:x=>x.id,isLoading:b,emptyMessage:"No users found",onRowClick:x=>p(x),activeRowKey:(N==null?void 0:N.id)??null}),e.jsx(K,{page:l.page,totalPages:l.totalPages(i),onPageChange:l.setPage,total:i,pageSize:l.pageSize,onPageSizeChange:l.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(_e,{user:N})})]}),e.jsx(he,{open:d,onClose:()=>j(!1)}),e.jsx(je,{open:!!f,onClose:()=>m(null),user:f}),e.jsx(R,{open:!!u,onClose:()=>v(null),onConfirm:g,title:"Delete User",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(u==null?void 0:u.display_name)||(u==null?void 0:u.external_id)}),"? This action cannot be undone."]}),isPending:n.isPending,error:n.error})]})}export{Ye as UsersPage};
|
|
2
|
+
//# sourceMappingURL=index--WeZDfeN.js.map
|