@camunda/ccma-saas-frontend 0.1.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/c4-billing-page/c4-billing-page.mocks.d.ts +3 -0
- package/lib/esm/components/c4-billing-page/c4-billing-page.mocks.js +154 -0
- package/lib/esm/components/c4-billing-page/elements/value-metric.d.ts +2 -0
- package/lib/esm/components/c4-billing-page/elements/value-metric.js +14 -3
- package/lib/esm/components/c4-billing-page/elements/value-metric.spec.js +18 -0
- package/lib/esm/components/c4-charts-dashboard/elements/alluvial-chart.js +58 -1
- package/lib/esm/components/c4-charts-dashboard/elements/bar-chart.js +40 -6
- package/lib/esm/components/c4-charts-dashboard/elements/line-chart.js +6 -0
- package/lib/esm/components/c4-cluster-details-alerts/c4-cluster-details-alerts.mocks.d.ts +5 -0
- package/lib/esm/components/c4-cluster-details-alerts/c4-cluster-details-alerts.mocks.js +83 -0
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.d.ts +6 -0
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +79 -0
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.mocks.d.ts +3 -0
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.mocks.js +65 -0
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.mocks.d.ts +60 -0
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.mocks.js +143 -0
- package/lib/esm/components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.mocks.d.ts +6 -0
- package/lib/esm/components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.mocks.js +51 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +63 -2
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.mocks.d.ts +4 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.mocks.js +132 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +7 -0
- package/lib/esm/components/c4-cluster-overview/applications.d.ts +1 -1
- package/lib/esm/components/c4-cluster-overview/applications.js +17 -3
- package/lib/esm/components/c4-cluster-overview/applications.spec.js +27 -1
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.mocks.d.ts +8 -0
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.mocks.js +203 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +2 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +59 -9
- package/lib/esm/components/c4-cluster-overview/cluster-load.js +38 -3
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.mocks.d.ts +16 -0
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.mocks.js +104 -0
- package/lib/esm/components/c4-cluster-settings/elements/app-integrations-toggle.d.ts +14 -0
- package/lib/esm/components/c4-cluster-settings/elements/app-integrations-toggle.js +12 -0
- package/lib/esm/components/c4-cluster-settings/elements/cluster-settings.d.ts +5 -1
- package/lib/esm/components/c4-cluster-settings/elements/cluster-settings.js +10 -3
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.d.ts +20 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.js +85 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.spec.d.ts +1 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.spec.js +93 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.d.ts +20 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.js +15 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.spec.d.ts +1 -0
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.spec.js +50 -0
- package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.d.ts +10 -4
- package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.js +116 -24
- package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.spec.d.ts +1 -0
- package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.spec.js +120 -0
- package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +19 -1
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.mocks.d.ts +2 -0
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.mocks.js +186 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.d.ts +2 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +132 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.mocks.d.ts +2 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.mocks.js +20 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.types.d.ts +22 -0
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.types.js +6 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.d.ts +32 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.js +71 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.spec.d.ts +1 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.spec.js +83 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +31 -58
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.d.ts +64 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.js +298 -0
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +48 -30
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.mocks.d.ts +2 -0
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.mocks.js +23 -0
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.types.d.ts +2 -0
- package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.mocks.d.ts +2 -0
- package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.mocks.js +15 -0
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +5 -5
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.mocks.d.ts +2 -0
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.mocks.js +13 -0
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.types.d.ts +1 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.d.ts +2 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +77 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.mocks.d.ts +2 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.mocks.js +11 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.types.d.ts +14 -0
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.types.js +6 -0
- package/lib/esm/components/c4-data-table/c4-data-table.js +117 -34
- package/lib/esm/components/c4-data-table/c4-data-table.stability.spec.d.ts +1 -0
- package/lib/esm/components/c4-data-table/c4-data-table.stability.spec.js +151 -0
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.mocks.d.ts +2 -0
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.mocks.js +231 -0
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.js +56 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.js +36 -1
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.mocks.d.ts +2 -0
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.mocks.js +102 -0
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-ds-colors.d.ts +10 -0
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-ds-colors.js +16 -0
- package/lib/esm/components/c4-management-activity/c4-management-activity.d.ts +1 -1
- package/lib/esm/components/c4-management-activity/c4-management-activity.js +103 -1
- package/lib/esm/components/c4-management-activity/c4-management-activity.mocks.d.ts +4 -0
- package/lib/esm/components/c4-management-activity/c4-management-activity.mocks.js +63 -0
- package/lib/esm/components/c4-management-activity/c4-management-activity.types.d.ts +11 -0
- package/lib/esm/components/c4-management-api/c4-management-api.mocks.d.ts +43 -0
- package/lib/esm/components/c4-management-api/c4-management-api.mocks.js +118 -0
- package/lib/esm/components/c4-management-overview/c4-management-overview.js +6 -4
- package/lib/esm/components/c4-old-dashboard/c4-old-dashboard.js +1 -1
- package/lib/esm/components/c4-old-dashboard/c4-old-dashboard.types.d.ts +1 -0
- package/lib/esm/components/c4-selectable-tile/c4-selectable-tile.js +4 -1
- package/lib/esm/components/c4-telemetry-page/telemetry-for-component.js +58 -36
- package/lib/esm/components/c4-usage-history/elements/usage-history-charts.js +6 -0
- package/lib/esm/components/c4-user-details/tabs/authorized-resources.js +3 -1
- package/lib/esm/components/shared-charts/ds-charts.smoke.spec.d.ts +1 -0
- package/lib/esm/components/shared-charts/ds-charts.smoke.spec.js +47 -0
- package/lib/esm/components/shared-charts/ds-line-chart.d.ts +33 -0
- package/lib/esm/components/shared-charts/ds-line-chart.js +55 -0
- package/lib/esm/components/shared-charts/ds-meter-chart.d.ts +22 -0
- package/lib/esm/components/shared-charts/ds-meter-chart.js +48 -0
- package/lib/esm/components/shared-charts/recharts-tokens.d.ts +24 -0
- package/lib/esm/components/shared-charts/recharts-tokens.js +51 -0
- package/lib/esm/externalUrls.const.d.ts +2 -0
- package/lib/esm/externalUrls.const.js +7 -0
- package/lib/esm/externalUrls.const.spec.js +2 -0
- package/lib/esm/i18n/en/entities/orgroles.json +0 -16
- package/lib/esm/i18n/en/pages/clusterdetails.json +9 -1
- package/lib/esm/i18n/en/pages/orgmanagement.json +9 -2
- package/lib/esm/index.d.ts +17 -2
- package/lib/esm/index.js +11 -2
- package/lib/esm/runtime/c4-console-authz.d.ts +26 -0
- package/lib/esm/runtime/c4-console-authz.js +58 -28
- package/lib/esm/runtime/c4-console-authz.spec.js +84 -17
- package/lib/esm/runtime/c4-console-data-context.js +40 -0
- package/lib/esm/runtime/c4-console-data-context.types.d.ts +19 -1
- package/lib/esm/runtime/c4-console-data-store.d.ts +25 -1
- package/lib/esm/runtime/c4-console-data-store.js +145 -31
- package/lib/esm/runtime/c4-console-data-store.nav.spec.d.ts +1 -0
- package/lib/esm/runtime/c4-console-data-store.nav.spec.js +121 -0
- package/lib/esm/runtime/c4-console-data-store.spec.js +35 -6
- package/lib/esm/runtime/c4-console-events-context.d.ts +18 -0
- package/lib/esm/runtime/c4-console-events-context.js +62 -0
- package/lib/esm/runtime/c4-console-runtime.types.d.ts +12 -0
- package/lib/esm/runtime/c4-user-notifications-context.d.ts +19 -0
- package/lib/esm/runtime/c4-user-notifications-context.js +201 -0
- package/lib/esm/runtime/c4-user-notifications-context.spec.d.ts +1 -0
- package/lib/esm/runtime/c4-user-notifications-context.spec.js +80 -0
- package/lib/esm/runtime/c4-user-notifications-context.types.d.ts +31 -0
- package/lib/esm/runtime/c4-user-notifications-context.types.js +6 -0
- package/lib/esm/runtime/c4-user-theme.d.ts +27 -0
- package/lib/esm/runtime/c4-user-theme.js +106 -0
- package/lib/esm/runtime/decode-access-token.d.ts +12 -0
- package/lib/esm/runtime/decode-access-token.js +39 -0
- package/lib/esm/runtime/nav/camunda-apps.d.ts +45 -0
- package/lib/esm/runtime/nav/camunda-apps.js +100 -0
- package/lib/esm/runtime/nav/camunda-apps.spec.d.ts +1 -0
- package/lib/esm/runtime/nav/camunda-apps.spec.js +90 -0
- package/lib/esm/runtime/nav/use-webapp-nav-data.d.ts +75 -0
- package/lib/esm/runtime/nav/use-webapp-nav-data.js +211 -0
- package/lib/esm/runtime/nav/use-webapp-nav-data.spec.d.ts +1 -0
- package/lib/esm/runtime/nav/use-webapp-nav-data.spec.js +91 -0
- package/lib/esm/runtime/to-api-config.js +4 -0
- package/lib/esm/ui/index.d.ts +1 -0
- package/lib/esm/ui/index.js +3 -2
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +32 -13
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.merge.spec.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.merge.spec.js +49 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +8 -0
- package/lib/esm/widgets/cluster-details/cluster-details-tabs.d.ts +23 -0
- package/lib/esm/widgets/cluster-details/cluster-details-tabs.js +83 -0
- package/lib/esm/widgets/cluster-details/cluster-details-tabs.spec.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/cluster-details-tabs.spec.js +33 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +17 -84
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +19 -35
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +38 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +38 -14
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.d.ts +2 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +190 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.spec.js +60 -1
- package/lib/esm/widgets/clusters/c4-clusters-page.js +80 -44
- package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +48 -48
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +2 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +2 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.js +10 -3
- package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-page.spec.js +32 -0
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +4 -3
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +21 -2
- package/lib/esm/widgets/group-details/c4-group-details-page.js +3 -2
- package/lib/esm/widgets/management/c4-management-app.js +80 -24
- package/lib/esm/widgets/management/c4-management-app.spec.js +32 -10
- package/lib/esm/widgets/management/management-tabs.d.ts +22 -0
- package/lib/esm/widgets/management/management-tabs.js +76 -0
- package/lib/esm/widgets/management/management-tabs.spec.d.ts +1 -0
- package/lib/esm/widgets/management/management-tabs.spec.js +28 -0
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.d.ts +2 -1
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +11 -2
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +0 -10
- package/lib/esm/widgets/user-details/c4-user-details-page.js +0 -10
- package/package.json +9 -7
|
@@ -0,0 +1,298 @@
|
|
|
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
|
+
export const stageLabel = {
|
|
7
|
+
title: 'Cluster tag',
|
|
8
|
+
textBelow: 'Assign a tag to make it easier for team members to clearly distinguish between different stages of the software development lifecycle. Tags can be changed later.',
|
|
9
|
+
boxes: {
|
|
10
|
+
dev: { text: 'dev', info: 'info text' },
|
|
11
|
+
test: {
|
|
12
|
+
text: 'test test long line of something explaining what this is all about. and more. long line of something ',
|
|
13
|
+
},
|
|
14
|
+
stage: { text: 'stage' },
|
|
15
|
+
prod: { text: 'prod' },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
// HELPER FUNCTIONS
|
|
19
|
+
export const generateClusterPlanTypeOptions = (options) => {
|
|
20
|
+
const additionalCount = options.additionalCount ?? 0;
|
|
21
|
+
const allDisabled = options.allDisabled ?? false;
|
|
22
|
+
const hasAdvancedOffering = options.advancedOffering ?? false;
|
|
23
|
+
const clusterPlanTypes = [
|
|
24
|
+
{
|
|
25
|
+
title: 'Development cluster',
|
|
26
|
+
type: 'dev',
|
|
27
|
+
uuid: 'dev',
|
|
28
|
+
description: 'A development cluster is used to test processes and decisions outside of your production envuronment.',
|
|
29
|
+
default: false,
|
|
30
|
+
disabled: allDisabled,
|
|
31
|
+
price: 500,
|
|
32
|
+
currency: 'USD',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'Production cluster',
|
|
36
|
+
type: 'prod',
|
|
37
|
+
uuid: 'prod',
|
|
38
|
+
description: 'A production-ready cluster that allows for increased scalability, fault tolerance, and hight availability.',
|
|
39
|
+
default: true,
|
|
40
|
+
disabled: allDisabled,
|
|
41
|
+
price: 1900,
|
|
42
|
+
currency: 'USD',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
for (let i = 0; i < additionalCount; i++) {
|
|
46
|
+
clusterPlanTypes.push({
|
|
47
|
+
title: `Cluster plan type ${i}`,
|
|
48
|
+
type: 'prod',
|
|
49
|
+
uuid: `cluster-plan-type-${i}`,
|
|
50
|
+
description: `Cluster plan type ${i} description`,
|
|
51
|
+
default: false,
|
|
52
|
+
disabled: allDisabled === true ? true : i % 3 === 0,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (hasAdvancedOffering) {
|
|
56
|
+
clusterPlanTypes.push({
|
|
57
|
+
title: `Standard (Advanced Offering)`,
|
|
58
|
+
type: 'prod',
|
|
59
|
+
uuid: `dead-beef`,
|
|
60
|
+
description: `designed for production-ready use-cases.`,
|
|
61
|
+
default: false,
|
|
62
|
+
disabled: false,
|
|
63
|
+
availabilityClass: 'Standard',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return clusterPlanTypes;
|
|
67
|
+
};
|
|
68
|
+
export const generateRegions = (additionalCount = 0) => {
|
|
69
|
+
const options = [
|
|
70
|
+
{
|
|
71
|
+
title: 'South Carolina, North America (us-east1)',
|
|
72
|
+
uuid: 'eu-west',
|
|
73
|
+
provider: 'GCP',
|
|
74
|
+
default: false,
|
|
75
|
+
backups: [
|
|
76
|
+
{
|
|
77
|
+
uuid: 'asd',
|
|
78
|
+
regions: [
|
|
79
|
+
{
|
|
80
|
+
id: 'REGION1',
|
|
81
|
+
label: 'SomeCity, SomeCountrey (some-location)',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
uuid: 'asd1',
|
|
87
|
+
regions: [
|
|
88
|
+
{
|
|
89
|
+
id: 'REGION1',
|
|
90
|
+
label: 'SomeCity, SomeCountrey (some-location)',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'REGION2',
|
|
94
|
+
label: 'OtherCity, OtherCountrey (other-location)',
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: 'Iowa, North America (us-central1)',
|
|
102
|
+
uuid: 'us-east',
|
|
103
|
+
provider: 'GCP',
|
|
104
|
+
default: false,
|
|
105
|
+
backups: [
|
|
106
|
+
{
|
|
107
|
+
uuid: 'asd',
|
|
108
|
+
regions: [
|
|
109
|
+
{ id: 'REGION1', label: 'SomeCity, SomeCountrey (some-location)' },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: 'Sydney, Australia (australia-southeast1)',
|
|
116
|
+
uuid: 'us-central',
|
|
117
|
+
provider: 'AWS',
|
|
118
|
+
default: false,
|
|
119
|
+
backups: [
|
|
120
|
+
{
|
|
121
|
+
uuid: 'asd',
|
|
122
|
+
regions: [
|
|
123
|
+
{ id: 'REGION1', label: 'SomeCity, SomeCountrey (some-location)' },
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
title: 'Toronto, North America (northamerica-northeast1)',
|
|
130
|
+
uuid: 'aus-southeast',
|
|
131
|
+
provider: 'AWS',
|
|
132
|
+
default: false,
|
|
133
|
+
backups: [
|
|
134
|
+
{
|
|
135
|
+
uuid: 'asd',
|
|
136
|
+
regions: [
|
|
137
|
+
{ id: 'REGION1', label: 'SomeCity, SomeCountrey (some-location)' },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
for (let i = 0; i < additionalCount; i++) {
|
|
144
|
+
options.push({
|
|
145
|
+
title: `Region with long names, and city ${i}`,
|
|
146
|
+
uuid: `region-${i}`,
|
|
147
|
+
provider: i % 2 === 0 ? 'GCP' : 'AWS',
|
|
148
|
+
default: false,
|
|
149
|
+
backups: [
|
|
150
|
+
{
|
|
151
|
+
uuid: 'asd',
|
|
152
|
+
regions: [
|
|
153
|
+
{ id: 'REGION1', label: 'SomeCity, SomeCountrey (some-location)' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return options;
|
|
160
|
+
};
|
|
161
|
+
export const generateChannels = (options) => {
|
|
162
|
+
const channels = [];
|
|
163
|
+
const generateGeneration = (title, defaultGeneration = false) => {
|
|
164
|
+
return {
|
|
165
|
+
title,
|
|
166
|
+
uuid: title.replace(' ', '-').replace(' ', '-').toLowerCase(),
|
|
167
|
+
default: defaultGeneration,
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const stable = {
|
|
171
|
+
title: 'Stable',
|
|
172
|
+
description: 'Stable: Placeholder text...',
|
|
173
|
+
uuid: 'stable',
|
|
174
|
+
generations: [
|
|
175
|
+
generateGeneration('Zeebe 8.1.6', true),
|
|
176
|
+
generateGeneration('Zeebe 8.1.5'),
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
const alpha = {
|
|
180
|
+
title: 'Alpha',
|
|
181
|
+
description: 'Alpha: Placeholder text...',
|
|
182
|
+
uuid: 'alpha',
|
|
183
|
+
generations: [
|
|
184
|
+
generateGeneration('Zeebe 9.1.6 Alpha', true),
|
|
185
|
+
generateGeneration('Zeebe 9.1.5 Alpha'),
|
|
186
|
+
],
|
|
187
|
+
};
|
|
188
|
+
channels.push(stable);
|
|
189
|
+
channels.push(alpha);
|
|
190
|
+
if (options?.additionalChannels) {
|
|
191
|
+
for (let i = 0; i < options.additionalChannels; i++) {
|
|
192
|
+
const additionalChannel = {
|
|
193
|
+
title: `Channel ${i}`,
|
|
194
|
+
description: `Channel ${i}: Placeholder text...`,
|
|
195
|
+
uuid: `channel-${i}`,
|
|
196
|
+
generations: [
|
|
197
|
+
generateGeneration('Zeebe 8.1.6', true),
|
|
198
|
+
generateGeneration('Zeebe 8.1.5'),
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
if (options?.additionalGenerations) {
|
|
202
|
+
for (let j = 0; j < options.additionalGenerations; j++) {
|
|
203
|
+
additionalChannel.generations.push(generateGeneration(`Zeebe ${i}.${j}`));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
channels.push(additionalChannel);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return channels;
|
|
210
|
+
};
|
|
211
|
+
// HELPER FUNCTIONS END
|
|
212
|
+
export const CTA = (success) => {
|
|
213
|
+
return {
|
|
214
|
+
label: 'Create cluster',
|
|
215
|
+
states: {
|
|
216
|
+
submitting: 'Creating cluster...',
|
|
217
|
+
success: 'Cluster created',
|
|
218
|
+
error: 'Error creating cluster. Please try again.',
|
|
219
|
+
},
|
|
220
|
+
create: async (params) => {
|
|
221
|
+
console.log('Create cluster', params);
|
|
222
|
+
await new Promise((resolve, _reject) => {
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
resolve('');
|
|
225
|
+
}, 2000);
|
|
226
|
+
});
|
|
227
|
+
console.log('create: done');
|
|
228
|
+
return success
|
|
229
|
+
? {
|
|
230
|
+
success: true,
|
|
231
|
+
clusterId: 'cluster-id-123',
|
|
232
|
+
}
|
|
233
|
+
: {
|
|
234
|
+
success: false,
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
postCreate: (clusterId) => {
|
|
238
|
+
console.log('postCreate: done', clusterId);
|
|
239
|
+
},
|
|
240
|
+
cancel: {
|
|
241
|
+
label: 'Cancel',
|
|
242
|
+
onClick: () => {
|
|
243
|
+
console.log('cancel: done');
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
help: {
|
|
247
|
+
prefix: 'Need help?',
|
|
248
|
+
label: 'Talk to an expert',
|
|
249
|
+
href: 'https://camunda.com',
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export const CLUSTER_NAME = {
|
|
254
|
+
title: 'Cluster name',
|
|
255
|
+
placeholder: 'Enter a name for the cluster',
|
|
256
|
+
validation: (value) => {
|
|
257
|
+
const response = {
|
|
258
|
+
isValid: true,
|
|
259
|
+
message: '',
|
|
260
|
+
};
|
|
261
|
+
if (value.length < 2) {
|
|
262
|
+
response.isValid = false;
|
|
263
|
+
response.message = 'Cluster name must be at least 2 characters long';
|
|
264
|
+
}
|
|
265
|
+
return response;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
export const basicCreateClusterProps = {
|
|
269
|
+
loading: false,
|
|
270
|
+
banner: {
|
|
271
|
+
noSlotsLeft: {
|
|
272
|
+
title: 'No slots available',
|
|
273
|
+
description: 'Please try again later or contact our support team for assistance.',
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
cta: CTA(true),
|
|
277
|
+
formElements: {
|
|
278
|
+
name: CLUSTER_NAME,
|
|
279
|
+
clusterPlanType: {
|
|
280
|
+
title: 'Select a cluster type',
|
|
281
|
+
options: generateClusterPlanTypeOptions({}),
|
|
282
|
+
},
|
|
283
|
+
region: {
|
|
284
|
+
title: 'Select region',
|
|
285
|
+
description: 'Pre-selection is based on the best current load and performance.',
|
|
286
|
+
backupRegionTitle: 'Backup location',
|
|
287
|
+
backupDescription: 'Choose single region to keep your data in one place, or select dual region for higher redundancy across geographically dispersed locations, ensuring better protection against local disruptions.',
|
|
288
|
+
dualRegionBackups: true,
|
|
289
|
+
options: generateRegions(),
|
|
290
|
+
validationMessage: 'Please select a region for your cluster',
|
|
291
|
+
},
|
|
292
|
+
generation: {
|
|
293
|
+
title: 'Channel',
|
|
294
|
+
channels: generateChannels(),
|
|
295
|
+
},
|
|
296
|
+
stageLabel,
|
|
297
|
+
},
|
|
298
|
+
};
|
package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
*/
|
|
7
7
|
import { Form } from '@carbon/react';
|
|
8
8
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
9
|
-
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
|
+
import { Checkbox, Link, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
10
10
|
import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
|
|
11
11
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
12
12
|
function safeTranslate(t, key, defaultValue, options) {
|
|
@@ -26,22 +26,25 @@ function isClientNameValid(name) {
|
|
|
26
26
|
}
|
|
27
27
|
return /^[A-Za-z0-9_-]+$/.test(name);
|
|
28
28
|
}
|
|
29
|
-
export const C4CreateClusterApiClientModal = forwardRef(({ t, onCreateClusterApiClient }, ref) => {
|
|
29
|
+
export const C4CreateClusterApiClientModal = forwardRef(({ t, onCreateClusterApiClient, hasIdentityIntegration, scopesDocsUrl }, ref) => {
|
|
30
30
|
const [isOpen, setIsOpen] = useState(false);
|
|
31
31
|
const [orgId, setOrgId] = useState('');
|
|
32
32
|
const [clusterId, setClusterId] = useState('');
|
|
33
33
|
const [clusterName, setClusterName] = useState(undefined);
|
|
34
34
|
const [name, setName] = useState('');
|
|
35
35
|
const [nameTouched, setNameTouched] = useState(false);
|
|
36
|
-
const [scopes, setScopes] = useState(['Zeebe']);
|
|
36
|
+
const [scopes, setScopes] = useState(hasIdentityIntegration ? [] : ['Zeebe']);
|
|
37
37
|
const [saving, setSaving] = useState(false);
|
|
38
38
|
const [error, setError] = useState(undefined);
|
|
39
39
|
const [responseOpen, setResponseOpen] = useState(false);
|
|
40
40
|
const [response, setResponse] = useState(undefined);
|
|
41
41
|
const modalHeading = useMemo(() => {
|
|
42
42
|
const base = safeTranslate(t, 'clusterclients:create.heading.input', 'Create new client credentials');
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// Identity-integration clusters show no cluster name in the heading.
|
|
44
|
+
return clusterName && !hasIdentityIntegration
|
|
45
|
+
? `${base}: ${clusterName}`
|
|
46
|
+
: base;
|
|
47
|
+
}, [clusterName, hasIdentityIntegration, t]);
|
|
45
48
|
const close = useCallback(() => {
|
|
46
49
|
setSaving(false);
|
|
47
50
|
setError(undefined);
|
|
@@ -53,12 +56,12 @@ export const C4CreateClusterApiClientModal = forwardRef(({ t, onCreateClusterApi
|
|
|
53
56
|
setClusterName(params.clusterName);
|
|
54
57
|
setName('');
|
|
55
58
|
setNameTouched(false);
|
|
56
|
-
setScopes(['Zeebe']);
|
|
59
|
+
setScopes(hasIdentityIntegration ? [] : ['Zeebe']);
|
|
57
60
|
setSaving(false);
|
|
58
61
|
setError(undefined);
|
|
59
62
|
setResponse(undefined);
|
|
60
63
|
setIsOpen(true);
|
|
61
|
-
}, []);
|
|
64
|
+
}, [hasIdentityIntegration]);
|
|
62
65
|
useImperativeHandle(ref, () => ({
|
|
63
66
|
open,
|
|
64
67
|
close,
|
|
@@ -102,31 +105,46 @@ export const C4CreateClusterApiClientModal = forwardRef(({ t, onCreateClusterApi
|
|
|
102
105
|
}
|
|
103
106
|
})();
|
|
104
107
|
}, [clusterId, name, onCreateClusterApiClient, orgId, scopes, t]);
|
|
105
|
-
const scopeOptions = useMemo(() =>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
108
|
+
const scopeOptions = useMemo(() => hasIdentityIntegration
|
|
109
|
+
? [
|
|
110
|
+
{
|
|
111
|
+
value: 'Orchestration',
|
|
112
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.orchestration8_8', 'Orchestration Cluster API'),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: 'Optimize',
|
|
116
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.optimize8_8', 'Optimize API'),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
value: 'Secrets',
|
|
120
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.secrets8_8', 'Administration API - Resource: Secrets'),
|
|
121
|
+
},
|
|
122
|
+
]
|
|
123
|
+
: [
|
|
124
|
+
{
|
|
125
|
+
value: 'Zeebe',
|
|
126
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.zeebe', 'Zeebe'),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: 'Tasklist',
|
|
130
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.tasklist', 'Tasklist'),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: 'Operate',
|
|
134
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.operate', 'Operate'),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
value: 'Optimize',
|
|
138
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.optimize', 'Optimize'),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
value: 'Secrets',
|
|
142
|
+
label: safeTranslate(t, 'clusterclients:create.fields.scopes.secrets', 'Secrets'),
|
|
143
|
+
},
|
|
144
|
+
], [hasIdentityIntegration, t]);
|
|
127
145
|
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving || scopes.length === 0, onRequestClose: close, onRequestSubmit: onSubmit, size: 'md', id: 'c4-create-cluster-api-client-modal', children: _jsx(Form, { noValidate: true, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: error, hideCloseButton: true, lowContrast: true })), _jsx(TextInput, { id: 'c4-cluster-api-client-name', name: 'name', "data-modal-primary-focus": true, labelText: safeTranslate(t, 'clusterclients:create.fields.name.label', 'Client Name'), maxLength: 50, value: name, placeholder: safeTranslate(t, 'clusterclients:create.fields.name.label', 'Client Name'), helperText: safeTranslate(t, 'clusterclients:create.fields.name.helperText', 'can contain letters, dashes, underscores, and digits'), invalid: Boolean(nameInvalid), invalidText: nameInvalid
|
|
128
146
|
? safeTranslate(t, 'clusterclients:create.error.doublette', 'Name is invalid')
|
|
129
|
-
: '', onChange: (event) => setName(event.target.value), onBlur: () => setNameTouched(true), disabled: saving }), _jsxs(Stack, { gap: 2, children: [_jsx("h3", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.label', 'Scopes') }), _jsx("p", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.helperText', 'Scopes define the access for client credentials.') })] }), _jsx("div", { children: scopeOptions.map((scope) => (_jsx(Checkbox, { labelText: scope.label, id: `c4-cluster-scope-${scope.value}`, value: scope.value, checked: scopes.includes(scope.value), onChange: () => {
|
|
147
|
+
: '', onChange: (event) => setName(event.target.value), onBlur: () => setNameTouched(true), disabled: saving }), _jsxs(Stack, { gap: 2, children: [_jsx("h3", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.label', 'Scopes') }), _jsx("p", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.helperText', 'Scopes define the access for client credentials.') }), hasIdentityIntegration && (_jsxs(_Fragment, { children: [_jsx("p", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.helperText8_8', 'Granular authorizations for the Orchestration Cluster API can be managed via Orchestration Cluster Identity.') }), _jsxs("p", { children: ["Read more about", ' ', _jsx(Link, { href: scopesDocsUrl ?? '#', children: "Scopes for Client Credentials" }), "."] })] }))] }), _jsx("div", { children: scopeOptions.map((scope) => (_jsx(Checkbox, { labelText: scope.label, id: `c4-cluster-scope-${scope.value}`, value: scope.value, checked: scopes.includes(scope.value), onChange: () => {
|
|
130
148
|
setScopes((current) => {
|
|
131
149
|
if (current.includes(scope.value)) {
|
|
132
150
|
return current.filter((s) => s !== scope.value);
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export const basicCreateClusterApiClientModalProps = {
|
|
7
|
+
onCreateClusterApiClient: async ({ orgId, clusterId, name, scopes }) => {
|
|
8
|
+
console.log('Create cluster API client requested', {
|
|
9
|
+
orgId,
|
|
10
|
+
clusterId,
|
|
11
|
+
name,
|
|
12
|
+
scopes,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
clientId: 'client-id',
|
|
16
|
+
clientSecret: 'client-secret',
|
|
17
|
+
connectionInfo: {
|
|
18
|
+
zeebeAddress: 'my-cluster.zeebe.camunda.io:443',
|
|
19
|
+
oauthTokenUrl: 'https://login.example.com/oauth/token',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -9,6 +9,8 @@ export interface C4CreateClusterApiClientModalHandle {
|
|
|
9
9
|
}
|
|
10
10
|
export interface C4CreateClusterApiClientModalProps {
|
|
11
11
|
t?: (key: string, options?: Record<string, unknown>) => string;
|
|
12
|
+
hasIdentityIntegration?: boolean;
|
|
13
|
+
scopesDocsUrl?: string;
|
|
12
14
|
onCreateClusterApiClient: (params: {
|
|
13
15
|
orgId: string;
|
|
14
16
|
clusterId: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export const basicCreateConnectorSecretModalProps = {
|
|
7
|
+
onCreateSecret: async ({ orgId, clusterId, secretName, secretValue }) => {
|
|
8
|
+
console.log('Create secret requested', {
|
|
9
|
+
orgId,
|
|
10
|
+
clusterId,
|
|
11
|
+
secretName,
|
|
12
|
+
secretValue,
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
};
|
package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js
CHANGED
|
@@ -6,7 +6,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
*/
|
|
7
7
|
import { Form, FormGroup } from '@carbon/react';
|
|
8
8
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
9
|
-
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
|
+
import { Checkbox, Link, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
10
10
|
import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
|
|
11
11
|
function isApiClientNameValid(name) {
|
|
12
12
|
if (!name.trim()) {
|
|
@@ -229,7 +229,7 @@ function getAvailableScopes(t) {
|
|
|
229
229
|
},
|
|
230
230
|
];
|
|
231
231
|
}
|
|
232
|
-
export const C4CreateConsoleApiClientModal = forwardRef(({ t, apiBaseUrl, loginBaseUrl, onCreateApiClient }, ref) => {
|
|
232
|
+
export const C4CreateConsoleApiClientModal = forwardRef(({ t, apiBaseUrl, loginBaseUrl, onCreateApiClient, scopesDocsHref }, ref) => {
|
|
233
233
|
const [isOpen, setIsOpen] = useState(false);
|
|
234
234
|
const [orgId, setOrgId] = useState('');
|
|
235
235
|
const [name, setName] = useState('');
|
|
@@ -300,12 +300,12 @@ export const C4CreateConsoleApiClientModal = forwardRef(({ t, apiBaseUrl, loginB
|
|
|
300
300
|
const curl = response
|
|
301
301
|
? `#!/bin/sh\ncurl --header "Content-Type: application/json" --request POST --data '{"grant_type":"client_credentials", "audience":"${audience}", "client_id":"${response.clientId}", "client_secret":"${response.clientSecret}"}' ${oauthTokenUrl}`
|
|
302
302
|
: '';
|
|
303
|
-
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'apiclients:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'apiclients:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving, onRequestClose: close, onRequestSubmit: onSubmit, size: 'sm', id: 'c4-create-console-api-client-modal', children: _jsx(Stack, { gap: 6, children: _jsx(Form, { noValidate: true, children: _jsxs(Stack, { gap: 6, children: [_jsx(TextInput, { id: 'c4-console-api-client-name', labelText: safeTranslate(t, 'apiclients:create.fields.name.label', 'Name'), maxLength: 50, value: name, helperText: safeTranslate(t, 'apiclients:create.fields.name.helperText', ''), onChange: (e) => setName(e.currentTarget.value), invalid: Boolean(error), invalidText: error, disabled: saving }), _jsxs(Stack, { gap: 2, children: [_jsx("h3", { children: safeTranslate(t, 'apiclients:create.fields.scopes.label', 'Scopes') }), _jsx("p", { children: renderInlineLink0(safeTranslate(t, 'apiclients:create.fields.scopes.helperText', 'Select scopes for this client.'), (label) => (_jsx("span", { children: label }))) })] }), _jsx(Stack, { gap: 4, children: scopes.map((group, groupIndex) => {
|
|
303
|
+
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'apiclients:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'apiclients:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving, onRequestClose: close, onRequestSubmit: onSubmit, size: 'sm', id: 'c4-create-console-api-client-modal', children: _jsx(Stack, { gap: 6, children: _jsx(Form, { noValidate: true, children: _jsxs(Stack, { gap: 6, children: [_jsx(TextInput, { id: 'c4-console-api-client-name', labelText: safeTranslate(t, 'apiclients:create.fields.name.label', 'Name'), maxLength: 50, value: name, helperText: safeTranslate(t, 'apiclients:create.fields.name.helperText', ''), onChange: (e) => setName(e.currentTarget.value), invalid: Boolean(error), invalidText: error, disabled: saving }), _jsxs(Stack, { gap: 2, children: [_jsx("h3", { children: safeTranslate(t, 'apiclients:create.fields.scopes.label', 'Scopes') }), _jsx("p", { children: renderInlineLink0(safeTranslate(t, 'apiclients:create.fields.scopes.helperText', 'Select scopes for this client.'), (label) => scopesDocsHref ? (_jsx(Link, { size: 'sm', href: scopesDocsHref, children: label })) : (_jsx("span", { children: label }))) })] }), _jsx(Stack, { gap: 4, children: scopes.map((group, groupIndex) => {
|
|
304
304
|
const groupValues = group.scopes.map((s) => s.value);
|
|
305
305
|
const selectedCount = groupValues.filter((v) => permissions.includes(v)).length;
|
|
306
306
|
const allSelected = selectedCount === groupValues.length;
|
|
307
307
|
const indeterminate = selectedCount > 0 && !allSelected;
|
|
308
|
-
return (_jsx(FormGroup, { legendText: '', children: _jsxs(Stack, { gap:
|
|
308
|
+
return (_jsx(FormGroup, { legendText: '', children: _jsxs(Stack, { gap: 2, children: [_jsx(Checkbox, { id: `c4-console-api-scope-group-${groupIndex}`, labelText: group.label, checked: allSelected, indeterminate: indeterminate, onChange: () => {
|
|
309
309
|
setPermissions((current) => {
|
|
310
310
|
const currentSet = new Set(current);
|
|
311
311
|
const isAllSelected = groupValues.every((v) => currentSet.has(v));
|
|
@@ -317,7 +317,7 @@ export const C4CreateConsoleApiClientModal = forwardRef(({ t, apiBaseUrl, loginB
|
|
|
317
317
|
}
|
|
318
318
|
return Array.from(currentSet);
|
|
319
319
|
});
|
|
320
|
-
}, disabled: saving }), _jsx("div", { style: { marginLeft: 'var(--cds-spacing-06)' }, children: _jsx(Stack, { gap:
|
|
320
|
+
}, disabled: saving }), _jsx("div", { style: { marginLeft: 'var(--cds-spacing-06)' }, children: _jsx(Stack, { gap: 0, style: { rowGap: '0px' }, children: group.scopes.map((scope) => {
|
|
321
321
|
const checked = permissions.includes(scope.value);
|
|
322
322
|
return (_jsx(Checkbox, { id: `c4-console-api-scope-${scope.value}`, labelText: scope.label, checked: checked, onChange: () => {
|
|
323
323
|
setPermissions((current) => checked
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
export const basicCreateConsoleApiClientModalProps = {
|
|
7
|
+
apiBaseUrl: 'https://api.example.com',
|
|
8
|
+
loginBaseUrl: 'https://login.example.com',
|
|
9
|
+
onCreateApiClient: async ({ orgId, name, permissions }) => {
|
|
10
|
+
console.log('Create API client requested', { orgId, name, permissions });
|
|
11
|
+
return { clientId: 'client-id', clientSecret: 'client-secret' };
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -9,6 +9,7 @@ export interface C4CreateConsoleApiClientModalProps {
|
|
|
9
9
|
t?: (key: string, options?: Record<string, unknown>) => string;
|
|
10
10
|
apiBaseUrl?: string;
|
|
11
11
|
loginBaseUrl?: string;
|
|
12
|
+
scopesDocsHref?: string;
|
|
12
13
|
onCreateApiClient: (params: {
|
|
13
14
|
orgId: string;
|
|
14
15
|
name: string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { C4CreateIpWhitelistModalHandle, C4CreateIpWhitelistModalProps } from './c4-create-ip-whitelist-modal.types';
|
|
2
|
+
export declare const C4CreateIpWhitelistModal: import("react").ForwardRefExoticComponent<C4CreateIpWhitelistModalProps & import("react").RefAttributes<C4CreateIpWhitelistModalHandle>>;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { Form } from '@carbon/react';
|
|
8
|
+
import { forwardRef, useCallback, useImperativeHandle, useState, } from 'react';
|
|
9
|
+
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
10
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
11
|
+
// Helper function to ensure translations work
|
|
12
|
+
function safeTranslate(t, key, fallback) {
|
|
13
|
+
if (!t)
|
|
14
|
+
return fallback;
|
|
15
|
+
const result = t(key);
|
|
16
|
+
if (!result || result === key) {
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
19
|
+
// i18next can return the key *without* the namespace when the namespace is missing.
|
|
20
|
+
// Example: `ipwhitelist:data.title` -> `data.title`
|
|
21
|
+
if (key.includes(':')) {
|
|
22
|
+
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
23
|
+
if (result === withoutNamespace) {
|
|
24
|
+
return fallback;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
export const C4CreateIpWhitelistModal = forwardRef(({ t, onCreateIpWhitelist, onCancel, onSubmitStart, onSubmitError }, ref) => {
|
|
30
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const [busy, setBusy] = useState(false);
|
|
32
|
+
const [error, setError] = useState('');
|
|
33
|
+
const [ipValue, setIpValue] = useState('');
|
|
34
|
+
const [ipDescription, setIpDescription] = useState('');
|
|
35
|
+
const close = useCallback(() => {
|
|
36
|
+
setBusy(false);
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
}, []);
|
|
39
|
+
const open = useCallback(() => {
|
|
40
|
+
setIpValue('');
|
|
41
|
+
setIpDescription('');
|
|
42
|
+
setError('');
|
|
43
|
+
setBusy(false);
|
|
44
|
+
setIsOpen(true);
|
|
45
|
+
}, []);
|
|
46
|
+
useImperativeHandle(ref, () => ({
|
|
47
|
+
open,
|
|
48
|
+
close,
|
|
49
|
+
}), [open, close]);
|
|
50
|
+
return (_jsx(Modal, { open: isOpen, modalHeading: safeTranslate(t, 'ipwhitelist:create.heading', 'Add new IP(s)'), primaryButtonText: safeTranslate(t, 'ipwhitelist:create.buttons.primary', 'Add'), secondaryButtonText: safeTranslate(t, 'ipwhitelist:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: busy || ipValue.length === 0, onRequestClose: () => {
|
|
51
|
+
onCancel?.();
|
|
52
|
+
close();
|
|
53
|
+
}, onRequestSubmit: () => {
|
|
54
|
+
void (async () => {
|
|
55
|
+
onSubmitStart?.();
|
|
56
|
+
setBusy(true);
|
|
57
|
+
setError('');
|
|
58
|
+
try {
|
|
59
|
+
await onCreateIpWhitelist({
|
|
60
|
+
ip: ipValue,
|
|
61
|
+
description: ipDescription,
|
|
62
|
+
});
|
|
63
|
+
close();
|
|
64
|
+
}
|
|
65
|
+
catch (submitError) {
|
|
66
|
+
setError(submitError instanceof Error ? submitError.message : 'Failed');
|
|
67
|
+
onSubmitError?.(submitError);
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
setBusy(false);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
}, children: _jsx(Form, { onSubmit: (e) => {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
}, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'ipwhitelist:create.error.generic', "We're having trouble adding the IP(s)"), subtitle: error, lowContrast: true, hideCloseButton: true })), _jsx(TextInput, { id: 'ip-input-whitelist-create', labelText: safeTranslate(t, 'ipwhitelist:create.fields.ips', 'IP(s)'), helperText: safeTranslate(t, 'ipwhitelist:create.fields.ipsHelper', 'Comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1'), value: ipValue, maxLength: 50, onChange: (event) => setIpValue(event.target.value) }), _jsx(TextInput, { id: 'name-input-whitelist-create', labelText: safeTranslate(t, 'ipwhitelist:create.fields.description', 'Description (optional)'), value: ipDescription, maxLength: 1024, onChange: (event) => setIpDescription(event.target.value) })] }) }) }));
|
|
76
|
+
});
|
|
77
|
+
C4CreateIpWhitelistModal.displayName = 'C4CreateIpWhitelistModal';
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export const basicCreateIpWhitelistModalProps = {
|
|
7
|
+
t: (key) => key,
|
|
8
|
+
onCreateIpWhitelist: async ({ ip, description }) => {
|
|
9
|
+
console.log('Create IP whitelist requested', { ip, description });
|
|
10
|
+
},
|
|
11
|
+
};
|