@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
package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface C4CreateIpWhitelistModalHandle {
|
|
2
|
+
open: () => void;
|
|
3
|
+
close: () => void;
|
|
4
|
+
}
|
|
5
|
+
export interface C4CreateIpWhitelistModalProps {
|
|
6
|
+
t?: (key: string, options?: Record<string, unknown>) => string;
|
|
7
|
+
onCreateIpWhitelist: (params: {
|
|
8
|
+
ip: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
onCancel?: () => void;
|
|
12
|
+
onSubmitStart?: () => void;
|
|
13
|
+
onSubmitError?: (error: unknown) => void;
|
|
14
|
+
}
|
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { C3DataTable, } from '@camunda/camunda-composite-components';
|
|
8
8
|
import { Button, DataTable, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, MultiSelect, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@camunda/design-system';
|
|
9
|
-
import { useState } from 'react';
|
|
9
|
+
import { useCallback, useMemo, useRef, useState, } from 'react';
|
|
10
10
|
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
11
11
|
/**
|
|
12
12
|
* Design-system-switchable data table.
|
|
@@ -63,36 +63,65 @@ function renderCell(header, row) {
|
|
|
63
63
|
return value;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
// Build column defs from a ref to the latest headers. The returned array is
|
|
67
|
+
// meant to be memoised (stable identity) so the DS `DataTable` — backed by
|
|
68
|
+
// TanStack Table — does not rebuild its column model and remount every cell
|
|
69
|
+
// (which would close any open row action menu). Each column resolves its
|
|
70
|
+
// current header on access, so a stable column still renders with the latest
|
|
71
|
+
// render's cell wrapper / sort comparator.
|
|
72
|
+
function toColumns(headersRef) {
|
|
73
|
+
return headersRef.current.map((header) => {
|
|
74
|
+
const resolveHeader = () => headersRef.current.find((candidate) => candidate.key === header.key) ??
|
|
75
|
+
header;
|
|
76
|
+
return {
|
|
77
|
+
id: header.key,
|
|
78
|
+
accessorFn: (row) => row[header.key],
|
|
79
|
+
header: header.label,
|
|
80
|
+
enableSorting: !!header.sorting,
|
|
81
|
+
...(header.sorting && {
|
|
82
|
+
sortingFn: (a, b) => resolveHeader().sorting?.(a.original, b.original) ?? 0,
|
|
83
|
+
}),
|
|
84
|
+
cell: ({ row }) => renderCell(resolveHeader(), row.original),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
77
87
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
:
|
|
95
|
-
|
|
88
|
+
// Build row-action descriptors from a ref to the latest actions. Like
|
|
89
|
+
// toColumns, the result is meant to be memoised so the DS `DataTable` keeps a
|
|
90
|
+
// stable actions column and does not remount the row action menu on every
|
|
91
|
+
// re-render. Each descriptor delegates to the current action on access: the DS
|
|
92
|
+
// table calls `visible` / `disabled` / `label` during its own render, so a
|
|
93
|
+
// stale closure (e.g. captured before a row's status changed) would render the
|
|
94
|
+
// wrong actions.
|
|
95
|
+
function toRowActions(actionsRef) {
|
|
96
|
+
const actions = actionsRef.current;
|
|
97
|
+
if (!actions) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
return actions.map((action) => {
|
|
101
|
+
const resolveAction = () => actionsRef.current?.find((candidate) => candidate.id === action.id) ??
|
|
102
|
+
action;
|
|
103
|
+
return {
|
|
104
|
+
id: action.id,
|
|
105
|
+
label: (row) => {
|
|
106
|
+
const label = resolveAction().label;
|
|
107
|
+
return typeof label === 'function' ? label(row) : label;
|
|
108
|
+
},
|
|
109
|
+
onClick: (row) => resolveAction().onClick(row),
|
|
110
|
+
disabled: (row) => resolveAction().disabled?.(row) ?? false,
|
|
111
|
+
visible: (row) => resolveAction().visible?.(row) ?? true,
|
|
112
|
+
hasDivider: action.hasDivider,
|
|
113
|
+
variant: typeof action.kind === 'string' && action.kind.includes('danger')
|
|
114
|
+
? 'destructive'
|
|
115
|
+
: 'default',
|
|
116
|
+
icon: action.icon
|
|
117
|
+
? (row) => {
|
|
118
|
+
const icon = resolveAction().icon;
|
|
119
|
+
const Icon = typeof icon === 'function' ? icon(row) : icon;
|
|
120
|
+
return Icon ? _jsx(Icon, {}) : undefined;
|
|
121
|
+
}
|
|
122
|
+
: undefined,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
96
125
|
}
|
|
97
126
|
// Items that filter rows (search/singleSelect/multiSelect); button/menuButton
|
|
98
127
|
// do not.
|
|
@@ -124,6 +153,32 @@ function keepRow(row, items, state) {
|
|
|
124
153
|
}
|
|
125
154
|
function C4DataTableDs(props) {
|
|
126
155
|
const { headers, data, actions, options, isLoading, title, description, id } = props;
|
|
156
|
+
// Mirror the latest headers/actions into refs so the memoised (referentially
|
|
157
|
+
// stable) `columns` / `rowActions` below can delegate to the current
|
|
158
|
+
// render's cell wrappers and action callbacks. These are written during
|
|
159
|
+
// render on purpose: the DS `DataTable` invokes the column cells and action
|
|
160
|
+
// `visible`/`disabled` predicates synchronously while rendering its own
|
|
161
|
+
// subtree (which happens after this component's render in the same pass), so
|
|
162
|
+
// an effect-based update would be a render too late and show stale actions.
|
|
163
|
+
const headersRef = useRef(headers);
|
|
164
|
+
headersRef.current = headers;
|
|
165
|
+
const actionsRef = useRef(actions);
|
|
166
|
+
actionsRef.current = actions;
|
|
167
|
+
// Structural signatures: the only changes that require *new* column /
|
|
168
|
+
// action descriptors (vs. the ref-delegated ones staying live). Rebuilding
|
|
169
|
+
// `columns` / `rowActions` on every render would hand the DS `DataTable` new
|
|
170
|
+
// cell/action functions, forcing TanStack to rebuild its column model and
|
|
171
|
+
// React to remount every cell — which closes any open row action menu.
|
|
172
|
+
const headerSignature = headers
|
|
173
|
+
.map((header) => `${header.key}${header.label}${header.sorting ? 1 : 0}`)
|
|
174
|
+
.join('');
|
|
175
|
+
const actionSignature = (actions ?? [])
|
|
176
|
+
.map((action) => `${action.id}${String(action.kind)}${action.hasDivider ? 1 : 0}${action.icon ? 1 : 0}`)
|
|
177
|
+
.join('');
|
|
178
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: headersRef is stable; the reactive input is headerSignature, which subsumes the every-render `headers` array (see comment above)
|
|
179
|
+
const columns = useMemo(() => toColumns(headersRef), [headerSignature]);
|
|
180
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: actionsRef is stable; the reactive input is actionSignature, which subsumes the every-render `actions` array (see comment above)
|
|
181
|
+
const rowActions = useMemo(() => toRowActions(actionsRef), [actionSignature]);
|
|
127
182
|
// Normalise `toolbar` (single row) / `toolbars` (multiple rows) into rows.
|
|
128
183
|
const toolbarRows = props.toolbars ?? (props.toolbar ? [props.toolbar] : []);
|
|
129
184
|
const allToolbarItems = toolbarRows.flat();
|
|
@@ -137,9 +192,34 @@ function C4DataTableDs(props) {
|
|
|
137
192
|
return initial;
|
|
138
193
|
});
|
|
139
194
|
const setValue = (key, value) => setFilterState((prev) => ({ ...prev, [key]: value }));
|
|
140
|
-
|
|
195
|
+
// Stable signature of the filtering toolbar items (their `type` + `id`).
|
|
196
|
+
// It only changes when the toolbar's filtering shape changes — not on every
|
|
197
|
+
// render — and captures every input that can alter `keepRow`'s result other
|
|
198
|
+
// than the row data and the filter state (a filter's predicate is a pure
|
|
199
|
+
// function of the row and the current selection, so its closure identity is
|
|
200
|
+
// irrelevant). It is what gates the memo below against stale results.
|
|
201
|
+
const filterSignature = allToolbarItems
|
|
202
|
+
.filter((item) => item.type === 'search' ||
|
|
203
|
+
item.type === 'singleSelect' ||
|
|
204
|
+
item.type === 'multiSelect')
|
|
205
|
+
.map((item) => `${item.type}:${item.id}`)
|
|
206
|
+
.join('|');
|
|
207
|
+
// Keep the array reference stable across renders when neither the source
|
|
208
|
+
// `data` reference, the filter state, nor the filtering toolbar shape
|
|
209
|
+
// changed. The underlying DS `DataTable` is backed by TanStack Table, whose
|
|
210
|
+
// default `autoResetPageIndex` resets to the first page whenever the `data`
|
|
211
|
+
// reference changes; an unconditional `.filter()` would hand it a brand-new
|
|
212
|
+
// array on every parent re-render (e.g. when a per-row API call resolves),
|
|
213
|
+
// snapping the table back to page 1 and unmounting any open row action
|
|
214
|
+
// menu. Consumers that mutate row contents in place (see c4-cluster-list)
|
|
215
|
+
// rely on this stability. `allToolbarItems` itself is rebuilt on every
|
|
216
|
+
// render, so it is intentionally not a dependency — `filterSignature`
|
|
217
|
+
// subsumes it; depending on the array directly would defeat the memo and
|
|
218
|
+
// reintroduce the reset.
|
|
219
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: allToolbarItems is rebuilt every render and is subsumed by filterSignature (see comment above)
|
|
220
|
+
const filteredData = useMemo(() => allToolbarItems.length
|
|
141
221
|
? data.filter((row) => keepRow(row, allToolbarItems, filterState))
|
|
142
|
-
: data;
|
|
222
|
+
: data, [data, filterState, filterSignature]);
|
|
143
223
|
const renderToolbarItem = (item) => {
|
|
144
224
|
switch (item.type) {
|
|
145
225
|
case 'search': {
|
|
@@ -181,12 +261,15 @@ function C4DataTableDs(props) {
|
|
|
181
261
|
};
|
|
182
262
|
const hasHeading = title !== undefined || description !== undefined;
|
|
183
263
|
const hasExpansion = data.some((row) => row.expansion !== undefined);
|
|
184
|
-
|
|
264
|
+
// Stable identity so TanStack Table keeps its row identities (and open row
|
|
265
|
+
// action menus) across re-renders.
|
|
266
|
+
const getRowId = useCallback((row, index) => row.id ?? String(index), []);
|
|
267
|
+
return (_jsxs("div", { className: 'flex flex-col gap-3', id: id, children: [hasHeading && (_jsxs("div", { className: 'flex flex-col gap-1', children: [title !== undefined && (_jsx("div", { className: 'text-base font-semibold', children: title })), description !== undefined && (_jsx("div", { className: 'text-sm text-neutral-foreground-subtle', children: description }))] })), toolbarRows.map(renderToolbarRow), _jsx(DataTable, { columns: columns, data: filteredData, getRowId: getRowId, sorting: headers.some((header) => !!header.sorting), pagination: options?.pageSize || options?.pageSizes
|
|
185
268
|
? {
|
|
186
269
|
defaultPageSize: options.pageSize,
|
|
187
270
|
pageSizes: options.pageSizes,
|
|
188
271
|
}
|
|
189
|
-
: true, size: options?.tableSize, zebra: options?.useZebraStyles, inlineActionsThreshold: options?.actionsUseOverflowMenuMinItems, rowActions:
|
|
272
|
+
: true, size: options?.tableSize, zebra: options?.useZebraStyles, inlineActionsThreshold: options?.actionsUseOverflowMenuMinItems, rowActions: rowActions, loading: isLoading, onRowClick: (row) => row.onClick?.(), expansion: hasExpansion ? (row) => row.expansion ?? null : undefined })] }));
|
|
190
273
|
}
|
|
191
274
|
export function C4DataTable(props) {
|
|
192
275
|
const designSystem = useC4DesignSystem();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { C4ConsoleRuntimeProvider } from '../../runtime/c4-console-runtime-context.js';
|
|
5
|
+
import { C4DataTable } from './c4-data-table.js';
|
|
6
|
+
// Regression coverage for the DS data-table reset bug (PR #9151): when a
|
|
7
|
+
// parent re-render hands C4DataTable the *same* `data` array reference with
|
|
8
|
+
// row contents mutated in place (e.g. per-cluster capacity API calls
|
|
9
|
+
// resolving), the DS `DataTable` — backed by TanStack Table — must receive
|
|
10
|
+
// stable `data`, `columns`, and `rowActions` references so that:
|
|
11
|
+
// - its default `autoResetPageIndex` does not fire (no page reset), and
|
|
12
|
+
// - it does not rebuild its column model, which would give every cell a new
|
|
13
|
+
// `flexRender` component type and remount the cell subtree — closing any
|
|
14
|
+
// open row action menu (the "Rename/Delete" overflow menu).
|
|
15
|
+
// We assert those invariants at the boundary rather than driving the
|
|
16
|
+
// design-system pagination / dropdown DOM, so the test stays decoupled from
|
|
17
|
+
// design-system internals.
|
|
18
|
+
const { received } = vi.hoisted(() => ({
|
|
19
|
+
received: {
|
|
20
|
+
data: [],
|
|
21
|
+
columns: [],
|
|
22
|
+
rowActions: [],
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
// Fully stub the design-system so this suite is independent of the real
|
|
26
|
+
// component tree; the only export we care about is `DataTable`, which records
|
|
27
|
+
// the `data` / `columns` / `rowActions` references it is handed on every
|
|
28
|
+
// render.
|
|
29
|
+
vi.mock('@camunda/design-system', () => ({
|
|
30
|
+
DataTable: (props) => {
|
|
31
|
+
received.data.push(props.data);
|
|
32
|
+
received.columns.push(props.columns);
|
|
33
|
+
received.rowActions.push(props.rowActions);
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
Button: () => null,
|
|
37
|
+
Input: () => null,
|
|
38
|
+
MultiSelect: () => null,
|
|
39
|
+
Select: () => null,
|
|
40
|
+
SelectContent: () => null,
|
|
41
|
+
SelectItem: () => null,
|
|
42
|
+
SelectTrigger: () => null,
|
|
43
|
+
SelectValue: () => null,
|
|
44
|
+
DropdownMenu: () => null,
|
|
45
|
+
DropdownMenuContent: () => null,
|
|
46
|
+
DropdownMenuItem: () => null,
|
|
47
|
+
DropdownMenuTrigger: () => null,
|
|
48
|
+
}));
|
|
49
|
+
const wrapper = ({ children }) => (_jsx(C4ConsoleRuntimeProvider, { config: {
|
|
50
|
+
stage: 'dev',
|
|
51
|
+
designSystem: 'ds',
|
|
52
|
+
auth: { getAccessToken: async () => '' },
|
|
53
|
+
backendUrls: {},
|
|
54
|
+
}, children: children }));
|
|
55
|
+
// Headers, toolbar and actions are rebuilt on every render (as real consumers
|
|
56
|
+
// such as c4-cluster-list do), so this exercises the wrapper's
|
|
57
|
+
// referential-stability guarantees rather than relying on the caller passing
|
|
58
|
+
// stable references.
|
|
59
|
+
function Harness({ data, canDelete = true, }) {
|
|
60
|
+
const actions = [
|
|
61
|
+
{
|
|
62
|
+
id: 'delete',
|
|
63
|
+
kind: 'danger--ghost',
|
|
64
|
+
label: 'Delete',
|
|
65
|
+
onClick: () => undefined,
|
|
66
|
+
visible: () => canDelete,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
return (_jsx(C4DataTable, { headers: [
|
|
70
|
+
{ key: 'name', label: 'Name' },
|
|
71
|
+
{ key: 'load', label: 'Load' },
|
|
72
|
+
], data: data, actions: actions, toolbar: [
|
|
73
|
+
{
|
|
74
|
+
id: 'search',
|
|
75
|
+
type: 'search',
|
|
76
|
+
label: 'Search',
|
|
77
|
+
filter: ({ row, searchTerm }) => row.name.toLowerCase().includes((searchTerm ?? '').toLowerCase()),
|
|
78
|
+
},
|
|
79
|
+
] }));
|
|
80
|
+
}
|
|
81
|
+
function resetReceived() {
|
|
82
|
+
received.data.length = 0;
|
|
83
|
+
received.columns.length = 0;
|
|
84
|
+
received.rowActions.length = 0;
|
|
85
|
+
}
|
|
86
|
+
describe('C4DataTableDs reference stability', () => {
|
|
87
|
+
it('passes the same data reference when row contents mutate in place', () => {
|
|
88
|
+
resetReceived();
|
|
89
|
+
const data = [
|
|
90
|
+
{ id: 'r1', originalIndex: 0, name: 'Alice', load: 0 },
|
|
91
|
+
{ id: 'r2', originalIndex: 1, name: 'Bob', load: 0 },
|
|
92
|
+
];
|
|
93
|
+
const { rerender } = render(_jsx(Harness, { data: data }), { wrapper });
|
|
94
|
+
// Mutate row contents in place, keeping the same array reference — the
|
|
95
|
+
// shape consumers rely on to avoid resetting the table.
|
|
96
|
+
data[0].load = 42;
|
|
97
|
+
rerender(_jsx(Harness, { data: data }));
|
|
98
|
+
expect(received.data.length).toBeGreaterThanOrEqual(2);
|
|
99
|
+
const first = received.data[0];
|
|
100
|
+
const last = received.data[received.data.length - 1];
|
|
101
|
+
// Same filtered array reference across renders => TanStack sees no data
|
|
102
|
+
// change => no page reset.
|
|
103
|
+
expect(last).toBe(first);
|
|
104
|
+
// ...and the in-place mutation is still visible through that reference.
|
|
105
|
+
expect(last[0].load).toBe(42);
|
|
106
|
+
});
|
|
107
|
+
it('passes stable columns and rowActions references across re-renders', () => {
|
|
108
|
+
resetReceived();
|
|
109
|
+
const data = [{ id: 'r1', originalIndex: 0, name: 'Alice', load: 0 }];
|
|
110
|
+
const { rerender } = render(_jsx(Harness, { data: data }), { wrapper });
|
|
111
|
+
data[0].load = 7;
|
|
112
|
+
rerender(_jsx(Harness, { data: data }));
|
|
113
|
+
// Stable identity => the DS DataTable does not rebuild its column model,
|
|
114
|
+
// so cells (and any open row action menu) are not remounted.
|
|
115
|
+
expect(received.columns[0]).toBe(received.columns[received.columns.length - 1]);
|
|
116
|
+
expect(received.rowActions[0]).toBe(received.rowActions[received.rowActions.length - 1]);
|
|
117
|
+
});
|
|
118
|
+
it('keeps rowActions identity stable while delegating to the latest action callbacks', () => {
|
|
119
|
+
resetReceived();
|
|
120
|
+
const data = [{ id: 'r1', originalIndex: 0, name: 'Alice', load: 0 }];
|
|
121
|
+
const row = data[0];
|
|
122
|
+
const { rerender } = render(_jsx(Harness, { data: data, canDelete: true }), {
|
|
123
|
+
wrapper,
|
|
124
|
+
});
|
|
125
|
+
const initialRowActions = received.rowActions[0];
|
|
126
|
+
expect(initialRowActions[0].visible(row)).toBe(true);
|
|
127
|
+
// Re-render with a new `actions` prop (same action id, but `visible` now
|
|
128
|
+
// returns false). The descriptor identity must not change, yet the
|
|
129
|
+
// predicate the DS table invokes must reflect the latest render.
|
|
130
|
+
rerender(_jsx(Harness, { data: data, canDelete: false }));
|
|
131
|
+
const nextRowActions = received.rowActions[received.rowActions.length - 1];
|
|
132
|
+
expect(nextRowActions).toBe(initialRowActions);
|
|
133
|
+
expect(initialRowActions[0].visible(row)).toBe(false);
|
|
134
|
+
});
|
|
135
|
+
it('passes a new data reference when the data array reference changes', () => {
|
|
136
|
+
resetReceived();
|
|
137
|
+
const initial = [
|
|
138
|
+
{ id: 'r1', originalIndex: 0, name: 'Alice', load: 0 },
|
|
139
|
+
];
|
|
140
|
+
const { rerender } = render(_jsx(Harness, { data: initial }), { wrapper });
|
|
141
|
+
const replacement = [
|
|
142
|
+
{ id: 'r1', originalIndex: 0, name: 'Alice', load: 0 },
|
|
143
|
+
{ id: 'r2', originalIndex: 1, name: 'Bob', load: 0 },
|
|
144
|
+
];
|
|
145
|
+
rerender(_jsx(Harness, { data: replacement }));
|
|
146
|
+
const first = received.data[0];
|
|
147
|
+
const last = received.data[received.data.length - 1];
|
|
148
|
+
expect(last).not.toBe(first);
|
|
149
|
+
expect(last.length).toBe(2);
|
|
150
|
+
});
|
|
151
|
+
});
|
package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.mocks.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
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 { getDropdownTranslations, getErrorHandlerTranslations, } from '../c4-job-dashboard-shared/c4-stories-data-generator.js';
|
|
7
|
+
// All dates below are computed relative to real "now" (rather than a fixed
|
|
8
|
+
// past date, which reads as obviously stale in a docs screenshot) - matches
|
|
9
|
+
// this migration's dynamic-date convention (see stories/shared/billing-dates.ts).
|
|
10
|
+
const MINUTE = 60 * 1000;
|
|
11
|
+
const HOUR = 60 * MINUTE;
|
|
12
|
+
const now = Date.now();
|
|
13
|
+
const isoAt = (offsetMs) => new Date(now - offsetMs).toISOString();
|
|
14
|
+
const lastUpdatedDisplay = new Date(now).toLocaleString('en-US', {
|
|
15
|
+
month: 'long',
|
|
16
|
+
day: 'numeric',
|
|
17
|
+
year: 'numeric',
|
|
18
|
+
hour: 'numeric',
|
|
19
|
+
minute: '2-digit',
|
|
20
|
+
hour12: true,
|
|
21
|
+
});
|
|
22
|
+
export const defaultDetailsProps = {
|
|
23
|
+
jobType: 'fetch-customer-data',
|
|
24
|
+
lastUpdatedAt: lastUpdatedDisplay,
|
|
25
|
+
config: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
exportInterval: 'PT5M',
|
|
28
|
+
},
|
|
29
|
+
isLoadingConfig: false,
|
|
30
|
+
breadcrumb: {
|
|
31
|
+
elements: [
|
|
32
|
+
{ key: 'clusters', label: 'Clusters', href: '/clusters' },
|
|
33
|
+
{
|
|
34
|
+
key: 'cluster-123',
|
|
35
|
+
label: 'cluster-123',
|
|
36
|
+
href: '/clusters/cluster-123',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'job-dashboard',
|
|
40
|
+
label: 'Job Dashboard',
|
|
41
|
+
href: '/clusters/cluster-123/job-dashboard',
|
|
42
|
+
},
|
|
43
|
+
{ key: 'job-type', label: 'fetch-customer-data' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
onTimeRangeChange: () => { },
|
|
47
|
+
translations: {
|
|
48
|
+
title: 'Job type details',
|
|
49
|
+
lastUpdated: 'Last updated:',
|
|
50
|
+
jobTypeLabel: 'Job type:',
|
|
51
|
+
backgroundFetching: 'Loading more data...',
|
|
52
|
+
dataLimitWarning: {
|
|
53
|
+
title: 'Data limit warning',
|
|
54
|
+
description: 'Not all data could be fetched. Data limit reached',
|
|
55
|
+
},
|
|
56
|
+
charts: {
|
|
57
|
+
jobLabel: {
|
|
58
|
+
singular: 'job',
|
|
59
|
+
plural: 'jobs',
|
|
60
|
+
},
|
|
61
|
+
jobWorkload: {
|
|
62
|
+
title: 'Job workload',
|
|
63
|
+
tooltip: 'Tracks the flow of created, completed and not completed (failed, cancelled, timed out) jobs over time for the chosen Job type.',
|
|
64
|
+
subtitle: 'Jobs created, completed and not completed (failed, cancelled, timed out) over time',
|
|
65
|
+
},
|
|
66
|
+
createdVsCompleted: {
|
|
67
|
+
title: 'Created vs completed jobs',
|
|
68
|
+
tooltip: 'Indicates overall completion rate. How many created jobs were finished for the chosen job type.',
|
|
69
|
+
},
|
|
70
|
+
axes: {
|
|
71
|
+
time: 'Time',
|
|
72
|
+
numberOfJobs: 'Number of jobs',
|
|
73
|
+
},
|
|
74
|
+
legend: {
|
|
75
|
+
created: 'Created',
|
|
76
|
+
completed: 'Completed',
|
|
77
|
+
failed: 'Not completed',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
workerTable: {
|
|
81
|
+
title: 'Job worker connection',
|
|
82
|
+
headers: {
|
|
83
|
+
workerName: 'Worker name',
|
|
84
|
+
createdJobs: 'Created Jobs',
|
|
85
|
+
completedJobs: 'Completed Jobs',
|
|
86
|
+
completedJobsTooltip: 'Jobs that have finished executing successfully.',
|
|
87
|
+
failedJobs: 'Failed Jobs',
|
|
88
|
+
failedJobsTooltip: 'Jobs that encountered an error and could not complete.',
|
|
89
|
+
lastCompleted: 'Last Completed',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
errorTable: {
|
|
93
|
+
title: 'Failed Jobs by Error Type',
|
|
94
|
+
searchLabel: 'Search',
|
|
95
|
+
viewErrorsAction: 'View errors',
|
|
96
|
+
headers: {
|
|
97
|
+
errorType: 'Error Type',
|
|
98
|
+
errorMessage: 'Error Message',
|
|
99
|
+
jobsWithError: 'Job workers with errors',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
errorHandler: getErrorHandlerTranslations(),
|
|
103
|
+
dropdown: getDropdownTranslations(),
|
|
104
|
+
},
|
|
105
|
+
// The totals below (jobData.data), the per-worker breakdown (workerData),
|
|
106
|
+
// and the per-interval series (timeSeries) are kept internally consistent:
|
|
107
|
+
// workerData's completed/failed sum to jobData.data's, and timeSeries'
|
|
108
|
+
// created/completed/failed each sum to jobData.data's - unlike the
|
|
109
|
+
// previous version, where a 1200/1100/50 top-line total didn't reconcile
|
|
110
|
+
// with either the ~750/~730/~7 worker sums or the timeSeries values.
|
|
111
|
+
jobData: {
|
|
112
|
+
data: {
|
|
113
|
+
created: {
|
|
114
|
+
count: 11,
|
|
115
|
+
lastUpdatedAt: isoAt(0),
|
|
116
|
+
},
|
|
117
|
+
completed: {
|
|
118
|
+
count: 10,
|
|
119
|
+
lastUpdatedAt: isoAt(0),
|
|
120
|
+
},
|
|
121
|
+
failed: {
|
|
122
|
+
count: 3,
|
|
123
|
+
lastUpdatedAt: isoAt(0),
|
|
124
|
+
},
|
|
125
|
+
lastUpdatedAt: isoAt(0),
|
|
126
|
+
},
|
|
127
|
+
isIncomplete: false,
|
|
128
|
+
isLoading: false,
|
|
129
|
+
},
|
|
130
|
+
workerData: {
|
|
131
|
+
items: [
|
|
132
|
+
{
|
|
133
|
+
worker: 'worker-1',
|
|
134
|
+
created: {
|
|
135
|
+
count: 7,
|
|
136
|
+
lastUpdatedAt: isoAt(0),
|
|
137
|
+
},
|
|
138
|
+
completed: {
|
|
139
|
+
count: 6,
|
|
140
|
+
lastUpdatedAt: isoAt(0),
|
|
141
|
+
},
|
|
142
|
+
failed: {
|
|
143
|
+
count: 2,
|
|
144
|
+
lastUpdatedAt: isoAt(2 * MINUTE),
|
|
145
|
+
},
|
|
146
|
+
lastUpdatedAt: isoAt(0),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
worker: 'worker-2',
|
|
150
|
+
created: {
|
|
151
|
+
count: 4,
|
|
152
|
+
lastUpdatedAt: isoAt(2 * MINUTE),
|
|
153
|
+
},
|
|
154
|
+
completed: {
|
|
155
|
+
count: 4,
|
|
156
|
+
lastUpdatedAt: isoAt(2 * MINUTE),
|
|
157
|
+
},
|
|
158
|
+
failed: {
|
|
159
|
+
count: 1,
|
|
160
|
+
lastUpdatedAt: isoAt(4 * MINUTE),
|
|
161
|
+
},
|
|
162
|
+
lastUpdatedAt: isoAt(2 * MINUTE),
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
isLoading: false,
|
|
166
|
+
},
|
|
167
|
+
timeSeries: {
|
|
168
|
+
// 5 buckets spanning the full 24 hours ending at `lastUpdatedAt` (rather
|
|
169
|
+
// than a few minutes) so the x-axis actually matches the "Last 24 hours"
|
|
170
|
+
// range selected above it. Mountain-shaped (peaking mid-window) rather
|
|
171
|
+
// than a monotonic decline from unrealistically large counts. Each
|
|
172
|
+
// series' counts sum to jobData.data's total above (created: 11,
|
|
173
|
+
// completed: 10, failed: 3).
|
|
174
|
+
items: [
|
|
175
|
+
{
|
|
176
|
+
time: isoAt(24 * HOUR),
|
|
177
|
+
created: { count: 1, lastUpdatedAt: isoAt(24 * HOUR) },
|
|
178
|
+
completed: { count: 1, lastUpdatedAt: isoAt(24 * HOUR) },
|
|
179
|
+
failed: { count: 0, lastUpdatedAt: isoAt(24 * HOUR) },
|
|
180
|
+
lastUpdatedAt: isoAt(24 * HOUR),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
time: isoAt(18 * HOUR),
|
|
184
|
+
created: { count: 2, lastUpdatedAt: isoAt(18 * HOUR) },
|
|
185
|
+
completed: { count: 2, lastUpdatedAt: isoAt(18 * HOUR) },
|
|
186
|
+
failed: { count: 1, lastUpdatedAt: isoAt(18 * HOUR) },
|
|
187
|
+
lastUpdatedAt: isoAt(18 * HOUR),
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
time: isoAt(12 * HOUR),
|
|
191
|
+
created: { count: 3, lastUpdatedAt: isoAt(12 * HOUR) },
|
|
192
|
+
completed: { count: 3, lastUpdatedAt: isoAt(12 * HOUR) },
|
|
193
|
+
failed: { count: 1, lastUpdatedAt: isoAt(12 * HOUR) },
|
|
194
|
+
lastUpdatedAt: isoAt(12 * HOUR),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
time: isoAt(6 * HOUR),
|
|
198
|
+
created: { count: 3, lastUpdatedAt: isoAt(6 * HOUR) },
|
|
199
|
+
completed: { count: 2, lastUpdatedAt: isoAt(6 * HOUR) },
|
|
200
|
+
failed: { count: 1, lastUpdatedAt: isoAt(6 * HOUR) },
|
|
201
|
+
lastUpdatedAt: isoAt(6 * HOUR),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
time: isoAt(0),
|
|
205
|
+
created: { count: 2, lastUpdatedAt: isoAt(0) },
|
|
206
|
+
completed: { count: 2, lastUpdatedAt: isoAt(0) },
|
|
207
|
+
failed: { count: 0, lastUpdatedAt: isoAt(0) },
|
|
208
|
+
lastUpdatedAt: isoAt(0),
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
isLoading: false,
|
|
212
|
+
},
|
|
213
|
+
errorData: {
|
|
214
|
+
operateBaseUrl: 'https://example.camunda.io/operate',
|
|
215
|
+
// Sums to jobData.data.failed.count (3) above, instead of wildly
|
|
216
|
+
// exceeding the total number of failed jobs.
|
|
217
|
+
items: [
|
|
218
|
+
{
|
|
219
|
+
errorCode: 'UNHANDLED_ERROR_EVENT',
|
|
220
|
+
errorMessage: 'An unexpected error occurred.',
|
|
221
|
+
workers: 2,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
errorCode: 'IO_ERROR',
|
|
225
|
+
errorMessage: 'Failed to read from remote server.',
|
|
226
|
+
workers: 1,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
isLoading: false,
|
|
230
|
+
},
|
|
231
|
+
};
|