@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8
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,2243 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
|
|
3
|
+
import { t as Icon } from "./Icon-BtQ0HXLh.js";
|
|
4
|
+
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
5
|
+
import { n as useNavigationV2 } from "./useNavigationV2-C2WeqN7d.js";
|
|
6
|
+
import { t as describeOperationError } from "./errors-ClKb5sEt.js";
|
|
7
|
+
import { i as SdkPermissionButton, s as useFluidGridsPermission, t as FLUIDGRIDS_PERMISSIONS } from "./constants-DlRnHBfQ.js";
|
|
8
|
+
import { c as useUpdateVariable, i as useRevealVariableValue, l as useVariables, n as useDeleteVariable, r as useEveryVariable, t as useCreateVariable } from "./useVariables-BIelxcWr.js";
|
|
9
|
+
import { t as cn } from "./cn-QqidFIgr.js";
|
|
10
|
+
import { n as formatRelativeTime, t as formatExactTime } from "./relative-time-Dxt8ZIIu.js";
|
|
11
|
+
import { t as ConfirmActionDialog } from "./ConfirmActionDialog-DHWTDRbp.js";
|
|
12
|
+
import { a as useWorkflowProjects } from "./useWorkflowOrganization-CpBbOrs7.js";
|
|
13
|
+
import { _ as ViewOnlyPill, c as CompactRow, f as RowSummary, g as MoreToolsPage, h as MoreToolsHeader, i as Panel, m as Dot, o as ToneAlert, s as CompactList, u as ListToolbar, v as WhatIsLink } from "./panels-PfBBAToE.js";
|
|
14
|
+
import { i as copyText, n as CopyButton } from "./secrets-Re_wSiE3.js";
|
|
15
|
+
import { a as NoResultsPanel, c as ResultsPager, f as MORE_TOOLS_PAGE_SIZE, g as serverWindow, h as pageSlice, m as matchesSearch, n as ListSkeleton, o as PagedBody, p as countBy, r as LoadErrorPanel, s as ResultsHeading, t as EmptyPanel, u as formatCount } from "./results-CwK_yDxK.js";
|
|
16
|
+
import { a as useClampedPage, o as useSearchDraft, r as readChoice, s as useUrlListState, t as RowMenu } from "./menus-CU3hDGYl.js";
|
|
17
|
+
import { n as Status } from "./status-CessxGpm.js";
|
|
18
|
+
import { t as CONTROL_RING } from "./styles-WGmTnZ2n.js";
|
|
19
|
+
import { t as ChoiceSelect } from "./ChoiceSelect-LkK-uS9J.js";
|
|
20
|
+
import { t as SearchBox } from "./SearchBox-BGtYjvfs.js";
|
|
21
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
22
|
+
import { Link, useNavigate } from "react-router";
|
|
23
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { Braces, Eye, EyeOff, FolderClosed, KeyRound, Pencil, Plus, Trash2, Users } from "lucide-react";
|
|
25
|
+
import { toast } from "sonner";
|
|
26
|
+
import { Badge, Card, CardHeader, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, EmptyState, Input, Label, PageTabs, ResponsiveDialog, ResponsiveDialogContent, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger } from "@burdenoff/fe-libs/ui";
|
|
27
|
+
import { Button as Button$1 } from "@burdenoff/fe-libs/button";
|
|
28
|
+
|
|
29
|
+
// src/modules/variables/utils/secret-reference.ts
|
|
30
|
+
const KEY_PATTERN = /^[a-z][a-z0-9_-]{0,39}$/;
|
|
31
|
+
const KEY_CHAR = /[a-z0-9_-]/;
|
|
32
|
+
const PLAIN_SEGMENT_CHAR = /[A-Za-z0-9_/+=@-]/;
|
|
33
|
+
const CONTROL_CHARS = /\p{Cc}/u;
|
|
34
|
+
const MAX_NAME_LENGTH = 512;
|
|
35
|
+
const MAX_FIELD_LENGTH = 128;
|
|
36
|
+
const SECRETS_ROOT = "$secrets";
|
|
37
|
+
/** The pattern shown next to the field. */
|
|
38
|
+
const SECRET_REFERENCE_HINT = "$secrets.<provider>.<name>[.<field>]";
|
|
39
|
+
/** One `.segment` or `["segment"]` at `index`: its value and the index after it, or null. */
|
|
40
|
+
function readSegment(text, index) {
|
|
41
|
+
if (text[index] === ".") {
|
|
42
|
+
let end = index + 1;
|
|
43
|
+
while (end < text.length && PLAIN_SEGMENT_CHAR.test(text.charAt(end))) end += 1;
|
|
44
|
+
return end === index + 1 ? null : [text.slice(index + 1, end), end];
|
|
45
|
+
}
|
|
46
|
+
if (text[index] === "[" && text[index + 1] === "\"") {
|
|
47
|
+
let end = index + 2;
|
|
48
|
+
while (end < text.length && text[end] !== "\"") end += text[end] === "\\" ? 2 : 1;
|
|
49
|
+
if (end >= text.length || text[end + 1] !== "]") return null;
|
|
50
|
+
let value;
|
|
51
|
+
try {
|
|
52
|
+
value = JSON.parse(text.slice(index + 1, end + 1));
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
57
|
+
return [value, end + 2];
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/** The reference without one surrounding `{{ … }}`, or null when unbalanced. */
|
|
62
|
+
function unwrap(raw) {
|
|
63
|
+
const text = raw.trim();
|
|
64
|
+
if (!text.startsWith("{{")) return text;
|
|
65
|
+
if (!text.endsWith("}}")) return null;
|
|
66
|
+
return text.slice(2, -2).trim();
|
|
67
|
+
}
|
|
68
|
+
/** What is wrong with a typed reference, or null when it is well formed. */
|
|
69
|
+
function secretReferenceProblem(raw) {
|
|
70
|
+
if (!raw.trim()) return "empty";
|
|
71
|
+
const text = unwrap(raw);
|
|
72
|
+
if (text === null || !text.startsWith(`${SECRETS_ROOT}.`)) return "format";
|
|
73
|
+
let index = 9;
|
|
74
|
+
let keyEnd = index;
|
|
75
|
+
while (keyEnd < text.length && KEY_CHAR.test(text.charAt(keyEnd))) keyEnd += 1;
|
|
76
|
+
if (!KEY_PATTERN.test(text.slice(index, keyEnd))) return "providerKey";
|
|
77
|
+
index = keyEnd;
|
|
78
|
+
const name = readSegment(text, index);
|
|
79
|
+
if (!name) return "format";
|
|
80
|
+
index = name[1];
|
|
81
|
+
let field;
|
|
82
|
+
if (index < text.length) {
|
|
83
|
+
const next = readSegment(text, index);
|
|
84
|
+
if (!next) return "format";
|
|
85
|
+
field = next[0];
|
|
86
|
+
index = next[1];
|
|
87
|
+
}
|
|
88
|
+
if (index !== text.length) return "format";
|
|
89
|
+
if (name[0].length > MAX_NAME_LENGTH || CONTROL_CHARS.test(name[0])) return "name";
|
|
90
|
+
if (field !== void 0 && (field.length > MAX_FIELD_LENGTH || CONTROL_CHARS.test(field))) return "name";
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/modules/variables/utils/variable-form.ts
|
|
95
|
+
/** The providers the server no longer accepts for a new or moved variable. */
|
|
96
|
+
const RETIRED_PROVIDERS = /* @__PURE__ */ new Set([
|
|
97
|
+
"AWS_SECRETS_MANAGER",
|
|
98
|
+
"VAULT",
|
|
99
|
+
"AZURE_KEY_VAULT",
|
|
100
|
+
"GCP_SECRET_MANAGER"
|
|
101
|
+
]);
|
|
102
|
+
/** Where a new variable's value can come from, in the order offered. */
|
|
103
|
+
const VALUE_SOURCES = ["NONE", "SECRET_REFERENCE"];
|
|
104
|
+
const VALUE_SOURCE_SET = new Set(VALUE_SOURCES);
|
|
105
|
+
/** The retired providers' product names (proper nouns, not translated). */
|
|
106
|
+
const RETIRED_PROVIDER_NAMES = {
|
|
107
|
+
AWS_SECRETS_MANAGER: "AWS Secrets Manager",
|
|
108
|
+
VAULT: "HashiCorp Vault",
|
|
109
|
+
AZURE_KEY_VAULT: "Azure Key Vault",
|
|
110
|
+
GCP_SECRET_MANAGER: "GCP Secret Manager"
|
|
111
|
+
};
|
|
112
|
+
/** A retired provider's product name; the raw value for anything else. */
|
|
113
|
+
function retiredProviderName(provider) {
|
|
114
|
+
return RETIRED_PROVIDER_NAMES[provider] ?? provider;
|
|
115
|
+
}
|
|
116
|
+
/** True for a legacy provider that only existing rows can still show. */
|
|
117
|
+
function isRetiredProvider(provider) {
|
|
118
|
+
return RETIRED_PROVIDERS.has(provider);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The sources the dialog offers: typed in and platform secret, plus, when an
|
|
122
|
+
* existing variable still reads from a retired provider, that provider, so
|
|
123
|
+
* the dialog can show where the value comes from today.
|
|
124
|
+
*/
|
|
125
|
+
function valueSourceOptions(variable) {
|
|
126
|
+
const options = [...VALUE_SOURCES];
|
|
127
|
+
if (variable && isRetiredProvider(variable.externalProvider)) options.push(variable.externalProvider);
|
|
128
|
+
return options;
|
|
129
|
+
}
|
|
130
|
+
/** Narrows a select's value to a source this dialog offers for `variable`. */
|
|
131
|
+
function isOfferedValueSource(value, variable) {
|
|
132
|
+
return VALUE_SOURCE_SET.has(value) || !!variable && value === variable.externalProvider && isRetiredProvider(variable.externalProvider);
|
|
133
|
+
}
|
|
134
|
+
function initialVariableForm(variable) {
|
|
135
|
+
return {
|
|
136
|
+
key: variable?.key ?? "",
|
|
137
|
+
description: variable?.description ?? "",
|
|
138
|
+
isSecret: variable?.isSecret ?? false,
|
|
139
|
+
value: "",
|
|
140
|
+
scope: variable?.scope ?? "WORKSPACE",
|
|
141
|
+
projectId: variable?.projectId ?? "",
|
|
142
|
+
source: variable?.externalProvider ?? "NONE",
|
|
143
|
+
externalRef: variable?.externalRef ?? ""
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/** True when the variable's value lives outside this service. */
|
|
147
|
+
function isExternallyBacked(variable) {
|
|
148
|
+
return !!variable && variable.externalProvider !== "NONE";
|
|
149
|
+
}
|
|
150
|
+
/** A platform secret is always secret, whatever the switch said before. */
|
|
151
|
+
function effectiveIsSecret(form) {
|
|
152
|
+
return form.source === "SECRET_REFERENCE" || form.isSecret;
|
|
153
|
+
}
|
|
154
|
+
/** The reference's problem, as a form error. */
|
|
155
|
+
function referenceError(problem) {
|
|
156
|
+
return problem === "empty" ? "secretReferenceRequired" : "secretReferenceInvalid";
|
|
157
|
+
}
|
|
158
|
+
/** What stops the form from saving, in the order the fields appear. */
|
|
159
|
+
function variableFormErrors(form, variable, v2) {
|
|
160
|
+
const errors = [];
|
|
161
|
+
const isEdit = !!variable;
|
|
162
|
+
if (!isEdit && !form.key.trim()) errors.push("keyRequired");
|
|
163
|
+
if (v2 && !isEdit && form.scope === "PROJECT" && !form.projectId) errors.push("projectRequired");
|
|
164
|
+
if (form.source === "SECRET_REFERENCE") {
|
|
165
|
+
const problem = secretReferenceProblem(form.externalRef);
|
|
166
|
+
if (problem) errors.push(referenceError(problem));
|
|
167
|
+
} else if (isRetiredProvider(form.source) && form.source !== variable?.externalProvider) errors.push("providerRetired");
|
|
168
|
+
if (isEdit && isExternallyBacked(variable) && form.source === "NONE") {
|
|
169
|
+
if (!form.value) errors.push("valueRequired");
|
|
170
|
+
}
|
|
171
|
+
return errors;
|
|
172
|
+
}
|
|
173
|
+
/** The mutation input the form sends. Call only when it has no errors. */
|
|
174
|
+
function buildVariableSubmission(form, variable, v2) {
|
|
175
|
+
const isSecret = effectiveIsSecret(form);
|
|
176
|
+
if (!variable) {
|
|
177
|
+
const input = {
|
|
178
|
+
key: form.key.trim(),
|
|
179
|
+
description: form.description || void 0,
|
|
180
|
+
isSecret,
|
|
181
|
+
scope: form.scope
|
|
182
|
+
};
|
|
183
|
+
if (v2 && form.scope === "PROJECT") input.projectId = form.projectId;
|
|
184
|
+
if (form.source === "SECRET_REFERENCE") {
|
|
185
|
+
input.externalProvider = "SECRET_REFERENCE";
|
|
186
|
+
input.externalRef = form.externalRef.trim();
|
|
187
|
+
} else input.value = form.value;
|
|
188
|
+
return {
|
|
189
|
+
kind: "create",
|
|
190
|
+
input
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const input = { isSecret };
|
|
194
|
+
if (form.description !== (variable.description ?? "")) input.description = form.description;
|
|
195
|
+
if (form.source === "NONE") {
|
|
196
|
+
if (form.value) input.value = form.value;
|
|
197
|
+
if (isExternallyBacked(variable)) input.externalProvider = "NONE";
|
|
198
|
+
return {
|
|
199
|
+
kind: "update",
|
|
200
|
+
id: variable.id,
|
|
201
|
+
input
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (form.source !== "SECRET_REFERENCE") return {
|
|
205
|
+
kind: "update",
|
|
206
|
+
id: variable.id,
|
|
207
|
+
input
|
|
208
|
+
};
|
|
209
|
+
const ref = form.externalRef.trim();
|
|
210
|
+
if (variable.externalProvider !== "SECRET_REFERENCE") {
|
|
211
|
+
input.externalProvider = "SECRET_REFERENCE";
|
|
212
|
+
input.externalRef = ref;
|
|
213
|
+
} else if (ref !== (variable.externalRef ?? "")) input.externalRef = ref;
|
|
214
|
+
return {
|
|
215
|
+
kind: "update",
|
|
216
|
+
id: variable.id,
|
|
217
|
+
input
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/** The kind a form currently describes. */
|
|
221
|
+
function kindOfForm(form) {
|
|
222
|
+
if (form.source !== "NONE") return "store";
|
|
223
|
+
return form.isSecret ? "secret" : "plain";
|
|
224
|
+
}
|
|
225
|
+
/** The form with another kind picked; a store reference is always secret. */
|
|
226
|
+
function withKind(form, kind) {
|
|
227
|
+
if (kind === "store") return {
|
|
228
|
+
...form,
|
|
229
|
+
source: "SECRET_REFERENCE",
|
|
230
|
+
isSecret: true
|
|
231
|
+
};
|
|
232
|
+
return {
|
|
233
|
+
...form,
|
|
234
|
+
source: "NONE",
|
|
235
|
+
isSecret: kind === "secret"
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* The dialog's starting values. A variable still linked to a retired
|
|
240
|
+
* provider starts as a store reference with an empty reference, so saving
|
|
241
|
+
* it moves it to a secret store (or the person picks another kind).
|
|
242
|
+
*/
|
|
243
|
+
function initialKindForm(variable) {
|
|
244
|
+
const form = initialVariableForm(variable);
|
|
245
|
+
if (variable && isRetiredProvider(variable.externalProvider)) return {
|
|
246
|
+
...form,
|
|
247
|
+
source: "SECRET_REFERENCE",
|
|
248
|
+
externalRef: "",
|
|
249
|
+
isSecret: true
|
|
250
|
+
};
|
|
251
|
+
return form;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/modules/variables/hooks/useVariableFormSubmit.ts
|
|
255
|
+
/**
|
|
256
|
+
* Saving the Variables create/edit form (BOFF-11851, BOFF-10856): refuse with
|
|
257
|
+
* the form's errors (a toast naming the first one with the switch off; the
|
|
258
|
+
* fields' own errors in Navigation v2), otherwise create or update and report
|
|
259
|
+
* the outcome in plain words. The server's own refusal (for example a
|
|
260
|
+
* reference it cannot parse) is shown as it says it.
|
|
261
|
+
*/
|
|
262
|
+
function useVariableFormSubmit({ form, variable, v2, onDone }) {
|
|
263
|
+
const tr = useTr();
|
|
264
|
+
const { createVariable, loading: creating } = useCreateVariable();
|
|
265
|
+
const { updateVariable, loading: updating } = useUpdateVariable();
|
|
266
|
+
const [submitted, setSubmitted] = useState(false);
|
|
267
|
+
const errors = variableFormErrors(form, variable, v2);
|
|
268
|
+
const showError = (error) => v2 && submitted && errors.includes(error);
|
|
269
|
+
const messageFor = (error) => {
|
|
270
|
+
switch (error) {
|
|
271
|
+
case "keyRequired": return tr("fluidgrids.variables.keyRequired", "Key is required");
|
|
272
|
+
case "projectRequired": return tr("fluidgrids.variables.projectRequired", "Choose a project");
|
|
273
|
+
case "secretReferenceRequired": return tr("fluidgrids.variables.secretReferenceRequired", "Type the platform secret's reference");
|
|
274
|
+
case "secretReferenceInvalid": return tr("fluidgrids.variables.secretReferenceInvalid", "Write the reference as $secrets.<provider>.<name>, with an optional .<field>");
|
|
275
|
+
case "providerRetired": return tr("fluidgrids.variables.providerRetired", "This provider is retired. Choose a platform secret instead.");
|
|
276
|
+
case "valueRequired": return tr("fluidgrids.variables.valueRequired", "Type the value to keep it here");
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const submit = async () => {
|
|
280
|
+
const [firstError] = errors;
|
|
281
|
+
if (firstError) {
|
|
282
|
+
if (v2) setSubmitted(true);
|
|
283
|
+
else toast.error(messageFor(firstError));
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const submission = buildVariableSubmission(form, variable, v2);
|
|
287
|
+
try {
|
|
288
|
+
if (submission.kind === "update") {
|
|
289
|
+
await updateVariable(submission.id, submission.input);
|
|
290
|
+
toast.success(tr("fluidgrids.variables.updated", "Variable updated"));
|
|
291
|
+
} else {
|
|
292
|
+
await createVariable(submission.input);
|
|
293
|
+
toast.success(tr("fluidgrids.variables.created", "Variable created"));
|
|
294
|
+
}
|
|
295
|
+
onDone();
|
|
296
|
+
} catch (err) {
|
|
297
|
+
toast.error(describeOperationError(err, tr("fluidgrids.variables.saveFailed", "Failed to save variable")));
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
return {
|
|
301
|
+
submit,
|
|
302
|
+
showError,
|
|
303
|
+
saving: creating || updating
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// src/modules/variables/utils/variables-filters.ts
|
|
308
|
+
/**
|
|
309
|
+
* The Variables list's pure helpers (BOFF-15502): what kind a variable is,
|
|
310
|
+
* how the filters read from the address, and how they narrow the list.
|
|
311
|
+
*/
|
|
312
|
+
/** How long a revealed value stays on screen before it is masked again. */
|
|
313
|
+
const REVEAL_FOR_MS = 15e3;
|
|
314
|
+
/** Where secret stores are connected: Saved values › Providers (Navigation v2). */
|
|
315
|
+
const VAULT_INTEGRATIONS_PATH = "/security/providers";
|
|
316
|
+
const KIND_FILTERS = [
|
|
317
|
+
"all",
|
|
318
|
+
"plain",
|
|
319
|
+
"secret",
|
|
320
|
+
"store",
|
|
321
|
+
"retired"
|
|
322
|
+
];
|
|
323
|
+
const SORTS = ["key", "recent"];
|
|
324
|
+
/** The kind a saved variable has (a retired provider link is its own kind). */
|
|
325
|
+
function variableKind(variable) {
|
|
326
|
+
if (isRetiredProvider(variable.externalProvider)) return "retired";
|
|
327
|
+
if (variable.externalProvider === "SECRET_REFERENCE") return "store";
|
|
328
|
+
return variable.isSecret ? "secret" : "plain";
|
|
329
|
+
}
|
|
330
|
+
/** How steps use a variable. */
|
|
331
|
+
function usageOf(key) {
|
|
332
|
+
return `{{ $vars.${key} }}`;
|
|
333
|
+
}
|
|
334
|
+
function matchesApplies(variable, applies) {
|
|
335
|
+
if (applies === "workspace") return variable.scope === "WORKSPACE";
|
|
336
|
+
if (applies.startsWith("project:")) {
|
|
337
|
+
const projectId = applies.slice(8);
|
|
338
|
+
return variable.scope === "PROJECT" && variable.projectId === projectId;
|
|
339
|
+
}
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
/** The variables the filters keep, in the chosen order. */
|
|
343
|
+
function filterVariables(variables, filters) {
|
|
344
|
+
return variables.filter((variable) => matchesApplies(variable, filters.applies) && (filters.kind === "all" || variableKind(variable) === filters.kind) && matchesSearch(filters.q, variable.key, variable.description)).sort(filters.sort === "recent" ? (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime() : (a, b) => a.key.localeCompare(b.key));
|
|
345
|
+
}
|
|
346
|
+
/** True when the service can page the list as asked: key A–Z, no search or kind. */
|
|
347
|
+
function isServerPaged(filters) {
|
|
348
|
+
return filters.q.trim() === "" && filters.kind === "all" && filters.sort === "key";
|
|
349
|
+
}
|
|
350
|
+
/** The service's scope filter for an "Applies" choice. */
|
|
351
|
+
function scopeArgs(applies) {
|
|
352
|
+
if (applies === "workspace") return { scope: "WORKSPACE" };
|
|
353
|
+
if (applies.startsWith("project:")) return {
|
|
354
|
+
scope: "PROJECT",
|
|
355
|
+
projectId: applies.slice(8)
|
|
356
|
+
};
|
|
357
|
+
return {};
|
|
358
|
+
}
|
|
359
|
+
function readFilters(params) {
|
|
360
|
+
const applies = params.get("applies") ?? "all";
|
|
361
|
+
return {
|
|
362
|
+
q: params.get("q") ?? "",
|
|
363
|
+
applies: applies === "workspace" || applies.startsWith("project:") ? applies : "all",
|
|
364
|
+
kind: readChoice(params, "kind", KIND_FILTERS, "all"),
|
|
365
|
+
sort: readChoice(params, "sort", SORTS, "key")
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/modules/variables/hooks/useVariablesListState.ts
|
|
370
|
+
/**
|
|
371
|
+
* State behind the Variables list (BOFF-15502): filters from the address,
|
|
372
|
+
* the page read (on the service or in memory), and the delete confirmation.
|
|
373
|
+
*/
|
|
374
|
+
/** The page of variables the list shows, and the numbers around it. */
|
|
375
|
+
function useVariablesPage(revision) {
|
|
376
|
+
const list = useUrlListState();
|
|
377
|
+
const filters = useMemo(() => readFilters(list.params), [list.params]);
|
|
378
|
+
const onServer = isServerPaged(filters);
|
|
379
|
+
const window = onServer ? serverWindow(list.page) : {
|
|
380
|
+
offset: 0,
|
|
381
|
+
limit: 500
|
|
382
|
+
};
|
|
383
|
+
const { variables, total, loading, error, refetch } = useVariables({
|
|
384
|
+
...scopeArgs(filters.applies),
|
|
385
|
+
...window
|
|
386
|
+
});
|
|
387
|
+
const refetchRef = useRef(refetch);
|
|
388
|
+
useLayoutEffect(() => {
|
|
389
|
+
refetchRef.current = refetch;
|
|
390
|
+
});
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (revision > 0) refetchRef.current();
|
|
393
|
+
}, [revision]);
|
|
394
|
+
const filtered = useMemo(() => onServer ? variables : filterVariables(variables, filters), [
|
|
395
|
+
onServer,
|
|
396
|
+
variables,
|
|
397
|
+
filters
|
|
398
|
+
]);
|
|
399
|
+
const slice = onServer ? {
|
|
400
|
+
items: variables,
|
|
401
|
+
page: list.page,
|
|
402
|
+
total
|
|
403
|
+
} : pageSlice(filtered, list.page);
|
|
404
|
+
useClampedPage(list.page, slice.total, MORE_TOOLS_PAGE_SIZE, !loading && !error, list.setPage);
|
|
405
|
+
const [loadedOnce, setLoadedOnce] = useState(false);
|
|
406
|
+
if (!loading && !loadedOnce) setLoadedOnce(true);
|
|
407
|
+
return {
|
|
408
|
+
list,
|
|
409
|
+
filters,
|
|
410
|
+
variables,
|
|
411
|
+
total,
|
|
412
|
+
loading,
|
|
413
|
+
error,
|
|
414
|
+
refetch,
|
|
415
|
+
filtered,
|
|
416
|
+
slice,
|
|
417
|
+
loadedOnce,
|
|
418
|
+
capped: !onServer && total > variables.length,
|
|
419
|
+
kinds: onServer ? null : countBy(variables, variableKind)
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
/** The delete confirmation: which variable is pending, and the delete itself. */
|
|
423
|
+
function useDeleteFlow(onChanged) {
|
|
424
|
+
const tr = useTr();
|
|
425
|
+
const { deleteVariable, loading: deleting } = useDeleteVariable();
|
|
426
|
+
const [pendingDelete, setPendingDelete] = useState(null);
|
|
427
|
+
return {
|
|
428
|
+
pendingDelete,
|
|
429
|
+
setPendingDelete,
|
|
430
|
+
performDelete: useCallback(async () => {
|
|
431
|
+
if (!pendingDelete) return;
|
|
432
|
+
try {
|
|
433
|
+
await deleteVariable(pendingDelete.id);
|
|
434
|
+
toast.success(tr("fluidgrids.variables.deleted", "Variable deleted"));
|
|
435
|
+
setPendingDelete(null);
|
|
436
|
+
onChanged();
|
|
437
|
+
} catch (err) {
|
|
438
|
+
toast.error(describeOperationError(err, tr("fluidgrids.variables.deleteFailed", "Failed to delete variable")));
|
|
439
|
+
}
|
|
440
|
+
}, [
|
|
441
|
+
pendingDelete,
|
|
442
|
+
deleteVariable,
|
|
443
|
+
onChanged,
|
|
444
|
+
tr
|
|
445
|
+
]),
|
|
446
|
+
deleting
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function useVariablesListState(revision, onChanged) {
|
|
450
|
+
const page = useVariablesPage(revision);
|
|
451
|
+
const { list, filters } = page;
|
|
452
|
+
const commitSearch = useCallback((q) => list.set({ q }, { replace: true }), [list]);
|
|
453
|
+
const [search, setSearch] = useSearchDraft(filters.q, commitSearch);
|
|
454
|
+
const remove = useDeleteFlow(onChanged);
|
|
455
|
+
return {
|
|
456
|
+
...page,
|
|
457
|
+
search,
|
|
458
|
+
setSearch,
|
|
459
|
+
...remove
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/modules/variables/hooks/useVariablesPageState.ts
|
|
464
|
+
/**
|
|
465
|
+
* State behind the Variables page shell (BOFF-15502): permissions, the
|
|
466
|
+
* overall count, and the new/edit dialog.
|
|
467
|
+
*/
|
|
468
|
+
function useVariablesPermissions() {
|
|
469
|
+
const createPermission = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.VARIABLE_CREATE);
|
|
470
|
+
const canCreate = createPermission.allowed;
|
|
471
|
+
const canUpdate = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.VARIABLE_UPDATE).allowed;
|
|
472
|
+
const canDelete = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.VARIABLE_DELETE).allowed;
|
|
473
|
+
return {
|
|
474
|
+
canCreate,
|
|
475
|
+
canUpdate,
|
|
476
|
+
canDelete,
|
|
477
|
+
viewOnly: !createPermission.isLoading && !canCreate && !canUpdate && !canDelete
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function useVariableDialog() {
|
|
481
|
+
const [dialog, setDialog] = useState(null);
|
|
482
|
+
return {
|
|
483
|
+
dialog,
|
|
484
|
+
openNew: useCallback(() => setDialog((d) => ({
|
|
485
|
+
session: (d?.session ?? 0) + 1,
|
|
486
|
+
variable: null
|
|
487
|
+
})), []),
|
|
488
|
+
openEdit: useCallback((variable) => setDialog((d) => ({
|
|
489
|
+
session: (d?.session ?? 0) + 1,
|
|
490
|
+
variable
|
|
491
|
+
})), []),
|
|
492
|
+
close: useCallback(() => setDialog(null), [])
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/** Every variable's count and a way to refresh the page after a change. */
|
|
496
|
+
function useVariablesOverall() {
|
|
497
|
+
const overall = useVariables({
|
|
498
|
+
limit: 1,
|
|
499
|
+
offset: 0
|
|
500
|
+
});
|
|
501
|
+
const [revision, setRevision] = useState(0);
|
|
502
|
+
return {
|
|
503
|
+
overall,
|
|
504
|
+
revision,
|
|
505
|
+
changed: useCallback(() => {
|
|
506
|
+
overall.refetch();
|
|
507
|
+
setRevision((current) => current + 1);
|
|
508
|
+
}, [overall])
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// src/modules/variables/utils/variables-options.ts
|
|
513
|
+
function appliesOptions(tr, projects) {
|
|
514
|
+
return [
|
|
515
|
+
{
|
|
516
|
+
value: "all",
|
|
517
|
+
label: tr("fluidgrids.moreTools.variables.appliesAnywhere", "Anywhere")
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
value: "workspace",
|
|
521
|
+
label: tr("fluidgrids.moreTools.variables.appliesWorkspace", "Whole workspace")
|
|
522
|
+
},
|
|
523
|
+
...projects.map((project) => ({
|
|
524
|
+
value: `project:${project.id}`,
|
|
525
|
+
label: tr("fluidgrids.moreTools.variables.appliesProject", "Project: {{name}}", { name: project.name })
|
|
526
|
+
}))
|
|
527
|
+
];
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* With every variable loaded the kinds carry their counts; when the service
|
|
531
|
+
* pages the list they are plain choices (a count would be a guess).
|
|
532
|
+
*/
|
|
533
|
+
function kindOptions(tr, kinds, current) {
|
|
534
|
+
const count = (kind) => formatCount(kinds?.[kind] ?? 0);
|
|
535
|
+
return [
|
|
536
|
+
{
|
|
537
|
+
value: "all",
|
|
538
|
+
label: tr("fluidgrids.moreTools.variables.kindAny", "Any kind")
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
value: "plain",
|
|
542
|
+
label: kinds ? tr("fluidgrids.moreTools.variables.kindPlainCount", "Plain value ({{count}})", { count: count("plain") }) : tr("fluidgrids.moreTools.variables.kindPlain", "Plain value")
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
value: "secret",
|
|
546
|
+
label: kinds ? tr("fluidgrids.moreTools.variables.kindSecretCount", "Secret ({{count}})", { count: count("secret") }) : tr("fluidgrids.moreTools.variables.kindSecret", "Secret")
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
value: "store",
|
|
550
|
+
label: kinds ? tr("fluidgrids.moreTools.variables.kindStoreCount", "From a secret store ({{count}})", { count: count("store") }) : tr("fluidgrids.moreTools.variables.kindStore", "From a secret store")
|
|
551
|
+
},
|
|
552
|
+
...(kinds?.retired ?? 0) > 0 || current === "retired" ? [{
|
|
553
|
+
value: "retired",
|
|
554
|
+
label: tr("fluidgrids.moreTools.variables.kindRetiredCount", "Retired AWS link ({{count}})", { count: count("retired") })
|
|
555
|
+
}] : []
|
|
556
|
+
];
|
|
557
|
+
}
|
|
558
|
+
function sortOptions(tr) {
|
|
559
|
+
return [{
|
|
560
|
+
value: "key",
|
|
561
|
+
label: tr("fluidgrids.moreTools.variables.sortKey", "Key A–Z")
|
|
562
|
+
}, {
|
|
563
|
+
value: "recent",
|
|
564
|
+
label: tr("fluidgrids.moreTools.variables.sortRecent", "Recently changed")
|
|
565
|
+
}];
|
|
566
|
+
}
|
|
567
|
+
/** The new-variable dialog's three kinds. */
|
|
568
|
+
function kindChoices(tr) {
|
|
569
|
+
return [
|
|
570
|
+
{
|
|
571
|
+
value: "plain",
|
|
572
|
+
title: tr("fluidgrids.moreTools.variables.kindPlain", "Plain value"),
|
|
573
|
+
text: tr("fluidgrids.moreTools.variables.kindPlainHint", "Shown to anyone who can see variables")
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
value: "secret",
|
|
577
|
+
title: tr("fluidgrids.moreTools.variables.kindSecret", "Secret"),
|
|
578
|
+
text: tr("fluidgrids.moreTools.variables.kindSecretHint", "Masked everywhere, never in run logs")
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
value: "store",
|
|
582
|
+
title: tr("fluidgrids.moreTools.variables.kindStore", "From a secret store"),
|
|
583
|
+
text: tr("fluidgrids.moreTools.variables.kindStoreHint", "Read from a connected store each time a run needs it")
|
|
584
|
+
}
|
|
585
|
+
];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/modules/variables/pages/VariableDialogFields.tsx
|
|
589
|
+
/** The fields of the new / edit variable dialog (BOFF-15502). */
|
|
590
|
+
function RetiredNotice() {
|
|
591
|
+
const tr = useTr();
|
|
592
|
+
return /* @__PURE__ */ jsx(ToneAlert, {
|
|
593
|
+
tone: "warning",
|
|
594
|
+
title: tr("fluidgrids.moreTools.variables.retiredDialogTitle", "This variable uses the retired AWS Secrets Manager link"),
|
|
595
|
+
children: tr("fluidgrids.moreTools.variables.retiredDialogBody", "Point it at a secret store with a reference, or type its value as a secret.")
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function KeyHint({ keyText }) {
|
|
599
|
+
const tr = useTr();
|
|
600
|
+
const unusual = !!keyText && !/^[A-Z][A-Z0-9_]*$/.test(keyText);
|
|
601
|
+
return /* @__PURE__ */ jsx("p", {
|
|
602
|
+
id: "variable-key-hint",
|
|
603
|
+
className: cn("text-xs", unusual ? "text-status-warning-text" : "text-text-secondary"),
|
|
604
|
+
children: unusual ? tr("fluidgrids.moreTools.variables.keyCapitals", "Keys are usually capitals and underscores, like {{suggestion}}.", { suggestion: keyText.toUpperCase().replace(/[^A-Z0-9]+/g, "_") }) : tr("fluidgrids.moreTools.variables.keyUsage", "Use it as {{usage}}", { usage: usageOf(keyText || "KEY") })
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function KeyField$1({ form, update, showError, isEdit }) {
|
|
608
|
+
const tr = useTr();
|
|
609
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
610
|
+
className: "space-y-1.5",
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ jsx(Label, {
|
|
613
|
+
htmlFor: "variable-key",
|
|
614
|
+
children: tr("fluidgrids.variables.keyLabel", "Key")
|
|
615
|
+
}),
|
|
616
|
+
/* @__PURE__ */ jsx(Input, {
|
|
617
|
+
id: "variable-key",
|
|
618
|
+
value: form.key,
|
|
619
|
+
onChange: (event) => update("key", event.target.value),
|
|
620
|
+
disabled: isEdit,
|
|
621
|
+
placeholder: "API_URL",
|
|
622
|
+
className: "font-mono",
|
|
623
|
+
"aria-required": !isEdit,
|
|
624
|
+
"aria-invalid": showError("keyRequired"),
|
|
625
|
+
"aria-describedby": "variable-key-hint"
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ jsx(KeyHint, { keyText: form.key.trim() }),
|
|
628
|
+
showError("keyRequired") && /* @__PURE__ */ jsx("p", {
|
|
629
|
+
role: "alert",
|
|
630
|
+
className: "text-xs text-status-error-text",
|
|
631
|
+
children: tr("fluidgrids.variables.keyRequired", "Key is required")
|
|
632
|
+
})
|
|
633
|
+
]
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
function KindField({ kind, onPick }) {
|
|
637
|
+
const tr = useTr();
|
|
638
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
639
|
+
className: "space-y-1.5",
|
|
640
|
+
children: [/* @__PURE__ */ jsx("legend", {
|
|
641
|
+
className: "text-sm font-medium text-text-primary",
|
|
642
|
+
children: tr("fluidgrids.moreTools.variables.kindLegend", "Kind")
|
|
643
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
644
|
+
className: "grid gap-2 sm:grid-cols-3",
|
|
645
|
+
role: "radiogroup",
|
|
646
|
+
children: kindChoices(tr).map((option) => /* @__PURE__ */ jsxs("label", {
|
|
647
|
+
className: cn("flex cursor-pointer gap-2 rounded-lg border p-2.5 text-sm has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-accent-glow", kind === option.value ? "border-accent-glow/55 bg-accent-glow/10" : "border-border-default hover:border-border-strong"),
|
|
648
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
649
|
+
type: "radio",
|
|
650
|
+
name: "variable-kind",
|
|
651
|
+
value: option.value,
|
|
652
|
+
checked: kind === option.value,
|
|
653
|
+
onChange: () => onPick(option.value),
|
|
654
|
+
className: "mt-0.5 accent-[var(--color-action-primary-bg)]",
|
|
655
|
+
"data-testid": `variable-kind-${option.value}`
|
|
656
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
657
|
+
className: "min-w-0",
|
|
658
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
659
|
+
className: "block font-medium text-text-primary",
|
|
660
|
+
children: option.title
|
|
661
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
662
|
+
className: "block text-xs text-text-secondary",
|
|
663
|
+
children: option.text
|
|
664
|
+
})]
|
|
665
|
+
})]
|
|
666
|
+
}, option.value))
|
|
667
|
+
})]
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
function ReferenceField({ form, update, showError }) {
|
|
671
|
+
const tr = useTr();
|
|
672
|
+
const missing = showError("secretReferenceRequired");
|
|
673
|
+
const invalid = showError("secretReferenceInvalid");
|
|
674
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
675
|
+
className: "space-y-1.5",
|
|
676
|
+
children: [
|
|
677
|
+
/* @__PURE__ */ jsx(Label, {
|
|
678
|
+
htmlFor: "variable-external-ref",
|
|
679
|
+
children: tr("fluidgrids.moreTools.variables.refLabel", "Secret reference")
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ jsx(Input, {
|
|
682
|
+
id: "variable-external-ref",
|
|
683
|
+
value: form.externalRef,
|
|
684
|
+
onChange: (event) => update("externalRef", event.target.value),
|
|
685
|
+
placeholder: "$secrets.aws.stripe_key",
|
|
686
|
+
className: "font-mono",
|
|
687
|
+
"aria-required": true,
|
|
688
|
+
"aria-invalid": missing || invalid,
|
|
689
|
+
"aria-describedby": "variable-external-ref-hint"
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ jsx("p", {
|
|
692
|
+
id: "variable-external-ref-hint",
|
|
693
|
+
className: "text-xs text-text-secondary",
|
|
694
|
+
children: tr("fluidgrids.moreTools.variables.refHint", "$secrets.<store>.<name>, or $secrets.<store>.<name>.<field> for one field. Stores are connected in Saved values.")
|
|
695
|
+
}),
|
|
696
|
+
(missing || invalid) && /* @__PURE__ */ jsx("p", {
|
|
697
|
+
role: "alert",
|
|
698
|
+
className: "text-xs text-status-error-text",
|
|
699
|
+
children: missing ? tr("fluidgrids.moreTools.variables.refRequired", "Enter the secret's reference") : tr("fluidgrids.moreTools.variables.refInvalid", "A reference looks like $secrets.<store>.<name>")
|
|
700
|
+
})
|
|
701
|
+
]
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
function valuePlaceholder(tr, kind, variable) {
|
|
705
|
+
if (variable && !variable.externalRef) return tr("fluidgrids.variables.valueLeaveBlank", "Leave blank to keep the current value");
|
|
706
|
+
if (kind === "secret") return tr("fluidgrids.moreTools.variables.valueSecretPlaceholder", "Paste the secret");
|
|
707
|
+
return "https://api.example.com";
|
|
708
|
+
}
|
|
709
|
+
function ValueField$1({ form, update, showError, kind, variable }) {
|
|
710
|
+
const tr = useTr();
|
|
711
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
712
|
+
className: "space-y-1.5",
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ jsx(Label, {
|
|
715
|
+
htmlFor: "variable-value",
|
|
716
|
+
children: tr("fluidgrids.variables.valueLabel", "Value")
|
|
717
|
+
}),
|
|
718
|
+
/* @__PURE__ */ jsx(Input, {
|
|
719
|
+
id: "variable-value",
|
|
720
|
+
type: kind === "secret" ? "password" : "text",
|
|
721
|
+
value: form.value,
|
|
722
|
+
onChange: (event) => update("value", event.target.value),
|
|
723
|
+
className: "font-mono",
|
|
724
|
+
placeholder: valuePlaceholder(tr, kind, variable),
|
|
725
|
+
"aria-invalid": showError("valueRequired")
|
|
726
|
+
}),
|
|
727
|
+
showError("valueRequired") && /* @__PURE__ */ jsx("p", {
|
|
728
|
+
role: "alert",
|
|
729
|
+
className: "text-xs text-status-error-text",
|
|
730
|
+
children: tr("fluidgrids.variables.valueRequired", "Type the value to keep it here")
|
|
731
|
+
})
|
|
732
|
+
]
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
function ProjectField({ form, update, showError, isEdit, projects, projectsLoading }) {
|
|
736
|
+
const tr = useTr();
|
|
737
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
738
|
+
className: "space-y-1.5",
|
|
739
|
+
"data-testid": "variable-project-field",
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ jsx(Label, {
|
|
742
|
+
htmlFor: "variable-project",
|
|
743
|
+
children: tr("fluidgrids.variables.projectLabel", "Project")
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ jsx(ChoiceSelect, {
|
|
746
|
+
id: "variable-project",
|
|
747
|
+
value: form.projectId,
|
|
748
|
+
onValueChange: (projectId) => update("projectId", projectId),
|
|
749
|
+
disabled: isEdit,
|
|
750
|
+
options: projects.map((project) => ({
|
|
751
|
+
value: project.id,
|
|
752
|
+
label: project.name
|
|
753
|
+
})),
|
|
754
|
+
placeholder: projectsLoading ? tr("fluidgrids.variables.loading", "Loading…") : tr("fluidgrids.variables.projectPlaceholder", "Choose a project"),
|
|
755
|
+
"aria-invalid": showError("projectRequired"),
|
|
756
|
+
className: "w-full",
|
|
757
|
+
"data-testid": "variable-project"
|
|
758
|
+
}),
|
|
759
|
+
!projectsLoading && projects.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
760
|
+
className: "text-xs text-text-secondary",
|
|
761
|
+
children: tr("fluidgrids.variables.noProjects", "There are no projects yet. Create one from the Workflows list, or keep this variable for the whole workspace.")
|
|
762
|
+
}),
|
|
763
|
+
showError("projectRequired") && /* @__PURE__ */ jsx("p", {
|
|
764
|
+
role: "alert",
|
|
765
|
+
className: "text-xs text-status-error-text",
|
|
766
|
+
children: tr("fluidgrids.variables.projectRequired", "Choose a project")
|
|
767
|
+
})
|
|
768
|
+
]
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
function ScopeFields(props) {
|
|
772
|
+
const tr = useTr();
|
|
773
|
+
const { form, update, isEdit } = props;
|
|
774
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
775
|
+
className: "grid gap-3 sm:grid-cols-2",
|
|
776
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
777
|
+
className: "space-y-1.5",
|
|
778
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
779
|
+
htmlFor: "variable-scope",
|
|
780
|
+
children: tr("fluidgrids.moreTools.variables.appliesField", "Applies to")
|
|
781
|
+
}), /* @__PURE__ */ jsx(ChoiceSelect, {
|
|
782
|
+
id: "variable-scope",
|
|
783
|
+
value: form.scope,
|
|
784
|
+
onValueChange: (scope) => update("scope", scope),
|
|
785
|
+
disabled: isEdit,
|
|
786
|
+
options: [{
|
|
787
|
+
value: "WORKSPACE",
|
|
788
|
+
label: tr("fluidgrids.moreTools.variables.scopeWorkspace", "The whole workspace")
|
|
789
|
+
}, {
|
|
790
|
+
value: "PROJECT",
|
|
791
|
+
label: tr("fluidgrids.moreTools.variables.scopeProject", "One project")
|
|
792
|
+
}],
|
|
793
|
+
className: "w-full",
|
|
794
|
+
"data-testid": "variable-scope"
|
|
795
|
+
})]
|
|
796
|
+
}), form.scope === "PROJECT" && /* @__PURE__ */ jsx(ProjectField, { ...props })]
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
function DescriptionField({ form, update }) {
|
|
800
|
+
const tr = useTr();
|
|
801
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
802
|
+
className: "space-y-1.5",
|
|
803
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
804
|
+
htmlFor: "variable-description",
|
|
805
|
+
children: tr("fluidgrids.moreTools.variables.descriptionLabel", "Description (optional)")
|
|
806
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
807
|
+
id: "variable-description",
|
|
808
|
+
value: form.description,
|
|
809
|
+
onChange: (event) => update("description", event.target.value),
|
|
810
|
+
placeholder: tr("fluidgrids.moreTools.variables.descriptionPlaceholder", "What it is for")
|
|
811
|
+
})]
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// src/modules/variables/pages/VariableDialogV2.tsx
|
|
816
|
+
/** The new / edit variable dialog (BOFF-15502, Navigation v2). */
|
|
817
|
+
function DialogTitle$1({ variable }) {
|
|
818
|
+
const tr = useTr();
|
|
819
|
+
return /* @__PURE__ */ jsx(ResponsiveDialogTitle, { children: variable ? tr("fluidgrids.moreTools.variables.editTitle", "Edit {{key}}", { key: variable.key }) : tr("fluidgrids.moreTools.variables.newTitle", "New variable") });
|
|
820
|
+
}
|
|
821
|
+
function SaveLabel({ saving, isEdit }) {
|
|
822
|
+
const tr = useTr();
|
|
823
|
+
if (saving) return /* @__PURE__ */ jsx(Fragment$1, { children: tr("fluidgrids.variables.saving", "Saving…") });
|
|
824
|
+
if (isEdit) return /* @__PURE__ */ jsx(Fragment$1, { children: tr("fluidgrids.variables.save", "Save") });
|
|
825
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: tr("fluidgrids.moreTools.variables.create", "Create variable") });
|
|
826
|
+
}
|
|
827
|
+
function VariableDialogV2({ variable, onClose, onSaved }) {
|
|
828
|
+
const tr = useTr();
|
|
829
|
+
const isEdit = !!variable;
|
|
830
|
+
const [form, setForm] = useState(() => initialKindForm(variable));
|
|
831
|
+
const update = (field, value) => setForm((current) => ({
|
|
832
|
+
...current,
|
|
833
|
+
[field]: value
|
|
834
|
+
}));
|
|
835
|
+
const { submit, showError, saving } = useVariableFormSubmit({
|
|
836
|
+
form,
|
|
837
|
+
variable,
|
|
838
|
+
v2: true,
|
|
839
|
+
onDone: () => {
|
|
840
|
+
onSaved();
|
|
841
|
+
onClose();
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
const { projects, loading: projectsLoading } = useWorkflowProjects();
|
|
845
|
+
const kind = kindOfForm(form);
|
|
846
|
+
const retired = !!variable && isRetiredProvider(variable.externalProvider);
|
|
847
|
+
const field = {
|
|
848
|
+
form,
|
|
849
|
+
update,
|
|
850
|
+
showError
|
|
851
|
+
};
|
|
852
|
+
return /* @__PURE__ */ jsx(ResponsiveDialog, {
|
|
853
|
+
open: true,
|
|
854
|
+
onOpenChange: (open) => !open && onClose(),
|
|
855
|
+
children: /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
|
|
856
|
+
className: "max-w-lg",
|
|
857
|
+
"data-testid": "variable-dialog-v2",
|
|
858
|
+
children: [
|
|
859
|
+
/* @__PURE__ */ jsx(ResponsiveDialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle$1, { variable }) }),
|
|
860
|
+
/* @__PURE__ */ jsxs("div", {
|
|
861
|
+
className: "space-y-4 py-1",
|
|
862
|
+
children: [
|
|
863
|
+
retired && /* @__PURE__ */ jsx(RetiredNotice, {}),
|
|
864
|
+
/* @__PURE__ */ jsx(KeyField$1, {
|
|
865
|
+
...field,
|
|
866
|
+
isEdit
|
|
867
|
+
}),
|
|
868
|
+
/* @__PURE__ */ jsx(KindField, {
|
|
869
|
+
kind,
|
|
870
|
+
onPick: (next) => setForm((current) => withKind(current, next))
|
|
871
|
+
}),
|
|
872
|
+
kind === "store" ? /* @__PURE__ */ jsx(ReferenceField, { ...field }) : /* @__PURE__ */ jsx(ValueField$1, {
|
|
873
|
+
...field,
|
|
874
|
+
kind,
|
|
875
|
+
variable
|
|
876
|
+
}),
|
|
877
|
+
/* @__PURE__ */ jsx(ScopeFields, {
|
|
878
|
+
...field,
|
|
879
|
+
isEdit,
|
|
880
|
+
projects,
|
|
881
|
+
projectsLoading
|
|
882
|
+
}),
|
|
883
|
+
/* @__PURE__ */ jsx(DescriptionField, {
|
|
884
|
+
form,
|
|
885
|
+
update
|
|
886
|
+
})
|
|
887
|
+
]
|
|
888
|
+
}),
|
|
889
|
+
/* @__PURE__ */ jsxs(ResponsiveDialogFooter, { children: [/* @__PURE__ */ jsx(Button$1, {
|
|
890
|
+
variant: "outline",
|
|
891
|
+
onClick: onClose,
|
|
892
|
+
disabled: saving,
|
|
893
|
+
children: tr("fluidgrids.variables.cancel", "Cancel")
|
|
894
|
+
}), /* @__PURE__ */ jsx(Button$1, {
|
|
895
|
+
onClick: () => void submit(),
|
|
896
|
+
disabled: saving,
|
|
897
|
+
"data-agent": "confirm",
|
|
898
|
+
"data-testid": "variable-save",
|
|
899
|
+
children: /* @__PURE__ */ jsx(SaveLabel, {
|
|
900
|
+
saving,
|
|
901
|
+
isEdit
|
|
902
|
+
})
|
|
903
|
+
})] })
|
|
904
|
+
]
|
|
905
|
+
})
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// src/modules/variables/pages/VariablesPageHeader.tsx
|
|
910
|
+
/** The Variables page's header and tabs (BOFF-15502). */
|
|
911
|
+
function CountFact({ total }) {
|
|
912
|
+
const tr = useTr();
|
|
913
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
914
|
+
className: "tabular-nums",
|
|
915
|
+
"data-testid": "variables-count",
|
|
916
|
+
children: tr("fluidgrids.moreTools.variables.countFact", "{{count}} values your steps reuse", { count: formatCount(total) })
|
|
917
|
+
}), /* @__PURE__ */ jsx(Dot, {})] });
|
|
918
|
+
}
|
|
919
|
+
function HowItWorks() {
|
|
920
|
+
const tr = useTr();
|
|
921
|
+
return /* @__PURE__ */ jsxs(WhatIsLink, {
|
|
922
|
+
label: tr("fluidgrids.moreTools.variables.whatIs", "How variables work"),
|
|
923
|
+
title: tr("fluidgrids.moreTools.variables.whatIsTitle", "How variables work"),
|
|
924
|
+
children: [/* @__PURE__ */ jsx("p", { children: tr("fluidgrids.moreTools.variables.whatIsBody", "Keep a value once and use it in any step as {{usage}}. Change it here and every workflow picks it up.", { usage: usageOf("KEY") }) }), /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.moreTools.variables.whatIsLegacy", "Older workflows may use ${vars.KEY}, which still works. Secrets are masked everywhere and never printed to run logs.") })]
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
function VariablesPageHeader({ overall, viewOnly, showNew, onNew }) {
|
|
928
|
+
const tr = useTr();
|
|
929
|
+
return /* @__PURE__ */ jsx("div", {
|
|
930
|
+
"data-tour": "fluidgrids-variables-header",
|
|
931
|
+
children: /* @__PURE__ */ jsx(MoreToolsHeader, {
|
|
932
|
+
title: tr("fluidgrids.moreTools.variables.title", "Variables"),
|
|
933
|
+
titleTestId: "variables-title",
|
|
934
|
+
facts: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
935
|
+
!overall.loading && !overall.error && /* @__PURE__ */ jsx(CountFact, { total: overall.total }),
|
|
936
|
+
/* @__PURE__ */ jsx("span", { children: tr("fluidgrids.moreTools.variables.useAs", "Use one as {{usage}}", { usage: usageOf("KEY") }) }),
|
|
937
|
+
/* @__PURE__ */ jsx(HowItWorks, {}),
|
|
938
|
+
viewOnly && /* @__PURE__ */ jsx(ViewOnlyPill, {})
|
|
939
|
+
] }),
|
|
940
|
+
actions: showNew ? /* @__PURE__ */ jsxs(Button$1, {
|
|
941
|
+
onClick: onNew,
|
|
942
|
+
"data-tour": "fluidgrids-variables-create",
|
|
943
|
+
"data-testid": "variables-new",
|
|
944
|
+
children: [/* @__PURE__ */ jsx(Plus, {
|
|
945
|
+
className: "me-1.5 size-4",
|
|
946
|
+
"aria-hidden": "true"
|
|
947
|
+
}), tr("fluidgrids.moreTools.variables.new", "New variable")]
|
|
948
|
+
}) : null
|
|
949
|
+
})
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
function VariablesTabs({ overall, active }) {
|
|
953
|
+
const tr = useTr();
|
|
954
|
+
const tabs = [{
|
|
955
|
+
id: "variables",
|
|
956
|
+
label: tr("fluidgrids.moreTools.variables.tabVariables", "Variables"),
|
|
957
|
+
href: "?tab=variables",
|
|
958
|
+
badge: overall.loading || overall.error ? void 0 : overall.total
|
|
959
|
+
}, {
|
|
960
|
+
id: "stores",
|
|
961
|
+
label: tr("fluidgrids.moreTools.variables.tabStores", "Secret stores"),
|
|
962
|
+
href: "?tab=stores"
|
|
963
|
+
}];
|
|
964
|
+
return /* @__PURE__ */ jsx("div", {
|
|
965
|
+
className: "mb-4",
|
|
966
|
+
"data-tour": "fluidgrids-variables-tabs",
|
|
967
|
+
children: /* @__PURE__ */ jsx(PageTabs, {
|
|
968
|
+
tabs,
|
|
969
|
+
activeId: active,
|
|
970
|
+
maxVisible: 2,
|
|
971
|
+
ariaLabel: tr("fluidgrids.moreTools.variables.tabsLabel", "Variables sections")
|
|
972
|
+
})
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// src/modules/variables/pages/VariablesToolbar.tsx
|
|
977
|
+
/** The Variables list's search and filter row (BOFF-15502). */
|
|
978
|
+
function VariablesToolbar({ filters, list, search, onSearch, loading, kinds, projects }) {
|
|
979
|
+
const tr = useTr();
|
|
980
|
+
return /* @__PURE__ */ jsxs(ListToolbar, { children: [
|
|
981
|
+
/* @__PURE__ */ jsx(SearchBox, {
|
|
982
|
+
value: search,
|
|
983
|
+
onChange: onSearch,
|
|
984
|
+
placeholder: tr("fluidgrids.moreTools.variables.search", "Search keys and descriptions"),
|
|
985
|
+
disabled: loading,
|
|
986
|
+
testId: "variables-search"
|
|
987
|
+
}),
|
|
988
|
+
/* @__PURE__ */ jsx(ChoiceSelect, {
|
|
989
|
+
value: filters.applies,
|
|
990
|
+
onValueChange: (applies) => list.set({ applies: applies === "all" ? null : applies }),
|
|
991
|
+
options: appliesOptions(tr, projects),
|
|
992
|
+
prefix: tr("fluidgrids.moreTools.variables.appliesPrefix", "Applies"),
|
|
993
|
+
"aria-label": tr("fluidgrids.moreTools.variables.appliesLabel", "Where it applies"),
|
|
994
|
+
"data-testid": "variables-applies"
|
|
995
|
+
}),
|
|
996
|
+
/* @__PURE__ */ jsx(ChoiceSelect, {
|
|
997
|
+
value: filters.kind,
|
|
998
|
+
onValueChange: (kind) => list.set({ kind: kind === "all" ? null : kind }),
|
|
999
|
+
options: kindOptions(tr, kinds, filters.kind),
|
|
1000
|
+
prefix: tr("fluidgrids.moreTools.variables.kindPrefix", "Kind"),
|
|
1001
|
+
"aria-label": tr("fluidgrids.moreTools.variables.kindLabel", "Kind"),
|
|
1002
|
+
"data-testid": "variables-kind"
|
|
1003
|
+
}),
|
|
1004
|
+
/* @__PURE__ */ jsx(ChoiceSelect, {
|
|
1005
|
+
value: filters.sort,
|
|
1006
|
+
onValueChange: (sort) => list.set({ sort: sort === "key" ? null : sort }),
|
|
1007
|
+
options: sortOptions(tr),
|
|
1008
|
+
"aria-label": tr("fluidgrids.moreTools.variables.sortLabel", "Sort"),
|
|
1009
|
+
className: "sm:ms-auto",
|
|
1010
|
+
"data-testid": "variables-sort"
|
|
1011
|
+
})
|
|
1012
|
+
] });
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// src/modules/variables/pages/VariablesPageV2.tsx
|
|
1016
|
+
/**
|
|
1017
|
+
* Variables, redesigned (BOFF-15502, Navigation v2 / FluidGrids only).
|
|
1018
|
+
*
|
|
1019
|
+
* One compact header; two tabs (Variables, Secret stores); search, where it
|
|
1020
|
+
* applies, kind and sort, all in the address; compact rows with fixed
|
|
1021
|
+
* columns; the Templates pager. The new-variable dialog offers the kind as
|
|
1022
|
+
* three choices: a plain value, a secret, or a reference to a secret store.
|
|
1023
|
+
*
|
|
1024
|
+
* The AWS Secrets Manager settings the old page had are retired by the
|
|
1025
|
+
* service (BOFF-10856: saving them is refused, testing them always fails):
|
|
1026
|
+
* secret stores are connected in Saved values (its Providers page) and a
|
|
1027
|
+
* variable points at one with `$secrets.<store>.<name>`. The Secret stores
|
|
1028
|
+
* tab says so, links there, and lists variables still on the retired link.
|
|
1029
|
+
*/
|
|
1030
|
+
function VariablesPageV2() {
|
|
1031
|
+
const tab = useUrlListState().params.get("tab") === "stores" ? "stores" : "variables";
|
|
1032
|
+
const { overall, revision, changed } = useVariablesOverall();
|
|
1033
|
+
const { canCreate, canUpdate, canDelete, viewOnly } = useVariablesPermissions();
|
|
1034
|
+
const { dialog, openNew, openEdit, close } = useVariableDialog();
|
|
1035
|
+
return /* @__PURE__ */ jsxs(MoreToolsPage, {
|
|
1036
|
+
testId: "variables-page-v2",
|
|
1037
|
+
children: [
|
|
1038
|
+
/* @__PURE__ */ jsx(VariablesPageHeader, {
|
|
1039
|
+
overall,
|
|
1040
|
+
viewOnly,
|
|
1041
|
+
showNew: canCreate && tab === "variables",
|
|
1042
|
+
onNew: openNew
|
|
1043
|
+
}),
|
|
1044
|
+
/* @__PURE__ */ jsx(VariablesTabs, {
|
|
1045
|
+
overall,
|
|
1046
|
+
active: tab
|
|
1047
|
+
}),
|
|
1048
|
+
tab === "stores" ? /* @__PURE__ */ jsx(SecretStoresTab, {}) : /* @__PURE__ */ jsx(VariablesList, {
|
|
1049
|
+
revision,
|
|
1050
|
+
noneAtAll: !overall.loading && !overall.error && overall.total === 0,
|
|
1051
|
+
canCreate,
|
|
1052
|
+
canUpdate,
|
|
1053
|
+
canDelete,
|
|
1054
|
+
onNew: openNew,
|
|
1055
|
+
onEdit: openEdit,
|
|
1056
|
+
onChanged: changed
|
|
1057
|
+
}),
|
|
1058
|
+
dialog && /* @__PURE__ */ jsx(VariableDialogV2, {
|
|
1059
|
+
variable: dialog.variable,
|
|
1060
|
+
onClose: close,
|
|
1061
|
+
onSaved: changed
|
|
1062
|
+
}, dialog.session)
|
|
1063
|
+
]
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
const COLUMNS = "sm:grid-cols-[minmax(0,1.3fr)_minmax(0,1fr)_minmax(0,1.3fr)_6.5rem_7.5rem]";
|
|
1067
|
+
function VariablesList({ revision, noneAtAll, canCreate, canUpdate, canDelete, onNew, onEdit, onChanged }) {
|
|
1068
|
+
const tr = useTr();
|
|
1069
|
+
const state = useVariablesListState(revision, onChanged);
|
|
1070
|
+
const { projects } = useWorkflowProjects();
|
|
1071
|
+
const { error, loading, variables, refetch } = state;
|
|
1072
|
+
if (error) return /* @__PURE__ */ jsx(LoadErrorPanel, {
|
|
1073
|
+
title: tr("fluidgrids.moreTools.variables.loadErrorTitle", "Couldn't load your variables"),
|
|
1074
|
+
text: tr("fluidgrids.moreTools.variables.loadErrorText", "The workflow service did not answer. Steps that use variables keep their values."),
|
|
1075
|
+
error,
|
|
1076
|
+
onRetry: () => void refetch()
|
|
1077
|
+
});
|
|
1078
|
+
if (noneAtAll && !loading && variables.length === 0) return /* @__PURE__ */ jsx(NoVariablesYet, {
|
|
1079
|
+
canCreate,
|
|
1080
|
+
onNew
|
|
1081
|
+
});
|
|
1082
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1083
|
+
"data-tour": "fluidgrids-variables-table",
|
|
1084
|
+
children: [
|
|
1085
|
+
/* @__PURE__ */ jsx(VariablesToolbar, {
|
|
1086
|
+
filters: state.filters,
|
|
1087
|
+
list: state.list,
|
|
1088
|
+
search: state.search,
|
|
1089
|
+
onSearch: state.setSearch,
|
|
1090
|
+
loading,
|
|
1091
|
+
kinds: state.kinds,
|
|
1092
|
+
projects
|
|
1093
|
+
}),
|
|
1094
|
+
/* @__PURE__ */ jsx(VariablesBody, {
|
|
1095
|
+
state,
|
|
1096
|
+
projects,
|
|
1097
|
+
canCreate,
|
|
1098
|
+
canUpdate,
|
|
1099
|
+
canDelete,
|
|
1100
|
+
onNew,
|
|
1101
|
+
onEdit
|
|
1102
|
+
}),
|
|
1103
|
+
/* @__PURE__ */ jsx(DeleteVariableDialog, { state })
|
|
1104
|
+
]
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
function NoVariablesYet({ canCreate, onNew }) {
|
|
1108
|
+
const tr = useTr();
|
|
1109
|
+
return /* @__PURE__ */ jsx(EmptyPanel, {
|
|
1110
|
+
illustration: "variables",
|
|
1111
|
+
icon: /* @__PURE__ */ jsx(Braces, {
|
|
1112
|
+
className: "size-5 text-text-secondary",
|
|
1113
|
+
"aria-hidden": "true"
|
|
1114
|
+
}),
|
|
1115
|
+
title: tr("fluidgrids.moreTools.variables.emptyTitle", "No variables yet"),
|
|
1116
|
+
text: tr("fluidgrids.moreTools.variables.emptyText", "Keep a value once, such as an API address or a secret key, and use it in any step. Change it here and every workflow picks it up."),
|
|
1117
|
+
children: canCreate && /* @__PURE__ */ jsxs(Button$1, {
|
|
1118
|
+
onClick: onNew,
|
|
1119
|
+
"data-testid": "variables-empty-new",
|
|
1120
|
+
children: [/* @__PURE__ */ jsx(Plus, {
|
|
1121
|
+
className: "me-1.5 size-4",
|
|
1122
|
+
"aria-hidden": "true"
|
|
1123
|
+
}), tr("fluidgrids.moreTools.variables.new", "New variable")]
|
|
1124
|
+
})
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
function VariablesBody({ state, ...rest }) {
|
|
1128
|
+
const { loading, loadedOnce, filtered } = state;
|
|
1129
|
+
if (loading && !loadedOnce) return /* @__PURE__ */ jsx(ListSkeleton, { rows: 8 });
|
|
1130
|
+
if (filtered.length === 0 && !loading) return /* @__PURE__ */ jsxs(Fragment$1, { children: [state.capped && /* @__PURE__ */ jsx(CappedNote, {
|
|
1131
|
+
shown: state.variables.length,
|
|
1132
|
+
total: state.total
|
|
1133
|
+
}), /* @__PURE__ */ jsx(VariablesNoMatch, {
|
|
1134
|
+
state,
|
|
1135
|
+
...rest
|
|
1136
|
+
})] });
|
|
1137
|
+
return /* @__PURE__ */ jsx(VariablesResults, {
|
|
1138
|
+
state,
|
|
1139
|
+
...rest
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
/** The in-memory search read only the first window of the list. */
|
|
1143
|
+
function CappedNote({ shown, total }) {
|
|
1144
|
+
const tr = useTr();
|
|
1145
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1146
|
+
className: "mb-2 text-xs text-text-muted",
|
|
1147
|
+
"data-testid": "variables-capped",
|
|
1148
|
+
children: tr("fluidgrids.moreTools.variables.capped", "Searching the first {{shown}} of {{total}} variables, by key.", {
|
|
1149
|
+
shown: formatCount(shown),
|
|
1150
|
+
total: formatCount(total)
|
|
1151
|
+
})
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
function VariablesNoMatch({ state, canCreate, onNew }) {
|
|
1155
|
+
const tr = useTr();
|
|
1156
|
+
const { filters, list } = state;
|
|
1157
|
+
const filtering = filters.q !== "" || filters.applies !== "all" || filters.kind !== "all";
|
|
1158
|
+
return /* @__PURE__ */ jsxs(NoResultsPanel, {
|
|
1159
|
+
kind: filters.q ? "no-results" : "filtered",
|
|
1160
|
+
title: filters.q ? tr("fluidgrids.moreTools.variables.noMatchSearch", "No variables match “{{q}}”", { q: filters.q }) : tr("fluidgrids.moreTools.variables.noMatch", "No variables match these filters"),
|
|
1161
|
+
text: tr("fluidgrids.moreTools.variables.noMatchHint", "Keys are matched anywhere in the name, for example “key” finds STRIPE_SECRET_KEY."),
|
|
1162
|
+
children: [filtering && /* @__PURE__ */ jsx(Button$1, {
|
|
1163
|
+
variant: "outline",
|
|
1164
|
+
onClick: () => list.set({
|
|
1165
|
+
q: null,
|
|
1166
|
+
applies: null,
|
|
1167
|
+
kind: null
|
|
1168
|
+
}),
|
|
1169
|
+
"data-testid": "variables-clear-filters",
|
|
1170
|
+
children: tr("fluidgrids.moreTools.common.clearFilters", "Clear filters")
|
|
1171
|
+
}), canCreate && /* @__PURE__ */ jsx(Button$1, {
|
|
1172
|
+
onClick: onNew,
|
|
1173
|
+
children: tr("fluidgrids.moreTools.variables.new", "New variable")
|
|
1174
|
+
})]
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
function VariablesResults({ state, projects, canUpdate, canDelete, onEdit }) {
|
|
1178
|
+
const tr = useTr();
|
|
1179
|
+
const { slice, loading, capped, variables, total, list, setPendingDelete } = state;
|
|
1180
|
+
const headingRef = useRef(null);
|
|
1181
|
+
const projectName = (id) => projects.find((project) => project.id === id)?.name ?? null;
|
|
1182
|
+
const listTitle = tr("fluidgrids.moreTools.variables.listTitle", "All variables");
|
|
1183
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1184
|
+
/* @__PURE__ */ jsx(ResultsHeading, {
|
|
1185
|
+
title: listTitle,
|
|
1186
|
+
page: slice.page,
|
|
1187
|
+
total: slice.total,
|
|
1188
|
+
showRange: true,
|
|
1189
|
+
headingRef
|
|
1190
|
+
}),
|
|
1191
|
+
capped && /* @__PURE__ */ jsx(CappedNote, {
|
|
1192
|
+
shown: variables.length,
|
|
1193
|
+
total
|
|
1194
|
+
}),
|
|
1195
|
+
/* @__PURE__ */ jsx(PagedBody, {
|
|
1196
|
+
page: slice.page,
|
|
1197
|
+
pageLoading: loading,
|
|
1198
|
+
children: /* @__PURE__ */ jsx(CompactList, {
|
|
1199
|
+
label: listTitle,
|
|
1200
|
+
columns: COLUMNS,
|
|
1201
|
+
headings: [
|
|
1202
|
+
tr("fluidgrids.moreTools.variables.colKey", "Key"),
|
|
1203
|
+
tr("fluidgrids.moreTools.variables.colApplies", "Applies to"),
|
|
1204
|
+
tr("fluidgrids.moreTools.variables.colValue", "Value"),
|
|
1205
|
+
tr("fluidgrids.moreTools.variables.colChanged", "Changed"),
|
|
1206
|
+
""
|
|
1207
|
+
],
|
|
1208
|
+
testId: "variables-list",
|
|
1209
|
+
children: slice.items.map((variable) => /* @__PURE__ */ jsx(VariableRow, {
|
|
1210
|
+
variable,
|
|
1211
|
+
projectName: projectName(variable.projectId),
|
|
1212
|
+
canUpdate,
|
|
1213
|
+
canDelete,
|
|
1214
|
+
onEdit: () => onEdit(variable),
|
|
1215
|
+
onDelete: () => setPendingDelete(variable)
|
|
1216
|
+
}, variable.id))
|
|
1217
|
+
})
|
|
1218
|
+
}),
|
|
1219
|
+
/* @__PURE__ */ jsx(ResultsPager, {
|
|
1220
|
+
page: slice.page,
|
|
1221
|
+
total: slice.total,
|
|
1222
|
+
onPage: (page) => {
|
|
1223
|
+
list.setPage(page);
|
|
1224
|
+
headingRef.current?.focus({ preventScroll: true });
|
|
1225
|
+
}
|
|
1226
|
+
})
|
|
1227
|
+
] });
|
|
1228
|
+
}
|
|
1229
|
+
function DeleteVariableDialog({ state }) {
|
|
1230
|
+
const tr = useTr();
|
|
1231
|
+
const { pendingDelete, setPendingDelete, performDelete, deleting } = state;
|
|
1232
|
+
return /* @__PURE__ */ jsx(ConfirmActionDialog, {
|
|
1233
|
+
open: pendingDelete !== null,
|
|
1234
|
+
onOpenChange: (next) => {
|
|
1235
|
+
if (!next) setPendingDelete(null);
|
|
1236
|
+
},
|
|
1237
|
+
title: tr("fluidgrids.variables.deleteTitle", "Delete \"{{key}}\"?", { key: pendingDelete?.key ?? "" }),
|
|
1238
|
+
description: tr("fluidgrids.variables.deleteBody", "Workflows that use \"{{key}}\" will no longer find its value, and their runs may fail. This can't be undone.", { key: pendingDelete?.key ?? "" }),
|
|
1239
|
+
confirmLabel: tr("fluidgrids.variables.deleteConfirm", "Delete variable"),
|
|
1240
|
+
cancelLabel: tr("fluidgrids.variables.keep", "Keep variable"),
|
|
1241
|
+
destructive: true,
|
|
1242
|
+
busy: deleting,
|
|
1243
|
+
onConfirm: () => void performDelete(),
|
|
1244
|
+
"data-testid": "confirm-delete-variable"
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
function appliesText(tr, variable, projectName) {
|
|
1248
|
+
if (variable.scope === "WORKSPACE") return tr("fluidgrids.moreTools.variables.appliesWorkspace", "Whole workspace");
|
|
1249
|
+
return tr("fluidgrids.moreTools.variables.appliesProject", "Project: {{name}}", { name: projectName ?? tr("fluidgrids.moreTools.variables.unknownProject", "a project") });
|
|
1250
|
+
}
|
|
1251
|
+
function kindText(tr, kind) {
|
|
1252
|
+
switch (kind) {
|
|
1253
|
+
case "secret": return tr("fluidgrids.moreTools.variables.kindSecret", "Secret");
|
|
1254
|
+
case "store": return tr("fluidgrids.moreTools.variables.kindStore", "From a secret store");
|
|
1255
|
+
case "retired": return tr("fluidgrids.moreTools.variables.kindRetired", "Retired AWS link");
|
|
1256
|
+
default: return tr("fluidgrids.moreTools.variables.kindPlain", "Plain value");
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function VariableRow({ variable, projectName, canUpdate, canDelete, onEdit, onDelete }) {
|
|
1260
|
+
const tr = useTr();
|
|
1261
|
+
const kind = variableKind(variable);
|
|
1262
|
+
const usage = usageOf(variable.key);
|
|
1263
|
+
return /* @__PURE__ */ jsxs(CompactRow, {
|
|
1264
|
+
columns: COLUMNS,
|
|
1265
|
+
testId: `variable-row-${variable.key}`,
|
|
1266
|
+
children: [
|
|
1267
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1268
|
+
className: "min-w-0",
|
|
1269
|
+
children: [
|
|
1270
|
+
/* @__PURE__ */ jsx("code", {
|
|
1271
|
+
className: "block truncate font-mono text-sm font-semibold text-text-primary",
|
|
1272
|
+
children: variable.key
|
|
1273
|
+
}),
|
|
1274
|
+
/* @__PURE__ */ jsx("p", {
|
|
1275
|
+
className: "truncate text-xs text-text-muted",
|
|
1276
|
+
children: variable.description || tr("fluidgrids.moreTools.variables.noDescription", "No description")
|
|
1277
|
+
}),
|
|
1278
|
+
/* @__PURE__ */ jsxs(RowSummary, { children: [
|
|
1279
|
+
/* @__PURE__ */ jsx("span", { children: appliesText(tr, variable, projectName) }),
|
|
1280
|
+
/* @__PURE__ */ jsx("span", {
|
|
1281
|
+
"aria-hidden": "true",
|
|
1282
|
+
children: "·"
|
|
1283
|
+
}),
|
|
1284
|
+
/* @__PURE__ */ jsx("span", { children: kindText(tr, kind) })
|
|
1285
|
+
] })
|
|
1286
|
+
]
|
|
1287
|
+
}),
|
|
1288
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1289
|
+
className: "flex min-w-0 items-center gap-1.5 text-sm text-text-secondary max-sm:hidden",
|
|
1290
|
+
children: [variable.scope === "WORKSPACE" ? /* @__PURE__ */ jsx(Users, {
|
|
1291
|
+
className: "size-3.5 shrink-0",
|
|
1292
|
+
"aria-hidden": "true"
|
|
1293
|
+
}) : /* @__PURE__ */ jsx(FolderClosed, {
|
|
1294
|
+
className: "size-3.5 shrink-0",
|
|
1295
|
+
"aria-hidden": "true"
|
|
1296
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1297
|
+
className: "truncate",
|
|
1298
|
+
children: appliesText(tr, variable, projectName)
|
|
1299
|
+
})]
|
|
1300
|
+
}),
|
|
1301
|
+
/* @__PURE__ */ jsx("div", {
|
|
1302
|
+
className: "min-w-0 max-sm:hidden",
|
|
1303
|
+
children: /* @__PURE__ */ jsx(VariableValue, { variable })
|
|
1304
|
+
}),
|
|
1305
|
+
/* @__PURE__ */ jsx("div", {
|
|
1306
|
+
className: "text-sm tabular-nums text-text-secondary max-sm:hidden",
|
|
1307
|
+
title: formatExactTime(variable.updatedAt),
|
|
1308
|
+
children: formatRelativeTime(tr, variable.updatedAt)
|
|
1309
|
+
}),
|
|
1310
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1311
|
+
className: "flex items-center justify-end gap-0.5",
|
|
1312
|
+
children: [
|
|
1313
|
+
/* @__PURE__ */ jsx(CopyButton, {
|
|
1314
|
+
value: usage,
|
|
1315
|
+
what: tr("fluidgrids.moreTools.variables.copyUsageWhat", "how to use {{key}}", { key: variable.key }),
|
|
1316
|
+
iconOnly: true,
|
|
1317
|
+
"data-testid": `variable-copy-${variable.key}`
|
|
1318
|
+
}),
|
|
1319
|
+
canUpdate && /* @__PURE__ */ jsx("button", {
|
|
1320
|
+
type: "button",
|
|
1321
|
+
onClick: onEdit,
|
|
1322
|
+
"aria-label": tr("fluidgrids.variables.editNamed", "Edit {{key}}", { key: variable.key }),
|
|
1323
|
+
title: tr("fluidgrids.variables.edit", "Edit"),
|
|
1324
|
+
className: cn("inline-flex size-8 items-center justify-center rounded-lg text-text-secondary hover:bg-surface-hover hover:text-text-primary", "outline-none focus-visible:ring-2 focus-visible:ring-accent-glow"),
|
|
1325
|
+
"data-testid": `variable-edit-${variable.key}`,
|
|
1326
|
+
children: /* @__PURE__ */ jsx(Pencil, {
|
|
1327
|
+
className: "size-4",
|
|
1328
|
+
"aria-hidden": "true"
|
|
1329
|
+
})
|
|
1330
|
+
}),
|
|
1331
|
+
/* @__PURE__ */ jsx(RowMenu, {
|
|
1332
|
+
label: tr("fluidgrids.moreTools.variables.moreFor", "More for {{key}}", { key: variable.key }),
|
|
1333
|
+
testId: `variable-menu-${variable.key}`,
|
|
1334
|
+
items: [
|
|
1335
|
+
...canUpdate ? [{
|
|
1336
|
+
id: "edit",
|
|
1337
|
+
label: tr("fluidgrids.variables.edit", "Edit"),
|
|
1338
|
+
icon: /* @__PURE__ */ jsx(Pencil, {
|
|
1339
|
+
className: "size-4",
|
|
1340
|
+
"aria-hidden": "true"
|
|
1341
|
+
}),
|
|
1342
|
+
onSelect: onEdit
|
|
1343
|
+
}] : [],
|
|
1344
|
+
{
|
|
1345
|
+
id: "copy",
|
|
1346
|
+
label: tr("fluidgrids.moreTools.variables.copyUsage", "Copy {{usage}}", { usage }),
|
|
1347
|
+
icon: /* @__PURE__ */ jsx(Braces, {
|
|
1348
|
+
className: "size-4",
|
|
1349
|
+
"aria-hidden": "true"
|
|
1350
|
+
}),
|
|
1351
|
+
onSelect: () => {
|
|
1352
|
+
copyText(usage).then((copied) => copied ? toast.success(tr("fluidgrids.moreTools.common.copied", "Copied")) : toast.error(tr("fluidgrids.moreTools.common.copyFailed", "Couldn't copy. Select the text and copy it yourself.")));
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
...canDelete ? [{
|
|
1356
|
+
id: "delete",
|
|
1357
|
+
label: tr("fluidgrids.moreTools.variables.deleteItem", "Delete…"),
|
|
1358
|
+
icon: /* @__PURE__ */ jsx(Trash2, {
|
|
1359
|
+
className: "size-4",
|
|
1360
|
+
"aria-hidden": "true"
|
|
1361
|
+
}),
|
|
1362
|
+
onSelect: onDelete,
|
|
1363
|
+
danger: true,
|
|
1364
|
+
separatorBefore: true
|
|
1365
|
+
}] : []
|
|
1366
|
+
]
|
|
1367
|
+
})
|
|
1368
|
+
]
|
|
1369
|
+
})
|
|
1370
|
+
]
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* The value cell: a plain value in mono; a secret masked with Reveal (it
|
|
1375
|
+
* masks itself again after 15 s, and when the row goes away); a store
|
|
1376
|
+
* reference with its reference; a retired AWS link flagged in yellow.
|
|
1377
|
+
*/
|
|
1378
|
+
function VariableValue({ variable }) {
|
|
1379
|
+
const tr = useTr();
|
|
1380
|
+
const canReveal = useFluidGridsPermission(FLUIDGRIDS_PERMISSIONS.VARIABLE_REVEAL).allowed;
|
|
1381
|
+
const { revealValue, loading } = useRevealVariableValue();
|
|
1382
|
+
const [revealed, setRevealed] = useState(null);
|
|
1383
|
+
const timer = useRef(null);
|
|
1384
|
+
const clearTimer = useCallback(() => {
|
|
1385
|
+
if (timer.current !== null) clearTimeout(timer.current);
|
|
1386
|
+
timer.current = null;
|
|
1387
|
+
}, []);
|
|
1388
|
+
useEffect(() => clearTimer, [clearTimer]);
|
|
1389
|
+
const hide = useCallback(() => {
|
|
1390
|
+
clearTimer();
|
|
1391
|
+
setRevealed(null);
|
|
1392
|
+
}, [clearTimer]);
|
|
1393
|
+
const reveal = useCallback(async () => {
|
|
1394
|
+
try {
|
|
1395
|
+
const value = await revealValue(variable.id);
|
|
1396
|
+
setRevealed(value);
|
|
1397
|
+
clearTimer();
|
|
1398
|
+
timer.current = setTimeout(() => {
|
|
1399
|
+
timer.current = null;
|
|
1400
|
+
setRevealed(null);
|
|
1401
|
+
}, REVEAL_FOR_MS);
|
|
1402
|
+
} catch (err) {
|
|
1403
|
+
toast.error(describeOperationError(err, tr("fluidgrids.variables.revealFailed", "Failed to reveal value")));
|
|
1404
|
+
}
|
|
1405
|
+
}, [
|
|
1406
|
+
revealValue,
|
|
1407
|
+
variable.id,
|
|
1408
|
+
clearTimer,
|
|
1409
|
+
tr
|
|
1410
|
+
]);
|
|
1411
|
+
const kind = variableKind(variable);
|
|
1412
|
+
if (kind === "plain") return /* @__PURE__ */ jsx("code", {
|
|
1413
|
+
className: "block truncate font-mono text-[13px] text-text-primary",
|
|
1414
|
+
title: variable.value ?? "",
|
|
1415
|
+
children: variable.value ?? ""
|
|
1416
|
+
});
|
|
1417
|
+
if (revealed !== null) return /* @__PURE__ */ jsxs("span", {
|
|
1418
|
+
className: "flex min-w-0 items-center gap-2",
|
|
1419
|
+
"data-testid": `variable-revealed-${variable.key}`,
|
|
1420
|
+
children: [
|
|
1421
|
+
/* @__PURE__ */ jsx("code", {
|
|
1422
|
+
className: "min-w-0 truncate font-mono text-[13px] text-text-primary",
|
|
1423
|
+
title: revealed,
|
|
1424
|
+
children: revealed
|
|
1425
|
+
}),
|
|
1426
|
+
/* @__PURE__ */ jsxs("button", {
|
|
1427
|
+
type: "button",
|
|
1428
|
+
onClick: hide,
|
|
1429
|
+
className: cn("inline-flex shrink-0 items-center gap-1 rounded text-xs text-text-secondary hover:text-text-primary", CONTROL_RING),
|
|
1430
|
+
children: [/* @__PURE__ */ jsx(EyeOff, {
|
|
1431
|
+
className: "size-3.5",
|
|
1432
|
+
"aria-hidden": "true"
|
|
1433
|
+
}), tr("fluidgrids.variables.hide", "Hide")]
|
|
1434
|
+
}),
|
|
1435
|
+
/* @__PURE__ */ jsx("span", {
|
|
1436
|
+
className: "shrink-0 text-xs text-text-muted max-lg:hidden",
|
|
1437
|
+
children: tr("fluidgrids.moreTools.variables.hidesAgain", "Hides again in 15 s")
|
|
1438
|
+
})
|
|
1439
|
+
]
|
|
1440
|
+
});
|
|
1441
|
+
const revealButton = canReveal ? /* @__PURE__ */ jsxs("button", {
|
|
1442
|
+
type: "button",
|
|
1443
|
+
onClick: () => void reveal(),
|
|
1444
|
+
disabled: loading,
|
|
1445
|
+
className: cn("inline-flex shrink-0 items-center gap-1 rounded text-xs text-text-secondary hover:text-text-primary disabled:opacity-60", CONTROL_RING),
|
|
1446
|
+
"data-testid": `variable-reveal-${variable.key}`,
|
|
1447
|
+
children: [/* @__PURE__ */ jsx(Eye, {
|
|
1448
|
+
className: "size-3.5",
|
|
1449
|
+
"aria-hidden": "true"
|
|
1450
|
+
}), loading ? tr("fluidgrids.variables.revealing", "Revealing…") : tr("fluidgrids.variables.reveal", "Reveal")]
|
|
1451
|
+
}) : null;
|
|
1452
|
+
if (kind === "store" || kind === "retired") return /* @__PURE__ */ jsxs("span", {
|
|
1453
|
+
className: "flex min-w-0 items-center gap-2",
|
|
1454
|
+
children: [
|
|
1455
|
+
kind === "retired" ? /* @__PURE__ */ jsx(Status, {
|
|
1456
|
+
tone: "warning",
|
|
1457
|
+
children: tr("fluidgrids.moreTools.variables.kindRetired", "Retired AWS link")
|
|
1458
|
+
}) : /* @__PURE__ */ jsx(KeyRound, {
|
|
1459
|
+
className: "size-3.5 shrink-0 text-text-muted",
|
|
1460
|
+
"aria-hidden": "true"
|
|
1461
|
+
}),
|
|
1462
|
+
/* @__PURE__ */ jsx("code", {
|
|
1463
|
+
className: "min-w-0 truncate font-mono text-[13px] text-text-secondary",
|
|
1464
|
+
title: variable.externalRef ?? "",
|
|
1465
|
+
children: variable.externalRef ?? ""
|
|
1466
|
+
}),
|
|
1467
|
+
revealButton
|
|
1468
|
+
]
|
|
1469
|
+
});
|
|
1470
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1471
|
+
className: "flex items-center gap-2",
|
|
1472
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1473
|
+
className: "select-none tracking-widest text-text-secondary",
|
|
1474
|
+
"aria-label": tr("fluidgrids.moreTools.variables.hiddenSecret", "Hidden secret"),
|
|
1475
|
+
children: "••••••••"
|
|
1476
|
+
}), revealButton]
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
/** Where secret stores are connected (FluidGrids mounts Security at /security). */
|
|
1480
|
+
function SecretStoresTab() {
|
|
1481
|
+
const tr = useTr();
|
|
1482
|
+
const { variables, loading, error, refetch } = useEveryVariable();
|
|
1483
|
+
const kinds = countBy(variables, variableKind);
|
|
1484
|
+
const retired = kinds.retired ?? 0;
|
|
1485
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1486
|
+
className: "max-w-3xl space-y-4",
|
|
1487
|
+
"data-testid": "variables-stores",
|
|
1488
|
+
children: [
|
|
1489
|
+
/* @__PURE__ */ jsx(Panel, {
|
|
1490
|
+
title: tr("fluidgrids.moreTools.variables.storesTitle", "Secret stores"),
|
|
1491
|
+
testId: "variables-stores-panel",
|
|
1492
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1493
|
+
className: "space-y-3 text-sm text-text-secondary",
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ jsx("p", { children: tr("fluidgrids.moreTools.variables.storesBody", "A variable can read its value from a secret store your workspace connects, such as AWS Secrets Manager or HashiCorp Vault, instead of keeping its own copy. Stores are connected once, in Saved values (Workspace & account › Workspace › More).") }),
|
|
1496
|
+
/* @__PURE__ */ jsx("p", { children: tr("fluidgrids.moreTools.variables.storesHow", "Then pick “From a secret store” when you create a variable and enter the secret's reference, for example {{example}}.", { example: "$secrets.aws.stripe_key" }) }),
|
|
1497
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1498
|
+
className: "flex flex-wrap items-center gap-3 pt-1",
|
|
1499
|
+
children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1500
|
+
asChild: true,
|
|
1501
|
+
variant: "outline",
|
|
1502
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
1503
|
+
to: VAULT_INTEGRATIONS_PATH,
|
|
1504
|
+
"data-testid": "variables-open-vault",
|
|
1505
|
+
children: tr("fluidgrids.moreTools.variables.openVault", "Open Saved values")
|
|
1506
|
+
})
|
|
1507
|
+
}), !loading && !error && /* @__PURE__ */ jsx("span", {
|
|
1508
|
+
className: "text-sm tabular-nums",
|
|
1509
|
+
"data-testid": "variables-store-count",
|
|
1510
|
+
children: tr("fluidgrids.moreTools.variables.storeCount", "{{count}} variables read from a secret store", { count: formatCount(kinds.store ?? 0) })
|
|
1511
|
+
})]
|
|
1512
|
+
})
|
|
1513
|
+
]
|
|
1514
|
+
})
|
|
1515
|
+
}),
|
|
1516
|
+
error && /* @__PURE__ */ jsx(LoadErrorPanel, {
|
|
1517
|
+
size: "panel",
|
|
1518
|
+
title: tr("fluidgrids.moreTools.variables.loadErrorTitle", "Couldn't load your variables"),
|
|
1519
|
+
text: tr("fluidgrids.moreTools.variables.loadErrorText", "The workflow service did not answer. Steps that use variables keep their values."),
|
|
1520
|
+
error,
|
|
1521
|
+
onRetry: () => void refetch()
|
|
1522
|
+
}),
|
|
1523
|
+
!error && retired > 0 && /* @__PURE__ */ jsx(ToneAlert, {
|
|
1524
|
+
tone: "warning",
|
|
1525
|
+
title: tr("fluidgrids.moreTools.variables.retiredTitle", "{{count}} variables still use the retired AWS Secrets Manager link", { count: formatCount(retired) }),
|
|
1526
|
+
actions: /* @__PURE__ */ jsx(Button$1, {
|
|
1527
|
+
asChild: true,
|
|
1528
|
+
variant: "outline",
|
|
1529
|
+
size: "sm",
|
|
1530
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
1531
|
+
to: "?kind=retired",
|
|
1532
|
+
"data-testid": "variables-show-retired",
|
|
1533
|
+
children: tr("fluidgrids.moreTools.variables.showRetired", "Show them")
|
|
1534
|
+
})
|
|
1535
|
+
}),
|
|
1536
|
+
testId: "variables-retired-alert",
|
|
1537
|
+
children: tr("fluidgrids.moreTools.variables.retiredBody", "That link was replaced by secret stores. Edit each one and point it at a secret store, or type its value instead.")
|
|
1538
|
+
})
|
|
1539
|
+
]
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
// src/modules/variables/pages/VariablesPage.tsx
|
|
1544
|
+
/**
|
|
1545
|
+
* Variables Page (BOFF-7517)
|
|
1546
|
+
*
|
|
1547
|
+
* Workspace/project-scoped `$vars` key-value store management: list/create/
|
|
1548
|
+
* edit/delete variables and mask secret values (dots + explicit "Reveal"
|
|
1549
|
+
* action). A variable's value is typed in, or comes from a platform secret
|
|
1550
|
+
* (BOFF-10856): a `$secrets.<provider>.<name>[.<field>]` reference to a
|
|
1551
|
+
* secret manager connected in Security > Vault integrations, which replaced
|
|
1552
|
+
* the per-workspace external secrets provider settings this page used to have.
|
|
1553
|
+
*/
|
|
1554
|
+
var VariablesPage_exports = /* @__PURE__ */ __exportAll({ VariablesPage: () => VariablesPage });
|
|
1555
|
+
/** A provider's name as people read it; a retired one says so. */
|
|
1556
|
+
function useProviderLabel() {
|
|
1557
|
+
const tr = useTr();
|
|
1558
|
+
return useCallback((provider) => {
|
|
1559
|
+
if (provider === "SECRET_REFERENCE") return tr("fluidgrids.variables.sourcePlatformSecret", "Platform secret");
|
|
1560
|
+
if (provider === "NONE") return tr("fluidgrids.variables.sourceTyped", "Typed in here");
|
|
1561
|
+
return tr("fluidgrids.variables.sourceRetired", "{{provider}} (retired)", { provider: retiredProviderName(provider) });
|
|
1562
|
+
}, [tr]);
|
|
1563
|
+
}
|
|
1564
|
+
function VariableValueCell({ variable }) {
|
|
1565
|
+
const tr = useTr();
|
|
1566
|
+
const providerLabel = useProviderLabel();
|
|
1567
|
+
const { revealValue, loading } = useRevealVariableValue();
|
|
1568
|
+
const [revealed, setRevealed] = useState(null);
|
|
1569
|
+
const [revealError, setRevealError] = useState(null);
|
|
1570
|
+
const remaskTimer = useRef(null);
|
|
1571
|
+
const clearRemaskTimer = useCallback(() => {
|
|
1572
|
+
if (remaskTimer.current !== null) clearTimeout(remaskTimer.current);
|
|
1573
|
+
remaskTimer.current = null;
|
|
1574
|
+
}, []);
|
|
1575
|
+
useEffect(() => clearRemaskTimer, [clearRemaskTimer]);
|
|
1576
|
+
const isMasked = variable.isSecret || variable.externalProvider !== "NONE";
|
|
1577
|
+
const hide = useCallback(() => {
|
|
1578
|
+
clearRemaskTimer();
|
|
1579
|
+
setRevealed(null);
|
|
1580
|
+
}, [clearRemaskTimer]);
|
|
1581
|
+
const handleReveal = useCallback(async () => {
|
|
1582
|
+
setRevealError(null);
|
|
1583
|
+
try {
|
|
1584
|
+
const value = await revealValue(variable.id);
|
|
1585
|
+
setRevealed(value);
|
|
1586
|
+
clearRemaskTimer();
|
|
1587
|
+
remaskTimer.current = setTimeout(() => {
|
|
1588
|
+
remaskTimer.current = null;
|
|
1589
|
+
setRevealed(null);
|
|
1590
|
+
}, REVEAL_FOR_MS);
|
|
1591
|
+
} catch (err) {
|
|
1592
|
+
const message = describeOperationError(err, tr("fluidgrids.variables.revealFailed", "Failed to reveal value"));
|
|
1593
|
+
setRevealError(message);
|
|
1594
|
+
toast.error(message);
|
|
1595
|
+
}
|
|
1596
|
+
}, [
|
|
1597
|
+
revealValue,
|
|
1598
|
+
variable.id,
|
|
1599
|
+
tr,
|
|
1600
|
+
clearRemaskTimer
|
|
1601
|
+
]);
|
|
1602
|
+
const errorLine = revealError && /* @__PURE__ */ jsx("p", {
|
|
1603
|
+
role: "alert",
|
|
1604
|
+
className: "text-xs text-status-error-text mt-1 break-words",
|
|
1605
|
+
"data-testid": "variable-reveal-error",
|
|
1606
|
+
children: revealError
|
|
1607
|
+
});
|
|
1608
|
+
if (variable.externalProvider !== "NONE" && revealed === null) return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
1609
|
+
className: "flex items-center gap-2",
|
|
1610
|
+
children: [
|
|
1611
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
1612
|
+
variant: "outline",
|
|
1613
|
+
className: "text-xs",
|
|
1614
|
+
"data-testid": "variable-source-badge",
|
|
1615
|
+
children: providerLabel(variable.externalProvider)
|
|
1616
|
+
}),
|
|
1617
|
+
variable.externalRef && /* @__PURE__ */ jsx("span", {
|
|
1618
|
+
className: "text-xs text-text-secondary truncate max-w-[160px]",
|
|
1619
|
+
title: variable.externalRef,
|
|
1620
|
+
children: variable.externalRef
|
|
1621
|
+
}),
|
|
1622
|
+
/* @__PURE__ */ jsx("button", {
|
|
1623
|
+
type: "button",
|
|
1624
|
+
onClick: handleReveal,
|
|
1625
|
+
disabled: loading,
|
|
1626
|
+
className: "text-xs text-text-secondary hover:text-text-primary underline",
|
|
1627
|
+
children: loading ? tr("fluidgrids.variables.revealing", "Revealing…") : tr("fluidgrids.variables.reveal", "Reveal")
|
|
1628
|
+
})
|
|
1629
|
+
]
|
|
1630
|
+
}), errorLine] });
|
|
1631
|
+
if (!isMasked) return /* @__PURE__ */ jsx("code", {
|
|
1632
|
+
className: "text-sm text-text-primary",
|
|
1633
|
+
children: variable.value ?? ""
|
|
1634
|
+
});
|
|
1635
|
+
if (revealed !== null) return /* @__PURE__ */ jsxs("div", {
|
|
1636
|
+
className: "flex items-center gap-2",
|
|
1637
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
1638
|
+
className: "text-sm text-text-primary break-all",
|
|
1639
|
+
children: revealed
|
|
1640
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1641
|
+
type: "button",
|
|
1642
|
+
onClick: hide,
|
|
1643
|
+
className: "text-xs text-text-secondary hover:text-text-primary underline shrink-0",
|
|
1644
|
+
children: tr("fluidgrids.variables.hide", "Hide")
|
|
1645
|
+
})]
|
|
1646
|
+
});
|
|
1647
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
1648
|
+
className: "flex items-center gap-2",
|
|
1649
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1650
|
+
className: "tracking-widest text-text-secondary select-none",
|
|
1651
|
+
children: "••••••••"
|
|
1652
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1653
|
+
type: "button",
|
|
1654
|
+
onClick: handleReveal,
|
|
1655
|
+
disabled: loading,
|
|
1656
|
+
className: "text-xs text-text-secondary hover:text-text-primary underline",
|
|
1657
|
+
children: loading ? tr("fluidgrids.variables.revealing", "Revealing…") : tr("fluidgrids.variables.reveal", "Reveal")
|
|
1658
|
+
})]
|
|
1659
|
+
}), errorLine] });
|
|
1660
|
+
}
|
|
1661
|
+
/** A tab's data could not be read: say so, and offer to try again. */
|
|
1662
|
+
function LoadErrorAlert({ title, error, onRetry }) {
|
|
1663
|
+
const tr = useTr();
|
|
1664
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1665
|
+
role: "alert",
|
|
1666
|
+
className: "mb-4 rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
|
|
1667
|
+
children: [
|
|
1668
|
+
/* @__PURE__ */ jsx("p", {
|
|
1669
|
+
className: "font-medium",
|
|
1670
|
+
children: title
|
|
1671
|
+
}),
|
|
1672
|
+
/* @__PURE__ */ jsx("p", {
|
|
1673
|
+
className: "mt-1",
|
|
1674
|
+
children: describeOperationError(error)
|
|
1675
|
+
}),
|
|
1676
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
1677
|
+
variant: "outline",
|
|
1678
|
+
size: "sm",
|
|
1679
|
+
className: "mt-3",
|
|
1680
|
+
onClick: onRetry,
|
|
1681
|
+
children: tr("fluidgrids.variables.retryLoad", "Try again")
|
|
1682
|
+
})
|
|
1683
|
+
]
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
function isVariableScope(value) {
|
|
1687
|
+
return value === "WORKSPACE" || value === "PROJECT";
|
|
1688
|
+
}
|
|
1689
|
+
/** "Vault integrations": where the workspace's secret managers are connected. */
|
|
1690
|
+
function VaultIntegrationsLink({ testId, onNavigate }) {
|
|
1691
|
+
const tr = useTr();
|
|
1692
|
+
const navigate = useNavigate();
|
|
1693
|
+
return /* @__PURE__ */ jsxs(Button$1, {
|
|
1694
|
+
variant: "outline",
|
|
1695
|
+
size: "sm",
|
|
1696
|
+
"data-testid": testId,
|
|
1697
|
+
onClick: () => {
|
|
1698
|
+
onNavigate?.();
|
|
1699
|
+
navigate(VAULT_INTEGRATIONS_PATH);
|
|
1700
|
+
},
|
|
1701
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1702
|
+
icon: "mdi:shield-key-outline",
|
|
1703
|
+
className: "mr-1.5",
|
|
1704
|
+
width: 16
|
|
1705
|
+
}), tr("fluidgrids.variables.openVaultIntegrations", "Open Vault integrations")]
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Where the value comes from: typed in here, or a platform secret, a
|
|
1710
|
+
* `$secrets.<provider>.<name>[.<field>]` reference to a secret manager
|
|
1711
|
+
* connected in Security > Vault integrations (BOFF-10856). A variable that
|
|
1712
|
+
* still reads from a retired provider shows it, read only, until it is moved.
|
|
1713
|
+
* Navigation v2 has its own dialog (VariableDialogV2) with the same choice.
|
|
1714
|
+
*/
|
|
1715
|
+
function ValueSourceFields({ variable, source, externalRef, onSourceChange, onExternalRefChange, onLeave }) {
|
|
1716
|
+
const tr = useTr();
|
|
1717
|
+
const providerLabel = useProviderLabel();
|
|
1718
|
+
const retired = isRetiredProvider(source);
|
|
1719
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1720
|
+
className: "space-y-3 rounded-md border border-border-default p-3",
|
|
1721
|
+
"data-testid": "variable-value-source",
|
|
1722
|
+
children: [
|
|
1723
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1724
|
+
className: "space-y-1.5",
|
|
1725
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1726
|
+
htmlFor: "variable-source",
|
|
1727
|
+
children: tr("fluidgrids.variables.sourceLabel", "Where the value comes from")
|
|
1728
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
1729
|
+
value: source,
|
|
1730
|
+
onValueChange: (next) => {
|
|
1731
|
+
if (isOfferedValueSource(next, variable)) onSourceChange(next);
|
|
1732
|
+
},
|
|
1733
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1734
|
+
id: "variable-source",
|
|
1735
|
+
"data-testid": "variable-source",
|
|
1736
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
1737
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: valueSourceOptions(variable).map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1738
|
+
value: option,
|
|
1739
|
+
children: providerLabel(option)
|
|
1740
|
+
}, option)) })]
|
|
1741
|
+
})]
|
|
1742
|
+
}),
|
|
1743
|
+
source === "SECRET_REFERENCE" && /* @__PURE__ */ jsxs("div", {
|
|
1744
|
+
className: "space-y-1.5",
|
|
1745
|
+
"data-testid": "variable-secret-reference",
|
|
1746
|
+
children: [
|
|
1747
|
+
/* @__PURE__ */ jsx(Label, {
|
|
1748
|
+
htmlFor: "variable-external-ref",
|
|
1749
|
+
children: tr("fluidgrids.variables.secretReferenceLabel", "Secret reference")
|
|
1750
|
+
}),
|
|
1751
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1752
|
+
id: "variable-external-ref",
|
|
1753
|
+
"data-testid": "variable-external-ref",
|
|
1754
|
+
value: externalRef,
|
|
1755
|
+
onChange: (e) => onExternalRefChange(e.target.value),
|
|
1756
|
+
placeholder: "$secrets.my_vault.stripe_key",
|
|
1757
|
+
spellCheck: false,
|
|
1758
|
+
autoComplete: "off",
|
|
1759
|
+
className: "font-mono",
|
|
1760
|
+
"aria-required": true,
|
|
1761
|
+
"aria-describedby": "variable-external-ref-hint"
|
|
1762
|
+
}),
|
|
1763
|
+
/* @__PURE__ */ jsx("p", {
|
|
1764
|
+
id: "variable-external-ref-hint",
|
|
1765
|
+
className: "text-xs text-text-secondary",
|
|
1766
|
+
children: tr("fluidgrids.variables.secretReferenceHint", "Write it as {{pattern}}. The provider is the reference key of a secret manager connected in Security > Vault integrations.", { pattern: "$secrets.<provider>.<name>[.<field>]" })
|
|
1767
|
+
}),
|
|
1768
|
+
/* @__PURE__ */ jsx(VaultIntegrationsLink, {
|
|
1769
|
+
testId: "variable-open-vault-integrations",
|
|
1770
|
+
onNavigate: onLeave
|
|
1771
|
+
})
|
|
1772
|
+
]
|
|
1773
|
+
}),
|
|
1774
|
+
retired && /* @__PURE__ */ jsxs("div", {
|
|
1775
|
+
className: "space-y-1.5",
|
|
1776
|
+
"data-testid": "variable-retired-provider",
|
|
1777
|
+
children: [
|
|
1778
|
+
/* @__PURE__ */ jsx(Label, {
|
|
1779
|
+
htmlFor: "variable-external-ref",
|
|
1780
|
+
children: tr("fluidgrids.variables.secretNameLabel", "Secret name")
|
|
1781
|
+
}),
|
|
1782
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1783
|
+
id: "variable-external-ref",
|
|
1784
|
+
value: externalRef,
|
|
1785
|
+
readOnly: true,
|
|
1786
|
+
className: "font-mono"
|
|
1787
|
+
}),
|
|
1788
|
+
/* @__PURE__ */ jsx("p", {
|
|
1789
|
+
className: "text-xs text-text-secondary",
|
|
1790
|
+
children: tr("fluidgrids.variables.retiredProviderHint", "{{provider}} is retired. Move this value to a platform secret, or type it in here.", { provider: retiredProviderName(source) })
|
|
1791
|
+
})
|
|
1792
|
+
]
|
|
1793
|
+
})
|
|
1794
|
+
]
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
/** The key: fixed after create. */
|
|
1798
|
+
function KeyField({ value, onChange, isEdit }) {
|
|
1799
|
+
const tr = useTr();
|
|
1800
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1801
|
+
className: "space-y-1.5",
|
|
1802
|
+
children: [
|
|
1803
|
+
/* @__PURE__ */ jsx(Label, {
|
|
1804
|
+
htmlFor: "variable-key",
|
|
1805
|
+
children: tr("fluidgrids.variables.keyLabel", "Key")
|
|
1806
|
+
}),
|
|
1807
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1808
|
+
id: "variable-key",
|
|
1809
|
+
value,
|
|
1810
|
+
onChange: (e) => onChange(e.target.value),
|
|
1811
|
+
disabled: isEdit,
|
|
1812
|
+
placeholder: "API_URL"
|
|
1813
|
+
}),
|
|
1814
|
+
/* @__PURE__ */ jsx("p", {
|
|
1815
|
+
className: "text-xs text-text-secondary",
|
|
1816
|
+
children: tr("fluidgrids.variables.keyHint", "Use it in expressions as {{ $vars.KEY }} or ${vars.KEY}")
|
|
1817
|
+
})
|
|
1818
|
+
]
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
/** Workspace or Project (create only). */
|
|
1822
|
+
function ScopeField({ value, onChange }) {
|
|
1823
|
+
const tr = useTr();
|
|
1824
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1825
|
+
className: "space-y-1.5",
|
|
1826
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1827
|
+
htmlFor: "variable-scope",
|
|
1828
|
+
children: tr("fluidgrids.variables.scopeLabel", "Scope")
|
|
1829
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
1830
|
+
value,
|
|
1831
|
+
onValueChange: (next) => {
|
|
1832
|
+
if (isVariableScope(next)) onChange(next);
|
|
1833
|
+
},
|
|
1834
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1835
|
+
id: "variable-scope",
|
|
1836
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
1837
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
1838
|
+
value: "WORKSPACE",
|
|
1839
|
+
children: tr("fluidgrids.variables.scopeWorkspace", "Workspace")
|
|
1840
|
+
}), /* @__PURE__ */ jsx(SelectItem, {
|
|
1841
|
+
value: "PROJECT",
|
|
1842
|
+
children: tr("fluidgrids.variables.scopeProject", "Project")
|
|
1843
|
+
})] })]
|
|
1844
|
+
})]
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Description and the secret switch. A platform secret is always secret, so
|
|
1849
|
+
* the switch is locked on for one (BOFF-10856).
|
|
1850
|
+
*/
|
|
1851
|
+
function DescriptionAndSecretFields({ form, update }) {
|
|
1852
|
+
const tr = useTr();
|
|
1853
|
+
const locked = form.source === "SECRET_REFERENCE";
|
|
1854
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1855
|
+
className: "space-y-1.5",
|
|
1856
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1857
|
+
htmlFor: "variable-description",
|
|
1858
|
+
children: tr("fluidgrids.variables.descriptionLabel", "Description")
|
|
1859
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
1860
|
+
id: "variable-description",
|
|
1861
|
+
value: form.description,
|
|
1862
|
+
onChange: (e) => update("description", e.target.value),
|
|
1863
|
+
placeholder: tr("fluidgrids.variables.descriptionPlaceholder", "Optional")
|
|
1864
|
+
})]
|
|
1865
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1866
|
+
className: "flex items-center justify-between py-1",
|
|
1867
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
|
|
1868
|
+
htmlFor: "variable-secret",
|
|
1869
|
+
children: tr("fluidgrids.variables.secretLabel", "Secret value")
|
|
1870
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1871
|
+
className: "text-xs text-text-secondary",
|
|
1872
|
+
children: locked ? tr("fluidgrids.variables.secretLockedHint", "A platform secret is always secret: masked in the UI and never printed to run logs") : tr("fluidgrids.variables.secretHint", "Masked in the UI and never printed to run logs")
|
|
1873
|
+
})] }), /* @__PURE__ */ jsx(Switch, {
|
|
1874
|
+
id: "variable-secret",
|
|
1875
|
+
"data-testid": "variable-secret-switch",
|
|
1876
|
+
checked: effectiveIsSecret(form),
|
|
1877
|
+
disabled: locked,
|
|
1878
|
+
onCheckedChange: (checked) => update("isSecret", checked)
|
|
1879
|
+
})]
|
|
1880
|
+
})] });
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* The value, typed in here. When the value comes from outside, a note in its
|
|
1884
|
+
* place says where it is read from: a platform secret has no value field.
|
|
1885
|
+
*/
|
|
1886
|
+
function ValueField({ form, update, variable }) {
|
|
1887
|
+
const tr = useTr();
|
|
1888
|
+
if (form.source !== "NONE") return /* @__PURE__ */ jsx("p", {
|
|
1889
|
+
className: "text-xs text-text-secondary",
|
|
1890
|
+
"data-testid": "variable-value-from-provider",
|
|
1891
|
+
children: form.source === "SECRET_REFERENCE" ? tr("fluidgrids.variables.valueFromPlatformSecret", "The value is read from the platform secret each time a run needs it. It is never stored here.") : tr("fluidgrids.variables.valueFromRetiredProvider", "The value is read from {{provider}} each time a run needs it.", { provider: retiredProviderName(form.source) })
|
|
1892
|
+
});
|
|
1893
|
+
const keepsCurrent = !!variable && !isExternallyBacked(variable);
|
|
1894
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1895
|
+
className: "space-y-1.5",
|
|
1896
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
1897
|
+
htmlFor: "variable-value",
|
|
1898
|
+
children: tr("fluidgrids.variables.valueLabel", "Value")
|
|
1899
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
1900
|
+
id: "variable-value",
|
|
1901
|
+
type: form.isSecret ? "password" : "text",
|
|
1902
|
+
value: form.value,
|
|
1903
|
+
onChange: (e) => update("value", e.target.value),
|
|
1904
|
+
placeholder: keepsCurrent ? tr("fluidgrids.variables.valueLeaveBlank", "Leave blank to keep the current value") : ""
|
|
1905
|
+
})]
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* The create/edit dialog. The parent gives it a new `key` each time it opens,
|
|
1910
|
+
* so its fields start from the variable being edited (they used to keep the
|
|
1911
|
+
* first variable's values, or none, and an edit could turn a secret into a
|
|
1912
|
+
* plain value without the person touching the switch).
|
|
1913
|
+
*/
|
|
1914
|
+
function VariableFormDialog({ open, onOpenChange, variable, onSaved }) {
|
|
1915
|
+
const tr = useTr();
|
|
1916
|
+
const isEdit = !!variable;
|
|
1917
|
+
const [form, setForm] = useState(() => initialVariableForm(variable));
|
|
1918
|
+
const update = (field, value) => setForm((current) => ({
|
|
1919
|
+
...current,
|
|
1920
|
+
[field]: value
|
|
1921
|
+
}));
|
|
1922
|
+
const { submit, saving } = useVariableFormSubmit({
|
|
1923
|
+
form,
|
|
1924
|
+
variable,
|
|
1925
|
+
v2: false,
|
|
1926
|
+
onDone: () => {
|
|
1927
|
+
onSaved();
|
|
1928
|
+
onOpenChange(false);
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
1932
|
+
open,
|
|
1933
|
+
onOpenChange,
|
|
1934
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
1935
|
+
className: "max-w-md",
|
|
1936
|
+
children: [
|
|
1937
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: isEdit ? tr("fluidgrids.variables.editTitle", "Edit variable") : tr("fluidgrids.variables.createTitle", "New variable") }) }),
|
|
1938
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1939
|
+
className: "space-y-4 py-2",
|
|
1940
|
+
children: [
|
|
1941
|
+
/* @__PURE__ */ jsx(KeyField, {
|
|
1942
|
+
value: form.key,
|
|
1943
|
+
onChange: (key) => update("key", key),
|
|
1944
|
+
isEdit
|
|
1945
|
+
}),
|
|
1946
|
+
!isEdit && /* @__PURE__ */ jsx(ScopeField, {
|
|
1947
|
+
value: form.scope,
|
|
1948
|
+
onChange: (scope) => update("scope", scope)
|
|
1949
|
+
}),
|
|
1950
|
+
/* @__PURE__ */ jsx(ValueSourceFields, {
|
|
1951
|
+
variable,
|
|
1952
|
+
source: form.source,
|
|
1953
|
+
externalRef: form.externalRef,
|
|
1954
|
+
onSourceChange: (source) => update("source", source),
|
|
1955
|
+
onExternalRefChange: (ref) => update("externalRef", ref),
|
|
1956
|
+
onLeave: () => onOpenChange(false)
|
|
1957
|
+
}),
|
|
1958
|
+
/* @__PURE__ */ jsx(DescriptionAndSecretFields, {
|
|
1959
|
+
form,
|
|
1960
|
+
update
|
|
1961
|
+
}),
|
|
1962
|
+
/* @__PURE__ */ jsx(ValueField, {
|
|
1963
|
+
form,
|
|
1964
|
+
update,
|
|
1965
|
+
variable
|
|
1966
|
+
})
|
|
1967
|
+
]
|
|
1968
|
+
}),
|
|
1969
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button$1, {
|
|
1970
|
+
variant: "outline",
|
|
1971
|
+
onClick: () => onOpenChange(false),
|
|
1972
|
+
children: tr("fluidgrids.variables.cancel", "Cancel")
|
|
1973
|
+
}), /* @__PURE__ */ jsx(Button$1, {
|
|
1974
|
+
"data-agent": "confirm",
|
|
1975
|
+
"data-testid": "variable-save",
|
|
1976
|
+
onClick: () => void submit(),
|
|
1977
|
+
disabled: saving,
|
|
1978
|
+
children: saving ? tr("fluidgrids.variables.saving", "Saving…") : tr("fluidgrids.variables.save", "Save")
|
|
1979
|
+
})] })
|
|
1980
|
+
]
|
|
1981
|
+
})
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
function VariablesTab() {
|
|
1985
|
+
const tr = useTr();
|
|
1986
|
+
const { variables, loading, error, refetch } = useVariables();
|
|
1987
|
+
const { deleteVariable } = useDeleteVariable();
|
|
1988
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
1989
|
+
const [dialogSession, setDialogSession] = useState(0);
|
|
1990
|
+
const [editing, setEditing] = useState(null);
|
|
1991
|
+
const handleCreate = useCallback(() => {
|
|
1992
|
+
setEditing(null);
|
|
1993
|
+
setDialogSession((session) => session + 1);
|
|
1994
|
+
setDialogOpen(true);
|
|
1995
|
+
}, []);
|
|
1996
|
+
const handleEdit = useCallback((variable) => {
|
|
1997
|
+
setEditing(variable);
|
|
1998
|
+
setDialogSession((session) => session + 1);
|
|
1999
|
+
setDialogOpen(true);
|
|
2000
|
+
}, []);
|
|
2001
|
+
const performDelete = useCallback(async (variable) => {
|
|
2002
|
+
try {
|
|
2003
|
+
await deleteVariable(variable.id);
|
|
2004
|
+
toast.success(tr("fluidgrids.variables.deleted", "Variable deleted"));
|
|
2005
|
+
refetch();
|
|
2006
|
+
} catch (err) {
|
|
2007
|
+
toast.error(describeOperationError(err, tr("fluidgrids.variables.deleteFailed", "Failed to delete variable")));
|
|
2008
|
+
}
|
|
2009
|
+
}, [
|
|
2010
|
+
deleteVariable,
|
|
2011
|
+
refetch,
|
|
2012
|
+
tr
|
|
2013
|
+
]);
|
|
2014
|
+
const handleDelete = useCallback(async (variable) => {
|
|
2015
|
+
if (!window.confirm(tr("fluidgrids.variables.confirmDelete", "Delete variable \"{{key}}\"?", { key: variable.key }))) return;
|
|
2016
|
+
await performDelete(variable);
|
|
2017
|
+
}, [performDelete, tr]);
|
|
2018
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2019
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2020
|
+
className: "flex items-center justify-between mb-4",
|
|
2021
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
2022
|
+
className: "text-sm text-text-secondary",
|
|
2023
|
+
children: tr("fluidgrids.variables.tabDescription", "Reference these in any node parameter as {{ $vars.KEY }} (new expressions) or ${vars.KEY} (legacy).")
|
|
2024
|
+
}), /* @__PURE__ */ jsx(SdkPermissionButton, {
|
|
2025
|
+
permission: FLUIDGRIDS_PERMISSIONS.VARIABLE_CREATE,
|
|
2026
|
+
deniedTooltip: tr("fluidgrids.variables.createDeniedTooltip", "You don't have permission to create variables"),
|
|
2027
|
+
children: /* @__PURE__ */ jsxs(Button$1, {
|
|
2028
|
+
onClick: handleCreate,
|
|
2029
|
+
size: "sm",
|
|
2030
|
+
"data-tour": "fluidgrids-variables-create",
|
|
2031
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2032
|
+
icon: "mdi:plus",
|
|
2033
|
+
className: "mr-1.5",
|
|
2034
|
+
width: 16
|
|
2035
|
+
}), tr("fluidgrids.variables.newVariable", "New Variable")]
|
|
2036
|
+
})
|
|
2037
|
+
})]
|
|
2038
|
+
}),
|
|
2039
|
+
error && /* @__PURE__ */ jsx(LoadErrorAlert, {
|
|
2040
|
+
title: tr("fluidgrids.variables.loadError", "Could not load variables"),
|
|
2041
|
+
error,
|
|
2042
|
+
onRetry: () => void refetch()
|
|
2043
|
+
}),
|
|
2044
|
+
/* @__PURE__ */ jsx(Card, {
|
|
2045
|
+
className: "border border-border-default bg-surface",
|
|
2046
|
+
"data-tour": "fluidgrids-variables-table",
|
|
2047
|
+
children: /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
2048
|
+
/* @__PURE__ */ jsx(TableHead, { children: tr("fluidgrids.variables.colKey", "Key") }),
|
|
2049
|
+
/* @__PURE__ */ jsx(TableHead, { children: tr("fluidgrids.variables.colScope", "Scope") }),
|
|
2050
|
+
/* @__PURE__ */ jsx(TableHead, { children: tr("fluidgrids.variables.colValue", "Value") }),
|
|
2051
|
+
/* @__PURE__ */ jsx(TableHead, {
|
|
2052
|
+
className: "text-right",
|
|
2053
|
+
children: tr("fluidgrids.variables.colActions", "Actions")
|
|
2054
|
+
})
|
|
2055
|
+
] }) }), /* @__PURE__ */ jsxs(TableBody, { children: [
|
|
2056
|
+
loading && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
2057
|
+
colSpan: 4,
|
|
2058
|
+
className: "text-center text-text-secondary py-8",
|
|
2059
|
+
children: tr("fluidgrids.variables.loading", "Loading…")
|
|
2060
|
+
}) }),
|
|
2061
|
+
!loading && !error && variables.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
2062
|
+
colSpan: 4,
|
|
2063
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
2064
|
+
kind: "first-use",
|
|
2065
|
+
illustration: "variables",
|
|
2066
|
+
size: "table",
|
|
2067
|
+
compact: true,
|
|
2068
|
+
icon: null,
|
|
2069
|
+
title: tr("fluidgrids.variables.empty", "No variables yet")
|
|
2070
|
+
})
|
|
2071
|
+
}) }),
|
|
2072
|
+
variables.map((variable) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
2073
|
+
/* @__PURE__ */ jsxs(TableCell, { children: [/* @__PURE__ */ jsxs("div", {
|
|
2074
|
+
className: "flex items-center gap-2",
|
|
2075
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
2076
|
+
className: "text-sm font-medium text-text-primary",
|
|
2077
|
+
children: variable.key
|
|
2078
|
+
}), variable.isSecret && /* @__PURE__ */ jsx(Badge, {
|
|
2079
|
+
variant: "outline",
|
|
2080
|
+
className: "text-[10px]",
|
|
2081
|
+
children: tr("fluidgrids.variables.secretBadge", "SECRET")
|
|
2082
|
+
})]
|
|
2083
|
+
}), variable.description && /* @__PURE__ */ jsx("p", {
|
|
2084
|
+
className: "text-xs text-text-secondary mt-0.5",
|
|
2085
|
+
children: variable.description
|
|
2086
|
+
})] }),
|
|
2087
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
2088
|
+
className: "text-text-secondary text-sm",
|
|
2089
|
+
children: variable.scope
|
|
2090
|
+
}),
|
|
2091
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(VariableValueCell, { variable }) }),
|
|
2092
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
2093
|
+
className: "text-right",
|
|
2094
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2095
|
+
className: "flex items-center justify-end gap-1",
|
|
2096
|
+
children: [/* @__PURE__ */ jsx(SdkPermissionButton, {
|
|
2097
|
+
permission: FLUIDGRIDS_PERMISSIONS.VARIABLE_UPDATE,
|
|
2098
|
+
deniedTooltip: tr("fluidgrids.variables.editDeniedTooltip", "You don't have permission to edit variables"),
|
|
2099
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
2100
|
+
type: "button",
|
|
2101
|
+
onClick: () => handleEdit(variable),
|
|
2102
|
+
className: "p-1.5 rounded hover:bg-surface-sunken text-text-secondary hover:text-text-primary",
|
|
2103
|
+
title: tr("fluidgrids.variables.edit", "Edit"),
|
|
2104
|
+
"aria-label": tr("fluidgrids.variables.editNamed", "Edit {{key}}", { key: variable.key }),
|
|
2105
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
2106
|
+
icon: "mdi:pencil-outline",
|
|
2107
|
+
width: 16
|
|
2108
|
+
})
|
|
2109
|
+
})
|
|
2110
|
+
}), /* @__PURE__ */ jsx(SdkPermissionButton, {
|
|
2111
|
+
permission: FLUIDGRIDS_PERMISSIONS.VARIABLE_DELETE,
|
|
2112
|
+
deniedTooltip: tr("fluidgrids.variables.deleteDeniedTooltip", "You don't have permission to delete variables"),
|
|
2113
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
2114
|
+
type: "button",
|
|
2115
|
+
onClick: () => void handleDelete(variable),
|
|
2116
|
+
className: "p-1.5 rounded hover:bg-surface-sunken text-text-secondary hover:text-status-error-text",
|
|
2117
|
+
title: tr("fluidgrids.variables.delete", "Delete"),
|
|
2118
|
+
"aria-label": tr("fluidgrids.variables.deleteNamed", "Delete {{key}}", { key: variable.key }),
|
|
2119
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
2120
|
+
icon: "mdi:trash-can-outline",
|
|
2121
|
+
width: 16
|
|
2122
|
+
})
|
|
2123
|
+
})
|
|
2124
|
+
})]
|
|
2125
|
+
})
|
|
2126
|
+
})
|
|
2127
|
+
] }, variable.id))
|
|
2128
|
+
] })] })
|
|
2129
|
+
}),
|
|
2130
|
+
/* @__PURE__ */ jsx(VariableFormDialog, {
|
|
2131
|
+
open: dialogOpen,
|
|
2132
|
+
onOpenChange: setDialogOpen,
|
|
2133
|
+
variable: editing,
|
|
2134
|
+
onSaved: () => void refetch()
|
|
2135
|
+
}, dialogSession)
|
|
2136
|
+
] });
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Where the AWS Secrets Manager settings used to be. Secret managers are now
|
|
2140
|
+
* connected once for the workspace in Security > Vault integrations, and a
|
|
2141
|
+
* variable references one of their secrets as a platform secret.
|
|
2142
|
+
*/
|
|
2143
|
+
function VaultIntegrationsTab() {
|
|
2144
|
+
const tr = useTr();
|
|
2145
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2146
|
+
className: "max-w-xl",
|
|
2147
|
+
children: /* @__PURE__ */ jsx(Card, {
|
|
2148
|
+
className: "border border-border-default bg-surface",
|
|
2149
|
+
"data-testid": "variables-vault-integrations-note",
|
|
2150
|
+
children: /* @__PURE__ */ jsxs(CardHeader, {
|
|
2151
|
+
className: "space-y-3",
|
|
2152
|
+
children: [
|
|
2153
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2154
|
+
className: "flex items-center gap-2",
|
|
2155
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2156
|
+
icon: "mdi:shield-key-outline",
|
|
2157
|
+
width: 20,
|
|
2158
|
+
className: "text-text-secondary"
|
|
2159
|
+
}), /* @__PURE__ */ jsx("h3", {
|
|
2160
|
+
className: "text-sm font-semibold text-text-primary",
|
|
2161
|
+
children: tr("fluidgrids.variables.vaultNoteTitle", "Secrets now come from Vault integrations")
|
|
2162
|
+
})]
|
|
2163
|
+
}),
|
|
2164
|
+
/* @__PURE__ */ jsx("p", {
|
|
2165
|
+
className: "text-sm text-text-secondary",
|
|
2166
|
+
children: tr("fluidgrids.variables.vaultNoteBody", "Connect AWS Secrets Manager, HashiCorp Vault, Azure Key Vault or GCP Secret Manager once in Security > Vault integrations. Then create a variable, choose Platform secret, and write its reference as {{pattern}}.", { pattern: SECRET_REFERENCE_HINT })
|
|
2167
|
+
}),
|
|
2168
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(VaultIntegrationsLink, { testId: "variables-open-vault-integrations" }) })
|
|
2169
|
+
]
|
|
2170
|
+
})
|
|
2171
|
+
})
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* The Variables page. Navigation v2 (FluidGrids) shows the redesigned page
|
|
2176
|
+
* (BOFF-15502); every other app keeps the page below exactly as it was.
|
|
2177
|
+
*/
|
|
2178
|
+
function VariablesPage() {
|
|
2179
|
+
return useNavigationV2() ? /* @__PURE__ */ jsx(VariablesPageV2, {}) : /* @__PURE__ */ jsx(VariablesPageClassic, {});
|
|
2180
|
+
}
|
|
2181
|
+
function VariablesPageClassic() {
|
|
2182
|
+
const tr = useTr();
|
|
2183
|
+
const navigate = useNavigate();
|
|
2184
|
+
const [activeTab, setActiveTab] = useState("variables");
|
|
2185
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2186
|
+
className: "p-4 sm:p-6 bg-surface-canvas min-h-screen",
|
|
2187
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2188
|
+
className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",
|
|
2189
|
+
"data-tour": "fluidgrids-variables-header",
|
|
2190
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
2191
|
+
className: "text-2xl sm:text-3xl font-bold text-text-primary",
|
|
2192
|
+
children: tr("fluidgrids.variables.pageTitle", "Variables")
|
|
2193
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2194
|
+
className: "text-text-secondary mt-1",
|
|
2195
|
+
children: tr("fluidgrids.variables.pageSubtitle", "Reusable values workflows can reference as $vars")
|
|
2196
|
+
})] }), /* @__PURE__ */ jsxs(Button$1, {
|
|
2197
|
+
variant: "outline",
|
|
2198
|
+
onClick: () => navigate("../list"),
|
|
2199
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2200
|
+
icon: "mdi:arrow-left",
|
|
2201
|
+
className: "mr-2",
|
|
2202
|
+
width: 16
|
|
2203
|
+
}), tr("fluidgrids.variables.backToWorkflows", "Back to Workflows")]
|
|
2204
|
+
})]
|
|
2205
|
+
}), /* @__PURE__ */ jsxs(Tabs, {
|
|
2206
|
+
value: activeTab,
|
|
2207
|
+
onValueChange: setActiveTab,
|
|
2208
|
+
className: "w-full",
|
|
2209
|
+
children: [
|
|
2210
|
+
/* @__PURE__ */ jsxs(TabsList, {
|
|
2211
|
+
className: "bg-surface-sunken border border-border-default mb-6",
|
|
2212
|
+
"data-tour": "fluidgrids-variables-tabs",
|
|
2213
|
+
children: [/* @__PURE__ */ jsxs(TabsTrigger, {
|
|
2214
|
+
value: "variables",
|
|
2215
|
+
className: "gap-1.5",
|
|
2216
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2217
|
+
icon: "mdi:variable",
|
|
2218
|
+
width: 16
|
|
2219
|
+
}), tr("fluidgrids.variables.variablesTab", "Variables")]
|
|
2220
|
+
}), /* @__PURE__ */ jsxs(TabsTrigger, {
|
|
2221
|
+
value: "providers",
|
|
2222
|
+
className: "gap-1.5",
|
|
2223
|
+
"data-testid": "variables-vault-tab",
|
|
2224
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
2225
|
+
icon: "mdi:shield-key-outline",
|
|
2226
|
+
width: 16
|
|
2227
|
+
}), tr("fluidgrids.variables.vaultIntegrationsTab", "Vault integrations")]
|
|
2228
|
+
})]
|
|
2229
|
+
}),
|
|
2230
|
+
/* @__PURE__ */ jsx(TabsContent, {
|
|
2231
|
+
value: "variables",
|
|
2232
|
+
children: /* @__PURE__ */ jsx(VariablesTab, {})
|
|
2233
|
+
}),
|
|
2234
|
+
/* @__PURE__ */ jsx(TabsContent, {
|
|
2235
|
+
value: "providers",
|
|
2236
|
+
children: /* @__PURE__ */ jsx(VaultIntegrationsTab, {})
|
|
2237
|
+
})
|
|
2238
|
+
]
|
|
2239
|
+
})]
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
export { VariablesPage_exports as n, VariablesPage as t };
|