@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
@@ -15,6 +15,9 @@ const SWITCHABLE_APPS = [
15
15
  'optimize',
16
16
  'admin',
17
17
  ];
18
+ // Returned when there is nothing to show, so the result is referentially stable
19
+ // while idle or loading regardless of the caller's `options` identity.
20
+ const NO_ENTRIES = [];
18
21
  /**
19
22
  * Headless equivalent of c3's `useClusterSidebarEntries`. Reads the org's
20
23
  * clusters from `useC4ConsoleData` (auto-fetching them on first use) and
@@ -22,23 +25,28 @@ const SWITCHABLE_APPS = [
22
25
  * presentational navigation library maps `app` to its own icon and renders the
23
26
  * rows. Returns `[]` while data is loading or nothing is renderable.
24
27
  *
28
+ * Pass `enabled: false` to keep it idle when mounted above authentication.
29
+ *
25
30
  * Requires `C4ConsoleRuntimeProvider` + `C4ConsoleDataProvider`.
26
31
  */
27
32
  export function useC4ClusterNavEntries(orgId, options = {}) {
28
33
  const data = useC4ConsoleData();
34
+ const { apps = DEFAULT_NAV_APPS, isAppVisible, appTeaserHrefs, appLabels, enabled = true, } = options;
29
35
  useEffect(() => {
30
- if (orgId) {
36
+ if (enabled && orgId) {
31
37
  void data.fetchWebappClusters(orgId);
32
38
  }
33
- }, [data, orgId]);
39
+ }, [data, orgId, enabled]);
34
40
  // Read through useObserver so this hook re-renders its caller when the
35
41
  // webapp-cluster data changes, even when that caller is not itself an
36
42
  // observer (the data context value is stable and no longer bumps globally).
37
- const clusters = useObserver(() => data.getWebappClusters(orgId));
38
- const { apps = DEFAULT_NAV_APPS, isAppVisible, appTeaserHrefs, appLabels, } = options;
43
+ // While disabled the read is skipped entirely: touching the store here would
44
+ // subscribe to that observable and keep re-rendering the caller on unrelated
45
+ // store changes, so a disabled hook would not really be idle.
46
+ const clusters = useObserver(() => enabled ? data.getWebappClusters(orgId) : undefined);
39
47
  return useMemo(() => {
40
48
  if (!clusters) {
41
- return [];
49
+ return NO_ENTRIES;
42
50
  }
43
51
  return clusters.flatMap((cluster) => {
44
52
  const appEntries = apps.flatMap((app) => {
@@ -82,6 +90,11 @@ export function useC4ClusterNavEntries(orgId, options = {}) {
82
90
  });
83
91
  }, [clusters, apps, isAppVisible, appTeaserHrefs, appLabels]);
84
92
  }
93
+ // ── Webapp breadcrumbs ──────────────────────────────────────────────────────
94
+ // Returned by the disabled hook, so the result is referentially stable while
95
+ // idle even when the caller passes an inline `webappLinks` object (which would
96
+ // otherwise invalidate the memo on every render).
97
+ const NO_CRUMBS = [];
85
98
  /**
86
99
  * Headless equivalent of c3's `useClusterWebappBreadcrumbs`. Builds the
87
100
  * `[Org] > [Cluster] > [App]` chain as plain data (labels, hrefs, dropdown
@@ -92,24 +105,34 @@ export function useC4ClusterNavEntries(orgId, options = {}) {
92
105
  * Requires `C4ConsoleRuntimeProvider` + `C4ConsoleDataProvider`.
93
106
  */
94
107
  export function useC4WebappBreadcrumbData(options) {
95
- const { orgId, currentApp, currentClusterUuid, webappLinks } = options;
108
+ const { orgId, currentApp, currentClusterUuid, webappLinks, enabled = true, } = options;
96
109
  const runtime = useC4ConsoleRuntime();
97
110
  const data = useC4ConsoleData();
98
111
  useEffect(() => {
99
- void data.fetchMyOrgs();
100
- }, [data]);
112
+ if (enabled) {
113
+ void data.fetchMyOrgs();
114
+ }
115
+ }, [data, enabled]);
101
116
  useEffect(() => {
102
- if (orgId) {
117
+ if (enabled && orgId) {
103
118
  void data.fetchWebappClusters(orgId);
104
119
  }
105
- }, [data, orgId]);
120
+ }, [data, orgId, enabled]);
106
121
  // Read through useObserver so this hook re-renders its caller when the orgs
107
- // or webapp-cluster data changes, even for non-observer callers.
108
- const { orgs, clusters } = useObserver(() => ({
109
- orgs: data.getMyOrgs(),
110
- clusters: data.getWebappClusters(orgId),
111
- }));
122
+ // or webapp-cluster data changes, even for non-observer callers. While
123
+ // disabled the reads are skipped entirely: touching the store here would
124
+ // subscribe to those observables and keep re-rendering the caller on
125
+ // unrelated store changes, so a disabled hook would not really be idle.
126
+ const { orgs, clusters } = useObserver(() => enabled
127
+ ? {
128
+ orgs: data.getMyOrgs(),
129
+ clusters: data.getWebappClusters(orgId),
130
+ }
131
+ : { orgs: undefined, clusters: undefined });
112
132
  return useMemo(() => {
133
+ if (!enabled) {
134
+ return NO_CRUMBS;
135
+ }
113
136
  const crumbs = [];
114
137
  const modelerUrl = webappLinks?.modeler ?? runtime.publicUrls?.modelerBaseUrl;
115
138
  const allOrgs = orgs ?? [];
@@ -208,6 +231,7 @@ export function useC4WebappBreadcrumbData(options) {
208
231
  });
209
232
  return crumbs;
210
233
  }, [
234
+ enabled,
211
235
  orgs,
212
236
  clusters,
213
237
  orgId,
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The user-facing reason a request was rejected, or `undefined` when there
3
+ * isn't one worth showing.
4
+ *
5
+ * Backends send their reason as the plain-text response body (see
6
+ * `errorMiddleware`), and `packages/api` puts that body on `HttpError.message`
7
+ * (its constructor forwards its `statusText` argument to `super()`, so
8
+ * `.message` — not `.statusText` — is the body).
9
+ *
10
+ * Only 4xx reasons are surfaced: they indicate a client-side rejection (for
11
+ * example unmet preconditions like "you are not in more than one org"). 5xx
12
+ * bodies are our own failure text and tell the user nothing they can use.
13
+ */
14
+ export declare function clientErrorMessage(error: unknown): string | undefined;
@@ -0,0 +1,35 @@
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
+ import { HttpError } from '@camunda/ccma-api';
7
+ /**
8
+ * The user-facing reason a request was rejected, or `undefined` when there
9
+ * isn't one worth showing.
10
+ *
11
+ * Backends send their reason as the plain-text response body (see
12
+ * `errorMiddleware`), and `packages/api` puts that body on `HttpError.message`
13
+ * (its constructor forwards its `statusText` argument to `super()`, so
14
+ * `.message` — not `.statusText` — is the body).
15
+ *
16
+ * Only 4xx reasons are surfaced: they indicate a client-side rejection (for
17
+ * example unmet preconditions like "you are not in more than one org"). 5xx
18
+ * bodies are our own failure text and tell the user nothing they can use.
19
+ */
20
+ export function clientErrorMessage(error) {
21
+ if (!(error instanceof HttpError)) {
22
+ return undefined;
23
+ }
24
+ if (error.status < 400 || error.status > 499) {
25
+ return undefined;
26
+ }
27
+ const message = error.message.trim();
28
+ // A proxy/gateway 4xx can answer with an HTML page instead of our own plain
29
+ // text; rendering its markup as a notification title is worse than the
30
+ // caller's generic copy.
31
+ if (message === '' || message.startsWith('<')) {
32
+ return undefined;
33
+ }
34
+ return message;
35
+ }
@@ -1,18 +1,36 @@
1
1
  import { type AssignableOrganizationRoleType } from '@camunda/ccma-shared-types';
2
2
  type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
3
- export declare const LEGACY_SECTION_ROLES: AssignableOrganizationRoleType[];
3
+ /** The 8.7-cluster legacy section, minus anything the aligned model promotes. */
4
+ export declare function legacySectionRoles(permissionsReworkEnabled: boolean): AssignableOrganizationRoleType[];
4
5
  /**
5
- * Whether a role from the legacy section may be offered: freely while the org
6
- * has an 8.7-or-older cluster; Developer/Visitor/Task user additionally stay
7
- * offered to a holder so they can be removed.
6
+ * Order a primary-role list for display. A no-op when the aligned model is off;
7
+ * unranked roles keep their relative position after the ranked ones.
8
8
  */
9
- export declare function isRoleAssignable(role: string, showLegacyClusterRoles: boolean, heldRoles: ReadonlySet<string>): boolean;
10
- export declare function isLegacyLabeledRole(role: string, showLegacyClusterRoles: boolean): boolean;
9
+ export declare function orderPrimaryRoles<T extends string>(roles: readonly T[], permissionsReworkEnabled: boolean): T[];
10
+ /**
11
+ * Whether a role may be offered for new assignment. MEMBER predates the cluster
12
+ * roles and is never newly assignable, only removable from a holder. A legacy
13
+ * role is offered freely while the org has an 8.7-or-older cluster, and stays
14
+ * offered to a holder either way so it can be removed. Every other role (the
15
+ * primary/ladder roles, and DevOps once promoted out of the legacy set) is
16
+ * freely assignable regardless of cluster version.
17
+ */
18
+ export declare function isRoleAssignable(role: string, showLegacyClusterRoles: boolean, heldRoles: ReadonlySet<string>, permissionsReworkEnabled?: boolean): boolean;
19
+ export declare function isLegacyLabeledRole(role: string, showLegacyClusterRoles: boolean, permissionsReworkEnabled?: boolean): boolean;
11
20
  /** Section heading: verbose 8.7 copy while such a cluster exists, else the unassign-only copy. */
12
21
  export declare function moreRolesHeadingText(t: TranslateFn | undefined, showLegacyClusterRoles: boolean): string;
13
- /** Resolve a role's label and description from the `orgroles` i18n namespace. */
22
+ /**
23
+ * Resolve a role's label and description from the `orgroles` i18n namespace.
24
+ *
25
+ * When `permissionsReworkEnabled` is set (supplied by the host app, gated
26
+ * behind its feature flag), roles with an aligned label read from the
27
+ * `orgroles:aligned.*` keys instead; those descriptions carry a "Formerly the
28
+ * X role." transition note. Roles without an aligned label fall through to the
29
+ * pre-alignment keys so the flag only moves what the aligned model renames.
30
+ */
14
31
  export declare function roleLabelDescription(t: TranslateFn | undefined, role: string, options?: {
15
32
  legacy?: boolean;
33
+ permissionsReworkEnabled?: boolean;
16
34
  }): {
17
35
  label: string;
18
36
  description: string;
@@ -18,7 +18,7 @@ function safeTranslate(t, key, defaultValue) {
18
18
  }
19
19
  }
20
20
  // Historical UI order of the 8.7-cluster roles section.
21
- export const LEGACY_SECTION_ROLES = [
21
+ const LEGACY_SECTION_ROLES = [
22
22
  OrganizationRole.VISITOR,
23
23
  OrganizationRole.OPERATIONS_ENGINEER,
24
24
  OrganizationRole.TASK_USER,
@@ -26,25 +26,68 @@ export const LEGACY_SECTION_ROLES = [
26
26
  ];
27
27
  const LEGACY_HELD_ROLES = new Set(LegacyHeldOrganizationRole);
28
28
  /**
29
- * Whether a role from the legacy section may be offered: freely while the org
30
- * has an 8.7-or-older cluster; Developer/Visitor/Task user additionally stay
31
- * offered to a holder so they can be removed.
29
+ * Under the aligned model Operations engineer becomes the go-forward DevOps role
30
+ * (camunda-hub#25467), so it stops being a legacy role: callers list it among the
31
+ * primary roles instead, and the legacy rules below no longer match it. Single
32
+ * source of truth, so there is no per-rule exception for it.
32
33
  */
33
- export function isRoleAssignable(role, showLegacyClusterRoles, heldRoles) {
34
- // MEMBER predates the cluster roles and is never newly assignable.
34
+ function isLegacyRole(role, permissionsReworkEnabled) {
35
+ if (permissionsReworkEnabled &&
36
+ role === OrganizationRole.OPERATIONS_ENGINEER) {
37
+ return false;
38
+ }
39
+ return LEGACY_HELD_ROLES.has(role);
40
+ }
41
+ /** The 8.7-cluster legacy section, minus anything the aligned model promotes. */
42
+ export function legacySectionRoles(permissionsReworkEnabled) {
43
+ return LEGACY_SECTION_ROLES.filter((role) => isLegacyRole(role, permissionsReworkEnabled));
44
+ }
45
+ const ALIGNED_PRIMARY_ORDER = [
46
+ OrganizationRole.MODELER,
47
+ OrganizationRole.ANALYST,
48
+ OrganizationRole.OPERATIONS_ENGINEER,
49
+ OrganizationRole.ADMIN,
50
+ OrganizationRole.OWNER,
51
+ ];
52
+ /**
53
+ * Order a primary-role list for display. A no-op when the aligned model is off;
54
+ * unranked roles keep their relative position after the ranked ones.
55
+ */
56
+ export function orderPrimaryRoles(roles, permissionsReworkEnabled) {
57
+ if (!permissionsReworkEnabled) {
58
+ return [...roles];
59
+ }
60
+ const rank = (role) => {
61
+ const index = ALIGNED_PRIMARY_ORDER.indexOf(role);
62
+ return index === -1 ? ALIGNED_PRIMARY_ORDER.length : index;
63
+ };
64
+ return [...roles]
65
+ .map((role, index) => ({ role, index }))
66
+ .sort((a, b) => rank(a.role) - rank(b.role) || a.index - b.index)
67
+ .map(({ role }) => role);
68
+ }
69
+ /**
70
+ * Whether a role may be offered for new assignment. MEMBER predates the cluster
71
+ * roles and is never newly assignable, only removable from a holder. A legacy
72
+ * role is offered freely while the org has an 8.7-or-older cluster, and stays
73
+ * offered to a holder either way so it can be removed. Every other role (the
74
+ * primary/ladder roles, and DevOps once promoted out of the legacy set) is
75
+ * freely assignable regardless of cluster version.
76
+ */
77
+ export function isRoleAssignable(role, showLegacyClusterRoles, heldRoles, permissionsReworkEnabled = false) {
35
78
  if (role === OrganizationRole.MEMBER) {
36
79
  return heldRoles.has(role);
37
80
  }
38
- if (LEGACY_HELD_ROLES.has(role)) {
81
+ if (isLegacyRole(role, permissionsReworkEnabled)) {
39
82
  return showLegacyClusterRoles || heldRoles.has(role);
40
83
  }
41
- return showLegacyClusterRoles;
84
+ return true;
42
85
  }
43
- export function isLegacyLabeledRole(role, showLegacyClusterRoles) {
86
+ export function isLegacyLabeledRole(role, showLegacyClusterRoles, permissionsReworkEnabled = false) {
44
87
  if (role === OrganizationRole.MEMBER) {
45
88
  return true;
46
89
  }
47
- return !showLegacyClusterRoles && LEGACY_HELD_ROLES.has(role);
90
+ return !showLegacyClusterRoles && isLegacyRole(role, permissionsReworkEnabled);
48
91
  }
49
92
  /** Section heading: verbose 8.7 copy while such a cluster exists, else the unassign-only copy. */
50
93
  export function moreRolesHeadingText(t, showLegacyClusterRoles) {
@@ -64,13 +107,51 @@ const ROLE_LABEL_DEFAULTS = {
64
107
  [OrganizationRole.VISITOR]: 'Visitor',
65
108
  [OrganizationRole.MODELER]: 'Modeler',
66
109
  };
67
- /** Resolve a role's label and description from the `orgroles` i18n namespace. */
110
+ /**
111
+ * Aligned org-role labels (camunda-hub#25467). A role appears here when the
112
+ * aligned model gives it new copy; anything absent keeps its pre-alignment label
113
+ * and description. Display projection only; raw role ids are unchanged.
114
+ *
115
+ * Org Owner / Org Admin use the short form so the familiar terms survive while
116
+ * naming the org level, now that Workspace Admin exists. `member` is renamed
117
+ * because `modeler` takes over the "Member" name; it is a rename, not a
118
+ * promotion, so it stays legacy-marked. `analyst` is here only for its
119
+ * description, which now refers to Member rather than Modeler.
120
+ */
121
+ const ALIGNED_ROLE_LABEL_DEFAULTS = {
122
+ [OrganizationRole.OWNER]: 'Org Owner',
123
+ [OrganizationRole.ADMIN]: 'Org Admin',
124
+ [OrganizationRole.MODELER]: 'Member',
125
+ [OrganizationRole.OPERATIONS_ENGINEER]: 'DevOps',
126
+ [OrganizationRole.MEMBER]: 'Console Member',
127
+ [OrganizationRole.ANALYST]: 'Analyst',
128
+ };
129
+ /**
130
+ * Resolve a role's label and description from the `orgroles` i18n namespace.
131
+ *
132
+ * When `permissionsReworkEnabled` is set (supplied by the host app, gated
133
+ * behind its feature flag), roles with an aligned label read from the
134
+ * `orgroles:aligned.*` keys instead; those descriptions carry a "Formerly the
135
+ * X role." transition note. Roles without an aligned label fall through to the
136
+ * pre-alignment keys so the flag only moves what the aligned model renames.
137
+ */
68
138
  export function roleLabelDescription(t, role, options) {
69
139
  const normalized = role.toLowerCase().replace(/[^a-z]/g, '');
140
+ const alignedLabel = options?.permissionsReworkEnabled
141
+ ? ALIGNED_ROLE_LABEL_DEFAULTS[role]
142
+ : undefined;
70
143
  const fallback = ROLE_LABEL_DEFAULTS[role] ??
71
144
  (role ? role.charAt(0).toUpperCase() + role.slice(1) : role);
72
- const label = safeTranslate(t, `orgroles:${normalized}.label`, fallback);
73
- const description = safeTranslate(t, `orgroles:${normalized}.description`, '');
145
+ const { label, description } = alignedLabel
146
+ ? {
147
+ label: safeTranslate(t, `orgroles:aligned.${normalized}.label`, alignedLabel),
148
+ description: safeTranslate(t, `orgroles:aligned.${normalized}.description`, ''),
149
+ }
150
+ : {
151
+ label: safeTranslate(t, `orgroles:${normalized}.label`, fallback),
152
+ description: safeTranslate(t, `orgroles:${normalized}.description`, ''),
153
+ };
154
+ // A renamed role can still be legacy: Console Member keeps the suffix.
74
155
  if (options?.legacy) {
75
156
  const suffix = safeTranslate(t, 'orgroles:legacySuffix', 'Legacy');
76
157
  return { label: `${label} (${suffix})`, description };
@@ -1,6 +1,9 @@
1
+ import { type HdpPrometheusDataCapacityDataPoint } from '@camunda/ccma-shared-types';
1
2
  import { type JSX } from 'react';
2
3
  import type { C4ClusterDetailsAppProps } from './c4-cluster-details-app.types.js';
3
4
  export declare function mergeNestedSnapshot<T>(previous: T | undefined, next: T): T;
5
+ export declare function ensureClusterLoadPerDay(perDay: HdpPrometheusDataCapacityDataPoint[]): HdpPrometheusDataCapacityDataPoint[];
6
+ export declare function ensureClusterLoad24h(last24h: HdpPrometheusDataCapacityDataPoint[]): HdpPrometheusDataCapacityDataPoint[];
4
7
  export declare const C4ClusterDetailsApp: ((props: C4ClusterDetailsAppProps) => JSX.Element) & {
5
8
  displayName: string;
6
9
  };
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
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 { AuditLoggerService, ConsoleAlertsService, ConsoleByomMonitoringService, ConsoleClusterClientsService, ConsoleClusterParametersService, ConsoleClusterService, HdpService, SaaSJobsService, } from '@camunda/ccma-api';
7
+ import { AuditLoggerService, ConsoleAlertsService, ConsoleByomMonitoringService, ConsoleClusterClientsService, ConsoleClusterParametersService, ConsoleClusterService, HdpService, HttpError, SaaSJobsService, } from '@camunda/ccma-api';
8
8
  import { checkVersion, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
9
9
  import { observer } from 'mobx-react-lite';
10
10
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
@@ -154,7 +154,31 @@ function persistDismissedFailedRestores(ids) {
154
154
  // localStorage unavailable (private mode / SSR) — dismissal is best-effort.
155
155
  }
156
156
  }
157
- function ensureClusterLoadPerDay(perDay) {
157
+ // Client-side dismissal of the "update your BYOM/BYOIDP endpoint after
158
+ // failover" notice (#9679) — same reasoning as above: whether the customer
159
+ // has actually gone and repointed their external monitoring/identity
160
+ // provider at this cluster isn't something Console can observe, so there's
161
+ // no server-computed "done" state to gate on. Keyed by cluster uuid so a
162
+ // different cluster's notice isn't accidentally suppressed.
163
+ const DISMISSED_FAILOVER_URI_NOTICES_KEY = 'c4:dismissedFailoverUriNotices';
164
+ function loadDismissedFailoverUriNotices() {
165
+ try {
166
+ const raw = window.localStorage.getItem(DISMISSED_FAILOVER_URI_NOTICES_KEY);
167
+ return new Set(raw ? JSON.parse(raw) : []);
168
+ }
169
+ catch {
170
+ return new Set();
171
+ }
172
+ }
173
+ function persistDismissedFailoverUriNotices(ids) {
174
+ try {
175
+ window.localStorage.setItem(DISMISSED_FAILOVER_URI_NOTICES_KEY, JSON.stringify([...ids]));
176
+ }
177
+ catch {
178
+ // localStorage unavailable (private mode / SSR) — dismissal is best-effort.
179
+ }
180
+ }
181
+ export function ensureClusterLoadPerDay(perDay) {
158
182
  const DAY = 24 * 60 * 60 * 1000;
159
183
  const now = Date.now();
160
184
  const updatedPerDay = perDay.filter((point) => Number.isFinite(point.ts) &&
@@ -189,7 +213,12 @@ function ensureClusterLoadPerDay(perDay) {
189
213
  updatedPerDay.sort((a, b) => b.ts - a.ts);
190
214
  return updatedPerDay;
191
215
  }
192
- function ensureClusterLoad24h(last24h) {
216
+ // Sorts ascending by timestamp (oldest first, "now" last) — the chart plots
217
+ // its array in order left-to-right, matching the 7d/30d convention.
218
+ function sortAscendingByTs(points) {
219
+ return points.sort((a, b) => a.ts - b.ts);
220
+ }
221
+ export function ensureClusterLoad24h(last24h) {
193
222
  const HOUR = 60 * 60 * 1000;
194
223
  const DAY = 24 * HOUR;
195
224
  const now = Date.now();
@@ -197,36 +226,55 @@ function ensureClusterLoad24h(last24h) {
197
226
  Number.isFinite(point.min) &&
198
227
  Number.isFinite(point.max) &&
199
228
  Number.isFinite(point.avg));
200
- const max24h = updated24h.length > 0
201
- ? Math.max(...updated24h.map((item) => item.ts))
202
- : Number.NaN;
203
- if (updated24h.length < 24) {
204
- if (max24h < now - HOUR && max24h > now - DAY) {
205
- const missingHours = Math.floor((now - max24h) / HOUR);
206
- for (let i = 1; i < missingHours + 1; i += 1) {
207
- updated24h.push({
208
- ts: max24h + i * HOUR,
209
- min: 0,
210
- max: 0,
211
- avg: 0,
212
- });
213
- }
229
+ // No real data at all — fill a full 24h window with zeros so the chart
230
+ // still renders instead of being empty.
231
+ if (updated24h.length === 0) {
232
+ for (let i = 0; i < 24; i += 1) {
233
+ updated24h.push({
234
+ ts: now - i * HOUR,
235
+ min: 0,
236
+ max: 0,
237
+ avg: 0,
238
+ });
214
239
  }
215
- else {
216
- // Fill with a full 24h window so the chart always renders.
217
- updated24h.length = 0;
218
- for (let i = 0; i < 24; i += 1) {
219
- updated24h.push({
220
- ts: now - i * HOUR,
221
- min: 0,
222
- max: 0,
223
- avg: 0,
224
- });
225
- }
240
+ return sortAscendingByTs(updated24h);
241
+ }
242
+ // We have real data (e.g. a cluster younger than 24h only has a handful of
243
+ // hourly buckets) — never discard it. Only backfill the gap between the
244
+ // most recent real point and "now" when that point is stale, so a
245
+ // still-fresh but incomplete window keeps its real values (including any
246
+ // spikes) instead of being wiped and replaced with zeros.
247
+ const max24h = Math.max(...updated24h.map((item) => item.ts));
248
+ // The most recent real point is itself very stale (e.g. the cluster was
249
+ // paused and its newest hourly bucket is many hours/days old). Padding
250
+ // forward from that point — even capped — could still land far in the
251
+ // past and never reach "now". Fall back to the same full zero-refill
252
+ // anchored at "now" used when there is no real data at all, mirroring how
253
+ // `ensureClusterLoadPerDay` treats a stale latest point.
254
+ if (max24h < now - DAY) {
255
+ updated24h.length = 0;
256
+ for (let i = 0; i < 24; i += 1) {
257
+ updated24h.push({
258
+ ts: now - i * HOUR,
259
+ min: 0,
260
+ max: 0,
261
+ avg: 0,
262
+ });
263
+ }
264
+ return sortAscendingByTs(updated24h);
265
+ }
266
+ if (max24h < now - HOUR) {
267
+ const missingHours = Math.floor((now - max24h) / HOUR);
268
+ for (let i = 1; i < missingHours + 1; i += 1) {
269
+ updated24h.push({
270
+ ts: max24h + i * HOUR,
271
+ min: 0,
272
+ max: 0,
273
+ avg: 0,
274
+ });
226
275
  }
227
276
  }
228
- updated24h.sort((a, b) => b.ts - a.ts);
229
- return updated24h;
277
+ return sortAscendingByTs(updated24h);
230
278
  }
231
279
  function isUnsupportedGenerationStarted(isUnsupportedStarting) {
232
280
  if (!isUnsupportedStarting) {
@@ -315,13 +363,25 @@ export const C4ClusterDetailsApp = observer((props) => {
315
363
  data.upsertCluster(props.orgId, loaded);
316
364
  }
317
365
  catch (error) {
366
+ // A cluster that no longer exists (e.g. a stale/typo'd URL) is not an
367
+ // error state worth rendering inline — send the user back to the
368
+ // dashboard instead of showing an empty tab shell with the backend's
369
+ // generic 404 body text. Only short-circuit when a navigation handler
370
+ // is actually available; otherwise fall back to the inline error so
371
+ // the widget never ends up in a blank state.
372
+ if (error instanceof HttpError &&
373
+ error.status === 404 &&
374
+ props.onNavigate) {
375
+ props.onNavigate({ kind: 'dashboard', orgId: props.orgId });
376
+ return;
377
+ }
318
378
  setCluster(undefined);
319
379
  setClusterError(error instanceof Error ? error.message : 'Failed to load');
320
380
  }
321
381
  finally {
322
382
  setIsClusterLoading(false);
323
383
  }
324
- }, [apiConfig, data, props.clusterId, props.orgId]);
384
+ }, [apiConfig, data, props.clusterId, props.onNavigate, props.orgId]);
325
385
  const reloadCreationParameters = useCallback(async () => {
326
386
  setIsCreationParametersLoading(true);
327
387
  try {
@@ -483,7 +543,15 @@ export const C4ClusterDetailsApp = observer((props) => {
483
543
  return next;
484
544
  });
485
545
  }, []);
486
- const banner = useMemo(() => {
546
+ const [dismissedFailoverUriNotices, setDismissedFailoverUriNotices] = useState(loadDismissedFailoverUriNotices);
547
+ const dismissFailoverUriNotice = useCallback((clusterUuid) => {
548
+ setDismissedFailoverUriNotices((prev) => {
549
+ const next = new Set(prev).add(clusterUuid);
550
+ persistDismissedFailoverUriNotices(next);
551
+ return next;
552
+ });
553
+ }, []);
554
+ const primaryBanner = useMemo(() => {
487
555
  if (!cluster)
488
556
  return undefined;
489
557
  if (cluster.restoreInProgress) {
@@ -825,6 +893,49 @@ export const C4ClusterDetailsApp = observer((props) => {
825
893
  const [byomError, setByomError] = useState(false);
826
894
  const byomLoadedRef = useRef(false);
827
895
  const [byomStatus, setByomStatus] = useState({});
896
+ // #9679: a failover cluster carries over the source's BYOM/BYOIDP config
897
+ // as-is, but the customer's external monitoring tool / identity provider
898
+ // still points at the OLD cluster's endpoint — Console can't fix that
899
+ // externally, so this nudges the customer to update it themselves.
900
+ // Combined with primaryBanner further down (this can't be computed
901
+ // there — byomClients isn't declared yet at that point in the component).
902
+ //
903
+ // ponytail: known false positive, accepted rather than engineered around
904
+ // — this fires whenever a failover-destination cluster currently HAS
905
+ // BYOM/BYOIDP config, not specifically when that config was carried over
906
+ // from the source. A customer who sets up monitoring fresh on this
907
+ // cluster (with a correct endpoint from the start) still sees the
908
+ // notice. ByomClient rows do carry a `created` timestamp that could be
909
+ // compared against the cluster's own `created` to guess "looks carried-
910
+ // over", but externalIdpEnabled/externalIdpConfig have no timestamp at
911
+ // all — a heuristic that covers BYOM but silently can't cover BYOIDP
912
+ // would produce harder-to-explain asymmetric behaviour than just always
913
+ // showing it. Cost of the false positive is one extra dismiss click, not
914
+ // incorrect action — revisit if that stops being true (e.g. by tracking
915
+ // "carried over" explicitly at write time).
916
+ const failoverUriBanner = useMemo(() => {
917
+ if (!cluster?.failoverSourceClusterId)
918
+ return undefined;
919
+ if (dismissedFailoverUriNotices.has(cluster.uuid))
920
+ return undefined;
921
+ const hasByom = byomClients.length > 0;
922
+ const hasByoidp = !!cluster.externalIdpEnabled;
923
+ if (!hasByom && !hasByoidp)
924
+ return undefined;
925
+ return {
926
+ kind: 'failoverUriUpdateNeeded',
927
+ hasByom,
928
+ hasByoidp,
929
+ onDismiss: () => dismissFailoverUriNotice(cluster.uuid),
930
+ };
931
+ }, [
932
+ cluster?.failoverSourceClusterId,
933
+ cluster?.uuid,
934
+ cluster?.externalIdpEnabled,
935
+ byomClients.length,
936
+ dismissedFailoverUriNotices,
937
+ dismissFailoverUriNotice,
938
+ ]);
828
939
  const reloadByom = useCallback(async () => {
829
940
  if (!canViewMonitoringTab) {
830
941
  setByomClients([]);
@@ -1035,6 +1146,7 @@ export const C4ClusterDetailsApp = observer((props) => {
1035
1146
  },
1036
1147
  }
1037
1148
  : undefined,
1149
+ ignoreHead: params.ignoreHead,
1038
1150
  },
1039
1151
  });
1040
1152
  await reloadAlerts();
@@ -1152,7 +1264,8 @@ export const C4ClusterDetailsApp = observer((props) => {
1152
1264
  canUpdate: Boolean(orgPermissions?.cluster.connectorSecrets.update),
1153
1265
  canDelete: Boolean(orgPermissions?.cluster.connectorSecrets.delete),
1154
1266
  }, docsUrl: urls.docs.connectorSecrets, t: t, onNavigate: props.onNavigate }));
1155
- const hotBackupsComponent = (_jsx(C4ClusterDetailsHotBackupsTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, canMutateCluster: canMutateCluster, isHotBackupEnabled: Boolean(orgInfo?.organizationToSalesPlan?.limits?.hotBackup), docsUrls: {
1267
+ const hotBackupsComponent = (_jsx(C4ClusterDetailsHotBackupsTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, canMutateCluster: canMutateCluster, isHotBackupEnabled: Boolean(orgInfo?.organizationToSalesPlan?.limits?.hotBackup), manualBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits?.hotBackupManualRetainedCount, scheduledBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits
1268
+ ?.hotBackupScheduledRetainedCount, docsUrls: {
1156
1269
  hotBackups: urls.docs.hotBackups,
1157
1270
  support: urls.docs.support,
1158
1271
  contact: urls.docs.contact,
@@ -1206,7 +1319,15 @@ export const C4ClusterDetailsApp = observer((props) => {
1206
1319
  reloadCluster,
1207
1320
  urls.docs.auditlogs,
1208
1321
  ]);
1209
- const encryptionComponent = (_jsx(C4ClusterDetailsEncryptionTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, translate: t ?? ((key) => key), activeTabId: activeTabId, onReloadCluster: reloadCluster, restoreInProgress: cluster?.restoreInProgress, docsUrls: {
1322
+ // Both halves of a failover pair share a stableId, and the source is
1323
+ // flagged isFailoverSource — so the pair can be matched from the org's
1324
+ // cluster list without a dedicated backend field.
1325
+ const isFailoverTarget = Boolean(cluster?.stableId &&
1326
+ !cluster.isFailoverSource &&
1327
+ clustersOfOrg?.some((sibling) => sibling.uuid !== cluster.uuid &&
1328
+ sibling.stableId === cluster.stableId &&
1329
+ sibling.isFailoverSource === true));
1330
+ const encryptionComponent = (_jsx(C4ClusterDetailsEncryptionTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, translate: t ?? ((key) => key), activeTabId: activeTabId, onReloadCluster: reloadCluster, restoreInProgress: cluster?.restoreInProgress, isFailoverTarget: isFailoverTarget, docsUrls: {
1210
1331
  encryption: urls.docs.encryption,
1211
1332
  encryptionCli: urls.docs.encryptionCli,
1212
1333
  encryptionManual: urls.docs.encryptionManual,
@@ -1378,6 +1499,10 @@ export const C4ClusterDetailsApp = observer((props) => {
1378
1499
  isCreationParametersLoading,
1379
1500
  isSecureConnectivityTabVisible,
1380
1501
  ]);
1502
+ // primaryBanner takes priority — an active restore, an unmaintained
1503
+ // generation, or disabled authorizations all matter more than a
1504
+ // one-time "update your endpoint" nudge.
1505
+ const banner = primaryBanner ?? failoverUriBanner;
1381
1506
  return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsPage, { loading: isClusterLoading || authz.isLoading, clusterName: cluster?.name, isDevelopmentPlan: cluster?.planType?.development, urls: { clusters: urls.clusters }, onNavigateToClusters: () => props.onNavigate?.({ kind: 'clusters', orgId: props.orgId }), menu: {
1382
1507
  canRename,
1383
1508
  canDelete,
@@ -7,6 +7,9 @@ export type C4ClusterDetailsNavigateEvent = {
7
7
  } | {
8
8
  kind: 'clusters';
9
9
  orgId: string;
10
+ } | {
11
+ kind: 'dashboard';
12
+ orgId: string;
10
13
  } | {
11
14
  kind: 'managementUsers';
12
15
  orgId: string;