@camunda/ccma-saas-frontend 0.21.14 → 0.22.1

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.
@@ -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 defaultChannel = formElements.generation.channels.find((channel) => channel.uuid === initialValues?.channel) ??
126
- formElements.generation.channels.find((channel) => channel.default === true) ??
127
- formElements.generation.channels[0];
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 = formElements.generation.channels.find((channel) => channel.uuid === channelUuid) ?? formElements.generation.channels[0];
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
+ /** Tooltip of the empty Alpha channel in the channel switcher. */
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) => (_jsx(ToggleGroupItem, { value: option.id, disabled: option.disabled, style: { flex: '0 0 auto', minWidth: 'auto' }, children: option.label }, option.id))) }) }), hasMoreAfter && (_jsx(Button, { kind: 'ghost', size: 'sm', type: 'button', "aria-label": `Scroll ${ariaLabel} to the right`, renderIcon: ChevronRight, onClick: () => scrollByStep(1) }))] }));
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
  },
@@ -52,7 +52,7 @@ function renderInlineLink(value, opts) {
52
52
  const prefix = match[1] ?? '';
53
53
  const label = match[2] ?? opts.labelFallback;
54
54
  const suffix = match[3] ?? '';
55
- return (_jsxs(_Fragment, { children: [prefix, _jsx(Link, { href: opts.href, onClick: (event) => {
55
+ return (_jsxs(_Fragment, { children: [prefix, _jsx(Link, { inline: true, href: opts.href, onClick: (event) => {
56
56
  if (!opts.onNavigate) {
57
57
  return;
58
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
- if (filtered.length > 0) {
716
- filtered[0].default = true;
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.21.14",
3
+ "version": "0.22.1",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -47,29 +47,29 @@
47
47
  "@playwright/test": "1.64.1",
48
48
  "@camunda/c4-identity": "0.0.45",
49
49
  "@camunda/camunda-composite-components": "0.25.5",
50
- "@camunda/design-system": "0.74.0",
51
- "@carbon/react": "1.118.0",
50
+ "@camunda/design-system": "0.75.0",
51
+ "@carbon/react": "1.119.0",
52
52
  "recharts": "3.10.1",
53
- "@chromatic-com/storybook": "5.5.1",
53
+ "@chromatic-com/storybook": "5.6.0",
54
54
  "@mdx-js/react": "3.1.1",
55
- "@storybook/addon-docs": "10.6.2",
56
- "@storybook/addon-links": "10.6.2",
57
- "@storybook/react": "10.6.2",
58
- "@storybook/react-vite": "10.6.2",
55
+ "@storybook/addon-docs": "10.6.3",
56
+ "@storybook/addon-links": "10.6.3",
57
+ "@storybook/react": "10.6.3",
58
+ "@storybook/react-vite": "10.6.3",
59
59
  "@testing-library/jest-dom": "7.0.1",
60
60
  "@testing-library/react": "16.3.3",
61
61
  "@testing-library/user-event": "14.6.8",
62
62
  "eslint-import-resolver-typescript": "4.4.5",
63
63
  "eslint-plugin-react": "7.37.5",
64
64
  "eslint-plugin-react-hooks": "7.1.1",
65
- "eslint-plugin-storybook": "10.6.2",
65
+ "eslint-plugin-storybook": "10.6.3",
66
66
  "jsdom": "30.1.3",
67
- "lucide-react": "1.59.0",
67
+ "lucide-react": "1.61.0",
68
68
  "react": "19.3.1",
69
69
  "react-dom": "19.3.1",
70
70
  "react-is": "19.3.1",
71
71
  "rimraf": "6.1.3",
72
- "storybook": "10.6.2",
72
+ "storybook": "10.6.3",
73
73
  "styled-components": "6.6.0"
74
74
  },
75
75
  "peerDependencies": {
@@ -85,7 +85,7 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "6.0.0",
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",