@camunda/ccma-saas-frontend 0.0.37 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.d.ts +1 -1
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.js +10 -4
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.types.d.ts +2 -0
- package/lib/esm/components/c4-cluster-overview/applications.d.ts +1 -1
- package/lib/esm/components/c4-cluster-overview/applications.js +21 -9
- package/lib/esm/components/c4-cluster-overview/applications.spec.js +6 -0
- package/lib/esm/components/c4-page-template/c4-page-template.d.ts +1 -0
- package/lib/esm/components/c4-page-template/c4-page-template.js +1 -1
- package/lib/esm/externalUrls.const.d.ts +1 -1
- package/lib/esm/externalUrls.const.js +1 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +1 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +41 -10
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.spec.js +26 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +2 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +9 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +1 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +20 -15
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +13 -10
- package/lib/esm/widgets/clusters/c4-clusters-page.js +5 -8
- package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +97 -15
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +4 -1
- package/lib/esm/widgets/is-cluster-reconciliation-paused.d.ts +6 -0
- package/lib/esm/widgets/is-cluster-reconciliation-paused.js +54 -0
- package/lib/esm/widgets/management/c4-management-app.js +12 -0
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.d.ts +2 -1
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +33 -27
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.spec.d.ts +1 -0
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.spec.js +246 -0
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import type { C4BreadcrumbProps } from './c4-breadcrumb.types';
|
|
3
|
-
export declare const C4Breadcrumb: ({ loading, noTrailingSlash, elements, title, menu, tag, codeSnippet, }: C4BreadcrumbProps) => JSX.Element;
|
|
3
|
+
export declare const C4Breadcrumb: ({ loading, noTrailingSlash, elements, title, menu, tag, indicator, codeSnippet, }: C4BreadcrumbProps) => JSX.Element;
|
|
@@ -9,10 +9,16 @@ const breadCrumbWrapperStyles = {
|
|
|
9
9
|
minHeight: '40px',
|
|
10
10
|
display: 'grid',
|
|
11
11
|
gridAutoFlow: 'column',
|
|
12
|
-
gridAutoColumns: '
|
|
12
|
+
gridAutoColumns: '1fr',
|
|
13
13
|
alignItems: 'center',
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
const headerRowStyles = {
|
|
16
|
+
minHeight: '40px',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
gap: '1rem',
|
|
20
|
+
};
|
|
21
|
+
export const C4Breadcrumb = ({ loading, noTrailingSlash, elements, title, menu, tag, indicator, codeSnippet, }) => {
|
|
16
22
|
let breadcrumb = null;
|
|
17
23
|
if (loading) {
|
|
18
24
|
breadcrumb = _jsx(BreadcrumbSkeleton, {});
|
|
@@ -25,9 +31,9 @@ export const C4Breadcrumb = ({ loading, noTrailingSlash, elements, title, menu,
|
|
|
25
31
|
element.onClick();
|
|
26
32
|
}
|
|
27
33
|
}, style: { cursor: 'pointer' }, children: element.label }) }, element.key));
|
|
28
|
-
}) }), (menu || title || tag || codeSnippet) && (_jsxs("div", { style:
|
|
34
|
+
}) }), (menu || title || tag || indicator || codeSnippet) && (_jsxs("div", { style: headerRowStyles, children: [_jsxs(Stack, { orientation: 'horizontal', gap: 4, children: [title && _jsx("h2", { style: { marginTop: '2px' }, children: title }), tag && _jsx(Tag, { type: 'blue', children: tag }), codeSnippet?.text && (_jsx(CodeSnippet, { feedback: codeSnippet?.copyFeedback, type: 'inline', children: codeSnippet.text }))] }), menu && (_jsx(OverflowMenu, { "aria-label": 'cluster operations', children: menu.map((item) => {
|
|
29
35
|
return (_jsx(OverflowMenuItem, { id: item.key, onClick: () => item.onClick(), itemText: item.label, isDelete: item.isDelete }, item.key));
|
|
30
|
-
}) }))] }))] }));
|
|
36
|
+
}) })), indicator && _jsx("div", { style: { marginLeft: 'auto' }, children: indicator })] }))] }));
|
|
31
37
|
}
|
|
32
38
|
return _jsx("div", { style: breadCrumbWrapperStyles, children: breadcrumb });
|
|
33
39
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
export interface C4BreadcrumbProps {
|
|
2
3
|
loading?: boolean;
|
|
3
4
|
noTrailingSlash?: boolean;
|
|
@@ -9,6 +10,7 @@ export interface C4BreadcrumbProps {
|
|
|
9
10
|
}>;
|
|
10
11
|
title?: string;
|
|
11
12
|
tag?: string;
|
|
13
|
+
indicator?: ReactNode;
|
|
12
14
|
codeSnippet?: {
|
|
13
15
|
text: string;
|
|
14
16
|
copyFeedback: string;
|
|
@@ -7,7 +7,7 @@ export declare enum StatusColor {
|
|
|
7
7
|
WAITING = "var(--cds-support-warning)",
|
|
8
8
|
SUSPENDED = "var(--cds-icon-secondary)"
|
|
9
9
|
}
|
|
10
|
-
export type ClusterStatus = 'healthy' | 'unhealthy' | 'creating' | 'updating' | 'waitingForInput' | 'suspended' | 'resuming';
|
|
10
|
+
export type ClusterStatus = 'healthy' | 'unhealthy' | 'creating' | 'updating' | 'waitingForInput' | 'suspended' | 'resuming' | 'maintenance';
|
|
11
11
|
export declare const normalizeClusterStatus: (status: string | undefined) => ClusterStatus | undefined;
|
|
12
12
|
export interface ApplicationTileProps {
|
|
13
13
|
name: string;
|
|
@@ -4,11 +4,13 @@ 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 { Layer, Link, Loading, Stack, Tile, Tooltip } from '@carbon/react';
|
|
7
|
+
import { preview__IconIndicator as IconIndicator, Layer, Link, Loading, Stack, Tile, Tooltip, } from '@carbon/react';
|
|
8
8
|
import { ArrowRight, CheckmarkFilled, Information, PauseOutlineFilled, PendingFilled, WarningFilled, } from '@carbon/react/icons/index.esm.js';
|
|
9
9
|
import { useEffect, useState } from 'react';
|
|
10
10
|
import { mediaSizeByWidth } from '../c4-billing-page/elements/current-usage-metrics.js';
|
|
11
11
|
import { C4TileWithTitleAndAction } from '../c4-tile-with-title-and-action/c4-tile-with-title-and-action.js';
|
|
12
|
+
const MAINTENANCE_STATUS_TEXT = 'Maintenance';
|
|
13
|
+
const MAINTENANCE_INDICATOR_KIND = 'undefined';
|
|
12
14
|
export var StatusColor;
|
|
13
15
|
(function (StatusColor) {
|
|
14
16
|
StatusColor["HEALTHY"] = "var(--cds-support-success)";
|
|
@@ -37,11 +39,14 @@ export const normalizeClusterStatus = (status) => {
|
|
|
37
39
|
return 'suspended';
|
|
38
40
|
case 'resuming':
|
|
39
41
|
return 'resuming';
|
|
42
|
+
case 'maintenance':
|
|
43
|
+
return 'maintenance';
|
|
40
44
|
default:
|
|
41
45
|
return undefined;
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
48
|
export const ClusterStatusElement = (props) => {
|
|
49
|
+
const isMaintenanceStatus = props.status === 'maintenance';
|
|
45
50
|
let icon = null;
|
|
46
51
|
let text = '';
|
|
47
52
|
let color;
|
|
@@ -81,14 +86,21 @@ export const ClusterStatusElement = (props) => {
|
|
|
81
86
|
text = 'Resuming cluster...';
|
|
82
87
|
color = StatusColor.SUSPENDED;
|
|
83
88
|
break;
|
|
89
|
+
case 'maintenance':
|
|
90
|
+
text = MAINTENANCE_STATUS_TEXT;
|
|
91
|
+
icon = (_jsx(IconIndicator, { kind: MAINTENANCE_INDICATOR_KIND, label: MAINTENANCE_STATUS_TEXT }));
|
|
92
|
+
break;
|
|
84
93
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
const iconWrapperStyle = isMaintenanceStatus
|
|
95
|
+
? { display: 'flex' }
|
|
96
|
+
: {
|
|
97
|
+
display: 'flex',
|
|
98
|
+
position: 'absolute',
|
|
99
|
+
top: '50%',
|
|
100
|
+
transform: 'translateY(-50%)',
|
|
101
|
+
color,
|
|
102
|
+
};
|
|
103
|
+
const component = (_jsx("div", { style: { ...props.style }, children: _jsxs("div", { style: { position: 'relative' }, children: [icon && _jsx("div", { style: iconWrapperStyle, children: icon }), !isMaintenanceStatus && (_jsxs("span", { style: {
|
|
92
104
|
paddingInlineStart: icon ? '1.2rem' : '0rem',
|
|
93
105
|
display: 'inline-flex',
|
|
94
106
|
alignItems: 'center',
|
|
@@ -108,7 +120,7 @@ export const ClusterStatusElement = (props) => {
|
|
|
108
120
|
background: 'transparent',
|
|
109
121
|
color: 'var(--cds-icon-primary)',
|
|
110
122
|
cursor: 'pointer',
|
|
111
|
-
}, children: _jsx(Information, {}) }) }))] })] }) }));
|
|
123
|
+
}, children: _jsx(Information, {}) }) }))] }))] }) }));
|
|
112
124
|
return component;
|
|
113
125
|
};
|
|
114
126
|
export const ApplicationTile = (props) => {
|
|
@@ -23,4 +23,10 @@ describe('ClusterStatusElement', () => {
|
|
|
23
23
|
expect(normalizeClusterStatus('WaitingForInput')).toBe('waitingForInput');
|
|
24
24
|
expect(normalizeClusterStatus('waitingforinput')).toBe('waitingForInput');
|
|
25
25
|
});
|
|
26
|
+
it('renders maintenance with Carbon undefined icon indicator', () => {
|
|
27
|
+
const { container } = render(_jsx(ClusterStatusElement, { status: 'maintenance' }));
|
|
28
|
+
expect(screen.getByText('Maintenance')).toBeInTheDocument();
|
|
29
|
+
expect(screen.queryAllByText('Maintenance')).toHaveLength(1);
|
|
30
|
+
expect(container.querySelector('.cds--icon-indicator--undefined')).toBeInTheDocument();
|
|
31
|
+
});
|
|
26
32
|
});
|
|
@@ -11,7 +11,7 @@ import { C4Tabs } from '../c4-tabs/c4-tabs.js';
|
|
|
11
11
|
const gridStyles = { paddingRight: 0, paddingLeft: 0 };
|
|
12
12
|
const gridColumnStyles = { marginInline: 0 };
|
|
13
13
|
const C4PageTemplate = ({ header, tabs, banner, children, loading = false, breadcrumbs = { elements: [] }, }) => {
|
|
14
|
-
return (_jsx(Grid, { style: gridStyles, children: _jsx(Column, { span: '100%', style: gridColumnStyles, children: _jsxs("div", { style: { display: 'flex', gap: '2rem', flexDirection: 'column' }, children: [(breadcrumbs.elements?.length || header) && (_jsx(C4Breadcrumb, { ...breadcrumbs, title: header?.title, menu: header?.menuItems, tag: header?.tag, loading: loading, codeSnippet: header?.codeSnippet })), banner &&
|
|
14
|
+
return (_jsx(Grid, { style: gridStyles, children: _jsx(Column, { span: '100%', style: gridColumnStyles, children: _jsxs("div", { style: { display: 'flex', gap: '2rem', flexDirection: 'column' }, children: [(breadcrumbs.elements?.length || header) && (_jsx(C4Breadcrumb, { ...breadcrumbs, title: header?.title, menu: header?.menuItems, tag: header?.tag, indicator: header?.indicator, loading: loading, codeSnippet: header?.codeSnippet })), banner &&
|
|
15
15
|
(banner.action ? (_jsx(C4ActionableNotification, { kind: banner.kind, title: banner.title, subtitle: banner.subtitle, actionButtonLabel: banner.action.label, onActionButtonClick: banner.action.onClick, lowContrast: true })) : (_jsx(InlineNotification, { kind: banner.kind, hideCloseButton: true, title: banner.title, subtitle: banner.subtitle, lowContrast: true }))), tabs && (_jsx(Stack, { orientation: 'vertical', gap: 5, children: _jsx(C4Tabs, { tabs: tabs.list, desiredTabId: tabs?.desiredTabId, onTabChange: tabs?.onChange, loading: loading }) })), children] }) }) }));
|
|
16
16
|
};
|
|
17
17
|
export { C4PageTemplate };
|
|
@@ -42,7 +42,7 @@ export declare const C4_EXTERNAL_URLS: {
|
|
|
42
42
|
readonly autoPause: "https://docs.camunda.io/docs/components/concepts/clusters/#auto-pause";
|
|
43
43
|
};
|
|
44
44
|
readonly auditLog: "https://docs.camunda.io/docs/next/components/audit-log/overview/";
|
|
45
|
-
readonly secureConnectivity: "https://docs.camunda.io/docs/components/saas/secure-connectivity/
|
|
45
|
+
readonly secureConnectivity: "https://docs.camunda.io/docs/components/saas/secure-connectivity/";
|
|
46
46
|
readonly releasePolicy: "https://camunda.com/release-policy/";
|
|
47
47
|
readonly jobDashboard: {
|
|
48
48
|
readonly roles: "https://docs.camunda.io/docs/components/identity/role/";
|
|
@@ -40,7 +40,7 @@ export const C4_EXTERNAL_URLS = {
|
|
|
40
40
|
autoPause: 'https://docs.camunda.io/docs/components/concepts/clusters/#auto-pause',
|
|
41
41
|
},
|
|
42
42
|
auditLog: 'https://docs.camunda.io/docs/next/components/audit-log/overview/',
|
|
43
|
-
secureConnectivity: 'https://docs.camunda.io/docs/components/saas/secure-connectivity/
|
|
43
|
+
secureConnectivity: 'https://docs.camunda.io/docs/components/saas/secure-connectivity/',
|
|
44
44
|
releasePolicy: 'https://camunda.com/release-policy/',
|
|
45
45
|
jobDashboard: {
|
|
46
46
|
roles: 'https://docs.camunda.io/docs/components/identity/role/',
|
|
@@ -4,7 +4,8 @@ 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 { BreadcrumbSkeleton, SkeletonText, Stack, TabsSkeleton, } from '@carbon/react';
|
|
7
|
+
import { BreadcrumbSkeleton, Link, SkeletonText, Stack, TabsSkeleton, Tooltip, } from '@carbon/react';
|
|
8
|
+
import { WarningAltFilled } from '@carbon/react/icons/index.esm.js';
|
|
8
9
|
import { C4PageTemplate } from '../../components/c4-page-template/c4-page-template.js';
|
|
9
10
|
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
10
11
|
const breadCrumbWrapperStyles = {
|
|
@@ -64,15 +65,40 @@ function buildBanner(opts) {
|
|
|
64
65
|
},
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
function buildAuthorizationsDisabledIndicator(opts) {
|
|
71
|
+
const { banner, t } = opts;
|
|
72
|
+
if (!banner || banner.kind !== 'authorizationsDisabled') {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const title = safeTranslate(t, 'c4console:clusterDetails.banner.authorizationsDisabled.title', 'Authorizations disabled');
|
|
76
|
+
const subtitle = safeTranslate(t, 'c4console:clusterDetails.banner.authorizationsDisabled.subtitle', 'All authenticated users & clients have full access to this cluster’s resources. To restrict access, enable authorizations in the settings.');
|
|
77
|
+
const actionLabel = safeTranslate(t, 'c4console:clusterDetails.banner.authorizationsDisabled.actionLabel', 'Learn more about managing authorizations');
|
|
78
|
+
return (_jsx("div", { style: {
|
|
79
|
+
'--cds-background-inverse': 'var(--cds-layer)',
|
|
80
|
+
'--cds-text-inverse': 'var(--cds-text-primary)',
|
|
81
|
+
'--cds-link-inverse': 'var(--cds-link-primary)',
|
|
82
|
+
}, children: _jsx(Tooltip, { align: 'bottom-end', autoAlign: true, dropShadow: true, description: _jsxs("span", { style: {
|
|
83
|
+
display: 'block',
|
|
84
|
+
whiteSpace: 'normal',
|
|
85
|
+
maxWidth: '20rem',
|
|
86
|
+
}, children: [subtitle, ' ', _jsx(Link, { href: banner.docsUrl, target: '_blank', rel: 'noopener noreferrer', inline: true, onClick: (event) => {
|
|
87
|
+
if (banner.onLearnMore) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
banner.onLearnMore();
|
|
90
|
+
}
|
|
91
|
+
}, children: actionLabel })] }), children: _jsxs("button", { type: 'button', "aria-label": title, style: {
|
|
92
|
+
display: 'inline-flex',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
gap: '0.25rem',
|
|
95
|
+
padding: 0,
|
|
96
|
+
border: 0,
|
|
97
|
+
background: 'transparent',
|
|
98
|
+
cursor: 'default',
|
|
99
|
+
color: 'var(--cds-text-secondary)',
|
|
100
|
+
fontSize: 'var(--cds-body-compact-01-font-size)',
|
|
101
|
+
}, children: [_jsx(WarningAltFilled, { size: 16, style: { fill: 'var(--cds-support-caution-major)' } }), title] }) }) }));
|
|
76
102
|
}
|
|
77
103
|
export const C4ClusterDetailsPage = ({ loading, clusterName, isDevelopmentPlan, urls, onNavigateToClusters, menu, banner, tabs, }) => {
|
|
78
104
|
const runtime = useC4ConsoleRuntime();
|
|
@@ -84,9 +110,14 @@ export const C4ClusterDetailsPage = ({ loading, clusterName, isDevelopmentPlan,
|
|
|
84
110
|
? safeTranslate(t, 'c4console:clusterDetails.tag.development', 'Development')
|
|
85
111
|
: '';
|
|
86
112
|
const bannerProps = buildBanner({ banner, t });
|
|
113
|
+
const authorizationsIndicator = buildAuthorizationsDisabledIndicator({
|
|
114
|
+
banner,
|
|
115
|
+
t,
|
|
116
|
+
});
|
|
87
117
|
return (_jsx(C4PageTemplate, { loading: loading, banner: bannerProps, header: {
|
|
88
118
|
title: clusterName ?? '',
|
|
89
119
|
tag,
|
|
120
|
+
indicator: authorizationsIndicator,
|
|
90
121
|
menuItems: buildMenuItems({ menu, t }),
|
|
91
122
|
}, breadcrumbs: {
|
|
92
123
|
elements: [
|
|
@@ -64,4 +64,30 @@ describe('C4ClusterDetailsPage', () => {
|
|
|
64
64
|
expect(screen.getByText('Rename')).toBeInTheDocument();
|
|
65
65
|
expect(screen.getByText('Delete')).toBeInTheDocument();
|
|
66
66
|
});
|
|
67
|
+
it('renders a condensed indicator for authorizations disabled instead of a banner', () => {
|
|
68
|
+
const onLearnMore = vi.fn();
|
|
69
|
+
const banner = {
|
|
70
|
+
kind: 'authorizationsDisabled',
|
|
71
|
+
onLearnMore,
|
|
72
|
+
docsUrl: 'https://docs.example.com/authorizations',
|
|
73
|
+
};
|
|
74
|
+
renderPage({ banner });
|
|
75
|
+
expect(screen.getByLabelText('Authorizations disabled')).toBeInTheDocument();
|
|
76
|
+
expect(screen.queryByRole('status')).not.toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
it('shows tooltip content with docs link when hovering the authorizations disabled indicator', async () => {
|
|
79
|
+
const onLearnMore = vi.fn();
|
|
80
|
+
const banner = {
|
|
81
|
+
kind: 'authorizationsDisabled',
|
|
82
|
+
onLearnMore,
|
|
83
|
+
docsUrl: 'https://docs.example.com/authorizations',
|
|
84
|
+
};
|
|
85
|
+
renderPage({ banner });
|
|
86
|
+
const indicator = screen.getByLabelText('Authorizations disabled');
|
|
87
|
+
await userEvent.hover(indicator);
|
|
88
|
+
expect(screen.getByText(/All authenticated users & clients have full access to this cluster/)).toBeInTheDocument();
|
|
89
|
+
const docsLink = screen.getByText('Learn more about managing authorizations');
|
|
90
|
+
expect(docsLink).toBeInTheDocument();
|
|
91
|
+
expect(docsLink.closest('a')).toHaveAttribute('href', 'https://docs.example.com/authorizations');
|
|
92
|
+
});
|
|
67
93
|
});
|
|
@@ -5,7 +5,8 @@ export type C4ClusterDetailsPageBanner = {
|
|
|
5
5
|
onLearnMore: () => void;
|
|
6
6
|
} | {
|
|
7
7
|
kind: 'authorizationsDisabled';
|
|
8
|
-
onLearnMore
|
|
8
|
+
onLearnMore?: () => void;
|
|
9
|
+
docsUrl: string;
|
|
9
10
|
};
|
|
10
11
|
export type C4ClusterDetailsTab = C4TabProps;
|
|
11
12
|
export interface C4ClusterDetailsPageProps {
|
|
@@ -138,9 +138,15 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
138
138
|
}
|
|
139
139
|
void reloadConnectorSecrets();
|
|
140
140
|
}, [reloadConnectorSecrets, sseSecretsVersion]);
|
|
141
|
+
// Secrets prefixed with 'CAMUNDA_PROVIDED_' are system-managed and should be
|
|
142
|
+
// shown as protected (hidden) — users cannot reveal, update, or delete them.
|
|
141
143
|
const secrets = Object.keys(connectorSecretsMap)
|
|
142
144
|
.sort((a, b) => a.localeCompare(b))
|
|
143
|
-
.map((key) => ({
|
|
145
|
+
.map((key) => ({
|
|
146
|
+
id: key,
|
|
147
|
+
key,
|
|
148
|
+
isProtected: key.startsWith('CAMUNDA_PROVIDED_'),
|
|
149
|
+
}));
|
|
144
150
|
const emptyDescription = renderInlineStrong(safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.description', 'Create a connector secret to use in your connectors.'));
|
|
145
151
|
const infoText = renderInlineLink0(safeTranslate(t, 'clusterdetails:connectorSecrets.infoText', 'Learn more about connector secrets in our <0>documentation</0>.'), (label) => (_jsx(Link, { size: 'sm', href: docsUrl ?? '', onClick: (e) => {
|
|
146
152
|
e.preventDefault();
|
|
@@ -169,7 +175,8 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
169
175
|
emptyCreateButton: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.button', 'Create secret'),
|
|
170
176
|
emptyLearnMoreLabel: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.link', 'Learn more'),
|
|
171
177
|
infoText,
|
|
172
|
-
|
|
178
|
+
// Label for the badge shown on CAMUNDA_PROVIDED_ secrets
|
|
179
|
+
protectedBadge: safeTranslate(t, 'clusterdetails:connectorSecrets.protectedBadge', 'Hidden'),
|
|
173
180
|
}, urls: { docs: docsUrl ?? '' }, permissions: {
|
|
174
181
|
canCreate: connectorSecretsPermissions?.canCreate ?? canMutateCluster,
|
|
175
182
|
canRead: connectorSecretsPermissions?.canRead ?? canMutateCluster,
|
|
@@ -96,7 +96,7 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
|
|
|
96
96
|
if (!cluster) {
|
|
97
97
|
return _jsx(_Fragment, {});
|
|
98
98
|
}
|
|
99
|
-
const clusterRegion = normalizeRegion(cluster?.k8sContext?.region);
|
|
99
|
+
const clusterRegion = normalizeRegion(cluster?.k8sContext?.region ?? cluster?.k8sContext?.name);
|
|
100
100
|
const backupRegion = normalizeRegion(cluster?.backupRegion);
|
|
101
101
|
const isDualRegion = Boolean(cluster?.backupRegion?.toLowerCase().includes('dual region'));
|
|
102
102
|
const primaryEncryptionKeyId = cluster?.primaryEncryptionKeyId ?? null;
|
|
@@ -17,6 +17,7 @@ import { C4MultiStepUglyModal } from '../../../components/c4-multi-step-modal-ug
|
|
|
17
17
|
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
18
18
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
19
19
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
20
|
+
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
20
21
|
// Helper function to ensure translations work
|
|
21
22
|
function safeTranslate(t, key, fallback, options) {
|
|
22
23
|
if (!t)
|
|
@@ -419,16 +420,7 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
419
420
|
updateToIdentityAuthorization,
|
|
420
421
|
]);
|
|
421
422
|
const isClusterPausedReconciliation = useMemo(() => {
|
|
422
|
-
|
|
423
|
-
if (!labels)
|
|
424
|
-
return false;
|
|
425
|
-
if (typeof labels?.get === 'function') {
|
|
426
|
-
return labels.get('cloud.camunda.io/pauseReconciliation') === 'true';
|
|
427
|
-
}
|
|
428
|
-
if (typeof labels === 'object') {
|
|
429
|
-
return (labels['cloud.camunda.io/pauseReconciliation'] === 'true');
|
|
430
|
-
}
|
|
431
|
-
return false;
|
|
423
|
+
return isClusterReconciliationPaused(cluster);
|
|
432
424
|
}, [cluster]);
|
|
433
425
|
const generationUpdateAvailability = useMemo(() => {
|
|
434
426
|
const isUpdateAvailable = upgradableGenerations.length > 0;
|
|
@@ -939,6 +931,17 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
939
931
|
return extractVersionFromPossiblyDockerImage(version);
|
|
940
932
|
};
|
|
941
933
|
const toAppTileProps = (app) => {
|
|
934
|
+
if (isClusterPausedReconciliation) {
|
|
935
|
+
return {
|
|
936
|
+
name: app.name,
|
|
937
|
+
status: 'maintenance',
|
|
938
|
+
url: app.url ?? '',
|
|
939
|
+
version: app.version,
|
|
940
|
+
description: app.description,
|
|
941
|
+
linkLabel: app.linkLabel,
|
|
942
|
+
linkVisible: app.linkVisible !== false,
|
|
943
|
+
};
|
|
944
|
+
}
|
|
942
945
|
const normalizedStatus = normalizeClusterStatus(app.status) ?? 'unhealthy';
|
|
943
946
|
return {
|
|
944
947
|
name: app.name,
|
|
@@ -950,7 +953,9 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
950
953
|
linkVisible: app.linkVisible !== false,
|
|
951
954
|
};
|
|
952
955
|
};
|
|
953
|
-
const statusValue =
|
|
956
|
+
const statusValue = isClusterPausedReconciliation
|
|
957
|
+
? 'maintenance'
|
|
958
|
+
: (cluster.status?.ready ?? '');
|
|
954
959
|
const normalizedReadyStatus = normalizeClusterStatus(statusValue);
|
|
955
960
|
const generationName = cluster.generation?.name ?? '-';
|
|
956
961
|
const clusterUpdateType = (() => {
|
|
@@ -1223,10 +1228,10 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1223
1228
|
type: {
|
|
1224
1229
|
label: safeTranslate(t, 'clusterdetails:overview.clusterDetails.type', 'Type'),
|
|
1225
1230
|
value: typeValue,
|
|
1226
|
-
updateHwPackageLabel: canModifyHardwarePackages
|
|
1231
|
+
updateHwPackageLabel: canModifyHardwarePackages && !isClusterPausedReconciliation
|
|
1227
1232
|
? safeTranslate(t, 'clusterdetails:overview.clusterDetails.updateHwPackageButton', 'Resize cluster')
|
|
1228
1233
|
: undefined,
|
|
1229
|
-
updateHwPackageAction: canModifyHardwarePackages
|
|
1234
|
+
updateHwPackageAction: canModifyHardwarePackages && !isClusterPausedReconciliation
|
|
1230
1235
|
? openHardwareModal
|
|
1231
1236
|
: undefined,
|
|
1232
1237
|
},
|
|
@@ -1291,8 +1296,8 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1291
1296
|
await onReloadCluster();
|
|
1292
1297
|
},
|
|
1293
1298
|
wakeLabel: safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeLabel', 'Resume cluster'),
|
|
1294
|
-
wakeVisibility: canWakeCluster,
|
|
1295
|
-
sleepAction: canSleepCluster
|
|
1299
|
+
wakeVisibility: canWakeCluster && !isClusterPausedReconciliation,
|
|
1300
|
+
sleepAction: canSleepCluster && !isClusterPausedReconciliation
|
|
1296
1301
|
? async () => {
|
|
1297
1302
|
const { ConsoleClusterService } = await import('@camunda/ccma-api');
|
|
1298
1303
|
await ConsoleClusterService.suspendCluster({
|
|
@@ -6,6 +6,7 @@ import { Fragment, useCallback, useMemo, useState, } from 'react';
|
|
|
6
6
|
import { C4ClusterSettings } from '../../../components/c4-cluster-settings/c4-cluster-settings.js';
|
|
7
7
|
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
8
8
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
9
|
+
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
9
10
|
// Helper to translate with fallback
|
|
10
11
|
function safeTranslate(translateFn, key, fallback, options) {
|
|
11
12
|
try {
|
|
@@ -52,6 +53,8 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
52
53
|
const [rbaError, setRbaError] = useState(false);
|
|
53
54
|
const [authorizationsConfirm, setAuthorizationsConfirm] = useState(undefined);
|
|
54
55
|
const [authorizationsConfirmError, setAuthorizationsConfirmError] = useState(undefined);
|
|
56
|
+
const isReconciliationPaused = isClusterReconciliationPaused(props.cluster);
|
|
57
|
+
const effectiveCanEdit = props.canEditCluster && !isReconciliationPaused;
|
|
55
58
|
const checkClusterVersion = useCallback((minVersion) => {
|
|
56
59
|
if (!props.cluster?.generation?.versions?.zeebe) {
|
|
57
60
|
return false;
|
|
@@ -500,7 +503,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
500
503
|
onClick: openResourceBasedAuthorizationsConfirmation,
|
|
501
504
|
},
|
|
502
505
|
permissions: {
|
|
503
|
-
mayToggleResourceBasedAuthorizations:
|
|
506
|
+
mayToggleResourceBasedAuthorizations: effectiveCanEdit && !isUpdatingRba,
|
|
504
507
|
mayManageUsers: props.canManageUsers,
|
|
505
508
|
},
|
|
506
509
|
errorNotification: rbaError
|
|
@@ -520,7 +523,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
520
523
|
onClick: openIdentityBasedAuthorizationsConfirmation,
|
|
521
524
|
},
|
|
522
525
|
permissions: {
|
|
523
|
-
mayToggleIdentityBasedAuthorizations:
|
|
526
|
+
mayToggleIdentityBasedAuthorizations: effectiveCanEdit && !isUpdatingIdentityAuthorizations,
|
|
524
527
|
},
|
|
525
528
|
description: (_jsxs(_Fragment, { children: [_jsx("p", { children: "When enabled, users and clients will no longer have access to cluster resources and applications, requiring you to define authorizations in the cluster's Admin component." }), _jsx("p", { children: "Organization admins will keep all permissions and access to all resources." }), _jsx("br", {}), _jsx("p", { children: "When disabled, authorizations can be configured for users and clients, but they will remain inactive until the feature is enabled." }), _jsx("br", {}), _jsxs("p", { children: ["Learn more about", ' ', _jsx(Link, { href: props.docsUrls.identityAuthorization, target: '_blank', rel: 'noopener noreferrer', children: "managing authorizations" })] })] })),
|
|
526
529
|
},
|
|
@@ -529,7 +532,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
529
532
|
enabled: props.cluster.autoUpdate ?? false,
|
|
530
533
|
description: (_jsx(_Fragment, { children: safeTranslate(props.t, 'clusterdetails:settings.autoUpdate.description', 'When enabled, the cluster will be updated to the latest patch release. For entirely new cluster versions, updates will need to be performed manually. Please note that during the update, there may be a brief period of unavailability for the cluster.') })),
|
|
531
534
|
permissions: {
|
|
532
|
-
mayChange:
|
|
535
|
+
mayChange: effectiveCanEdit,
|
|
533
536
|
},
|
|
534
537
|
action: {
|
|
535
538
|
label: safeTranslate(props.t, 'clusterdetails:settings.autoUpdate.title', 'Automatic cluster patch updates'),
|
|
@@ -542,7 +545,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
542
545
|
enabled: props.cluster.enforceGroups ?? false,
|
|
543
546
|
description: (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.enforceGroups.manageAccess', 'Manage access restrictions for tasks in Tasklist. When activated, tasks assigned to users or candidate groups are only visible to the assigned user or respective group members.'), _jsx("br", {}), _jsx("br", {}), safeTranslate(props.t, 'clusterdetails:settings.enforceGroups.deactivated', 'When deactivated, every user can see any task, regardless of the assignment. Use this mode in development environments to test assignment rules.')] })),
|
|
544
547
|
permissions: {
|
|
545
|
-
mayChange:
|
|
548
|
+
mayChange: effectiveCanEdit,
|
|
546
549
|
},
|
|
547
550
|
action: {
|
|
548
551
|
label: safeTranslate(props.t, 'clusterdetails:settings.enforceGroups.title', 'Enforce user task restrictions'),
|
|
@@ -555,7 +558,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
555
558
|
enabled: props.cluster.playMode ?? false,
|
|
556
559
|
description: (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.lowLatency.description', 'When enabled, updates and changes in Modeler Play, Operate and Tasklist are applied quicker, which is ideal for testing purposes.'), _jsx("br", {}), _jsx("br", {}), safeTranslate(props.t, 'clusterdetails:settings.lowLatency.warning', 'This setting is not recommended for production environments, as it might reduce individual process instance latency but can slow down general throughput.')] })),
|
|
557
560
|
permissions: {
|
|
558
|
-
mayChange:
|
|
561
|
+
mayChange: effectiveCanEdit,
|
|
559
562
|
},
|
|
560
563
|
action: {
|
|
561
564
|
label: safeTranslate(props.t, 'clusterdetails:settings.lowLatency.title', 'Low latency updates'),
|
|
@@ -577,7 +580,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
577
580
|
return (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.swagger.accessSwagger', 'Access your cluster Swagger UI:'), ' ', _jsx(Link, { href: swaggerUrl, target: '_blank', rel: 'noopener noreferrer', children: swaggerUrl }), _jsx("br", {}), _jsx("br", {})] }));
|
|
578
581
|
})(), safeTranslate(props.t, 'clusterdetails:settings.swagger.description3', 'Learn more about'), ' ', _jsx(Link, { href: props.docsUrls.swagger, target: '_blank', children: safeTranslate(props.t, 'clusterdetails:settings.swagger.description4', 'accessing API endpoints via Swagger UI.') })] })),
|
|
579
582
|
permissions: {
|
|
580
|
-
mayChange:
|
|
583
|
+
mayChange: effectiveCanEdit,
|
|
581
584
|
},
|
|
582
585
|
action: {
|
|
583
586
|
label: safeTranslate(props.t, 'clusterdetails:settings.swagger.title', 'Enable Swagger'),
|
|
@@ -591,7 +594,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
591
594
|
enabled: props.cluster.mcpEnabled ?? false,
|
|
592
595
|
description: (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.mcp.description', 'When enabled, the cluster supports Model Context Protocol (MCP) for enhanced orchestration capabilities.'), _jsx("br", {}), _jsx("br", {}), "Learn more about the", ' ', _jsx(Link, { href: props.docsUrls.mcpOverview, target: '_blank', rel: 'noopener noreferrer', children: "Orchestration Cluster MCP Server" }), "."] })),
|
|
593
596
|
permissions: {
|
|
594
|
-
mayChange:
|
|
597
|
+
mayChange: effectiveCanEdit,
|
|
595
598
|
},
|
|
596
599
|
action: {
|
|
597
600
|
label: safeTranslate(props.t, 'clusterdetails:settings.mcp.title', 'Enable MCP Support'),
|
|
@@ -605,7 +608,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
605
608
|
enabled: props.cluster.businessIdUniquenessEnabled ?? false,
|
|
606
609
|
description: (_jsx(_Fragment, { children: safeTranslate(props.t, 'clusterdetails:settings.businessIdUniqueness.description', 'When enabled, the cluster enforces uniqueness constraints on business identifiers to prevent duplicate process instances.') })),
|
|
607
610
|
permissions: {
|
|
608
|
-
mayChange:
|
|
611
|
+
mayChange: effectiveCanEdit,
|
|
609
612
|
},
|
|
610
613
|
action: {
|
|
611
614
|
label: safeTranslate(props.t, 'clusterdetails:settings.businessIdUniqueness.title', 'Enable Business ID Uniqueness'),
|
|
@@ -621,12 +624,12 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
621
624
|
enabled: true,
|
|
622
625
|
description: (_jsxs(_Fragment, { children: [_jsx("div", { children: renderStrongTextTranslation(props.t, 'clusterdetails:settings.tasklistMode.description', 'The Tasklist component currently uses the <0>deprecated</0> v1 API. We recommend upgrading to Tasklist v2, which integrates with the Orchestration Cluster API, uses the recommended Camunda user task implementation type, and offers improved performance.', { state: 'deprecated' }) }), _jsx("div", { children: renderStrongTextTranslation(props.t, 'clusterdetails:settings.tasklistMode.descriptionLine1', "Before migrating to Tasklist v2, ensure that you're <0>not relying on</0> job worker-based user tasks, draft variables, or public start forms, as these features are only available in v1.", { support: 'not relying on' }) }), _jsx("div", { children: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.descriptionLine2', 'After upgrading to v2, downgrading back to v1 will not be possible.') }), _jsx("div", { children: _jsx(Link, { href: props.docsUrls.tasklistApiVersions, target: '_blank', children: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.learnMore', 'Learn more about upgrading from Tasklist v1 to v2') }) })] })),
|
|
623
626
|
permissions: {
|
|
624
|
-
mayChange:
|
|
627
|
+
mayChange: effectiveCanEdit,
|
|
625
628
|
},
|
|
626
629
|
action: {
|
|
627
630
|
label: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.action.label', 'Upgrade to Tasklist v2'),
|
|
628
631
|
onClick: () => setShowTasklistV2ConfirmModal(true),
|
|
629
|
-
disabled: !
|
|
632
|
+
disabled: !effectiveCanEdit ||
|
|
630
633
|
isUpdatingTasklistV2 ||
|
|
631
634
|
(props.cluster.externalMetadata?.tasklistV2Enabled ??
|
|
632
635
|
false),
|
|
@@ -11,6 +11,7 @@ import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
|
11
11
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
12
12
|
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
13
13
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
14
|
+
import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
|
|
14
15
|
function getString(record, key) {
|
|
15
16
|
const value = record[key];
|
|
16
17
|
return typeof value === 'string' ? value : undefined;
|
|
@@ -60,13 +61,6 @@ function getClusterGenerationUuid(rawCluster) {
|
|
|
60
61
|
getPathString(rawCluster, ['generation', 'uuid']) ??
|
|
61
62
|
getString(rawCluster, 'generationId'));
|
|
62
63
|
}
|
|
63
|
-
function isPausedReconciliation(rawCluster) {
|
|
64
|
-
return (getPathString(rawCluster, [
|
|
65
|
-
'metadata',
|
|
66
|
-
'labels',
|
|
67
|
-
'cloud.camunda.io/pauseReconciliation',
|
|
68
|
-
]) === 'true');
|
|
69
|
-
}
|
|
70
64
|
function isGenerationMatching(rawCluster) {
|
|
71
65
|
const generationUuid = getClusterGenerationUuid(rawCluster);
|
|
72
66
|
const currentGenerationUuid = getPathString(rawCluster, [
|
|
@@ -326,6 +320,9 @@ export const C4ClustersPage = observer(({ orgId, gettingStartedHref, onNavigate,
|
|
|
326
320
|
const item = mapClusterToListItem(rawCluster, index);
|
|
327
321
|
if (!item)
|
|
328
322
|
return undefined;
|
|
323
|
+
if (isClusterReconciliationPaused(rawCluster)) {
|
|
324
|
+
return { ...item, status: 'maintenance' };
|
|
325
|
+
}
|
|
329
326
|
const generationUuid = getClusterGenerationUuid(rawCluster);
|
|
330
327
|
const upgradableCount = generationUuid
|
|
331
328
|
? (data.getUpgradableGenerations(generationUuid)?.length ?? 0)
|
|
@@ -337,7 +334,7 @@ export const C4ClustersPage = observer(({ orgId, gettingStartedHref, onNavigate,
|
|
|
337
334
|
const shouldOfferUpdate = canUpgradeGeneration &&
|
|
338
335
|
upgradableCount > 0 &&
|
|
339
336
|
item.status === 'healthy' &&
|
|
340
|
-
!
|
|
337
|
+
!isClusterReconciliationPaused(rawCluster) &&
|
|
341
338
|
isGenerationMatching(rawCluster) &&
|
|
342
339
|
zeebeStatus !== 'Updating' &&
|
|
343
340
|
zeebeStatus !== 'Creating';
|
|
@@ -12,6 +12,22 @@ import { C4ConsoleRuntimeProvider } from '../../runtime/c4-console-runtime-conte
|
|
|
12
12
|
import { C4ClustersPage } from './c4-clusters-page.js';
|
|
13
13
|
let lastClusterListProps;
|
|
14
14
|
let lastClustersEmptyStateProps;
|
|
15
|
+
const getDefaultAuthorization = () => ({
|
|
16
|
+
isLoading: false,
|
|
17
|
+
orgRoles: [],
|
|
18
|
+
features: {},
|
|
19
|
+
visibilities: {
|
|
20
|
+
clusters: {
|
|
21
|
+
canCreate: true,
|
|
22
|
+
canEdit: true,
|
|
23
|
+
canDelete: true,
|
|
24
|
+
canUpdateTag: true,
|
|
25
|
+
canSeeClusterLoad: true,
|
|
26
|
+
canWake: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
let authzMock = getDefaultAuthorization();
|
|
15
31
|
vi.mock('@camunda/ccma-api', async () => {
|
|
16
32
|
const actual = await vi.importActual('@camunda/ccma-api');
|
|
17
33
|
return {
|
|
@@ -39,21 +55,7 @@ vi.mock('@camunda/ccma-api', async () => {
|
|
|
39
55
|
vi.mock('../../runtime/c4-console-authz', () => {
|
|
40
56
|
return {
|
|
41
57
|
useC4ConsoleAuthz: () => {
|
|
42
|
-
return
|
|
43
|
-
isLoading: false,
|
|
44
|
-
orgRoles: [],
|
|
45
|
-
features: {},
|
|
46
|
-
visibilities: {
|
|
47
|
-
clusters: {
|
|
48
|
-
canCreate: true,
|
|
49
|
-
canEdit: true,
|
|
50
|
-
canDelete: true,
|
|
51
|
-
canUpdateTag: true,
|
|
52
|
-
canSeeClusterLoad: true,
|
|
53
|
-
canWake: true,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
58
|
+
return authzMock;
|
|
57
59
|
},
|
|
58
60
|
};
|
|
59
61
|
});
|
|
@@ -75,6 +77,7 @@ vi.mock('../../components/c4-clusters-empty-state/c4-clusters-empty-state', () =
|
|
|
75
77
|
});
|
|
76
78
|
describe('C4ClustersPage', () => {
|
|
77
79
|
beforeEach(() => {
|
|
80
|
+
authzMock = getDefaultAuthorization();
|
|
78
81
|
lastClusterListProps = undefined;
|
|
79
82
|
lastClustersEmptyStateProps = undefined;
|
|
80
83
|
vi.mocked(ConsoleClusterService.getClusters).mockReset();
|
|
@@ -147,6 +150,85 @@ describe('C4ClustersPage', () => {
|
|
|
147
150
|
clusterId: 'c1',
|
|
148
151
|
});
|
|
149
152
|
});
|
|
153
|
+
it('marks spec or legacy-label paused clusters as maintenance and suppresses update suffix', async () => {
|
|
154
|
+
authzMock.features = {
|
|
155
|
+
console: {
|
|
156
|
+
clusters: {
|
|
157
|
+
canUpgradeGeneration: true,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
vi.mocked(ConsoleClusterService.getClusters).mockResolvedValue([
|
|
162
|
+
{
|
|
163
|
+
uuid: 'cluster-normal',
|
|
164
|
+
name: 'Cluster normal',
|
|
165
|
+
generation: '8.8',
|
|
166
|
+
generationUuid: 'gen-normal',
|
|
167
|
+
type: 'prod',
|
|
168
|
+
region: 'eu',
|
|
169
|
+
status: { ready: 'healthy' },
|
|
170
|
+
labels: { camunda: ['dev'], custom: [] },
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
uuid: 'cluster-spec-paused',
|
|
174
|
+
name: 'Cluster spec paused',
|
|
175
|
+
generation: '8.8',
|
|
176
|
+
generationUuid: 'gen-spec-paused',
|
|
177
|
+
type: 'prod',
|
|
178
|
+
region: 'eu',
|
|
179
|
+
status: { ready: 'healthy' },
|
|
180
|
+
labels: { camunda: ['dev'], custom: [] },
|
|
181
|
+
spec: { reconciliation: { paused: true } },
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
uuid: 'cluster-label-paused',
|
|
185
|
+
name: 'Cluster label paused',
|
|
186
|
+
generation: '8.8',
|
|
187
|
+
generationUuid: 'gen-label-paused',
|
|
188
|
+
type: 'prod',
|
|
189
|
+
region: 'eu',
|
|
190
|
+
status: { ready: 'healthy' },
|
|
191
|
+
labels: { camunda: ['dev'], custom: [] },
|
|
192
|
+
metadata: {
|
|
193
|
+
labels: { 'cloud.camunda.io/pauseReconciliation': 'true' },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
]);
|
|
197
|
+
vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([]);
|
|
198
|
+
vi.mocked(GenerationService.getUpgradable).mockResolvedValue([
|
|
199
|
+
{ uuid: 'target-gen' },
|
|
200
|
+
]);
|
|
201
|
+
vi.mocked(OrgsService.getOrgInfo).mockResolvedValue({
|
|
202
|
+
uuid: 'org-1',
|
|
203
|
+
organizationToSalesPlan: {
|
|
204
|
+
trialStateExpired: false,
|
|
205
|
+
salesPlan: {
|
|
206
|
+
salesPlanType: 'trial',
|
|
207
|
+
},
|
|
208
|
+
trialExpirationDate: new Date(Date.now() + 10 * 24 * 60 * 60 * 1000).toISOString(),
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
render(_jsx(C4ConsoleRuntimeProvider, { config: {
|
|
212
|
+
stage: 'dev',
|
|
213
|
+
auth: {
|
|
214
|
+
getAccessToken: async () => 'token',
|
|
215
|
+
},
|
|
216
|
+
backendUrls: {},
|
|
217
|
+
}, children: _jsx(C4ConsoleDataProvider, { children: _jsx(C4ClustersPage, { orgId: 'org-1' }) }) }));
|
|
218
|
+
await waitFor(() => {
|
|
219
|
+
expect(lastClusterListProps?.clusters).toHaveLength(3);
|
|
220
|
+
const normalCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-normal');
|
|
221
|
+
expect(normalCluster?.generation).toContain('update available');
|
|
222
|
+
const specPausedCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-spec-paused');
|
|
223
|
+
expect(specPausedCluster?.status).toBe('maintenance');
|
|
224
|
+
expect(specPausedCluster?.generation).toBe('8.8');
|
|
225
|
+
expect(specPausedCluster?.generation).not.toContain('update available');
|
|
226
|
+
const labelPausedCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-label-paused');
|
|
227
|
+
expect(labelPausedCluster?.status).toBe('maintenance');
|
|
228
|
+
expect(labelPausedCluster?.generation).toBe('8.8');
|
|
229
|
+
expect(labelPausedCluster?.generation).not.toContain('update available');
|
|
230
|
+
});
|
|
231
|
+
});
|
|
150
232
|
it('merges permissionsOverride into derived permissions', async () => {
|
|
151
233
|
vi.mocked(ConsoleClusterService.getClusters).mockResolvedValue([]);
|
|
152
234
|
vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([]);
|
|
@@ -7,6 +7,7 @@ import { C4OldDashboard } from '../../components/c4-old-dashboard/c4-old-dashboa
|
|
|
7
7
|
import { getC4DashboardUrls } from '../../externalUrls.const.js';
|
|
8
8
|
import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
9
9
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
10
|
+
import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
|
|
10
11
|
const DAY = 24 * 60 * 60 * 1000;
|
|
11
12
|
function safeTranslate(t, key, fallback, options) {
|
|
12
13
|
try {
|
|
@@ -180,7 +181,9 @@ export const C4DashboardApp = observer((props) => {
|
|
|
180
181
|
return {
|
|
181
182
|
id,
|
|
182
183
|
name: cluster.name,
|
|
183
|
-
status: cluster
|
|
184
|
+
status: isClusterReconciliationPaused(cluster)
|
|
185
|
+
? 'maintenance'
|
|
186
|
+
: cluster.status?.ready || 'Unknown',
|
|
184
187
|
tags: cluster.labels?.camunda?.length === 1
|
|
185
188
|
? cluster.labels.camunda[0]
|
|
186
189
|
: '',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when reconciliation is paused via either:
|
|
3
|
+
* - `spec.reconciliation.paused` (current CRD field), or
|
|
4
|
+
* - `metadata.labels['cloud.camunda.io/pauseReconciliation']` (legacy label).
|
|
5
|
+
*/
|
|
6
|
+
export declare function isClusterReconciliationPaused(cluster: unknown): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
const LEGACY_PAUSE_RECONCILIATION_LABEL = 'cloud.camunda.io/pauseReconciliation';
|
|
7
|
+
/**
|
|
8
|
+
* Reads the legacy pause-reconciliation label from cluster metadata.
|
|
9
|
+
*/
|
|
10
|
+
function readLegacyPauseLabel(clusterRecord) {
|
|
11
|
+
const metadata = clusterRecord.metadata;
|
|
12
|
+
if (!metadata || typeof metadata !== 'object') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const labels = metadata.labels;
|
|
16
|
+
if (!labels) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
// Some call sites provide map-like label containers instead of plain objects.
|
|
20
|
+
if (labels instanceof Map) {
|
|
21
|
+
return labels.get(LEGACY_PAUSE_RECONCILIATION_LABEL) === 'true';
|
|
22
|
+
}
|
|
23
|
+
if (labels !== null && typeof labels === 'object') {
|
|
24
|
+
return (labels[LEGACY_PAUSE_RECONCILIATION_LABEL] ===
|
|
25
|
+
'true');
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reads the CRD-native reconciliation pause flag from cluster spec.
|
|
31
|
+
*/
|
|
32
|
+
function readSpecPauseFlag(clusterRecord) {
|
|
33
|
+
const spec = clusterRecord.spec;
|
|
34
|
+
if (!spec || typeof spec !== 'object') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const reconciliation = spec.reconciliation;
|
|
38
|
+
if (!reconciliation || typeof reconciliation !== 'object') {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return reconciliation.paused === true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns true when reconciliation is paused via either:
|
|
45
|
+
* - `spec.reconciliation.paused` (current CRD field), or
|
|
46
|
+
* - `metadata.labels['cloud.camunda.io/pauseReconciliation']` (legacy label).
|
|
47
|
+
*/
|
|
48
|
+
export function isClusterReconciliationPaused(cluster) {
|
|
49
|
+
if (!cluster || typeof cluster !== 'object') {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const clusterRecord = cluster;
|
|
53
|
+
return readLegacyPauseLabel(clusterRecord) || readSpecPauseFlag(clusterRecord);
|
|
54
|
+
}
|
|
@@ -1263,6 +1263,18 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
1263
1263
|
});
|
|
1264
1264
|
await loadBilling();
|
|
1265
1265
|
},
|
|
1266
|
+
onCreateUsageAlert: async (metric, threshold, enabled) => {
|
|
1267
|
+
await UsageAlertsService.create({
|
|
1268
|
+
config: apiConfig,
|
|
1269
|
+
params: {
|
|
1270
|
+
orgId,
|
|
1271
|
+
metric,
|
|
1272
|
+
threshold,
|
|
1273
|
+
enabled,
|
|
1274
|
+
},
|
|
1275
|
+
});
|
|
1276
|
+
await loadBilling();
|
|
1277
|
+
},
|
|
1266
1278
|
t,
|
|
1267
1279
|
};
|
|
1268
1280
|
}, [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UsageAlertDto } from '@camunda/ccma-shared-types';
|
|
1
|
+
import { type UsageAlertDto, UsageAlertMetric } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
3
|
type Translate = (key: string, options?: Record<string, unknown>) => string;
|
|
4
4
|
interface ClusterReservation {
|
|
@@ -37,6 +37,7 @@ export interface C4ManagementBillingTabProps {
|
|
|
37
37
|
membersCount: number;
|
|
38
38
|
changeTab: (tabId: string) => void;
|
|
39
39
|
onUpdateUsageAlert: (alertId: string, threshold: number, enabled: boolean) => Promise<void>;
|
|
40
|
+
onCreateUsageAlert: (metric: UsageAlertMetric, threshold: number, enabled: boolean) => Promise<void>;
|
|
40
41
|
t?: Translate;
|
|
41
42
|
isLicensingModel2025?: boolean;
|
|
42
43
|
}
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 { UsageAlertMetric, UsageAlertThresholdLimits, } from '@camunda/ccma-shared-types';
|
|
7
|
+
import { UsageAlertInitValues, UsageAlertMetric, UsageAlertThresholdLimits, } from '@camunda/ccma-shared-types';
|
|
8
8
|
import { Modal, Stack } from '@carbon/react';
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import { C4BillingPage } from '../../../components/c4-billing-page/c4-billing-page.js';
|
|
@@ -68,30 +68,28 @@ export const C4ManagementBillingTab = (props) => {
|
|
|
68
68
|
return safeTranslate(props.t, 'orgmanagement:tabs.billing.usageAlerts.table.data.taskUsers', 'Task Users');
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
const
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
.sort((a) => (a.metric === UsageAlertMetric.PROCESS_INSTANCES ? -1 : 1))
|
|
92
|
-
.map((alert) => {
|
|
71
|
+
const allMetrics = props.isLicensingModel2025
|
|
72
|
+
? [UsageAlertMetric.PROCESS_INSTANCES]
|
|
73
|
+
: [
|
|
74
|
+
UsageAlertMetric.PROCESS_INSTANCES,
|
|
75
|
+
UsageAlertMetric.DECISION_INSTANCES,
|
|
76
|
+
UsageAlertMetric.TASK_USERS,
|
|
77
|
+
];
|
|
78
|
+
const existingByMetric = new Map(props.billingUsageAlerts.map((a) => [a.metric, a]));
|
|
79
|
+
const placeholderDate = new Date(0);
|
|
80
|
+
const mergedAlerts = allMetrics.map((metric) => existingByMetric.get(metric) ?? {
|
|
81
|
+
uuid: '',
|
|
82
|
+
created: placeholderDate,
|
|
83
|
+
createdBy: '',
|
|
84
|
+
updated: placeholderDate,
|
|
85
|
+
metric,
|
|
86
|
+
threshold: UsageAlertInitValues.threshold,
|
|
87
|
+
enabled: UsageAlertInitValues.enabled,
|
|
88
|
+
triggered: false,
|
|
89
|
+
});
|
|
90
|
+
const usageAlertsRows = mergedAlerts.map((alert) => {
|
|
93
91
|
return {
|
|
94
|
-
key: alert.uuid
|
|
92
|
+
key: alert.uuid !== '' ? alert.uuid : `default-${alert.metric}`,
|
|
95
93
|
metric: getMetricLabel(alert.metric),
|
|
96
94
|
threshold: `${alert.threshold}%`,
|
|
97
95
|
status: alert.enabled
|
|
@@ -243,6 +241,7 @@ export const C4ManagementBillingTab = (props) => {
|
|
|
243
241
|
}
|
|
244
242
|
const nextThreshold = usageAlertUpdateThreshold;
|
|
245
243
|
const nextEnabled = usageAlertUpdateEnabled;
|
|
244
|
+
const isNewAlert = alert.uuid === '';
|
|
246
245
|
const validate = () => {
|
|
247
246
|
if (nextThreshold < UsageAlertThresholdLimits.min ||
|
|
248
247
|
nextThreshold > UsageAlertThresholdLimits.max) {
|
|
@@ -253,13 +252,15 @@ export const C4ManagementBillingTab = (props) => {
|
|
|
253
252
|
}));
|
|
254
253
|
return false;
|
|
255
254
|
}
|
|
256
|
-
if (
|
|
255
|
+
if (!isNewAlert &&
|
|
256
|
+
nextThreshold === alert.threshold &&
|
|
257
257
|
nextEnabled === alert.enabled) {
|
|
258
258
|
setUsageAlertUpdateInvalid(true);
|
|
259
259
|
setUsageAlertUpdateInvalidText(safeTranslate(props.t, 'usagealerts:update.error.thresholdSame', 'No changes to save.'));
|
|
260
260
|
return false;
|
|
261
261
|
}
|
|
262
|
-
if (
|
|
262
|
+
if (!isNewAlert &&
|
|
263
|
+
nextEnabled === true &&
|
|
263
264
|
alert.triggered === true &&
|
|
264
265
|
nextThreshold < alert.threshold) {
|
|
265
266
|
setUsageAlertUpdateInvalid(true);
|
|
@@ -277,7 +278,12 @@ export const C4ManagementBillingTab = (props) => {
|
|
|
277
278
|
void (async () => {
|
|
278
279
|
setUsageAlertUpdateSaving(true);
|
|
279
280
|
try {
|
|
280
|
-
|
|
281
|
+
if (isNewAlert) {
|
|
282
|
+
await props.onCreateUsageAlert(alert.metric, nextThreshold, nextEnabled);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
await props.onUpdateUsageAlert(alert.uuid, nextThreshold, nextEnabled);
|
|
286
|
+
}
|
|
281
287
|
setUsageAlertUpdateModalOpen(false);
|
|
282
288
|
setUsageAlertUpdateTarget(undefined);
|
|
283
289
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { UsageAlertMetric } from '@camunda/ccma-shared-types';
|
|
8
|
+
import { act, render, screen } from '@testing-library/react';
|
|
9
|
+
import userEvent from '@testing-library/user-event';
|
|
10
|
+
import { C4ManagementBillingTab } from './c4-management-billing-tab.js';
|
|
11
|
+
let lastUsageAlertsProps;
|
|
12
|
+
vi.mock('../../../components/c4-billing-page/c4-billing-page', () => ({
|
|
13
|
+
C4BillingPage: (props) => {
|
|
14
|
+
lastUsageAlertsProps = props.usageAlerts;
|
|
15
|
+
return (_jsx("div", { "data-testid": 'billing-page', children: props.usageAlerts?.data.rows.map((row) => (_jsxs("div", { "data-testid": `row-${row.key}`, children: [_jsx("span", { children: row.metric }), _jsx("span", { children: row.threshold }), _jsx("span", { children: row.status }), _jsx("button", { onClick: row.action?.onClick, children: row.action?.label })] }, row.key))) }));
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
vi.mock('../../../components/c4-usage-alert-update-modal/c4-usage-alert-update-modal', () => ({
|
|
19
|
+
C4UsageAlertUpdateModal: (props) => (_jsxs("div", { children: [_jsx("input", { "data-testid": 'threshold-input', type: 'number', value: props.form.threashold.currentValue, onChange: (e) => props.form.threashold.onChange(Number(e.target.value)) }), _jsx("input", { "data-testid": 'status-input', type: 'checkbox', checked: props.form.status.currentValue, onChange: (e) => props.form.status.onChange(e.target.checked) }), props.form.threashold.errors.invalid && (_jsx("span", { "data-testid": 'invalid-text', children: props.form.threashold.errors.invalidText }))] })),
|
|
20
|
+
}));
|
|
21
|
+
const NOW = new Date('2024-01-01T00:00:00Z');
|
|
22
|
+
function makeAlert(metric, overrides = {}) {
|
|
23
|
+
return {
|
|
24
|
+
uuid: `alert-${metric}`,
|
|
25
|
+
created: NOW,
|
|
26
|
+
createdBy: 'user',
|
|
27
|
+
updated: NOW,
|
|
28
|
+
metric,
|
|
29
|
+
threshold: 80,
|
|
30
|
+
enabled: true,
|
|
31
|
+
triggered: false,
|
|
32
|
+
...overrides,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function renderTab(overrides = {}) {
|
|
36
|
+
lastUsageAlertsProps = undefined;
|
|
37
|
+
const base = {
|
|
38
|
+
billingIsEnterprise: true,
|
|
39
|
+
billingLoading: false,
|
|
40
|
+
billingError: undefined,
|
|
41
|
+
billingGeneralData: {
|
|
42
|
+
displaySalesPlan: 'Enterprise',
|
|
43
|
+
lastUpdated: NOW,
|
|
44
|
+
},
|
|
45
|
+
billingEnterprisePeriod: {
|
|
46
|
+
periodStart: NOW,
|
|
47
|
+
periodEnd: NOW,
|
|
48
|
+
nextRenewal: NOW,
|
|
49
|
+
},
|
|
50
|
+
billingUsageAlerts: [],
|
|
51
|
+
billingIncludedMetrics: {
|
|
52
|
+
processInstances: 0,
|
|
53
|
+
decisionInstances: 0,
|
|
54
|
+
taskUsers: 0,
|
|
55
|
+
},
|
|
56
|
+
billingCurrentMetrics: {
|
|
57
|
+
processInstances: 0,
|
|
58
|
+
decisionInstances: 0,
|
|
59
|
+
taskUsers: 0,
|
|
60
|
+
},
|
|
61
|
+
billingClusterReservations: [],
|
|
62
|
+
enterpriseDevOnly: false,
|
|
63
|
+
membersCount: 1,
|
|
64
|
+
changeTab: vi.fn(),
|
|
65
|
+
onUpdateUsageAlert: vi.fn(),
|
|
66
|
+
onCreateUsageAlert: vi.fn(),
|
|
67
|
+
};
|
|
68
|
+
return render(_jsx(C4ManagementBillingTab, { ...base, ...overrides }));
|
|
69
|
+
}
|
|
70
|
+
describe('C4ManagementBillingTab usage alerts', () => {
|
|
71
|
+
it('shows default placeholder rows when no alerts exist in the DB', () => {
|
|
72
|
+
renderTab({ billingUsageAlerts: [] });
|
|
73
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
74
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
75
|
+
expect(rows).toHaveLength(3);
|
|
76
|
+
expect(rows.map((r) => r.threshold)).toEqual(['80%', '80%', '80%']);
|
|
77
|
+
expect(rows.map((r) => r.status)).toEqual(['Off', 'Off', 'Off']);
|
|
78
|
+
});
|
|
79
|
+
it('shows real alerts when they exist in the DB', () => {
|
|
80
|
+
renderTab({
|
|
81
|
+
billingUsageAlerts: [
|
|
82
|
+
makeAlert(UsageAlertMetric.PROCESS_INSTANCES, {
|
|
83
|
+
threshold: 90,
|
|
84
|
+
enabled: true,
|
|
85
|
+
}),
|
|
86
|
+
makeAlert(UsageAlertMetric.DECISION_INSTANCES, {
|
|
87
|
+
threshold: 50,
|
|
88
|
+
enabled: false,
|
|
89
|
+
}),
|
|
90
|
+
makeAlert(UsageAlertMetric.TASK_USERS, {
|
|
91
|
+
threshold: 75,
|
|
92
|
+
enabled: true,
|
|
93
|
+
}),
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
97
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
98
|
+
expect(rows).toHaveLength(3);
|
|
99
|
+
expect(rows[0].threshold).toBe('90%');
|
|
100
|
+
expect(rows[0].status).toBe('On');
|
|
101
|
+
expect(rows[1].threshold).toBe('50%');
|
|
102
|
+
expect(rows[1].status).toBe('Off');
|
|
103
|
+
});
|
|
104
|
+
it('fills in default placeholder for a missing metric when others exist', () => {
|
|
105
|
+
renderTab({
|
|
106
|
+
billingUsageAlerts: [
|
|
107
|
+
makeAlert(UsageAlertMetric.PROCESS_INSTANCES, { threshold: 90 }),
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
111
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
112
|
+
expect(rows).toHaveLength(3);
|
|
113
|
+
// PI row uses the real alert
|
|
114
|
+
const piRow = rows.find((r) => r.key.startsWith(`alert-${UsageAlertMetric.PROCESS_INSTANCES}`));
|
|
115
|
+
expect(piRow).toBeDefined();
|
|
116
|
+
expect(piRow.threshold).toBe('90%');
|
|
117
|
+
// DI row is a default placeholder
|
|
118
|
+
const diRow = rows.find((r) => r.key.startsWith('default-'));
|
|
119
|
+
expect(diRow).toBeDefined();
|
|
120
|
+
expect(diRow.threshold).toBe('80%');
|
|
121
|
+
});
|
|
122
|
+
it('places Process Instances first', () => {
|
|
123
|
+
renderTab({ billingUsageAlerts: [] });
|
|
124
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
125
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
126
|
+
expect(rows[0].metric).toBe('Process Instances');
|
|
127
|
+
});
|
|
128
|
+
it('hides Decision Instances and Task Users for 2025 licensing model', () => {
|
|
129
|
+
renderTab({
|
|
130
|
+
isLicensingModel2025: true,
|
|
131
|
+
billingUsageAlerts: [],
|
|
132
|
+
});
|
|
133
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
134
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
135
|
+
expect(rows).toHaveLength(1);
|
|
136
|
+
expect(rows[0].metric).toBe('Process Instances');
|
|
137
|
+
});
|
|
138
|
+
it('hides existing DI and TU alerts from the DB for 2025 licensing model', () => {
|
|
139
|
+
renderTab({
|
|
140
|
+
isLicensingModel2025: true,
|
|
141
|
+
billingUsageAlerts: [
|
|
142
|
+
makeAlert(UsageAlertMetric.PROCESS_INSTANCES, {
|
|
143
|
+
threshold: 90,
|
|
144
|
+
enabled: true,
|
|
145
|
+
}),
|
|
146
|
+
makeAlert(UsageAlertMetric.DECISION_INSTANCES, {
|
|
147
|
+
threshold: 50,
|
|
148
|
+
enabled: true,
|
|
149
|
+
}),
|
|
150
|
+
makeAlert(UsageAlertMetric.TASK_USERS, {
|
|
151
|
+
threshold: 75,
|
|
152
|
+
enabled: true,
|
|
153
|
+
}),
|
|
154
|
+
],
|
|
155
|
+
});
|
|
156
|
+
expect(lastUsageAlertsProps).toBeDefined();
|
|
157
|
+
const rows = lastUsageAlertsProps.data.rows;
|
|
158
|
+
expect(rows).toHaveLength(1);
|
|
159
|
+
expect(rows[0].metric).toBe('Process Instances');
|
|
160
|
+
expect(rows[0].threshold).toBe('90%');
|
|
161
|
+
expect(rows[0].status).toBe('On');
|
|
162
|
+
});
|
|
163
|
+
it('calls onCreateUsageAlert when editing a placeholder (no DB entry)', async () => {
|
|
164
|
+
const onCreateUsageAlert = vi.fn().mockResolvedValue(undefined);
|
|
165
|
+
renderTab({
|
|
166
|
+
billingUsageAlerts: [],
|
|
167
|
+
onCreateUsageAlert,
|
|
168
|
+
});
|
|
169
|
+
// Click Edit on the PI placeholder row
|
|
170
|
+
const editButton = screen.getAllByText('Edit')[0];
|
|
171
|
+
await act(async () => {
|
|
172
|
+
await userEvent.click(editButton);
|
|
173
|
+
});
|
|
174
|
+
// Modal opens — click the Update button
|
|
175
|
+
const updateButton = await screen.findByText('Update');
|
|
176
|
+
await act(async () => {
|
|
177
|
+
await userEvent.click(updateButton);
|
|
178
|
+
});
|
|
179
|
+
expect(onCreateUsageAlert).toHaveBeenCalledWith(UsageAlertMetric.PROCESS_INSTANCES, 80, false);
|
|
180
|
+
});
|
|
181
|
+
it('shows "no changes" validation error when editing an existing alert without changing values', async () => {
|
|
182
|
+
const onUpdateUsageAlert = vi.fn().mockResolvedValue(undefined);
|
|
183
|
+
renderTab({
|
|
184
|
+
billingUsageAlerts: [
|
|
185
|
+
makeAlert(UsageAlertMetric.PROCESS_INSTANCES, {
|
|
186
|
+
threshold: 80,
|
|
187
|
+
enabled: false,
|
|
188
|
+
}),
|
|
189
|
+
],
|
|
190
|
+
onUpdateUsageAlert,
|
|
191
|
+
});
|
|
192
|
+
const editButton = screen.getAllByText('Edit')[0];
|
|
193
|
+
await act(async () => {
|
|
194
|
+
await userEvent.click(editButton);
|
|
195
|
+
});
|
|
196
|
+
const updateButton = await screen.findByText('Update');
|
|
197
|
+
await act(async () => {
|
|
198
|
+
await userEvent.click(updateButton);
|
|
199
|
+
});
|
|
200
|
+
expect(onUpdateUsageAlert).not.toHaveBeenCalled();
|
|
201
|
+
expect(await screen.findByText('No changes to save.')).toBeInTheDocument();
|
|
202
|
+
});
|
|
203
|
+
it('calls onUpdateUsageAlert when editing an existing alert with changed values', async () => {
|
|
204
|
+
const onUpdateUsageAlert = vi.fn().mockResolvedValue(undefined);
|
|
205
|
+
renderTab({
|
|
206
|
+
billingUsageAlerts: [
|
|
207
|
+
makeAlert(UsageAlertMetric.PROCESS_INSTANCES, {
|
|
208
|
+
threshold: 80,
|
|
209
|
+
enabled: false,
|
|
210
|
+
}),
|
|
211
|
+
],
|
|
212
|
+
onUpdateUsageAlert,
|
|
213
|
+
});
|
|
214
|
+
const editButton = screen.getAllByText('Edit')[0];
|
|
215
|
+
await act(async () => {
|
|
216
|
+
await userEvent.click(editButton);
|
|
217
|
+
});
|
|
218
|
+
// Change the threshold to a different value
|
|
219
|
+
const thresholdInput = await screen.findByTestId('threshold-input');
|
|
220
|
+
await act(async () => {
|
|
221
|
+
await userEvent.clear(thresholdInput);
|
|
222
|
+
await userEvent.type(thresholdInput, '90');
|
|
223
|
+
});
|
|
224
|
+
const updateButton = screen.getByText('Update');
|
|
225
|
+
await act(async () => {
|
|
226
|
+
await userEvent.click(updateButton);
|
|
227
|
+
});
|
|
228
|
+
expect(onUpdateUsageAlert).toHaveBeenCalledWith(`alert-${UsageAlertMetric.PROCESS_INSTANCES}`, 90, false);
|
|
229
|
+
});
|
|
230
|
+
it('shows non-enterprise message when billingIsEnterprise is false', () => {
|
|
231
|
+
render(_jsx(C4ManagementBillingTab, { billingIsEnterprise: false, billingLoading: false, billingError: undefined, billingGeneralData: { displaySalesPlan: 'Pro', lastUpdated: NOW }, billingEnterprisePeriod: {
|
|
232
|
+
periodStart: NOW,
|
|
233
|
+
periodEnd: NOW,
|
|
234
|
+
nextRenewal: NOW,
|
|
235
|
+
}, billingUsageAlerts: [], billingIncludedMetrics: {
|
|
236
|
+
processInstances: 0,
|
|
237
|
+
decisionInstances: 0,
|
|
238
|
+
taskUsers: 0,
|
|
239
|
+
}, billingCurrentMetrics: {
|
|
240
|
+
processInstances: 0,
|
|
241
|
+
decisionInstances: 0,
|
|
242
|
+
taskUsers: 0,
|
|
243
|
+
}, billingClusterReservations: [], enterpriseDevOnly: false, membersCount: 1, changeTab: vi.fn(), onUpdateUsageAlert: vi.fn(), onCreateUsageAlert: vi.fn() }));
|
|
244
|
+
expect(screen.getByText('Billing is not available.')).toBeInTheDocument();
|
|
245
|
+
});
|
|
246
|
+
});
|
|
@@ -340,7 +340,7 @@ export const C4ManagementUsersTab = ({ orgId, members, loading, mayManageUsersAc
|
|
|
340
340
|
setResendError(undefined);
|
|
341
341
|
try {
|
|
342
342
|
await onResendInvite(inviteId);
|
|
343
|
-
|
|
343
|
+
closeResendInviteModal();
|
|
344
344
|
}
|
|
345
345
|
catch (error) {
|
|
346
346
|
telemetry?.captureException?.(error, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"rimraf": "6.1.3",
|
|
51
51
|
"storybook": "10.3.5",
|
|
52
52
|
"styled-components": "6.4.0",
|
|
53
|
-
"@camunda/camunda-composite-components": "0.
|
|
53
|
+
"@camunda/camunda-composite-components": "0.23.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@camunda/c4-connectors": "1.x",
|