@invect/ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/Invect-CWpIwZ5F.js +92738 -0
- package/dist/Invect.d.ts +25 -0
- package/dist/InvectShell.d.ts +14 -0
- package/dist/api/agent-tools.api.d.ts +1 -0
- package/dist/api/client.d.ts +207 -0
- package/dist/api/credentials.api.d.ts +47 -0
- package/dist/api/executions.api.d.ts +43 -0
- package/dist/api/flows.api.d.ts +100 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/node-data.api.d.ts +66 -0
- package/dist/api/query-keys.d.ts +22 -0
- package/dist/api/triggers.api.d.ts +44 -0
- package/dist/api/types.d.ts +147 -0
- package/dist/api/use-flow-run-stream.d.ts +12 -0
- package/dist/assets/invect-branding.d.ts +4 -0
- package/dist/assets/provider-icons/index.d.ts +8 -0
- package/dist/babel-C9OtljFZ.js +9721 -0
- package/dist/components/PageLayout.d.ts +17 -0
- package/dist/components/chat/ChatInput.d.ts +17 -0
- package/dist/components/chat/ChatMessageList.d.ts +14 -0
- package/dist/components/chat/ChatModelSelector.d.ts +11 -0
- package/dist/components/chat/ChatPanel.d.ts +19 -0
- package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
- package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
- package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
- package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
- package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
- package/dist/components/chat/chat-memory.d.ts +21 -0
- package/dist/components/chat/chat.store.d.ts +416 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/use-chat.d.ts +28 -0
- package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
- package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
- package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
- package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
- package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
- package/dist/components/credentials/credential-utils.d.ts +12 -0
- package/dist/components/credentials/index.d.ts +9 -0
- package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
- package/dist/components/dashboard/FlowCard.d.ts +7 -0
- package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
- package/dist/components/dashboard/StatCard.d.ts +10 -0
- package/dist/components/dashboard/index.d.ts +5 -0
- package/dist/components/dashboard/status-helpers.d.ts +5 -0
- package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
- package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
- package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
- package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
- package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
- package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
- package/dist/components/flow-editor/RunControls.d.ts +12 -0
- package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
- package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
- package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
- package/dist/components/flow-editor/index.d.ts +6 -0
- package/dist/components/flow-editor/inline-edit.d.ts +10 -0
- package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
- package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
- package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
- package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
- package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
- package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
- package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
- package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
- package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
- package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
- package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
- package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
- package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
- package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
- package/dist/components/flow-runs-table/index.d.ts +1 -0
- package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
- package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
- package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
- package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
- package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
- package/dist/components/flow-viewer/index.d.ts +1 -0
- package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
- package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
- package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
- package/dist/components/graph/LayoutSelector.d.ts +9 -0
- package/dist/components/graph/index.d.ts +47 -0
- package/dist/components/graph/styleUtils.d.ts +124 -0
- package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
- package/dist/components/nodes/AgentNode.d.ts +8 -0
- package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
- package/dist/components/nodes/NodeAppendix.d.ts +19 -0
- package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
- package/dist/components/nodes/NodeViewContext.d.ts +18 -0
- package/dist/components/nodes/ToolParamField.d.ts +28 -0
- package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
- package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
- package/dist/components/nodes/UniversalNode.d.ts +2 -0
- package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
- package/dist/components/nodes/index.d.ts +22 -0
- package/dist/components/nodes/nodeRegistry.d.ts +13 -0
- package/dist/components/nodes/withNodeContext.d.ts +7 -0
- package/dist/components/shared/InvectLoader.d.ts +8 -0
- package/dist/components/shared/InvectLogo.d.ts +9 -0
- package/dist/components/shared/ProviderIcon.d.ts +23 -0
- package/dist/components/side-menu/side-menu.d.ts +4 -0
- package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/triggers/CronPreview.d.ts +12 -0
- package/dist/components/triggers/index.d.ts +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
- package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
- package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
- package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty-state.d.ts +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree-view.d.ts +107 -0
- package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
- package/dist/contexts/ApiContext.d.ts +11 -0
- package/dist/contexts/FlowDataContext.d.ts +9 -0
- package/dist/contexts/NodeRegistryContext.d.ts +14 -0
- package/dist/contexts/PluginRegistryContext.d.ts +39 -0
- package/dist/contexts/ThemeProvider.d.ts +18 -0
- package/dist/contexts/ValidationContext.d.ts +22 -0
- package/dist/demo/DemoInvect.d.ts +11 -0
- package/dist/demo/FlowViewer.d.ts +31 -0
- package/dist/demo/demo-api-client.d.ts +33 -0
- package/dist/demo/index.d.ts +6 -0
- package/dist/demo/sample-data.d.ts +1538 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2774 -0
- package/dist/estree-ClbRfS-1.js +7076 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-document-title.d.ts +1 -0
- package/dist/hooks/use-flow-data.d.ts +22 -0
- package/dist/hooks/use-invect-portal-class.d.ts +21 -0
- package/dist/hooks/useFlowEditorStore.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +717 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/prettier.d.ts +13 -0
- package/dist/routes/all-flow-runs.d.ts +5 -0
- package/dist/routes/credentials.d.ts +5 -0
- package/dist/routes/flow-route-layout.d.ts +19 -0
- package/dist/routes/flow-runs.d.ts +5 -0
- package/dist/routes/flow.d.ts +5 -0
- package/dist/routes/home.d.ts +5 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/standalone-C3Df7W52.js +3463 -0
- package/dist/stores/executionViewStore.d.ts +64 -0
- package/dist/stores/flow-editor.store.d.ts +137 -0
- package/dist/stores/flowEditorStore.d.ts +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/uiStore.d.ts +45 -0
- package/dist/types/agent-tools.types.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node-definition.types.d.ts +85 -0
- package/dist/types/plugin.types.d.ts +100 -0
- package/dist/utils/credentialBranding.d.ts +8 -0
- package/dist/utils/credentialFiltering.d.ts +20 -0
- package/dist/utils/flowTransformations.d.ts +16 -0
- package/dist/utils/layoutUtils.d.ts +23 -0
- package/dist/utils/nodeReferenceUtils.d.ts +37 -0
- package/dist/vendor.d.ts +5 -0
- package/package.json +130 -0
- package/src/.DS_Store +0 -0
- package/src/Invect.tsx +229 -0
- package/src/InvectShell.tsx +55 -0
- package/src/api/agent-tools.api.ts +23 -0
- package/src/api/client.ts +899 -0
- package/src/api/credentials.api.ts +197 -0
- package/src/api/executions.api.ts +228 -0
- package/src/api/flows.api.ts +195 -0
- package/src/api/index.ts +17 -0
- package/src/api/node-data.api.ts +167 -0
- package/src/api/query-keys.ts +44 -0
- package/src/api/triggers.api.ts +120 -0
- package/src/api/types.ts +212 -0
- package/src/api/use-flow-run-stream.ts +206 -0
- package/src/app.css +560 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/src/assets/invect-branding.ts +51 -0
- package/src/assets/provider-icons/anthropic.svg +1 -0
- package/src/assets/provider-icons/anthropic_light.svg +1 -0
- package/src/assets/provider-icons/github.svg +1 -0
- package/src/assets/provider-icons/github_light.svg +1 -0
- package/src/assets/provider-icons/gmail.svg +1 -0
- package/src/assets/provider-icons/google_calendar.svg +1 -0
- package/src/assets/provider-icons/google_docs.svg +1 -0
- package/src/assets/provider-icons/google_drive.svg +1 -0
- package/src/assets/provider-icons/google_sheets.svg +1 -0
- package/src/assets/provider-icons/index.ts +55 -0
- package/src/assets/provider-icons/linear.svg +1 -0
- package/src/assets/provider-icons/openai.svg +1 -0
- package/src/assets/provider-icons/postgres.svg +1 -0
- package/src/assets/provider-icons/slack.svg +1 -0
- package/src/assets/small-loader-dark.svg +22 -0
- package/src/assets/small-loader-light.svg +22 -0
- package/src/assets/small.svg +7 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/PageLayout.tsx +55 -0
- package/src/components/chat/ChatInput.tsx +115 -0
- package/src/components/chat/ChatMessageList.tsx +788 -0
- package/src/components/chat/ChatModelSelector.tsx +208 -0
- package/src/components/chat/ChatPanel.tsx +243 -0
- package/src/components/chat/ChatPromptOverlay.tsx +150 -0
- package/src/components/chat/ChatProviderSelector.tsx +135 -0
- package/src/components/chat/ChatSettingsPanel.tsx +277 -0
- package/src/components/chat/InlineCredentialSetup.tsx +343 -0
- package/src/components/chat/MarkdownRenderer.tsx +140 -0
- package/src/components/chat/chat-memory.ts +88 -0
- package/src/components/chat/chat.store.ts +479 -0
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/use-chat.ts +473 -0
- package/src/components/credentials/CreateCredentialModal.tsx +609 -0
- package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
- package/src/components/credentials/EditCredentialModal.tsx +399 -0
- package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
- package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
- package/src/components/credentials/credential-utils.ts +99 -0
- package/src/components/credentials/index.ts +10 -0
- package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
- package/src/components/dashboard/FlowCard.tsx +64 -0
- package/src/components/dashboard/RecentActivityTable.tsx +92 -0
- package/src/components/dashboard/StatCard.tsx +32 -0
- package/src/components/dashboard/index.ts +5 -0
- package/src/components/dashboard/status-helpers.tsx +102 -0
- package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
- package/src/components/flow-editor/FlowEditor.tsx +1002 -0
- package/src/components/flow-editor/FlowHeader.tsx +87 -0
- package/src/components/flow-editor/FlowLayout.tsx +117 -0
- package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
- package/src/components/flow-editor/NodeSidebar.tsx +343 -0
- package/src/components/flow-editor/RunControls.tsx +109 -0
- package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
- package/src/components/flow-editor/ValidationPanel.tsx +167 -0
- package/src/components/flow-editor/flow-editor.store.ts +2 -0
- package/src/components/flow-editor/index.ts +6 -0
- package/src/components/flow-editor/inline-edit.tsx +111 -0
- package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
- package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
- package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
- package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
- package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
- package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
- package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
- package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
- package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
- package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
- package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
- package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
- package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
- package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
- package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
- package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
- package/src/components/flow-editor/node-config-panel/types.ts +20 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
- package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
- package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
- package/src/components/flow-editor/toolbar-context.ts +9 -0
- package/src/components/flow-editor/use-copy-paste.ts +575 -0
- package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
- package/src/components/flow-editor/use-flow-editor.ts +241 -0
- package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
- package/src/components/flow-runs-table/index.ts +1 -0
- package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
- package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
- package/src/components/flow-viewer/RunSelector.tsx +422 -0
- package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
- package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
- package/src/components/flow-viewer/index.ts +1 -0
- package/src/components/flow-viewer/logs-panel.tsx +567 -0
- package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
- package/src/components/graph/BatchFlowEdge.tsx +229 -0
- package/src/components/graph/LayoutSelector.tsx +42 -0
- package/src/components/graph/index.ts +61 -0
- package/src/components/graph/styleUtils.ts +375 -0
- package/src/components/nodes/.DS_Store +0 -0
- package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
- package/src/components/nodes/AgentNode.tsx +298 -0
- package/src/components/nodes/AgentToolsBox.tsx +193 -0
- package/src/components/nodes/NodeAppendix.tsx +98 -0
- package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
- package/src/components/nodes/NodeViewContext.tsx +45 -0
- package/src/components/nodes/ToolParamField.tsx +282 -0
- package/src/components/nodes/ToolSelectorModal.tsx +648 -0
- package/src/components/nodes/ToolSelectorParts.tsx +505 -0
- package/src/components/nodes/UniversalNode.tsx +356 -0
- package/src/components/nodes/createContextAwareNodes.ts +19 -0
- package/src/components/nodes/index.ts +45 -0
- package/src/components/nodes/nodeRegistry.ts +50 -0
- package/src/components/nodes/withNodeContext.tsx +55 -0
- package/src/components/shared/InvectLoader.tsx +59 -0
- package/src/components/shared/InvectLogo.tsx +59 -0
- package/src/components/shared/ProviderIcon.tsx +115 -0
- package/src/components/side-menu/side-menu.tsx +267 -0
- package/src/components/sidebar/BaseSidebar.tsx +148 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/triggers/CronPreview.tsx +243 -0
- package/src/components/triggers/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +152 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/codemirror-js-editor.tsx +432 -0
- package/src/components/ui/codemirror-json-editor.tsx +816 -0
- package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
- package/src/components/ui/codemirror-vscode-theme.ts +243 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +162 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/dropdown-menu.tsx +232 -0
- package/src/components/ui/empty-state.tsx +93 -0
- package/src/components/ui/input.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/popover.tsx +53 -0
- package/src/components/ui/resizable.tsx +61 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +179 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/slider.tsx +58 -0
- package/src/components/ui/switch.tsx +22 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/components/ui/tree-view.tsx +574 -0
- package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
- package/src/contexts/ApiContext.tsx +51 -0
- package/src/contexts/FlowDataContext.tsx +21 -0
- package/src/contexts/NodeRegistryContext.tsx +54 -0
- package/src/contexts/PluginRegistryContext.tsx +182 -0
- package/src/contexts/ThemeProvider.tsx +106 -0
- package/src/contexts/ValidationContext.tsx +122 -0
- package/src/demo/DemoInvect.tsx +42 -0
- package/src/demo/FlowViewer.tsx +294 -0
- package/src/demo/demo-api-client.ts +246 -0
- package/src/demo/index.ts +28 -0
- package/src/demo/sample-data.ts +1980 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-document-title.ts +8 -0
- package/src/hooks/use-flow-data.ts +144 -0
- package/src/hooks/use-invect-portal-class.ts +27 -0
- package/src/hooks/useFlowEditorStore.ts +2 -0
- package/src/index.ts +70 -0
- package/src/lib/utils.ts +6 -0
- package/src/prettier.d.ts +13 -0
- package/src/routes/all-flow-runs.tsx +27 -0
- package/src/routes/credentials.tsx +362 -0
- package/src/routes/flow-route-layout.tsx +113 -0
- package/src/routes/flow-runs.tsx +22 -0
- package/src/routes/flow.tsx +22 -0
- package/src/routes/home.tsx +282 -0
- package/src/services/index.ts +6 -0
- package/src/stores/executionViewStore.ts +211 -0
- package/src/stores/flow-editor.store.ts +738 -0
- package/src/stores/flowEditorStore.ts +2 -0
- package/src/stores/index.ts +10 -0
- package/src/stores/uiStore.ts +189 -0
- package/src/types/agent-tools.types.ts +64 -0
- package/src/types/index.ts +5 -0
- package/src/types/node-definition.types.ts +104 -0
- package/src/types/plugin.types.ts +123 -0
- package/src/utils/credentialBranding.ts +116 -0
- package/src/utils/credentialFiltering.ts +68 -0
- package/src/utils/flowTransformations.ts +137 -0
- package/src/utils/layoutUtils.ts +127 -0
- package/src/utils/nodeReferenceUtils.ts +135 -0
- package/src/vendor.d.ts +7 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState, useMemo } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
CheckCircle,
|
|
6
|
+
XCircle,
|
|
7
|
+
Clock,
|
|
8
|
+
Loader2,
|
|
9
|
+
StopCircle,
|
|
10
|
+
ChevronsUpDown,
|
|
11
|
+
Calendar,
|
|
12
|
+
ChevronLeft,
|
|
13
|
+
ChevronRight,
|
|
14
|
+
} from 'lucide-react';
|
|
15
|
+
import { Popover, PopoverContent, PopoverTrigger } from '~/components/ui/popover';
|
|
16
|
+
import { cn } from '~/lib/utils';
|
|
17
|
+
|
|
18
|
+
export interface RunSelectorItem {
|
|
19
|
+
id: string;
|
|
20
|
+
status: string;
|
|
21
|
+
startedAt?: string | Date;
|
|
22
|
+
completedAt?: string | Date;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface RunSelectorProps {
|
|
26
|
+
runs: RunSelectorItem[];
|
|
27
|
+
selectedRunId: string | null;
|
|
28
|
+
onSelectRun: (runId: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type DateFilter = 'all' | 'today' | '7d' | '30d' | 'custom';
|
|
32
|
+
|
|
33
|
+
const PAGE_SIZE = 20;
|
|
34
|
+
|
|
35
|
+
function StatusDot({ status }: { status: string }) {
|
|
36
|
+
const colorClass =
|
|
37
|
+
status === 'SUCCESS'
|
|
38
|
+
? 'bg-green-500'
|
|
39
|
+
: status === 'FAILED'
|
|
40
|
+
? 'bg-red-500'
|
|
41
|
+
: status === 'RUNNING'
|
|
42
|
+
? 'bg-blue-500 animate-pulse'
|
|
43
|
+
: status === 'CANCELLED'
|
|
44
|
+
? 'bg-yellow-500'
|
|
45
|
+
: 'bg-muted-foreground';
|
|
46
|
+
return <span className={cn('inline-block h-2 w-2 rounded-full shrink-0', colorClass)} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function StatusIcon({ status }: { status: string }) {
|
|
50
|
+
switch (status) {
|
|
51
|
+
case 'SUCCESS':
|
|
52
|
+
return <CheckCircle className="w-3.5 h-3.5 text-green-600 shrink-0" />;
|
|
53
|
+
case 'FAILED':
|
|
54
|
+
return <XCircle className="w-3.5 h-3.5 text-red-600 shrink-0" />;
|
|
55
|
+
case 'CANCELLED':
|
|
56
|
+
return <StopCircle className="w-3.5 h-3.5 text-yellow-600 shrink-0" />;
|
|
57
|
+
case 'RUNNING':
|
|
58
|
+
return <Loader2 className="w-3.5 h-3.5 text-blue-600 animate-spin shrink-0" />;
|
|
59
|
+
default:
|
|
60
|
+
return <Clock className="w-3.5 h-3.5 text-muted-foreground shrink-0" />;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function formatSince(dateLike?: string | Date): string {
|
|
65
|
+
if (!dateLike) {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
const d = new Date(dateLike).getTime();
|
|
69
|
+
const diffMs = Date.now() - d;
|
|
70
|
+
const minutes = Math.floor(diffMs / (1000 * 60));
|
|
71
|
+
const hours = Math.floor(minutes / 60);
|
|
72
|
+
const days = Math.floor(hours / 24);
|
|
73
|
+
if (minutes < 1) {
|
|
74
|
+
return 'Just now';
|
|
75
|
+
}
|
|
76
|
+
if (minutes < 60) {
|
|
77
|
+
return `${minutes}m ago`;
|
|
78
|
+
}
|
|
79
|
+
if (hours < 24) {
|
|
80
|
+
return `${hours}h ago`;
|
|
81
|
+
}
|
|
82
|
+
return `${days}d ago`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function formatTimestamp(dateLike?: string | Date): string {
|
|
86
|
+
if (!dateLike) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
const d = new Date(dateLike);
|
|
90
|
+
return d.toLocaleString(undefined, {
|
|
91
|
+
month: 'short',
|
|
92
|
+
day: 'numeric',
|
|
93
|
+
hour: '2-digit',
|
|
94
|
+
minute: '2-digit',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function toDateInputValue(d: Date): string {
|
|
99
|
+
const year = d.getFullYear();
|
|
100
|
+
const month = String(d.getMonth() + 1).padStart(2, '0');
|
|
101
|
+
const day = String(d.getDate()).padStart(2, '0');
|
|
102
|
+
return `${year}-${month}-${day}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function getDateFilterRange(filter: DateFilter): { start: Date | null; end: Date | null } {
|
|
106
|
+
if (filter === 'all' || filter === 'custom') {
|
|
107
|
+
return { start: null, end: null };
|
|
108
|
+
}
|
|
109
|
+
const now = new Date();
|
|
110
|
+
if (filter === 'today') {
|
|
111
|
+
const start = new Date(now);
|
|
112
|
+
start.setHours(0, 0, 0, 0);
|
|
113
|
+
return { start, end: null };
|
|
114
|
+
}
|
|
115
|
+
if (filter === '7d') {
|
|
116
|
+
return { start: new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000), end: null };
|
|
117
|
+
}
|
|
118
|
+
if (filter === '30d') {
|
|
119
|
+
return { start: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000), end: null };
|
|
120
|
+
}
|
|
121
|
+
return { start: null, end: null };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const DATE_FILTERS: { label: string; value: DateFilter }[] = [
|
|
125
|
+
{ label: 'All', value: 'all' },
|
|
126
|
+
{ label: 'Today', value: 'today' },
|
|
127
|
+
{ label: '7d', value: '7d' },
|
|
128
|
+
{ label: '30d', value: '30d' },
|
|
129
|
+
{ label: 'Range', value: 'custom' },
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
export function RunSelector({ runs, selectedRunId, onSelectRun }: RunSelectorProps) {
|
|
133
|
+
const [open, setOpen] = useState(false);
|
|
134
|
+
const [dateFilter, setDateFilter] = useState<DateFilter>('all');
|
|
135
|
+
const [statusFilter, setStatusFilter] = useState<string | null>(null);
|
|
136
|
+
const [customFrom, setCustomFrom] = useState('');
|
|
137
|
+
const [customTo, setCustomTo] = useState('');
|
|
138
|
+
const [page, setPage] = useState(0);
|
|
139
|
+
|
|
140
|
+
const selectedRun = runs.find((r) => r.id === selectedRunId);
|
|
141
|
+
|
|
142
|
+
const filteredRuns = useMemo(() => {
|
|
143
|
+
let result = runs;
|
|
144
|
+
|
|
145
|
+
// Date filter
|
|
146
|
+
if (dateFilter === 'custom') {
|
|
147
|
+
const from = customFrom ? new Date(customFrom + 'T00:00:00') : null;
|
|
148
|
+
const to = customTo ? new Date(customTo + 'T23:59:59') : null;
|
|
149
|
+
if (from || to) {
|
|
150
|
+
result = result.filter((r) => {
|
|
151
|
+
if (!r.startedAt) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const d = new Date(r.startedAt);
|
|
155
|
+
if (from && d < from) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (to && d > to) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
const { start } = getDateFilterRange(dateFilter);
|
|
166
|
+
if (start) {
|
|
167
|
+
result = result.filter((r) => {
|
|
168
|
+
if (!r.startedAt) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return new Date(r.startedAt) >= start;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Status filter
|
|
177
|
+
if (statusFilter) {
|
|
178
|
+
result = result.filter((r) => r.status === statusFilter);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return result;
|
|
182
|
+
}, [runs, dateFilter, statusFilter, customFrom, customTo]);
|
|
183
|
+
|
|
184
|
+
// Reset page when filters change
|
|
185
|
+
const totalPages = Math.max(1, Math.ceil(filteredRuns.length / PAGE_SIZE));
|
|
186
|
+
const safePage = Math.min(page, totalPages - 1);
|
|
187
|
+
const pagedRuns = filteredRuns.slice(safePage * PAGE_SIZE, (safePage + 1) * PAGE_SIZE);
|
|
188
|
+
|
|
189
|
+
const statusCounts = useMemo(() => {
|
|
190
|
+
const counts: Record<string, number> = {};
|
|
191
|
+
for (const r of runs) {
|
|
192
|
+
counts[r.status] = (counts[r.status] || 0) + 1;
|
|
193
|
+
}
|
|
194
|
+
return counts;
|
|
195
|
+
}, [runs]);
|
|
196
|
+
|
|
197
|
+
const handleSelect = (runId: string) => {
|
|
198
|
+
onSelectRun(runId);
|
|
199
|
+
setOpen(false);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const handleDateFilterChange = (value: DateFilter) => {
|
|
203
|
+
setDateFilter(value);
|
|
204
|
+
setPage(0);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const handleStatusFilterChange = (status: string | null) => {
|
|
208
|
+
setStatusFilter(status);
|
|
209
|
+
setPage(0);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
214
|
+
<PopoverTrigger asChild>
|
|
215
|
+
<button
|
|
216
|
+
className="flex items-center gap-2 w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-card hover:bg-accent/50 transition-colors cursor-pointer"
|
|
217
|
+
title="Select execution run"
|
|
218
|
+
>
|
|
219
|
+
{selectedRun ? (
|
|
220
|
+
<>
|
|
221
|
+
<StatusIcon status={selectedRun.status} />
|
|
222
|
+
<span className="flex-1 text-left truncate font-medium">
|
|
223
|
+
{formatSince(selectedRun.startedAt)}
|
|
224
|
+
</span>
|
|
225
|
+
<span
|
|
226
|
+
className={cn(
|
|
227
|
+
'rounded-full border px-1.5 py-0 text-[10px] font-medium shrink-0',
|
|
228
|
+
selectedRun.status === 'SUCCESS' &&
|
|
229
|
+
'bg-green-500/10 text-green-600 border-green-500/20',
|
|
230
|
+
selectedRun.status === 'FAILED' && 'bg-red-500/10 text-red-600 border-red-500/20',
|
|
231
|
+
(selectedRun.status === 'RUNNING' ||
|
|
232
|
+
selectedRun.status === 'PENDING' ||
|
|
233
|
+
selectedRun.status === 'PAUSED' ||
|
|
234
|
+
selectedRun.status === 'PAUSED_FOR_BATCH') &&
|
|
235
|
+
'bg-blue-500/10 text-blue-600 border-blue-500/20',
|
|
236
|
+
selectedRun.status === 'CANCELLED' &&
|
|
237
|
+
'bg-yellow-500/10 text-yellow-600 border-yellow-500/20',
|
|
238
|
+
)}
|
|
239
|
+
>
|
|
240
|
+
{selectedRun.status}
|
|
241
|
+
</span>
|
|
242
|
+
</>
|
|
243
|
+
) : (
|
|
244
|
+
<span className="flex-1 text-left text-muted-foreground">Select a run…</span>
|
|
245
|
+
)}
|
|
246
|
+
<ChevronsUpDown className="w-3.5 h-3.5 text-muted-foreground shrink-0" />
|
|
247
|
+
</button>
|
|
248
|
+
</PopoverTrigger>
|
|
249
|
+
<PopoverContent
|
|
250
|
+
align="start"
|
|
251
|
+
side="top"
|
|
252
|
+
className="w-80 p-0"
|
|
253
|
+
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
254
|
+
>
|
|
255
|
+
<div className="flex flex-col">
|
|
256
|
+
{/* Header */}
|
|
257
|
+
<div className="flex items-center justify-between px-3 py-2 border-b border-border">
|
|
258
|
+
<span className="text-xs font-semibold">Execution History</span>
|
|
259
|
+
<span className="text-xs text-muted-foreground">
|
|
260
|
+
{filteredRuns.length === runs.length
|
|
261
|
+
? `${runs.length} runs`
|
|
262
|
+
: `${filteredRuns.length} / ${runs.length} runs`}
|
|
263
|
+
</span>
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
{/* Date filters */}
|
|
267
|
+
<div className="flex items-center gap-1 px-3 py-1.5 border-b border-border">
|
|
268
|
+
<Calendar className="w-3 h-3 text-muted-foreground shrink-0 mr-0.5" />
|
|
269
|
+
{DATE_FILTERS.map((f) => (
|
|
270
|
+
<button
|
|
271
|
+
key={f.value}
|
|
272
|
+
onClick={() => handleDateFilterChange(f.value)}
|
|
273
|
+
className={cn(
|
|
274
|
+
'px-2 py-0.5 text-xs rounded-md transition-colors',
|
|
275
|
+
dateFilter === f.value
|
|
276
|
+
? 'bg-accent text-accent-foreground font-medium'
|
|
277
|
+
: 'text-muted-foreground hover:bg-accent/50',
|
|
278
|
+
)}
|
|
279
|
+
>
|
|
280
|
+
{f.label}
|
|
281
|
+
</button>
|
|
282
|
+
))}
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
{/* Custom date range inputs */}
|
|
286
|
+
{dateFilter === 'custom' && (
|
|
287
|
+
<div className="flex items-center gap-2 px-3 py-1.5 border-b border-border">
|
|
288
|
+
<input
|
|
289
|
+
type="date"
|
|
290
|
+
value={customFrom}
|
|
291
|
+
max={customTo || toDateInputValue(new Date())}
|
|
292
|
+
onChange={(e) => {
|
|
293
|
+
setCustomFrom(e.target.value);
|
|
294
|
+
setPage(0);
|
|
295
|
+
}}
|
|
296
|
+
className="flex-1 h-7 px-1.5 text-xs rounded-md border border-border bg-background text-foreground"
|
|
297
|
+
/>
|
|
298
|
+
<span className="text-xs text-muted-foreground">–</span>
|
|
299
|
+
<input
|
|
300
|
+
type="date"
|
|
301
|
+
value={customTo}
|
|
302
|
+
min={customFrom || undefined}
|
|
303
|
+
max={toDateInputValue(new Date())}
|
|
304
|
+
onChange={(e) => {
|
|
305
|
+
setCustomTo(e.target.value);
|
|
306
|
+
setPage(0);
|
|
307
|
+
}}
|
|
308
|
+
className="flex-1 h-7 px-1.5 text-xs rounded-md border border-border bg-background text-foreground"
|
|
309
|
+
/>
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
312
|
+
|
|
313
|
+
{/* Status filter chips */}
|
|
314
|
+
<div className="flex items-center gap-1 px-3 py-1.5 border-b border-border flex-wrap">
|
|
315
|
+
<button
|
|
316
|
+
onClick={() => handleStatusFilterChange(null)}
|
|
317
|
+
className={cn(
|
|
318
|
+
'px-2 py-0.5 text-xs rounded-md transition-colors',
|
|
319
|
+
!statusFilter
|
|
320
|
+
? 'bg-accent text-accent-foreground font-medium'
|
|
321
|
+
: 'text-muted-foreground hover:bg-accent/50',
|
|
322
|
+
)}
|
|
323
|
+
>
|
|
324
|
+
All
|
|
325
|
+
</button>
|
|
326
|
+
{Object.entries(statusCounts).map(([status, count]) => (
|
|
327
|
+
<button
|
|
328
|
+
key={status}
|
|
329
|
+
onClick={() => handleStatusFilterChange(statusFilter === status ? null : status)}
|
|
330
|
+
className={cn(
|
|
331
|
+
'flex items-center gap-1 px-2 py-0.5 text-xs rounded-md transition-colors',
|
|
332
|
+
statusFilter === status
|
|
333
|
+
? 'bg-accent text-accent-foreground font-medium'
|
|
334
|
+
: 'text-muted-foreground hover:bg-accent/50',
|
|
335
|
+
)}
|
|
336
|
+
>
|
|
337
|
+
<StatusDot status={status} />
|
|
338
|
+
{status.toLowerCase()} ({count})
|
|
339
|
+
</button>
|
|
340
|
+
))}
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
{/* Runs list */}
|
|
344
|
+
<div className="max-h-64 overflow-y-auto">
|
|
345
|
+
<div className="py-1">
|
|
346
|
+
{pagedRuns.length === 0 ? (
|
|
347
|
+
<div className="px-3 py-4 text-xs text-center text-muted-foreground">
|
|
348
|
+
No runs match the current filters.
|
|
349
|
+
</div>
|
|
350
|
+
) : (
|
|
351
|
+
pagedRuns.map((run) => (
|
|
352
|
+
<button
|
|
353
|
+
key={run.id}
|
|
354
|
+
onClick={() => handleSelect(run.id)}
|
|
355
|
+
className={cn(
|
|
356
|
+
'flex items-center gap-2 w-full px-3 py-1.5 text-left transition-colors',
|
|
357
|
+
selectedRunId === run.id
|
|
358
|
+
? 'bg-accent text-accent-foreground'
|
|
359
|
+
: 'hover:bg-accent/40',
|
|
360
|
+
)}
|
|
361
|
+
>
|
|
362
|
+
<StatusIcon status={run.status} />
|
|
363
|
+
<div className="flex-1 min-w-0">
|
|
364
|
+
<div className="flex items-center gap-2">
|
|
365
|
+
<span className="text-xs font-medium">{formatSince(run.startedAt)}</span>
|
|
366
|
+
<span
|
|
367
|
+
className={cn(
|
|
368
|
+
'rounded-full border px-1.5 py-0 text-[10px] font-medium',
|
|
369
|
+
run.status === 'SUCCESS' &&
|
|
370
|
+
'bg-green-500/10 text-green-600 border-green-500/20',
|
|
371
|
+
run.status === 'FAILED' &&
|
|
372
|
+
'bg-red-500/10 text-red-600 border-red-500/20',
|
|
373
|
+
(run.status === 'RUNNING' ||
|
|
374
|
+
run.status === 'PENDING' ||
|
|
375
|
+
run.status === 'PAUSED' ||
|
|
376
|
+
run.status === 'PAUSED_FOR_BATCH') &&
|
|
377
|
+
'bg-blue-500/10 text-blue-600 border-blue-500/20',
|
|
378
|
+
run.status === 'CANCELLED' &&
|
|
379
|
+
'bg-yellow-500/10 text-yellow-600 border-yellow-500/20',
|
|
380
|
+
)}
|
|
381
|
+
>
|
|
382
|
+
{run.status}
|
|
383
|
+
</span>
|
|
384
|
+
</div>
|
|
385
|
+
<div className="text-[10px] text-muted-foreground truncate">
|
|
386
|
+
{formatTimestamp(run.startedAt)}
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
</button>
|
|
390
|
+
))
|
|
391
|
+
)}
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
{/* Pagination */}
|
|
396
|
+
{totalPages > 1 && (
|
|
397
|
+
<div className="flex items-center justify-between px-3 py-1.5 border-t border-border">
|
|
398
|
+
<button
|
|
399
|
+
onClick={() => setPage(Math.max(0, safePage - 1))}
|
|
400
|
+
disabled={safePage === 0}
|
|
401
|
+
className="p-0.5 rounded hover:bg-accent/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
|
|
402
|
+
>
|
|
403
|
+
<ChevronLeft className="w-3.5 h-3.5" />
|
|
404
|
+
</button>
|
|
405
|
+
<span className="text-[10px] text-muted-foreground">
|
|
406
|
+
{safePage * PAGE_SIZE + 1}–
|
|
407
|
+
{Math.min((safePage + 1) * PAGE_SIZE, filteredRuns.length)} of {filteredRuns.length}
|
|
408
|
+
</span>
|
|
409
|
+
<button
|
|
410
|
+
onClick={() => setPage(Math.min(totalPages - 1, safePage + 1))}
|
|
411
|
+
disabled={safePage >= totalPages - 1}
|
|
412
|
+
className="p-0.5 rounded hover:bg-accent/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
|
|
413
|
+
>
|
|
414
|
+
<ChevronRight className="w-3.5 h-3.5" />
|
|
415
|
+
</button>
|
|
416
|
+
</div>
|
|
417
|
+
)}
|
|
418
|
+
</div>
|
|
419
|
+
</PopoverContent>
|
|
420
|
+
</Popover>
|
|
421
|
+
);
|
|
422
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Clock, Loader2, CheckCircle, XCircle, StopCircle } from 'lucide-react';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
export interface RunListItem {
|
|
6
|
+
id: string;
|
|
7
|
+
status: string;
|
|
8
|
+
startedAt?: string | Date;
|
|
9
|
+
completedAt?: string | Date;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface RunsSidebarProps {
|
|
13
|
+
runs: RunListItem[];
|
|
14
|
+
selectedRunId: string | null;
|
|
15
|
+
onSelectRun: (runId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function formatTimestamp(dateLike?: string | Date): string {
|
|
19
|
+
if (!dateLike) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
const d = new Date(dateLike);
|
|
23
|
+
return d.toLocaleString();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function formatSince(dateLike?: string | Date): string {
|
|
27
|
+
if (!dateLike) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
const d = new Date(dateLike).getTime();
|
|
31
|
+
const diffMs = Date.now() - d;
|
|
32
|
+
const minutes = Math.floor(diffMs / (1000 * 60));
|
|
33
|
+
const hours = Math.floor(minutes / 60);
|
|
34
|
+
const days = Math.floor(hours / 24);
|
|
35
|
+
if (minutes < 1) {
|
|
36
|
+
return 'Just now';
|
|
37
|
+
}
|
|
38
|
+
if (minutes < 60) {
|
|
39
|
+
return `${minutes}m ago`;
|
|
40
|
+
}
|
|
41
|
+
if (hours < 24) {
|
|
42
|
+
return `${hours}h ago`;
|
|
43
|
+
}
|
|
44
|
+
return `${days}d ago`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function StatusIcon({ status }: { status: string }) {
|
|
48
|
+
switch (status) {
|
|
49
|
+
case 'SUCCESS':
|
|
50
|
+
return <CheckCircle className="w-4 h-4 text-green-600" />;
|
|
51
|
+
case 'FAILED':
|
|
52
|
+
return <XCircle className="w-4 h-4 text-red-600" />;
|
|
53
|
+
case 'CANCELLED':
|
|
54
|
+
return <StopCircle className="w-4 h-4 text-yellow-600" />;
|
|
55
|
+
case 'RUNNING':
|
|
56
|
+
return <Loader2 className="w-4 h-4 text-blue-600 animate-spin" />;
|
|
57
|
+
case 'PENDING':
|
|
58
|
+
case 'PAUSED':
|
|
59
|
+
case 'PAUSED_FOR_BATCH':
|
|
60
|
+
return <Clock className="w-4 h-4 text-muted-foreground" />;
|
|
61
|
+
default:
|
|
62
|
+
return <Clock className="w-4 h-4 text-muted-foreground" />;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const RunsSidebar: React.FC<RunsSidebarProps> = ({ runs, selectedRunId, onSelectRun }) => {
|
|
67
|
+
return (
|
|
68
|
+
<div className="flex flex-col w-64 border-r shrink-0 border-border bg-imp-background text-card-foreground">
|
|
69
|
+
<div className="px-4 py-3 border-b border-border">
|
|
70
|
+
<h2 className="text-sm font-semibold text-card-foreground">Execution History</h2>
|
|
71
|
+
<p className="mt-1 text-xs text-muted-foreground">{runs.length} total runs</p>
|
|
72
|
+
</div>
|
|
73
|
+
<div className="flex-1 p-3 space-y-2 overflow-auto">
|
|
74
|
+
{runs.length === 0 ? (
|
|
75
|
+
<div className="flex flex-col items-center justify-center h-full px-4 text-center">
|
|
76
|
+
<Clock className="w-12 h-12 mb-3 text-muted-foreground/50" />
|
|
77
|
+
<p className="mb-1 text-sm text-muted-foreground">No flow runs yet</p>
|
|
78
|
+
<p className="text-xs text-muted-foreground">Run this flow to see execution history</p>
|
|
79
|
+
</div>
|
|
80
|
+
) : (
|
|
81
|
+
runs.map((run) => (
|
|
82
|
+
<button
|
|
83
|
+
key={run.id}
|
|
84
|
+
onClick={() => onSelectRun(run.id)}
|
|
85
|
+
className={cn(
|
|
86
|
+
'w-full text-left rounded-lg border p-2 transition-colors',
|
|
87
|
+
'hover:bg-muted/50',
|
|
88
|
+
selectedRunId === run.id
|
|
89
|
+
? 'bg-muted border-muted-foreground'
|
|
90
|
+
: 'bg-card border-border',
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
<div className="flex items-start justify-between gap-2 mb-2">
|
|
94
|
+
<div className="flex items-center gap-2">
|
|
95
|
+
<StatusIcon status={run.status} />
|
|
96
|
+
<span className="text-xs text-muted-foreground">
|
|
97
|
+
{formatSince(run.startedAt)}
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
<span
|
|
101
|
+
className={cn(
|
|
102
|
+
'rounded-full border px-2 py-0 text-xs font-medium',
|
|
103
|
+
run.status === 'SUCCESS' &&
|
|
104
|
+
'bg-green-500/10 text-green-600 border-green-500/20',
|
|
105
|
+
run.status === 'FAILED' && 'bg-red-500/10 text-red-600 border-red-500/20',
|
|
106
|
+
(run.status === 'RUNNING' ||
|
|
107
|
+
run.status === 'PENDING' ||
|
|
108
|
+
run.status === 'PAUSED' ||
|
|
109
|
+
run.status === 'PAUSED_FOR_BATCH') &&
|
|
110
|
+
'bg-blue-500/10 text-blue-600 border-blue-500/20',
|
|
111
|
+
run.status === 'CANCELLED' &&
|
|
112
|
+
'bg-yellow-500/10 text-yellow-600 border-yellow-500/20',
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
{run.status}
|
|
116
|
+
</span>
|
|
117
|
+
</div>
|
|
118
|
+
<div className="text-xs text-muted-foreground">{formatTimestamp(run.startedAt)}</div>
|
|
119
|
+
</button>
|
|
120
|
+
))
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|