@galaxy-io/filament-ui 0.11.0 → 0.13.0
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/dist/api/queries/constants.d.ts +1 -0
- package/dist/api/queries/constants.js +2 -1
- package/dist/api/queries/pipelines.d.ts +15 -0
- package/dist/api/queries/pipelines.js +13 -12
- package/dist/api/queries/runs.d.ts +1 -1
- package/dist/api/queries/runs.js +8 -11
- package/dist/api/queries/webhooks.d.ts +61 -0
- package/dist/api/queries/webhooks.js +41 -0
- package/dist/api/utils.d.ts +1 -0
- package/dist/api/utils.js +3 -1
- package/dist/components/connections/ConnectorPreviewChip.js +4 -3
- package/dist/components/webhooks/WebhookDeliveryUrlCopyButton.d.ts +8 -0
- package/dist/components/webhooks/WebhookDeliveryUrlCopyButton.js +33 -0
- package/dist/components/webhooks/WebhookEndpointErrorLayout.d.ts +7 -0
- package/dist/components/webhooks/WebhookEndpointErrorLayout.js +26 -0
- package/dist/components/webhooks/WebhookEndpointStatusBeacon.d.ts +7 -0
- package/dist/components/webhooks/WebhookEndpointStatusBeacon.js +20 -0
- package/dist/components/webhooks/WebhookEndpointStatusCallout.d.ts +8 -0
- package/dist/components/webhooks/WebhookEndpointStatusCallout.js +11 -0
- package/dist/components/webhooks/constants.d.ts +10 -0
- package/dist/components/webhooks/constants.js +36 -0
- package/dist/components/webhooks/hooks/useWebhookEndpointSync.d.ts +8 -0
- package/dist/components/webhooks/hooks/useWebhookEndpointSync.js +112 -0
- package/dist/components/webhooks/types.d.ts +9 -0
- package/dist/components/webhooks/types.js +13 -0
- package/dist/components/webhooks/utils.d.ts +21 -0
- package/dist/components/webhooks/utils.js +47 -0
- package/dist/constants.js +1 -1
- package/dist/gen/ingestion/v1/capabilities_pb.js +1 -1
- package/dist/gen/ingestion/v1/connectors_pb.d.ts +6 -0
- package/dist/gen/ingestion/v1/connectors_pb.js +1 -1
- package/dist/gen/ingestion/v1/runs_pb.d.ts +2 -1
- package/dist/gen/ingestion/v1/service_pb.d.ts +19 -0
- package/dist/gen/ingestion/v1/service_pb.js +5 -3
- package/dist/gen/ingestion/v1/webhooks_pb.d.ts +177 -0
- package/dist/gen/ingestion/v1/webhooks_pb.js +23 -0
- package/dist/hooks/useConfirm.d.ts +1 -1
- package/dist/module/hooks.d.ts +5 -6
- package/dist/module/hooks.js +6 -1
- package/dist/module/routes.d.ts +1 -2
- package/dist/module/schemas.d.ts +1 -2
- package/dist/module/schemas.js +1 -2
- package/dist/pages/connections/ConnectionsPage.js +0 -4
- package/dist/pages/connections/components/card/ConnectionCard.d.ts +0 -1
- package/dist/pages/connections/components/card/ConnectionCard.js +4 -9
- package/dist/pages/connections/components/create/configure/CreateConnectionConfigure.js +48 -11
- package/dist/pages/connections/components/drawer/ConnectionDrawer.js +6 -1
- package/dist/pages/connections/components/drawer/ConnectionDrawerSection.js +1 -1
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhook.d.ts +7 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhook.js +105 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSecrets.d.ts +7 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSecrets.js +40 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSigningKey.d.ts +9 -0
- package/dist/pages/connections/components/drawer/ConnectionDrawerWebhookSigningKey.js +120 -0
- package/dist/pages/connections/components/form/ConnectionFormSigningKeyModal.d.ts +9 -0
- package/dist/pages/connections/components/form/ConnectionFormSigningKeyModal.js +66 -0
- package/dist/pages/connections/components/form/ConnectionFormWrapper.d.ts +1 -0
- package/dist/pages/connections/components/form/ConnectionFormWrapper.js +2 -1
- package/dist/pages/connections/components/form/types.d.ts +5 -0
- package/dist/pages/connections/hooks/useConnectionWebhookKeyMint.d.ts +12 -0
- package/dist/pages/connections/hooks/useConnectionWebhookKeyMint.js +27 -0
- package/dist/pages/observability/ObservabilityPage.js +61 -66
- package/dist/pages/observability/components/ObservabilityPageActions.js +1 -3
- package/dist/pages/observability/components/ObservabilityWidgetEmpty.d.ts +8 -0
- package/dist/pages/observability/components/ObservabilityWidgetEmpty.js +30 -0
- package/dist/pages/observability/components/band/ObservabilityBand.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBand.js +28 -0
- package/dist/pages/observability/components/band/ObservabilityBandList.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandList.js +81 -0
- package/dist/pages/observability/components/band/ObservabilityBandMetricTile.d.ts +10 -0
- package/dist/pages/observability/components/band/ObservabilityBandMetricTile.js +86 -0
- package/dist/pages/observability/components/band/ObservabilityBandPivotSelect.d.ts +7 -0
- package/dist/pages/observability/components/band/ObservabilityBandPivotSelect.js +37 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsChart.d.ts +10 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsChart.js +26 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsPastTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsPastTile.js +128 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsTile.js +13 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsUpcomingTile.d.ts +3 -0
- package/dist/pages/observability/components/band/ObservabilityBandRunsUpcomingTile.js +63 -0
- package/dist/pages/observability/components/band/ObservabilityBandTile.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandTile.js +71 -0
- package/dist/pages/observability/components/band/ObservabilityBandTimeseriesChart.d.ts +14 -0
- package/dist/pages/observability/components/band/ObservabilityBandTimeseriesChart.js +48 -0
- package/dist/pages/observability/components/band/ObservabilityBandTopList.d.ts +12 -0
- package/dist/pages/observability/components/band/ObservabilityBandTopList.js +19 -0
- package/dist/pages/observability/components/band/constants.d.ts +25 -0
- package/dist/pages/observability/components/band/constants.js +81 -0
- package/dist/pages/observability/components/band/types.d.ts +27 -0
- package/dist/pages/observability/components/band/utils.d.ts +25 -0
- package/dist/pages/observability/components/band/utils.js +93 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionRow.d.ts +9 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionRow.js +57 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionsWidget.d.ts +7 -0
- package/dist/pages/observability/components/connections/ObservabilityConnectionsWidget.js +56 -0
- package/dist/pages/observability/components/connections/constants.d.ts +5 -0
- package/dist/pages/observability/components/connections/constants.js +24 -0
- package/dist/pages/observability/components/connections/types.d.ts +4 -0
- package/dist/pages/observability/components/connections/utils.d.ts +4 -0
- package/dist/pages/observability/components/connections/utils.js +23 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresBanner.d.ts +3 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresBanner.js +33 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresDetails.d.ts +7 -0
- package/dist/pages/observability/components/failures/ObservabilityFailuresDetails.js +99 -0
- package/dist/pages/observability/components/failures/constants.d.ts +2 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesBar.d.ts +7 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesBar.js +34 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesColumnCell.d.ts +7 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesColumnCell.js +15 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesHeader.d.ts +3 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesHeader.js +34 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesRow.d.ts +11 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesRow.js +120 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesWidget.d.ts +3 -0
- package/dist/pages/observability/components/pipelines/ObservabilityPipelinesWidget.js +142 -0
- package/dist/pages/observability/components/pipelines/constants.d.ts +23 -0
- package/dist/pages/observability/components/pipelines/constants.js +33 -0
- package/dist/pages/observability/components/pipelines/types.d.ts +22 -0
- package/dist/pages/observability/components/pipelines/types.js +11 -0
- package/dist/pages/observability/components/pipelines/utils.d.ts +9 -0
- package/dist/pages/observability/components/pipelines/utils.js +73 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsPastTable.js +6 -13
- package/dist/pages/observability/components/runs/ObservabilityRunsTableActions.d.ts +3 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsTableActions.js +43 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsTableWidget.js +2 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsViewToggle.d.ts +3 -0
- package/dist/pages/observability/components/runs/ObservabilityRunsViewToggle.js +26 -0
- package/dist/pages/observability/components/runs/constants.d.ts +4 -10
- package/dist/pages/observability/components/runs/constants.js +8 -12
- package/dist/pages/observability/components/scheduled/ObservabilityScheduledWidget.d.ts +3 -0
- package/dist/pages/observability/components/scheduled/ObservabilityScheduledWidget.js +94 -0
- package/dist/pages/observability/components/setup/ObservabilitySetupChecklist.js +3 -1
- package/dist/pages/observability/components/setup/constants.js +1 -1
- package/dist/pages/observability/constants.d.ts +18 -3
- package/dist/pages/observability/constants.js +24 -4
- package/dist/pages/observability/hooks/useObservabilityAggregateQuery.d.ts +2 -0
- package/dist/pages/observability/hooks/useObservabilityAggregateQuery.js +13 -0
- package/dist/pages/observability/hooks/useObservabilityBandRanking.d.ts +8 -0
- package/dist/pages/observability/hooks/useObservabilityBandRanking.js +21 -0
- package/dist/pages/observability/hooks/useObservabilityBandUpcoming.d.ts +8 -0
- package/dist/pages/observability/hooks/useObservabilityBandUpcoming.js +45 -0
- package/dist/pages/observability/hooks/useObservabilityMetricInputs.d.ts +9 -0
- package/dist/pages/observability/hooks/useObservabilityMetricInputs.js +33 -0
- package/dist/pages/observability/hooks/useObservabilityPipelines.d.ts +12 -0
- package/dist/pages/observability/hooks/useObservabilityPipelines.js +22 -0
- package/dist/pages/observability/hooks/useObservabilityTimeseriesQuery.d.ts +2 -0
- package/dist/pages/observability/hooks/useObservabilityTimeseriesQuery.js +13 -0
- package/dist/pages/observability/types.d.ts +16 -0
- package/dist/pages/observability/types.js +7 -1
- package/dist/pages/observability/utils.d.ts +6 -1
- package/dist/pages/observability/utils.js +19 -2
- package/dist/pages/pipelines/canvas/hooks/usePipelineCanvasPanelResourceOptions.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/PipelineCanvasPanelOverview.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/node/PipelineCanvasPanelNodeDetail.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceDetail.js +11 -0
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceEndpoint.js +1 -1
- package/dist/pages/pipelines/canvas/panel/overview/resource/PipelineCanvasPanelResourceSection.js +4 -1
- package/dist/pages/pipelines/canvas/routes/hooks/usePipelineCanvasRoutes.js +1 -1
- package/dist/pages/pipelines/components/create/components/CreatePipelineModalFooter.js +7 -1
- package/dist/pages/pipelines/components/create/hooks/useCreatePipelineResources.js +2 -2
- package/dist/pages/pipelines/components/create/steps/CreatePipelineModalResources.js +5 -2
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesTable.js +15 -2
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesUrlCell.d.ts +7 -0
- package/dist/pages/pipelines/components/create/steps/components/CreatePipelineModalResourcesUrlCell.js +27 -0
- package/dist/pages/pipelines/components/header/PipelinePageEditActions.js +10 -0
- package/dist/pages/pipelines/components/header/PipelinePageHeading.js +1 -1
- package/dist/pages/pipelines/components/resource/PipelineResourceCreateForm.d.ts +1 -0
- package/dist/pages/pipelines/components/resource/PipelineResourceCreateForm.js +10 -3
- package/dist/pages/pipelines/components/run/PipelineRunModal.js +7 -4
- package/dist/pages/pipelines/components/run/PipelineRunModalResourcesPane.d.ts +1 -0
- package/dist/pages/pipelines/components/run/PipelineRunModalResourcesPane.js +5 -4
- package/dist/pages/pipelines/components/run/utils.d.ts +1 -0
- package/dist/pages/pipelines/components/run/utils.js +2 -1
- package/dist/pages/pipelines/components/table/PipelinesTable.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageAdvanced.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageDanger.js +1 -1
- package/dist/pages/pipelines/settings/PipelineSettingsPageGeneral.js +2 -2
- package/dist/pages/pipelines/settings/PipelineSettingsPageSchedule.js +1 -1
- package/dist/styles.css +15 -0
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.js +6 -1
- package/package.json +1 -1
- package/dist/pages/observability/components/metrics/ObservabilityMetricsWidget.d.ts +0 -3
- package/dist/pages/observability/components/metrics/ObservabilityMetricsWidget.js +0 -139
- package/dist/pages/observability/components/metrics/constants.d.ts +0 -3
- package/dist/pages/observability/components/metrics/constants.js +0 -11
- package/dist/pages/observability/components/runs/ObservabilityRunsChart.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsChart.js +0 -66
- package/dist/pages/observability/components/runs/ObservabilityRunsChartWidget.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsChartWidget.js +0 -75
- package/dist/pages/observability/components/runs/ObservabilityRunsScheduledChart.d.ts +0 -3
- package/dist/pages/observability/components/runs/ObservabilityRunsScheduledChart.js +0 -39
- package/dist/pages/observability/components/runs/types.d.ts +0 -1
- package/dist/pages/observability/components/runs/utils.d.ts +0 -14
- package/dist/pages/observability/components/runs/utils.js +0 -71
- package/dist/pages/observability/components/timeseries/ObservabilityPivotSelect.d.ts +0 -8
- package/dist/pages/observability/components/timeseries/ObservabilityPivotSelect.js +0 -28
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesChart.d.ts +0 -14
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesChart.js +0 -105
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesWidget.d.ts +0 -19
- package/dist/pages/observability/components/timeseries/ObservabilityTimeseriesWidget.js +0 -61
- package/dist/pages/observability/components/timeseries/constants.d.ts +0 -19
- package/dist/pages/observability/components/timeseries/constants.js +0 -57
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useFilamentSearchUpdate } from "../../../../../module/hooks.js";
|
|
2
2
|
import { CreateConnectionRequestSchema } from "../../../../../gen/ingestion/v1/connections_pb.js";
|
|
3
|
+
import { isWebhookConnector } from "../../../../../components/webhooks/utils.js";
|
|
3
4
|
import { ConnectionFormPhase } from "../../form/types.js";
|
|
4
5
|
import ConnectionFormProvider, { useConnectionFormActions, useConnectionFormState } from "../../form/ConnectionFormProvider.js";
|
|
5
6
|
import { getErrorMessage } from "../../../../../utils/errors.js";
|
|
6
7
|
import ConnectionForm from "../../form/ConnectionForm.js";
|
|
8
|
+
import ConnectionFormSigningKeyModal from "../../form/ConnectionFormSigningKeyModal.js";
|
|
9
|
+
import { useConnectionWebhookKeyMint } from "../../../hooks/useConnectionWebhookKeyMint.js";
|
|
7
10
|
import { useCreateConnectionMutation } from "../../../../../api/queries/connections.js";
|
|
8
|
-
import { useCallback } from "react";
|
|
11
|
+
import { useCallback, useState } from "react";
|
|
9
12
|
import { create } from "@bufbuild/protobuf";
|
|
10
13
|
import { jsx } from "react/jsx-runtime";
|
|
11
14
|
import { ToastVariant } from "@galaxy-io/dls/toast/Toast";
|
|
@@ -16,7 +19,36 @@ var CreateConnectionConfigureContent = ({ isOpen, connector, connectorKind: kind
|
|
|
16
19
|
const state = useConnectionFormState();
|
|
17
20
|
const { setPhase } = useConnectionFormActions();
|
|
18
21
|
const { toast } = useToast();
|
|
22
|
+
const [reveal, setReveal] = useState();
|
|
19
23
|
const { mutate: createConnection } = useCreateConnectionMutation();
|
|
24
|
+
const { mintKey } = useConnectionWebhookKeyMint();
|
|
25
|
+
const openConnection = useCallback((connectionId) => {
|
|
26
|
+
updateSearch((prev) => ({
|
|
27
|
+
...prev,
|
|
28
|
+
flow: void 0,
|
|
29
|
+
connector: void 0,
|
|
30
|
+
connectorKind: void 0,
|
|
31
|
+
connectorSearch: void 0,
|
|
32
|
+
connectionId
|
|
33
|
+
}));
|
|
34
|
+
}, [updateSearch]);
|
|
35
|
+
const mintSigningKey = useCallback((connection) => {
|
|
36
|
+
mintKey(connection, void 0, {
|
|
37
|
+
onSuccess: setReveal,
|
|
38
|
+
onError: (error) => {
|
|
39
|
+
toast({
|
|
40
|
+
variant: ToastVariant.ERROR,
|
|
41
|
+
header: "Connection created without a signing key",
|
|
42
|
+
description: getErrorMessage(error, "Failed to generate a signing key")
|
|
43
|
+
});
|
|
44
|
+
openConnection(connection.id);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, [
|
|
48
|
+
mintKey,
|
|
49
|
+
toast,
|
|
50
|
+
openConnection
|
|
51
|
+
]);
|
|
20
52
|
const handleCreateConnection = useCallback((config) => {
|
|
21
53
|
const name = state.name.trim();
|
|
22
54
|
if (!name) return;
|
|
@@ -28,18 +60,17 @@ var CreateConnectionConfigureContent = ({ isOpen, connector, connectorKind: kind
|
|
|
28
60
|
config
|
|
29
61
|
}), {
|
|
30
62
|
onSuccess: (response) => {
|
|
63
|
+
const connection = response.connection;
|
|
64
|
+
if (!connection?.id) return;
|
|
31
65
|
toast({
|
|
32
66
|
variant: ToastVariant.SUCCESS,
|
|
33
67
|
header: "Connection created"
|
|
34
68
|
});
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
connectorSearch: void 0,
|
|
41
|
-
connectionId: response.connection?.id
|
|
42
|
-
}));
|
|
69
|
+
if (isWebhookConnector(connection.connector)) {
|
|
70
|
+
mintSigningKey(connection);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
openConnection(connection.id);
|
|
43
74
|
},
|
|
44
75
|
onError: (error) => {
|
|
45
76
|
setPhase(ConnectionFormPhase.ERROR);
|
|
@@ -56,8 +87,9 @@ var CreateConnectionConfigureContent = ({ isOpen, connector, connectorKind: kind
|
|
|
56
87
|
kind,
|
|
57
88
|
createConnection,
|
|
58
89
|
toast,
|
|
59
|
-
|
|
60
|
-
|
|
90
|
+
setPhase,
|
|
91
|
+
mintSigningKey,
|
|
92
|
+
openConnection
|
|
61
93
|
]);
|
|
62
94
|
const handleConnectorVersionChange = useCallback((version) => {
|
|
63
95
|
updateSearch((prev) => ({
|
|
@@ -65,6 +97,11 @@ var CreateConnectionConfigureContent = ({ isOpen, connector, connectorKind: kind
|
|
|
65
97
|
connector: version
|
|
66
98
|
}), { replace: true });
|
|
67
99
|
}, [updateSearch]);
|
|
100
|
+
if (reveal) return /* @__PURE__ */ jsx(ConnectionFormSigningKeyModal, {
|
|
101
|
+
isOpen,
|
|
102
|
+
reveal,
|
|
103
|
+
onDone: () => openConnection(reveal.connection.id)
|
|
104
|
+
});
|
|
68
105
|
return /* @__PURE__ */ jsx(ConnectionForm, {
|
|
69
106
|
isOpen,
|
|
70
107
|
connectorName: connector,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IS_DEBUG } from "../../../../constants.js";
|
|
2
2
|
import { formatVersion } from "../../../../utils/format.js";
|
|
3
|
+
import { isWebhookConnector } from "../../../../components/webhooks/utils.js";
|
|
3
4
|
import ConnectionKindChip from "../../../../components/connections/ConnectionKindChip.js";
|
|
4
5
|
import { isNotFoundError } from "../../../../utils/errors.js";
|
|
5
6
|
import { createGetConnectionInput, useGetConnectionQuery } from "../../../../api/queries/connections.js";
|
|
@@ -11,6 +12,8 @@ import ConnectionDrawerActions from "./ConnectionDrawerActions.js";
|
|
|
11
12
|
import ConnectionDrawerHeader from "./ConnectionDrawerHeader.js";
|
|
12
13
|
import ConnectionDrawerJsonSection from "./ConnectionDrawerJsonSection.js";
|
|
13
14
|
import ConnectionDrawerPipelines from "./ConnectionDrawerPipelines.js";
|
|
15
|
+
import ConnectionDrawerWebhook from "./ConnectionDrawerWebhook.js";
|
|
16
|
+
import ConnectionDrawerWebhookSecrets from "./ConnectionDrawerWebhookSecrets.js";
|
|
14
17
|
import { KeyIcon, LinkBreakIcon, SlidersIcon } from "@phosphor-icons/react";
|
|
15
18
|
import Button, { ButtonSize, ButtonVariant } from "@galaxy-io/dls/buttons/Button";
|
|
16
19
|
import ErrorLayout from "@galaxy-io/dls/layout/ErrorLayout";
|
|
@@ -48,6 +51,7 @@ var ConnectionDrawer = ({ connectionId, isOpen, onClose }) => {
|
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
if (!connection) return /* @__PURE__ */ jsx(PendingLayout, {});
|
|
54
|
+
const isWebhook = isWebhookConnector(connection.connector);
|
|
51
55
|
return /* @__PURE__ */ jsxs(Flex, {
|
|
52
56
|
alignItems: AlignItems.STRETCH,
|
|
53
57
|
direction: FlexDirection.COLUMN,
|
|
@@ -102,13 +106,14 @@ var ConnectionDrawer = ({ connectionId, isOpen, onClose }) => {
|
|
|
102
106
|
emptyHeader: "No configuration",
|
|
103
107
|
emptyMessage: "This connection has no configuration values."
|
|
104
108
|
}),
|
|
105
|
-
/* @__PURE__ */ jsx(ConnectionDrawerJsonSection, {
|
|
109
|
+
isWebhook ? /* @__PURE__ */ jsx(ConnectionDrawerWebhookSecrets, { connection }) : /* @__PURE__ */ jsx(ConnectionDrawerJsonSection, {
|
|
106
110
|
header: "Secrets",
|
|
107
111
|
icon: KeyIcon,
|
|
108
112
|
data: connection.secretRefs,
|
|
109
113
|
emptyHeader: "No secrets",
|
|
110
114
|
emptyMessage: "This connection has no secret references."
|
|
111
115
|
}),
|
|
116
|
+
isWebhook && /* @__PURE__ */ jsx(ConnectionDrawerWebhook, { connection }),
|
|
112
117
|
/* @__PURE__ */ jsx(ConnectionDrawerPipelines, { connectionId: connection.id })
|
|
113
118
|
]
|
|
114
119
|
});
|
|
@@ -22,7 +22,7 @@ var ConnectionDrawerSection = ({ header, icon, count, emptyHeader, emptyMessage,
|
|
|
22
22
|
})]
|
|
23
23
|
}),
|
|
24
24
|
defaultIsOpen: isOpenInitial,
|
|
25
|
-
isFlush:
|
|
25
|
+
isFlush: count !== 0 && isFlush,
|
|
26
26
|
children: count === 0 ? /* @__PURE__ */ jsx(Box, {
|
|
27
27
|
padding: 12,
|
|
28
28
|
children: /* @__PURE__ */ jsx(EmptyLayout, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Connection } from '../../../../gen/ingestion/v1/connections_pb';
|
|
3
|
+
interface ConnectionDrawerWebhookProps {
|
|
4
|
+
connection: Connection;
|
|
5
|
+
}
|
|
6
|
+
declare const ConnectionDrawerWebhook: FC<ConnectionDrawerWebhookProps>;
|
|
7
|
+
export default ConnectionDrawerWebhook;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Flow } from "../../../../module/types.js";
|
|
2
|
+
import { useFilamentFlowOpen } from "../../../../module/hooks.js";
|
|
3
|
+
import { WebhookEndpointStatus } from "../../../../components/webhooks/types.js";
|
|
4
|
+
import { WEBHOOK_DOCS_PATH } from "../../../../components/webhooks/constants.js";
|
|
5
|
+
import { getWebhookEndpointStatus } from "../../../../components/webhooks/utils.js";
|
|
6
|
+
import { isNotFoundError } from "../../../../utils/errors.js";
|
|
7
|
+
import { createGetWebhookEndpointInput, useGetWebhookEndpointQuery } from "../../../../api/queries/webhooks.js";
|
|
8
|
+
import DocsLink from "../../../../components/DocsLink.js";
|
|
9
|
+
import ConnectionDrawerSection from "./ConnectionDrawerSection.js";
|
|
10
|
+
import { createGetPipelineInput, useGetPipelineQuery } from "../../../../api/queries/pipelines.js";
|
|
11
|
+
import WebhookDeliveryUrlCopyButton from "../../../../components/webhooks/WebhookDeliveryUrlCopyButton.js";
|
|
12
|
+
import WebhookEndpointErrorLayout from "../../../../components/webhooks/WebhookEndpointErrorLayout.js";
|
|
13
|
+
import WebhookEndpointStatusBeacon from "../../../../components/webhooks/WebhookEndpointStatusBeacon.js";
|
|
14
|
+
import WebhookEndpointStatusCallout from "../../../../components/webhooks/WebhookEndpointStatusCallout.js";
|
|
15
|
+
import { WebhooksLogoIcon } from "@phosphor-icons/react";
|
|
16
|
+
import Button, { ButtonSize } from "@galaxy-io/dls/buttons/Button";
|
|
17
|
+
import { Fragment } from "react";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import Flex, { AlignItems, FlexDirection, JustifyContent } from "@galaxy-io/dls/layout/Flex";
|
|
20
|
+
import Box from "@galaxy-io/dls/layout/Box";
|
|
21
|
+
import Skeleton from "@galaxy-io/dls/feedback/Skeleton";
|
|
22
|
+
import Text, { TextSize } from "@galaxy-io/dls/text/Text";
|
|
23
|
+
import { FontFamily } from "@galaxy-io/dls/theme/enums";
|
|
24
|
+
import Divider from "@galaxy-io/dls/layout/Divider";
|
|
25
|
+
//#region src/pages/connections/components/drawer/ConnectionDrawerWebhook.tsx
|
|
26
|
+
var NEEDS_PIPELINE_STATUSES = /* @__PURE__ */ new Set([WebhookEndpointStatus.NO_PIPELINE, WebhookEndpointStatus.PIPELINE_DELETED]);
|
|
27
|
+
var ConnectionDrawerWebhook = ({ connection }) => {
|
|
28
|
+
const openFlow = useFilamentFlowOpen();
|
|
29
|
+
const { data, error, isError, isLoading } = useGetWebhookEndpointQuery({
|
|
30
|
+
input: createGetWebhookEndpointInput(connection.id),
|
|
31
|
+
options: { retry: false }
|
|
32
|
+
});
|
|
33
|
+
const endpoint = data?.endpoint;
|
|
34
|
+
const isFailed = isError && !isNotFoundError(error);
|
|
35
|
+
const { data: pipelineData, error: pipelineError } = useGetPipelineQuery({
|
|
36
|
+
input: createGetPipelineInput(endpoint?.pipelineId ?? ""),
|
|
37
|
+
options: {
|
|
38
|
+
enabled: !!endpoint?.pipelineId,
|
|
39
|
+
retry: false
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const isPipelineDeleted = isNotFoundError(pipelineError) || (pipelineData?.pipeline?.deletedAt ?? 0n) > 0n;
|
|
43
|
+
const status = getWebhookEndpointStatus(endpoint, isPipelineDeleted);
|
|
44
|
+
const renderContent = () => {
|
|
45
|
+
if (isLoading) return /* @__PURE__ */ jsx(Box, {
|
|
46
|
+
padding: 12,
|
|
47
|
+
children: /* @__PURE__ */ jsx(Skeleton, { lines: 3 })
|
|
48
|
+
});
|
|
49
|
+
if (isFailed) return /* @__PURE__ */ jsx(WebhookEndpointErrorLayout, { error });
|
|
50
|
+
const resources = endpoint?.resources ?? [];
|
|
51
|
+
return /* @__PURE__ */ jsxs(Flex, {
|
|
52
|
+
alignItems: AlignItems.STRETCH,
|
|
53
|
+
direction: FlexDirection.COLUMN,
|
|
54
|
+
fillWidth: true,
|
|
55
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
56
|
+
padding: 12,
|
|
57
|
+
children: /* @__PURE__ */ jsx(WebhookEndpointStatusCallout, {
|
|
58
|
+
status,
|
|
59
|
+
actions: /* @__PURE__ */ jsxs(Flex, {
|
|
60
|
+
alignItems: AlignItems.CENTER,
|
|
61
|
+
gap: 12,
|
|
62
|
+
children: [NEEDS_PIPELINE_STATUSES.has(status) && /* @__PURE__ */ jsx(Button, {
|
|
63
|
+
label: "Create pipeline",
|
|
64
|
+
size: ButtonSize.SMALL,
|
|
65
|
+
onClick: () => openFlow(Flow.CREATE_PIPELINE)
|
|
66
|
+
}), /* @__PURE__ */ jsx(DocsLink, {
|
|
67
|
+
label: "Setup guide",
|
|
68
|
+
path: WEBHOOK_DOCS_PATH,
|
|
69
|
+
size: TextSize.BODY_SM
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
}), resources.map((resource) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsxs(Flex, {
|
|
74
|
+
alignItems: AlignItems.CENTER,
|
|
75
|
+
justifyContent: JustifyContent.SPACE_BETWEEN,
|
|
76
|
+
gap: 12,
|
|
77
|
+
height: 40,
|
|
78
|
+
padding: [0, 12],
|
|
79
|
+
fillWidth: true,
|
|
80
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
81
|
+
size: TextSize.BODY_SM,
|
|
82
|
+
family: FontFamily.MONO,
|
|
83
|
+
lineClamp: 1,
|
|
84
|
+
children: resource
|
|
85
|
+
}), /* @__PURE__ */ jsx(WebhookDeliveryUrlCopyButton, {
|
|
86
|
+
sourceConnectionId: connection.id,
|
|
87
|
+
resource
|
|
88
|
+
})]
|
|
89
|
+
})] }, resource))]
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsx(ConnectionDrawerSection, {
|
|
93
|
+
header: "Endpoints",
|
|
94
|
+
icon: WebhooksLogoIcon,
|
|
95
|
+
count: void 0,
|
|
96
|
+
emptyHeader: "No endpoint",
|
|
97
|
+
emptyMessage: "This source has no webhook endpoint.",
|
|
98
|
+
actions: isLoading || isFailed ? void 0 : /* @__PURE__ */ jsx(WebhookEndpointStatusBeacon, { status }),
|
|
99
|
+
isOpenInitial: true,
|
|
100
|
+
isFlush: true,
|
|
101
|
+
children: renderContent()
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { ConnectionDrawerWebhook as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Connection } from '../../../../gen/ingestion/v1/connections_pb';
|
|
3
|
+
interface ConnectionDrawerWebhookSecretsProps {
|
|
4
|
+
connection: Connection;
|
|
5
|
+
}
|
|
6
|
+
declare const ConnectionDrawerWebhookSecrets: FC<ConnectionDrawerWebhookSecretsProps>;
|
|
7
|
+
export default ConnectionDrawerWebhookSecrets;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isNotFoundError } from "../../../../utils/errors.js";
|
|
2
|
+
import { createGetWebhookEndpointInput, useGetWebhookEndpointQuery } from "../../../../api/queries/webhooks.js";
|
|
3
|
+
import ConnectionDrawerSection from "./ConnectionDrawerSection.js";
|
|
4
|
+
import WebhookEndpointErrorLayout from "../../../../components/webhooks/WebhookEndpointErrorLayout.js";
|
|
5
|
+
import ConnectionDrawerWebhookSigningKey from "./ConnectionDrawerWebhookSigningKey.js";
|
|
6
|
+
import { KeyIcon } from "@phosphor-icons/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import Box from "@galaxy-io/dls/layout/Box";
|
|
9
|
+
import Skeleton from "@galaxy-io/dls/feedback/Skeleton";
|
|
10
|
+
//#region src/pages/connections/components/drawer/ConnectionDrawerWebhookSecrets.tsx
|
|
11
|
+
var ConnectionDrawerWebhookSecrets = ({ connection }) => {
|
|
12
|
+
const { data, error, isError, isLoading } = useGetWebhookEndpointQuery({
|
|
13
|
+
input: createGetWebhookEndpointInput(connection.id),
|
|
14
|
+
options: { retry: false }
|
|
15
|
+
});
|
|
16
|
+
const endpoint = data?.endpoint;
|
|
17
|
+
const isFailed = isError && !isNotFoundError(error);
|
|
18
|
+
const renderContent = () => {
|
|
19
|
+
if (isLoading) return /* @__PURE__ */ jsx(Box, {
|
|
20
|
+
padding: 12,
|
|
21
|
+
children: /* @__PURE__ */ jsx(Skeleton, { lines: 2 })
|
|
22
|
+
});
|
|
23
|
+
if (isFailed) return /* @__PURE__ */ jsx(WebhookEndpointErrorLayout, { error });
|
|
24
|
+
return /* @__PURE__ */ jsx(ConnectionDrawerWebhookSigningKey, {
|
|
25
|
+
connection,
|
|
26
|
+
endpoint
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ jsx(ConnectionDrawerSection, {
|
|
30
|
+
header: "Secrets",
|
|
31
|
+
icon: KeyIcon,
|
|
32
|
+
count: endpoint?.hasSigningSecret ? 1 : void 0,
|
|
33
|
+
emptyHeader: "No secrets",
|
|
34
|
+
emptyMessage: "This connection has no secret references.",
|
|
35
|
+
isFlush: true,
|
|
36
|
+
children: renderContent()
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ConnectionDrawerWebhookSecrets as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Connection } from '../../../../gen/ingestion/v1/connections_pb';
|
|
3
|
+
import { WebhookEndpointConfig } from '../../../../gen/ingestion/v1/webhooks_pb';
|
|
4
|
+
interface ConnectionDrawerWebhookSigningKeyProps {
|
|
5
|
+
connection: Connection;
|
|
6
|
+
endpoint: WebhookEndpointConfig | undefined;
|
|
7
|
+
}
|
|
8
|
+
declare const ConnectionDrawerWebhookSigningKey: FC<ConnectionDrawerWebhookSigningKeyProps>;
|
|
9
|
+
export default ConnectionDrawerWebhookSigningKey;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { formatTimestamp } from "../../../../utils/format.js";
|
|
2
|
+
import { isWebhookPreviousKeyActive } from "../../../../components/webhooks/utils.js";
|
|
3
|
+
import { getErrorMessage } from "../../../../utils/errors.js";
|
|
4
|
+
import ConnectionFormSigningKeyModal from "../form/ConnectionFormSigningKeyModal.js";
|
|
5
|
+
import { useConnectionWebhookKeyMint } from "../../hooks/useConnectionWebhookKeyMint.js";
|
|
6
|
+
import { useConfirm } from "../../../../hooks/useConfirm.js";
|
|
7
|
+
import Button, { ButtonSize } from "@galaxy-io/dls/buttons/Button";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import Flex, { AlignItems, FlexDirection, JustifyContent } from "@galaxy-io/dls/layout/Flex";
|
|
11
|
+
import { ToastVariant } from "@galaxy-io/dls/toast/Toast";
|
|
12
|
+
import { useToast } from "@galaxy-io/dls/toast/useToast";
|
|
13
|
+
import Text, { TextSize, TextVariant, TextWeight } from "@galaxy-io/dls/text/Text";
|
|
14
|
+
import Divider from "@galaxy-io/dls/layout/Divider";
|
|
15
|
+
import ConfirmDialog from "@galaxy-io/dls/modal/ConfirmDialog";
|
|
16
|
+
//#region src/pages/connections/components/drawer/ConnectionDrawerWebhookSigningKey.tsx
|
|
17
|
+
var ConnectionDrawerWebhookSigningKey = ({ connection, endpoint }) => {
|
|
18
|
+
const { toast } = useToast();
|
|
19
|
+
const [reveal, setReveal] = useState();
|
|
20
|
+
const { mintKey, isPending } = useConnectionWebhookKeyMint();
|
|
21
|
+
const hasKey = !!endpoint?.hasSigningSecret;
|
|
22
|
+
const isPreviousKeyActive = isWebhookPreviousKeyActive(endpoint);
|
|
23
|
+
const previousKeyExpiry = formatTimestamp(endpoint?.previousKeyExpiresAt ?? 0n);
|
|
24
|
+
const mintSigningKey = (callbacks) => mintKey(connection, endpoint, {
|
|
25
|
+
onSuccess: (reveal) => {
|
|
26
|
+
setReveal(reveal);
|
|
27
|
+
callbacks.onSuccess();
|
|
28
|
+
},
|
|
29
|
+
onError: callbacks.onError
|
|
30
|
+
});
|
|
31
|
+
const rotateConfirm = useConfirm({
|
|
32
|
+
entityLabel: "Signing key",
|
|
33
|
+
messages: {
|
|
34
|
+
successHeader: "Signing key rotated",
|
|
35
|
+
errorHeader: "Rotate failed",
|
|
36
|
+
errorFallback: "Could not rotate the signing key"
|
|
37
|
+
},
|
|
38
|
+
onConfirm: (_, callbacks) => mintSigningKey(callbacks)
|
|
39
|
+
});
|
|
40
|
+
const handleGenerate = () => mintSigningKey({
|
|
41
|
+
onSuccess: () => void 0,
|
|
42
|
+
onError: (error) => toast({
|
|
43
|
+
variant: ToastVariant.ERROR,
|
|
44
|
+
header: "Generate failed",
|
|
45
|
+
description: getErrorMessage(error, "Could not generate a signing key")
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
49
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
50
|
+
alignItems: AlignItems.STRETCH,
|
|
51
|
+
direction: FlexDirection.COLUMN,
|
|
52
|
+
fillWidth: true,
|
|
53
|
+
children: [/* @__PURE__ */ jsxs(Flex, {
|
|
54
|
+
alignItems: AlignItems.CENTER,
|
|
55
|
+
justifyContent: JustifyContent.SPACE_BETWEEN,
|
|
56
|
+
gap: 12,
|
|
57
|
+
height: 40,
|
|
58
|
+
padding: [0, 12],
|
|
59
|
+
fillWidth: true,
|
|
60
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
61
|
+
size: TextSize.BODY_SM,
|
|
62
|
+
weight: TextWeight.MEDIUM,
|
|
63
|
+
children: "Signing key"
|
|
64
|
+
}), /* @__PURE__ */ jsxs(Flex, {
|
|
65
|
+
alignItems: AlignItems.CENTER,
|
|
66
|
+
gap: 12,
|
|
67
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
68
|
+
size: TextSize.BODY_SM,
|
|
69
|
+
variant: TextVariant.SECONDARY,
|
|
70
|
+
children: hasKey ? "HMAC-SHA256" : "Not set"
|
|
71
|
+
}), hasKey ? /* @__PURE__ */ jsx(Button, {
|
|
72
|
+
label: "Rotate",
|
|
73
|
+
size: ButtonSize.SMALL,
|
|
74
|
+
isDisabled: isPreviousKeyActive,
|
|
75
|
+
tooltip: isPreviousKeyActive ? `Rotate again after ${previousKeyExpiry}` : void 0,
|
|
76
|
+
onClick: () => rotateConfirm.handleOpen(connection)
|
|
77
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
78
|
+
label: "Generate",
|
|
79
|
+
size: ButtonSize.SMALL,
|
|
80
|
+
isLoading: isPending,
|
|
81
|
+
onClick: handleGenerate
|
|
82
|
+
})]
|
|
83
|
+
})]
|
|
84
|
+
}), isPreviousKeyActive && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Divider, {}), /* @__PURE__ */ jsxs(Flex, {
|
|
85
|
+
alignItems: AlignItems.CENTER,
|
|
86
|
+
justifyContent: JustifyContent.SPACE_BETWEEN,
|
|
87
|
+
gap: 12,
|
|
88
|
+
height: 40,
|
|
89
|
+
padding: [0, 12],
|
|
90
|
+
fillWidth: true,
|
|
91
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
92
|
+
size: TextSize.BODY_SM,
|
|
93
|
+
weight: TextWeight.MEDIUM,
|
|
94
|
+
children: "Previous key"
|
|
95
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
96
|
+
size: TextSize.BODY_SM,
|
|
97
|
+
variant: TextVariant.SECONDARY,
|
|
98
|
+
children: ["Works until ", previousKeyExpiry]
|
|
99
|
+
})]
|
|
100
|
+
})] })]
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
103
|
+
isOpen: rotateConfirm.isOpen,
|
|
104
|
+
onOpenChange: (isOpen) => {
|
|
105
|
+
if (!isOpen) rotateConfirm.handleClose();
|
|
106
|
+
},
|
|
107
|
+
onConfirm: rotateConfirm.handleConfirm,
|
|
108
|
+
header: "Rotate signing key?",
|
|
109
|
+
description: "Filament creates a new key and shows it once. The current key keeps working for 72 hours.",
|
|
110
|
+
label: "Rotate key"
|
|
111
|
+
}),
|
|
112
|
+
reveal && /* @__PURE__ */ jsx(ConnectionFormSigningKeyModal, {
|
|
113
|
+
isOpen: true,
|
|
114
|
+
reveal,
|
|
115
|
+
onDone: () => setReveal(void 0)
|
|
116
|
+
})
|
|
117
|
+
] });
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { ConnectionDrawerWebhookSigningKey as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ConnectionFormSigningKeyReveal } from './types';
|
|
3
|
+
interface ConnectionFormSigningKeyModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
reveal: ConnectionFormSigningKeyReveal;
|
|
6
|
+
onDone: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ConnectionFormSigningKeyModal: FC<ConnectionFormSigningKeyModalProps>;
|
|
9
|
+
export default ConnectionFormSigningKeyModal;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import ConnectionFormHeader from "./ConnectionFormHeader.js";
|
|
2
|
+
import ConnectionFormWrapper from "./ConnectionFormWrapper.js";
|
|
3
|
+
import Button from "@galaxy-io/dls/buttons/Button";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import Flex, { AlignItems, FlexDirection, JustifyContent } from "@galaxy-io/dls/layout/Flex";
|
|
7
|
+
import Alert, { AlertVariant } from "@galaxy-io/dls/feedback/Alert";
|
|
8
|
+
import Text from "@galaxy-io/dls/text/Text";
|
|
9
|
+
import CheckboxInput from "@galaxy-io/dls/inputs/CheckboxInput";
|
|
10
|
+
import { FontFamily } from "@galaxy-io/dls/theme/enums";
|
|
11
|
+
import CopyInput from "@galaxy-io/dls/inputs/CopyInput";
|
|
12
|
+
//#region src/pages/connections/components/form/ConnectionFormSigningKeyModal.tsx
|
|
13
|
+
var ConnectionFormSigningKeyModal = ({ isOpen, reveal: { connection, signingKey, deliveryUrl }, onDone }) => {
|
|
14
|
+
const [isStored, setIsStored] = useState(false);
|
|
15
|
+
return /* @__PURE__ */ jsx(ConnectionFormWrapper, {
|
|
16
|
+
isOpen,
|
|
17
|
+
isDismissable: isStored,
|
|
18
|
+
header: /* @__PURE__ */ jsx(ConnectionFormHeader, {
|
|
19
|
+
connectorName: connection.connector,
|
|
20
|
+
connectorKind: connection.kind,
|
|
21
|
+
title: `${connection.name} signing key`
|
|
22
|
+
}),
|
|
23
|
+
footer: /* @__PURE__ */ jsxs(Flex, {
|
|
24
|
+
alignItems: AlignItems.CENTER,
|
|
25
|
+
justifyContent: JustifyContent.SPACE_BETWEEN,
|
|
26
|
+
fillWidth: true,
|
|
27
|
+
children: [/* @__PURE__ */ jsx(CheckboxInput, {
|
|
28
|
+
label: "I stored this key",
|
|
29
|
+
isChecked: isStored,
|
|
30
|
+
onChange: setIsStored
|
|
31
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
32
|
+
label: "Done",
|
|
33
|
+
isDisabled: !isStored,
|
|
34
|
+
onClick: onDone
|
|
35
|
+
})]
|
|
36
|
+
}),
|
|
37
|
+
onClose: onDone,
|
|
38
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
39
|
+
alignItems: AlignItems.STRETCH,
|
|
40
|
+
direction: FlexDirection.COLUMN,
|
|
41
|
+
gap: 16,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Alert, {
|
|
44
|
+
variant: AlertVariant.WARNING,
|
|
45
|
+
header: "Save this key now. It will not be shown again.",
|
|
46
|
+
children: "Add it to the sender that signs your deliveries."
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx(CopyInput, {
|
|
49
|
+
label: "Signing key",
|
|
50
|
+
value: signingKey,
|
|
51
|
+
family: FontFamily.MONO,
|
|
52
|
+
fillWidth: true
|
|
53
|
+
}),
|
|
54
|
+
deliveryUrl ? /* @__PURE__ */ jsx(CopyInput, {
|
|
55
|
+
label: "Delivery URL",
|
|
56
|
+
labelTooltip: "Send each delivery to this URL followed by a resource name, such as /orders. Resources are named in the pipeline that reads this source.",
|
|
57
|
+
value: deliveryUrl,
|
|
58
|
+
family: FontFamily.MONO,
|
|
59
|
+
fillWidth: true
|
|
60
|
+
}) : /* @__PURE__ */ jsx(Text, { children: "Delivery URL unavailable. Configure WEBHOOK_PUBLIC_BASE_URL." })
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { ConnectionFormSigningKeyModal as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import Modal from "@galaxy-io/dls/modal/Modal";
|
|
3
3
|
//#region src/pages/connections/components/form/ConnectionFormWrapper.tsx
|
|
4
|
-
var ConnectionFormWrapper = ({ isOpen, header, footer, onClose, children }) => /* @__PURE__ */ jsx(Modal, {
|
|
4
|
+
var ConnectionFormWrapper = ({ isOpen, header, footer, isDismissable = true, onClose, children }) => /* @__PURE__ */ jsx(Modal, {
|
|
5
5
|
isOpen,
|
|
6
6
|
header,
|
|
7
7
|
footer,
|
|
8
|
+
isDismissable,
|
|
8
9
|
onOpenChange: (isOpen) => {
|
|
9
10
|
if (!isOpen) onClose();
|
|
10
11
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Connection } from '../../../gen/ingestion/v1/connections_pb';
|
|
2
|
+
import { WebhookEndpointConfig } from '../../../gen/ingestion/v1/webhooks_pb';
|
|
3
|
+
import { ConnectionFormSigningKeyReveal } from '../components/form/types';
|
|
4
|
+
interface ConnectionWebhookKeyMintCallbacks {
|
|
5
|
+
onSuccess: (reveal: ConnectionFormSigningKeyReveal) => void;
|
|
6
|
+
onError: (error: unknown) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useConnectionWebhookKeyMint: () => {
|
|
9
|
+
mintKey: (connection: Connection, endpoint: WebhookEndpointConfig | undefined, { onSuccess, onError }: ConnectionWebhookKeyMintCallbacks) => void;
|
|
10
|
+
isPending: boolean;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createPutWebhookEndpointRequest, createWebhookDeliveryBaseUrl } from "../../../components/webhooks/utils.js";
|
|
2
|
+
import { usePutWebhookEndpointMutation } from "../../../api/queries/webhooks.js";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
//#region src/pages/connections/hooks/useConnectionWebhookKeyMint.ts
|
|
5
|
+
var useConnectionWebhookKeyMint = () => {
|
|
6
|
+
const { mutate: putEndpoint, reset, isPending } = usePutWebhookEndpointMutation();
|
|
7
|
+
return {
|
|
8
|
+
mintKey: useCallback((connection, endpoint, { onSuccess, onError }) => putEndpoint(createPutWebhookEndpointRequest({
|
|
9
|
+
sourceConnectionId: connection.id,
|
|
10
|
+
endpoint,
|
|
11
|
+
mintSecret: true
|
|
12
|
+
}), {
|
|
13
|
+
onSuccess: (response) => {
|
|
14
|
+
reset();
|
|
15
|
+
onSuccess({
|
|
16
|
+
connection,
|
|
17
|
+
signingKey: response.mintedSecret,
|
|
18
|
+
deliveryUrl: createWebhookDeliveryBaseUrl(response.endpoint?.deliveryUrl)
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
onError
|
|
22
|
+
}), [putEndpoint, reset]),
|
|
23
|
+
isPending
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useConnectionWebhookKeyMint };
|