@camunda/ccma-saas-frontend 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.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 +16 -1
- package/lib/esm/index.js +10 -1
- 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-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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
|
-
import { AuditLoggerService, ConsoleClusterService, EarlyAccessFeaturesService, GenerationService, HdpService, HttpError, OrganizationMembersService, OrgsService, } from '@camunda/ccma-api';
|
|
6
|
+
import { AuditLoggerService, ConsoleClusterService, EarlyAccessFeaturesService, ExternalAccountsService, ExternalConsoleService, GenerationService, HdpService, HttpError, OrganizationMembersService, OrgsService, } from '@camunda/ccma-api';
|
|
7
7
|
import { SseEntity, SseType, } from '@camunda/ccma-shared-types';
|
|
8
8
|
import { flow, types } from 'mobx-state-tree';
|
|
9
9
|
import { toApiConfig } from './to-api-config.js';
|
|
@@ -54,6 +54,16 @@ function mergePreservingNestedData(previous, next) {
|
|
|
54
54
|
}
|
|
55
55
|
const merged = { ...previous };
|
|
56
56
|
for (const [key, nextValue] of Object.entries(next)) {
|
|
57
|
+
// externalMetadata is a single JSON column with no per-field permission
|
|
58
|
+
// gating (unlike e.g. generation/plan, which can be legitimately absent
|
|
59
|
+
// from a lean SSE payload) — whenever it's present in a snapshot it's the
|
|
60
|
+
// complete, authoritative value. Deep-merging it would resurrect stale
|
|
61
|
+
// sub-fields (e.g. optimizeFiltering) whose cleared value got dropped by
|
|
62
|
+
// JSON.stringify, so take it wholesale instead.
|
|
63
|
+
if (key === 'externalMetadata') {
|
|
64
|
+
merged[key] = nextValue;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
57
67
|
const previousValue = previous[key];
|
|
58
68
|
if (nextValue === undefined) {
|
|
59
69
|
merged[key] = previousValue;
|
|
@@ -94,6 +104,13 @@ export const ConsoleDataStore = types
|
|
|
94
104
|
// Caches keyed by arbitrary string keys (e.g., generationUuid)
|
|
95
105
|
upgradableGenerations: types.map(CacheStateModel),
|
|
96
106
|
generationDetails: types.map(CacheStateModel),
|
|
107
|
+
// Navigation caches (external API shapes).
|
|
108
|
+
// `myOrgs` is keyed by the caller's token, i.e. a single entry per store.
|
|
109
|
+
myOrgs: types.maybeNull(CacheStateModel),
|
|
110
|
+
// `webappClusters` holds the external cluster shape (per-app endpoints +
|
|
111
|
+
// health) used by navigation, keyed by orgId. Distinct from `clusters`,
|
|
112
|
+
// which holds the internal ConsoleClusterDto used by console's own widgets.
|
|
113
|
+
webappClusters: types.map(CacheStateModel),
|
|
97
114
|
/**
|
|
98
115
|
* SSE refresh signals.
|
|
99
116
|
*
|
|
@@ -112,6 +129,8 @@ export const ConsoleDataStore = types
|
|
|
112
129
|
inFlightClusterCapacity: new Set(),
|
|
113
130
|
inFlightUpgradableGenerations: new Set(),
|
|
114
131
|
inFlightGenerationDetails: new Set(),
|
|
132
|
+
inFlightMyOrgs: false,
|
|
133
|
+
inFlightWebappClusters: new Set(),
|
|
115
134
|
clustersLastRefreshMs: new Map(),
|
|
116
135
|
clusterCapacityLastRefreshMs: new Map(),
|
|
117
136
|
}))
|
|
@@ -153,6 +172,13 @@ export const ConsoleDataStore = types
|
|
|
153
172
|
const cached = self.generationDetails.get(generationUuid);
|
|
154
173
|
return cached?.data;
|
|
155
174
|
},
|
|
175
|
+
getMyOrgs() {
|
|
176
|
+
return self.myOrgs?.data;
|
|
177
|
+
},
|
|
178
|
+
getWebappClusters(orgId) {
|
|
179
|
+
const cached = self.webappClusters.get(orgId);
|
|
180
|
+
return cached?.data;
|
|
181
|
+
},
|
|
156
182
|
getSseEntityVersion(orgId, entity, clusterId) {
|
|
157
183
|
const key = `${orgId}:${entity}:${clusterId ?? ''}`;
|
|
158
184
|
return self.sseVersions.get(key) ?? 0;
|
|
@@ -221,6 +247,12 @@ export const ConsoleDataStore = types
|
|
|
221
247
|
invalidateAudits(orgId) {
|
|
222
248
|
self.audits.delete(orgId);
|
|
223
249
|
},
|
|
250
|
+
invalidateMyOrgs() {
|
|
251
|
+
self.myOrgs = null;
|
|
252
|
+
},
|
|
253
|
+
invalidateWebappClusters(orgId) {
|
|
254
|
+
self.webappClusters.delete(orgId);
|
|
255
|
+
},
|
|
224
256
|
invalidateAll(orgId) {
|
|
225
257
|
self.clusters.delete(orgId);
|
|
226
258
|
self.orgInfo.delete(orgId);
|
|
@@ -229,6 +261,7 @@ export const ConsoleDataStore = types
|
|
|
229
261
|
self.members.delete(orgId);
|
|
230
262
|
self.audits.delete(orgId);
|
|
231
263
|
self.clusterCapacity.delete(orgId);
|
|
264
|
+
self.webappClusters.delete(orgId);
|
|
232
265
|
},
|
|
233
266
|
bumpSseEntityVersion(orgId, entity, clusterId) {
|
|
234
267
|
const key = `${orgId}:${entity}:${clusterId ?? ''}`;
|
|
@@ -237,6 +270,93 @@ export const ConsoleDataStore = types
|
|
|
237
270
|
},
|
|
238
271
|
}))
|
|
239
272
|
.actions((self) => ({
|
|
273
|
+
fetchMyOrgs: flow(function* (options) {
|
|
274
|
+
if (!self.runtime) {
|
|
275
|
+
throw new Error('Runtime config not set');
|
|
276
|
+
}
|
|
277
|
+
const cached = self.myOrgs;
|
|
278
|
+
if (!options?.force && cached && (cached.isLoading || cached.data)) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (self.inFlightMyOrgs) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
self.inFlightMyOrgs = true;
|
|
285
|
+
self.myOrgs = {
|
|
286
|
+
data: cached?.data,
|
|
287
|
+
isLoading: true,
|
|
288
|
+
error: null,
|
|
289
|
+
lastFetched: cached?.lastFetched ?? null,
|
|
290
|
+
};
|
|
291
|
+
try {
|
|
292
|
+
const apiConfig = toApiConfig(self.runtime);
|
|
293
|
+
const orgs = yield ExternalAccountsService.getMyOrganizations({
|
|
294
|
+
config: apiConfig,
|
|
295
|
+
});
|
|
296
|
+
// Alphabetical by name, matching the c3 profile provider ordering.
|
|
297
|
+
const sorted = [...orgs].sort((a, b) => a.name.localeCompare(b.name));
|
|
298
|
+
self.myOrgs = {
|
|
299
|
+
data: sorted,
|
|
300
|
+
isLoading: false,
|
|
301
|
+
error: null,
|
|
302
|
+
lastFetched: new Date(),
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
self.myOrgs = {
|
|
307
|
+
data: cached?.data,
|
|
308
|
+
isLoading: false,
|
|
309
|
+
error: error,
|
|
310
|
+
lastFetched: cached?.lastFetched ?? null,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
finally {
|
|
314
|
+
self.inFlightMyOrgs = false;
|
|
315
|
+
}
|
|
316
|
+
}),
|
|
317
|
+
fetchWebappClusters: flow(function* (orgId, options) {
|
|
318
|
+
if (!self.runtime) {
|
|
319
|
+
throw new Error('Runtime config not set');
|
|
320
|
+
}
|
|
321
|
+
const cached = self.webappClusters.get(orgId);
|
|
322
|
+
if (!options?.force && cached && (cached.isLoading || cached.data)) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (self.inFlightWebappClusters.has(orgId)) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
self.inFlightWebappClusters.add(orgId);
|
|
329
|
+
self.webappClusters.set(orgId, {
|
|
330
|
+
data: cached?.data,
|
|
331
|
+
isLoading: true,
|
|
332
|
+
error: null,
|
|
333
|
+
lastFetched: cached?.lastFetched ?? null,
|
|
334
|
+
});
|
|
335
|
+
try {
|
|
336
|
+
const apiConfig = toApiConfig(self.runtime);
|
|
337
|
+
const clusters = yield ExternalConsoleService.getOrgClusters({
|
|
338
|
+
params: { orgId },
|
|
339
|
+
config: apiConfig,
|
|
340
|
+
});
|
|
341
|
+
self.webappClusters.set(orgId, {
|
|
342
|
+
data: Array.isArray(clusters) ? clusters : [],
|
|
343
|
+
isLoading: false,
|
|
344
|
+
error: null,
|
|
345
|
+
lastFetched: new Date(),
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
self.webappClusters.set(orgId, {
|
|
350
|
+
data: cached?.data,
|
|
351
|
+
isLoading: false,
|
|
352
|
+
error: error,
|
|
353
|
+
lastFetched: cached?.lastFetched ?? null,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
self.inFlightWebappClusters.delete(orgId);
|
|
358
|
+
}
|
|
359
|
+
}),
|
|
240
360
|
fetchOrgInfo: flow(function* (orgId, options) {
|
|
241
361
|
if (!self.runtime) {
|
|
242
362
|
throw new Error('Runtime config not set');
|
|
@@ -464,27 +584,11 @@ export const ConsoleDataStore = types
|
|
|
464
584
|
});
|
|
465
585
|
try {
|
|
466
586
|
const apiConfig = toApiConfig(self.runtime);
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
...(clusterId ? { clusterId } : {}),
|
|
473
|
-
config: apiConfig,
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
const gens = yield GenerationService.getUpgradable({
|
|
478
|
-
fromGenerationUuid,
|
|
479
|
-
...(clusterId ? { clusterId } : {}),
|
|
480
|
-
config: apiConfig,
|
|
481
|
-
});
|
|
482
|
-
// Normalize to UpgradableGenerationsDto — preferred is the only item (existing behavior)
|
|
483
|
-
dto = {
|
|
484
|
-
preferred: Array.isArray(gens) && gens.length > 0 ? gens[0] : null,
|
|
485
|
-
options: Array.isArray(gens) ? gens : [],
|
|
486
|
-
};
|
|
487
|
-
}
|
|
587
|
+
const dto = yield GenerationService.getUpgradableMulti({
|
|
588
|
+
fromGenerationUuid,
|
|
589
|
+
...(clusterId ? { clusterId } : {}),
|
|
590
|
+
config: apiConfig,
|
|
591
|
+
});
|
|
488
592
|
self.upgradableGenerations.set(cacheKey, {
|
|
489
593
|
data: dto,
|
|
490
594
|
isLoading: false,
|
|
@@ -738,19 +842,27 @@ export const ConsoleDataStore = types
|
|
|
738
842
|
const payloadCluster = extractClusterPayload(detail.payload);
|
|
739
843
|
const payloadUuid = getString(payloadCluster?.uuid) ?? getString(payloadCluster?.id);
|
|
740
844
|
const targetId = clusterId ?? payloadUuid;
|
|
741
|
-
// Patch cache only if it is already
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
845
|
+
// Patch a cluster-list cache in place, but only if it is already
|
|
846
|
+
// populated (avoids traffic for caches nothing reads yet). Applied to
|
|
847
|
+
// both the internal `clusters` cache (console widgets) and the
|
|
848
|
+
// `webappClusters` cache (navigation). Merges conservatively so
|
|
849
|
+
// fields absent from the SSE payload are preserved — the internal and
|
|
850
|
+
// external shapes overlap on uuid/status/endpoints/generation.
|
|
851
|
+
const patchClusterListCache = (cache) => {
|
|
852
|
+
const cached = cache.get(orgId);
|
|
853
|
+
const cachedList = Array.isArray(cached?.data)
|
|
854
|
+
? cached?.data
|
|
855
|
+
: undefined;
|
|
856
|
+
if (!cached || !cachedList || !targetId) {
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
747
859
|
if (sseType === SseType.DELETED) {
|
|
748
860
|
const next = cachedList.filter((item) => {
|
|
749
861
|
const rec = getRecord(item);
|
|
750
862
|
const uuid = getString(rec?.uuid) ?? getString(rec?.id);
|
|
751
863
|
return uuid !== targetId;
|
|
752
864
|
});
|
|
753
|
-
|
|
865
|
+
cache.set(orgId, {
|
|
754
866
|
data: next,
|
|
755
867
|
isLoading: false,
|
|
756
868
|
error: cached.error ?? null,
|
|
@@ -770,14 +882,16 @@ export const ConsoleDataStore = types
|
|
|
770
882
|
else {
|
|
771
883
|
next.push(payloadCluster);
|
|
772
884
|
}
|
|
773
|
-
|
|
885
|
+
cache.set(orgId, {
|
|
774
886
|
data: next,
|
|
775
887
|
isLoading: false,
|
|
776
888
|
error: cached.error ?? null,
|
|
777
889
|
lastFetched: new Date(),
|
|
778
890
|
});
|
|
779
891
|
}
|
|
780
|
-
}
|
|
892
|
+
};
|
|
893
|
+
patchClusterListCache(self.clusters);
|
|
894
|
+
patchClusterListCache(self.webappClusters);
|
|
781
895
|
// Always bump the CLUSTER version so widgets can re-read cached data.
|
|
782
896
|
self.bumpSseEntityVersion(orgId, SseEntity.CLUSTER, clusterId);
|
|
783
897
|
break;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { SseEntity, SseType } from '@camunda/ccma-shared-types';
|
|
7
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
8
|
+
import { ConsoleDataStore } from './c4-console-data-store.js';
|
|
9
|
+
vi.mock('@camunda/ccma-api', () => ({
|
|
10
|
+
ExternalAccountsService: {
|
|
11
|
+
getMyOrganizations: vi.fn(),
|
|
12
|
+
},
|
|
13
|
+
ExternalConsoleService: {
|
|
14
|
+
getOrgClusters: vi.fn(),
|
|
15
|
+
},
|
|
16
|
+
// Unused by these tests but imported by the store module.
|
|
17
|
+
AuditLoggerService: {},
|
|
18
|
+
ConsoleClusterService: {},
|
|
19
|
+
EarlyAccessFeaturesService: {},
|
|
20
|
+
GenerationService: {},
|
|
21
|
+
HdpService: {},
|
|
22
|
+
HttpError: class {
|
|
23
|
+
},
|
|
24
|
+
OrganizationMembersService: {},
|
|
25
|
+
OrgsService: {},
|
|
26
|
+
}));
|
|
27
|
+
import { ExternalAccountsService, ExternalConsoleService, } from '@camunda/ccma-api';
|
|
28
|
+
const FAKE_RUNTIME = {
|
|
29
|
+
stage: 'dev',
|
|
30
|
+
auth: { getAccessToken: async () => 'token' },
|
|
31
|
+
backendUrls: {},
|
|
32
|
+
};
|
|
33
|
+
const cacheEntry = (data) => ({
|
|
34
|
+
data,
|
|
35
|
+
isLoading: false,
|
|
36
|
+
error: null,
|
|
37
|
+
lastFetched: null,
|
|
38
|
+
});
|
|
39
|
+
const makeStore = (webappClusters = {}) => ConsoleDataStore.create({
|
|
40
|
+
clusters: {},
|
|
41
|
+
orgInfo: {},
|
|
42
|
+
orgOwner: {},
|
|
43
|
+
earlyAccessFeatures: {},
|
|
44
|
+
members: {},
|
|
45
|
+
audits: {},
|
|
46
|
+
clusterCapacity: {},
|
|
47
|
+
upgradableGenerations: {},
|
|
48
|
+
generationDetails: {},
|
|
49
|
+
webappClusters,
|
|
50
|
+
});
|
|
51
|
+
describe('ConsoleDataStore.fetchMyOrgs', () => {
|
|
52
|
+
beforeEach(() => vi.clearAllMocks());
|
|
53
|
+
it('sorts organizations alphabetically by name', async () => {
|
|
54
|
+
vi.mocked(ExternalAccountsService.getMyOrganizations).mockResolvedValue([
|
|
55
|
+
{ uuid: '1', name: 'Zeta' },
|
|
56
|
+
{ uuid: '2', name: 'Alpha' },
|
|
57
|
+
]);
|
|
58
|
+
const store = makeStore();
|
|
59
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
60
|
+
await store.fetchMyOrgs();
|
|
61
|
+
expect(store.getMyOrgs()?.map((o) => o.name)).toEqual(['Alpha', 'Zeta']);
|
|
62
|
+
});
|
|
63
|
+
it('skips the fetch when already cached (no force)', async () => {
|
|
64
|
+
vi.mocked(ExternalAccountsService.getMyOrganizations).mockResolvedValue([
|
|
65
|
+
{ uuid: '1', name: 'Alpha' },
|
|
66
|
+
]);
|
|
67
|
+
const store = makeStore();
|
|
68
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
69
|
+
await store.fetchMyOrgs();
|
|
70
|
+
await store.fetchMyOrgs();
|
|
71
|
+
expect(ExternalAccountsService.getMyOrganizations).toHaveBeenCalledTimes(1);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('ConsoleDataStore.fetchWebappClusters', () => {
|
|
75
|
+
beforeEach(() => vi.clearAllMocks());
|
|
76
|
+
it('caches clusters keyed by orgId', async () => {
|
|
77
|
+
vi.mocked(ExternalConsoleService.getOrgClusters).mockResolvedValue([
|
|
78
|
+
{ uuid: 'c1', name: 'Cluster 1' },
|
|
79
|
+
]);
|
|
80
|
+
const store = makeStore();
|
|
81
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
82
|
+
await store.fetchWebappClusters('org-1');
|
|
83
|
+
expect(store.getWebappClusters('org-1')?.map((c) => c.uuid)).toEqual(['c1']);
|
|
84
|
+
expect(ExternalConsoleService.getOrgClusters).toHaveBeenCalledWith(expect.objectContaining({ params: { orgId: 'org-1' } }));
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe('handleClusterChange patches the webappClusters cache', () => {
|
|
88
|
+
it('upserts a cluster from an SSE payload when the cache is populated', () => {
|
|
89
|
+
const store = makeStore({
|
|
90
|
+
'org-1': cacheEntry([{ uuid: 'c1', name: 'Old name' }]),
|
|
91
|
+
});
|
|
92
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
93
|
+
store.handleClusterChange({
|
|
94
|
+
org: 'org-1',
|
|
95
|
+
entity: SseEntity.CLUSTER,
|
|
96
|
+
type: SseType.UPDATED,
|
|
97
|
+
clusterId: 'c1',
|
|
98
|
+
payload: { cluster: { uuid: 'c1', name: 'New name' } },
|
|
99
|
+
});
|
|
100
|
+
expect(store.getWebappClusters('org-1')?.[0]).toMatchObject({
|
|
101
|
+
uuid: 'c1',
|
|
102
|
+
name: 'New name',
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
it('removes a cluster on a DELETED event', () => {
|
|
106
|
+
const store = makeStore({
|
|
107
|
+
'org-1': cacheEntry([
|
|
108
|
+
{ uuid: 'c1', name: 'One' },
|
|
109
|
+
{ uuid: 'c2', name: 'Two' },
|
|
110
|
+
]),
|
|
111
|
+
});
|
|
112
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
113
|
+
store.handleClusterChange({
|
|
114
|
+
org: 'org-1',
|
|
115
|
+
entity: SseEntity.CLUSTER,
|
|
116
|
+
type: SseType.DELETED,
|
|
117
|
+
clusterId: 'c1',
|
|
118
|
+
});
|
|
119
|
+
expect(store.getWebappClusters('org-1')?.map((c) => c.uuid)).toEqual(['c2']);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -8,7 +8,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
|
8
8
|
import { ConsoleDataStore } from './c4-console-data-store.js';
|
|
9
9
|
vi.mock('@camunda/ccma-api', () => ({
|
|
10
10
|
GenerationService: {
|
|
11
|
-
|
|
11
|
+
getUpgradableMulti: vi
|
|
12
|
+
.fn()
|
|
13
|
+
.mockResolvedValue({ preferred: null, options: [] }),
|
|
12
14
|
getGeneration: vi.fn().mockResolvedValue(undefined),
|
|
13
15
|
upgradeCluster: vi.fn().mockResolvedValue(undefined),
|
|
14
16
|
},
|
|
@@ -41,23 +43,23 @@ describe('ConsoleDataStore.fetchUpgradableGenerations', () => {
|
|
|
41
43
|
beforeEach(() => {
|
|
42
44
|
vi.clearAllMocks();
|
|
43
45
|
});
|
|
44
|
-
it('passes clusterId to GenerationService.
|
|
46
|
+
it('passes clusterId to GenerationService.getUpgradableMulti', async () => {
|
|
45
47
|
const store = makeStore();
|
|
46
48
|
store.setRuntime(FAKE_RUNTIME);
|
|
47
49
|
await store.fetchUpgradableGenerations('gen-uuid', 'cluster-uuid');
|
|
48
|
-
expect(GenerationService.
|
|
50
|
+
expect(GenerationService.getUpgradableMulti).toHaveBeenCalledWith(expect.objectContaining({
|
|
49
51
|
fromGenerationUuid: 'gen-uuid',
|
|
50
52
|
clusterId: 'cluster-uuid',
|
|
51
53
|
}));
|
|
52
54
|
});
|
|
53
|
-
it('calls GenerationService.
|
|
55
|
+
it('calls GenerationService.getUpgradableMulti without clusterId when not provided', async () => {
|
|
54
56
|
const store = makeStore();
|
|
55
57
|
store.setRuntime(FAKE_RUNTIME);
|
|
56
58
|
await store.fetchUpgradableGenerations('gen-uuid');
|
|
57
|
-
expect(GenerationService.
|
|
59
|
+
expect(GenerationService.getUpgradableMulti).toHaveBeenCalledWith(expect.objectContaining({
|
|
58
60
|
fromGenerationUuid: 'gen-uuid',
|
|
59
61
|
}));
|
|
60
|
-
expect(GenerationService.
|
|
62
|
+
expect(GenerationService.getUpgradableMulti).toHaveBeenCalledWith(expect.not.objectContaining({ clusterId: expect.anything() }));
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
65
|
describe('ConsoleDataStore.handleClusterChange', () => {
|
|
@@ -231,4 +233,31 @@ describe('ConsoleDataStore.handleClusterChange', () => {
|
|
|
231
233
|
}),
|
|
232
234
|
]);
|
|
233
235
|
});
|
|
236
|
+
it('clears externalMetadata.optimizeFiltering when a CLUSTER event turns it off', () => {
|
|
237
|
+
const store = makeStore();
|
|
238
|
+
store.upsertCluster('org-1', {
|
|
239
|
+
uuid: 'cluster-1',
|
|
240
|
+
externalMetadata: {
|
|
241
|
+
optimizeFiltering: {
|
|
242
|
+
processDefinition: { inclusion: ['order-process'] },
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
// Disabling drops the `optimizeFiltering` key entirely from the JSON
|
|
247
|
+
// wire payload (the backend persists/serializes it as `undefined`, which
|
|
248
|
+
// JSON.stringify omits) rather than sending an explicit `null`.
|
|
249
|
+
const disabledPayload = JSON.parse(JSON.stringify({
|
|
250
|
+
uuid: 'cluster-1',
|
|
251
|
+
externalMetadata: { optimizeFiltering: undefined },
|
|
252
|
+
}));
|
|
253
|
+
store.handleClusterChange({
|
|
254
|
+
org: 'org-1',
|
|
255
|
+
entity: SseEntity.CLUSTER,
|
|
256
|
+
clusterId: 'cluster-1',
|
|
257
|
+
type: 'updated',
|
|
258
|
+
payload: { cluster: disabledPayload },
|
|
259
|
+
});
|
|
260
|
+
const cluster = store.getClusters('org-1')?.[0];
|
|
261
|
+
expect(cluster?.externalMetadata?.optimizeFiltering).toBeUndefined();
|
|
262
|
+
});
|
|
234
263
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SseConnectionState } from '@camunda/ccma-api';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
interface C4ConsoleEventsState {
|
|
4
|
+
state: SseConnectionState;
|
|
5
|
+
}
|
|
6
|
+
export interface C4ConsoleEventsProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** Disable the live subscription (e.g. Storybook / tests). Default `true`. */
|
|
9
|
+
live?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const C4ConsoleEventsProvider: ({ children, live, }: C4ConsoleEventsProviderProps) => React.JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Observe the event bridge's connection state. Returns `{ state: 'closed' }`
|
|
14
|
+
* when no `C4ConsoleEventsProvider` is mounted (non-throwing, so callers can
|
|
15
|
+
* render a status indicator unconditionally).
|
|
16
|
+
*/
|
|
17
|
+
export declare const useC4ConsoleEventsState: () => C4ConsoleEventsState;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } 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 { ExternalConsoleService, } from '@camunda/ccma-api';
|
|
8
|
+
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { useC4ConsoleRuntime } from './c4-console-runtime-context.js';
|
|
10
|
+
import { toApiConfig } from './to-api-config.js';
|
|
11
|
+
/**
|
|
12
|
+
* Bridges the Console org/cluster SSE stream to the `clusterchange` window
|
|
13
|
+
* event that `C4ConsoleDataProvider` (and legacy c3 `useClusterUpdate`
|
|
14
|
+
* consumers) already listen to. This replaces c3's `C3ClusterUpdateManager`.
|
|
15
|
+
*
|
|
16
|
+
* Mount exactly ONE producer of `clusterchange` per document. Mounting this
|
|
17
|
+
* alongside `C3ClusterUpdateManager` (or two of these) double-dispatches every
|
|
18
|
+
* event — duplicate toasts and cache churn. A dev-only warning fires if a
|
|
19
|
+
* second instance mounts.
|
|
20
|
+
*/
|
|
21
|
+
const CLUSTER_CHANGE_EVENT = 'clusterchange';
|
|
22
|
+
const EventsContext = createContext(undefined);
|
|
23
|
+
// Module-level guard: how many event bridges are currently mounted.
|
|
24
|
+
let mountedBridgeCount = 0;
|
|
25
|
+
export const C4ConsoleEventsProvider = ({ children, live = true, }) => {
|
|
26
|
+
const runtime = useC4ConsoleRuntime();
|
|
27
|
+
const [state, setState] = useState(live ? 'connecting' : 'closed');
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!live || typeof window === 'undefined') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
mountedBridgeCount += 1;
|
|
33
|
+
if (mountedBridgeCount > 1 && process.env.NODE_ENV !== 'production') {
|
|
34
|
+
// biome-ignore lint/suspicious/noConsole: intentional dev-only guard
|
|
35
|
+
console.warn('[c4] More than one clusterchange producer is mounted ' +
|
|
36
|
+
'(C4ConsoleEventsProvider and/or C3ClusterUpdateManager). This ' +
|
|
37
|
+
'double-dispatches SSE events. Mount exactly one. See ' +
|
|
38
|
+
'packages/c4/docs/runtime.md.');
|
|
39
|
+
}
|
|
40
|
+
const connection = ExternalConsoleService.streamOrgEvents({
|
|
41
|
+
config: toApiConfig(runtime),
|
|
42
|
+
onStateChange: setState,
|
|
43
|
+
onEvent: (event) => {
|
|
44
|
+
window.dispatchEvent(new CustomEvent(CLUSTER_CHANGE_EVENT, { detail: event }));
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
mountedBridgeCount -= 1;
|
|
49
|
+
connection.close();
|
|
50
|
+
};
|
|
51
|
+
}, [live, runtime]);
|
|
52
|
+
const value = useMemo(() => ({ state }), [state]);
|
|
53
|
+
return (_jsx(EventsContext.Provider, { value: value, children: children }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Observe the event bridge's connection state. Returns `{ state: 'closed' }`
|
|
57
|
+
* when no `C4ConsoleEventsProvider` is mounted (non-throwing, so callers can
|
|
58
|
+
* render a status indicator unconditionally).
|
|
59
|
+
*/
|
|
60
|
+
export const useC4ConsoleEventsState = () => {
|
|
61
|
+
return useContext(EventsContext) ?? { state: 'closed' };
|
|
62
|
+
};
|
|
@@ -12,10 +12,22 @@ export interface ConsoleBackendUrls {
|
|
|
12
12
|
consoleApiBaseUrl?: string;
|
|
13
13
|
accountsApiBaseUrl?: string;
|
|
14
14
|
identityApiBaseUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Overrides the notifications backend base URL. Needed for the user
|
|
17
|
+
* notification feed (`C4UserNotificationsProvider`) when not using the
|
|
18
|
+
* stage-derived default. Maps to the api `notifications` service id.
|
|
19
|
+
*/
|
|
20
|
+
notificationsApiBaseUrl?: string;
|
|
15
21
|
}
|
|
16
22
|
export interface ConsolePublicUrls {
|
|
17
23
|
apiBaseUrl?: string;
|
|
18
24
|
loginBaseUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Base URL of Web Modeler for this environment (e.g.
|
|
27
|
+
* `https://modeler.camunda.io`). Used by `useC4WebappBreadcrumbData` to build
|
|
28
|
+
* org/cluster back-links. When omitted, breadcrumbs that need it are dropped.
|
|
29
|
+
*/
|
|
30
|
+
modelerBaseUrl?: string;
|
|
19
31
|
}
|
|
20
32
|
export interface ConsoleUser {
|
|
21
33
|
email?: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { C4UserNotificationsProviderProps, C4UserNotificationsState } from './c4-user-notifications-context.types';
|
|
2
|
+
/**
|
|
3
|
+
* Provides the per-user notification **feed** (the bell-icon inbox): initial
|
|
4
|
+
* fetch, live SSE updates, and optimistic mark-read / dismiss / analytics —
|
|
5
|
+
* the c4 equivalent of c3's `C3NotificationProvider`.
|
|
6
|
+
*
|
|
7
|
+
* This is NOT the in-app toast stack; for transient toasts use
|
|
8
|
+
* `C4ConsoleNotificationsProvider` / `addC4ConsoleNotification`.
|
|
9
|
+
*
|
|
10
|
+
* The provider does not decide when to mark notifications read on open — the
|
|
11
|
+
* panel drives that (call `markAllAsRead` + `trackPanelOpened`). Must be nested
|
|
12
|
+
* inside `C4ConsoleRuntimeProvider`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const C4UserNotificationsProvider: ({ orgId, children, live, }: C4UserNotificationsProviderProps) => import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Access the user notification feed. Throws if no `C4UserNotificationsProvider`
|
|
17
|
+
* is mounted.
|
|
18
|
+
*/
|
|
19
|
+
export declare const useC4UserNotifications: () => C4UserNotificationsState;
|