@camunda/ccma-saas-frontend 0.21.11 → 0.21.12
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.
|
@@ -32,7 +32,7 @@ export const C4MultiStepModal = ({ title, subtitle, steps, isOpen, onClose, prev
|
|
|
32
32
|
const component = (_jsxs(ComposedModal, { open: isOpen, onClose: onClose,
|
|
33
33
|
// The DS adapter drops `size`. This width class is in the DS stylesheet.
|
|
34
34
|
// The stepper needs room for two steps with a title and a subtitle each.
|
|
35
|
-
className: 'sm:max-w-
|
|
35
|
+
className: 'sm:max-w-200', preventCloseOnClickOutside: preventCloseOnClickOutside ?? false, children: [_jsx(ModalHeader, { title: title, label: subtitle }), _jsx(ModalBody, { children: _jsxs(Stack, { gap: 8, children: [_jsx(Stepper, { currentStep: step, "aria-label": title, children: steps.map((item, index) => (_jsxs(StepperStep, { children: [item.title, item.subtitle && (_jsx("span", { style: { opacity: 0.8 }, children: item.subtitle }))] }, index))) }), currentStep.content, error.length > 0 && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: error }))] }) }), _jsxs(ModalFooter, { children: [_jsx(Button, { kind: secondary.kind, disabled: asyncWork || secondary.disabled, onClick: () => {
|
|
36
36
|
if (step > 0) {
|
|
37
37
|
setError('');
|
|
38
38
|
setStep(step - 1);
|
|
@@ -15,16 +15,16 @@ import { useRef } from 'react';
|
|
|
15
15
|
// compiles to a className with no matching CSS rule at all, silently
|
|
16
16
|
// no-op'ing the width cap (the DialogContent's own unconditional base class,
|
|
17
17
|
// `max-w-[calc(100%-2rem)]`, is all that's left, i.e. full viewport width).
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
18
|
+
// Design system 0.74.0 ships `sm:max-w-sm` and the numeric dialog widths
|
|
19
|
+
// `sm:max-w-100`, `sm:max-w-150` and `sm:max-w-200`. It no longer ships the
|
|
20
|
+
// arbitrary classes `sm:max-w-[400px|600px|800px]` of 0.68.1. Check
|
|
21
|
+
// `dist/styles.css` of the package again after each design system bump, and
|
|
22
|
+
// do not use other max-w-* utilities here.
|
|
23
23
|
const SIZE_CLASS = {
|
|
24
24
|
xs: 'sm:max-w-sm',
|
|
25
|
-
sm: 'sm:max-w-
|
|
26
|
-
md: 'sm:max-w-
|
|
27
|
-
lg: 'sm:max-w-
|
|
25
|
+
sm: 'sm:max-w-100',
|
|
26
|
+
md: 'sm:max-w-150',
|
|
27
|
+
lg: 'sm:max-w-200',
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* Modal API → DS `Dialog`.
|
|
@@ -27,6 +27,13 @@ function renderInlineLink0(value, linkRenderer) {
|
|
|
27
27
|
const [, before, label, after] = match;
|
|
28
28
|
return (_jsxs("span", { children: [before, linkRenderer(label), after] }));
|
|
29
29
|
}
|
|
30
|
+
const SECRETS_RETRY_DELAY_MS = 500;
|
|
31
|
+
// A 4xx answer is final. Anything else (a 5xx from the edge, a dropped
|
|
32
|
+
// connection, an error with no status) is worth one more try before the tab shows its error page.
|
|
33
|
+
function isRetryableSecretsError(error) {
|
|
34
|
+
const status = error?.status;
|
|
35
|
+
return typeof status !== 'number' || status >= 500;
|
|
36
|
+
}
|
|
30
37
|
const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
31
38
|
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, clusterSecretsDocsUrl, t, onNavigate, useClusterSecretsLabel, permissionsLoading = false, scope = 'cluster', onPanelState, } = props;
|
|
32
39
|
const pickValue = (condition, defaultValue, alternateValue) => (condition ? alternateValue : defaultValue);
|
|
@@ -64,6 +71,11 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
64
71
|
const [connectorSecretsError, setConnectorSecretsError] = useState(false);
|
|
65
72
|
const connectorSecretsLoadedRef = useRef(false);
|
|
66
73
|
const connectorSecretsLoadingRef = useRef(false);
|
|
74
|
+
const connectorSecretsReloadQueuedRef = useRef(false);
|
|
75
|
+
// A ref, so a new `runtime` object does not change `reloadConnectorSecrets`
|
|
76
|
+
// and refetch the list.
|
|
77
|
+
const telemetryRef = useRef(runtime.telemetry);
|
|
78
|
+
telemetryRef.current = runtime.telemetry;
|
|
67
79
|
// Modal states
|
|
68
80
|
const [secretCreateOpen, setSecretCreateOpen] = useState(false);
|
|
69
81
|
const [secretUpdateOpen, setSecretUpdateOpen] = useState(false);
|
|
@@ -90,24 +102,43 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
90
102
|
const [sourceClusterSecrets, setSourceClusterSecrets] = useState({});
|
|
91
103
|
const [fetchingSourceSecrets, setFetchingSourceSecrets] = useState(false);
|
|
92
104
|
const [sourceClusterInvalid, setSourceClusterInvalid] = useState(false);
|
|
93
|
-
const reloadConnectorSecrets = useCallback(async ()
|
|
105
|
+
const reloadConnectorSecrets = useCallback(async function run() {
|
|
94
106
|
if (!canReadSecrets) {
|
|
95
107
|
return;
|
|
96
108
|
}
|
|
109
|
+
// An SSE bump can arrive while a load runs. That load may have read the
|
|
110
|
+
// list before the change, so run once more when it ends.
|
|
97
111
|
if (connectorSecretsLoadingRef.current) {
|
|
112
|
+
connectorSecretsReloadQueuedRef.current = true;
|
|
98
113
|
return;
|
|
99
114
|
}
|
|
100
115
|
connectorSecretsLoadingRef.current = true;
|
|
101
116
|
setConnectorSecretsLoading(true);
|
|
102
117
|
setConnectorSecretsError(false);
|
|
118
|
+
const fetchAll = () => ConsoleConnectorSecretsService.getAll({
|
|
119
|
+
config: apiConfig,
|
|
120
|
+
params: { orgId, clusterId },
|
|
121
|
+
});
|
|
103
122
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
123
|
+
let loaded;
|
|
124
|
+
try {
|
|
125
|
+
loaded = await fetchAll();
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (!isRetryableSecretsError(error)) {
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
await new Promise((resolve) => setTimeout(resolve, SECRETS_RETRY_DELAY_MS));
|
|
132
|
+
loaded = await fetchAll();
|
|
133
|
+
}
|
|
108
134
|
setConnectorSecretsMap(loaded);
|
|
109
135
|
}
|
|
110
|
-
catch {
|
|
136
|
+
catch (error) {
|
|
137
|
+
telemetryRef.current?.captureException?.(error, {
|
|
138
|
+
source: 'connector-secrets-tab:load',
|
|
139
|
+
orgId,
|
|
140
|
+
clusterId,
|
|
141
|
+
});
|
|
111
142
|
setConnectorSecretsError(true);
|
|
112
143
|
setConnectorSecretsMap({});
|
|
113
144
|
}
|
|
@@ -115,8 +146,15 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
115
146
|
connectorSecretsLoadedRef.current = true;
|
|
116
147
|
connectorSecretsLoadingRef.current = false;
|
|
117
148
|
setConnectorSecretsLoading(false);
|
|
149
|
+
if (connectorSecretsReloadQueuedRef.current) {
|
|
150
|
+
connectorSecretsReloadQueuedRef.current = false;
|
|
151
|
+
void latestReloadRef.current?.();
|
|
152
|
+
}
|
|
118
153
|
}
|
|
119
154
|
}, [apiConfig, canReadSecrets, clusterId, orgId]);
|
|
155
|
+
// The queued run must use the inputs of now, not those of the load that ends.
|
|
156
|
+
const latestReloadRef = useRef(undefined);
|
|
157
|
+
latestReloadRef.current = reloadConnectorSecrets;
|
|
120
158
|
const exportConnectorSecrets = useCallback(async () => {
|
|
121
159
|
if (!connectorSecretsLoadedRef.current) {
|
|
122
160
|
await reloadConnectorSecrets();
|
|
@@ -144,10 +182,14 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
144
182
|
setConnectorSecretsError(false);
|
|
145
183
|
void reloadConnectorSecrets();
|
|
146
184
|
}, [reloadConnectorSecrets]);
|
|
185
|
+
// A bump during the first load must queue a reload too, so only a version
|
|
186
|
+
// that did not change skips the reload. The effect above loads on mount.
|
|
187
|
+
const seenSseSecretsVersionRef = useRef(sseSecretsVersion);
|
|
147
188
|
useEffect(() => {
|
|
148
|
-
if (
|
|
189
|
+
if (seenSseSecretsVersionRef.current === sseSecretsVersion) {
|
|
149
190
|
return;
|
|
150
191
|
}
|
|
192
|
+
seenSseSecretsVersionRef.current = sseSecretsVersion;
|
|
151
193
|
void reloadConnectorSecrets();
|
|
152
194
|
}, [reloadConnectorSecrets, sseSecretsVersion]);
|
|
153
195
|
// Secrets prefixed with 'CAMUNDA_PROVIDED_' are system-managed and should be
|