@camunda/ccma-saas-frontend 0.0.40 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js +1 -1
  2. package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.types.d.ts +1 -0
  3. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.d.ts +1 -1
  4. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +14 -6
  5. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.types.d.ts +1 -0
  6. package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.d.ts +1 -1
  7. package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js +21 -6
  8. package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.types.d.ts +17 -0
  9. package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.d.ts +3 -0
  10. package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js +51 -0
  11. package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.d.ts +24 -0
  12. package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.js +6 -0
  13. package/lib/esm/components/c4-cluster-overview/applications.d.ts +1 -1
  14. package/lib/esm/components/c4-cluster-overview/applications.js +7 -0
  15. package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.js +1 -1
  16. package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +1 -1
  17. package/lib/esm/components/c4-cluster-overview/cluster-details.js +1 -1
  18. package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +1 -1
  19. package/lib/esm/components/c4-create-cluster/c4-create-cluster.spec.js +4 -0
  20. package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.d.ts +1 -1
  21. package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js +3 -5
  22. package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.types.d.ts +1 -2
  23. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.d.ts +2 -3
  24. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +2 -2
  25. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.d.ts +2 -3
  26. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.js +2 -2
  27. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.d.ts +2 -3
  28. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.js +2 -2
  29. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.d.ts +2 -3
  30. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.js +2 -2
  31. package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.d.ts +1 -1
  32. package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.js +2 -2
  33. package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.types.d.ts +1 -2
  34. package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.d.ts +1 -1
  35. package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.js +4 -5
  36. package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.types.d.ts +1 -2
  37. package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.d.ts +2 -3
  38. package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.js +4 -3
  39. package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-shared.types.d.ts +0 -4
  40. package/lib/esm/externalUrls.const.d.ts +3 -5
  41. package/lib/esm/externalUrls.const.js +3 -15
  42. package/lib/esm/externalUrls.const.spec.js +0 -9
  43. package/lib/esm/i18n/en/modals/clusterclients.json +8 -0
  44. package/lib/esm/i18n/en/modals/clusters.json +4 -1
  45. package/lib/esm/i18n/en/pages/clusterdetails.json +33 -0
  46. package/lib/esm/i18n/en/pages/job-dashboard.json +4 -4
  47. package/lib/esm/index.css +257 -0
  48. package/lib/esm/index.d.ts +6 -1
  49. package/lib/esm/index.js +4 -1
  50. package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +27 -1
  51. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +50 -27
  52. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.permissions.spec.js +52 -12
  53. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +0 -6
  54. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.d.ts +1 -0
  55. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +18 -16
  56. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.spec.js +53 -1
  57. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
  58. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +9 -5
  59. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.d.ts +1 -0
  60. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +13 -12
  61. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +104 -3
  62. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.spec.js +16 -15
  63. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +1 -2
  64. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +111 -34
  65. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +121 -5
  66. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.d.ts +1 -0
  67. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +4 -2
  68. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.spec.js +4 -0
  69. package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.js +3 -2
  70. package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +3 -2
  71. package/lib/esm/widgets/connector-management/c4-connector-management.shared.d.ts +1 -0
  72. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +20 -1
  73. package/lib/esm/widgets/job-worker/c4-job-worker-details-page.d.ts +5 -0
  74. package/lib/esm/widgets/job-worker/c4-job-worker-details-page.js +309 -0
  75. package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.d.ts +5 -0
  76. package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.js +197 -0
  77. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +21 -0
  78. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +82 -0
  79. package/lib/esm/widgets/job-worker/c4-job-worker.types.d.ts +28 -0
  80. package/lib/esm/widgets/job-worker/c4-job-worker.types.js +6 -0
  81. package/lib/esm/widgets/management/c4-management-app.js +1 -1
  82. package/package.json +31 -26
  83. package/lib/esm/index.scss +0 -267
@@ -0,0 +1,309 @@
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 { ConsoleClusterService, SaaSJobsService } from '@camunda/ccma-api';
8
+ import { observer } from 'mobx-react-lite';
9
+ import { useCallback, useEffect, useMemo, useState } from 'react';
10
+ import { C4JobDashboardDetailsPage } from '../../components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js';
11
+ import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
12
+ import { toApiConfig } from '../../runtime/to-api-config.js';
13
+ import { getRegion, latestUpdateTime, makeTr, safeDecodeURIComponent, safeT, toJobsError, } from './c4-job-worker.helpers.js';
14
+ function buildDetailsTranslations(tr) {
15
+ return {
16
+ title: tr('details.title', 'Job type details'),
17
+ lastUpdated: tr('shared.lastUpdated', 'Last updated'),
18
+ jobTypeLabel: tr('details.jobTypeLabel', 'View details for job type:'),
19
+ backgroundFetching: tr('shared.backgroundFetching', 'Loading more data'),
20
+ dataLimitWarning: {
21
+ title: tr('shared.dataLimitWarning.title', 'Data loading limit reached.'),
22
+ description: tr('shared.dataLimitWarning.description', 'Job data limit has been reached for the selected date range.'),
23
+ },
24
+ charts: {
25
+ jobLabel: {
26
+ singular: tr('details.charts.jobLabel.singular', 'job'),
27
+ plural: tr('details.charts.jobLabel.plural', 'jobs'),
28
+ },
29
+ jobWorkload: {
30
+ title: tr('details.charts.jobWorkload.title', 'Job workload'),
31
+ tooltip: tr('details.charts.jobWorkload.tooltip', 'Tracks the flow of created, completed and not completed (failed, cancelled, timed out) jobs over time for the chosen job type.'),
32
+ subtitle: tr('details.charts.jobWorkload.subtitle', 'Jobs created, completed and not completed (failed, cancelled, timed out) over time'),
33
+ },
34
+ createdVsCompleted: {
35
+ title: tr('details.charts.createdVsCompleted.title', 'Job completion rate'),
36
+ tooltip: tr('details.charts.createdVsCompleted.tooltip', 'Indicates overall completion rate. How many created jobs were finished for the chosen job type.'),
37
+ },
38
+ axes: {
39
+ time: tr('details.charts.axes.time', 'Time'),
40
+ numberOfJobs: tr('details.charts.axes.numberOfJobs', 'Number of jobs'),
41
+ },
42
+ legend: {
43
+ created: tr('details.charts.legend.created', 'Created'),
44
+ completed: tr('details.charts.legend.completed', 'Completed'),
45
+ failed: tr('details.charts.legend.failed', 'Not completed'),
46
+ },
47
+ },
48
+ workerTable: {
49
+ title: tr('details.workerTable.title', 'Job workers'),
50
+ headers: {
51
+ workerName: tr('details.workerTable.headers.workerName', 'Worker name'),
52
+ createdJobs: tr('details.workerTable.headers.createdJobs', 'Created jobs'),
53
+ completedJobs: tr('details.workerTable.headers.completedJobs', 'Completed jobs'),
54
+ completedJobsTooltip: tr('details.workerTable.headers.completedJobsTooltip', 'Jobs that have finished executing successfully.'),
55
+ failedJobs: tr('details.workerTable.headers.failedJobs', 'Not completed jobs'),
56
+ failedJobsTooltip: tr('details.workerTable.headers.failedJobsTooltip', 'Jobs that encountered an error and could not complete.'),
57
+ lastCompleted: tr('details.workerTable.headers.lastCompleted', 'Last completed'),
58
+ },
59
+ },
60
+ errorTable: {
61
+ title: tr('details.errorTable.title', 'Not completed jobs by error type'),
62
+ searchLabel: tr('details.errorTable.searchLabel', 'Search'),
63
+ viewErrorsAction: tr('details.errorTable.viewErrorsAction', 'View errors'),
64
+ headers: {
65
+ errorType: tr('details.errorTable.headers.errorType', 'Error type'),
66
+ errorMessage: tr('details.errorTable.headers.errorMessage', 'Error message'),
67
+ jobsWithError: tr('details.errorTable.headers.jobsWithError', 'Job workers with errors'),
68
+ },
69
+ },
70
+ errorHandler: {
71
+ forbidden: {
72
+ title: tr('shared.errorHandler.forbidden.title', 'Missing permissions to view or feature disabled'),
73
+ description: tr('shared.errorHandler.forbidden.description', 'Please contact your organization owner or admin to give you the necessary permissions or enable this feature'),
74
+ learnMoreLabel: tr('shared.errorHandler.forbidden.learnMoreLabel', 'Learn more about roles and restrictions'),
75
+ },
76
+ empty: {
77
+ title: tr('shared.errorHandler.empty.title', 'No data available.'),
78
+ description: tr('shared.errorHandler.empty.description', 'No data was found for this cluster.'),
79
+ learnMoreLabel: tr('shared.errorHandler.empty.learnMoreLabel', 'Learn more about jobs and job workers'),
80
+ },
81
+ generalError: {
82
+ title: tr('shared.errorHandler.generalError.title', 'Error while loading data'),
83
+ description: tr('shared.errorHandler.generalError.description', "We couldn't load the requested data. Please try again."),
84
+ },
85
+ },
86
+ dropdown: {
87
+ label: tr('shared.dropdown.label', 'Select time range'),
88
+ last: tr('shared.dropdown.last', 'Last'),
89
+ minute: tr('shared.dropdown.minute', 'minute'),
90
+ minutes: tr('shared.dropdown.minutes', 'minutes'),
91
+ hour: tr('shared.dropdown.hour', 'hour'),
92
+ hours: tr('shared.dropdown.hours', 'hours'),
93
+ days: tr('shared.dropdown.days', 'days'),
94
+ },
95
+ };
96
+ }
97
+ const INITIAL_JOB_DATA = {
98
+ isIncomplete: false,
99
+ isLoading: false,
100
+ };
101
+ const INITIAL_WORKER_DATA = { items: [], isLoading: false };
102
+ const INITIAL_TIME_SERIES = { items: [], isLoading: false };
103
+ const INITIAL_ERROR_DATA = { items: [], isLoading: false };
104
+ export const C4JobWorkerDetailsPage = observer(({ orgId, clusterId, jobType: jobTypeProp, onNavigate, }) => {
105
+ const runtime = useC4ConsoleRuntime();
106
+ const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
107
+ const t = runtime.i18n?.t;
108
+ const tr = useMemo(() => makeTr(t), [t]);
109
+ const [cluster, setCluster] = useState();
110
+ const [clusterLoading, setClusterLoading] = useState(false);
111
+ const [config, setConfig] = useState();
112
+ const [configLoading, setConfigLoading] = useState(false);
113
+ const [lastUpdatedAt, setLastUpdatedAt] = useState('');
114
+ const [jobData, setJobData] = useState(INITIAL_JOB_DATA);
115
+ const [workerData, setWorkerData] = useState(INITIAL_WORKER_DATA);
116
+ const [timeSeries, setTimeSeries] = useState(INITIAL_TIME_SERIES);
117
+ const [errorData, setErrorData] = useState(INITIAL_ERROR_DATA);
118
+ const [range, setRange] = useState(1440);
119
+ useEffect(() => {
120
+ setCluster(undefined);
121
+ setConfig(undefined);
122
+ setLastUpdatedAt('');
123
+ setJobData(INITIAL_JOB_DATA);
124
+ setWorkerData(INITIAL_WORKER_DATA);
125
+ setTimeSeries(INITIAL_TIME_SERIES);
126
+ setErrorData(INITIAL_ERROR_DATA);
127
+ }, [orgId, clusterId]);
128
+ const loadCluster = useCallback(async () => {
129
+ if (!orgId || !clusterId)
130
+ return;
131
+ setClusterLoading(true);
132
+ try {
133
+ const loaded = await ConsoleClusterService.getCluster({
134
+ config: apiConfig,
135
+ params: { orgId, clusterId },
136
+ });
137
+ setCluster(loaded);
138
+ }
139
+ catch {
140
+ setCluster(undefined);
141
+ }
142
+ finally {
143
+ setClusterLoading(false);
144
+ }
145
+ }, [apiConfig, clusterId, orgId]);
146
+ useEffect(() => {
147
+ void loadCluster();
148
+ }, [loadCluster]);
149
+ const loadData = useCallback(async () => {
150
+ if (!cluster)
151
+ return;
152
+ if (cluster.uuid !== clusterId)
153
+ return;
154
+ const region = getRegion(cluster);
155
+ const jobType = safeDecodeURIComponent(jobTypeProp);
156
+ const now = Date.now();
157
+ const from = new Date(now - range * 60 * 1000);
158
+ const to = new Date(now);
159
+ // Config (fire-and-forget)
160
+ setConfigLoading(true);
161
+ SaaSJobsService.getJobStatisticsConfiguration({
162
+ config: apiConfig,
163
+ params: { orgId, clusterId, region },
164
+ })
165
+ .then((raw) => setConfig(raw?.jobMetrics ?? undefined))
166
+ .catch(() => setConfig(undefined))
167
+ .finally(() => setConfigLoading(false));
168
+ // Last updated timestamp (24h window)
169
+ SaaSJobsService.getJobStatisticsGlobal({
170
+ config: apiConfig,
171
+ params: {
172
+ orgId,
173
+ clusterId,
174
+ region,
175
+ from: new Date(now - 24 * 60 * 60 * 1000),
176
+ to: new Date(now),
177
+ },
178
+ })
179
+ .then((raw) => setLastUpdatedAt(latestUpdateTime(raw)))
180
+ .catch(() => setLastUpdatedAt(''));
181
+ // Job global summary
182
+ setJobData({ isIncomplete: false, isLoading: true });
183
+ SaaSJobsService.getJobStatisticsGlobal({
184
+ config: apiConfig,
185
+ params: { orgId, clusterId, region, from, to, jobType },
186
+ })
187
+ .then((raw) => setJobData({
188
+ data: {
189
+ created: raw.created,
190
+ completed: raw.completed,
191
+ failed: raw.failed,
192
+ lastUpdatedAt: latestUpdateTime(raw),
193
+ },
194
+ isIncomplete: Boolean(raw.isIncomplete),
195
+ isLoading: false,
196
+ }))
197
+ .catch((err) => setJobData({
198
+ isIncomplete: false,
199
+ isLoading: false,
200
+ error: toJobsError(err),
201
+ }));
202
+ // Time series
203
+ setTimeSeries({ items: [], isLoading: true });
204
+ SaaSJobsService.getJobStatisticsTimeSeries({
205
+ config: apiConfig,
206
+ params: { orgId, clusterId, region, from, to, jobType },
207
+ })
208
+ .then((raw) => setTimeSeries({
209
+ items: (raw.items ?? []).map((item) => ({
210
+ time: item.time,
211
+ lastUpdatedAt: '',
212
+ created: item.created,
213
+ completed: item.completed,
214
+ failed: item.failed,
215
+ })),
216
+ isLoading: false,
217
+ }))
218
+ .catch((err) => setTimeSeries({
219
+ items: [],
220
+ isLoading: false,
221
+ error: toJobsError(err),
222
+ }));
223
+ // Workers with full pagination
224
+ setWorkerData({ items: [], isLoading: true });
225
+ void (async () => {
226
+ try {
227
+ let allWorkers = [];
228
+ let cursor;
229
+ do {
230
+ const response = await SaaSJobsService.getJobStatisticsWorkers({
231
+ config: apiConfig,
232
+ params: { orgId, clusterId, region, from, to, jobType, cursor },
233
+ });
234
+ allWorkers = [...allWorkers, ...(response.items ?? [])];
235
+ cursor = response.page?.endCursor || undefined;
236
+ } while (cursor);
237
+ setWorkerData({
238
+ items: allWorkers.map((item) => ({
239
+ worker: item.worker,
240
+ lastUpdatedAt: latestUpdateTime(item),
241
+ created: item.created,
242
+ completed: item.completed,
243
+ failed: item.failed,
244
+ })),
245
+ isLoading: false,
246
+ });
247
+ }
248
+ catch (err) {
249
+ setWorkerData({
250
+ items: [],
251
+ isLoading: false,
252
+ error: toJobsError(err),
253
+ });
254
+ }
255
+ })();
256
+ // Errors with full pagination
257
+ setErrorData({ items: [], isLoading: true });
258
+ void (async () => {
259
+ try {
260
+ let allErrors = [];
261
+ let cursor;
262
+ do {
263
+ const response = await SaaSJobsService.getJobStatisticsErrors({
264
+ config: apiConfig,
265
+ params: { orgId, clusterId, region, from, to, jobType, cursor },
266
+ });
267
+ allErrors = [...allErrors, ...(response.items ?? [])];
268
+ cursor = response.page?.endCursor || undefined;
269
+ } while (cursor);
270
+ setErrorData({
271
+ items: allErrors.map((item) => ({
272
+ errorCode: item.errorCode ?? '',
273
+ errorMessage: item.errorMessage ?? '',
274
+ workers: item.workers ?? 0,
275
+ })),
276
+ isLoading: false,
277
+ });
278
+ }
279
+ catch (err) {
280
+ setErrorData({ items: [], isLoading: false, error: toJobsError(err) });
281
+ }
282
+ })();
283
+ }, [apiConfig, cluster, clusterId, jobTypeProp, orgId, range]);
284
+ useEffect(() => {
285
+ void loadData();
286
+ }, [loadData]);
287
+ const translations = useMemo(() => buildDetailsTranslations(tr), [tr]);
288
+ const breadcrumb = useMemo(() => ({
289
+ elements: [
290
+ {
291
+ key: '1',
292
+ label: safeT(t, 'c4console:clusters.list.title', 'Clusters'),
293
+ onClick: () => onNavigate?.({ kind: 'clusters', orgId }),
294
+ },
295
+ {
296
+ key: '2',
297
+ label: cluster?.name ?? clusterId,
298
+ onClick: () => onNavigate?.({ kind: 'clusterDetails', orgId, clusterId }),
299
+ },
300
+ {
301
+ key: '3',
302
+ label: safeT(t, 'c4console:clusters.details.jobDashboard', 'Job dashboard'),
303
+ onClick: () => onNavigate?.({ kind: 'jobWorkerOverview', orgId, clusterId }),
304
+ },
305
+ ],
306
+ }), [cluster?.name, clusterId, onNavigate, orgId, t]);
307
+ const operateBaseUrl = cluster?.status?.operateUrl ?? null;
308
+ return (_jsx(C4JobDashboardDetailsPage, { jobType: safeDecodeURIComponent(jobTypeProp), config: config, isLoadingConfig: configLoading || clusterLoading, lastUpdatedAt: lastUpdatedAt, breadcrumb: breadcrumb, jobData: jobData, workerData: workerData, timeSeries: timeSeries, errorData: { ...errorData, operateBaseUrl }, onTimeRangeChange: setRange, translations: translations }));
309
+ });
@@ -0,0 +1,5 @@
1
+ import type { JSX } from 'react';
2
+ import type { C4JobWorkerOverviewPageProps } from './c4-job-worker.types';
3
+ export declare const C4JobWorkerOverviewPage: (({ orgId, clusterId, onNavigate, }: C4JobWorkerOverviewPageProps) => JSX.Element) & {
4
+ displayName: string;
5
+ };
@@ -0,0 +1,197 @@
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 { ConsoleClusterService, SaaSJobsService } from '@camunda/ccma-api';
8
+ import { observer } from 'mobx-react-lite';
9
+ import { useCallback, useEffect, useMemo, useState } from 'react';
10
+ import { C4JobDashboardOverviewPage } from '../../components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.js';
11
+ import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
12
+ import { toApiConfig } from '../../runtime/to-api-config.js';
13
+ import { getRegion, latestUpdateTime, makeTr, safeT, toJobsError, } from './c4-job-worker.helpers.js';
14
+ function buildOverviewTranslations(tr) {
15
+ return {
16
+ title: tr('overview.title', 'Job types'),
17
+ description: tr('overview.description', 'View all job types running against the cluster.'),
18
+ learnMoreLabel: tr('overview.learnMoreLabel', 'See more information about job types here.'),
19
+ searchLabel: tr('overview.search.label', 'Search'),
20
+ lastUpdated: tr('shared.lastUpdated', 'Last updated'),
21
+ backgroundFetching: tr('shared.backgroundFetching', 'Loading more data'),
22
+ dataLimitWarning: {
23
+ title: tr('shared.dataLimitWarning.title', 'Data loading limit reached.'),
24
+ description: tr('shared.dataLimitWarning.description', 'Job data limit has been reached for the selected date range.'),
25
+ },
26
+ tableHeaders: {
27
+ jobType: tr('overview.table.headers.jobType', 'Job type'),
28
+ assignedWorkers: tr('overview.table.headers.assignedWorkers', 'Assigned workers'),
29
+ createdJobs: tr('overview.table.headers.createdJobs', 'Created jobs'),
30
+ createdJobsTooltip: tr('overview.table.headers.createdJobsTooltip', 'All jobs created regardless of their current or final state'),
31
+ completedJobs: tr('overview.table.headers.completedJobs', 'Completed jobs'),
32
+ completedJobsTooltip: tr('overview.table.headers.completedJobsTooltip', 'Jobs that have finished executing successfully.'),
33
+ failedJobs: tr('overview.table.headers.failedJobs', 'Not completed jobs'),
34
+ failedJobsTooltip: tr('overview.table.headers.failedJobsTooltip', 'Jobs that encountered an error and could not complete.'),
35
+ lastCompleted: tr('overview.table.headers.lastCompleted', 'Last completed'),
36
+ },
37
+ errorHandler: {
38
+ forbidden: {
39
+ title: tr('shared.errorHandler.forbidden.title', 'Missing permissions to view or feature disabled'),
40
+ description: tr('shared.errorHandler.forbidden.description', 'Contact your organization admin to grant the required permissions or enable this feature.'),
41
+ learnMoreLabel: tr('shared.errorHandler.forbidden.learnMoreLabel', 'Learn more about roles and restrictions'),
42
+ },
43
+ empty: {
44
+ title: tr('shared.errorHandler.empty.title', 'No data available.'),
45
+ description: tr('shared.errorHandler.empty.description', 'No data was found for this cluster.'),
46
+ learnMoreLabel: tr('shared.errorHandler.empty.learnMoreLabel', 'Learn more about Jobs and Job workers'),
47
+ },
48
+ generalError: {
49
+ title: tr('shared.errorHandler.generalError.title', 'Error while loading data'),
50
+ description: tr('shared.errorHandler.generalError.description', "We couldn't load the requested data. Please try again."),
51
+ },
52
+ },
53
+ dropdown: {
54
+ label: tr('shared.dropdown.label', 'Select time range'),
55
+ last: tr('shared.dropdown.last', 'Last'),
56
+ minute: tr('shared.dropdown.minute', 'minute'),
57
+ minutes: tr('shared.dropdown.minutes', 'minutes'),
58
+ hour: tr('shared.dropdown.hour', 'hour'),
59
+ hours: tr('shared.dropdown.hours', 'hours'),
60
+ days: tr('shared.dropdown.days', 'days'),
61
+ },
62
+ };
63
+ }
64
+ export const C4JobWorkerOverviewPage = observer(({ orgId, clusterId, onNavigate, }) => {
65
+ const runtime = useC4ConsoleRuntime();
66
+ const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
67
+ const t = runtime.i18n?.t;
68
+ const tr = useMemo(() => makeTr(t), [t]);
69
+ const [cluster, setCluster] = useState();
70
+ const [clusterLoading, setClusterLoading] = useState(false);
71
+ const [config, setConfig] = useState();
72
+ const [configLoading, setConfigLoading] = useState(false);
73
+ const [lastUpdatedAt, setLastUpdatedAt] = useState('');
74
+ const [items, setItems] = useState([]);
75
+ const [isIncomplete, setIsIncomplete] = useState(false);
76
+ const [tableLoading, setTableLoading] = useState(false);
77
+ const [tableError, setTableError] = useState();
78
+ const [range, setRange] = useState(1440);
79
+ useEffect(() => {
80
+ setCluster(undefined);
81
+ setConfig(undefined);
82
+ setLastUpdatedAt('');
83
+ setItems([]);
84
+ setIsIncomplete(false);
85
+ setTableError(undefined);
86
+ }, [orgId, clusterId]);
87
+ const loadCluster = useCallback(async () => {
88
+ if (!orgId || !clusterId)
89
+ return;
90
+ setClusterLoading(true);
91
+ try {
92
+ const loaded = await ConsoleClusterService.getCluster({
93
+ config: apiConfig,
94
+ params: { orgId, clusterId },
95
+ });
96
+ setCluster(loaded);
97
+ }
98
+ catch {
99
+ setCluster(undefined);
100
+ }
101
+ finally {
102
+ setClusterLoading(false);
103
+ }
104
+ }, [apiConfig, clusterId, orgId]);
105
+ useEffect(() => {
106
+ void loadCluster();
107
+ }, [loadCluster]);
108
+ const loadData = useCallback(async () => {
109
+ if (!cluster)
110
+ return;
111
+ if (cluster.uuid !== clusterId)
112
+ return;
113
+ const region = getRegion(cluster);
114
+ const now = Date.now();
115
+ const from = new Date(now - range * 60 * 1000);
116
+ const to = new Date(now);
117
+ // Load config (fire-and-forget, non-blocking for table)
118
+ setConfigLoading(true);
119
+ SaaSJobsService.getJobStatisticsConfiguration({
120
+ config: apiConfig,
121
+ params: { orgId, clusterId, region },
122
+ })
123
+ .then((raw) => setConfig(raw?.jobMetrics ?? undefined))
124
+ .catch(() => setConfig(undefined))
125
+ .finally(() => setConfigLoading(false));
126
+ // Load last updated timestamp using 24h global stats
127
+ SaaSJobsService.getJobStatisticsGlobal({
128
+ config: apiConfig,
129
+ params: {
130
+ orgId,
131
+ clusterId,
132
+ region,
133
+ from: new Date(now - 24 * 60 * 60 * 1000),
134
+ to: new Date(now),
135
+ },
136
+ })
137
+ .then((raw) => setLastUpdatedAt(latestUpdateTime(raw)))
138
+ .catch(() => setLastUpdatedAt(''));
139
+ // Load overview data with full pagination
140
+ setTableLoading(true);
141
+ setTableError(undefined);
142
+ try {
143
+ let allItems = [];
144
+ let incomplete = false;
145
+ let cursor;
146
+ do {
147
+ const response = await SaaSJobsService.getJobStatisticsOverview({
148
+ config: apiConfig,
149
+ params: { orgId, clusterId, region, from, to, cursor },
150
+ });
151
+ allItems = [...allItems, ...(response.items ?? [])];
152
+ incomplete = incomplete || Boolean(response.isIncomplete);
153
+ cursor = response.page?.endCursor || undefined;
154
+ } while (cursor);
155
+ setIsIncomplete(incomplete);
156
+ setItems(allItems.map((item) => ({
157
+ jobType: item.jobType,
158
+ workers: item.workers ?? 0,
159
+ lastUpdatedAt: latestUpdateTime(item),
160
+ created: item.created,
161
+ completed: item.completed,
162
+ failed: item.failed,
163
+ onClick: () => onNavigate?.({
164
+ kind: 'jobWorkerDetails',
165
+ orgId,
166
+ clusterId,
167
+ jobType: item.jobType,
168
+ }),
169
+ })));
170
+ }
171
+ catch (err) {
172
+ setTableError(toJobsError(err));
173
+ }
174
+ finally {
175
+ setTableLoading(false);
176
+ }
177
+ }, [apiConfig, cluster, clusterId, onNavigate, orgId, range]);
178
+ useEffect(() => {
179
+ void loadData();
180
+ }, [loadData]);
181
+ const translations = useMemo(() => buildOverviewTranslations(tr), [tr]);
182
+ const breadcrumb = useMemo(() => ({
183
+ elements: [
184
+ {
185
+ key: '1',
186
+ label: safeT(t, 'c4console:clusters.list.title', 'Clusters'),
187
+ onClick: () => onNavigate?.({ kind: 'clusters', orgId }),
188
+ },
189
+ {
190
+ key: '2',
191
+ label: cluster?.name ?? clusterId,
192
+ onClick: () => onNavigate?.({ kind: 'clusterDetails', orgId, clusterId }),
193
+ },
194
+ ],
195
+ }), [cluster?.name, clusterId, onNavigate, orgId, t]);
196
+ return (_jsx(C4JobDashboardOverviewPage, { breadcrumb: breadcrumb, lastUpdatedAt: lastUpdatedAt, items: items, onTimeRangeChange: setRange, error: tableError, config: config, isIncomplete: isIncomplete, isLoadingConfig: configLoading || clusterLoading, isLoadingTable: tableLoading, translations: translations }));
197
+ });
@@ -0,0 +1,21 @@
1
+ import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
2
+ import type { JobsError } from '../../components/c4-job-dashboard-shared/c4-job-dashboard-shared.types';
3
+ export type TranslateFn = (key: string) => string;
4
+ export type Tr = (key: string, fallback: string) => string;
5
+ export declare function makeTr(t: TranslateFn | undefined): Tr;
6
+ export declare function safeT(t: TranslateFn | undefined, key: string, fallback: string): string;
7
+ export declare function getRegion(cluster: ConsoleClusterDto): string;
8
+ export declare function formatDateTime(dateStr: string | null | undefined): string;
9
+ export declare function latestUpdateTime(item: {
10
+ created: {
11
+ lastUpdatedAt?: string | null;
12
+ };
13
+ completed: {
14
+ lastUpdatedAt?: string | null;
15
+ };
16
+ failed: {
17
+ lastUpdatedAt?: string | null;
18
+ };
19
+ }): string;
20
+ export declare function toJobsError(err: any): JobsError;
21
+ export declare function safeDecodeURIComponent(value: string): string;
@@ -0,0 +1,82 @@
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 function makeTr(t) {
7
+ return (key, fallback) => {
8
+ if (!t)
9
+ return fallback;
10
+ try {
11
+ const full = `jobDashboard:${key}`;
12
+ const result = t(full);
13
+ return result && result !== full ? result : fallback;
14
+ }
15
+ catch {
16
+ return fallback;
17
+ }
18
+ };
19
+ }
20
+ export function safeT(t, key, fallback) {
21
+ if (!t)
22
+ return fallback;
23
+ try {
24
+ const result = t(key);
25
+ return result && result !== key ? result : fallback;
26
+ }
27
+ catch {
28
+ return fallback;
29
+ }
30
+ }
31
+ export function getRegion(cluster) {
32
+ const zeebeRestUrl = cluster.status?.zeebeRestUrl;
33
+ if (!zeebeRestUrl)
34
+ return '';
35
+ const normalizedHost = zeebeRestUrl.replace(/^https?:\/\//, '').split('/')[0];
36
+ return normalizedHost.split('.')[0] ?? '';
37
+ }
38
+ export function formatDateTime(dateStr) {
39
+ if (!dateStr)
40
+ return '';
41
+ try {
42
+ const d = new Date(dateStr);
43
+ if (isNaN(d.getTime()))
44
+ return '';
45
+ return d.toLocaleString('en-US', {
46
+ month: 'short',
47
+ day: '2-digit',
48
+ year: 'numeric',
49
+ hour: '2-digit',
50
+ minute: '2-digit',
51
+ hour12: false,
52
+ });
53
+ }
54
+ catch {
55
+ return '';
56
+ }
57
+ }
58
+ export function latestUpdateTime(item) {
59
+ const dates = [
60
+ item.created?.lastUpdatedAt,
61
+ item.completed?.lastUpdatedAt,
62
+ item.failed?.lastUpdatedAt,
63
+ ].filter((d) => Boolean(d));
64
+ return dates.length
65
+ ? formatDateTime(dates.reduce((a, b) => (a > b ? a : b)))
66
+ : '';
67
+ }
68
+ export function toJobsError(err) {
69
+ return {
70
+ status: err?.status ?? 500,
71
+ details: String(err?.statusText ?? ''),
72
+ message: String(err?.message ?? 'Failed to load data'),
73
+ };
74
+ }
75
+ export function safeDecodeURIComponent(value) {
76
+ try {
77
+ return decodeURIComponent(value);
78
+ }
79
+ catch {
80
+ return value;
81
+ }
82
+ }
@@ -0,0 +1,28 @@
1
+ export type C4JobWorkerNavigateEvent = {
2
+ kind: 'clusters';
3
+ orgId: string;
4
+ } | {
5
+ kind: 'clusterDetails';
6
+ orgId: string;
7
+ clusterId: string;
8
+ } | {
9
+ kind: 'jobWorkerOverview';
10
+ orgId: string;
11
+ clusterId: string;
12
+ } | {
13
+ kind: 'jobWorkerDetails';
14
+ orgId: string;
15
+ clusterId: string;
16
+ jobType: string;
17
+ };
18
+ export interface C4JobWorkerOverviewPageProps {
19
+ orgId: string;
20
+ clusterId: string;
21
+ onNavigate?: (event: C4JobWorkerNavigateEvent) => void;
22
+ }
23
+ export interface C4JobWorkerDetailsPageProps {
24
+ orgId: string;
25
+ clusterId: string;
26
+ jobType: string;
27
+ onNavigate?: (event: C4JobWorkerNavigateEvent) => void;
28
+ }
@@ -0,0 +1,6 @@
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 {};
@@ -2308,7 +2308,7 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
2308
2308
  const isUsageSalesPlan = orgHasSalesPlanType(org, 'trial', 'in-negotiation', 'enterprise', 'internal');
2309
2309
  const billingVisible = canReadBilling && isEnterprise;
2310
2310
  const usageVisible = canReadUsage && isUsageSalesPlan;
2311
- const liteLlmEnabled = runtime.stage === 'dev' || runtime.stage === 'local';
2311
+ const liteLlmEnabled = true;
2312
2312
  const tenantKeyRaw = getNestedValue(org, ['metadata', 'llm', 'tenantKey']);
2313
2313
  const aiUsageVisible = liteLlmEnabled &&
2314
2314
  typeof tenantKeyRaw === 'string' &&