@camunda/ccma-saas-frontend 0.5.0 → 0.7.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.
Files changed (77) hide show
  1. package/lib/esm/components/c4-charts-dashboard/elements/bar-chart.js +2 -2
  2. package/lib/esm/components/c4-cluster-client-credentials/c4-cluster-client-credentials.js +1 -1
  3. package/lib/esm/components/c4-cluster-client-credentials-identity/c4-cluster-client-credentials-identity.js +1 -1
  4. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.d.ts +1 -1
  5. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +24 -1
  6. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.types.d.ts +14 -1
  7. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  8. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -9
  9. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +6 -0
  10. package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +2 -0
  11. package/lib/esm/components/c4-cluster-overview/cluster-details.js +10 -1
  12. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
  13. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +4 -2
  14. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.mocks.js +1 -1
  15. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +4 -0
  16. package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.js +15 -5
  17. package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.d.ts +12 -1
  18. package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.js +9 -3
  19. package/lib/esm/components/c4-cluster-settings/elements/session-settings.d.ts +13 -0
  20. package/lib/esm/components/c4-cluster-settings/elements/session-settings.js +69 -0
  21. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +19 -1
  22. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.mocks.js +2 -1
  23. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.types.d.ts +1 -0
  24. package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +12 -0
  25. package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +7 -2
  26. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.d.ts +1 -1
  27. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +3 -3
  28. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.types.d.ts +7 -0
  29. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +15 -8
  30. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.types.d.ts +1 -0
  31. package/lib/esm/components/c4-navigation/c4-navigation.js +17 -9
  32. package/lib/esm/components/c4-structured-list/c4-structured-list.js +15 -1
  33. package/lib/esm/components/c4-usage-history/elements/usage-history-charts.d.ts +7 -1
  34. package/lib/esm/components/c4-usage-history/elements/usage-history-charts.js +2 -2
  35. package/lib/esm/components/shared-charts/ds-line-chart.js +2 -2
  36. package/lib/esm/components/shared-charts/recharts-tokens.d.ts +24 -9
  37. package/lib/esm/components/shared-charts/recharts-tokens.js +40 -13
  38. package/lib/esm/i18n/en/entities/orgroles.json +26 -0
  39. package/lib/esm/i18n/en/modals/apiclients.json +4 -1
  40. package/lib/esm/i18n/en/modals/backups.json +2 -0
  41. package/lib/esm/i18n/en/pages/clusterdetails.json +3 -2
  42. package/lib/esm/i18n/en/pages/clusters.json +4 -1
  43. package/lib/esm/i18n/en/pages/orgmanagement.json +9 -1
  44. package/lib/esm/runtime/nav/use-webapp-nav-data.d.ts +18 -0
  45. package/lib/esm/runtime/nav/use-webapp-nav-data.js +39 -15
  46. package/lib/esm/utils/http-error-message.d.ts +14 -0
  47. package/lib/esm/utils/http-error-message.js +35 -0
  48. package/lib/esm/utils/role-labels.d.ts +25 -7
  49. package/lib/esm/utils/role-labels.js +94 -13
  50. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.d.ts +3 -0
  51. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +159 -34
  52. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +3 -0
  53. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +18 -0
  54. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +5 -0
  55. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.d.ts +1 -0
  56. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.d.ts +2 -0
  57. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +16 -3
  58. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.d.ts +19 -0
  59. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +108 -58
  60. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.d.ts +1 -1
  61. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +15 -3
  62. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +3 -0
  63. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +109 -26
  64. package/lib/esm/widgets/clusters/c4-clusters-page.js +18 -1
  65. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +4 -0
  66. package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
  67. package/lib/esm/widgets/management/c4-management-app.js +404 -98
  68. package/lib/esm/widgets/management/c4-management-app.types.d.ts +2 -0
  69. package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +21 -0
  70. package/lib/esm/widgets/management/tabs/c4-management-usage-tab.d.ts +30 -1
  71. package/lib/esm/widgets/management/tabs/c4-management-usage-tab.js +34 -14
  72. package/lib/esm/widgets/management/tabs/c4-management-users-tab.d.ts +2 -1
  73. package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +46 -17
  74. package/lib/esm/widgets/user-details/c4-user-details-page.d.ts +1 -1
  75. package/lib/esm/widgets/user-details/c4-user-details-page.js +22 -8
  76. package/lib/esm/widgets/user-details/c4-user-details-page.types.d.ts +2 -0
  77. package/package.json +11 -11
@@ -66,6 +66,24 @@ function buildBanner(opts) {
66
66
  onDismiss: banner.onDismiss,
67
67
  };
68
68
  }
69
+ if (banner.kind === 'failoverUriUpdateNeeded') {
70
+ const title = banner.hasByom && banner.hasByoidp
71
+ ? safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.titleBoth', 'Update your monitoring and identity provider settings')
72
+ : banner.hasByoidp
73
+ ? safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.titleByoidp', 'Update your identity provider settings')
74
+ : safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.titleByom', 'Update your monitoring settings');
75
+ const subtitle = banner.hasByom && banner.hasByoidp
76
+ ? safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.subtitleBoth', 'This cluster replaced another cluster after a failover. Point your external monitoring tool and identity provider at this cluster.')
77
+ : banner.hasByoidp
78
+ ? safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.subtitleByoidp', 'This cluster replaced another cluster after a failover. Update your identity provider’s redirect URI to point at this cluster.')
79
+ : safeTranslate(t, 'c4console:clusterDetails.banner.failoverUriUpdateNeeded.subtitleByom', 'This cluster replaced another cluster after a failover. Point your external monitoring tool’s scrape endpoint at this cluster.');
80
+ return {
81
+ kind: 'info',
82
+ title,
83
+ subtitle,
84
+ onDismiss: banner.onDismiss,
85
+ };
86
+ }
69
87
  if (banner.kind === 'unsupportedGeneration') {
70
88
  const subtitle = banner.isAlphaGeneration
71
89
  ? safeTranslate(t, 'c4console:clusterDetails.banner.unsupportedGeneration.subtitleAlpha', 'Alpha-generations can’t be updated. Create a new cluster to access the latest features.')
@@ -12,6 +12,11 @@ export type C4ClusterDetailsPageBanner = {
12
12
  } | {
13
13
  kind: 'restoreFailed';
14
14
  onDismiss: () => void;
15
+ } | {
16
+ kind: 'failoverUriUpdateNeeded';
17
+ hasByom: boolean;
18
+ hasByoidp: boolean;
19
+ onDismiss: () => void;
15
20
  };
16
21
  export type C4ClusterDetailsTab = C4TabProps;
17
22
  export interface C4ClusterDetailsPageProps {
@@ -25,6 +25,7 @@ interface C4ClusterDetailsAlertsTabProps {
25
25
  reportType: ReportType;
26
26
  webhookUrl?: string;
27
27
  hmacSecret?: string;
28
+ ignoreHead?: boolean;
28
29
  }) => Promise<void>;
29
30
  onUpdateAlert: (params: {
30
31
  alertId: string;
@@ -11,6 +11,8 @@ interface C4ClusterDetailsEncryptionTabProps {
11
11
  activeTabId: string;
12
12
  onReloadCluster: () => void;
13
13
  restoreInProgress?: boolean;
14
+ /** True when this cluster was created by failing over from a sibling. */
15
+ isFailoverTarget?: boolean;
14
16
  docsUrls: {
15
17
  encryption: string;
16
18
  encryptionCli: string;
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ConsoleByokScriptsService, ConsoleClusterService, } from '@camunda/ccma-api';
3
- import { deriveEncryptionStatus, } from '@camunda/ccma-shared-types';
3
+ import { deriveEncryptionStatus, deriveFailoverKeyPolicyPrincipals, } from '@camunda/ccma-shared-types';
4
4
  import { useCallback, useEffect, useState } from 'react';
5
5
  import { C4ClusterDetailsEncryption } from '../../../components/c4-cluster-details-encryption/c4-cluster-details-encryption.js';
6
6
  // ARN validation patterns
@@ -24,7 +24,7 @@ function toIsoString(value) {
24
24
  return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
25
25
  }
26
26
  export const C4ClusterDetailsEncryptionTab = (props) => {
27
- const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, docsUrls, } = props;
27
+ const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, isFailoverTarget, docsUrls, } = props;
28
28
  // BYOK script content
29
29
  const [byokCliSingle, setByokCliSingle] = useState('');
30
30
  const [byokCliDual, setByokCliDual] = useState('');
@@ -127,6 +127,13 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
127
127
  };
128
128
  // Render templates with cluster-specific values
129
129
  const tenantRoleArn = cluster?.status?.accountId ?? '';
130
+ // For a failed-over cluster, the three principals in the failover region
131
+ // that need access to the (already configured) keys. All are derived from
132
+ // the cluster's own role ARN plus the stableId carried over from its
133
+ // source, so nothing has to be persisted or fetched separately.
134
+ const failoverKeyPolicy = isFailoverTarget && encryptionStatus === 'ExternalEncryptionKeyNotReady'
135
+ ? deriveFailoverKeyPolicyPrincipals(tenantRoleArn, cluster?.stableId)
136
+ : undefined;
130
137
  const renderedPolicy = byokKeyPolicy.replaceAll('<TENANT-ROLE-ARN>', tenantRoleArn);
131
138
  const cliTemplate = isDualRegion ? byokCliDual : byokCliSingle;
132
139
  const renderedCli = cliTemplate
@@ -190,7 +197,7 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
190
197
  isDualRegion,
191
198
  status: encryptionStatus,
192
199
  accountId: tenantRoleArn,
193
- }, encryption: encryption, scripts: {
200
+ }, encryption: encryption, failoverKeyPolicy: failoverKeyPolicy, scripts: {
194
201
  cliScript: renderedCli,
195
202
  keyPolicy: renderedPolicy,
196
203
  }, text: {
@@ -227,6 +234,12 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
227
234
  confirmEncryptionBothRegions: 'Confirm Encryption for both regions',
228
235
  downloadCliScript: 'Download CLI script',
229
236
  downloadKeyPolicy: 'Download key policy',
237
+ failoverKeyPolicyTitle: 'Action required',
238
+ failoverKeyPolicyText: 'Update your encryption key policy so this cluster can read its restored data.',
239
+ failoverKeyPolicyInstruction: 'This cluster uses the encryption keys from the cluster it was failed over from, so no new key is needed. Grant the three roles below the same key permissions as your original cluster, on both the primary and secondary key. Until then, the restore cannot decrypt your backup data. Policy changes can take about 10 minutes to propagate, so allow some time after saving before the restore proceeds.',
240
+ failoverKeyPolicyCloneRole: 'Clone role — copies backup data into this cluster',
241
+ failoverKeyPolicyClusterRole: "This cluster's role",
242
+ failoverKeyPolicyReplicationRole: 'Replication role — replicates to the secondary region',
230
243
  }, urls: {
231
244
  byokMain: docsUrls.encryption,
232
245
  cliScriptLearnMore: docsUrls.encryptionCli,
@@ -3,6 +3,17 @@ import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
3
3
  import type { JSX } from 'react';
4
4
  import type { C4ClusterDetailsNavigateEvent } from '../c4-cluster-details-app.types.js';
5
5
  type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
6
+ export declare function parseCronSchedule(schedule: string): {
7
+ frequency: string;
8
+ startTime?: string;
9
+ };
10
+ export type ScheduleFrequency = '15min' | '30min' | 'hourly' | 'daily' | 'weekly';
11
+ export declare function buildScheduleCronOverrides(frequency: ScheduleFrequency, startingHour: number, startingMinute: number, weekdays: string[]): Record<string, unknown>;
12
+ export declare function deriveScheduleFormState(schedule: string): {
13
+ frequency: ScheduleFrequency;
14
+ startingTime: string;
15
+ weekdays: string[];
16
+ } | undefined;
6
17
  interface C4ClusterDetailsHotBackupsTabProps {
7
18
  cluster: ConsoleClusterDto | undefined;
8
19
  orgId: string;
@@ -10,6 +21,14 @@ interface C4ClusterDetailsHotBackupsTabProps {
10
21
  apiConfig: RequestBaseParamsConfig;
11
22
  canMutateCluster: boolean;
12
23
  isHotBackupEnabled: boolean;
24
+ /**
25
+ * Org-limit overrides for how many backups the operator retains before
26
+ * deleting the oldest (`hotBackupManualRetainedCount` /
27
+ * `hotBackupScheduledRetainedCount`). Defaults to 3 — the operator's own
28
+ * default — when unset.
29
+ */
30
+ manualBackupRetainedCount?: number;
31
+ scheduledBackupRetainedCount?: number;
13
32
  docsUrls: {
14
33
  hotBackups: string;
15
34
  support: string;
@@ -32,11 +32,21 @@ function convertFeWeekdayToCron(weekday) {
32
32
  }
33
33
  return weekday + 1;
34
34
  }
35
- function parseCronSchedule(schedule) {
35
+ export function parseCronSchedule(schedule) {
36
36
  try {
37
37
  const cron = CronExpressionParser.parse(schedule);
38
38
  const isHourly = cron.fields.hour.values.length > 1;
39
39
  if (isHourly) {
40
+ // Sub-hourly schedules reuse the "every hour" hour-field (all 24
41
+ // values) with extra minute marks layered on top — see
42
+ // `buildScheduleCronOverrides`.
43
+ const minuteCount = cron.fields.minute.values.length;
44
+ if (minuteCount === 4) {
45
+ return { frequency: 'Every 15 minutes' };
46
+ }
47
+ if (minuteCount === 2) {
48
+ return { frequency: 'Every 30 minutes' };
49
+ }
40
50
  return { frequency: 'Hourly' };
41
51
  }
42
52
  const hour = Number(cron.fields.hour.values[0]);
@@ -84,12 +94,81 @@ function parseCronSchedule(schedule) {
84
94
  };
85
95
  }
86
96
  }
97
+ const SUB_HOURLY_MINUTES = {
98
+ '15min': [0, 15, 30, 45],
99
+ '30min': [0, 30],
100
+ };
101
+ export function buildScheduleCronOverrides(frequency, startingHour, startingMinute, weekdays) {
102
+ const totalHours = 24;
103
+ const spansAllHours = frequency === 'hourly' || frequency === '15min' || frequency === '30min';
104
+ const hours = spansAllHours
105
+ ? Array.from({ length: totalHours }, (_, index) => index)
106
+ : [startingHour];
107
+ const fieldOverrides = {
108
+ hour: hours,
109
+ minute: SUB_HOURLY_MINUTES[frequency] ?? [startingMinute],
110
+ };
111
+ if (frequency === 'weekly') {
112
+ // Guard against an unrecognized weekday name: `indexOf` would otherwise
113
+ // return -1, and `convertFeWeekdayToCron(-1)` silently yields 0 (Sunday),
114
+ // injecting a day the user never selected.
115
+ fieldOverrides.dayOfWeek = weekdays
116
+ .filter((day) => WEEKDAYS.includes(day))
117
+ .map((day) => convertFeWeekdayToCron(WEEKDAYS.indexOf(day)));
118
+ }
119
+ return fieldOverrides;
120
+ }
121
+ // Derives the "Edit schedule" modal's form state from an existing schedule's
122
+ // cron string. Mirrors `parseCronSchedule`'s hour/minute reading (same
123
+ // sub-hourly-spans-all-24-hours shape from `buildScheduleCronOverrides`), but
124
+ // returns the internal `ScheduleFrequency` value plus local start time /
125
+ // weekdays for populating the editable form, rather than a display label.
126
+ // Returns `undefined` for an unparseable schedule.
127
+ export function deriveScheduleFormState(schedule) {
128
+ try {
129
+ const cron = CronExpressionParser.parse(schedule);
130
+ const isHourly = cron.fields.hour.values.length > 1;
131
+ // Convert UTC time to local time
132
+ const utcHour = Number(cron.fields.hour.values[0]);
133
+ const utcMinute = Number(cron.fields.minute.values[0]);
134
+ const utcDate = new Date();
135
+ utcDate.setUTCHours(utcHour);
136
+ utcDate.setUTCMinutes(utcMinute);
137
+ const localTime = `${String(utcDate.getHours()).padStart(2, '0')}:${String(utcDate.getMinutes()).padStart(2, '0')}`;
138
+ if (isHourly) {
139
+ const minuteCount = cron.fields.minute.values.length;
140
+ const frequency = minuteCount === 4 ? '15min' : minuteCount === 2 ? '30min' : 'hourly';
141
+ return { frequency, startingTime: '00:00', weekdays: [] };
142
+ }
143
+ const isDaily = cron.fields.dayOfWeek.values.length === 0 ||
144
+ cron.fields.dayOfWeek.values.length === 8;
145
+ if (isDaily) {
146
+ return { frequency: 'daily', startingTime: localTime, weekdays: [] };
147
+ }
148
+ const weekdays = cron.fields.dayOfWeek.values.filter((day) => typeof day === 'number')
149
+ .map((day) => WEEKDAYS[convertCronWeekdayToFe(day)])
150
+ .filter((weekday) => Boolean(weekday));
151
+ return { frequency: 'weekly', startingTime: localTime, weekdays };
152
+ }
153
+ catch {
154
+ return undefined;
155
+ }
156
+ }
87
157
  function toDateOrDash(value) {
88
158
  if (!value)
89
159
  return '-';
90
160
  const date = value instanceof Date ? value : new Date(String(value));
91
161
  return Number.isNaN(date.getTime()) ? '-' : date;
92
162
  }
163
+ // Manual (on-demand) backups are created with `generateName: 'on-demand-'`
164
+ // (k8sHotBackup.controller.ts); scheduled ones are named `scheduled-...` by
165
+ // the operator. There's no dedicated field on BackupDto for this — the name
166
+ // prefix is the only signal. Checked on `name`, not `uuid`, to match the
167
+ // backend's own throttle check (k8sHotBackup.controller.ts) in case the two
168
+ // ever diverge.
169
+ function isManualBackup(backup) {
170
+ return backup.name.includes('on-demand');
171
+ }
93
172
  function safeTranslate(t, key, fallback) {
94
173
  if (!t)
95
174
  return fallback;
@@ -98,7 +177,13 @@ function safeTranslate(t, key, fallback) {
98
177
  }
99
178
  const C4ClusterDetailsHotBackupsTabImpl = (props) => {
100
179
  const { Select, SelectItem } = useSelectFamily();
101
- const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, docsUrls, t, onNavigate, onReloadCluster, } = props;
180
+ const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, manualBackupRetainedCount, scheduledBackupRetainedCount, docsUrls, t, onNavigate, onReloadCluster, } = props;
181
+ // The operator (BackupRetention CR / BackupSchedule history limits) falls
182
+ // back to 3 whenever the org has no override — see hotBackupManualRetainedCount
183
+ // / hotBackupScheduledRetainedCount in SalesPlan.dto.ts.
184
+ const manualRetainedCount = manualBackupRetainedCount ?? 3;
185
+ const scheduledRetainedCount = scheduledBackupRetainedCount ?? 3;
186
+ const minCreatePeriodMinutes = HOTBACKUP_MIN_CREATE_PERIOD / (60 * 1000);
102
187
  const data = useC4ConsoleData();
103
188
  const runtime = useC4ConsoleRuntime();
104
189
  const { add: addNotification } = useC4ConsoleNotifications();
@@ -238,7 +323,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
238
323
  uuid: backup.uuid,
239
324
  name: backup.name,
240
325
  status: backup.status,
241
- type: backup.uuid.includes('on-demand') ? 'Manual' : 'Scheduled',
326
+ type: isManualBackup(backup) ? 'Manual' : 'Scheduled',
242
327
  started: toDateOrDash(backup.created),
243
328
  completed: toDateOrDash(backup.completed),
244
329
  // Resolved server-side from the backup's `generationUuid` label. Falls
@@ -256,7 +341,12 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
256
341
  tasklistStatus: String(backup.tasklistStatus),
257
342
  optimizeStatus: String(backup.optimizeStatus),
258
343
  }));
344
+ // Only manual backups count toward the 15-minute throttle: a scheduled run
345
+ // (now possibly every 15/30 minutes) must never block the customer from
346
+ // creating a manual backup — matches the backend's own check in
347
+ // k8sHotBackup.controller.ts.
259
348
  const lastCreatedTimestamp = Math.max(...hotBackups
349
+ .filter(isManualBackup)
260
350
  .map((b) => toDateOrDash(b.created))
261
351
  .filter((d) => d !== '-')
262
352
  .map((d) => d.getTime()), 0);
@@ -381,45 +471,14 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
381
471
  setBackupMutationError('');
382
472
  setScheduleStartingTimeInvalid(false);
383
473
  const schedule = backupSchedule?.schedule ?? '';
384
- if (schedule) {
385
- try {
386
- const cron = CronExpressionParser.parse(schedule);
387
- const isHourly = cron.fields.hour.values.length > 1;
388
- // Convert UTC time to local time
389
- const utcHour = Number(cron.fields.hour.values[0]);
390
- const utcMinute = Number(cron.fields.minute.values[0]);
391
- const utcDate = new Date();
392
- utcDate.setUTCHours(utcHour);
393
- utcDate.setUTCMinutes(utcMinute);
394
- const localHour = utcDate.getHours();
395
- const localMinute = utcDate.getMinutes();
396
- if (isHourly) {
397
- setScheduleFrequency('hourly');
398
- setScheduleStartingTime('00:00');
399
- setScheduleWeekdays([]);
400
- }
401
- else if (cron.fields.dayOfWeek.values.length === 0 ||
402
- cron.fields.dayOfWeek.values.length === 8) {
403
- setScheduleFrequency('daily');
404
- setScheduleStartingTime(`${String(localHour).padStart(2, '0')}:${String(localMinute).padStart(2, '0')}`);
405
- setScheduleWeekdays([]);
406
- }
407
- else {
408
- setScheduleFrequency('weekly');
409
- setScheduleStartingTime(`${String(localHour).padStart(2, '0')}:${String(localMinute).padStart(2, '0')}`);
410
- setScheduleWeekdays(cron.fields.dayOfWeek.values.filter((day) => typeof day === 'number').map((day) => {
411
- const index = convertCronWeekdayToFe(day);
412
- return WEEKDAYS[index] ?? '';
413
- }));
414
- }
415
- setScheduleIsCreate(false);
416
- }
417
- catch {
418
- setScheduleFrequency('daily');
419
- setScheduleStartingTime('00:00');
420
- setScheduleWeekdays([]);
421
- setScheduleIsCreate(true);
422
- }
474
+ const derived = schedule
475
+ ? deriveScheduleFormState(schedule)
476
+ : undefined;
477
+ if (derived) {
478
+ setScheduleFrequency(derived.frequency);
479
+ setScheduleStartingTime(derived.startingTime);
480
+ setScheduleWeekdays(derived.weekdays);
481
+ setScheduleIsCreate(false);
423
482
  }
424
483
  else {
425
484
  setScheduleFrequency('daily');
@@ -483,7 +542,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
483
542
  setBackupMutationBusy(false);
484
543
  }
485
544
  })();
486
- }, children: _jsxs(Stack, { gap: 4, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsxs("div", { children: ["You can create a manual backup every five hours. Only the three most recent successful manual backups are kept. If you already have three manual backups, the oldest manual backup is automatically removed to make space for the new backup. You can also have three scheduled backups in addition to your three manual backups.", ' ', _jsx("a", { href: docsUrls.hotBackups, target: '_blank', rel: 'noreferrer', onClick: () => {
545
+ }, children: _jsxs(Stack, { gap: 4, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsxs("div", { children: ["You can create a manual backup every ", minCreatePeriodMinutes, ' ', "minutes. Only the ", manualRetainedCount, " most recent successful manual backups are kept. If you already have ", manualRetainedCount, ' ', "manual backups, the oldest manual backup is automatically removed to make space for the new backup. You can also have", ' ', scheduledRetainedCount, " scheduled backups in addition to your", ' ', manualRetainedCount, " manual backups.", ' ', _jsx("a", { href: docsUrls.hotBackups, target: '_blank', rel: 'noreferrer', onClick: () => {
487
546
  trackDocsOpen('cluster-backups', docsUrls.hotBackups);
488
547
  onNavigate?.({
489
548
  kind: 'openUrl',
@@ -628,18 +687,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
628
687
  time.setMinutes(Number(minuteStr));
629
688
  const startingHour = time.getUTCHours();
630
689
  const startingMinute = time.getUTCMinutes();
631
- const totalHours = 24;
632
- let hours = [startingHour];
633
- if (scheduleFrequency === 'hourly') {
634
- hours = Array.from({ length: totalHours }, (_, index) => index);
635
- }
636
- const fieldOverrides = {
637
- hour: hours,
638
- minute: [startingMinute],
639
- };
640
- if (scheduleFrequency === 'weekly') {
641
- fieldOverrides.dayOfWeek = scheduleWeekdays.map((day) => convertFeWeekdayToCron(WEEKDAYS.indexOf(day)));
642
- }
690
+ const fieldOverrides = buildScheduleCronOverrides(scheduleFrequency, startingHour, startingMinute, scheduleWeekdays);
643
691
  const exp = CronExpression.fieldsToExpression(CronFieldCollection.from(baseCron.fields, fieldOverrides));
644
692
  await ConsoleBackupScheduleService.updateBackupSchedule({
645
693
  config: apiConfig,
@@ -660,7 +708,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
660
708
  setBackupMutationBusy(false);
661
709
  }
662
710
  })();
663
- }, children: _jsxs(Stack, { gap: 6, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsxs("p", { children: ["Only the three most recent successful scheduled backups are kept. If you already have three scheduled backups, the oldest scheduled backup is automatically removed to make space for the new backup. You can also have three manual backups in addition to your three scheduled backups.", ' ', _jsx("a", { href: docsUrls.hotBackups, target: '_blank', rel: 'noreferrer', onClick: () => {
711
+ }, children: _jsxs(Stack, { gap: 6, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsxs("p", { children: ["Only the ", scheduledRetainedCount, " most recent successful scheduled backups are kept. If you already have ", scheduledRetainedCount, ' ', "scheduled backups, the oldest scheduled backup is automatically removed to make space for the new backup. You can also have", ' ', manualRetainedCount, " manual backups in addition to your", ' ', scheduledRetainedCount, " scheduled backups.", ' ', _jsx("a", { href: docsUrls.hotBackups, target: '_blank', rel: 'noreferrer', onClick: () => {
664
712
  trackDocsOpen('cluster-backups', docsUrls.hotBackups);
665
713
  onNavigate?.({
666
714
  kind: 'openUrl',
@@ -670,7 +718,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
670
718
  const newFreq = event.target.value;
671
719
  trackEvent(`listBackups:schedule:modal:confirm:${newFreq}`, `Selected backup frequency is ${newFreq} `, { create: scheduleIsCreate });
672
720
  setScheduleFrequency(newFreq);
673
- }, children: [_jsx(SelectItem, { value: 'hourly', text: 'Hourly' }, 'schedule-frequency-hourly'), _jsx(SelectItem, { value: 'daily', text: 'Daily' }, 'schedule-frequency-daily'), _jsx(SelectItem, { value: 'weekly', text: 'Weekly' }, 'schedule-frequency-weekly')] }), scheduleFrequency === 'weekly' && (_jsxs("fieldset", { className: 'cds--fieldset', children: [_jsx("legend", { className: 'cds--label', children: "Select days" }), _jsx("div", { style: {
721
+ }, children: [_jsx(SelectItem, { value: '15min', text: 'Every 15 minutes' }, 'schedule-frequency-15min'), _jsx(SelectItem, { value: '30min', text: 'Every 30 minutes' }, 'schedule-frequency-30min'), _jsx(SelectItem, { value: 'hourly', text: 'Hourly' }, 'schedule-frequency-hourly'), _jsx(SelectItem, { value: 'daily', text: 'Daily' }, 'schedule-frequency-daily'), _jsx(SelectItem, { value: 'weekly', text: 'Weekly' }, 'schedule-frequency-weekly')] }), scheduleFrequency === 'weekly' && (_jsxs("fieldset", { className: 'cds--fieldset', children: [_jsx("legend", { className: 'cds--label', children: "Select days" }), _jsx("div", { style: {
674
722
  display: 'grid',
675
723
  gridTemplateColumns: 'repeat(auto-fill, 120px)',
676
724
  gridGap: '0px 0px',
@@ -692,7 +740,9 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
692
740
  }, children: _jsx(TextInput, { id: 'backup-schedule-start-time', labelText: '', style: { minWidth: '120px' }, placeholder: 'hh:mm', value: scheduleStartingTime, onChange: (event) => {
693
741
  setScheduleStartingTime(event.target.value);
694
742
  setScheduleStartingTimeInvalid(false);
695
- }, invalid: scheduleStartingTimeInvalid, invalidText: safeTranslate(t, 'backups:schedule.create.startingInvalidText', 'Required field'), type: 'time' }) }), "UTC ", -new Date().getTimezoneOffset() / 60 > 0 ? '+' : ' ', -new Date().getTimezoneOffset() / 60, ' ', safeTranslate(t, 'backups:schedule.create.timezone', '(local time zone)')] })), scheduleFrequency === 'hourly' && (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [_jsx("span", { children: safeTranslate(t, 'backups:schedule.create.hourly', 'Create a backup every hour starting at') }), _jsx("div", { style: { display: 'inline-block' }, children: `${(new Date().getUTCHours() + 1)
743
+ }, invalid: scheduleStartingTimeInvalid, invalidText: safeTranslate(t, 'backups:schedule.create.startingInvalidText', 'Required field'), type: 'time' }) }), "UTC ", -new Date().getTimezoneOffset() / 60 > 0 ? '+' : ' ', -new Date().getTimezoneOffset() / 60, ' ', safeTranslate(t, 'backups:schedule.create.timezone', '(local time zone)')] })), (scheduleFrequency === '15min' || scheduleFrequency === '30min') && (_jsx("span", { children: safeTranslate(t, scheduleFrequency === '15min'
744
+ ? 'backups:schedule.create.15min'
745
+ : 'backups:schedule.create.30min', `Create a backup every ${scheduleFrequency === '15min' ? '15' : '30'} minutes`) })), scheduleFrequency === 'hourly' && (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [_jsx("span", { children: safeTranslate(t, 'backups:schedule.create.hourly', 'Create a backup every hour starting at') }), _jsx("div", { style: { display: 'inline-block' }, children: `${(new Date().getUTCHours() + 1)
696
746
  .toString()
697
747
  .padStart(2, '0')}:${new Date()
698
748
  .getUTCMinutes()
@@ -1,5 +1,5 @@
1
1
  import type { RequestBaseParamsConfig } from '@camunda/ccma-api';
2
- import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
2
+ import { type ConsoleClusterDto } from '@camunda/ccma-shared-types';
3
3
  type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
4
4
  interface C4ClusterDetailsIpWhitelistTabProps {
5
5
  cluster: ConsoleClusterDto | undefined;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ConsoleIpWhitelistService, ConsoleSecureConnectivityService, } from '@camunda/ccma-api';
3
+ import { normalizeCIDRList, } from '@camunda/ccma-shared-types';
3
4
  import { Form } from '@carbon/react';
4
5
  import { useCallback, useEffect, useRef, useState } from 'react';
5
6
  import { C4ClusterDetailsIpWhitelist } from '../../../components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
@@ -185,7 +186,10 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
185
186
  trackEvent('clusterOverviewIpWhitelists:updateModal:open', 'Open Update IP Whitelist Modal', { ipIndex });
186
187
  const index = ipWhitelistItems.findIndex((ip) => ip.id === String(ipIndex));
187
188
  setSelectedIpIndex(index);
188
- setIpValue(ipWhitelistItems[index]?.ip ?? '');
189
+ // Entries stored before allowlist values were normalized can carry
190
+ // stray whitespace; clean it on prefill so re-saving the entry fixes
191
+ // it up.
192
+ setIpValue(normalizeCIDRList(ipWhitelistItems[index]?.ip ?? ''));
189
193
  setIpDescription(ipWhitelistItems[index]?.description ?? '');
190
194
  setIpMutationError('');
191
195
  setUpdateIpOpen(true);
@@ -230,7 +234,11 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
230
234
  setIpMutationError('');
231
235
  try {
232
236
  const next = ipWhitelistItems.map((item, index) => index === selectedIpIndex
233
- ? { ...item, ip: ipValue, description: ipDescription }
237
+ ? {
238
+ ...item,
239
+ ip: normalizeCIDRList(ipValue),
240
+ description: ipDescription,
241
+ }
234
242
  : item);
235
243
  await persistIpWhitelist(next);
236
244
  setUpdateIpOpen(false);
@@ -245,7 +253,11 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
245
253
  })();
246
254
  }, children: _jsx(Form, { onSubmit: (e) => {
247
255
  e.preventDefault();
248
- }, children: _jsxs(Stack, { gap: 6, children: [ipMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'ipwhitelist:update.error.generic', "We're having trouble updating the IP(s)"), subtitle: ipMutationError, lowContrast: true, hideCloseButton: true })), _jsx(TextInput, { id: 'ip-input-whitelist-update', labelText: safeTranslate(t, 'ipwhitelist:create.fields.ips', 'IP(s)'), helperText: safeTranslate(t, 'ipwhitelist:create.fields.ipsHelper', 'Comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1'), value: ipValue, maxLength: 50, onChange: (event) => setIpValue(event.target.value) }), _jsx(TextInput, { id: 'name-input-whitelist-update', labelText: safeTranslate(t, 'ipwhitelist:create.fields.description', 'Description (optional)'), value: ipDescription, maxLength: 1024, onChange: (event) => setIpDescription(event.target.value) })] }) }) }), _jsx(Modal, { open: deleteIpOpen, danger: true, modalHeading: `${safeTranslate(t, 'ipwhitelist:delete.heading', 'Delete IP(s)')}: ${ipWhitelistItems[selectedIpIndex]?.ip ?? ''}`, primaryButtonText: safeTranslate(t, 'ipwhitelist:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate(t, 'ipwhitelist:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: ipMutationBusy, onRequestClose: () => {
256
+ }, children: _jsxs(Stack, { gap: 6, children: [ipMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'ipwhitelist:update.error.generic', "We're having trouble updating the IP(s)"), subtitle: ipMutationError, lowContrast: true, hideCloseButton: true })), _jsx(TextInput, { id: 'ip-input-whitelist-update', labelText: safeTranslate(t, 'ipwhitelist:create.fields.ips', 'IP(s)'), helperText: safeTranslate(t, 'ipwhitelist:create.fields.ipsHelper', 'Comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1'), value: ipValue, maxLength: 50,
257
+ // Whitespace is never valid in a CIDR list, and a stray space
258
+ // (typed or pasted) is stored verbatim and breaks the cluster
259
+ // controller — so strip it as the user types.
260
+ onChange: (event) => setIpValue(normalizeCIDRList(event.target.value)) }), _jsx(TextInput, { id: 'name-input-whitelist-update', labelText: safeTranslate(t, 'ipwhitelist:create.fields.description', 'Description (optional)'), value: ipDescription, maxLength: 1024, onChange: (event) => setIpDescription(event.target.value) })] }) }) }), _jsx(Modal, { open: deleteIpOpen, danger: true, modalHeading: `${safeTranslate(t, 'ipwhitelist:delete.heading', 'Delete IP(s)')}: ${ipWhitelistItems[selectedIpIndex]?.ip ?? ''}`, primaryButtonText: safeTranslate(t, 'ipwhitelist:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate(t, 'ipwhitelist:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: ipMutationBusy, onRequestClose: () => {
249
261
  trackEvent('clusterOverviewIpWhitelists:deleteModal:cancel', 'Close Delete IP Whitelist Modal', { ipIndex: selectedIpIndex });
250
262
  setDeleteIpOpen(false);
251
263
  }, onRequestSubmit: () => {
@@ -1487,6 +1487,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
1487
1487
  },
1488
1488
  wakeLabel: safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeLabel', 'Resume cluster'),
1489
1489
  wakeVisibility: canWakeCluster && !isClusterPausedReconciliation && !restoreInProgress,
1490
+ wakeDisabledReason: cluster?.isFailoverSource === true
1491
+ ? safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeDisabledFailoverSource', 'This cluster was failed over and can no longer be resumed.')
1492
+ : undefined,
1490
1493
  sleepAction: canSleepCluster && !isClusterPausedReconciliation && !restoreInProgress
1491
1494
  ? async () => {
1492
1495
  const { ConsoleClusterService } = await import('@camunda/ccma-api');