@camunda/ccma-saas-frontend 0.21.13 → 0.22.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-create-cluster/c4-create-cluster.js +12 -6
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +4 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +2 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +14 -2
- package/lib/esm/i18n/en/pages/createcluster.json +1 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +1 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +27 -6
- package/package.json +2 -2
|
@@ -100,7 +100,8 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
100
100
|
const preConditions = formElements.clusterPlanType.options.length > 0 &&
|
|
101
101
|
formElements.region.options.length > 0 &&
|
|
102
102
|
formElements.generation.channels.length > 0 &&
|
|
103
|
-
formElements.generation.channels.reduce((a, b) => a && b.generations?.length > 0, true)
|
|
103
|
+
formElements.generation.channels.reduce((a, b) => a && (b.isEmpty || b.generations?.length > 0), true) &&
|
|
104
|
+
formElements.generation.channels.some((channel) => !channel.isEmpty);
|
|
104
105
|
// CONTEXT STATES
|
|
105
106
|
const [clusterNameValidation, setClusterNameValidation] = useState({
|
|
106
107
|
isValid: true,
|
|
@@ -122,9 +123,10 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
122
123
|
// Each `initialValues` lookup below falls back to the normal default when it
|
|
123
124
|
// finds no option of that uuid. An org can lose access to the generation or
|
|
124
125
|
// the region of the source cluster, and the form must still open.
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
const selectableChannels = formElements.generation.channels.filter((channel) => !channel.isEmpty);
|
|
127
|
+
const defaultChannel = selectableChannels.find((channel) => channel.uuid === initialValues?.channel) ??
|
|
128
|
+
selectableChannels.find((channel) => channel.default === true) ??
|
|
129
|
+
selectableChannels[0];
|
|
128
130
|
const defaultGeneration = defaultChannel?.generations?.find((generation) => generation.uuid === initialValues?.generation) ??
|
|
129
131
|
defaultChannel?.generations?.find((generation) => generation.default === true) ??
|
|
130
132
|
defaultChannel?.generations?.[0];
|
|
@@ -237,7 +239,8 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
237
239
|
setSelectedGeneration(generationUuid);
|
|
238
240
|
};
|
|
239
241
|
const updateSelectedChannel = (channelUuid) => {
|
|
240
|
-
const foundChannel =
|
|
242
|
+
const foundChannel = selectableChannels.find((channel) => channel.uuid === channelUuid) ??
|
|
243
|
+
selectableChannels[0];
|
|
241
244
|
const foundDefaultGeneration = foundChannel.generations.find((generation) => generation.default === true) ?? foundChannel.generations[0];
|
|
242
245
|
setSelectedChannel(channelUuid);
|
|
243
246
|
updateSelectedGeneration(foundDefaultGeneration.uuid);
|
|
@@ -717,7 +720,10 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
717
720
|
: enableMap.prod }) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: formElements.stageLabel.textBelow }) })] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), renderTtlSection(), _jsx("div", { style: GRID_STYLE, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: { marginBottom: '0.5rem' }, children: _jsx(C4SegmentedControl, { options: formElements.generation.channels.map((channel) => ({
|
|
718
721
|
id: channel.uuid,
|
|
719
722
|
label: channel.title,
|
|
720
|
-
disabled: noAvailableSlots,
|
|
723
|
+
disabled: noAvailableSlots || channel.isEmpty,
|
|
724
|
+
tooltip: channel.isEmpty && channel.title === 'Alpha'
|
|
725
|
+
? formElements.generation.emptyChannelNote
|
|
726
|
+
: undefined,
|
|
721
727
|
})), value: selectedChannel, onChange: updateSelectedChannel, ariaLabel: formElements.generation.title }) }), getSelectedChannel() && (_jsxs(Stack, { gap: 4, children: [_jsx("div", { style: { maxWidth: '58.33%' }, children: _jsx("p", { children: getSelectedChannel()?.description }) }), renderGenerationSection()] }))] }) }), authorizationToggle?.enabled && renderAuthorizationRadio(), tasklistModeToggle?.enabled && renderTasklistV2Content(), autoUpdate?.enabled && (_jsxs(_Fragment, { children: [_jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), _jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.autoUpdate?.title ?? '' }) }), autoUpdateEnabled && (_jsx("div", { style: GRID_STYLE, children: _jsx(Checkbox, { id: 'autoupdate', labelText: formElements.autoUpdate?.label ?? '', checked: autoUpdateChecked, onChange: (event) => {
|
|
722
728
|
setAutoUpdateChecked(event.target.checked);
|
|
723
729
|
}, disabled: isSubmitting() || !autoUpdateEnabled || noAvailableSlots }, 'autoupdate') })), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: autoUpdateEnabled
|
|
@@ -120,6 +120,8 @@ export interface C4CreateClusterChannelWithGenerations {
|
|
|
120
120
|
description: string;
|
|
121
121
|
uuid: string;
|
|
122
122
|
default?: boolean;
|
|
123
|
+
/** The channel has no generation. It shows disabled, with the note. */
|
|
124
|
+
isEmpty?: boolean;
|
|
123
125
|
generations: Array<{
|
|
124
126
|
title: string;
|
|
125
127
|
default: boolean;
|
|
@@ -271,6 +273,8 @@ export interface C4CreateClusterProps {
|
|
|
271
273
|
title: string;
|
|
272
274
|
channels: C4CreateClusterChannelWithGenerations[];
|
|
273
275
|
olderGenerationsLabel?: string;
|
|
276
|
+
/** Shown under the channel switcher for each empty channel. */
|
|
277
|
+
emptyChannelNote?: string;
|
|
274
278
|
olderGenerationsHelperText?: string;
|
|
275
279
|
orgUnlockedGenerationsHelperText?: string;
|
|
276
280
|
};
|
|
@@ -3,6 +3,8 @@ export interface C4SegmentedControlOption {
|
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
/** Shown on hover. It sits on a wrapper, because a disabled button gets no pointer events. */
|
|
7
|
+
tooltip?: string;
|
|
6
8
|
}
|
|
7
9
|
export interface C4SegmentedControlProps {
|
|
8
10
|
options: C4SegmentedControlOption[];
|
|
@@ -4,10 +4,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import { ToggleGroup, ToggleGroupItem } from '@camunda/design-system';
|
|
7
|
+
import { ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@camunda/design-system';
|
|
8
8
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
9
9
|
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
10
10
|
import { Button } from '../../ui/index.js';
|
|
11
|
+
const WRAPPER_STYLE = { display: 'flex', flex: '0 0 auto' };
|
|
11
12
|
/** How far one press of an arrow button moves the strip, in pixels. */
|
|
12
13
|
const MIN_SCROLL_STEP = 160;
|
|
13
14
|
/**
|
|
@@ -114,5 +115,16 @@ export const C4SegmentedControl = ({ options, value, onChange, ariaLabel, dsStyl
|
|
|
114
115
|
if (next) {
|
|
115
116
|
onChange(next);
|
|
116
117
|
}
|
|
117
|
-
}, children: options.map((option) =>
|
|
118
|
+
}, children: options.map((option) => {
|
|
119
|
+
const item = (_jsx(ToggleGroupItem, { value: option.id, disabled: option.disabled, style: { flex: '0 0 auto', minWidth: 'auto' }, children: option.label }, option.id));
|
|
120
|
+
if (!option.tooltip) {
|
|
121
|
+
return item;
|
|
122
|
+
}
|
|
123
|
+
// The trigger is a wrapper span, since a disabled button gets no
|
|
124
|
+
// pointer events. Only this item has one: the DS joins the items
|
|
125
|
+
// with `first:` and `last:`, so a span around each item would make
|
|
126
|
+
// every item a separate pill. The app has no global provider, so
|
|
127
|
+
// scope one.
|
|
128
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { style: WRAPPER_STYLE, children: item }) }), _jsx(TooltipContent, { children: option.tooltip })] }) }, option.id));
|
|
129
|
+
}) }) }), hasMoreAfter && (_jsx(Button, { kind: 'ghost', size: 'sm', type: 'button', "aria-label": `Scroll ${ariaLabel} to the right`, renderIcon: ChevronRight, onClick: () => scrollByStep(1) }))] }));
|
|
118
130
|
};
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"generation": {
|
|
53
53
|
"title": "Channel",
|
|
54
54
|
"olderGenerationsLabel": "View older generations",
|
|
55
|
+
"emptyChannelNote": "No alpha release at the moment. The first alpha of the next release will appear here.",
|
|
55
56
|
"olderGenerationsHelperText": "These are older generations that are used in your organization.",
|
|
56
57
|
"orgUnlockedGenerationsHelperText": "These are generations that have been unlocked for your organization."
|
|
57
58
|
},
|
|
@@ -39,6 +39,7 @@ export declare function buildCreateClusterTranslations(t: ((key: string, options
|
|
|
39
39
|
backupRegionDescription: string;
|
|
40
40
|
generationTitle: string;
|
|
41
41
|
olderGenerationsLabel: string;
|
|
42
|
+
emptyChannelNote: string;
|
|
42
43
|
olderGenerationsHelperText: string;
|
|
43
44
|
orgUnlockedGenerationsHelperText: string;
|
|
44
45
|
clusterPlanTitle: string;
|
|
@@ -312,6 +312,7 @@ export function buildCreateClusterTranslations(t) {
|
|
|
312
312
|
backupRegionDescription: translate('createcluster:form.backupRegion.description', '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. <0>Learn more</0>'),
|
|
313
313
|
generationTitle: translate('createcluster:form.generation.title', 'Channel'),
|
|
314
314
|
olderGenerationsLabel: translate('createcluster:form.generation.olderGenerationsLabel', 'View older generations'),
|
|
315
|
+
emptyChannelNote: translate('createcluster:form.generation.emptyChannelNote', 'No alpha release at the moment. The first alpha of the next release will appear here.'),
|
|
315
316
|
olderGenerationsHelperText: translate('createcluster:form.generation.olderGenerationsHelperText', 'These are older generations that are used in your organization.'),
|
|
316
317
|
orgUnlockedGenerationsHelperText: translate('createcluster:form.generation.orgUnlockedGenerationsHelperText', 'These are generations that have been unlocked for your organization.'),
|
|
317
318
|
clusterPlanTitle: translate('createcluster:form.clusterPlan.title', 'Cluster plan'),
|
|
@@ -671,9 +672,6 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
671
672
|
.map((channel) => {
|
|
672
673
|
const uuid = getString(channel, 'uuid') ?? '';
|
|
673
674
|
const title = getString(channel, 'name') ?? uuid;
|
|
674
|
-
const isDefault = alphaAsDefault
|
|
675
|
-
? title === 'Alpha'
|
|
676
|
-
: (getBoolean(channel, 'isDefault') ?? false);
|
|
677
675
|
const rawGenerations = getPathUnknown(channel, [
|
|
678
676
|
'allowedGenerations',
|
|
679
677
|
]);
|
|
@@ -702,18 +700,37 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
702
700
|
};
|
|
703
701
|
})
|
|
704
702
|
: [];
|
|
703
|
+
// The backend flags a channel with no default generation. Its
|
|
704
|
+
// list can still hold generations that an org keeps, so the
|
|
705
|
+
// channel is empty only when that list is empty too.
|
|
706
|
+
const isEmpty = (getBoolean(channel, 'isEmpty') ?? false) &&
|
|
707
|
+
generations.length === 0;
|
|
708
|
+
const isDefault = !isEmpty &&
|
|
709
|
+
(alphaAsDefault
|
|
710
|
+
? title === 'Alpha'
|
|
711
|
+
: (getBoolean(channel, 'isDefault') ?? false));
|
|
705
712
|
return {
|
|
706
713
|
title,
|
|
707
714
|
description: getString(channel, 'description') ?? '',
|
|
708
715
|
uuid,
|
|
709
716
|
default: isDefault,
|
|
717
|
+
isEmpty,
|
|
710
718
|
generations,
|
|
711
719
|
};
|
|
712
720
|
});
|
|
713
|
-
const filtered = mapped.filter((item) => item.generations.length > 0);
|
|
721
|
+
const filtered = mapped.filter((item) => item.isEmpty || item.generations.length > 0);
|
|
714
722
|
if (!filtered.some((channel) => channel.default)) {
|
|
715
|
-
|
|
716
|
-
|
|
723
|
+
// Prefer the default of the backend, then Stable, then the order.
|
|
724
|
+
const backendDefaultUuids = rawChannels
|
|
725
|
+
.filter(isRecord)
|
|
726
|
+
.filter((channel) => getBoolean(channel, 'isDefault') === true)
|
|
727
|
+
.map((channel) => getString(channel, 'uuid'));
|
|
728
|
+
const selectable = filtered.filter((channel) => !channel.isEmpty);
|
|
729
|
+
const first = selectable.find((channel) => backendDefaultUuids.includes(channel.uuid)) ??
|
|
730
|
+
selectable.find((channel) => channel.title === 'Stable') ??
|
|
731
|
+
selectable[0];
|
|
732
|
+
if (first) {
|
|
733
|
+
first.default = true;
|
|
717
734
|
}
|
|
718
735
|
}
|
|
719
736
|
return filtered;
|
|
@@ -1095,6 +1112,10 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1095
1112
|
title: translations.generationTitle,
|
|
1096
1113
|
channels: channelsWithGenerations,
|
|
1097
1114
|
olderGenerationsLabel: translations.olderGenerationsLabel,
|
|
1115
|
+
// The note names Alpha, so show it only for an empty Alpha.
|
|
1116
|
+
emptyChannelNote: channelsWithGenerations.some((channel) => channel.title === 'Alpha' && channel.isEmpty)
|
|
1117
|
+
? translations.emptyChannelNote
|
|
1118
|
+
: undefined,
|
|
1098
1119
|
olderGenerationsHelperText: translations.olderGenerationsHelperText,
|
|
1099
1120
|
orgUnlockedGenerationsHelperText: translations.orgUnlockedGenerationsHelperText,
|
|
1100
1121
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-markdown": "^8.0.7 || ^10.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@camunda/ccma-api": "
|
|
88
|
+
"@camunda/ccma-api": "6.1.0",
|
|
89
89
|
"@camunda/ccma-shared-types": "10.8.0",
|
|
90
90
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
91
91
|
"cron-parser": "5.10.2",
|