@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7
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/README.md +564 -2
- package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
- package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
- package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
- package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
- package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
- package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
- package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
- package/dist/DateTimeField-B1qR4ruo.js +51 -0
- package/dist/Disclosure-BNKij7-v.js +45 -0
- package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
- package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
- package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
- package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
- package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
- package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
- package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
- package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
- package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
- package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
- package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
- package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
- package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
- package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
- package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
- package/dist/FluidGridsMark-CE2blT7K.js +74 -0
- package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
- package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
- package/dist/HistoryPage-BSBISXoj.js +2835 -0
- package/dist/Icon-BtQ0HXLh.js +160 -0
- package/dist/InsightsPage-D7ybj8N9.js +11245 -0
- package/dist/IsolationSetting-vy911E8b.js +1153 -0
- package/dist/LibraryParts-DOeNgR8A.js +413 -0
- package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
- package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
- package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
- package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
- package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
- package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
- package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
- package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
- package/dist/NodesPage-O7KeeKtd.js +653 -0
- package/dist/OfflineIcon-TwMKYWjA.js +207 -0
- package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
- package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
- package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
- package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
- package/dist/RunActionsMenu-DodOgIQm.js +59 -0
- package/dist/RunnerStatusPill-C1v967iq.js +24 -0
- package/dist/RunnersPage-dB0RSdY_.js +1929 -0
- package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
- package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
- package/dist/SearchBox-BGtYjvfs.js +49 -0
- package/dist/SequenceEditor-CFiHeHkR.js +497 -0
- package/dist/SettingsPage-0CQBNPZV.js +8695 -0
- package/dist/StewardPages-DAJhepen.js +47 -0
- package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
- package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
- package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
- package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
- package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
- package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
- package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
- package/dist/TemplatePreview-cx7-NOeG.js +868 -0
- package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
- package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
- package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
- package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
- package/dist/TranslationBridge-Da-TPgQm.js +68 -0
- package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
- package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
- package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
- package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
- package/dist/VariablesPage-ChfGuW22.js +2243 -0
- package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
- package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
- package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
- package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
- package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
- package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
- package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
- package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
- package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
- package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
- package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
- package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
- package/dist/WorkflowsList--hR2_8gf.js +4593 -0
- package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
- package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
- package/dist/addonCatalog-CbZS4deh.js +58 -0
- package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
- package/dist/addons.d.ts +3 -0
- package/dist/addons.js +4 -0
- package/dist/agent-form-Bfvm32j1.js +83 -0
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/agentTools-CyL7DLOF.js +320 -0
- package/dist/ai-usage-BrxDgvdR.js +240 -0
- package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
- package/dist/api-BKq-nIOZ.js +2286 -0
- package/dist/api-Ol7I8NxE.js +8289 -0
- package/dist/apollo-type-policies.d.ts +11 -0
- package/dist/apollo-type-policies.js +64 -0
- package/dist/askAboutBridge-ByYsQams.js +106 -0
- package/dist/askQuestions-Cmx7VnMm.js +742 -0
- package/dist/assert-rules-lfYEMc99.js +318 -0
- package/dist/assistant.d.ts +94 -0
- package/dist/assistant.js +99 -0
- package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/basil.generated-BK-EHbwN.js +10 -0
- package/dist/browser-steps-DMpS5TyB.js +533 -0
- package/dist/builderTimings-pvGnK1m-.js +510 -0
- package/dist/button-DG7y_FVJ.js +48 -0
- package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
- package/dist/card-Bomy_1UG.js +44 -0
- package/dist/catalogGrid-BOrfMgi-.js +41 -0
- package/dist/channel-CPyQ1NR1.js +212 -0
- package/dist/chips-CvNrYJZa.js +27 -0
- package/dist/client-holder-C0M5Cfwl.js +68 -0
- package/dist/cn-QqidFIgr.js +10 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/code-editor-field-x_JrY8KR.js +113 -0
- package/dist/codec-client-DPuD6mw7.js +515 -0
- package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
- package/dist/config-DO68jw5k.js +322 -0
- package/dist/constants-DgbVc24O.d.ts +296 -0
- package/dist/constants-DlRnHBfQ.js +217 -0
- package/dist/convert-browser-action-pfecelF7.js +347 -0
- package/dist/convert-dialog-B_o22NiJ.js +382 -0
- package/dist/create-workflow-first-Azg3JUdX.js +120 -0
- package/dist/definition-canvas-Bsda-rDT.js +31 -0
- package/dist/dialog-BVd152GS.js +94 -0
- package/dist/durable-nodes-BXyYCLxT.js +91 -0
- package/dist/duration-CDb7-mT_.js +33 -0
- package/dist/edge-mapper-wEAdGVU2.js +4477 -0
- package/dist/element-library-DkSlg_VE.js +727 -0
- package/dist/entities-I_0kio3q.js +38 -0
- package/dist/error-advice-QLr5NCm7.js +65 -0
- package/dist/errors-ClKb5sEt.js +188 -0
- package/dist/executions.d.ts +3 -0
- package/dist/executions.js +5 -0
- package/dist/feature-flags-B2qetXKd.js +385 -0
- package/dist/field-label-DPZRmE_B.js +153 -0
- package/dist/firstWorkflow-C_h0KMB2.js +133 -0
- package/dist/flags.d.ts +3 -0
- package/dist/flags.js +4 -0
- package/dist/flow-builder-DIvLOhz0.js +28038 -0
- package/dist/flow-store-holder-CUN7Terz.js +52 -0
- package/dist/fluent.generated-CA_e6-4l.js +14 -0
- package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
- package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
- package/dist/global-client-BQPuFrFa.js +433 -0
- package/dist/global-operations-BG6YgxrM.js +136 -0
- package/dist/graphql-types-UTYtujY9.js +21358 -0
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/index-AoJAa5vU.d.ts +164958 -0
- package/dist/index-DEMT3iAM.d.ts +120 -0
- package/dist/index-ROZzNGyY.d.ts +76 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8123 -0
- package/dist/ion.generated-mbajjcAg.js +10 -0
- package/dist/label-Lzb8ZXf_.js +29 -0
- package/dist/labels-rXd9gYQz.js +1236 -0
- package/dist/liveCanvas-D5ytXDp8.js +103 -0
- package/dist/logos.generated-X6_0kjVR.js +21 -0
- package/dist/logs-panel-Cw0DkG0l.js +468 -0
- package/dist/lucide.generated-B6NVd3GT.js +29 -0
- package/dist/marksStore-a9oIMMot.js +175 -0
- package/dist/mcp-trigger-D0nRdvq5.js +307 -0
- package/dist/mdi.generated-D1BV74d6.js +292 -0
- package/dist/menus-CU3hDGYl.js +160 -0
- package/dist/mynaui.generated-DMWr5cXz.js +66 -0
- package/dist/navigation-v2.d.ts +3 -0
- package/dist/navigation-v2.js +5 -0
- package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
- package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
- package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/node-role-TMbnkmeP.js +132 -0
- package/dist/node-type-icon-BZa8n4iG.js +33 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +5 -0
- package/dist/offset-pages-zghoClB3.js +55 -0
- package/dist/operations-BBmT9ToP.js +663 -0
- package/dist/operations-WxRJWeqO.js +3133 -0
- package/dist/output-files-Ba8bu5lv.js +196 -0
- package/dist/page-operation-DrWuhd6Y.js +129 -0
- package/dist/page-twins.d.ts +13 -0
- package/dist/page-twins.js +186 -0
- package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
- package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
- package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
- package/dist/panels-PfBBAToE.js +346 -0
- package/dist/parts-B7fBcw-B.js +346 -0
- package/dist/popover-Dms9Vz3j.js +3389 -0
- package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
- package/dist/proactive.d.ts +66 -0
- package/dist/proactive.js +237 -0
- package/dist/quick-config-panel-DFd77xho.js +451 -0
- package/dist/quota-DeA_CJ2e.js +175 -0
- package/dist/quota.d.ts +3 -0
- package/dist/quota.js +4 -0
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/relative-time-Dxt8ZIIu.js +55 -0
- package/dist/results-CwK_yDxK.js +325 -0
- package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
- package/dist/route-data.d.ts +12 -0
- package/dist/route-data.js +69 -0
- package/dist/route-match-C-0_EnAt.d.ts +5 -0
- package/dist/route-match-DMkUICYV.js +41 -0
- package/dist/route-preload-C4DlGoCd.js +120 -0
- package/dist/run-display-UjLAoYqQ.js +81 -0
- package/dist/run-history-arGiHzGU.js +285 -0
- package/dist/run-list-links-DJn4Mf1T.js +98 -0
- package/dist/run-mode-USmM0-Uo.js +82 -0
- package/dist/run-parity-CWXqEJqM.js +144 -0
- package/dist/runsQuota-B6SyTbne.js +100 -0
- package/dist/runsQuota-DsniKiSg.d.ts +20 -0
- package/dist/safe-expression-Cw7-SCsm.js +1251 -0
- package/dist/save-status-store-C7nEYpfb.js +631 -0
- package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
- package/dist/schedule-rules-ggVKRkBH.js +358 -0
- package/dist/secrets-Re_wSiE3.js +153 -0
- package/dist/settings.d.ts +4 -0
- package/dist/settings.js +6 -0
- package/dist/shared-DAWGGMSM.js +177 -0
- package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
- package/dist/solar.generated-CGYuUQAC.js +10 -0
- package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
- package/dist/start-url-CT6Yz96K.js +24 -0
- package/dist/status-CessxGpm.js +55 -0
- package/dist/store-icon-OctYp5zP.js +155 -0
- package/dist/styles-WGmTnZ2n.js +26 -0
- package/dist/styles.css +139 -0
- package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
- package/dist/template-code-CzN6JWNV.js +191 -0
- package/dist/template-graph-DLF9dygU.js +20 -0
- package/dist/template-preview-DcIIKOOL.js +32 -0
- package/dist/template-price-CdUHZRMF.js +40 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +5 -0
- package/dist/theme-provider-CntfC4_i.js +23 -0
- package/dist/transient-DgZfhDfN.js +57 -0
- package/dist/typed-calls-C5tO03wq.js +26 -0
- package/dist/ui-script-By74Guk3.js +1094 -0
- package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
- package/dist/ui-step-fix-8uM2_Hft.js +67 -0
- package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
- package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
- package/dist/ui-target-editor-D2JhB_lD.js +673 -0
- package/dist/uiMarkTools-CSznnO1i.js +1054 -0
- package/dist/upgradePrompt-BAFBKKW5.js +72 -0
- package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
- package/dist/use-browser-available-hj8wc3Kb.js +241 -0
- package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
- package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
- package/dist/use-mobile-BTqCUjzS.js +27 -0
- package/dist/use-sdk-query-C697xZVv.js +116 -0
- package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
- package/dist/useActionParam-B2tU2BlY.js +85 -0
- package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
- package/dist/useBrowserClients-3v95-gSh.js +103 -0
- package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
- package/dist/useConnections-DsgEJs05.js +439 -0
- package/dist/useDebouncedValue-BFekcv6n.js +18 -0
- package/dist/useDurableParity-8fnMZmBc.js +1787 -0
- package/dist/useEntityTags-D0spL6Ut.js +460 -0
- package/dist/useExecutions-2u5nGJJk.js +681 -0
- package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
- package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
- package/dist/useHumanRequests-zlYDp3l1.js +221 -0
- package/dist/useNavigationV2-C2WeqN7d.js +29 -0
- package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
- package/dist/useObservability-BRlQ0tOA.js +285 -0
- package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
- package/dist/useRunHistory-CXCMUPyf.js +2759 -0
- package/dist/useRunLive-D0JvVZT2.js +1060 -0
- package/dist/useRunnerList-Dbi59i1K.js +446 -0
- package/dist/useRunners-URUc5quU.js +173 -0
- package/dist/useRunsPage-DG656UCK.js +2709 -0
- package/dist/useVariables-BIelxcWr.js +463 -0
- package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
- package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
- package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
- package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
- package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
- package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
- package/dist/utils-fvBb5qOD.js +89 -0
- package/dist/webhook-deliveries-AvQujaZy.js +99 -0
- package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
- package/dist/workflow-builder.d.ts +3 -0
- package/dist/workflow-builder.js +8 -0
- package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
- package/dist/workflow-embed.d.ts +3 -0
- package/dist/workflow-embed.js +4 -0
- package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
- package/dist/workflow-host.d.ts +6 -0
- package/dist/workflow-host.js +11 -0
- package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
- package/dist/workflow-pages.d.ts +3 -0
- package/dist/workflow-pages.js +115 -0
- package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
- package/dist/workflow-preview.d.ts +65 -0
- package/dist/workflow-preview.js +4 -0
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflow-save-state-D0l-DkLf.js +767 -0
- package/dist/workflow-transfer-CQnQC-ke.js +104 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.d.ts +10 -0
- package/dist/workflows-list.js +5 -0
- package/package.json +320 -4
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
|
|
3
|
+
import { s as throwIfResultError } from "./errors-ClKb5sEt.js";
|
|
4
|
+
import { f as MORE_TOOLS_PAGE_SIZE, g as serverWindow, h as pageSlice, m as matchesSearch } from "./results-CwK_yDxK.js";
|
|
5
|
+
import { t as RUNNER_FIELDS } from "./useRunners-URUc5quU.js";
|
|
6
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { gql } from "@apollo/client/core";
|
|
8
|
+
import { pageRange, totalPagesFor } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
|
|
10
|
+
// src/modules/runners/utils/runner-view.ts
|
|
11
|
+
/**
|
|
12
|
+
* Pure helpers of the redesigned Runners page (BOFF-15502, Navigation v2):
|
|
13
|
+
* the status chips and the search, the counts the header and the chips show,
|
|
14
|
+
* and the machine facts in plain words.
|
|
15
|
+
*/
|
|
16
|
+
/** The status chips, in order: `?status=` in the address ("all" is left out). */
|
|
17
|
+
const RUNNER_FILTERS = [
|
|
18
|
+
"all",
|
|
19
|
+
"online",
|
|
20
|
+
"offline",
|
|
21
|
+
"never"
|
|
22
|
+
];
|
|
23
|
+
const FILTER_OF_STATUS = {
|
|
24
|
+
ONLINE: "online",
|
|
25
|
+
OFFLINE: "offline",
|
|
26
|
+
NEVER_CONNECTED: "never"
|
|
27
|
+
};
|
|
28
|
+
/** The chip a runner counts under. */
|
|
29
|
+
function runnerFilterOf(status) {
|
|
30
|
+
return FILTER_OF_STATUS[status];
|
|
31
|
+
}
|
|
32
|
+
/** A runner matches the chip and the search (its name or its machine's name). */
|
|
33
|
+
function runnerMatches(runner, filter, search) {
|
|
34
|
+
if (filter !== "all" && runnerFilterOf(runner.status) !== filter) return false;
|
|
35
|
+
return matchesSearch(search, runner.name, runner.hostname);
|
|
36
|
+
}
|
|
37
|
+
/** How many runners each chip holds (every runner, whatever the search). */
|
|
38
|
+
function runnerCounts(runners) {
|
|
39
|
+
const counts = {
|
|
40
|
+
all: runners.length,
|
|
41
|
+
online: 0,
|
|
42
|
+
offline: 0,
|
|
43
|
+
never: 0
|
|
44
|
+
};
|
|
45
|
+
for (const runner of runners) counts[runnerFilterOf(runner.status)] += 1;
|
|
46
|
+
return counts;
|
|
47
|
+
}
|
|
48
|
+
const OS_NAMES = {
|
|
49
|
+
linux: "Linux",
|
|
50
|
+
darwin: "macOS",
|
|
51
|
+
macos: "macOS",
|
|
52
|
+
windows: "Windows"
|
|
53
|
+
};
|
|
54
|
+
const ARCH_NAMES = {
|
|
55
|
+
amd64: "x86-64",
|
|
56
|
+
x86_64: "x86-64",
|
|
57
|
+
arm64: "ARM64",
|
|
58
|
+
aarch64: "ARM64"
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The machine's system as people name it: "Linux (x86-64)", "macOS (Apple
|
|
62
|
+
* silicon)". Product names, so not translated; unknown values stay as sent.
|
|
63
|
+
*/
|
|
64
|
+
function runnerSystemLabel(os, arch) {
|
|
65
|
+
const osKey = os?.trim().toLowerCase() ?? "";
|
|
66
|
+
const archKey = arch?.trim().toLowerCase() ?? "";
|
|
67
|
+
if (!osKey && !archKey) return null;
|
|
68
|
+
const osName = OS_NAMES[osKey] ?? os?.trim() ?? "";
|
|
69
|
+
const archName = osName === "macOS" && (archKey === "arm64" || archKey === "aarch64") ? "Apple silicon" : ARCH_NAMES[archKey] ?? arch?.trim() ?? "";
|
|
70
|
+
if (!osName) return archName;
|
|
71
|
+
return archName ? `${osName} (${archName})` : osName;
|
|
72
|
+
}
|
|
73
|
+
const DRIVER_NAMES = {
|
|
74
|
+
microsandbox: "microsandbox (microVM)",
|
|
75
|
+
gvisor: "gVisor"
|
|
76
|
+
};
|
|
77
|
+
/** The local sandbox technology by its product name. */
|
|
78
|
+
function runnerSandboxLabel(driver) {
|
|
79
|
+
const key = driver?.trim().toLowerCase() ?? "";
|
|
80
|
+
if (!key) return null;
|
|
81
|
+
return DRIVER_NAMES[key] ?? driver.trim();
|
|
82
|
+
}
|
|
83
|
+
/** "store/postgresql" → "Postgresql": a node type as a word, not an id. */
|
|
84
|
+
function stepTypeLabel(nodeType) {
|
|
85
|
+
const words = (nodeType.split(/[:/]/).filter(Boolean).pop() ?? nodeType).replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_\-.]+/).filter(Boolean);
|
|
86
|
+
if (words.length === 0) return nodeType;
|
|
87
|
+
return words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
88
|
+
}
|
|
89
|
+
/** The ports of a rule, or null for every port. */
|
|
90
|
+
function rulePorts(rule) {
|
|
91
|
+
return rule.ports.length > 0 ? rule.ports.join(", ") : null;
|
|
92
|
+
}
|
|
93
|
+
/** The steps a rule is limited to, in words, or null for every step. */
|
|
94
|
+
function ruleSteps(rule) {
|
|
95
|
+
return rule.nodes.length > 0 ? rule.nodes.map(stepTypeLabel).join(", ") : null;
|
|
96
|
+
}
|
|
97
|
+
/** The example the Private network panel shows; copied as is. */
|
|
98
|
+
const NETWORK_ALLOW_EXAMPLE = "fluidgrids-runner network allow 10.0.5.12 --port 5432";
|
|
99
|
+
/** The example the Host commands panel shows; copied as is. */
|
|
100
|
+
const HOST_EXEC_ENABLE_EXAMPLE = "fluidgrids-runner exec enable --allow echo";
|
|
101
|
+
/** How to disable host commands on the runner machine. */
|
|
102
|
+
const HOST_EXEC_DISABLE_EXAMPLE = "fluidgrids-runner exec disable";
|
|
103
|
+
|
|
104
|
+
// src/modules/runners/hooks/useLiveRead.ts
|
|
105
|
+
/**
|
|
106
|
+
* A read for the redesigned More tools lists (BOFF-15502) that keeps its last
|
|
107
|
+
* answer while the next one loads, so a new page or filter dims the rows on
|
|
108
|
+
* screen instead of blanking them, and a failed refresh keeps the rows.
|
|
109
|
+
*
|
|
110
|
+
* - `key` names what is read; a new key reads again, `null` reads nothing.
|
|
111
|
+
* - An answer to a superseded read (an older key, an earlier refresh) is
|
|
112
|
+
* dropped, and nothing is set after the component is gone.
|
|
113
|
+
* - `data` is the last answer and `dataKey` the key it answered: the page
|
|
114
|
+
* decides whether it can show it for the current key. `errorKey` likewise
|
|
115
|
+
* says which key's read failed last.
|
|
116
|
+
*
|
|
117
|
+
* Runners and Task queues both use it (the More tools kit has no such read
|
|
118
|
+
* yet; see the BOFF-15502 report).
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* The rows the service sent for one window of a list it pages, as the page
|
|
122
|
+
* slice the pager reads: the window at `offset` of `total`.
|
|
123
|
+
*/
|
|
124
|
+
function windowSlice(items, offset, total, pageSize = MORE_TOOLS_PAGE_SIZE) {
|
|
125
|
+
const page = Math.floor(offset / pageSize) + 1;
|
|
126
|
+
const { start, end } = pageRange(page, pageSize, total);
|
|
127
|
+
return {
|
|
128
|
+
items,
|
|
129
|
+
page,
|
|
130
|
+
totalPages: totalPagesFor(total, pageSize),
|
|
131
|
+
total,
|
|
132
|
+
start,
|
|
133
|
+
end
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const NOTHING_SETTLED = {
|
|
137
|
+
data: null,
|
|
138
|
+
dataKey: null,
|
|
139
|
+
error: null,
|
|
140
|
+
errorKey: null
|
|
141
|
+
};
|
|
142
|
+
function useLiveRead(key, load) {
|
|
143
|
+
const latestLoad = useRef(load);
|
|
144
|
+
const latestKey = useRef(key);
|
|
145
|
+
useLayoutEffect(() => {
|
|
146
|
+
latestLoad.current = load;
|
|
147
|
+
latestKey.current = key;
|
|
148
|
+
});
|
|
149
|
+
const request = useRef(0);
|
|
150
|
+
const alive = useRef(true);
|
|
151
|
+
const [settled, setSettled] = useState(NOTHING_SETTLED);
|
|
152
|
+
const [loadingKey, setLoadingKey] = useState(null);
|
|
153
|
+
const refetch = useCallback(async () => {
|
|
154
|
+
const current = latestKey.current;
|
|
155
|
+
if (current === null) return;
|
|
156
|
+
const id = ++request.current;
|
|
157
|
+
setLoadingKey(current);
|
|
158
|
+
try {
|
|
159
|
+
const data = await latestLoad.current();
|
|
160
|
+
if (!alive.current || id !== request.current) return;
|
|
161
|
+
setSettled({
|
|
162
|
+
data,
|
|
163
|
+
dataKey: current,
|
|
164
|
+
error: null,
|
|
165
|
+
errorKey: null
|
|
166
|
+
});
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if (!alive.current || id !== request.current) return;
|
|
169
|
+
setSettled((previous) => ({
|
|
170
|
+
...previous,
|
|
171
|
+
error,
|
|
172
|
+
errorKey: current
|
|
173
|
+
}));
|
|
174
|
+
} finally {
|
|
175
|
+
if (alive.current && id === request.current) setLoadingKey(null);
|
|
176
|
+
}
|
|
177
|
+
}, []);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
alive.current = true;
|
|
180
|
+
return () => {
|
|
181
|
+
alive.current = false;
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
refetch();
|
|
186
|
+
}, [key, refetch]);
|
|
187
|
+
return {
|
|
188
|
+
...settled,
|
|
189
|
+
loading: key !== null && loadingKey === key,
|
|
190
|
+
refetch
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/modules/runners/hooks/useRunnerList.ts
|
|
195
|
+
/**
|
|
196
|
+
* The sources of the redesigned Runners page (BOFF-15502), on the service's
|
|
197
|
+
* paging (BOFF-15501: `sandboxRunners(limit, offset)` and
|
|
198
|
+
* `sandboxRunnerCount`, oldest first, at most 1000 runners):
|
|
199
|
+
*
|
|
200
|
+
* - The plain list (no status chip, no search) is paged by the service: one
|
|
201
|
+
* window of 20 per page, its total from the count, read again every 5 s
|
|
202
|
+
* while the tab is visible (once a minute while it is hidden).
|
|
203
|
+
* - The service filters by neither status nor name, so a chip or a search
|
|
204
|
+
* reads every runner, 100 at a time, and filters and pages them here. It is
|
|
205
|
+
* read again on the same schedule only while one window holds them all; a
|
|
206
|
+
* larger workspace is read again when the chip or the search changes and
|
|
207
|
+
* after an action, never every window on a timer.
|
|
208
|
+
* - The chips' counts and "N online" need every runner's status: they are
|
|
209
|
+
* given only when every runner is in hand (null otherwise), never guessed
|
|
210
|
+
* from one page.
|
|
211
|
+
* - One runner (its page, the add dialog's "connected" line) is found 100 at
|
|
212
|
+
* a time, newest last, then read again in the window it was found in.
|
|
213
|
+
*/
|
|
214
|
+
/** Re-read this often while the page is visible (today's rate). */
|
|
215
|
+
const RUNNERS_POLL_MS = 5e3;
|
|
216
|
+
/** Re-read this often while the browser tab is hidden. */
|
|
217
|
+
const RUNNERS_HIDDEN_POLL_MS = 6e4;
|
|
218
|
+
/** The largest window the service sends. */
|
|
219
|
+
const RUNNER_WINDOW = 100;
|
|
220
|
+
/** The service lists at most this many runners (and counts at most this many). */
|
|
221
|
+
const RUNNER_LIMIT = 1e3;
|
|
222
|
+
const SANDBOX_RUNNERS_WINDOW = gql`
|
|
223
|
+
${RUNNER_FIELDS}
|
|
224
|
+
query SandboxRunnersWindow($limit: Int!, $offset: Int!) {
|
|
225
|
+
sandboxRunners(context: {}, limit: $limit, offset: $offset) {
|
|
226
|
+
...SandboxRunnerFields
|
|
227
|
+
}
|
|
228
|
+
sandboxRunnerCount(context: {})
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
231
|
+
/** One window of the runners, oldest first, and their count. */
|
|
232
|
+
async function fetchRunnersWindow(offset, limit) {
|
|
233
|
+
const result = throwIfResultError(await getFluidGridsClient().query({
|
|
234
|
+
query: SANDBOX_RUNNERS_WINDOW,
|
|
235
|
+
variables: {
|
|
236
|
+
limit,
|
|
237
|
+
offset
|
|
238
|
+
},
|
|
239
|
+
fetchPolicy: "network-only"
|
|
240
|
+
}));
|
|
241
|
+
return {
|
|
242
|
+
runners: result.data?.sandboxRunners ?? [],
|
|
243
|
+
total: result.data?.sandboxRunnerCount ?? 0
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/** Every runner, 100 at a time (the service lists at most 1000). */
|
|
247
|
+
async function fetchAllRunners() {
|
|
248
|
+
const first = await fetchRunnersWindow(0, 100);
|
|
249
|
+
const bound = Math.min(first.total, RUNNER_LIMIT);
|
|
250
|
+
const offsets = [];
|
|
251
|
+
for (let offset = 100; offset < bound; offset += 100) offsets.push(offset);
|
|
252
|
+
const rest = await Promise.all(offsets.map((offset) => fetchRunnersWindow(offset, 100)));
|
|
253
|
+
const seen = /* @__PURE__ */ new Set();
|
|
254
|
+
const runners = [];
|
|
255
|
+
for (const window of [first, ...rest]) for (const runner of window.runners) if (!seen.has(runner.id)) {
|
|
256
|
+
seen.add(runner.id);
|
|
257
|
+
runners.push(runner);
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
runners,
|
|
261
|
+
total: first.total
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Calls `poll` every `visibleMs` while the document is visible and every
|
|
266
|
+
* `hiddenMs` while it is hidden; coming back to the tab reads at once.
|
|
267
|
+
* `visibleMs` of 0 stops it.
|
|
268
|
+
*
|
|
269
|
+
* One call at a time: a tick (or a return to the tab) while a call is still
|
|
270
|
+
* on its way is skipped. Otherwise a read slower than the interval would be
|
|
271
|
+
* replaced by the next before it could answer (`useLiveRead` keeps only the
|
|
272
|
+
* newest read's answer), and the list would never update.
|
|
273
|
+
*/
|
|
274
|
+
function useVisiblePolling(poll, visibleMs, hiddenMs) {
|
|
275
|
+
const latest = useRef(poll);
|
|
276
|
+
useLayoutEffect(() => {
|
|
277
|
+
latest.current = poll;
|
|
278
|
+
});
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
if (typeof document === "undefined" || visibleMs <= 0) return;
|
|
281
|
+
let timer;
|
|
282
|
+
let running = false;
|
|
283
|
+
const hidden = () => document.visibilityState === "hidden";
|
|
284
|
+
const read = () => {
|
|
285
|
+
if (running) return;
|
|
286
|
+
running = true;
|
|
287
|
+
let pending;
|
|
288
|
+
try {
|
|
289
|
+
pending = latest.current();
|
|
290
|
+
} catch {
|
|
291
|
+
pending = void 0;
|
|
292
|
+
}
|
|
293
|
+
Promise.resolve(pending).catch(() => void 0).finally(() => {
|
|
294
|
+
running = false;
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
const schedule = () => {
|
|
298
|
+
clearTimeout(timer);
|
|
299
|
+
timer = setTimeout(tick, hidden() ? hiddenMs : visibleMs);
|
|
300
|
+
};
|
|
301
|
+
const tick = () => {
|
|
302
|
+
read();
|
|
303
|
+
schedule();
|
|
304
|
+
};
|
|
305
|
+
const onVisibility = () => {
|
|
306
|
+
if (!hidden()) read();
|
|
307
|
+
schedule();
|
|
308
|
+
};
|
|
309
|
+
schedule();
|
|
310
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
311
|
+
return () => {
|
|
312
|
+
clearTimeout(timer);
|
|
313
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
314
|
+
};
|
|
315
|
+
}, [visibleMs, hiddenMs]);
|
|
316
|
+
}
|
|
317
|
+
/** Reads again each time `refreshKey` goes up (after an add, a new key, a removal). */
|
|
318
|
+
function useRefresh(refetch, refreshKey) {
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
if (refreshKey > 0) refetch();
|
|
321
|
+
}, [refreshKey, refetch]);
|
|
322
|
+
}
|
|
323
|
+
/** A chip or a search: the service cannot filter, so every runner is read. */
|
|
324
|
+
function isRunnerQueryFiltered({ filter, search }) {
|
|
325
|
+
return filter !== "all" || search.trim() !== "";
|
|
326
|
+
}
|
|
327
|
+
/** The page a snapshot can show for a query, and whether it is the one asked. */
|
|
328
|
+
function deriveRunnerView(snapshot, query) {
|
|
329
|
+
if (snapshot.kind === "all" || snapshot.offset === 0 && snapshot.runners.length >= snapshot.total) {
|
|
330
|
+
const matching = snapshot.runners.filter((runner) => runnerMatches(runner, query.filter, query.search));
|
|
331
|
+
return {
|
|
332
|
+
slice: pageSlice(matching, query.page),
|
|
333
|
+
counts: runnerCounts(snapshot.runners),
|
|
334
|
+
exact: true
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
const slice = windowSlice(snapshot.runners, snapshot.offset, snapshot.total);
|
|
338
|
+
return {
|
|
339
|
+
slice,
|
|
340
|
+
counts: null,
|
|
341
|
+
exact: !isRunnerQueryFiltered(query) && slice.page === query.page
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Whether the list may be read again on a timer: the plain list reads one
|
|
346
|
+
* window; a filtered list only while one window holds every runner.
|
|
347
|
+
*/
|
|
348
|
+
function runnerListPollable(snapshot, filtered) {
|
|
349
|
+
if (!filtered) return true;
|
|
350
|
+
return snapshot !== null && snapshot.kind === "all" && snapshot.total <= 100;
|
|
351
|
+
}
|
|
352
|
+
function useRunnerList({ filter, search, page, refreshKey = 0 }) {
|
|
353
|
+
const filtered = isRunnerQueryFiltered({
|
|
354
|
+
filter,
|
|
355
|
+
search
|
|
356
|
+
});
|
|
357
|
+
const { offset, limit } = serverWindow(page);
|
|
358
|
+
const key = filtered ? "all" : `window:${offset}`;
|
|
359
|
+
const load = useCallback(async () => {
|
|
360
|
+
if (filtered) return {
|
|
361
|
+
kind: "all",
|
|
362
|
+
...await fetchAllRunners()
|
|
363
|
+
};
|
|
364
|
+
return {
|
|
365
|
+
kind: "window",
|
|
366
|
+
offset,
|
|
367
|
+
...await fetchRunnersWindow(offset, limit)
|
|
368
|
+
};
|
|
369
|
+
}, [
|
|
370
|
+
filtered,
|
|
371
|
+
offset,
|
|
372
|
+
limit
|
|
373
|
+
]);
|
|
374
|
+
const read = useLiveRead(key, load);
|
|
375
|
+
useVisiblePolling(read.refetch, runnerListPollable(read.data, filtered) ? RUNNERS_POLL_MS : 0, RUNNERS_HIDDEN_POLL_MS);
|
|
376
|
+
useRefresh(read.refetch, refreshKey);
|
|
377
|
+
const view = useMemo(() => read.data ? deriveRunnerView(read.data, {
|
|
378
|
+
filter,
|
|
379
|
+
search,
|
|
380
|
+
page
|
|
381
|
+
}) : null, [
|
|
382
|
+
read.data,
|
|
383
|
+
filter,
|
|
384
|
+
search,
|
|
385
|
+
page
|
|
386
|
+
]);
|
|
387
|
+
return {
|
|
388
|
+
total: read.data?.total ?? null,
|
|
389
|
+
view,
|
|
390
|
+
pageLoading: view !== null && !view.exact,
|
|
391
|
+
error: read.errorKey === key ? read.error : null,
|
|
392
|
+
refetch: read.refetch
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* One runner, found 100 at a time (newest last, so a runner just added is
|
|
397
|
+
* found first), then read again every 5 s in the window it was found in.
|
|
398
|
+
* A runner that is not found is not looked for again on a timer.
|
|
399
|
+
*/
|
|
400
|
+
function useTrackedRunner(id, refreshKey = 0) {
|
|
401
|
+
const where = useRef({
|
|
402
|
+
id,
|
|
403
|
+
offset: 0
|
|
404
|
+
});
|
|
405
|
+
const load = useCallback(async () => {
|
|
406
|
+
if (id === null) return { runner: null };
|
|
407
|
+
if (where.current.id !== id) where.current = {
|
|
408
|
+
id,
|
|
409
|
+
offset: 0
|
|
410
|
+
};
|
|
411
|
+
const known = await fetchRunnersWindow(where.current.offset, 100);
|
|
412
|
+
const hit = known.runners.find((runner) => runner.id === id);
|
|
413
|
+
if (hit) return { runner: hit };
|
|
414
|
+
const bound = Math.min(known.total, RUNNER_LIMIT);
|
|
415
|
+
const last = Math.max(0, Math.ceil(bound / 100) - 1);
|
|
416
|
+
for (let index = last; index >= 0; index -= 1) {
|
|
417
|
+
const offset = index * 100;
|
|
418
|
+
if (offset === where.current.offset) continue;
|
|
419
|
+
const found = (await fetchRunnersWindow(offset, 100)).runners.find((runner) => runner.id === id);
|
|
420
|
+
if (found) {
|
|
421
|
+
where.current = {
|
|
422
|
+
id,
|
|
423
|
+
offset
|
|
424
|
+
};
|
|
425
|
+
return { runner: found };
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return { runner: null };
|
|
429
|
+
}, [id]);
|
|
430
|
+
const key = id === null ? null : `runner:${id}`;
|
|
431
|
+
const read = useLiveRead(key, load);
|
|
432
|
+
const fresh = key !== null && read.dataKey === key;
|
|
433
|
+
const runner = fresh ? read.data?.runner ?? void 0 : void 0;
|
|
434
|
+
useVisiblePolling(read.refetch, runner ? RUNNERS_POLL_MS : 0, RUNNERS_HIDDEN_POLL_MS);
|
|
435
|
+
useRefresh(read.refetch, refreshKey);
|
|
436
|
+
const error = read.errorKey === key ? read.error : null;
|
|
437
|
+
return {
|
|
438
|
+
runner,
|
|
439
|
+
missing: fresh && !runner,
|
|
440
|
+
loading: key !== null && !fresh && !error,
|
|
441
|
+
error,
|
|
442
|
+
refetch: read.refetch
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export { windowSlice as a, NETWORK_ALLOW_EXAMPLE as c, ruleSteps as d, runnerSandboxLabel as f, useLiveRead as i, RUNNER_FILTERS as l, useTrackedRunner as n, HOST_EXEC_DISABLE_EXAMPLE as o, runnerSystemLabel as p, useVisiblePolling as r, HOST_EXEC_ENABLE_EXAMPLE as s, useRunnerList as t, rulePorts as u };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as getFluidGridsClient } from "./client-holder-C0M5Cfwl.js";
|
|
3
|
+
import { s as throwIfResultError } from "./errors-ClKb5sEt.js";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { gql } from "@apollo/client";
|
|
6
|
+
|
|
7
|
+
// src/modules/runners/hooks/useRunners.ts
|
|
8
|
+
/**
|
|
9
|
+
* Self-hosted runners (wspace-sandbox-svc): list, add, rotate token, remove.
|
|
10
|
+
*
|
|
11
|
+
* A runner is a program the customer installs on their own machine; workflow
|
|
12
|
+
* nodes whose "Run on" names it execute there, in a local sandbox. Mirrors the
|
|
13
|
+
* connections/variables hook pattern (shared Apollo client, no generated hooks).
|
|
14
|
+
*/
|
|
15
|
+
/** The fields every runner read asks for (the list, its pages, create and rotate). */
|
|
16
|
+
const RUNNER_FIELDS = gql`
|
|
17
|
+
fragment SandboxRunnerFields on SandboxRunner {
|
|
18
|
+
id
|
|
19
|
+
name
|
|
20
|
+
status
|
|
21
|
+
hostname
|
|
22
|
+
os
|
|
23
|
+
arch
|
|
24
|
+
driver
|
|
25
|
+
version
|
|
26
|
+
capacity
|
|
27
|
+
privateNetwork {
|
|
28
|
+
target
|
|
29
|
+
ports
|
|
30
|
+
nodes
|
|
31
|
+
}
|
|
32
|
+
hostExec {
|
|
33
|
+
enabled
|
|
34
|
+
allow
|
|
35
|
+
user
|
|
36
|
+
}
|
|
37
|
+
tokenPrefix
|
|
38
|
+
lastSeenAt
|
|
39
|
+
connectedAt
|
|
40
|
+
createdBy
|
|
41
|
+
createdAt
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const LIST_RUNNERS = gql`
|
|
45
|
+
${RUNNER_FIELDS}
|
|
46
|
+
query SandboxRunners {
|
|
47
|
+
sandboxRunners(context: {}) {
|
|
48
|
+
...SandboxRunnerFields
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const CREATE_RUNNER = gql`
|
|
53
|
+
${RUNNER_FIELDS}
|
|
54
|
+
mutation CreateSandboxRunner($name: String!) {
|
|
55
|
+
createSandboxRunner(input: { name: $name, context: {} }) {
|
|
56
|
+
token
|
|
57
|
+
bridgeUrl
|
|
58
|
+
runner {
|
|
59
|
+
...SandboxRunnerFields
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const ROTATE_RUNNER_TOKEN = gql`
|
|
65
|
+
${RUNNER_FIELDS}
|
|
66
|
+
mutation RotateSandboxRunnerToken($id: ID!) {
|
|
67
|
+
rotateSandboxRunnerToken(id: $id, context: {}) {
|
|
68
|
+
token
|
|
69
|
+
bridgeUrl
|
|
70
|
+
runner {
|
|
71
|
+
...SandboxRunnerFields
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
const DELETE_RUNNER = gql`
|
|
77
|
+
mutation DeleteSandboxRunner($id: ID!) {
|
|
78
|
+
deleteSandboxRunner(id: $id, context: {})
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
/** Where the installer is published (fluidgrids-runner release workflow). */
|
|
82
|
+
const RUNNER_INSTALL_SCRIPT_URL = "https://www.fluidgrids.ai/downloads/runner/install.sh";
|
|
83
|
+
/**
|
|
84
|
+
* The one-line install command shown after creating a runner. It carries NO
|
|
85
|
+
* token: the installer asks for it (input hidden), so the token never lands in
|
|
86
|
+
* shell history or the machine's process list.
|
|
87
|
+
*/
|
|
88
|
+
function runnerInstallCommand(bridgeUrl) {
|
|
89
|
+
const base = `curl -fsSL ${RUNNER_INSTALL_SCRIPT_URL} | sh`;
|
|
90
|
+
return bridgeUrl && bridgeUrl !== "wss://graphqlworkspaces.burdenoff.com/runner-bridge" ? `${base} -s -- --url ${bridgeUrl}` : base;
|
|
91
|
+
}
|
|
92
|
+
/** The runner's built-in default; omitted from the command when it matches. */
|
|
93
|
+
const DEFAULT_BRIDGE_URL = "wss://graphqlworkspaces.burdenoff.com/runner-bridge";
|
|
94
|
+
/**
|
|
95
|
+
* Runners in the current workspace. Polls while mounted so ONLINE/OFFLINE
|
|
96
|
+
* stays current (a runner heartbeats every 20 s).
|
|
97
|
+
*/
|
|
98
|
+
function useRunners(options) {
|
|
99
|
+
const [runners, setRunners] = useState([]);
|
|
100
|
+
const [loading, setLoading] = useState(!options?.skip);
|
|
101
|
+
const [error, setError] = useState(null);
|
|
102
|
+
const mounted = useRef(true);
|
|
103
|
+
const fetchRunners = useCallback(async () => {
|
|
104
|
+
if (options?.skip) return;
|
|
105
|
+
try {
|
|
106
|
+
const result = await getFluidGridsClient().query({
|
|
107
|
+
query: LIST_RUNNERS,
|
|
108
|
+
fetchPolicy: "network-only"
|
|
109
|
+
});
|
|
110
|
+
if (!mounted.current) return;
|
|
111
|
+
setRunners(result.data?.sandboxRunners ?? []);
|
|
112
|
+
setError(null);
|
|
113
|
+
} catch (err) {
|
|
114
|
+
if (mounted.current) setError(err);
|
|
115
|
+
} finally {
|
|
116
|
+
if (mounted.current) setLoading(false);
|
|
117
|
+
}
|
|
118
|
+
}, [options?.skip]);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
mounted.current = true;
|
|
121
|
+
fetchRunners();
|
|
122
|
+
const pollMs = options?.pollMs ?? 1e4;
|
|
123
|
+
const timer = pollMs > 0 ? setInterval(fetchRunners, pollMs) : null;
|
|
124
|
+
return () => {
|
|
125
|
+
mounted.current = false;
|
|
126
|
+
if (timer) clearInterval(timer);
|
|
127
|
+
};
|
|
128
|
+
}, [fetchRunners, options?.pollMs]);
|
|
129
|
+
return {
|
|
130
|
+
runners,
|
|
131
|
+
loading,
|
|
132
|
+
error,
|
|
133
|
+
refetch: fetchRunners
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function useRunnerActions() {
|
|
137
|
+
const [busy, setBusy] = useState(false);
|
|
138
|
+
const run = useCallback(async (fn) => {
|
|
139
|
+
setBusy(true);
|
|
140
|
+
try {
|
|
141
|
+
return await fn();
|
|
142
|
+
} finally {
|
|
143
|
+
setBusy(false);
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
return {
|
|
147
|
+
createRunner: useCallback((name) => run(async () => {
|
|
148
|
+
const result = throwIfResultError(await getFluidGridsClient().mutate({
|
|
149
|
+
mutation: CREATE_RUNNER,
|
|
150
|
+
variables: { name }
|
|
151
|
+
}));
|
|
152
|
+
if (!result.data?.createSandboxRunner) throw new Error("No runner returned");
|
|
153
|
+
return result.data.createSandboxRunner;
|
|
154
|
+
}), [run]),
|
|
155
|
+
rotateToken: useCallback((id) => run(async () => {
|
|
156
|
+
const result = throwIfResultError(await getFluidGridsClient().mutate({
|
|
157
|
+
mutation: ROTATE_RUNNER_TOKEN,
|
|
158
|
+
variables: { id }
|
|
159
|
+
}));
|
|
160
|
+
if (!result.data?.rotateSandboxRunnerToken) throw new Error("No runner returned");
|
|
161
|
+
return result.data.rotateSandboxRunnerToken;
|
|
162
|
+
}), [run]),
|
|
163
|
+
deleteRunner: useCallback((id) => run(async () => {
|
|
164
|
+
return throwIfResultError(await getFluidGridsClient().mutate({
|
|
165
|
+
mutation: DELETE_RUNNER,
|
|
166
|
+
variables: { id }
|
|
167
|
+
})).data?.deleteSandboxRunner === true;
|
|
168
|
+
}), [run]),
|
|
169
|
+
busy
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { useRunners as a, useRunnerActions as i, RUNNER_INSTALL_SCRIPT_URL as n, runnerInstallCommand as r, RUNNER_FIELDS as t };
|