@flanksource/clicky-ui 0.3.24 → 0.3.26
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/NOTICE.md +1 -0
- package/dist/ai.cjs +4 -0
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.js +6 -2
- package/dist/ai.js.map +1 -1
- package/dist/chat.cjs +8 -0
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +9 -1
- package/dist/chat.js.map +1 -1
- package/dist/comments/CommentCard.cjs +89 -14
- package/dist/comments/CommentCard.cjs.map +1 -1
- package/dist/comments/CommentCard.d.ts.map +1 -1
- package/dist/comments/CommentCard.js +90 -15
- package/dist/comments/CommentCard.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +25 -2
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +25 -2
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentProvider.cjs +21 -14
- package/dist/comments/CommentProvider.cjs.map +1 -1
- package/dist/comments/CommentProvider.d.ts +1 -1
- package/dist/comments/CommentProvider.d.ts.map +1 -1
- package/dist/comments/CommentProvider.js +21 -14
- package/dist/comments/CommentProvider.js.map +1 -1
- package/dist/comments/CommentSidePanel.cjs +1 -1
- package/dist/comments/CommentSidePanel.cjs.map +1 -1
- package/dist/comments/CommentSidePanel.js +1 -1
- package/dist/comments/CommentSidePanel.js.map +1 -1
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +6 -0
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/components/DimensionField.cjs +56 -0
- package/dist/components/DimensionField.cjs.map +1 -0
- package/dist/components/DimensionField.d.ts +17 -0
- package/dist/components/DimensionField.d.ts.map +1 -0
- package/dist/components/DimensionField.js +56 -0
- package/dist/components/DimensionField.js.map +1 -0
- package/dist/components.cjs +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +2 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.js.map +1 -1
- package/dist/data/Clicky.cjs +4 -5
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.js +4 -5
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/TaskExecDetails.cjs +8 -3
- package/dist/data/TaskExecDetails.cjs.map +1 -1
- package/dist/data/TaskExecDetails.d.ts +4 -0
- package/dist/data/TaskExecDetails.d.ts.map +1 -1
- package/dist/data/TaskExecDetails.js +9 -4
- package/dist/data/TaskExecDetails.js.map +1 -1
- package/dist/data/TaskManagerButton.cjs +101 -7
- package/dist/data/TaskManagerButton.cjs.map +1 -1
- package/dist/data/TaskManagerButton.d.ts +6 -1
- package/dist/data/TaskManagerButton.d.ts.map +1 -1
- package/dist/data/TaskManagerButton.js +103 -9
- package/dist/data/TaskManagerButton.js.map +1 -1
- package/dist/data/TaskProcessDetails.cjs +2 -0
- package/dist/data/TaskProcessDetails.cjs.map +1 -1
- package/dist/data/TaskProcessDetails.d.ts.map +1 -1
- package/dist/data/TaskProcessDetails.js +2 -0
- package/dist/data/TaskProcessDetails.js.map +1 -1
- package/dist/data/TaskProgress.cjs +14 -4
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.js +14 -4
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +1 -0
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/ai/ChatWindow.cjs +18 -23
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts +1 -1
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +19 -24
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.cjs +12 -21
- package/dist/data/ai/ChatWindow.preferences.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.d.ts +3 -2
- package/dist/data/ai/ChatWindow.preferences.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.preferences.js +12 -21
- package/dist/data/ai/ChatWindow.preferences.js.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.cjs +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts +5 -5
- package/dist/data/ai/ChatWindow.tool-catalog.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.tool-catalog.js +21 -38
- package/dist/data/ai/ChatWindow.tool-catalog.js.map +1 -1
- package/dist/data/ai/ChatWindow.types.d.ts +2 -2
- package/dist/data/ai/ChatWindow.types.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowManager.cjs +2 -2
- package/dist/data/ai/ChatWindowManager.cjs.map +1 -1
- package/dist/data/ai/ChatWindowManager.js +2 -2
- package/dist/data/ai/ChatWindowManager.js.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.cjs +4 -2
- package/dist/data/ai/ChatWindowRequestBody.cjs.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.d.ts +15 -3
- package/dist/data/ai/ChatWindowRequestBody.d.ts.map +1 -1
- package/dist/data/ai/ChatWindowRequestBody.js +4 -2
- package/dist/data/ai/ChatWindowRequestBody.js.map +1 -1
- package/dist/data/ai/ToolPreferences.cjs +5 -5
- package/dist/data/ai/ToolPreferences.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.d.ts +6 -5
- package/dist/data/ai/ToolPreferences.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.js +5 -5
- package/dist/data/ai/ToolPreferences.js.map +1 -1
- package/dist/data/ai/ToolPreferences.model.cjs +61 -37
- package/dist/data/ai/ToolPreferences.model.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.model.d.ts +32 -13
- package/dist/data/ai/ToolPreferences.model.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.model.js +62 -38
- package/dist/data/ai/ToolPreferences.model.js.map +1 -1
- package/dist/data/ai/ToolPreferencesList.cjs +17 -20
- package/dist/data/ai/ToolPreferencesList.cjs.map +1 -1
- package/dist/data/ai/ToolPreferencesList.d.ts +16 -7
- package/dist/data/ai/ToolPreferencesList.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferencesList.js +18 -21
- package/dist/data/ai/ToolPreferencesList.js.map +1 -1
- package/dist/data/ai/chat-window-context.cjs +1 -1
- package/dist/data/ai/chat-window-context.cjs.map +1 -1
- package/dist/data/ai/chat-window-context.d.ts +7 -7
- package/dist/data/ai/chat-window-context.d.ts.map +1 -1
- package/dist/data/ai/chat-window-context.js +1 -1
- package/dist/data/ai/chat-window-context.js.map +1 -1
- package/dist/data/ai/index.d.ts +3 -1
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/chat/Chat.cjs +8 -4
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.js +8 -4
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.cjs +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.cjs.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.d.ts.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.js +11 -7
- package/dist/data/chat/ChatRuntimeToolbar.js.map +1 -1
- package/dist/data/chat/ContextMeter.cjs +64 -27
- package/dist/data/chat/ContextMeter.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.d.ts +11 -4
- package/dist/data/chat/ContextMeter.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.js +64 -27
- package/dist/data/chat/ContextMeter.js.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.cjs +2 -1
- package/dist/data/chat/clickyOperationsToTools.cjs.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.d.ts.map +1 -1
- package/dist/data/chat/clickyOperationsToTools.js +2 -1
- package/dist/data/chat/clickyOperationsToTools.js.map +1 -1
- package/dist/data/chat/index.d.ts +2 -1
- package/dist/data/chat/index.d.ts.map +1 -1
- package/dist/data/chat/tool-policy.cjs +132 -0
- package/dist/data/chat/tool-policy.cjs.map +1 -0
- package/dist/data/chat/tool-policy.d.ts +81 -0
- package/dist/data/chat/tool-policy.d.ts.map +1 -0
- package/dist/data/chat/tool-policy.js +132 -0
- package/dist/data/chat/tool-policy.js.map +1 -0
- package/dist/data/chat/types.cjs +20 -0
- package/dist/data/chat/types.cjs.map +1 -1
- package/dist/data/chat/types.d.ts +41 -2
- package/dist/data/chat/types.d.ts.map +1 -1
- package/dist/data/chat/types.js +20 -0
- package/dist/data/chat/types.js.map +1 -1
- package/dist/data/chat/usage-snapshot.cjs +10 -1
- package/dist/data/chat/usage-snapshot.cjs.map +1 -1
- package/dist/data/chat/usage-snapshot.d.ts.map +1 -1
- package/dist/data/chat/usage-snapshot.js +10 -1
- package/dist/data/chat/usage-snapshot.js.map +1 -1
- package/dist/data/debugConsoleSignal.cjs +64 -0
- package/dist/data/debugConsoleSignal.cjs.map +1 -0
- package/dist/data/debugConsoleSignal.d.ts +83 -0
- package/dist/data/debugConsoleSignal.d.ts.map +1 -0
- package/dist/data/debugConsoleSignal.js +64 -0
- package/dist/data/debugConsoleSignal.js.map +1 -0
- package/dist/data/har/HarPanel.cjs +20 -14
- package/dist/data/har/HarPanel.cjs.map +1 -1
- package/dist/data/har/HarPanel.d.ts.map +1 -1
- package/dist/data/har/HarPanel.js +20 -14
- package/dist/data/har/HarPanel.js.map +1 -1
- package/dist/data/har/types.d.ts +18 -0
- package/dist/data/har/types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +4 -42
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +5 -43
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +0 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/useDebugAction.cjs +29 -0
- package/dist/data/useDebugAction.cjs.map +1 -0
- package/dist/data/useDebugAction.d.ts +16 -0
- package/dist/data/useDebugAction.d.ts.map +1 -0
- package/dist/data/useDebugAction.js +29 -0
- package/dist/data/useDebugAction.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +16 -8
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +3 -2
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +16 -8
- package/dist/devtools/DebugConsole.cjs +138 -0
- package/dist/devtools/DebugConsole.cjs.map +1 -0
- package/dist/devtools/DebugConsole.d.ts +23 -0
- package/dist/devtools/DebugConsole.d.ts.map +1 -0
- package/dist/devtools/DebugConsole.js +138 -0
- package/dist/devtools/DebugConsole.js.map +1 -0
- package/dist/devtools/DebugConsoleButton.cjs +59 -0
- package/dist/devtools/DebugConsoleButton.cjs.map +1 -0
- package/dist/devtools/DebugConsoleButton.d.ts +20 -0
- package/dist/devtools/DebugConsoleButton.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleButton.js +59 -0
- package/dist/devtools/DebugConsoleButton.js.map +1 -0
- package/dist/devtools/DebugConsoleDock.cjs +112 -0
- package/dist/devtools/DebugConsoleDock.cjs.map +1 -0
- package/dist/devtools/DebugConsoleDock.d.ts +26 -0
- package/dist/devtools/DebugConsoleDock.d.ts.map +1 -0
- package/dist/devtools/DebugConsoleDock.js +112 -0
- package/dist/devtools/DebugConsoleDock.js.map +1 -0
- package/dist/devtools/ExecutionDetail.cjs +135 -0
- package/dist/devtools/ExecutionDetail.cjs.map +1 -0
- package/dist/devtools/ExecutionDetail.d.ts +19 -0
- package/dist/devtools/ExecutionDetail.d.ts.map +1 -0
- package/dist/devtools/ExecutionDetail.js +135 -0
- package/dist/devtools/ExecutionDetail.js.map +1 -0
- package/dist/devtools/debugClient.cjs +172 -0
- package/dist/devtools/debugClient.cjs.map +1 -0
- package/dist/devtools/debugClient.d.ts +98 -0
- package/dist/devtools/debugClient.d.ts.map +1 -0
- package/dist/devtools/debugClient.js +172 -0
- package/dist/devtools/debugClient.js.map +1 -0
- package/dist/devtools/debugStore.cjs +115 -0
- package/dist/devtools/debugStore.cjs.map +1 -0
- package/dist/devtools/debugStore.d.ts +83 -0
- package/dist/devtools/debugStore.d.ts.map +1 -0
- package/dist/devtools/debugStore.js +115 -0
- package/dist/devtools/debugStore.js.map +1 -0
- package/dist/devtools/dockState.cjs +51 -0
- package/dist/devtools/dockState.cjs.map +1 -0
- package/dist/devtools/dockState.d.ts +31 -0
- package/dist/devtools/dockState.d.ts.map +1 -0
- package/dist/devtools/dockState.js +51 -0
- package/dist/devtools/dockState.js.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.cjs +36 -0
- package/dist/devtools/tabs/ConsoleTab.cjs.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts +19 -0
- package/dist/devtools/tabs/ConsoleTab.d.ts.map +1 -0
- package/dist/devtools/tabs/ConsoleTab.js +36 -0
- package/dist/devtools/tabs/ConsoleTab.js.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.cjs +150 -0
- package/dist/devtools/tabs/InspectionCaches.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts +23 -0
- package/dist/devtools/tabs/InspectionCaches.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionCaches.js +150 -0
- package/dist/devtools/tabs/InspectionCaches.js.map +1 -0
- package/dist/devtools/tabs/InspectionTab.cjs +316 -0
- package/dist/devtools/tabs/InspectionTab.cjs.map +1 -0
- package/dist/devtools/tabs/InspectionTab.d.ts +27 -0
- package/dist/devtools/tabs/InspectionTab.d.ts.map +1 -0
- package/dist/devtools/tabs/InspectionTab.js +316 -0
- package/dist/devtools/tabs/InspectionTab.js.map +1 -0
- package/dist/devtools/tabs/NetworkTab.cjs +91 -0
- package/dist/devtools/tabs/NetworkTab.cjs.map +1 -0
- package/dist/devtools/tabs/NetworkTab.d.ts +20 -0
- package/dist/devtools/tabs/NetworkTab.d.ts.map +1 -0
- package/dist/devtools/tabs/NetworkTab.js +91 -0
- package/dist/devtools/tabs/NetworkTab.js.map +1 -0
- package/dist/devtools/tabs/QueriesTab.cjs +85 -0
- package/dist/devtools/tabs/QueriesTab.cjs.map +1 -0
- package/dist/devtools/tabs/QueriesTab.d.ts +24 -0
- package/dist/devtools/tabs/QueriesTab.d.ts.map +1 -0
- package/dist/devtools/tabs/QueriesTab.js +85 -0
- package/dist/devtools/tabs/QueriesTab.js.map +1 -0
- package/dist/devtools/types.cjs +26 -0
- package/dist/devtools/types.cjs.map +1 -0
- package/dist/devtools/types.d.ts +235 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools/types.js +26 -0
- package/dist/devtools/types.js.map +1 -0
- package/dist/devtools/useDebugStream.cjs +46 -0
- package/dist/devtools/useDebugStream.cjs.map +1 -0
- package/dist/devtools/useDebugStream.d.ts +23 -0
- package/dist/devtools/useDebugStream.d.ts.map +1 -0
- package/dist/devtools/useDebugStream.js +46 -0
- package/dist/devtools/useDebugStream.js.map +1 -0
- package/dist/devtools.cjs +51 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.ts +37 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +51 -0
- package/dist/devtools.js.map +1 -0
- package/dist/icons/components/UiOpenScad.cjs +10 -0
- package/dist/icons/components/UiOpenScad.cjs.map +1 -0
- package/dist/icons/components/UiOpenScad.d.ts +9 -0
- package/dist/icons/components/UiOpenScad.d.ts.map +1 -0
- package/dist/icons/components/UiOpenScad.js +10 -0
- package/dist/icons/components/UiOpenScad.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/registry.cjs +2 -0
- package/dist/icons/registry.cjs.map +1 -1
- package/dist/icons/registry.d.ts.map +1 -1
- package/dist/icons/registry.js +2 -0
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons.cjs +2 -0
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.cjs +15 -10
- package/dist/layout/AppShell.cjs.map +1 -1
- package/dist/layout/AppShell.d.ts +11 -0
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShell.js +15 -10
- package/dist/layout/AppShell.js.map +1 -1
- package/dist/layout/AppShell.nav.cjs +170 -49
- package/dist/layout/AppShell.nav.cjs.map +1 -1
- package/dist/layout/AppShell.nav.d.ts.map +1 -1
- package/dist/layout/AppShell.nav.js +170 -49
- package/dist/layout/AppShell.nav.js.map +1 -1
- package/dist/overlay/CellActions.cjs +18 -124
- package/dist/overlay/CellActions.cjs.map +1 -1
- package/dist/overlay/CellActions.d.ts +1 -1
- package/dist/overlay/CellActions.d.ts.map +1 -1
- package/dist/overlay/CellActions.js +18 -124
- package/dist/overlay/CellActions.js.map +1 -1
- package/dist/overlay/ContextMenu.cjs +144 -0
- package/dist/overlay/ContextMenu.cjs.map +1 -0
- package/dist/overlay/ContextMenu.d.ts +8 -0
- package/dist/overlay/ContextMenu.d.ts.map +1 -0
- package/dist/overlay/ContextMenu.js +144 -0
- package/dist/overlay/ContextMenu.js.map +1 -0
- package/dist/profiles/connections/connectionBrowserModel.cjs +14 -65
- package/dist/profiles/connections/connectionBrowserModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.d.ts +35 -35
- package/dist/profiles/connections/connectionBrowserModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionBrowserModel.js +14 -65
- package/dist/profiles/connections/connectionBrowserModel.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.cjs +29 -9
- package/dist/profiles/connections/connectionQueryWorkspace.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts +3 -2
- package/dist/profiles/connections/connectionQueryWorkspace.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspace.js +30 -10
- package/dist/profiles/connections/connectionQueryWorkspace.js.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.cjs.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts +22 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.d.ts.map +1 -1
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js +15 -0
- package/dist/profiles/connections/connectionQueryWorkspaceModel.js.map +1 -1
- package/dist/profiles/connections/index.d.ts +1 -0
- package/dist/profiles/connections/index.d.ts.map +1 -1
- package/dist/profiles/connections/inspectionStatus.cjs +44 -0
- package/dist/profiles/connections/inspectionStatus.cjs.map +1 -0
- package/dist/profiles/connections/inspectionStatus.d.ts +5 -0
- package/dist/profiles/connections/inspectionStatus.d.ts.map +1 -0
- package/dist/profiles/connections/inspectionStatus.js +44 -0
- package/dist/profiles/connections/inspectionStatus.js.map +1 -0
- package/dist/profiles/connections/useInspection.cjs +123 -0
- package/dist/profiles/connections/useInspection.cjs.map +1 -0
- package/dist/profiles/connections/useInspection.d.ts +35 -0
- package/dist/profiles/connections/useInspection.d.ts.map +1 -0
- package/dist/profiles/connections/useInspection.js +123 -0
- package/dist/profiles/connections/useInspection.js.map +1 -0
- package/dist/profiles/editor/profileBuilderWorkspace.cjs +55 -23
- package/dist/profiles/editor/profileBuilderWorkspace.cjs.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.d.ts.map +1 -1
- package/dist/profiles/editor/profileBuilderWorkspace.js +56 -24
- package/dist/profiles/editor/profileBuilderWorkspace.js.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.cjs.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts +2 -2
- package/dist/profiles/elasticsearch/esQueryBuilder.d.ts.map +1 -1
- package/dist/profiles/elasticsearch/esQueryBuilder.js +12 -3
- package/dist/profiles/elasticsearch/esQueryBuilder.js.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.cjs +137 -22
- package/dist/profiles/fields/profileFieldEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldEditor.js +137 -22
- package/dist/profiles/fields/profileFieldEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.cjs +171 -82
- package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts +0 -9
- package/dist/profiles/fields/profileFieldFilterEditor.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.js +174 -85
- package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.cjs +6 -3
- package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.js +6 -3
- package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
- package/dist/profiles/query/profileSampleFilterLookup.cjs +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.cjs.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts +12 -0
- package/dist/profiles/query/profileSampleFilterLookup.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleFilterLookup.js +34 -0
- package/dist/profiles/query/profileSampleFilterLookup.js.map +1 -0
- package/dist/profiles/query/profileSamplePayload.cjs +6 -4
- package/dist/profiles/query/profileSamplePayload.cjs.map +1 -1
- package/dist/profiles/query/profileSamplePayload.d.ts +11 -4
- package/dist/profiles/query/profileSamplePayload.d.ts.map +1 -1
- package/dist/profiles/query/profileSamplePayload.js +6 -4
- package/dist/profiles/query/profileSamplePayload.js.map +1 -1
- package/dist/profiles/query/profileSampleResult.cjs +26 -0
- package/dist/profiles/query/profileSampleResult.cjs.map +1 -0
- package/dist/profiles/query/profileSampleResult.d.ts +11 -0
- package/dist/profiles/query/profileSampleResult.d.ts.map +1 -0
- package/dist/profiles/query/profileSampleResult.js +26 -0
- package/dist/profiles/query/profileSampleResult.js.map +1 -0
- package/dist/profiles/query/queryTargetPicker.cjs +5 -3
- package/dist/profiles/query/queryTargetPicker.cjs.map +1 -1
- package/dist/profiles/query/queryTargetPicker.d.ts +3 -2
- package/dist/profiles/query/queryTargetPicker.d.ts.map +1 -1
- package/dist/profiles/query/queryTargetPicker.js +5 -3
- package/dist/profiles/query/queryTargetPicker.js.map +1 -1
- package/dist/profiles/wizard/profileWizard.cjs +14 -5
- package/dist/profiles/wizard/profileWizard.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizard.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizard.js +15 -6
- package/dist/profiles/wizard/profileWizard.js.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.cjs +35 -6
- package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.d.ts +29 -4
- package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.js +35 -6
- package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +44 -11
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +46 -13
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.cjs +33 -2
- package/dist/profiles/wizard/profileWizardSteps.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.d.ts +11 -2
- package/dist/profiles/wizard/profileWizardSteps.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardSteps.js +33 -2
- package/dist/profiles/wizard/profileWizardSteps.js.map +1 -1
- package/dist/profiles.cjs +8 -2
- package/dist/profiles.cjs.map +1 -1
- package/dist/profiles.js +10 -4
- package/dist/profiles.js.map +1 -1
- package/dist/rpc/FilterForm.cjs +21 -237
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.d.ts +3 -1
- package/dist/rpc/FilterForm.d.ts.map +1 -1
- package/dist/rpc/FilterForm.js +21 -237
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/FilterFormFields.cjs +240 -0
- package/dist/rpc/FilterFormFields.cjs.map +1 -0
- package/dist/rpc/FilterFormFields.d.ts +12 -0
- package/dist/rpc/FilterFormFields.d.ts.map +1 -0
- package/dist/rpc/FilterFormFields.js +240 -0
- package/dist/rpc/FilterFormFields.js.map +1 -0
- package/dist/rpc/router.cjs +3 -2
- package/dist/rpc/router.cjs.map +1 -1
- package/dist/rpc/router.d.ts.map +1 -1
- package/dist/rpc/router.js +3 -2
- package/dist/rpc/router.js.map +1 -1
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +3 -1
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
- package/dist/data/query-info/QueryInfoDialog.cjs +0 -106
- package/dist/data/query-info/QueryInfoDialog.cjs.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.d.ts +0 -16
- package/dist/data/query-info/QueryInfoDialog.d.ts.map +0 -1
- package/dist/data/query-info/QueryInfoDialog.js +0 -106
- package/dist/data/query-info/QueryInfoDialog.js.map +0 -1
- package/dist/data/query-info/index.d.ts +0 -4
- package/dist/data/query-info/index.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.cjs +0 -42
- package/dist/data/query-info/queryInfo.cjs.map +0 -1
- package/dist/data/query-info/queryInfo.d.ts +0 -45
- package/dist/data/query-info/queryInfo.d.ts.map +0 -1
- package/dist/data/query-info/queryInfo.js +0 -42
- package/dist/data/query-info/queryInfo.js.map +0 -1
- package/dist/data/query-info/useQueryInfo.cjs +0 -48
- package/dist/data/query-info/useQueryInfo.cjs.map +0 -1
- package/dist/data/query-info/useQueryInfo.d.ts +0 -26
- package/dist/data/query-info/useQueryInfo.d.ts.map +0 -1
- package/dist/data/query-info/useQueryInfo.js +0 -48
- package/dist/data/query-info/useQueryInfo.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspace.cjs","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"sourcesContent":["/**\n * The single query-browser host. The connection browser, the profile wizard and\n * the profile-edit builder all render this: they own where the query and the\n * options are stored and what a run means, and this owns the browser itself —\n * the catalog navigator, the structured filter builder, the completion, and the\n * descriptor's result view.\n */\n\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { LogsTable } from \"../../data/LogsTable\";\nimport { QueryBrowser } from \"../../data/query-browser/QueryBrowser\";\nimport type { QueryBrowserFilterLookup, QueryBrowserRequest, QueryBrowserResult, QueryBrowserResultContext } from \"../../data/query-browser/QueryBrowser.types\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { CatalogTree } from \"./catalogTree\";\nimport {\n withTarget,\n type BrowserDescriptor,\n type CatalogNode,\n type Inspection,\n type ProfileRowLimits\n} from \"./connectionBrowserModel\";\nimport { makeFieldValueLookup } from \"../elasticsearch/esFieldValues\";\nimport { EsQueryBuilder } from \"../elasticsearch/esQueryBuilder\";\nimport {\n toBuilderMode,\n toRawMode,\n type EsSearch,\n type QueryModeTransition\n} from \"../elasticsearch/esQueryBuilderModel\";\nimport {\n esBuilderVocabulary\n } from \"../elasticsearch/esQueryOperators\";\nimport { PrometheusResults } from \"../query/prometheusResults\";\nimport { QueryRowLimits } from \"../query/queryRowLimits\";\nimport { QueryTargetPicker } from \"../query/queryTargetPicker\";\nimport { KubernetesWorkloadTargetPicker } from \"../query/kubernetesWorkloadTargetPicker\";\nimport type { ParamMappingEdit } from \"../elasticsearch/esParamMappingModel\";\nimport type { ParamDraft } from \"../wizard/profileWizardModel\";\nimport { initialNavigatorTab, navigatorTabs, supportsQueryBuilder } from \"./connectionQueryWorkspaceModel\";\nimport { esQueryFields } from \"../elasticsearch/esQueryBuilderForm\";\nimport { useCompiledSearch } from \"../elasticsearch/esQueryCompile\";\n\n\nexport type ConnectionQueryWorkspaceProps = {\n id: string;\n title: string;\n descriptor: BrowserDescriptor;\n inspection: Inspection;\n onDatabaseChange: (database: string) => void;\n query: string;\n onQueryChange?: (query: string) => void | undefined;\n options: Record<string, unknown>;\n onOptionsChange: (options: Record<string, unknown>) => void;\n onCatalogSelect: (node: CatalogNode) => void;\n optionsSchema?: JsonSchemaObject | undefined;\n /**\n * The structured specification this host stores, when it stores one.\n * `undefined` means the raw query is the artifact.\n */\n search?: EsSearch | undefined;\n /**\n * Every change reports the specification and the raw query together, and one\n * of the two is always empty. The host stores both in one write, so it can\n * never end up holding a specification and a query at once — a state the\n * server rejects.\n */\n onSearchChange?: (transition: QueryModeTransition) => void | undefined;\n /**\n * The row caps the edited profile sets for itself. They are profile settings,\n * not provider options, so they are stored beside the query rather than\n * through `onOptionsChange`. A host that edits no profile — the connection\n * browser — passes neither, and the caps are then not offered at all.\n */\n limits?: ProfileRowLimits | undefined;\n onLimitsChange?: (limits: ProfileRowLimits | undefined) => void;\n /** Declared profile parameters an operand can bind to. */\n params?: ParamDraft[] | undefined;\n onParamMappingChange?: (edit: ParamMappingEdit) => void | undefined;\n /**\n * What those parameters currently resolve to. The server binds a {param:…}\n * operand from them and interpolates a {{.params.…}} one, so without values\n * the preview shows template text — or the compiler's refusal to guess.\n */\n paramValues?: Record<string, unknown> | undefined;\n /** Those parameters' roles, so the compiled preview folds them as a run would. */\n paramRoles?: Record<string, string> | undefined;\n /** Where POST /compile lives. Empty leaves the preview unresolved. */\n compileBaseUrl?: string | undefined;\n execute: (request: QueryBrowserRequest) => Promise<QueryBrowserResult>;\n /**\n * Answers a filter's value type-ahead. Absent leaves every filter the source\n * described showing only the values the result itself carried.\n */\n lookupFilterValues?: QueryBrowserFilterLookup | undefined;\n renderResults?: (context: QueryBrowserResultContext) => ReactNode | undefined;\n className?: string | undefined;\n};\n\nexport function ConnectionQueryWorkspace({\n id,\n title,\n descriptor,\n inspection,\n onDatabaseChange,\n query,\n onQueryChange,\n options,\n onOptionsChange,\n onCatalogSelect,\n optionsSchema,\n search,\n onSearchChange,\n limits,\n onLimitsChange,\n params,\n onParamMappingChange,\n paramValues,\n paramRoles,\n compileBaseUrl = \"\",\n execute,\n lookupFilterValues,\n renderResults,\n className\n}: ConnectionQueryWorkspaceProps) {\n const builder = Boolean(onSearchChange) && supportsQueryBuilder(descriptor);\n const tabs = navigatorTabs({ descriptor, builder });\n const [tab, setTab] = useState<string | undefined>(() =>\n initialNavigatorTab({\n tabs,\n search,\n query,\n ...(descriptor.defaultQuery ? { defaultQuery: descriptor.defaultQuery } : {})\n }),\n );\n // Picking a target has to reach the browser, which only resyncs its options\n // when `initialOptions` changes identity. The pick is layered here rather than\n // round-tripped through the host, so an options-form keystroke — which the\n // host also stores — cannot resync the browser out from under the author.\n const [picked, setPicked] = useState<Record<string, unknown>>();\n // What the browser last reported, so a pick keeps the author's other edits.\n const edited = useRef(options);\n const seed = useRef(options);\n if (seed.current !== options) {\n seed.current = options;\n edited.current = options;\n if (picked) setPicked(undefined);\n }\n const browserOptions = picked ?? options;\n const applyOptions = (next: Record<string, unknown>) => {\n edited.current = next;\n setPicked(next);\n onOptionsChange(next);\n };\n const compilation = useCompiledSearch({\n baseUrl: compileBaseUrl,\n search: search ?? {},\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n enabled: Boolean(search) && compileBaseUrl !== \"\"\n });\n const values = makeFieldValueLookup({\n baseUrl: compileBaseUrl,\n index: String(browserOptions.index ?? \"\"),\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {})\n });\n\n // While a specification is active the editor mirrors what it compiles to. It\n // is a preview, not an input: the query is not stored alongside the spec, so\n // there is no keystroke for a compile to overwrite.\n const specMode = search !== undefined;\n const active = tabs.some((entry) => entry.id === tab) ? tab : tabs[0]?.id;\n\n // The form tab is the specification, so being on it means holding one. A tab\n // that stores nothing would leave the builder rendering a query it cannot\n // edit, and this is also what makes filters the default rather than an opt-in.\n useEffect(() => {\n if (active === \"form\" && onSearchChange && search === undefined) {\n onSearchChange(toBuilderMode());\n }\n }, [active, onSearchChange, search]);\n\n // Switching tabs is the mode switch. Each mode stores its own artifact and the\n // server rejects holding both, so leaving the form hands the raw editor the\n // DSL the specification last compiled to and drops the specification.\n const selectTab = (next: string) => {\n if (next === \"json\" && search && onSearchChange) {\n onSearchChange(toRawMode(search, compilation.query, query));\n }\n setTab(next);\n };\n\n return (\n <QueryBrowser\n id={id}\n title={title}\n language={descriptor.language ?? \"text\"}\n queryLabel={descriptor.queryLabel ?? \"Query\"}\n initialQuery={specMode ? compilation.query : query}\n allowEmptyQuery={descriptor.allowEmptyQuery}\n optionsSchema={optionsSchema}\n initialOptions={browserOptions}\n completion={inspection.completion}\n {...(specMode ? {} : onQueryChange ? { onQueryChange } : {})}\n onOptionsChange={(next) => {\n edited.current = next;\n onOptionsChange(next);\n }}\n className={className}\n navigator={\n tabs.length === 0 && !descriptor.target ? undefined : (\n <div className=\"flex min-h-0 flex-col gap-2\">\n {descriptor.target?.kind === \"index\" ? (\n <QueryTargetPicker\n label={descriptor.target.label}\n inspection={inspection}\n value={String(browserOptions.index ?? \"\")}\n onChange={(index, targetKind) =>\n applyOptions(withTarget(edited.current, { index, targetKind }))\n }\n />\n ) : null}\n {descriptor.target?.kind === \"kubernetes-workload\" ? (\n <KubernetesWorkloadTargetPicker\n baseUrl={compileBaseUrl}\n target={descriptor.target}\n query={query}\n onChange={(next) => onQueryChange?.(next)}\n />\n ) : null}\n {builder ? (\n <QueryRowLimits\n value={String(browserOptions.limit ?? \"\")}\n onChange={(limit) =>\n applyOptions({ ...edited.current, limit })\n }\n {...(descriptor.rowLimits\n ? { defaults: descriptor.rowLimits }\n : {})}\n {...(limits ? { limits } : {})}\n {...(onLimitsChange ? { onLimitsChange } : {})}\n />\n ) : null}\n {tabs.length > 1 ? (\n <Tabs tabs={tabs} value={active ?? \"\"} onChange={selectTab} />\n ) : null}\n {active === \"form\" && onSearchChange && search ? (\n <EsQueryBuilder\n search={search}\n onChange={(next) => onSearchChange({ search: next, query: \"\" })}\n fields={esQueryFields(inspection.completion)}\n vocabulary={esBuilderVocabulary(descriptor.optionsSchema)}\n {...(params ? { params } : {})}\n {...(onParamMappingChange\n ? { onMappingChange: onParamMappingChange }\n : {})}\n {...(values ? { values } : {})}\n compilation={compilation}\n />\n ) : active === \"json\" ? (\n <p className=\"rounded-md border border-dashed p-3 text-xs text-muted-foreground\">\n The {descriptor.queryLabel ?? \"query\"} editor holds the query.\n Switch back to Form to build it from filters — the raw query is\n dropped then, since only one of the two is stored.\n </p>\n ) : active === \"catalog\" ? (\n <CatalogTree\n nodes={inspection.nodes}\n loading={inspection.loading}\n error={inspection.error}\n databases={inspection.databases}\n database={inspection.activeDatabase}\n onDatabaseChange={onDatabaseChange}\n onSelect={onCatalogSelect}\n />\n ) : null}\n </div>\n )\n }\n execute={(request) =>\n execute(\n specMode\n ? { ...request, query: \"\", options: { ...request.options, search } }\n : request,\n )\n }\n {...(lookupFilterValues ? { lookupFilterValues } : {})}\n renderResults={renderResults ?? descriptorResultView(descriptor)}\n />\n );\n}\n\n/**\n * descriptorResultView honours the view the server nominated for this provider.\n * A host that renders its own results (the profile builder's column picker)\n * passes renderResults and takes over entirely.\n */\nfunction descriptorResultView(\n descriptor: BrowserDescriptor,\n): ((context: QueryBrowserResultContext) => ReactNode) | undefined {\n if (descriptor.resultView === \"logs\") {\n return ({ result, defaultView }) =>\n result.rows?.length ? (\n <LogsTable logs={result.rows} autoFilter={false} fullscreenTitle=\"Logs\" />\n ) : (\n defaultView\n );\n }\n if (descriptor.resultView === \"timeseries\") {\n return ({ result, defaultView }) => (\n <PrometheusResults result={result} fallback={defaultView} />\n );\n }\n return undefined;\n}\n"],"names":["supportsQueryBuilder","navigatorTabs","useState","initialNavigatorTab","useRef","useCompiledSearch","makeFieldValueLookup","useEffect","toBuilderMode","toRawMode","jsx","QueryBrowser","jsxs","QueryTargetPicker","withTarget","KubernetesWorkloadTargetPicker","QueryRowLimits","Tabs","EsQueryBuilder","esQueryFields","esBuilderVocabulary","CatalogTree","LogsTable","PrometheusResults"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmGO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkC;;AAChC,QAAM,UAAU,QAAQ,cAAc,KAAKA,8BAAAA,qBAAqB,UAAU;AAC1E,QAAM,OAAOC,8BAAAA,cAAc,EAAE,YAAY,SAAS;AAClD,QAAM,CAAC,KAAK,MAAM,IAAIC,MAAAA;AAAAA,IAA6B,MACjDC,kDAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAI,WAAW,eAAe,EAAE,cAAc,WAAW,aAAA,IAAiB,CAAA;AAAA,IAAC,CAC5E;AAAA,EAAA;AAMH,QAAM,CAAC,QAAQ,SAAS,IAAID,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OAAA,MACxD;AAAA,MAAA;AAAA,MAGP,GAAI,qBAAqB,EAAE,mBAAA,IAAuB,CAAA;AAAA,MACnD,eAAe,iBAAiB,qBAAqB,UAAU;AAAA,IAAA;AAAA,EAAA;AAGrE;AAOA,SAAS,qBACP,YACiE;AACjE,MAAI,WAAW,eAAe,QAAQ;AACpC,WAAO,CAAC,EAAE,QAAQ,YAAA,MAAY;;AAC5B,2BAAO,SAAP,mBAAa,UACXX,+BAACY,UAAAA,WAAA,EAAU,MAAM,OAAO,MAAM,YAAY,OAAO,iBAAgB,QAAO,IAExE;AAAA;AAAA,EAEN;AACA,MAAI,WAAW,eAAe,cAAc;AAC1C,WAAO,CAAC,EAAE,QAAQ,kBAChBZ,2BAAAA,IAACa,kBAAAA,mBAAA,EAAkB,QAAgB,UAAU,aAAa;AAAA,EAE9D;AACA,SAAO;AACT;;"}
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspace.cjs","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"sourcesContent":["/**\n * The single query-browser host. The connection browser, the profile wizard and\n * the profile-edit builder all render this: they own where the query and the\n * options are stored and what a run means, and this owns the browser itself —\n * the catalog navigator, the structured filter builder, the completion, and the\n * descriptor's result view.\n */\n\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { LogsTable } from \"../../data/LogsTable\";\nimport { QueryBrowser } from \"../../data/query-browser/QueryBrowser\";\nimport type {\n QueryBrowserFilterLookup,\n QueryBrowserRequest,\n QueryBrowserResult,\n QueryBrowserResultContext,\n} from \"../../data/query-browser/QueryBrowser.types\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { CatalogTree } from \"./catalogTree\";\nimport {\n withTarget,\n type BrowserDescriptor,\n type CatalogNode,\n type ProfileRowLimits,\n} from \"./connectionBrowserModel\";\nimport type { Inspection } from \"./useInspection\";\nimport { makeFieldValueLookup } from \"../elasticsearch/esFieldValues\";\nimport { EsQueryBuilder } from \"../elasticsearch/esQueryBuilder\";\nimport {\n toBuilderMode,\n toRawMode,\n type EsSearch,\n type QueryModeTransition,\n} from \"../elasticsearch/esQueryBuilderModel\";\nimport { esBuilderVocabulary } from \"../elasticsearch/esQueryOperators\";\nimport { PrometheusResults } from \"../query/prometheusResults\";\nimport { QueryRowLimits } from \"../query/queryRowLimits\";\nimport { QueryTargetPicker } from \"../query/queryTargetPicker\";\nimport { KubernetesWorkloadTargetPicker } from \"../query/kubernetesWorkloadTargetPicker\";\nimport type { ParamMappingEdit } from \"../elasticsearch/esParamMappingModel\";\nimport type { ParamDraft } from \"../wizard/profileWizardModel\";\nimport {\n initialNavigatorTab,\n logsResultSort,\n navigatorTabs,\n structuredSearchRequest,\n supportsQueryBuilder,\n} from \"./connectionQueryWorkspaceModel\";\nimport { esQueryFields } from \"../elasticsearch/esQueryBuilderForm\";\nimport { useCompiledSearch } from \"../elasticsearch/esQueryCompile\";\nimport { InspectionStatus } from \"./inspectionStatus\";\n\nexport type ConnectionQueryWorkspaceProps = {\n id: string;\n title: string;\n descriptor: BrowserDescriptor;\n inspection: Inspection;\n onDatabaseChange: (database: string) => void;\n query: string;\n onQueryChange?: (query: string) => void | undefined;\n options: Record<string, unknown>;\n onOptionsChange: (options: Record<string, unknown>) => void;\n onCatalogSelect: (node: CatalogNode) => void;\n optionsSchema?: JsonSchemaObject | undefined;\n /**\n * The structured specification this host stores, when it stores one.\n * `undefined` means the raw query is the artifact.\n */\n search?: EsSearch | undefined;\n /**\n * Every change reports the specification and the raw query together, and one\n * of the two is always empty. The host stores both in one write, so it can\n * never end up holding a specification and a query at once — a state the\n * server rejects.\n */\n onSearchChange?: (transition: QueryModeTransition) => void | undefined;\n /**\n * The row caps the edited profile sets for itself. They are profile settings,\n * not provider options, so they are stored beside the query rather than\n * through `onOptionsChange`. A host that edits no profile — the connection\n * browser — passes neither, and the caps are then not offered at all.\n */\n limits?: ProfileRowLimits | undefined;\n onLimitsChange?: (limits: ProfileRowLimits | undefined) => void;\n /** Declared profile parameters an operand can bind to. */\n params?: ParamDraft[] | undefined;\n onParamMappingChange?: (edit: ParamMappingEdit) => void | undefined;\n /**\n * What those parameters currently resolve to. The server binds a {param:…}\n * operand from them and interpolates a {{.params.…}} one, so without values\n * the preview shows template text — or the compiler's refusal to guess.\n */\n paramValues?: Record<string, unknown> | undefined;\n /** Those parameters' roles, so the compiled preview folds them as a run would. */\n paramRoles?: Record<string, string> | undefined;\n /** Where POST /compile lives. Empty leaves the preview unresolved. */\n compileBaseUrl?: string | undefined;\n execute: (request: QueryBrowserRequest) => Promise<QueryBrowserResult>;\n /**\n * Answers a filter's value type-ahead. Absent leaves every filter the source\n * described showing only the values the result itself carried.\n */\n lookupFilterValues?: QueryBrowserFilterLookup | undefined;\n renderResults?: (context: QueryBrowserResultContext) => ReactNode | undefined;\n className?: string | undefined;\n};\n\nexport function ConnectionQueryWorkspace({\n id,\n title,\n descriptor,\n inspection,\n onDatabaseChange,\n query,\n onQueryChange,\n options,\n onOptionsChange,\n onCatalogSelect,\n optionsSchema,\n search,\n onSearchChange,\n limits,\n onLimitsChange,\n params,\n onParamMappingChange,\n paramValues,\n paramRoles,\n compileBaseUrl = \"\",\n execute,\n lookupFilterValues,\n renderResults,\n className,\n}: ConnectionQueryWorkspaceProps) {\n const builder = Boolean(onSearchChange) && supportsQueryBuilder(descriptor);\n const tabs = navigatorTabs({ descriptor, builder });\n const [tab, setTab] = useState<string | undefined>(() =>\n initialNavigatorTab({\n tabs,\n search,\n query,\n ...(descriptor.defaultQuery\n ? { defaultQuery: descriptor.defaultQuery }\n : {}),\n }),\n );\n // Picking a target has to reach the browser, which only resyncs its options\n // when `initialOptions` changes identity. The pick is layered here rather than\n // round-tripped through the host, so an options-form keystroke — which the\n // host also stores — cannot resync the browser out from under the author.\n const [picked, setPicked] = useState<Record<string, unknown>>();\n // What the browser last reported, so a pick keeps the author's other edits.\n const edited = useRef(options);\n const seed = useRef(options);\n if (seed.current !== options) {\n seed.current = options;\n edited.current = options;\n if (picked) setPicked(undefined);\n }\n const browserOptions = picked ?? options;\n const applyOptions = (next: Record<string, unknown>) => {\n edited.current = next;\n setPicked(next);\n onOptionsChange(next);\n };\n const compilation = useCompiledSearch({\n baseUrl: compileBaseUrl,\n search: search ?? {},\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n enabled: Boolean(search) && compileBaseUrl !== \"\",\n });\n const values = makeFieldValueLookup({\n baseUrl: compileBaseUrl,\n index: String(browserOptions.index ?? \"\"),\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n });\n\n // While a specification is active the editor mirrors what it compiles to. It\n // is a preview, not an input: the query is not stored alongside the spec, so\n // there is no keystroke for a compile to overwrite.\n const specMode = search !== undefined;\n const active = tabs.some((entry) => entry.id === tab) ? tab : tabs[0]?.id;\n const indexTarget =\n descriptor.target?.kind === \"index\" ? descriptor.target : undefined;\n\n // The form tab is the specification, so being on it means holding one. A tab\n // that stores nothing would leave the builder rendering a query it cannot\n // edit, and this is also what makes filters the default rather than an opt-in.\n useEffect(() => {\n if (active === \"form\" && onSearchChange && search === undefined) {\n onSearchChange(toBuilderMode());\n }\n }, [active, onSearchChange, search]);\n\n // Switching tabs is the mode switch. Each mode stores its own artifact and the\n // server rejects holding both, so leaving the form hands the raw editor the\n // DSL the specification last compiled to and drops the specification.\n const selectTab = (next: string) => {\n if (next === \"json\" && search && onSearchChange) {\n onSearchChange(toRawMode(search, compilation.query, query));\n }\n setTab(next);\n };\n\n return (\n <QueryBrowser\n id={id}\n title={title}\n language={descriptor.language ?? \"text\"}\n queryLabel={descriptor.queryLabel ?? \"Query\"}\n initialQuery={specMode ? compilation.query : query}\n allowEmptyQuery={descriptor.allowEmptyQuery}\n optionsSchema={optionsSchema}\n initialOptions={browserOptions}\n completion={inspection.completion}\n {...(specMode ? {} : onQueryChange ? { onQueryChange } : {})}\n onOptionsChange={(next) => {\n edited.current = next;\n onOptionsChange(next);\n }}\n className={className}\n navigator={\n tabs.length === 0 && !descriptor.target ? undefined : (\n <div className=\"flex min-h-0 flex-col gap-2\">\n {descriptor.catalog ? (\n <InspectionStatus inspection={inspection} />\n ) : null}\n {indexTarget ? (\n <QueryTargetPicker\n label={indexTarget.label}\n inspection={inspection}\n discoverable={descriptor.catalog === true}\n value={String(browserOptions[indexTarget.option] ?? \"\")}\n onChange={(index, targetKind) =>\n applyOptions(\n withTarget(edited.current, {\n option: indexTarget.option,\n value: index,\n targetKind,\n }),\n )\n }\n />\n ) : null}\n {descriptor.target?.kind === \"kubernetes-workload\" ? (\n <KubernetesWorkloadTargetPicker\n baseUrl={compileBaseUrl}\n target={descriptor.target}\n query={query}\n onChange={(next) => onQueryChange?.(next)}\n />\n ) : null}\n {builder ? (\n <QueryRowLimits\n value={String(browserOptions.limit ?? \"\")}\n onChange={(limit) => applyOptions({ ...edited.current, limit })}\n {...(descriptor.rowLimits\n ? { defaults: descriptor.rowLimits }\n : {})}\n {...(limits ? { limits } : {})}\n {...(onLimitsChange ? { onLimitsChange } : {})}\n />\n ) : null}\n {tabs.length > 1 ? (\n <Tabs tabs={tabs} value={active ?? \"\"} onChange={selectTab} />\n ) : null}\n {active === \"form\" && onSearchChange && search ? (\n <EsQueryBuilder\n search={search}\n onChange={(next) => onSearchChange({ search: next, query: \"\" })}\n fields={esQueryFields(inspection.completion)}\n vocabulary={esBuilderVocabulary(descriptor.optionsSchema)}\n {...(params ? { params } : {})}\n {...(onParamMappingChange\n ? { onMappingChange: onParamMappingChange }\n : {})}\n {...(values ? { values } : {})}\n compilation={compilation}\n />\n ) : active === \"json\" ? (\n <p className=\"rounded-md border border-dashed p-3 text-xs text-muted-foreground\">\n The {descriptor.queryLabel ?? \"query\"} editor holds the query.\n Switch back to Form to build it from filters — the raw query is\n dropped then, since only one of the two is stored.\n </p>\n ) : active === \"catalog\" ? (\n <CatalogTree\n nodes={inspection.nodes}\n loading={inspection.loading}\n error={inspection.error}\n databases={inspection.databases}\n database={inspection.activeDatabase}\n onDatabaseChange={onDatabaseChange}\n onSelect={onCatalogSelect}\n />\n ) : null}\n </div>\n )\n }\n execute={(request) =>\n execute(specMode ? structuredSearchRequest(request, search) : request)\n }\n {...(lookupFilterValues\n ? {\n lookupFilterValues: (request) =>\n lookupFilterValues(\n specMode ? structuredSearchRequest(request, search) : request,\n ),\n }\n : {})}\n renderResults={renderResults ?? descriptorResultView(descriptor)}\n />\n );\n}\n\n/**\n * descriptorResultView honours the view the server nominated for this provider.\n * A host that renders its own results (the profile builder's column picker)\n * passes renderResults and takes over entirely.\n */\nfunction descriptorResultView(\n descriptor: BrowserDescriptor,\n): ((context: QueryBrowserResultContext) => ReactNode) | undefined {\n if (descriptor.resultView === \"logs\") {\n return ({ result, defaultView }) =>\n result.rows?.length ? (\n <LogsTable\n logs={result.rows}\n autoFilter={false}\n fullscreenTitle=\"Logs\"\n {...logsResultSort(descriptor)}\n />\n ) : (\n defaultView\n );\n }\n if (descriptor.resultView === \"timeseries\") {\n return ({ result, defaultView }) => (\n <PrometheusResults result={result} fallback={defaultView} />\n );\n }\n return undefined;\n}\n"],"names":["supportsQueryBuilder","navigatorTabs","useState","initialNavigatorTab","useRef","useCompiledSearch","makeFieldValueLookup","useEffect","toBuilderMode","toRawMode","jsx","QueryBrowser","jsxs","InspectionStatus","QueryTargetPicker","withTarget","KubernetesWorkloadTargetPicker","QueryRowLimits","Tabs","EsQueryBuilder","esQueryFields","esBuilderVocabulary","CatalogTree","structuredSearchRequest","LogsTable","logsResultSort","PrometheusResults"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4GO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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IAACgB,kBAAAA,mBAAA,EAAkB,QAAgB,UAAU,aAAa;AAAA,EAE9D;AACA,SAAO;AACT;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { JsonSchemaObject } from '../../components/json-schema-form-types';
|
|
2
2
|
import { QueryBrowserFilterLookup, QueryBrowserRequest, QueryBrowserResult, QueryBrowserResultContext } from '../../data/query-browser/QueryBrowser.types';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
import { BrowserDescriptor, CatalogNode,
|
|
4
|
+
import { BrowserDescriptor, CatalogNode, ProfileRowLimits } from './connectionBrowserModel';
|
|
5
|
+
import { Inspection } from './useInspection';
|
|
5
6
|
import { EsSearch, QueryModeTransition } from '../elasticsearch/esQueryBuilderModel';
|
|
6
7
|
import { ParamMappingEdit } from '../elasticsearch/esParamMappingModel';
|
|
7
8
|
import { ParamDraft } from '../wizard/profileWizardModel';
|
|
@@ -59,5 +60,5 @@ export type ConnectionQueryWorkspaceProps = {
|
|
|
59
60
|
renderResults?: (context: QueryBrowserResultContext) => ReactNode | undefined;
|
|
60
61
|
className?: string | undefined;
|
|
61
62
|
};
|
|
62
|
-
export declare function ConnectionQueryWorkspace({ id, title, descriptor, inspection, onDatabaseChange, query, onQueryChange, options, onOptionsChange, onCatalogSelect, optionsSchema, search, onSearchChange, limits, onLimitsChange, params, onParamMappingChange, paramValues, paramRoles, compileBaseUrl, execute, lookupFilterValues, renderResults, className }: ConnectionQueryWorkspaceProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export declare function ConnectionQueryWorkspace({ id, title, descriptor, inspection, onDatabaseChange, query, onQueryChange, options, onOptionsChange, onCatalogSelect, optionsSchema, search, onSearchChange, limits, onLimitsChange, params, onParamMappingChange, paramValues, paramRoles, compileBaseUrl, execute, lookupFilterValues, renderResults, className, }: ConnectionQueryWorkspaceProps): import("react/jsx-runtime").JSX.Element;
|
|
63
64
|
//# sourceMappingURL=connectionQueryWorkspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspace.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAGhF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspace.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAGhF,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACzB,MAAM,sCAAsC,CAAC;AAM9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAY/D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,iBAAiB,CAAC;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS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AE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACvC,EAAE,EACF,KAAK,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,OAAO,EACP,eAAe,EACf,eAAe,EACf,aAAa,EACb,MAAM,EACN,cAAc,EACd,MAAM,EACN,cAAc,EACd,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,cAAmB,EACnB,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,SAAS,GACV,EAAE,6BAA6B,2CAsL/B"}
|
|
@@ -13,9 +13,10 @@ import { PrometheusResults } from "../query/prometheusResults.js";
|
|
|
13
13
|
import { QueryRowLimits } from "../query/queryRowLimits.js";
|
|
14
14
|
import { QueryTargetPicker } from "../query/queryTargetPicker.js";
|
|
15
15
|
import { KubernetesWorkloadTargetPicker } from "../query/kubernetesWorkloadTargetPicker.js";
|
|
16
|
-
import { supportsQueryBuilder, navigatorTabs, initialNavigatorTab } from "./connectionQueryWorkspaceModel.js";
|
|
16
|
+
import { supportsQueryBuilder, navigatorTabs, initialNavigatorTab, structuredSearchRequest, logsResultSort } from "./connectionQueryWorkspaceModel.js";
|
|
17
17
|
import { esQueryFields } from "../elasticsearch/esQueryBuilderForm.js";
|
|
18
18
|
import { useCompiledSearch } from "../elasticsearch/esQueryCompile.js";
|
|
19
|
+
import { InspectionStatus } from "./inspectionStatus.js";
|
|
19
20
|
function ConnectionQueryWorkspace({
|
|
20
21
|
id,
|
|
21
22
|
title,
|
|
@@ -82,6 +83,7 @@ function ConnectionQueryWorkspace({
|
|
|
82
83
|
});
|
|
83
84
|
const specMode = search !== void 0;
|
|
84
85
|
const active = tabs.some((entry) => entry.id === tab) ? tab : (_a = tabs[0]) == null ? void 0 : _a.id;
|
|
86
|
+
const indexTarget = ((_b = descriptor.target) == null ? void 0 : _b.kind) === "index" ? descriptor.target : void 0;
|
|
85
87
|
useEffect(() => {
|
|
86
88
|
if (active === "form" && onSearchChange && search === void 0) {
|
|
87
89
|
onSearchChange(toBuilderMode());
|
|
@@ -112,13 +114,21 @@ function ConnectionQueryWorkspace({
|
|
|
112
114
|
},
|
|
113
115
|
className,
|
|
114
116
|
navigator: tabs.length === 0 && !descriptor.target ? void 0 : /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-col gap-2", children: [
|
|
115
|
-
|
|
117
|
+
descriptor.catalog ? /* @__PURE__ */ jsx(InspectionStatus, { inspection }) : null,
|
|
118
|
+
indexTarget ? /* @__PURE__ */ jsx(
|
|
116
119
|
QueryTargetPicker,
|
|
117
120
|
{
|
|
118
|
-
label:
|
|
121
|
+
label: indexTarget.label,
|
|
119
122
|
inspection,
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
discoverable: descriptor.catalog === true,
|
|
124
|
+
value: String(browserOptions[indexTarget.option] ?? ""),
|
|
125
|
+
onChange: (index, targetKind) => applyOptions(
|
|
126
|
+
withTarget(edited.current, {
|
|
127
|
+
option: indexTarget.option,
|
|
128
|
+
value: index,
|
|
129
|
+
targetKind
|
|
130
|
+
})
|
|
131
|
+
)
|
|
122
132
|
}
|
|
123
133
|
) : null,
|
|
124
134
|
((_c = descriptor.target) == null ? void 0 : _c.kind) === "kubernetes-workload" ? /* @__PURE__ */ jsx(
|
|
@@ -170,10 +180,12 @@ function ConnectionQueryWorkspace({
|
|
|
170
180
|
}
|
|
171
181
|
) : null
|
|
172
182
|
] }),
|
|
173
|
-
execute: (request) => execute(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
execute: (request) => execute(specMode ? structuredSearchRequest(request, search) : request),
|
|
184
|
+
...lookupFilterValues ? {
|
|
185
|
+
lookupFilterValues: (request) => lookupFilterValues(
|
|
186
|
+
specMode ? structuredSearchRequest(request, search) : request
|
|
187
|
+
)
|
|
188
|
+
} : {},
|
|
177
189
|
renderResults: renderResults ?? descriptorResultView(descriptor)
|
|
178
190
|
}
|
|
179
191
|
);
|
|
@@ -182,7 +194,15 @@ function descriptorResultView(descriptor) {
|
|
|
182
194
|
if (descriptor.resultView === "logs") {
|
|
183
195
|
return ({ result, defaultView }) => {
|
|
184
196
|
var _a;
|
|
185
|
-
return ((_a = result.rows) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(
|
|
197
|
+
return ((_a = result.rows) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(
|
|
198
|
+
LogsTable,
|
|
199
|
+
{
|
|
200
|
+
logs: result.rows,
|
|
201
|
+
autoFilter: false,
|
|
202
|
+
fullscreenTitle: "Logs",
|
|
203
|
+
...logsResultSort(descriptor)
|
|
204
|
+
}
|
|
205
|
+
) : defaultView;
|
|
186
206
|
};
|
|
187
207
|
}
|
|
188
208
|
if (descriptor.resultView === "timeseries") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspace.js","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"sourcesContent":["/**\n * The single query-browser host. The connection browser, the profile wizard and\n * the profile-edit builder all render this: they own where the query and the\n * options are stored and what a run means, and this owns the browser itself —\n * the catalog navigator, the structured filter builder, the completion, and the\n * descriptor's result view.\n */\n\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { LogsTable } from \"../../data/LogsTable\";\nimport { QueryBrowser } from \"../../data/query-browser/QueryBrowser\";\nimport type { QueryBrowserFilterLookup, QueryBrowserRequest, QueryBrowserResult, QueryBrowserResultContext } from \"../../data/query-browser/QueryBrowser.types\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { CatalogTree } from \"./catalogTree\";\nimport {\n withTarget,\n type BrowserDescriptor,\n type CatalogNode,\n type Inspection,\n type ProfileRowLimits\n} from \"./connectionBrowserModel\";\nimport { makeFieldValueLookup } from \"../elasticsearch/esFieldValues\";\nimport { EsQueryBuilder } from \"../elasticsearch/esQueryBuilder\";\nimport {\n toBuilderMode,\n toRawMode,\n type EsSearch,\n type QueryModeTransition\n} from \"../elasticsearch/esQueryBuilderModel\";\nimport {\n esBuilderVocabulary\n } from \"../elasticsearch/esQueryOperators\";\nimport { PrometheusResults } from \"../query/prometheusResults\";\nimport { QueryRowLimits } from \"../query/queryRowLimits\";\nimport { QueryTargetPicker } from \"../query/queryTargetPicker\";\nimport { KubernetesWorkloadTargetPicker } from \"../query/kubernetesWorkloadTargetPicker\";\nimport type { ParamMappingEdit } from \"../elasticsearch/esParamMappingModel\";\nimport type { ParamDraft } from \"../wizard/profileWizardModel\";\nimport { initialNavigatorTab, navigatorTabs, supportsQueryBuilder } from \"./connectionQueryWorkspaceModel\";\nimport { esQueryFields } from \"../elasticsearch/esQueryBuilderForm\";\nimport { useCompiledSearch } from \"../elasticsearch/esQueryCompile\";\n\n\nexport type ConnectionQueryWorkspaceProps = {\n id: string;\n title: string;\n descriptor: BrowserDescriptor;\n inspection: Inspection;\n onDatabaseChange: (database: string) => void;\n query: string;\n onQueryChange?: (query: string) => void | undefined;\n options: Record<string, unknown>;\n onOptionsChange: (options: Record<string, unknown>) => void;\n onCatalogSelect: (node: CatalogNode) => void;\n optionsSchema?: JsonSchemaObject | undefined;\n /**\n * The structured specification this host stores, when it stores one.\n * `undefined` means the raw query is the artifact.\n */\n search?: EsSearch | undefined;\n /**\n * Every change reports the specification and the raw query together, and one\n * of the two is always empty. The host stores both in one write, so it can\n * never end up holding a specification and a query at once — a state the\n * server rejects.\n */\n onSearchChange?: (transition: QueryModeTransition) => void | undefined;\n /**\n * The row caps the edited profile sets for itself. They are profile settings,\n * not provider options, so they are stored beside the query rather than\n * through `onOptionsChange`. A host that edits no profile — the connection\n * browser — passes neither, and the caps are then not offered at all.\n */\n limits?: ProfileRowLimits | undefined;\n onLimitsChange?: (limits: ProfileRowLimits | undefined) => void;\n /** Declared profile parameters an operand can bind to. */\n params?: ParamDraft[] | undefined;\n onParamMappingChange?: (edit: ParamMappingEdit) => void | undefined;\n /**\n * What those parameters currently resolve to. The server binds a {param:…}\n * operand from them and interpolates a {{.params.…}} one, so without values\n * the preview shows template text — or the compiler's refusal to guess.\n */\n paramValues?: Record<string, unknown> | undefined;\n /** Those parameters' roles, so the compiled preview folds them as a run would. */\n paramRoles?: Record<string, string> | undefined;\n /** Where POST /compile lives. Empty leaves the preview unresolved. */\n compileBaseUrl?: string | undefined;\n execute: (request: QueryBrowserRequest) => Promise<QueryBrowserResult>;\n /**\n * Answers a filter's value type-ahead. Absent leaves every filter the source\n * described showing only the values the result itself carried.\n */\n lookupFilterValues?: QueryBrowserFilterLookup | undefined;\n renderResults?: (context: QueryBrowserResultContext) => ReactNode | undefined;\n className?: string | undefined;\n};\n\nexport function ConnectionQueryWorkspace({\n id,\n title,\n descriptor,\n inspection,\n onDatabaseChange,\n query,\n onQueryChange,\n options,\n onOptionsChange,\n onCatalogSelect,\n optionsSchema,\n search,\n onSearchChange,\n limits,\n onLimitsChange,\n params,\n onParamMappingChange,\n paramValues,\n paramRoles,\n compileBaseUrl = \"\",\n execute,\n lookupFilterValues,\n renderResults,\n className\n}: ConnectionQueryWorkspaceProps) {\n const builder = Boolean(onSearchChange) && supportsQueryBuilder(descriptor);\n const tabs = navigatorTabs({ descriptor, builder });\n const [tab, setTab] = useState<string | undefined>(() =>\n initialNavigatorTab({\n tabs,\n search,\n query,\n ...(descriptor.defaultQuery ? { defaultQuery: descriptor.defaultQuery } : {})\n }),\n );\n // Picking a target has to reach the browser, which only resyncs its options\n // when `initialOptions` changes identity. The pick is layered here rather than\n // round-tripped through the host, so an options-form keystroke — which the\n // host also stores — cannot resync the browser out from under the author.\n const [picked, setPicked] = useState<Record<string, unknown>>();\n // What the browser last reported, so a pick keeps the author's other edits.\n const edited = useRef(options);\n const seed = useRef(options);\n if (seed.current !== options) {\n seed.current = options;\n edited.current = options;\n if (picked) setPicked(undefined);\n }\n const browserOptions = picked ?? options;\n const applyOptions = (next: Record<string, unknown>) => {\n edited.current = next;\n setPicked(next);\n onOptionsChange(next);\n };\n const compilation = useCompiledSearch({\n baseUrl: compileBaseUrl,\n search: search ?? {},\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n enabled: Boolean(search) && compileBaseUrl !== \"\"\n });\n const values = makeFieldValueLookup({\n baseUrl: compileBaseUrl,\n index: String(browserOptions.index ?? \"\"),\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {})\n });\n\n // While a specification is active the editor mirrors what it compiles to. It\n // is a preview, not an input: the query is not stored alongside the spec, so\n // there is no keystroke for a compile to overwrite.\n const specMode = search !== undefined;\n const active = tabs.some((entry) => entry.id === tab) ? tab : tabs[0]?.id;\n\n // The form tab is the specification, so being on it means holding one. A tab\n // that stores nothing would leave the builder rendering a query it cannot\n // edit, and this is also what makes filters the default rather than an opt-in.\n useEffect(() => {\n if (active === \"form\" && onSearchChange && search === undefined) {\n onSearchChange(toBuilderMode());\n }\n }, [active, onSearchChange, search]);\n\n // Switching tabs is the mode switch. Each mode stores its own artifact and the\n // server rejects holding both, so leaving the form hands the raw editor the\n // DSL the specification last compiled to and drops the specification.\n const selectTab = (next: string) => {\n if (next === \"json\" && search && onSearchChange) {\n onSearchChange(toRawMode(search, compilation.query, query));\n }\n setTab(next);\n };\n\n return (\n <QueryBrowser\n id={id}\n title={title}\n language={descriptor.language ?? \"text\"}\n queryLabel={descriptor.queryLabel ?? \"Query\"}\n initialQuery={specMode ? compilation.query : query}\n allowEmptyQuery={descriptor.allowEmptyQuery}\n optionsSchema={optionsSchema}\n initialOptions={browserOptions}\n completion={inspection.completion}\n {...(specMode ? {} : onQueryChange ? { onQueryChange } : {})}\n onOptionsChange={(next) => {\n edited.current = next;\n onOptionsChange(next);\n }}\n className={className}\n navigator={\n tabs.length === 0 && !descriptor.target ? undefined : (\n <div className=\"flex min-h-0 flex-col gap-2\">\n {descriptor.target?.kind === \"index\" ? (\n <QueryTargetPicker\n label={descriptor.target.label}\n inspection={inspection}\n value={String(browserOptions.index ?? \"\")}\n onChange={(index, targetKind) =>\n applyOptions(withTarget(edited.current, { index, targetKind }))\n }\n />\n ) : null}\n {descriptor.target?.kind === \"kubernetes-workload\" ? (\n <KubernetesWorkloadTargetPicker\n baseUrl={compileBaseUrl}\n target={descriptor.target}\n query={query}\n onChange={(next) => onQueryChange?.(next)}\n />\n ) : null}\n {builder ? (\n <QueryRowLimits\n value={String(browserOptions.limit ?? \"\")}\n onChange={(limit) =>\n applyOptions({ ...edited.current, limit })\n }\n {...(descriptor.rowLimits\n ? { defaults: descriptor.rowLimits }\n : {})}\n {...(limits ? { limits } : {})}\n {...(onLimitsChange ? { onLimitsChange } : {})}\n />\n ) : null}\n {tabs.length > 1 ? (\n <Tabs tabs={tabs} value={active ?? \"\"} onChange={selectTab} />\n ) : null}\n {active === \"form\" && onSearchChange && search ? (\n <EsQueryBuilder\n search={search}\n onChange={(next) => onSearchChange({ search: next, query: \"\" })}\n fields={esQueryFields(inspection.completion)}\n vocabulary={esBuilderVocabulary(descriptor.optionsSchema)}\n {...(params ? { params } : {})}\n {...(onParamMappingChange\n ? { onMappingChange: onParamMappingChange }\n : {})}\n {...(values ? { values } : {})}\n compilation={compilation}\n />\n ) : active === \"json\" ? (\n <p className=\"rounded-md border border-dashed p-3 text-xs text-muted-foreground\">\n The {descriptor.queryLabel ?? \"query\"} editor holds the query.\n Switch back to Form to build it from filters — the raw query is\n dropped then, since only one of the two is stored.\n </p>\n ) : active === \"catalog\" ? (\n <CatalogTree\n nodes={inspection.nodes}\n loading={inspection.loading}\n error={inspection.error}\n databases={inspection.databases}\n database={inspection.activeDatabase}\n onDatabaseChange={onDatabaseChange}\n onSelect={onCatalogSelect}\n />\n ) : null}\n </div>\n )\n }\n execute={(request) =>\n execute(\n specMode\n ? { ...request, query: \"\", options: { ...request.options, search } }\n : request,\n )\n }\n {...(lookupFilterValues ? { lookupFilterValues } : {})}\n renderResults={renderResults ?? descriptorResultView(descriptor)}\n />\n );\n}\n\n/**\n * descriptorResultView honours the view the server nominated for this provider.\n * A host that renders its own results (the profile builder's column picker)\n * passes renderResults and takes over entirely.\n */\nfunction descriptorResultView(\n descriptor: BrowserDescriptor,\n): ((context: QueryBrowserResultContext) => ReactNode) | undefined {\n if (descriptor.resultView === \"logs\") {\n return ({ result, defaultView }) =>\n result.rows?.length ? (\n <LogsTable logs={result.rows} autoFilter={false} fullscreenTitle=\"Logs\" />\n ) : (\n defaultView\n );\n }\n if (descriptor.resultView === \"timeseries\") {\n return ({ result, defaultView }) => (\n <PrometheusResults result={result} fallback={defaultView} />\n );\n }\n return undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmGO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkC;;AAChC,QAAM,UAAU,QAAQ,cAAc,KAAK,qBAAqB,UAAU;AAC1E,QAAM,OAAO,cAAc,EAAE,YAAY,SAAS;AAClD,QAAM,CAAC,KAAK,MAAM,IAAI;AAAA,IAA6B,MACjD,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAI,WAAW,eAAe,EAAE,cAAc,WAAW,aAAA,IAAiB,CAAA;AAAA,IAAC,CAC5E;AAAA,EAAA;AAMH,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAA;AAE5B,QAAM,SAAS,OAAO,OAAO;AAC7B,QAAM,OAAO,OAAO,OAAO;AAC3B,MAAI,KAAK,YAAY,SAAS;AAC5B,SAAK,UAAU;AACf,WAAO,UAAU;AACjB,QAAI,kBAAkB,MAAS;AAAA,EACjC;AACA,QAAM,iBAAiB,UAAU;AAC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AC,mBAAA,EAAkB,QAAgB,UAAU,aAAa;AAAA,EAE9D;AACA,SAAO;AACT;"}
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspace.js","sources":["../../../src/profiles/connections/connectionQueryWorkspace.tsx"],"sourcesContent":["/**\n * The single query-browser host. The connection browser, the profile wizard and\n * the profile-edit builder all render this: they own where the query and the\n * options are stored and what a run means, and this owns the browser itself —\n * the catalog navigator, the structured filter builder, the completion, and the\n * descriptor's result view.\n */\n\nimport type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { LogsTable } from \"../../data/LogsTable\";\nimport { QueryBrowser } from \"../../data/query-browser/QueryBrowser\";\nimport type {\n QueryBrowserFilterLookup,\n QueryBrowserRequest,\n QueryBrowserResult,\n QueryBrowserResultContext,\n} from \"../../data/query-browser/QueryBrowser.types\";\nimport { Tabs } from \"../../layout/Tabs\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { CatalogTree } from \"./catalogTree\";\nimport {\n withTarget,\n type BrowserDescriptor,\n type CatalogNode,\n type ProfileRowLimits,\n} from \"./connectionBrowserModel\";\nimport type { Inspection } from \"./useInspection\";\nimport { makeFieldValueLookup } from \"../elasticsearch/esFieldValues\";\nimport { EsQueryBuilder } from \"../elasticsearch/esQueryBuilder\";\nimport {\n toBuilderMode,\n toRawMode,\n type EsSearch,\n type QueryModeTransition,\n} from \"../elasticsearch/esQueryBuilderModel\";\nimport { esBuilderVocabulary } from \"../elasticsearch/esQueryOperators\";\nimport { PrometheusResults } from \"../query/prometheusResults\";\nimport { QueryRowLimits } from \"../query/queryRowLimits\";\nimport { QueryTargetPicker } from \"../query/queryTargetPicker\";\nimport { KubernetesWorkloadTargetPicker } from \"../query/kubernetesWorkloadTargetPicker\";\nimport type { ParamMappingEdit } from \"../elasticsearch/esParamMappingModel\";\nimport type { ParamDraft } from \"../wizard/profileWizardModel\";\nimport {\n initialNavigatorTab,\n logsResultSort,\n navigatorTabs,\n structuredSearchRequest,\n supportsQueryBuilder,\n} from \"./connectionQueryWorkspaceModel\";\nimport { esQueryFields } from \"../elasticsearch/esQueryBuilderForm\";\nimport { useCompiledSearch } from \"../elasticsearch/esQueryCompile\";\nimport { InspectionStatus } from \"./inspectionStatus\";\n\nexport type ConnectionQueryWorkspaceProps = {\n id: string;\n title: string;\n descriptor: BrowserDescriptor;\n inspection: Inspection;\n onDatabaseChange: (database: string) => void;\n query: string;\n onQueryChange?: (query: string) => void | undefined;\n options: Record<string, unknown>;\n onOptionsChange: (options: Record<string, unknown>) => void;\n onCatalogSelect: (node: CatalogNode) => void;\n optionsSchema?: JsonSchemaObject | undefined;\n /**\n * The structured specification this host stores, when it stores one.\n * `undefined` means the raw query is the artifact.\n */\n search?: EsSearch | undefined;\n /**\n * Every change reports the specification and the raw query together, and one\n * of the two is always empty. The host stores both in one write, so it can\n * never end up holding a specification and a query at once — a state the\n * server rejects.\n */\n onSearchChange?: (transition: QueryModeTransition) => void | undefined;\n /**\n * The row caps the edited profile sets for itself. They are profile settings,\n * not provider options, so they are stored beside the query rather than\n * through `onOptionsChange`. A host that edits no profile — the connection\n * browser — passes neither, and the caps are then not offered at all.\n */\n limits?: ProfileRowLimits | undefined;\n onLimitsChange?: (limits: ProfileRowLimits | undefined) => void;\n /** Declared profile parameters an operand can bind to. */\n params?: ParamDraft[] | undefined;\n onParamMappingChange?: (edit: ParamMappingEdit) => void | undefined;\n /**\n * What those parameters currently resolve to. The server binds a {param:…}\n * operand from them and interpolates a {{.params.…}} one, so without values\n * the preview shows template text — or the compiler's refusal to guess.\n */\n paramValues?: Record<string, unknown> | undefined;\n /** Those parameters' roles, so the compiled preview folds them as a run would. */\n paramRoles?: Record<string, string> | undefined;\n /** Where POST /compile lives. Empty leaves the preview unresolved. */\n compileBaseUrl?: string | undefined;\n execute: (request: QueryBrowserRequest) => Promise<QueryBrowserResult>;\n /**\n * Answers a filter's value type-ahead. Absent leaves every filter the source\n * described showing only the values the result itself carried.\n */\n lookupFilterValues?: QueryBrowserFilterLookup | undefined;\n renderResults?: (context: QueryBrowserResultContext) => ReactNode | undefined;\n className?: string | undefined;\n};\n\nexport function ConnectionQueryWorkspace({\n id,\n title,\n descriptor,\n inspection,\n onDatabaseChange,\n query,\n onQueryChange,\n options,\n onOptionsChange,\n onCatalogSelect,\n optionsSchema,\n search,\n onSearchChange,\n limits,\n onLimitsChange,\n params,\n onParamMappingChange,\n paramValues,\n paramRoles,\n compileBaseUrl = \"\",\n execute,\n lookupFilterValues,\n renderResults,\n className,\n}: ConnectionQueryWorkspaceProps) {\n const builder = Boolean(onSearchChange) && supportsQueryBuilder(descriptor);\n const tabs = navigatorTabs({ descriptor, builder });\n const [tab, setTab] = useState<string | undefined>(() =>\n initialNavigatorTab({\n tabs,\n search,\n query,\n ...(descriptor.defaultQuery\n ? { defaultQuery: descriptor.defaultQuery }\n : {}),\n }),\n );\n // Picking a target has to reach the browser, which only resyncs its options\n // when `initialOptions` changes identity. The pick is layered here rather than\n // round-tripped through the host, so an options-form keystroke — which the\n // host also stores — cannot resync the browser out from under the author.\n const [picked, setPicked] = useState<Record<string, unknown>>();\n // What the browser last reported, so a pick keeps the author's other edits.\n const edited = useRef(options);\n const seed = useRef(options);\n if (seed.current !== options) {\n seed.current = options;\n edited.current = options;\n if (picked) setPicked(undefined);\n }\n const browserOptions = picked ?? options;\n const applyOptions = (next: Record<string, unknown>) => {\n edited.current = next;\n setPicked(next);\n onOptionsChange(next);\n };\n const compilation = useCompiledSearch({\n baseUrl: compileBaseUrl,\n search: search ?? {},\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n enabled: Boolean(search) && compileBaseUrl !== \"\",\n });\n const values = makeFieldValueLookup({\n baseUrl: compileBaseUrl,\n index: String(browserOptions.index ?? \"\"),\n ...(paramValues ? { params: paramValues } : {}),\n ...(paramRoles ? { roles: paramRoles } : {}),\n });\n\n // While a specification is active the editor mirrors what it compiles to. It\n // is a preview, not an input: the query is not stored alongside the spec, so\n // there is no keystroke for a compile to overwrite.\n const specMode = search !== undefined;\n const active = tabs.some((entry) => entry.id === tab) ? tab : tabs[0]?.id;\n const indexTarget =\n descriptor.target?.kind === \"index\" ? descriptor.target : undefined;\n\n // The form tab is the specification, so being on it means holding one. A tab\n // that stores nothing would leave the builder rendering a query it cannot\n // edit, and this is also what makes filters the default rather than an opt-in.\n useEffect(() => {\n if (active === \"form\" && onSearchChange && search === undefined) {\n onSearchChange(toBuilderMode());\n }\n }, [active, onSearchChange, search]);\n\n // Switching tabs is the mode switch. Each mode stores its own artifact and the\n // server rejects holding both, so leaving the form hands the raw editor the\n // DSL the specification last compiled to and drops the specification.\n const selectTab = (next: string) => {\n if (next === \"json\" && search && onSearchChange) {\n onSearchChange(toRawMode(search, compilation.query, query));\n }\n setTab(next);\n };\n\n return (\n <QueryBrowser\n id={id}\n title={title}\n language={descriptor.language ?? \"text\"}\n queryLabel={descriptor.queryLabel ?? \"Query\"}\n initialQuery={specMode ? compilation.query : query}\n allowEmptyQuery={descriptor.allowEmptyQuery}\n optionsSchema={optionsSchema}\n initialOptions={browserOptions}\n completion={inspection.completion}\n {...(specMode ? {} : onQueryChange ? { onQueryChange } : {})}\n onOptionsChange={(next) => {\n edited.current = next;\n onOptionsChange(next);\n }}\n className={className}\n navigator={\n tabs.length === 0 && !descriptor.target ? undefined : (\n <div className=\"flex min-h-0 flex-col gap-2\">\n {descriptor.catalog ? (\n <InspectionStatus inspection={inspection} />\n ) : null}\n {indexTarget ? (\n <QueryTargetPicker\n label={indexTarget.label}\n inspection={inspection}\n discoverable={descriptor.catalog === true}\n value={String(browserOptions[indexTarget.option] ?? \"\")}\n onChange={(index, targetKind) =>\n applyOptions(\n withTarget(edited.current, {\n option: indexTarget.option,\n value: index,\n targetKind,\n }),\n )\n }\n />\n ) : null}\n {descriptor.target?.kind === \"kubernetes-workload\" ? (\n <KubernetesWorkloadTargetPicker\n baseUrl={compileBaseUrl}\n target={descriptor.target}\n query={query}\n onChange={(next) => onQueryChange?.(next)}\n />\n ) : null}\n {builder ? (\n <QueryRowLimits\n value={String(browserOptions.limit ?? \"\")}\n onChange={(limit) => applyOptions({ ...edited.current, limit })}\n {...(descriptor.rowLimits\n ? { defaults: descriptor.rowLimits }\n : {})}\n {...(limits ? { limits } : {})}\n {...(onLimitsChange ? { onLimitsChange } : {})}\n />\n ) : null}\n {tabs.length > 1 ? (\n <Tabs tabs={tabs} value={active ?? \"\"} onChange={selectTab} />\n ) : null}\n {active === \"form\" && onSearchChange && search ? (\n <EsQueryBuilder\n search={search}\n onChange={(next) => onSearchChange({ search: next, query: \"\" })}\n fields={esQueryFields(inspection.completion)}\n vocabulary={esBuilderVocabulary(descriptor.optionsSchema)}\n {...(params ? { params } : {})}\n {...(onParamMappingChange\n ? { onMappingChange: onParamMappingChange }\n : {})}\n {...(values ? { values } : {})}\n compilation={compilation}\n />\n ) : active === \"json\" ? (\n <p className=\"rounded-md border border-dashed p-3 text-xs text-muted-foreground\">\n The {descriptor.queryLabel ?? \"query\"} editor holds the query.\n Switch back to Form to build it from filters — the raw query is\n dropped then, since only one of the two is stored.\n </p>\n ) : active === \"catalog\" ? (\n <CatalogTree\n nodes={inspection.nodes}\n loading={inspection.loading}\n error={inspection.error}\n databases={inspection.databases}\n database={inspection.activeDatabase}\n onDatabaseChange={onDatabaseChange}\n onSelect={onCatalogSelect}\n />\n ) : null}\n </div>\n )\n }\n execute={(request) =>\n execute(specMode ? structuredSearchRequest(request, search) : request)\n }\n {...(lookupFilterValues\n ? {\n lookupFilterValues: (request) =>\n lookupFilterValues(\n specMode ? structuredSearchRequest(request, search) : request,\n ),\n }\n : {})}\n renderResults={renderResults ?? descriptorResultView(descriptor)}\n />\n );\n}\n\n/**\n * descriptorResultView honours the view the server nominated for this provider.\n * A host that renders its own results (the profile builder's column picker)\n * passes renderResults and takes over entirely.\n */\nfunction descriptorResultView(\n descriptor: BrowserDescriptor,\n): ((context: QueryBrowserResultContext) => ReactNode) | undefined {\n if (descriptor.resultView === \"logs\") {\n return ({ result, defaultView }) =>\n result.rows?.length ? (\n <LogsTable\n logs={result.rows}\n autoFilter={false}\n fullscreenTitle=\"Logs\"\n {...logsResultSort(descriptor)}\n />\n ) : (\n defaultView\n );\n }\n if (descriptor.resultView === \"timeseries\") {\n return ({ result, defaultView }) => (\n <PrometheusResults result={result} fallback={defaultView} />\n );\n }\n return undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA4GO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkC;;AAChC,QAAM,UAAU,QAAQ,cAAc,KAAK,qBAAqB,UAAU;AAC1E,QAAM,OAAO,cAAc,EAAE,YAAY,SAAS;AAClD,QAAM,CAAC,KAAK,MAAM,IAAI;AAAA,IAA6B,MACjD,oBAAoB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAI,WAAW,eACX,EAAE,cAAc,WAAW,aAAA,IAC3B,CAAA;AAAA,IAAC,CACN;AAAA,EAAA;AAMH,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAA;AAE5B,QAAM,SAAS,OAAO,OAAO;AAC7B,QAAM,OAAO,OAAO,OAAO;AAC3B,MAAI,KAAK,YAAY,SAAS;AAC5B,SAAK,UAAU;AACf,WAAO,UAAU;AACjB,QAAI,kBAAkB,MAAS;AAAA,EACjC;AACA,QAAM,iBAAiB,UAAU;AACjC,QAAM,eAAe,CAAC,SAAkC;AACtD,WAAO,UAAU;AACjB,cAAU,IAAI;AACd,oBAAgB,IAAI;AAAA,EACtB;AACA,QAAM,cAAc,kBAAkB;AAAA,IACpC,S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ACZ,iBAAgB;AAAA,UACf,GAAG,eAAe,UAAU;AAAA,QAAA;AAAA,MAAA,IAG/B;AAAA;AAAA,EAEN;AACA,MAAI,WAAW,eAAe,cAAc;AAC1C,WAAO,CAAC,EAAE,QAAQ,kBAChB,oBAAC,mBAAA,EAAkB,QAAgB,UAAU,aAAa;AAAA,EAE9D;AACA,SAAO;AACT;"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const esQueryOperators = require("../elasticsearch/esQueryOperators.cjs");
|
|
4
|
+
function structuredSearchRequest(request, search) {
|
|
5
|
+
return {
|
|
6
|
+
...request,
|
|
7
|
+
query: "",
|
|
8
|
+
options: { ...request.options, search }
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function logsResultSort(descriptor) {
|
|
12
|
+
return {
|
|
13
|
+
manualSort: true,
|
|
14
|
+
...descriptor.resultSort ? { defaultSort: descriptor.resultSort } : {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
4
17
|
function supportsQueryBuilder(descriptor) {
|
|
5
18
|
return esQueryOperators.operatorCatalogFromSchema(descriptor.optionsSchema).length > 0;
|
|
6
19
|
}
|
|
@@ -23,6 +36,8 @@ function initialNavigatorTab(input) {
|
|
|
23
36
|
return authored && authored !== (input.defaultQuery ?? "").trim() ? "json" : "form";
|
|
24
37
|
}
|
|
25
38
|
exports.initialNavigatorTab = initialNavigatorTab;
|
|
39
|
+
exports.logsResultSort = logsResultSort;
|
|
26
40
|
exports.navigatorTabs = navigatorTabs;
|
|
41
|
+
exports.structuredSearchRequest = structuredSearchRequest;
|
|
27
42
|
exports.supportsQueryBuilder = supportsQueryBuilder;
|
|
28
43
|
//# sourceMappingURL=connectionQueryWorkspaceModel.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspaceModel.cjs","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"sourcesContent":["/**\n * Which navigator tabs the query workspace offers, and which one it opens on.\n *\n * Kept apart from the workspace component so that module exports only\n * components (react/only-export-components).\n */\n\nimport type {
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspaceModel.cjs","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"sourcesContent":["/**\n * Which navigator tabs the query workspace offers, and which one it opens on.\n *\n * Kept apart from the workspace component so that module exports only\n * components (react/only-export-components).\n */\n\nimport type {\n BrowserDescriptor,\n BrowserResultSort,\n} from \"./connectionBrowserModel\";\nimport type { EsSearch } from \"../elasticsearch/esQueryBuilderModel\";\nimport { operatorCatalogFromSchema } from \"../elasticsearch/esQueryOperators\";\n\nexport type NavigatorTab = { id: \"catalog\" | \"form\" | \"json\"; label: string };\n\nexport function structuredSearchRequest<\n T extends { query: string; options: Record<string, unknown> },\n>(request: T, search: EsSearch | undefined): T {\n return {\n ...request,\n query: \"\",\n options: { ...request.options, search },\n };\n}\n\n/**\n * How a logs result is handed to the table: as delivered, in the order the\n * provider declared.\n *\n * A browser query is a bounded top-N, so the order the server applied and the\n * cut it made are one decision. Sorting the returned rows again presents them\n * as though the cut had been made the other way round — Kubernetes is the case\n * that proves it, since its API only resumes forward, so a limit returns the\n * *oldest* lines and newest-first would read as \"the latest logs\".\n *\n * `manualSort` is the load-bearing half: without it the table re-sorts and its\n * header claims an order the rows were not selected under.\n */\nexport function logsResultSort(descriptor: BrowserDescriptor): {\n manualSort: true;\n defaultSort?: BrowserResultSort;\n} {\n return {\n manualSort: true,\n ...(descriptor.resultSort ? { defaultSort: descriptor.resultSort } : {}),\n };\n}\n\n/**\n * A source supports the builder when the server described a structured search on\n * it. The operator catalog travels with the schema, so no provider name is\n * hardcoded here — adding a structured provider in Go reaches the editor on its\n * own.\n */\nexport function supportsQueryBuilder(descriptor: BrowserDescriptor): boolean {\n return operatorCatalogFromSchema(descriptor.optionsSchema).length > 0;\n}\n\n/**\n * navigatorTabs is what the left pane offers. Where the source has a structured\n * search, the two ways of authoring one — the form and the raw DSL — are tabs\n * rather than a one-way door: they are the same query, and the tab says which\n * of the two is stored. A source that picks one flat target has a combobox\n * pinned above the tabs instead of a catalog tree — its targets are a list of\n * index names, and a list is not worth navigating.\n */\nexport function navigatorTabs(input: {\n descriptor: BrowserDescriptor;\n builder: boolean;\n}): NavigatorTab[] {\n const tabs: NavigatorTab[] = [];\n if (input.descriptor.catalog && !input.descriptor.target) {\n tabs.push({ id: \"catalog\", label: \"Catalog\" });\n }\n if (input.builder) {\n tabs.push({ id: \"form\", label: \"Form\" }, { id: \"json\", label: \"JSON\" });\n }\n return tabs;\n}\n\n/**\n * initialNavigatorTab opens on the form: filters are what the builder is for,\n * so it is where authoring starts rather than something to opt into. The one\n * thing that overrides it is a raw query already worth preserving — and the\n * starter query the descriptor supplies is not one, since nobody wrote it.\n */\nexport function initialNavigatorTab(input: {\n tabs: NavigatorTab[];\n search: EsSearch | undefined;\n query: string;\n defaultQuery?: string;\n}): string | undefined {\n const has = (id: NavigatorTab[\"id\"]) =>\n input.tabs.some((tab) => tab.id === id);\n if (!has(\"form\")) return input.tabs[0]?.id;\n if (input.search) return \"form\";\n const authored = input.query.trim();\n return authored && authored !== (input.defaultQuery ?? \"\").trim()\n ? \"json\"\n : \"form\";\n}\n"],"names":["operatorCatalogFromSchema"],"mappings":";;;AAgBO,SAAS,wBAEd,SAAY,QAAiC;AAC7C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO;AAAA,IACP,SAAS,EAAE,GAAG,QAAQ,SAAS,OAAA;AAAA,EAAO;AAE1C;AAeO,SAAS,eAAe,YAG7B;AACA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,GAAI,WAAW,aAAa,EAAE,aAAa,WAAW,WAAA,IAAe,CAAA;AAAA,EAAC;AAE1E;AAQO,SAAS,qBAAqB,YAAwC;AAC3E,SAAOA,iBAAAA,0BAA0B,WAAW,aAAa,EAAE,SAAS;AACtE;AAUO,SAAS,cAAc,OAGX;AACjB,QAAM,OAAuB,CAAA;AAC7B,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,WAAW,QAAQ;AACxD,SAAK,KAAK,EAAE,IAAI,WAAW,OAAO,WAAW;AAAA,EAC/C;AACA,MAAI,MAAM,SAAS;AACjB,SAAK,KAAK,EAAE,IAAI,QAAQ,OAAO,OAAA,GAAU,EAAE,IAAI,QAAQ,OAAO,OAAA,CAAQ;AAAA,EACxE;AACA,SAAO;AACT;AAQO,SAAS,oBAAoB,OAKb;;AACrB,QAAM,MAAM,CAAC,OACX,MAAM,KAAK,KAAK,CAAC,QAAQ,IAAI,OAAO,EAAE;AACxC,MAAI,CAAC,IAAI,MAAM,WAAU,WAAM,KAAK,CAAC,MAAZ,mBAAe;AACxC,MAAI,MAAM,OAAQ,QAAO;AACzB,QAAM,WAAW,MAAM,MAAM,KAAA;AAC7B,SAAO,YAAY,cAAc,MAAM,gBAAgB,IAAI,SACvD,SACA;AACN;;;;;;"}
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
import { BrowserDescriptor } from './connectionBrowserModel';
|
|
1
|
+
import { BrowserDescriptor, BrowserResultSort } from './connectionBrowserModel';
|
|
2
2
|
import { EsSearch } from '../elasticsearch/esQueryBuilderModel';
|
|
3
3
|
export type NavigatorTab = {
|
|
4
4
|
id: "catalog" | "form" | "json";
|
|
5
5
|
label: string;
|
|
6
6
|
};
|
|
7
|
+
export declare function structuredSearchRequest<T extends {
|
|
8
|
+
query: string;
|
|
9
|
+
options: Record<string, unknown>;
|
|
10
|
+
}>(request: T, search: EsSearch | undefined): T;
|
|
11
|
+
/**
|
|
12
|
+
* How a logs result is handed to the table: as delivered, in the order the
|
|
13
|
+
* provider declared.
|
|
14
|
+
*
|
|
15
|
+
* A browser query is a bounded top-N, so the order the server applied and the
|
|
16
|
+
* cut it made are one decision. Sorting the returned rows again presents them
|
|
17
|
+
* as though the cut had been made the other way round — Kubernetes is the case
|
|
18
|
+
* that proves it, since its API only resumes forward, so a limit returns the
|
|
19
|
+
* *oldest* lines and newest-first would read as "the latest logs".
|
|
20
|
+
*
|
|
21
|
+
* `manualSort` is the load-bearing half: without it the table re-sorts and its
|
|
22
|
+
* header claims an order the rows were not selected under.
|
|
23
|
+
*/
|
|
24
|
+
export declare function logsResultSort(descriptor: BrowserDescriptor): {
|
|
25
|
+
manualSort: true;
|
|
26
|
+
defaultSort?: BrowserResultSort;
|
|
27
|
+
};
|
|
7
28
|
/**
|
|
8
29
|
* A source supports the builder when the server described a structured search on
|
|
9
30
|
* it. The operator catalog travels with the schema, so no provider name is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspaceModel.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspaceModel.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAGrE,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,wBAAgB,uBAAuB,CACrC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,CAAC,CAM7C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,iBAAiB,GAAG;IAC7D,UAAU,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC,CAKA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,YAAY,EAAE,CASjB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,GAAG,SAAS,CASrB"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { operatorCatalogFromSchema } from "../elasticsearch/esQueryOperators.js";
|
|
2
|
+
function structuredSearchRequest(request, search) {
|
|
3
|
+
return {
|
|
4
|
+
...request,
|
|
5
|
+
query: "",
|
|
6
|
+
options: { ...request.options, search }
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function logsResultSort(descriptor) {
|
|
10
|
+
return {
|
|
11
|
+
manualSort: true,
|
|
12
|
+
...descriptor.resultSort ? { defaultSort: descriptor.resultSort } : {}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
2
15
|
function supportsQueryBuilder(descriptor) {
|
|
3
16
|
return operatorCatalogFromSchema(descriptor.optionsSchema).length > 0;
|
|
4
17
|
}
|
|
@@ -22,7 +35,9 @@ function initialNavigatorTab(input) {
|
|
|
22
35
|
}
|
|
23
36
|
export {
|
|
24
37
|
initialNavigatorTab,
|
|
38
|
+
logsResultSort,
|
|
25
39
|
navigatorTabs,
|
|
40
|
+
structuredSearchRequest,
|
|
26
41
|
supportsQueryBuilder
|
|
27
42
|
};
|
|
28
43
|
//# sourceMappingURL=connectionQueryWorkspaceModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionQueryWorkspaceModel.js","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"sourcesContent":["/**\n * Which navigator tabs the query workspace offers, and which one it opens on.\n *\n * Kept apart from the workspace component so that module exports only\n * components (react/only-export-components).\n */\n\nimport type {
|
|
1
|
+
{"version":3,"file":"connectionQueryWorkspaceModel.js","sources":["../../../src/profiles/connections/connectionQueryWorkspaceModel.ts"],"sourcesContent":["/**\n * Which navigator tabs the query workspace offers, and which one it opens on.\n *\n * Kept apart from the workspace component so that module exports only\n * components (react/only-export-components).\n */\n\nimport type {\n BrowserDescriptor,\n BrowserResultSort,\n} from \"./connectionBrowserModel\";\nimport type { EsSearch } from \"../elasticsearch/esQueryBuilderModel\";\nimport { operatorCatalogFromSchema } from \"../elasticsearch/esQueryOperators\";\n\nexport type NavigatorTab = { id: \"catalog\" | \"form\" | \"json\"; label: string };\n\nexport function structuredSearchRequest<\n T extends { query: string; options: Record<string, unknown> },\n>(request: T, search: EsSearch | undefined): T {\n return {\n ...request,\n query: \"\",\n options: { ...request.options, search },\n };\n}\n\n/**\n * How a logs result is handed to the table: as delivered, in the order the\n * provider declared.\n *\n * A browser query is a bounded top-N, so the order the server applied and the\n * cut it made are one decision. Sorting the returned rows again presents them\n * as though the cut had been made the other way round — Kubernetes is the case\n * that proves it, since its API only resumes forward, so a limit returns the\n * *oldest* lines and newest-first would read as \"the latest logs\".\n *\n * `manualSort` is the load-bearing half: without it the table re-sorts and its\n * header claims an order the rows were not selected under.\n */\nexport function logsResultSort(descriptor: BrowserDescriptor): {\n manualSort: true;\n defaultSort?: BrowserResultSort;\n} {\n return {\n manualSort: true,\n ...(descriptor.resultSort ? { defaultSort: descriptor.resultSort } : {}),\n };\n}\n\n/**\n * A source supports the builder when the server described a structured search on\n * it. The operator catalog travels with the schema, so no provider name is\n * hardcoded here — adding a structured provider in Go reaches the editor on its\n * own.\n */\nexport function supportsQueryBuilder(descriptor: BrowserDescriptor): boolean {\n return operatorCatalogFromSchema(descriptor.optionsSchema).length > 0;\n}\n\n/**\n * navigatorTabs is what the left pane offers. Where the source has a structured\n * search, the two ways of authoring one — the form and the raw DSL — are tabs\n * rather than a one-way door: they are the same query, and the tab says which\n * of the two is stored. A source that picks one flat target has a combobox\n * pinned above the tabs instead of a catalog tree — its targets are a list of\n * index names, and a list is not worth navigating.\n */\nexport function navigatorTabs(input: {\n descriptor: BrowserDescriptor;\n builder: boolean;\n}): NavigatorTab[] {\n const tabs: NavigatorTab[] = [];\n if (input.descriptor.catalog && !input.descriptor.target) {\n tabs.push({ id: \"catalog\", label: \"Catalog\" });\n }\n if (input.builder) {\n tabs.push({ id: \"form\", label: \"Form\" }, { id: \"json\", label: \"JSON\" });\n }\n return tabs;\n}\n\n/**\n * initialNavigatorTab opens on the form: filters are what the builder is for,\n * so it is where authoring starts rather than something to opt into. The one\n * thing that overrides it is a raw query already worth preserving — and the\n * starter query the descriptor supplies is not one, since nobody wrote it.\n */\nexport function initialNavigatorTab(input: {\n tabs: NavigatorTab[];\n search: EsSearch | undefined;\n query: string;\n defaultQuery?: string;\n}): string | undefined {\n const has = (id: NavigatorTab[\"id\"]) =>\n input.tabs.some((tab) => tab.id === id);\n if (!has(\"form\")) return input.tabs[0]?.id;\n if (input.search) return \"form\";\n const authored = input.query.trim();\n return authored && authored !== (input.defaultQuery ?? \"\").trim()\n ? \"json\"\n : \"form\";\n}\n"],"names":[],"mappings":";AAgBO,SAAS,wBAEd,SAAY,QAAiC;AAC7C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO;AAAA,IACP,SAAS,EAAE,GAAG,QAAQ,SAAS,OAAA;AAAA,EAAO;AAE1C;AAeO,SAAS,eAAe,YAG7B;AACA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,GAAI,WAAW,aAAa,EAAE,aAAa,WAAW,WAAA,IAAe,CAAA;AAAA,EAAC;AAE1E;AAQO,SAAS,qBAAqB,YAAwC;AAC3E,SAAO,0BAA0B,WAAW,aAAa,EAAE,SAAS;AACtE;AAUO,SAAS,cAAc,OAGX;AACjB,QAAM,OAAuB,CAAA;AAC7B,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,WAAW,QAAQ;AACxD,SAAK,KAAK,EAAE,IAAI,WAAW,OAAO,WAAW;AAAA,EAC/C;AACA,MAAI,MAAM,SAAS;AACjB,SAAK,KAAK,EAAE,IAAI,QAAQ,OAAO,OAAA,GAAU,EAAE,IAAI,QAAQ,OAAO,OAAA,CAAQ;AAAA,EACxE;AACA,SAAO;AACT;AAQO,SAAS,oBAAoB,OAKb;;AACrB,QAAM,MAAM,CAAC,OACX,MAAM,KAAK,KAAK,CAAC,QAAQ,IAAI,OAAO,EAAE;AACxC,MAAI,CAAC,IAAI,MAAM,WAAU,WAAM,KAAK,CAAC,MAAZ,mBAAe;AACxC,MAAI,MAAM,OAAQ,QAAO;AACzB,QAAM,WAAW,MAAM,MAAM,KAAA;AAC7B,SAAO,YAAY,cAAc,MAAM,gBAAgB,IAAI,SACvD,SACA;AACN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const IconButton = require("../../components/IconButton.cjs");
|
|
5
|
+
const UiRefresh = require("../../icons/components/UiRefresh.cjs");
|
|
6
|
+
function metadataAge(ageMs) {
|
|
7
|
+
const minutes = Math.floor(ageMs / 6e4);
|
|
8
|
+
if (minutes < 1) return "just now";
|
|
9
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
10
|
+
const hours = Math.floor(minutes / 60);
|
|
11
|
+
if (hours < 48) return `${hours}h ago`;
|
|
12
|
+
return `${Math.floor(hours / 24)}d ago`;
|
|
13
|
+
}
|
|
14
|
+
function InspectionStatus({ inspection }) {
|
|
15
|
+
const cache = inspection.cache;
|
|
16
|
+
const label = inspection.refreshing ? "Refreshing metadata" : "Refresh metadata";
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 rounded-md border px-2 py-1 text-xs text-muted-foreground", children: [
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: cache ? `Metadata updated ${metadataAge(cache.ageMs)}${cache.state === "stale" ? " · stale" : ""}` : "Metadata has not been loaded" }),
|
|
20
|
+
(cache == null ? void 0 : cache.lastRefreshError) ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
"p",
|
|
22
|
+
{
|
|
23
|
+
className: "truncate text-destructive",
|
|
24
|
+
title: cache.lastRefreshError,
|
|
25
|
+
children: [
|
|
26
|
+
"Refresh failed: ",
|
|
27
|
+
cache.lastRefreshError
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
) : null
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
IconButton.IconButton,
|
|
34
|
+
{
|
|
35
|
+
icon: UiRefresh.UiRefresh,
|
|
36
|
+
label,
|
|
37
|
+
disabled: inspection.refreshing,
|
|
38
|
+
onClick: inspection.refresh
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
exports.InspectionStatus = InspectionStatus;
|
|
44
|
+
//# sourceMappingURL=inspectionStatus.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectionStatus.cjs","sources":["../../../src/profiles/connections/inspectionStatus.tsx"],"sourcesContent":["import { IconButton } from \"../../components/IconButton\";\nimport { UiRefresh } from \"../../icons\";\nimport type { Inspection } from \"./useInspection\";\n\nfunction metadataAge(ageMs: number): string {\n const minutes = Math.floor(ageMs / 60_000);\n if (minutes < 1) return \"just now\";\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 48) return `${hours}h ago`;\n return `${Math.floor(hours / 24)}d ago`;\n}\n\nexport function InspectionStatus({ inspection }: { inspection: Inspection }) {\n const cache = inspection.cache;\n const label = inspection.refreshing\n ? \"Refreshing metadata\"\n : \"Refresh metadata\";\n return (\n <div className=\"flex items-center justify-between gap-2 rounded-md border px-2 py-1 text-xs text-muted-foreground\">\n <div className=\"min-w-0\">\n <span>\n {cache\n ? `Metadata updated ${metadataAge(cache.ageMs)}${cache.state === \"stale\" ? \" · stale\" : \"\"}`\n : \"Metadata has not been loaded\"}\n </span>\n {cache?.lastRefreshError ? (\n <p\n className=\"truncate text-destructive\"\n title={cache.lastRefreshError}\n >\n Refresh failed: {cache.lastRefreshError}\n </p>\n ) : null}\n </div>\n <IconButton\n icon={UiRefresh}\n label={label}\n disabled={inspection.refreshing}\n onClick={inspection.refresh}\n />\n </div>\n );\n}\n"],"names":["jsxs","jsx","IconButton","UiRefresh"],"mappings":";;;;;AAIA,SAAS,YAAY,OAAuB;AAC1C,QAAM,UAAU,KAAK,MAAM,QAAQ,GAAM;AACzC,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,UAAU,GAAI,QAAO,GAAG,OAAO;AACnC,QAAM,QAAQ,KAAK,MAAM,UAAU,EAAE;AACrC,MAAI,QAAQ,GAAI,QAAO,GAAG,KAAK;AAC/B,SAAO,GAAG,KAAK,MAAM,QAAQ,EAAE,CAAC;AAClC;AAEO,SAAS,iBAAiB,EAAE,cAA0C;AAC3E,QAAM,QAAQ,WAAW;AACzB,QAAM,QAAQ,WAAW,aACrB,wBACA;AACJ,SACEA,2BAAAA,KAAC,OAAA,EAAI,WAAU,qGACb,UAAA;AAAA,IAAAA,2BAAAA,KAAC,OAAA,EAAI,WAAU,WACb,UAAA;AAAA,MAAAC,2BAAAA,IAAC,QAAA,EACE,UAAA,QACG,oBAAoB,YAAY,MAAM,KAAK,CAAC,GAAG,MAAM,UAAU,UAAU,aAAa,EAAE,KACxF,gCACN;AAAA,OACC,+BAAO,oBACND,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO,MAAM;AAAA,UACd,UAAA;AAAA,YAAA;AAAA,YACkB,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,IAEvB;AAAA,IAAA,GACN;AAAA,IACAC,2BAAAA;AAAAA,MAACC,WAAAA;AAAAA,MAAA;AAAA,QACC,MAAMC,UAAAA;AAAAA,QACN;AAAA,QACA,UAAU,WAAW;AAAA,QACrB,SAAS,WAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EACtB,GACF;AAEJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectionStatus.d.ts","sourceRoot":"","sources":["../../../src/profiles/connections/inspectionStatus.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,2CA8B1E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from "../../components/IconButton.js";
|
|
3
|
+
import { UiRefresh } from "../../icons/components/UiRefresh.js";
|
|
4
|
+
function metadataAge(ageMs) {
|
|
5
|
+
const minutes = Math.floor(ageMs / 6e4);
|
|
6
|
+
if (minutes < 1) return "just now";
|
|
7
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
8
|
+
const hours = Math.floor(minutes / 60);
|
|
9
|
+
if (hours < 48) return `${hours}h ago`;
|
|
10
|
+
return `${Math.floor(hours / 24)}d ago`;
|
|
11
|
+
}
|
|
12
|
+
function InspectionStatus({ inspection }) {
|
|
13
|
+
const cache = inspection.cache;
|
|
14
|
+
const label = inspection.refreshing ? "Refreshing metadata" : "Refresh metadata";
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 rounded-md border px-2 py-1 text-xs text-muted-foreground", children: [
|
|
16
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
17
|
+
/* @__PURE__ */ jsx("span", { children: cache ? `Metadata updated ${metadataAge(cache.ageMs)}${cache.state === "stale" ? " · stale" : ""}` : "Metadata has not been loaded" }),
|
|
18
|
+
(cache == null ? void 0 : cache.lastRefreshError) ? /* @__PURE__ */ jsxs(
|
|
19
|
+
"p",
|
|
20
|
+
{
|
|
21
|
+
className: "truncate text-destructive",
|
|
22
|
+
title: cache.lastRefreshError,
|
|
23
|
+
children: [
|
|
24
|
+
"Refresh failed: ",
|
|
25
|
+
cache.lastRefreshError
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
) : null
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
IconButton,
|
|
32
|
+
{
|
|
33
|
+
icon: UiRefresh,
|
|
34
|
+
label,
|
|
35
|
+
disabled: inspection.refreshing,
|
|
36
|
+
onClick: inspection.refresh
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
InspectionStatus
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=inspectionStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectionStatus.js","sources":["../../../src/profiles/connections/inspectionStatus.tsx"],"sourcesContent":["import { IconButton } from \"../../components/IconButton\";\nimport { UiRefresh } from \"../../icons\";\nimport type { Inspection } from \"./useInspection\";\n\nfunction metadataAge(ageMs: number): string {\n const minutes = Math.floor(ageMs / 60_000);\n if (minutes < 1) return \"just now\";\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 48) return `${hours}h ago`;\n return `${Math.floor(hours / 24)}d ago`;\n}\n\nexport function InspectionStatus({ inspection }: { inspection: Inspection }) {\n const cache = inspection.cache;\n const label = inspection.refreshing\n ? \"Refreshing metadata\"\n : \"Refresh metadata\";\n return (\n <div className=\"flex items-center justify-between gap-2 rounded-md border px-2 py-1 text-xs text-muted-foreground\">\n <div className=\"min-w-0\">\n <span>\n {cache\n ? `Metadata updated ${metadataAge(cache.ageMs)}${cache.state === \"stale\" ? \" · stale\" : \"\"}`\n : \"Metadata has not been loaded\"}\n </span>\n {cache?.lastRefreshError ? (\n <p\n className=\"truncate text-destructive\"\n title={cache.lastRefreshError}\n >\n Refresh failed: {cache.lastRefreshError}\n </p>\n ) : null}\n </div>\n <IconButton\n icon={UiRefresh}\n label={label}\n disabled={inspection.refreshing}\n onClick={inspection.refresh}\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,YAAY,OAAuB;AAC1C,QAAM,UAAU,KAAK,MAAM,QAAQ,GAAM;AACzC,MAAI,UAAU,EAAG,QAAO;AACxB,MAAI,UAAU,GAAI,QAAO,GAAG,OAAO;AACnC,QAAM,QAAQ,KAAK,MAAM,UAAU,EAAE;AACrC,MAAI,QAAQ,GAAI,QAAO,GAAG,KAAK;AAC/B,SAAO,GAAG,KAAK,MAAM,QAAQ,EAAE,CAAC;AAClC;AAEO,SAAS,iBAAiB,EAAE,cAA0C;AAC3E,QAAM,QAAQ,WAAW;AACzB,QAAM,QAAQ,WAAW,aACrB,wBACA;AACJ,SACE,qBAAC,OAAA,EAAI,WAAU,qGACb,UAAA;AAAA,IAAA,qBAAC,OAAA,EAAI,WAAU,WACb,UAAA;AAAA,MAAA,oBAAC,QAAA,EACE,UAAA,QACG,oBAAoB,YAAY,MAAM,KAAK,CAAC,GAAG,MAAM,UAAU,UAAU,aAAa,EAAE,KACxF,gCACN;AAAA,OACC,+BAAO,oBACN;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO,MAAM;AAAA,UACd,UAAA;AAAA,YAAA;AAAA,YACkB,MAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,IAEvB;AAAA,IAAA,GACN;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA,UAAU,WAAW;AAAA,QACrB,SAAS,WAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EACtB,GACF;AAEJ;"}
|