@camunda/ccma-saas-frontend 0.17.6 → 0.18.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/lib/esm/components/c4-cluster-list/c4-cluster-expiry-tag.d.ts +10 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-expiry-tag.js +27 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +13 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +6 -0
- package/lib/esm/components/c4-cluster-list/cluster-expiry-tag.d.ts +49 -0
- package/lib/esm/components/c4-cluster-list/cluster-expiry-tag.js +55 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-ttl-section.d.ts +29 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-ttl-section.js +14 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +74 -2
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.d.ts +3 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.js +35 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +62 -0
- package/lib/esm/i18n/c4-console-i18n.js +6 -0
- package/lib/esm/i18n/en/pages/createcluster.json +29 -0
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +3 -0
- package/lib/esm/widgets/clusters/c4-clusters-page.js +46 -2
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +29 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +122 -1
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ClusterExpiryTag } from './cluster-expiry-tag.js';
|
|
3
|
+
/**
|
|
4
|
+
* C4ClusterExpiryTag shows when a cluster expires, as a short tag. The `title`
|
|
5
|
+
* gives the exact date to a mouse user. A screen reader gets the exact date as
|
|
6
|
+
* hidden text, because a keyboard cannot open a `title`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const C4ClusterExpiryTag: ({ expiry, }: {
|
|
9
|
+
expiry: ClusterExpiryTag;
|
|
10
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
3
|
+
import { Tag } from '../../ui/index.js';
|
|
4
|
+
// Hides the text on the screen but keeps it for screen readers. An inline style
|
|
5
|
+
// works in Carbon mode and in ds mode, thus the tag needs no class of either.
|
|
6
|
+
const VISUALLY_HIDDEN = {
|
|
7
|
+
position: 'absolute',
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
margin: -1,
|
|
11
|
+
padding: 0,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
border: 0,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* C4ClusterExpiryTag shows when a cluster expires, as a short tag. The `title`
|
|
19
|
+
* gives the exact date to a mouse user. A screen reader gets the exact date as
|
|
20
|
+
* hidden text, because a keyboard cannot open a `title`.
|
|
21
|
+
*/
|
|
22
|
+
export const C4ClusterExpiryTag = ({ expiry, }) => {
|
|
23
|
+
const designSystem = useC4DesignSystem();
|
|
24
|
+
return (_jsxs(Tag, { type: expiry.soon ? 'red' : 'gray',
|
|
25
|
+
// The DS adapter has no size and warns about each prop that it drops.
|
|
26
|
+
size: designSystem === 'ds' ? undefined : 'sm', children: [_jsx("span", { title: expiry.title, children: expiry.label }), _jsx("span", { style: VISUALLY_HIDDEN, children: ` ${expiry.title}` })] }));
|
|
27
|
+
};
|
|
@@ -9,6 +9,7 @@ import { C4DataTable } from '../c4-data-table/c4-data-table.js';
|
|
|
9
9
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
10
10
|
import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
11
11
|
import { C4PageTemplate } from '../c4-page-template/c4-page-template.js';
|
|
12
|
+
import { C4ClusterExpiryTag } from './c4-cluster-expiry-tag.js';
|
|
12
13
|
import { buildClusterListFilters } from './cluster-list-filters.js';
|
|
13
14
|
// ds-only column-width hints (see `docs/c4-carbon-compat.md`) so the Status
|
|
14
15
|
// column has room for its icon + label and doesn't wrap on narrower (~14")
|
|
@@ -298,7 +299,18 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
298
299
|
options: {
|
|
299
300
|
wrapperOptions: {
|
|
300
301
|
wrapper: (row) => {
|
|
301
|
-
|
|
302
|
+
const stageTag = row.tags?.length > 0 ? (_jsx(ClusterTag, { stage: row.tags[0] })) : (permissions.canUpdateTag && (_jsx(C4LinkButton, { label: translations.tags.addLabel, onClick: () => onAssignTag(row.id), disabled: !permissions.canUpdateTag, style: { alignSelf: 'center' }, icon: _jsx(Add, {}) })));
|
|
303
|
+
// A row with no expiry keeps the cell it had before the
|
|
304
|
+
// expiry existed, in both modes.
|
|
305
|
+
if (!row.expiry) {
|
|
306
|
+
return stageTag;
|
|
307
|
+
}
|
|
308
|
+
return (_jsxs("span", { style: {
|
|
309
|
+
display: 'inline-flex',
|
|
310
|
+
flexWrap: 'wrap',
|
|
311
|
+
alignItems: 'center',
|
|
312
|
+
gap: '0.25rem',
|
|
313
|
+
}, children: [stageTag, _jsx(C4ClusterExpiryTag, { expiry: row.expiry })] }));
|
|
302
314
|
},
|
|
303
315
|
},
|
|
304
316
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { C4WidgetScope } from '../../widgets/c4-widget-scope.types.js';
|
|
2
|
+
import type { ClusterExpiryTag } from './cluster-expiry-tag.js';
|
|
2
3
|
export interface ClusterListItem {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
@@ -14,6 +15,11 @@ export interface ClusterListItem {
|
|
|
14
15
|
status: 'healthy' | 'unhealthy' | 'creating' | 'updating' | 'waitingForInput' | 'suspended' | 'resuming' | 'deleting' | string;
|
|
15
16
|
statusInfoTooltip?: string;
|
|
16
17
|
tags: string[];
|
|
18
|
+
/**
|
|
19
|
+
* The expiry tag. The page sets it only for a cluster that expires, and only
|
|
20
|
+
* when the backend sent the expiry to this reader.
|
|
21
|
+
*/
|
|
22
|
+
expiry?: ClusterExpiryTag;
|
|
17
23
|
currentClusterLoad?: number;
|
|
18
24
|
originalIndex?: number;
|
|
19
25
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClusterExpiryRemaining is the time until a cluster expires, rounded down to
|
|
3
|
+
* whole days, or to whole hours under one day. `soon` covers less than one
|
|
4
|
+
* hour and an expiry in the past: the cluster still exists until the next
|
|
5
|
+
* delete run.
|
|
6
|
+
*/
|
|
7
|
+
export type ClusterExpiryRemaining = {
|
|
8
|
+
unit: 'days';
|
|
9
|
+
count: number;
|
|
10
|
+
} | {
|
|
11
|
+
unit: 'hours';
|
|
12
|
+
count: number;
|
|
13
|
+
} | {
|
|
14
|
+
unit: 'soon';
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* getClusterExpiryRemaining gives `undefined` when `expiresAt` is absent or is
|
|
18
|
+
* not a date, thus a cluster with no expiry shows no tag.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getClusterExpiryRemaining(expiresAt: string | undefined, now: Date): ClusterExpiryRemaining | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* ClusterExpiryTagCopy is the copy of the expiry tag. `days` and `hours` hold
|
|
23
|
+
* `{{count}}`, and `title` holds `{{date}}`.
|
|
24
|
+
*/
|
|
25
|
+
export interface ClusterExpiryTagCopy {
|
|
26
|
+
days: string;
|
|
27
|
+
hours: string;
|
|
28
|
+
soon: string;
|
|
29
|
+
title: string;
|
|
30
|
+
}
|
|
31
|
+
/** ClusterExpiryTag is what the cluster list shows for one cluster. */
|
|
32
|
+
export interface ClusterExpiryTag {
|
|
33
|
+
label: string;
|
|
34
|
+
/** The exact expiry, for the tooltip. */
|
|
35
|
+
title: string;
|
|
36
|
+
/** True under one hour. The list then shows the tag in red. */
|
|
37
|
+
soon: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare const DEFAULT_CLUSTER_EXPIRY_TAG_COPY: ClusterExpiryTagCopy;
|
|
40
|
+
/**
|
|
41
|
+
* getClusterExpiryTag gives the tag of a cluster that expires at `expiresAt`,
|
|
42
|
+
* or `undefined` for a cluster with no expiry.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getClusterExpiryTag({ expiresAt, now, copy, formatDate, }: {
|
|
45
|
+
expiresAt: string | undefined;
|
|
46
|
+
now: Date;
|
|
47
|
+
copy?: ClusterExpiryTagCopy;
|
|
48
|
+
formatDate?: (date: Date) => string;
|
|
49
|
+
}): ClusterExpiryTag | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
const HOUR_MS = 60 * 60 * 1000;
|
|
7
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
8
|
+
/**
|
|
9
|
+
* getClusterExpiryRemaining gives `undefined` when `expiresAt` is absent or is
|
|
10
|
+
* not a date, thus a cluster with no expiry shows no tag.
|
|
11
|
+
*/
|
|
12
|
+
export function getClusterExpiryRemaining(expiresAt, now) {
|
|
13
|
+
if (!expiresAt) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const expiresMs = new Date(expiresAt).getTime();
|
|
17
|
+
if (Number.isNaN(expiresMs)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const remainingMs = expiresMs - now.getTime();
|
|
21
|
+
if (remainingMs >= DAY_MS) {
|
|
22
|
+
return { unit: 'days', count: Math.floor(remainingMs / DAY_MS) };
|
|
23
|
+
}
|
|
24
|
+
if (remainingMs >= HOUR_MS) {
|
|
25
|
+
return { unit: 'hours', count: Math.floor(remainingMs / HOUR_MS) };
|
|
26
|
+
}
|
|
27
|
+
return { unit: 'soon' };
|
|
28
|
+
}
|
|
29
|
+
export const DEFAULT_CLUSTER_EXPIRY_TAG_COPY = {
|
|
30
|
+
days: 'Expires in {{count}}d',
|
|
31
|
+
hours: 'Expires in {{count}}h',
|
|
32
|
+
soon: 'Expires soon',
|
|
33
|
+
title: 'Expires on {{date}}',
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* getClusterExpiryTag gives the tag of a cluster that expires at `expiresAt`,
|
|
37
|
+
* or `undefined` for a cluster with no expiry.
|
|
38
|
+
*/
|
|
39
|
+
export function getClusterExpiryTag({ expiresAt, now, copy = DEFAULT_CLUSTER_EXPIRY_TAG_COPY, formatDate = (date) => date.toLocaleString(undefined, {
|
|
40
|
+
dateStyle: 'medium',
|
|
41
|
+
timeStyle: 'short',
|
|
42
|
+
}), }) {
|
|
43
|
+
const remaining = getClusterExpiryRemaining(expiresAt, now);
|
|
44
|
+
if (!remaining || !expiresAt) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const label = remaining.unit === 'soon'
|
|
48
|
+
? copy.soon
|
|
49
|
+
: copy[remaining.unit].replace('{{count}}', String(remaining.count));
|
|
50
|
+
return {
|
|
51
|
+
label,
|
|
52
|
+
title: copy.title.replace('{{date}}', formatDate(new Date(expiresAt))),
|
|
53
|
+
soon: remaining.unit === 'soon',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ClusterTtlOption } from '@camunda/ccma-shared-types';
|
|
2
|
+
import type { JSX, RefObject } from 'react';
|
|
3
|
+
import type { C4CreateClusterTtlFormElement, C4CreateClusterTtlUnlimitedErrors } from './c4-create-cluster.types.js';
|
|
4
|
+
export interface C4CreateClusterTtlSectionProps {
|
|
5
|
+
ttl: C4CreateClusterTtlFormElement;
|
|
6
|
+
value: ClusterTtlOption | undefined;
|
|
7
|
+
onChange: (value: ClusterTtlOption) => void;
|
|
8
|
+
unlimitedReason: string;
|
|
9
|
+
onUnlimitedReasonChange: (value: string) => void;
|
|
10
|
+
unlimitedLink: string;
|
|
11
|
+
onUnlimitedLinkChange: (value: string) => void;
|
|
12
|
+
errors: C4CreateClusterTtlUnlimitedErrors;
|
|
13
|
+
/**
|
|
14
|
+
* The form keeps the expiry of the source cluster. The section then shows
|
|
15
|
+
* `ttl.unlimited.fromSourceText` above the reason.
|
|
16
|
+
*/
|
|
17
|
+
keepsSourceTtl?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** The form moves the focus here when the reason stops the submit. */
|
|
20
|
+
reasonFieldRef?: RefObject<HTMLDivElement | null>;
|
|
21
|
+
/** The form moves the focus here when the link stops the submit. */
|
|
22
|
+
linkFieldRef?: RefObject<HTMLDivElement | null>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* C4CreateClusterTtlSection is the body of the expiry section of the create
|
|
26
|
+
* form: the choice of the expiry and, for `unlimited`, the reason and the
|
|
27
|
+
* link. The form renders the title of the section.
|
|
28
|
+
*/
|
|
29
|
+
export declare const C4CreateClusterTtlSection: ({ ttl, value, onChange, unlimitedReason, onUnlimitedReasonChange, unlimitedLink, onUnlimitedLinkChange, errors, keepsSourceTtl, disabled, reasonFieldRef, linkFieldRef, }: C4CreateClusterTtlSectionProps) => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, TextInput } from '../../ui/index.js';
|
|
3
|
+
import { C4CreateClusterTileGrid } from './c4-create-cluster-tile-grid.js';
|
|
4
|
+
/**
|
|
5
|
+
* C4CreateClusterTtlSection is the body of the expiry section of the create
|
|
6
|
+
* form: the choice of the expiry and, for `unlimited`, the reason and the
|
|
7
|
+
* link. The form renders the title of the section.
|
|
8
|
+
*/
|
|
9
|
+
export const C4CreateClusterTtlSection = ({ ttl, value, onChange, unlimitedReason, onUnlimitedReasonChange, unlimitedLink, onUnlimitedLinkChange, errors, keepsSourceTtl, disabled, reasonFieldRef, linkFieldRef, }) => (_jsxs(Stack, { gap: 4, children: [_jsx(C4CreateClusterTileGrid, { items: ttl.options, getKey: (option) => option.value, getLabel: (option) => option.label, getDisabled: () => Boolean(disabled), value: value, onChange: (selected) => {
|
|
10
|
+
const option = ttl.options.find((candidate) => candidate.value === selected);
|
|
11
|
+
if (option) {
|
|
12
|
+
onChange(option.value);
|
|
13
|
+
}
|
|
14
|
+
}, ariaLabel: ttl.title, columnWidth: '160px' }), _jsx("p", { children: ttl.description }), value === 'unlimited' && (_jsx("div", { style: { maxWidth: '40rem' }, children: _jsxs(Stack, { gap: 5, children: [keepsSourceTtl && ttl.unlimited.fromSourceText && (_jsx("p", { children: ttl.unlimited.fromSourceText })), _jsx("div", { ref: reasonFieldRef, children: _jsx(TextInput, { id: 'cluster-ttl-unlimited-reason', labelText: ttl.unlimited.reason.label, placeholder: ttl.unlimited.reason.placeholder, value: unlimitedReason, invalid: Boolean(errors.reason), invalidText: errors.reason, disabled: disabled, autoComplete: 'off', onChange: (event) => onUnlimitedReasonChange(event.target.value) }) }), _jsx("div", { ref: linkFieldRef, children: _jsx(TextInput, { id: 'cluster-ttl-unlimited-link', type: 'url', labelText: ttl.unlimited.link.label, placeholder: ttl.unlimited.link.placeholder, helperText: ttl.unlimited.link.helperText, value: unlimitedLink, invalid: Boolean(errors.link), invalidText: errors.link, disabled: disabled, autoComplete: 'off', onChange: (event) => onUnlimitedLinkChange(event.target.value) }) })] }) }))] }));
|
|
@@ -17,6 +17,7 @@ import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
|
17
17
|
import { C4SegmentedControl } from '../c4-segmented-control/c4-segmented-control.js';
|
|
18
18
|
import { C4SelectableTile } from '../c4-selectable-tile/c4-selectable-tile.js';
|
|
19
19
|
import { C4CreateClusterTileGrid } from './c4-create-cluster-tile-grid.js';
|
|
20
|
+
import { C4CreateClusterTtlSection } from './c4-create-cluster-ttl-section.js';
|
|
20
21
|
var TasklistMode;
|
|
21
22
|
(function (TasklistMode) {
|
|
22
23
|
TasklistMode["V1"] = "v1";
|
|
@@ -114,6 +115,8 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
114
115
|
const clusterNameInputFieldRef = useRef(null);
|
|
115
116
|
const clusterDescriptionInputFieldRef = useRef(null);
|
|
116
117
|
const regionSectionRef = useRef(null);
|
|
118
|
+
const ttlUnlimitedReasonFieldRef = useRef(null);
|
|
119
|
+
const ttlUnlimitedLinkFieldRef = useRef(null);
|
|
117
120
|
// Each `initialValues` lookup below falls back to the normal default when it
|
|
118
121
|
// finds no option of that uuid. An org can lose access to the generation or
|
|
119
122
|
// the region of the source cluster, and the form must still open.
|
|
@@ -132,6 +135,19 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
132
135
|
const [clusterPlanType, setClusterPlanType] = useState(defaultClusterPlanType ? defaultClusterPlanType?.uuid : '');
|
|
133
136
|
const [selectedTag, setSelectedTag] = useState(initialValues?.stageLabel ?? 'dev');
|
|
134
137
|
const [showOlderGenerations, setShowOlderGenerations] = useState(false);
|
|
138
|
+
const [ttl, setTtl] = useState(formElements.ttl
|
|
139
|
+
? (formElements.ttl.options.find((option) => option.value === initialValues?.ttl)?.value ?? formElements.ttl.defaultValue)
|
|
140
|
+
: undefined);
|
|
141
|
+
const [ttlUnlimitedReason, setTtlUnlimitedReason] = useState(initialValues?.ttlUnlimitedReason ?? '');
|
|
142
|
+
const [ttlUnlimitedLink, setTtlUnlimitedLink] = useState(initialValues?.ttlUnlimitedLink ?? '');
|
|
143
|
+
const [ttlUnlimitedErrors, setTtlUnlimitedErrors] = useState({});
|
|
144
|
+
// See `C4CreateClusterCtaParameters.ttlFromSource`. A reason or a link that
|
|
145
|
+
// the customer enters replaces the expiry of the source, and is then
|
|
146
|
+
// validated as usual.
|
|
147
|
+
const keepsSourceTtl = initialValues?.ttlFromSource === true &&
|
|
148
|
+
ttl === 'unlimited' &&
|
|
149
|
+
ttlUnlimitedReason.trim() === '' &&
|
|
150
|
+
ttlUnlimitedLink.trim() === '';
|
|
135
151
|
const currentClusterPlanType = (clusterPlanType || defaultClusterPlanType?.uuid) ?? '';
|
|
136
152
|
const setClusterPlanTypeWithEffects = (clusterPlanTypeUuid) => {
|
|
137
153
|
updateNumberOfAllocatedHwPackages(1);
|
|
@@ -271,6 +287,11 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
271
287
|
const updateEncryption = (value) => {
|
|
272
288
|
setEncryption(value);
|
|
273
289
|
};
|
|
290
|
+
const updateTtl = (value) => {
|
|
291
|
+
setTtl(value);
|
|
292
|
+
setTtlUnlimitedErrors({});
|
|
293
|
+
setSubmitBlockedMessage(undefined);
|
|
294
|
+
};
|
|
274
295
|
const updateClusterName = (name) => {
|
|
275
296
|
setClusterNameValidation({ isValid: true, message: '' });
|
|
276
297
|
setSubmitBlockedMessage(undefined);
|
|
@@ -324,8 +345,17 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
324
345
|
stageTag: selectedTag,
|
|
325
346
|
encryption,
|
|
326
347
|
provider: foundRegion ? foundRegion.provider : undefined,
|
|
348
|
+
ttl: getTtlSummary(),
|
|
327
349
|
};
|
|
328
350
|
};
|
|
351
|
+
const getTtlSummary = () => {
|
|
352
|
+
const label = formElements.ttl?.options.find((option) => option.value === ttl)?.label;
|
|
353
|
+
if (!label) {
|
|
354
|
+
return '-';
|
|
355
|
+
}
|
|
356
|
+
const reason = ttlUnlimitedReason.trim();
|
|
357
|
+
return ttl === 'unlimited' && reason ? `${label} (${reason})` : label;
|
|
358
|
+
};
|
|
329
359
|
const isSubmitting = () => {
|
|
330
360
|
return submitState === 'submitting';
|
|
331
361
|
};
|
|
@@ -357,6 +387,21 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
357
387
|
revealValidationError(regionSectionRef, regionMessage);
|
|
358
388
|
return;
|
|
359
389
|
}
|
|
390
|
+
if (formElements.ttl && ttl === 'unlimited' && !keepsSourceTtl) {
|
|
391
|
+
const ttlErrors = formElements.ttl.unlimited.validation({
|
|
392
|
+
reason: ttlUnlimitedReason,
|
|
393
|
+
link: ttlUnlimitedLink,
|
|
394
|
+
});
|
|
395
|
+
setTtlUnlimitedErrors(ttlErrors);
|
|
396
|
+
if (ttlErrors.reason) {
|
|
397
|
+
revealValidationError(ttlUnlimitedReasonFieldRef, ttlErrors.reason);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (ttlErrors.link) {
|
|
401
|
+
revealValidationError(ttlUnlimitedLinkFieldRef, ttlErrors.link);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
360
405
|
// A replace deletes the source cluster and its data. The customer confirms
|
|
361
406
|
// that in the modal below, which then calls `submitForm`.
|
|
362
407
|
if (duplicate?.replace?.checked) {
|
|
@@ -395,6 +440,13 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
395
440
|
identityBackendChecksEnabled: authorizationToggle?.enabled && generationIs8_8OrAbove()
|
|
396
441
|
? authorizationEnabled
|
|
397
442
|
: undefined,
|
|
443
|
+
...(formElements.ttl && ttl && !keepsSourceTtl && { ttl }),
|
|
444
|
+
...(formElements.ttl &&
|
|
445
|
+
ttl === 'unlimited' &&
|
|
446
|
+
!keepsSourceTtl && {
|
|
447
|
+
ttlUnlimitedReason: ttlUnlimitedReason.trim(),
|
|
448
|
+
ttlUnlimitedLink: ttlUnlimitedLink.trim(),
|
|
449
|
+
}),
|
|
398
450
|
});
|
|
399
451
|
if (success.success) {
|
|
400
452
|
setSubmitState('success');
|
|
@@ -479,12 +531,32 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
479
531
|
overflow: 'hidden',
|
|
480
532
|
zIndex: 1,
|
|
481
533
|
minHeight: '572px',
|
|
482
|
-
}, children: [_jsxs("div", { children: [_jsx("h6", { style: summaryHeadingStyle, children: "Summary" }), _jsx(C4Divider, {}), _jsxs(Stack, { gap: 4, children: [loading ? (_jsx(SkeletonText, {})) : (_jsxs("h6", { style: summaryHeadingStyle, children: [summary.clusterPlanType, " - ", numberOfAllocatedHwPackages, "x"] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Backup region" }), loading ? _jsx(SkeletonText, {}) : summary.backup] })), summary.encryption && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: encryptions?.title ?? 'Encryption at rest' }), loading ? _jsx(SkeletonText, {}) : summary.encryption] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Channel" }), loading ? _jsx(SkeletonText, {}) : summary.channel] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Generation" }), loading ? _jsx(SkeletonText, {}) : summary.generation] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Cluster tag" }), loading ? (_jsx(SkeletonText, {})) : (_jsx("span", { children: _jsx(ClusterTag, { stage: summary.stageTag }) }))] })] })] }), !loading && (_jsx("div", { style: { alignSelf: 'end' }, children: _jsx("div", { children: _jsxs(Stack, { gap: 3, children: [submitBlockedMessage && submitState === 'idle' && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, hideCloseButton: true, style: { minWidth: '0' }, title: submitBlockedMessage })), ['submitting', 'success', 'error'].includes(submitState) ? (_jsx(InlineLoading, { description: submitStateDescription, status: getInlineStatusByState(submitState), style: { marginLeft: '1rem' } })) : (_jsx(Button, { disabled: !clusterCreationAllowed(), style: { width: '100%' }, onClick: handleSubmit, children: cta.label })), cta.cancel && (_jsx(Button, { onClick: () => {
|
|
534
|
+
}, children: [_jsxs("div", { children: [_jsx("h6", { style: summaryHeadingStyle, children: "Summary" }), _jsx(C4Divider, {}), _jsxs(Stack, { gap: 4, children: [loading ? (_jsx(SkeletonText, {})) : (_jsxs("h6", { style: summaryHeadingStyle, children: [summary.clusterPlanType, " - ", numberOfAllocatedHwPackages, "x"] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Backup region" }), loading ? _jsx(SkeletonText, {}) : summary.backup] })), summary.encryption && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: encryptions?.title ?? 'Encryption at rest' }), loading ? _jsx(SkeletonText, {}) : summary.encryption] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Channel" }), loading ? _jsx(SkeletonText, {}) : summary.channel] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Generation" }), loading ? _jsx(SkeletonText, {}) : summary.generation] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Cluster tag" }), loading ? (_jsx(SkeletonText, {})) : (_jsx("span", { children: _jsx(ClusterTag, { stage: summary.stageTag }) }))] }), formElements.ttl && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: formElements.ttl.summaryLabel }), _jsx("span", { style: { overflowWrap: 'anywhere' }, children: summary.ttl })] }))] })] }), !loading && (_jsx("div", { style: { alignSelf: 'end' }, children: _jsx("div", { children: _jsxs(Stack, { gap: 3, children: [submitBlockedMessage && submitState === 'idle' && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, hideCloseButton: true, style: { minWidth: '0' }, title: submitBlockedMessage })), ['submitting', 'success', 'error'].includes(submitState) ? (_jsx(InlineLoading, { description: submitStateDescription, status: getInlineStatusByState(submitState), style: { marginLeft: '1rem' } })) : (_jsx(Button, { disabled: !clusterCreationAllowed(), style: { width: '100%' }, onClick: handleSubmit, children: cta.label })), cta.cancel && (_jsx(Button, { onClick: () => {
|
|
483
535
|
if (cta.cancel) {
|
|
484
536
|
cta.cancel.onClick();
|
|
485
537
|
}
|
|
486
538
|
}, disabled: submitState !== 'idle', kind: 'secondary', style: { width: '100%' }, children: cta.cancel.label })), cta.help && (_jsxs("p", { children: [cta.help.prefix, ' ', _jsx(Link, { href: cta.help.href, target: '_blank', children: cta.help.label })] }))] }) }) }))] }));
|
|
487
539
|
};
|
|
540
|
+
const renderTtlSection = () => {
|
|
541
|
+
if (!formElements.ttl) {
|
|
542
|
+
return undefined;
|
|
543
|
+
}
|
|
544
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.ttl.title }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4CreateClusterTtlSection, { ttl: formElements.ttl, value: ttl, onChange: updateTtl, unlimitedReason: ttlUnlimitedReason, onUnlimitedReasonChange: (value) => {
|
|
545
|
+
setTtlUnlimitedReason(value);
|
|
546
|
+
setTtlUnlimitedErrors((errors) => ({
|
|
547
|
+
...errors,
|
|
548
|
+
reason: undefined,
|
|
549
|
+
}));
|
|
550
|
+
setSubmitBlockedMessage(undefined);
|
|
551
|
+
}, unlimitedLink: ttlUnlimitedLink, onUnlimitedLinkChange: (value) => {
|
|
552
|
+
setTtlUnlimitedLink(value);
|
|
553
|
+
setTtlUnlimitedErrors((errors) => ({
|
|
554
|
+
...errors,
|
|
555
|
+
link: undefined,
|
|
556
|
+
}));
|
|
557
|
+
setSubmitBlockedMessage(undefined);
|
|
558
|
+
}, errors: ttlUnlimitedErrors, keepsSourceTtl: keepsSourceTtl, disabled: isSubmitting() || noAvailableSlots, reasonFieldRef: ttlUnlimitedReasonFieldRef, linkFieldRef: ttlUnlimitedLinkFieldRef }) }) })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) })] }));
|
|
559
|
+
};
|
|
488
560
|
const renderTasklistV2Content = () => {
|
|
489
561
|
if (!(tasklistModeToggle?.enabled && generationIs8_8OrAboveAndLessThan8_10())) {
|
|
490
562
|
return null;
|
|
@@ -667,7 +739,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
667
739
|
}
|
|
668
740
|
}, save: { allowed: !noAvailableSlots }, currentStage: selectedTag, allowedTags: selectedPlan?.type
|
|
669
741
|
? enableMap[selectedPlan?.type]
|
|
670
|
-
: enableMap.prod }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.stageLabel.textBelow }) }) })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: designSystem === 'ds'
|
|
742
|
+
: enableMap.prod }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.stageLabel.textBelow }) }) })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), renderTtlSection(), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: designSystem === 'ds'
|
|
671
743
|
? { marginBottom: '0.5rem' }
|
|
672
744
|
: { overflowX: 'auto', marginBottom: '0.5rem' }, children: _jsx(C4SegmentedControl, { options: formElements.generation.channels.map((channel) => ({
|
|
673
745
|
id: channel.uuid,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterProps, C4CreateClusterRegion } from './c4-create-cluster.types.js';
|
|
1
|
+
import type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterProps, C4CreateClusterRegion, C4CreateClusterTtlFormElement } from './c4-create-cluster.types.js';
|
|
2
2
|
export declare const stageLabel: {
|
|
3
3
|
title: string;
|
|
4
4
|
textBelow: string;
|
|
@@ -62,4 +62,6 @@ export declare const CLUSTER_NAME: {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
export declare const backupDescription = "Choose single region to keep your data in one place, or dual region for higher redundancy across geographically separate locations. Some dual-region locations also support cross-region cold recovery, while others only keep a secondary copy of your backups.";
|
|
65
|
+
/** The expiry section, with the copy and the rules of the create page. */
|
|
66
|
+
export declare const ttlFormElement: C4CreateClusterTtlFormElement;
|
|
65
67
|
export declare const basicCreateClusterProps: C4CreateClusterProps;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
|
+
import { isHttpUrl } from '@camunda/ccma-shared-types';
|
|
6
7
|
export const stageLabel = {
|
|
7
8
|
title: 'Cluster tag',
|
|
8
9
|
textBelow: 'Assign a tag to make it easier for team members to clearly distinguish between different stages of the software development lifecycle. Tags can be changed later.',
|
|
@@ -268,6 +269,40 @@ export const CLUSTER_NAME = {
|
|
|
268
269
|
};
|
|
269
270
|
// The page adds a "Learn more" link after this text. The component does not.
|
|
270
271
|
export const backupDescription = 'Choose single region to keep your data in one place, or dual region for higher redundancy across geographically separate locations. Some dual-region locations also support cross-region cold recovery, while others only keep a secondary copy of your backups.';
|
|
272
|
+
/** The expiry section, with the copy and the rules of the create page. */
|
|
273
|
+
export const ttlFormElement = {
|
|
274
|
+
title: 'Expiry',
|
|
275
|
+
description: 'When the cluster expires, Camunda deletes it and all of its data.',
|
|
276
|
+
options: [
|
|
277
|
+
{ value: '24h', label: '24 hours' },
|
|
278
|
+
{ value: '3d', label: '3 days' },
|
|
279
|
+
{ value: '1w', label: '1 week' },
|
|
280
|
+
{ value: '4w', label: '4 weeks' },
|
|
281
|
+
{ value: 'unlimited', label: 'Never' },
|
|
282
|
+
],
|
|
283
|
+
defaultValue: '24h',
|
|
284
|
+
summaryLabel: 'Expiry',
|
|
285
|
+
unlimited: {
|
|
286
|
+
reason: {
|
|
287
|
+
label: 'Reason',
|
|
288
|
+
placeholder: 'Why this cluster needs to keep running',
|
|
289
|
+
},
|
|
290
|
+
link: {
|
|
291
|
+
label: 'Link',
|
|
292
|
+
placeholder: 'https://github.com/camunda/…',
|
|
293
|
+
helperText: 'A GitHub issue or another page that explains the reason.',
|
|
294
|
+
},
|
|
295
|
+
fromSourceText: 'The new cluster keeps this setting of the source cluster. To give your own reason, enter a reason and a link.',
|
|
296
|
+
validation: ({ reason, link }) => ({
|
|
297
|
+
reason: reason.trim() ? undefined : 'Enter a reason.',
|
|
298
|
+
link: !link.trim()
|
|
299
|
+
? 'Enter a link.'
|
|
300
|
+
: isHttpUrl(link.trim())
|
|
301
|
+
? undefined
|
|
302
|
+
: 'Enter a link that starts with http:// or https://.',
|
|
303
|
+
}),
|
|
304
|
+
},
|
|
305
|
+
};
|
|
271
306
|
export const basicCreateClusterProps = {
|
|
272
307
|
loading: false,
|
|
273
308
|
banner: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CamundaClusterStageLabel } from '@camunda/camunda-composite-components';
|
|
2
|
+
import type { ClusterTtlOption } from '@camunda/ccma-shared-types';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
4
|
export interface C4CreateClusterCtaParameters {
|
|
4
5
|
name: string;
|
|
@@ -16,6 +17,65 @@ export interface C4CreateClusterCtaParameters {
|
|
|
16
17
|
numberOfAllocatedHwPackages?: number;
|
|
17
18
|
tasklistV2Enabled?: boolean;
|
|
18
19
|
identityBackendChecksEnabled?: boolean;
|
|
20
|
+
/** Set only when the form shows the expiry (`formElements.ttl`). */
|
|
21
|
+
ttl?: ClusterTtlOption;
|
|
22
|
+
/** Set only when `ttl` is `unlimited`. Trimmed. */
|
|
23
|
+
ttlUnlimitedReason?: string;
|
|
24
|
+
/** Set only when `ttl` is `unlimited`. Trimmed. */
|
|
25
|
+
ttlUnlimitedLink?: string;
|
|
26
|
+
/**
|
|
27
|
+
* An initial value only. The source of a duplicate never expires, and no
|
|
28
|
+
* person gave it a link, for example a cluster from before the expiry
|
|
29
|
+
* existed. The form then opens on `unlimited` with an empty reason and
|
|
30
|
+
* link. While both stay empty, the form does not ask for them and sends no
|
|
31
|
+
* `ttl`. The backend then copies the expiry of the source cluster.
|
|
32
|
+
*/
|
|
33
|
+
ttlFromSource?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** The two fields that a cluster with no expiry needs. */
|
|
36
|
+
export interface C4CreateClusterTtlUnlimitedInput {
|
|
37
|
+
reason: string;
|
|
38
|
+
link: string;
|
|
39
|
+
}
|
|
40
|
+
/** One message per field that is not valid. No message means valid. */
|
|
41
|
+
export interface C4CreateClusterTtlUnlimitedErrors {
|
|
42
|
+
reason?: string;
|
|
43
|
+
link?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The expiry of the new cluster. The page gives it only when the backend takes
|
|
47
|
+
* an expiry from this caller. Without it the form shows no expiry and sends no
|
|
48
|
+
* expiry field.
|
|
49
|
+
*/
|
|
50
|
+
export interface C4CreateClusterTtlFormElement {
|
|
51
|
+
title: string;
|
|
52
|
+
description: ReactNode;
|
|
53
|
+
/** The choices, in display order. The first render selects `defaultValue`. */
|
|
54
|
+
options: {
|
|
55
|
+
value: ClusterTtlOption;
|
|
56
|
+
label: string;
|
|
57
|
+
}[];
|
|
58
|
+
defaultValue: ClusterTtlOption;
|
|
59
|
+
/** The label of the summary row. */
|
|
60
|
+
summaryLabel: string;
|
|
61
|
+
/** The fields that show when the customer selects `unlimited`. */
|
|
62
|
+
unlimited: {
|
|
63
|
+
reason: {
|
|
64
|
+
label: string;
|
|
65
|
+
placeholder: string;
|
|
66
|
+
};
|
|
67
|
+
link: {
|
|
68
|
+
label: string;
|
|
69
|
+
placeholder: string;
|
|
70
|
+
helperText: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Shows above the reason while the form keeps the expiry of the source
|
|
74
|
+
* cluster, see `C4CreateClusterCtaParameters.ttlFromSource`.
|
|
75
|
+
*/
|
|
76
|
+
fromSourceText?: string;
|
|
77
|
+
validation: (input: C4CreateClusterTtlUnlimitedInput) => C4CreateClusterTtlUnlimitedErrors;
|
|
78
|
+
};
|
|
19
79
|
}
|
|
20
80
|
export interface C4CreateClusterClusterPlanType {
|
|
21
81
|
type: 'dev' | 'prod';
|
|
@@ -267,6 +327,8 @@ export interface C4CreateClusterProps {
|
|
|
267
327
|
url: string;
|
|
268
328
|
};
|
|
269
329
|
};
|
|
330
|
+
/** See `C4CreateClusterTtlFormElement`. */
|
|
331
|
+
ttl?: C4CreateClusterTtlFormElement;
|
|
270
332
|
allocatedHardwarePackages?: {
|
|
271
333
|
title: string;
|
|
272
334
|
max: number;
|
|
@@ -58,6 +58,12 @@ const resources = {
|
|
|
58
58
|
},
|
|
59
59
|
tags: {
|
|
60
60
|
addLabel: 'Add tag',
|
|
61
|
+
expiry: {
|
|
62
|
+
days: 'Expires in {{count}}d',
|
|
63
|
+
hours: 'Expires in {{count}}h',
|
|
64
|
+
soon: 'Expires soon',
|
|
65
|
+
title: 'Expires on {{date}}',
|
|
66
|
+
},
|
|
61
67
|
},
|
|
62
68
|
tooltips: {
|
|
63
69
|
clusterLoad: 'Cluster load',
|
|
@@ -80,6 +80,35 @@
|
|
|
80
80
|
"External": "External encryption keys use customer-managed keys for added security."
|
|
81
81
|
},
|
|
82
82
|
"linktext": "Learn more about encryption"
|
|
83
|
+
},
|
|
84
|
+
"ttl": {
|
|
85
|
+
"title": "Expiry",
|
|
86
|
+
"description": "When the cluster expires, Camunda deletes it and all of its data.",
|
|
87
|
+
"summaryLabel": "Expiry",
|
|
88
|
+
"options": {
|
|
89
|
+
"24h": "24 hours",
|
|
90
|
+
"3d": "3 days",
|
|
91
|
+
"1w": "1 week",
|
|
92
|
+
"4w": "4 weeks",
|
|
93
|
+
"unlimited": "Never"
|
|
94
|
+
},
|
|
95
|
+
"unlimited": {
|
|
96
|
+
"reason": {
|
|
97
|
+
"label": "Reason",
|
|
98
|
+
"placeholder": "Why this cluster needs to keep running",
|
|
99
|
+
"required": "Enter a reason.",
|
|
100
|
+
"tooLong": "The reason can't be longer than 500 characters."
|
|
101
|
+
},
|
|
102
|
+
"link": {
|
|
103
|
+
"label": "Link",
|
|
104
|
+
"placeholder": "https://github.com/camunda/…",
|
|
105
|
+
"helperText": "A GitHub issue or another page that explains the reason.",
|
|
106
|
+
"required": "Enter a link.",
|
|
107
|
+
"tooLong": "The link can't be longer than 2048 characters.",
|
|
108
|
+
"invalid": "Enter a link that starts with http:// or https://."
|
|
109
|
+
},
|
|
110
|
+
"fromSource": "The new cluster keeps this setting of the source cluster. To give your own reason, enter a reason and a link."
|
|
111
|
+
}
|
|
83
112
|
}
|
|
84
113
|
},
|
|
85
114
|
"cta": {
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -52,8 +52,10 @@ export { C4ClusterDetailsIpWhitelist } from './components/c4-cluster-details-ip-
|
|
|
52
52
|
export type { C4ClusterDetailsIpWhitelistProps, IpWhitelistItem, } from './components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.types.js';
|
|
53
53
|
export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
|
|
54
54
|
export type { C4ClusterDetailsSecureConnectivityProps, C4ClusterDetailsSecureConnectivityStatus, C4SecureConnectivityPrivateEndpoint, } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.types.js';
|
|
55
|
+
export { C4ClusterExpiryTag } from './components/c4-cluster-list/c4-cluster-expiry-tag.js';
|
|
55
56
|
export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
56
57
|
export type { C4ClusterListProps, ClusterListItem, ClusterListNotification, ClusterListPermissions, ClusterListUrls, } from './components/c4-cluster-list/c4-cluster-list.types.js';
|
|
58
|
+
export { type ClusterExpiryRemaining, type ClusterExpiryTag, type ClusterExpiryTagCopy, DEFAULT_CLUSTER_EXPIRY_TAG_COPY, getClusterExpiryRemaining, getClusterExpiryTag, } from './components/c4-cluster-list/cluster-expiry-tag.js';
|
|
57
59
|
export type { ApplicationsProps, ApplicationTileProps, ClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
58
60
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
59
61
|
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
@@ -74,7 +76,8 @@ export type { C4ConvertTrialOrganizationModalProps } from './components/c4-conve
|
|
|
74
76
|
export { C4CreateAlertModal } from './components/c4-create-alert-modal/c4-create-alert-modal.js';
|
|
75
77
|
export type { C4CreateAlertModalHandle, C4CreateAlertModalProps, C4CreateAlertReportType, } from './components/c4-create-alert-modal/c4-create-alert-modal.types.js';
|
|
76
78
|
export { C4CreateCluster } from './components/c4-create-cluster/c4-create-cluster.js';
|
|
77
|
-
export type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterProps, C4CreateClusterRegion, } from './components/c4-create-cluster/c4-create-cluster.types.js';
|
|
79
|
+
export type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterProps, C4CreateClusterRegion, C4CreateClusterTtlFormElement, C4CreateClusterTtlUnlimitedErrors, C4CreateClusterTtlUnlimitedInput, } from './components/c4-create-cluster/c4-create-cluster.types.js';
|
|
80
|
+
export { C4CreateClusterTtlSection, type C4CreateClusterTtlSectionProps, } from './components/c4-create-cluster/c4-create-cluster-ttl-section.js';
|
|
78
81
|
export { C4CreateClusterApiClientModal } from './components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js';
|
|
79
82
|
export type { C4CreateClusterApiClientModalHandle, C4CreateClusterApiClientModalOpenParams, C4CreateClusterApiClientModalProps, } from './components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.types.js';
|
|
80
83
|
export { C4CreateConnectorSecretModal } from './components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -29,7 +29,9 @@ export { C4ClusterDetailsHotBackups } from './components/c4-cluster-details-hot-
|
|
|
29
29
|
export { C4ClusterDetailsHotBackupsRestore } from './components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js';
|
|
30
30
|
export { C4ClusterDetailsIpWhitelist } from './components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
|
|
31
31
|
export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
|
|
32
|
+
export { C4ClusterExpiryTag } from './components/c4-cluster-list/c4-cluster-expiry-tag.js';
|
|
32
33
|
export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
34
|
+
export { DEFAULT_CLUSTER_EXPIRY_TAG_COPY, getClusterExpiryRemaining, getClusterExpiryTag, } from './components/c4-cluster-list/cluster-expiry-tag.js';
|
|
33
35
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
34
36
|
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
35
37
|
export { C4ClusterSettings } from './components/c4-cluster-settings/c4-cluster-settings.js';
|
|
@@ -40,6 +42,7 @@ export { C4ConsoleDashboard } from './components/c4-console-dashboard/c4-console
|
|
|
40
42
|
export { C4ConvertTrialOrganizationModal } from './components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js';
|
|
41
43
|
export { C4CreateAlertModal } from './components/c4-create-alert-modal/c4-create-alert-modal.js';
|
|
42
44
|
export { C4CreateCluster } from './components/c4-create-cluster/c4-create-cluster.js';
|
|
45
|
+
export { C4CreateClusterTtlSection, } from './components/c4-create-cluster/c4-create-cluster-ttl-section.js';
|
|
43
46
|
export { C4CreateClusterApiClientModal } from './components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js';
|
|
44
47
|
export { C4CreateConnectorSecretModal } from './components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js';
|
|
45
48
|
export { C4CreateConsoleApiClientModal } from './components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js';
|
|
@@ -3,6 +3,7 @@ import { BackupStatus, ClusterEncryptionKey, isGenerationResumable, Organization
|
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { C4ClusterList } from '../../components/c4-cluster-list/c4-cluster-list.js';
|
|
6
|
+
import { getClusterExpiryTag, } from '../../components/c4-cluster-list/cluster-expiry-tag.js';
|
|
6
7
|
import { C4ClustersEmptyState } from '../../components/c4-clusters-empty-state/c4-clusters-empty-state.js';
|
|
7
8
|
import { C4ClustersTrialNotification } from '../../components/c4-clusters-trial-notification/c4-clusters-trial-notification.js';
|
|
8
9
|
import { C4ExtendTrialModal } from '../../components/c4-extend-trial-modal/c4-extend-trial-modal.js';
|
|
@@ -141,6 +142,34 @@ function mapClusterToListItem(rawCluster, index) {
|
|
|
141
142
|
originalIndex: index,
|
|
142
143
|
};
|
|
143
144
|
}
|
|
145
|
+
const EXPIRY_CLOCK_INTERVAL_MS = 60_000;
|
|
146
|
+
/**
|
|
147
|
+
* useExpiryClock gives the time that the expiry tags count from. It moves once
|
|
148
|
+
* a minute while `active`, thus an open page does not keep "Expires in 2d"
|
|
149
|
+
* after the cluster has less than two days left. A list with no expiry starts
|
|
150
|
+
* no timer.
|
|
151
|
+
*/
|
|
152
|
+
function useExpiryClock(active) {
|
|
153
|
+
const [now, setNow] = useState(() => new Date());
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (!active) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
setNow(new Date());
|
|
159
|
+
const timer = setInterval(() => setNow(new Date()), EXPIRY_CLOCK_INTERVAL_MS);
|
|
160
|
+
return () => clearInterval(timer);
|
|
161
|
+
}, [active]);
|
|
162
|
+
return now;
|
|
163
|
+
}
|
|
164
|
+
function buildClusterExpiryTagCopy(t) {
|
|
165
|
+
const translate = (key, fallback) => safeTranslate(t, key, fallback);
|
|
166
|
+
return {
|
|
167
|
+
days: translate('c4console:clusters.tags.expiry.days', 'Expires in {{count}}d'),
|
|
168
|
+
hours: translate('c4console:clusters.tags.expiry.hours', 'Expires in {{count}}h'),
|
|
169
|
+
soon: translate('c4console:clusters.tags.expiry.soon', 'Expires soon'),
|
|
170
|
+
title: translate('c4console:clusters.tags.expiry.title', 'Expires on {{date}}'),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
144
173
|
function buildDefaultTranslations(t) {
|
|
145
174
|
const translate = (key, fallback) => safeTranslate(t, key, fallback);
|
|
146
175
|
return {
|
|
@@ -187,6 +216,7 @@ function buildDefaultTranslations(t) {
|
|
|
187
216
|
},
|
|
188
217
|
tags: {
|
|
189
218
|
addLabel: translate('c4console:clusters.tags.addLabel', 'Add tag'),
|
|
219
|
+
expiry: buildClusterExpiryTagCopy(t),
|
|
190
220
|
},
|
|
191
221
|
tooltips: {
|
|
192
222
|
clusterLoad: translate('c4console:clusters.tooltips.clusterLoad', 'Cluster load'),
|
|
@@ -348,17 +378,29 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
348
378
|
const clusterLoadData = useMemo(() => {
|
|
349
379
|
return clusterCapacityMap;
|
|
350
380
|
}, [clusterCapacityMap]);
|
|
381
|
+
const expiryNow = useExpiryClock(rawClusters.some((rawCluster) => getPathString(rawCluster, ['ttl', 'expiresAt']) !== undefined));
|
|
351
382
|
const clusters = useMemo(() => {
|
|
352
383
|
const tokenClusters = authz.features.console?.clusters;
|
|
353
384
|
const canUpgradeFromToken = (tokenClusters?.canUpgradeGeneration ?? false) ||
|
|
354
385
|
(tokenClusters?.canUpgradeGenerationYolo ?? false);
|
|
355
386
|
const canUpgradeGeneration = isOrgAdmin || canUpgradeFromToken;
|
|
356
387
|
const updateSuffix = safeTranslate(runtime.i18n?.t, 'c4console:clusters.list.updateAvailableSuffix', ' - update available');
|
|
388
|
+
const expiryCopy = translations?.tags.expiry ?? buildClusterExpiryTagCopy(runtime.i18n?.t);
|
|
357
389
|
return rawClusters
|
|
358
390
|
.map((rawCluster, index) => {
|
|
359
|
-
const
|
|
360
|
-
if (!
|
|
391
|
+
const mappedItem = mapClusterToListItem(rawCluster, index);
|
|
392
|
+
if (!mappedItem)
|
|
361
393
|
return undefined;
|
|
394
|
+
// console-backend sends `ttl` only to a reader who may see the
|
|
395
|
+
// expiry. A customer gets no `ttl`, thus no tag.
|
|
396
|
+
const expiry = getClusterExpiryTag({
|
|
397
|
+
expiresAt: getPathString(rawCluster, ['ttl', 'expiresAt']),
|
|
398
|
+
now: expiryNow,
|
|
399
|
+
copy: expiryCopy,
|
|
400
|
+
});
|
|
401
|
+
const item = expiry
|
|
402
|
+
? { ...mappedItem, expiry }
|
|
403
|
+
: mappedItem;
|
|
362
404
|
// A restoring or reconciliation-paused cluster reports a raw status
|
|
363
405
|
// that says nothing useful. `clusterHealthOverride` owns the label
|
|
364
406
|
// that replaces it. This list, the header badge of the cluster page,
|
|
@@ -404,9 +446,11 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
404
446
|
clusterLoadData,
|
|
405
447
|
data,
|
|
406
448
|
generationToClusterId,
|
|
449
|
+
expiryNow,
|
|
407
450
|
isOrgAdmin,
|
|
408
451
|
rawClusters,
|
|
409
452
|
runtime.i18n,
|
|
453
|
+
translations,
|
|
410
454
|
upgradableGenerationsCache,
|
|
411
455
|
]);
|
|
412
456
|
const clusterById = useMemo(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { C4ClusterListProps, ClusterListPermissions } from '../../components/c4-cluster-list/c4-cluster-list.types.js';
|
|
2
|
+
import type { ClusterExpiryTagCopy } from '../../components/c4-cluster-list/cluster-expiry-tag.js';
|
|
2
3
|
import type { C4WidgetScope } from '../c4-widget-scope.types.js';
|
|
3
4
|
export type C4ClustersNavigateEvent = {
|
|
4
5
|
kind: 'clusterDetails';
|
|
@@ -48,6 +49,12 @@ export interface C4ClustersPageTranslations {
|
|
|
48
49
|
};
|
|
49
50
|
tags: {
|
|
50
51
|
addLabel: string;
|
|
52
|
+
/**
|
|
53
|
+
* The copy of the expiry tag. When absent, the page translates the keys
|
|
54
|
+
* `c4console:clusters.tags.expiry.*` with the runtime, and uses English
|
|
55
|
+
* for each key that the runtime cannot translate.
|
|
56
|
+
*/
|
|
57
|
+
expiry?: ClusterExpiryTagCopy;
|
|
51
58
|
};
|
|
52
59
|
tooltips: {
|
|
53
60
|
clusterLoad: string;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { C4CreateClusterTtlUnlimitedErrors, C4CreateClusterTtlUnlimitedInput } from '../../components/c4-create-cluster/c4-create-cluster.types.js';
|
|
2
3
|
import type { C4CreateClusterPageProps } from './c4-create-cluster-page.types.js';
|
|
4
|
+
type CreateClusterTranslations = ReturnType<typeof buildCreateClusterTranslations>;
|
|
5
|
+
/**
|
|
6
|
+
* validateTtlUnlimited gives one message for each field of a cluster with no
|
|
7
|
+
* expiry that is not valid. It applies the rules of
|
|
8
|
+
* `validateClusterTtlUnlimited`, which console-backend applies to the same
|
|
9
|
+
* input, but it names the field and uses the copy of the page.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateTtlUnlimited(input: C4CreateClusterTtlUnlimitedInput, translations: Pick<CreateClusterTranslations, 'ttlReasonRequired' | 'ttlReasonTooLong' | 'ttlLinkRequired' | 'ttlLinkTooLong' | 'ttlLinkInvalid'>): C4CreateClusterTtlUnlimitedErrors;
|
|
3
12
|
/**
|
|
4
13
|
* Every copy string of the page, resolved once. Exported for the test that
|
|
5
14
|
* holds each string against its key: a miss must give the English fallback and
|
|
@@ -51,6 +60,25 @@ export declare function buildCreateClusterTranslations(t: ((key: string, options
|
|
|
51
60
|
encryptionItemHardware: string;
|
|
52
61
|
encryptionItemExternal: string;
|
|
53
62
|
encryptionLinkText: string;
|
|
63
|
+
ttlTitle: string;
|
|
64
|
+
ttlDescription: string;
|
|
65
|
+
ttlSummaryLabel: string;
|
|
66
|
+
ttlOption24h: string;
|
|
67
|
+
ttlOption3d: string;
|
|
68
|
+
ttlOption1w: string;
|
|
69
|
+
ttlOption4w: string;
|
|
70
|
+
ttlOptionUnlimited: string;
|
|
71
|
+
ttlReasonLabel: string;
|
|
72
|
+
ttlReasonPlaceholder: string;
|
|
73
|
+
ttlReasonRequired: string;
|
|
74
|
+
ttlReasonTooLong: string;
|
|
75
|
+
ttlLinkLabel: string;
|
|
76
|
+
ttlLinkPlaceholder: string;
|
|
77
|
+
ttlLinkHelperText: string;
|
|
78
|
+
ttlLinkRequired: string;
|
|
79
|
+
ttlLinkTooLong: string;
|
|
80
|
+
ttlLinkInvalid: string;
|
|
81
|
+
ttlFromSourceText: string;
|
|
54
82
|
ctaCreate: string;
|
|
55
83
|
ctaSubmitting: string;
|
|
56
84
|
ctaSuccess: string;
|
|
@@ -93,3 +121,4 @@ export declare function buildCreateClusterTranslations(t: ((key: string, options
|
|
|
93
121
|
export declare const C4CreateClusterPage: (({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, onNavigate, duplicateOfClusterId: sourceClusterId, }: C4CreateClusterPageProps) => React.ReactElement) & {
|
|
94
122
|
displayName: string;
|
|
95
123
|
};
|
|
124
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
7
|
import { ConsoleClusterParametersService, ConsoleClusterService, OrgsService, } from '@camunda/ccma-api';
|
|
8
|
-
import { ClusterEncryptionKey, getDisplayedSalesPlan, MAX_HARDWARE_PACKAGE_COUNT, MAX_LENGTH_CLUSTER_NAME, SalesPlanType, sortByAvailabilityClasses, sortGenerationBySemverOfZeebe, } from '@camunda/ccma-shared-types';
|
|
8
|
+
import { CLUSTER_TTL_OPTIONS, CLUSTER_TTL_UNLIMITED_LINK_MAX_LENGTH, CLUSTER_TTL_UNLIMITED_REASON_MAX_LENGTH, ClusterEncryptionKey, DEFAULT_CLUSTER_TTL_OPTION, getDisplayedSalesPlan, isHttpUrl, MAX_HARDWARE_PACKAGE_COUNT, MAX_LENGTH_CLUSTER_NAME, SalesPlanType, sortByAvailabilityClasses, sortGenerationBySemverOfZeebe, } from '@camunda/ccma-shared-types';
|
|
9
9
|
import { observer } from 'mobx-react-lite';
|
|
10
10
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import { C4CreateCluster } from '../../components/c4-create-cluster/c4-create-cluster.js';
|
|
@@ -182,6 +182,94 @@ function renderLinkPlaceholder(template, link) {
|
|
|
182
182
|
window.open(link.href, '_blank');
|
|
183
183
|
}, children: template || link.labelFallback }));
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* validateTtlUnlimited gives one message for each field of a cluster with no
|
|
187
|
+
* expiry that is not valid. It applies the rules of
|
|
188
|
+
* `validateClusterTtlUnlimited`, which console-backend applies to the same
|
|
189
|
+
* input, but it names the field and uses the copy of the page.
|
|
190
|
+
*/
|
|
191
|
+
export function validateTtlUnlimited(input, translations) {
|
|
192
|
+
const errors = {};
|
|
193
|
+
// The form submits the trimmed values, thus each check uses them.
|
|
194
|
+
const reason = input.reason.trim();
|
|
195
|
+
const link = input.link.trim();
|
|
196
|
+
if (reason === '') {
|
|
197
|
+
errors.reason = translations.ttlReasonRequired;
|
|
198
|
+
}
|
|
199
|
+
else if (reason.length > CLUSTER_TTL_UNLIMITED_REASON_MAX_LENGTH) {
|
|
200
|
+
errors.reason = translations.ttlReasonTooLong;
|
|
201
|
+
}
|
|
202
|
+
if (link === '') {
|
|
203
|
+
errors.link = translations.ttlLinkRequired;
|
|
204
|
+
}
|
|
205
|
+
else if (link.length > CLUSTER_TTL_UNLIMITED_LINK_MAX_LENGTH) {
|
|
206
|
+
errors.link = translations.ttlLinkTooLong;
|
|
207
|
+
}
|
|
208
|
+
else if (!isHttpUrl(link)) {
|
|
209
|
+
errors.link = translations.ttlLinkInvalid;
|
|
210
|
+
}
|
|
211
|
+
return errors;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* sourceTtlInitialValues gives the expiry fields of a duplicate. A source with
|
|
215
|
+
* no expiry opens the form on "Never". Else the form opens on its default.
|
|
216
|
+
* Thus a duplicate that replaces its source does not give an expiry to a
|
|
217
|
+
* cluster that stays, unless the customer chooses one.
|
|
218
|
+
*
|
|
219
|
+
* A source with no expiry and a link gives its reason and link to the form. A
|
|
220
|
+
* source with no link, such as a cluster from before the expiry existed, gives
|
|
221
|
+
* none: the form then sends no `ttl`, and the backend copies the expiry of the
|
|
222
|
+
* source, see `ttlFromSource`. Thus the form shows no reason that the customer
|
|
223
|
+
* did not write, and does not ask for a link that the source never had.
|
|
224
|
+
*/
|
|
225
|
+
function sourceTtlInitialValues(sourceCluster) {
|
|
226
|
+
const ttl = getPathUnknown(sourceCluster, ['ttl']);
|
|
227
|
+
// No `ttl` means that the reader may not see it, not that it is unlimited.
|
|
228
|
+
if (!isRecord(ttl) || getString(ttl, 'expiresAt') !== undefined) {
|
|
229
|
+
return {};
|
|
230
|
+
}
|
|
231
|
+
const link = getString(ttl, 'unlimitedLink');
|
|
232
|
+
if (!link) {
|
|
233
|
+
return { ttl: 'unlimited', ttlFromSource: true };
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
ttl: 'unlimited',
|
|
237
|
+
ttlUnlimitedReason: getString(ttl, 'unlimitedReason'),
|
|
238
|
+
ttlUnlimitedLink: link,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function buildTtlFormElement(translations) {
|
|
242
|
+
const optionLabels = {
|
|
243
|
+
'24h': translations.ttlOption24h,
|
|
244
|
+
'3d': translations.ttlOption3d,
|
|
245
|
+
'1w': translations.ttlOption1w,
|
|
246
|
+
'4w': translations.ttlOption4w,
|
|
247
|
+
unlimited: translations.ttlOptionUnlimited,
|
|
248
|
+
};
|
|
249
|
+
return {
|
|
250
|
+
title: translations.ttlTitle,
|
|
251
|
+
description: translations.ttlDescription,
|
|
252
|
+
options: CLUSTER_TTL_OPTIONS.map((value) => ({
|
|
253
|
+
value,
|
|
254
|
+
label: optionLabels[value],
|
|
255
|
+
})),
|
|
256
|
+
defaultValue: DEFAULT_CLUSTER_TTL_OPTION,
|
|
257
|
+
summaryLabel: translations.ttlSummaryLabel,
|
|
258
|
+
unlimited: {
|
|
259
|
+
reason: {
|
|
260
|
+
label: translations.ttlReasonLabel,
|
|
261
|
+
placeholder: translations.ttlReasonPlaceholder,
|
|
262
|
+
},
|
|
263
|
+
link: {
|
|
264
|
+
label: translations.ttlLinkLabel,
|
|
265
|
+
placeholder: translations.ttlLinkPlaceholder,
|
|
266
|
+
helperText: translations.ttlLinkHelperText,
|
|
267
|
+
},
|
|
268
|
+
fromSourceText: translations.ttlFromSourceText,
|
|
269
|
+
validation: (input) => validateTtlUnlimited(input, translations),
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
185
273
|
function sendNavigate(onNavigate, event) {
|
|
186
274
|
onNavigate?.(event);
|
|
187
275
|
}
|
|
@@ -245,6 +333,25 @@ export function buildCreateClusterTranslations(t) {
|
|
|
245
333
|
encryptionItemHardware: translate('createcluster:form.encryption.items.Hardware', 'Hardware encryption keys use KMS for the highest level of protection.'),
|
|
246
334
|
encryptionItemExternal: translate('createcluster:form.encryption.items.External', 'External encryption keys use customer-managed keys for added security.'),
|
|
247
335
|
encryptionLinkText: translate('createcluster:form.encryption.linktext', 'Learn more about encryption'),
|
|
336
|
+
ttlTitle: translate('createcluster:form.ttl.title', 'Expiry'),
|
|
337
|
+
ttlDescription: translate('createcluster:form.ttl.description', 'When the cluster expires, Camunda deletes it and all of its data.'),
|
|
338
|
+
ttlSummaryLabel: translate('createcluster:form.ttl.summaryLabel', 'Expiry'),
|
|
339
|
+
ttlOption24h: translate('createcluster:form.ttl.options.24h', '24 hours'),
|
|
340
|
+
ttlOption3d: translate('createcluster:form.ttl.options.3d', '3 days'),
|
|
341
|
+
ttlOption1w: translate('createcluster:form.ttl.options.1w', '1 week'),
|
|
342
|
+
ttlOption4w: translate('createcluster:form.ttl.options.4w', '4 weeks'),
|
|
343
|
+
ttlOptionUnlimited: translate('createcluster:form.ttl.options.unlimited', 'Never'),
|
|
344
|
+
ttlReasonLabel: translate('createcluster:form.ttl.unlimited.reason.label', 'Reason'),
|
|
345
|
+
ttlReasonPlaceholder: translate('createcluster:form.ttl.unlimited.reason.placeholder', 'Why this cluster needs to keep running'),
|
|
346
|
+
ttlReasonRequired: translate('createcluster:form.ttl.unlimited.reason.required', 'Enter a reason.'),
|
|
347
|
+
ttlReasonTooLong: translate('createcluster:form.ttl.unlimited.reason.tooLong', "The reason can't be longer than 500 characters."),
|
|
348
|
+
ttlLinkLabel: translate('createcluster:form.ttl.unlimited.link.label', 'Link'),
|
|
349
|
+
ttlLinkPlaceholder: translate('createcluster:form.ttl.unlimited.link.placeholder', 'https://github.com/camunda/…'),
|
|
350
|
+
ttlLinkHelperText: translate('createcluster:form.ttl.unlimited.link.helperText', 'A GitHub issue or another page that explains the reason.'),
|
|
351
|
+
ttlLinkRequired: translate('createcluster:form.ttl.unlimited.link.required', 'Enter a link.'),
|
|
352
|
+
ttlLinkTooLong: translate('createcluster:form.ttl.unlimited.link.tooLong', "The link can't be longer than 2048 characters."),
|
|
353
|
+
ttlLinkInvalid: translate('createcluster:form.ttl.unlimited.link.invalid', 'Enter a link that starts with http:// or https://.'),
|
|
354
|
+
ttlFromSourceText: translate('createcluster:form.ttl.unlimited.fromSource', 'The new cluster keeps this setting of the source cluster. To give your own reason, enter a reason and a link.'),
|
|
248
355
|
ctaCreate: translate('createcluster:cta.create', 'Create cluster'),
|
|
249
356
|
ctaSubmitting: translate('createcluster:cta.states.submitting', 'Creating cluster...'),
|
|
250
357
|
ctaSuccess: translate('createcluster:cta.states.success', 'Cluster will now be created'),
|
|
@@ -512,6 +619,10 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
512
619
|
creationParameters,
|
|
513
620
|
usageByPlanTypeUuid,
|
|
514
621
|
]);
|
|
622
|
+
// console-backend sets this only when it takes the expiry from this
|
|
623
|
+
// caller, after every guard of the feature. A customer never gets it, thus
|
|
624
|
+
// the page reads no feature flag of its own for the expiry.
|
|
625
|
+
const clusterTtlEnabled = getBoolean(creationParameters, 'clusterTtlEnabled') === true;
|
|
515
626
|
const unlockedClusterPlans = useMemo(() => {
|
|
516
627
|
const raw = getPathUnknown(creationParameters, ['unlockedClusterPlans']);
|
|
517
628
|
if (!Array.isArray(raw)) {
|
|
@@ -730,6 +841,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
730
841
|
'tasklistV2Enabled',
|
|
731
842
|
]),
|
|
732
843
|
identityBackendChecksEnabled: getBoolean(sourceCluster, 'identityBackendChecksEnabled'),
|
|
844
|
+
...sourceTtlInitialValues(sourceCluster),
|
|
733
845
|
};
|
|
734
846
|
}, [sourceChannelUuid, sourceCluster, sourceUnlockedClusterPlan]);
|
|
735
847
|
/**
|
|
@@ -812,6 +924,12 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
812
924
|
tasklistV2Enabled: params.tasklistV2Enabled,
|
|
813
925
|
identityBackendChecksEnabled: params.identityBackendChecksEnabled,
|
|
814
926
|
description: params.description,
|
|
927
|
+
...(clusterTtlEnabled &&
|
|
928
|
+
params.ttl && {
|
|
929
|
+
ttl: params.ttl,
|
|
930
|
+
ttlUnlimitedReason: params.ttlUnlimitedReason,
|
|
931
|
+
ttlUnlimitedLink: params.ttlUnlimitedLink,
|
|
932
|
+
}),
|
|
815
933
|
};
|
|
816
934
|
try {
|
|
817
935
|
if (sourceClusterId) {
|
|
@@ -862,6 +980,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
862
980
|
}, [
|
|
863
981
|
apiConfig,
|
|
864
982
|
carryOverStepLabels,
|
|
983
|
+
clusterTtlEnabled,
|
|
865
984
|
orgId,
|
|
866
985
|
replaceSource,
|
|
867
986
|
runtime.telemetry,
|
|
@@ -1018,6 +1137,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1018
1137
|
},
|
|
1019
1138
|
encryptionGCP,
|
|
1020
1139
|
encryptionAWS,
|
|
1140
|
+
...(clusterTtlEnabled && { ttl: buildTtlFormElement(translations) }),
|
|
1021
1141
|
allocatedHardwarePackages: {
|
|
1022
1142
|
title: translations.hardwarePackagesTitle,
|
|
1023
1143
|
max: MAX_HARDWARE_PACKAGE_COUNT,
|
|
@@ -1098,6 +1218,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1098
1218
|
autoUpdateShouldBeEnabled,
|
|
1099
1219
|
encryptionGCP,
|
|
1100
1220
|
encryptionAWS,
|
|
1221
|
+
clusterTtlEnabled,
|
|
1101
1222
|
create,
|
|
1102
1223
|
postCreate,
|
|
1103
1224
|
cancel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"react-markdown": "^8.0.7 || ^10.0.0"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@camunda/ccma-api": "5.
|
|
100
|
-
"@camunda/ccma-shared-types": "7.
|
|
99
|
+
"@camunda/ccma-api": "5.2.0",
|
|
100
|
+
"@camunda/ccma-shared-types": "7.3.0",
|
|
101
101
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
102
102
|
"cron-parser": "5.10.1",
|
|
103
103
|
"mobx": "6.16.1",
|