@gooddata/sdk-ui-analytical-designer 11.69.0-alpha.3 → 11.69.0-alpha.5
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/NOTICE +246 -47
- package/esm/backend.d.ts +15 -1
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js +26 -2
- package/esm/components/Report.d.ts +3 -1
- package/esm/components/Report.d.ts.map +1 -1
- package/esm/components/Report.js +13 -4
- package/esm/components/filterBar/filterBarDropdown/FilterBarDropdownBody.d.ts +2 -2
- package/esm/components/filterBar/filterBarDropdown/FilterBarDropdownBody.d.ts.map +1 -1
- package/esm/components/filterBar/filterBarDropdown/FilterBarParameterPicker.d.ts +2 -2
- package/esm/components/filterBar/filterBarDropdown/FilterBarParameterPicker.d.ts.map +1 -1
- package/esm/components/report/executionProgress/ExecutionProgressPanel.d.ts +12 -0
- package/esm/components/report/executionProgress/ExecutionProgressPanel.d.ts.map +1 -0
- package/esm/components/report/executionProgress/ExecutionProgressPanel.js +157 -0
- package/esm/components/report/executionProgress/ExecutionProgressSteps.d.ts +17 -0
- package/esm/components/report/executionProgress/ExecutionProgressSteps.d.ts.map +1 -0
- package/esm/components/report/executionProgress/ExecutionProgressSteps.js +122 -0
- package/esm/components/report/executionProgress/ExecutionStats.d.ts +10 -0
- package/esm/components/report/executionProgress/ExecutionStats.d.ts.map +1 -0
- package/esm/components/report/executionProgress/ExecutionStats.js +105 -0
- package/esm/components/report/executionProgress/timeline.d.ts +34 -0
- package/esm/components/report/executionProgress/timeline.d.ts.map +1 -0
- package/esm/components/report/executionProgress/timeline.js +51 -0
- package/esm/postMessageApi/actions/action_types.d.ts +1 -0
- package/esm/postMessageApi/actions/action_types.d.ts.map +1 -1
- package/esm/postMessageApi/actions/action_types.js +1 -0
- package/esm/postMessageApi/actions/command_error_actions.d.ts +7 -0
- package/esm/postMessageApi/actions/command_error_actions.d.ts.map +1 -1
- package/esm/postMessageApi/actions/command_error_actions.js +7 -0
- package/esm/postMessageApi/outgoing/command_error_events.d.ts +1 -0
- package/esm/postMessageApi/outgoing/command_error_events.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/command_error_events.js +7 -0
- package/esm/postMessageApi/outgoing/save_insight_events.d.ts +1 -0
- package/esm/postMessageApi/outgoing/save_insight_events.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/save_insight_events.js +7 -0
- package/esm/postMessageApi/outgoing/supported_commands_events.d.ts.map +1 -1
- package/esm/postMessageApi/outgoing/supported_commands_events.js +0 -4
- package/esm/postMessageApi/sagas/command_error_saga.d.ts +3 -2
- package/esm/postMessageApi/sagas/command_error_saga.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/command_error_saga.js +6 -1
- package/esm/postMessageApi/sagas/command_received_saga.d.ts +18 -4
- package/esm/postMessageApi/sagas/command_received_saga.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/command_received_saga.js +23 -16
- package/esm/postMessageApi/sagas/incoming_command_sagas.d.ts +5 -2
- package/esm/postMessageApi/sagas/incoming_command_sagas.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/save_insight_saga.d.ts.map +1 -1
- package/esm/postMessageApi/sagas/save_insight_saga.js +11 -2
- package/esm/reducers/combined_root_reducer.d.ts +3 -0
- package/esm/reducers/combined_root_reducer.d.ts.map +1 -1
- package/esm/reducers/combined_root_reducer.js +2 -0
- package/esm/sagas/catalog/catalog_saga.d.ts +1 -1
- package/esm/sagas/catalog/catalog_saga.d.ts.map +1 -1
- package/esm/sagas/catalog/catalog_saga.js +4 -3
- package/esm/sagas/open_report_sagas.d.ts +1 -1
- package/esm/sagas/open_report_sagas.d.ts.map +1 -1
- package/esm/sagas/sagas.d.ts +5 -2
- package/esm/sagas/sagas.d.ts.map +1 -1
- package/esm/sagas/sagas.js +4 -0
- package/esm/selectors/feature_flag_selector.d.ts +23 -2
- package/esm/selectors/feature_flag_selector.d.ts.map +1 -1
- package/esm/selectors/feature_flag_selector.js +2 -0
- package/esm/selectors/report_visualization_selector.d.ts +12 -0
- package/esm/selectors/report_visualization_selector.d.ts.map +1 -1
- package/esm/services/buckets_service.d.ts +1 -0
- package/esm/services/buckets_service.d.ts.map +1 -1
- package/esm/store/catalog/catalog_reducer.d.ts +2 -2
- package/esm/store/catalog/catalog_reducer.d.ts.map +1 -1
- package/esm/store/catalog/catalog_selector.d.ts +4 -4
- package/esm/store/catalog/catalog_store_actions.d.ts +3 -3
- package/esm/store/catalog/catalog_store_actions.d.ts.map +1 -1
- package/esm/store/catalog/catalog_types.d.ts +2 -2
- package/esm/store/catalog/catalog_types.d.ts.map +1 -1
- package/esm/store/execution_progress/execution_loading_view_model.d.ts +72 -0
- package/esm/store/execution_progress/execution_loading_view_model.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_loading_view_model.js +122 -0
- package/esm/store/execution_progress/execution_progress_actions.d.ts +42 -0
- package/esm/store/execution_progress/execution_progress_actions.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_actions.js +19 -0
- package/esm/store/execution_progress/execution_progress_mock.d.ts +31 -0
- package/esm/store/execution_progress/execution_progress_mock.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_mock.js +458 -0
- package/esm/store/execution_progress/execution_progress_saga.d.ts +56 -0
- package/esm/store/execution_progress/execution_progress_saga.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_saga.js +226 -0
- package/esm/store/execution_progress/execution_progress_selectors.d.ts +66 -0
- package/esm/store/execution_progress/execution_progress_selectors.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_selectors.js +7 -0
- package/esm/store/execution_progress/execution_progress_slice.d.ts +4 -0
- package/esm/store/execution_progress/execution_progress_slice.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_slice.js +95 -0
- package/esm/store/execution_progress/execution_progress_state.d.ts +54 -0
- package/esm/store/execution_progress/execution_progress_state.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_state.js +12 -0
- package/esm/store/execution_progress/execution_progress_view_model.d.ts +136 -0
- package/esm/store/execution_progress/execution_progress_view_model.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_progress_view_model.js +378 -0
- package/esm/store/execution_progress/execution_stats_view_model.d.ts +42 -0
- package/esm/store/execution_progress/execution_stats_view_model.d.ts.map +1 -0
- package/esm/store/execution_progress/execution_stats_view_model.js +51 -0
- package/esm/store/filter_bar/parameter_filter_actions.d.ts +3 -3
- package/esm/store/filter_bar/parameter_filter_actions.d.ts.map +1 -1
- package/esm/store/filter_bar/parameter_filter_service.d.ts +3 -3
- package/esm/store/filter_bar/parameter_filter_service.d.ts.map +1 -1
- package/esm/store/filter_bar/parameter_filter_types.d.ts +2 -2
- package/esm/store/filter_bar/parameter_filter_types.d.ts.map +1 -1
- package/esm/store/types.d.ts +3 -0
- package/esm/store/types.d.ts.map +1 -1
- package/esm/tests/parameter.test.helpers.d.ts +2 -2
- package/esm/tests/parameter.test.helpers.d.ts.map +1 -1
- package/esm/translations/de-DE.json +49 -0
- package/esm/translations/en-AU.json +49 -0
- package/esm/translations/en-GB.json +49 -0
- package/esm/translations/en-US.json +180 -0
- package/esm/translations/es-419.json +49 -0
- package/esm/translations/es-ES.json +49 -0
- package/esm/translations/fi-FI.json +49 -0
- package/esm/translations/fr-CA.json +49 -0
- package/esm/translations/fr-FR.json +49 -0
- package/esm/translations/id-ID.json +49 -0
- package/esm/translations/it-IT.json +49 -0
- package/esm/translations/ja-JP.json +49 -0
- package/esm/translations/ko-KR.json +48 -0
- package/esm/translations/nl-NL.json +49 -0
- package/esm/translations/pl-PL.json +49 -0
- package/esm/translations/pt-BR.json +49 -0
- package/esm/translations/pt-PT.json +49 -0
- package/esm/translations/ru-RU.json +49 -0
- package/esm/translations/sl-SI.json +49 -0
- package/esm/translations/th-TH.json +49 -0
- package/esm/translations/tr-TR.json +49 -0
- package/esm/translations/uk-UA.json +49 -0
- package/esm/translations/vi-VN.json +49 -0
- package/esm/translations/zh-HK.json +49 -0
- package/esm/translations/zh-Hans.json +49 -0
- package/esm/translations/zh-Hant.json +49 -0
- package/package.json +21 -22
- package/styles/css/execution_progress.css +486 -0
- package/styles/css/execution_progress.css.map +1 -0
- package/styles/css/main.css +485 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/_ad_partials.scss +1 -0
- package/styles/scss/execution_progress.scss +547 -0
package/esm/components/Report.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2007-2026 GoodData Corporation
|
|
3
3
|
import { memo } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { useSelector } from "react-redux";
|
|
6
|
+
import { isExecutionProgressEnabled } from "../selectors/feature_flag_selector.js";
|
|
6
7
|
import { reportSelector } from "../selectors/report_selector.js";
|
|
8
|
+
import { ExecutionProgressPanel } from "./report/executionProgress/ExecutionProgressPanel.js";
|
|
9
|
+
import { ExecutionStats } from "./report/executionProgress/ExecutionStats.js";
|
|
7
10
|
import { ReportBlank } from "./report/ReportBlank.js";
|
|
8
11
|
import { ReportComputing } from "./report/ReportComputing.js";
|
|
9
12
|
import { ReportCustomError } from "./report/ReportCustomError.js";
|
|
@@ -21,7 +24,7 @@ import { ReportTooLargeToDisplay } from "./report/ReportTooLargeToDisplay.js";
|
|
|
21
24
|
import { ReportUnsupportedConfiguration } from "./report/ReportUnsupportedConfiguration.js";
|
|
22
25
|
import { ReportVisualization } from "./report/ReportVisualization.js";
|
|
23
26
|
import { WorkspaceEmpty } from "./report/WorkspaceEmpty.js";
|
|
24
|
-
export const ReportBase = memo(function Report({ projectId = null, appSessionId, messages = {}, isSmallScreen = false, isExecutionRunning = false, isReportNotFound = false, reportNotFoundMissingItems, isReportTooLargeToCompute = false, isReportTooLargeToDisplay = false, isInvalidConfiguration = false, isReportWithFiltersEmpty = false, isReportWithoutFiltersEmpty = false, isBadRequest = false, isReportProtected = false, isMissingLocation = false, isMissingArea = false, isMissingMetric = false, isMissingColumns = false, isExecutable = false, isComputingShortcut = false, isNoMetricSupported, hasNegativeValue = false, unsupportedConfiguration = false, hasReportLoadingError = false, customError = null, }) {
|
|
27
|
+
export const ReportBase = memo(function Report({ projectId = null, appSessionId, messages = {}, isSmallScreen = false, isExecutionRunning = false, isReportNotFound = false, reportNotFoundMissingItems, isReportTooLargeToCompute = false, isReportTooLargeToDisplay = false, isInvalidConfiguration = false, isReportWithFiltersEmpty = false, isReportWithoutFiltersEmpty = false, isBadRequest = false, isReportProtected = false, isMissingLocation = false, isMissingArea = false, isMissingMetric = false, isMissingColumns = false, isExecutable = false, isComputingShortcut = false, isNoMetricSupported, hasNegativeValue = false, unsupportedConfiguration = false, hasReportLoadingError = false, customError = null, isExecutionProgressEnabled = false, }) {
|
|
25
28
|
const getReportErrorComponent = () => {
|
|
26
29
|
if (hasReportLoadingError) {
|
|
27
30
|
return ReportBlank; // we do not render specific error for now, only red toast message
|
|
@@ -79,10 +82,16 @@ export const ReportBase = memo(function Report({ projectId = null, appSessionId,
|
|
|
79
82
|
const ErrorComponent = getReportErrorComponent();
|
|
80
83
|
const className = classNames({
|
|
81
84
|
"invisible-report-visualization": ErrorComponent !== null,
|
|
85
|
+
"adi-execution-stats-enabled": isExecutionProgressEnabled,
|
|
82
86
|
});
|
|
83
|
-
|
|
87
|
+
// The progress panel takes the spinner's place while the report executes. It stays mounted
|
|
88
|
+
// whatever the outcome is (visualization, empty or error state), and overlays it for a moment
|
|
89
|
+
// after the execution settled so the final progress is readable; it renders nothing otherwise.
|
|
90
|
+
const replacesSpinner = isExecutionProgressEnabled && ErrorComponent === ReportComputing && isExecutionRunning;
|
|
91
|
+
return (_jsxs("div", { className: className, children: [isExecutionProgressEnabled ? (_jsxs(_Fragment, { children: [_jsx(ExecutionProgressPanel, { isExecutionRunning: isExecutionRunning }), isExecutable ? _jsx(ExecutionStats, { isExecutionRunning: isExecutionRunning }) : null] })) : null, replacesSpinner ? null : ErrorComponent === ReportNotFound ? (_jsx(ReportNotFound, { missingItems: reportNotFoundMissingItems })) : ErrorComponent === null ? null : (_jsx(ErrorComponent, { isSmallScreen: isSmallScreen })), _jsx(ReportVisualization, { projectId: projectId, appSessionId: appSessionId, messages: messages }, appSessionId)] }));
|
|
84
92
|
});
|
|
85
93
|
export function Report({ isSmallScreen }) {
|
|
86
94
|
const reportProps = useSelector(reportSelector);
|
|
87
|
-
|
|
95
|
+
const executionProgressEnabled = useSelector(isExecutionProgressEnabled);
|
|
96
|
+
return (_jsx(ReportBase, { ...reportProps, isSmallScreen: isSmallScreen, isExecutionProgressEnabled: executionProgressEnabled }));
|
|
88
97
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IScalarParameterMetadataObject } from "@gooddata/sdk-model";
|
|
2
2
|
import { type IAddFilterItem, type RankingFilterDisabledReason } from "./filterBarDropdownUtils.js";
|
|
3
3
|
export interface IFilterBarDropdownBodyOwnProps {
|
|
4
4
|
onClose: () => void;
|
|
@@ -6,7 +6,7 @@ export interface IFilterBarDropdownBodyOwnProps {
|
|
|
6
6
|
onAddDateFilter: () => void;
|
|
7
7
|
onAddRankingFilter: () => void;
|
|
8
8
|
onAddRankingFilterFromMetric: (items: IAddFilterItem[]) => void;
|
|
9
|
-
onAddParameters: (parameters: ReadonlyArray<
|
|
9
|
+
onAddParameters: (parameters: ReadonlyArray<IScalarParameterMetadataObject>) => void;
|
|
10
10
|
rankingDisabledReason: RankingFilterDisabledReason | undefined;
|
|
11
11
|
isDateItemAvailable: boolean;
|
|
12
12
|
enableImprovedRankingFilter: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBarDropdownBody.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/filterBarDropdown/FilterBarDropdownBody.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"FilterBarDropdownBody.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/filterBarDropdown/FilterBarDropdownBody.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAK1E,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAKpG,MAAM,WAAW,8BAA8B;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,4BAA4B,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAChE,eAAe,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,IAAI,CAAC;IACrF,qBAAqB,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAC/D,mBAAmB,EAAE,OAAO,CAAC;IAC7B,2BAA2B,EAAE,OAAO,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AAEzE,wBAAgB,qBAAqB,CAAC,EAClC,OAAO,EACP,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,aAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,eAAe,GAClB,EAAE,2BAA2B,2CAuD7B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IScalarParameterMetadataObject } from "@gooddata/sdk-model";
|
|
2
2
|
export interface IFilterBarParameterPickerProps {
|
|
3
3
|
maxListHeight: number;
|
|
4
4
|
onBack: () => void;
|
|
5
5
|
onClose: () => void;
|
|
6
|
-
onAdd: (parameters: ReadonlyArray<
|
|
6
|
+
onAdd: (parameters: ReadonlyArray<IScalarParameterMetadataObject>) => void;
|
|
7
7
|
}
|
|
8
8
|
export declare function FilterBarParameterPicker({ maxListHeight, onBack, onClose, onAdd, }: IFilterBarParameterPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
//# sourceMappingURL=FilterBarParameterPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBarParameterPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/filterBarDropdown/FilterBarParameterPicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"FilterBarParameterPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/filterBar/filterBarDropdown/FilterBarParameterPicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAM1E,MAAM,WAAW,8BAA8B;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,IAAI,CAAC;CAC9E;AAED,wBAAgB,wBAAwB,CAAC,EACrC,aAAa,EACb,MAAM,EACN,OAAO,EACP,KAAK,GACR,EAAE,8BAA8B,2CA8BhC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IExecutionProgressPanelProps {
|
|
2
|
+
isExecutionRunning: boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* The loading view of the report execution, in place of the computing spinner: the "Rendering
|
|
6
|
+
* visualisation" header, with the sub-steps appended below it (revealed one by one) when the data comes
|
|
7
|
+
* from the data source. Falls back to the spinner when no progress arrives.
|
|
8
|
+
*
|
|
9
|
+
* Everything sits in one fixed-width box, so the block keeps its place while the text changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ExecutionProgressPanel({ isExecutionRunning }: IExecutionProgressPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=ExecutionProgressPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionProgressPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/report/executionProgress/ExecutionProgressPanel.tsx"],"names":[],"mappings":"AA4CA,MAAM,WAAW,4BAA4B;IACzC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,kBAAkB,EAAE,EAAE,4BAA4B,kDA8C1F"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { useSelector } from "react-redux";
|
|
7
|
+
import { UiAiThinkingIcon, UiIconButton } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
import { advanceStepReveal, buildExecutionLoadingViewModel, initialStepRevealState, loadingStepDuration, nextStepRevealAt, revealedLoadingSteps, } from "../../../store/execution_progress/execution_loading_view_model.js";
|
|
9
|
+
import { getExecutionProgressViewModel } from "../../../store/execution_progress/execution_progress_selectors.js";
|
|
10
|
+
import { ReportComputing } from "../ReportComputing.js";
|
|
11
|
+
import { dataSourceLabel } from "./ExecutionProgressSteps.js";
|
|
12
|
+
import { computeGanttBars } from "./timeline.js";
|
|
13
|
+
/** no progress event by then: the generic spinner is shown instead */
|
|
14
|
+
const NO_EVENT_FALLBACK_MS = 1500;
|
|
15
|
+
/** the stream may lag behind a settled report execution at most this long */
|
|
16
|
+
const MAX_STREAM_LAG_MS = 10_000;
|
|
17
|
+
const TICK_MS = 250;
|
|
18
|
+
function useNow(enabled) {
|
|
19
|
+
const [now, setNow] = useState(() => Date.now());
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!enabled) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
setNow(Date.now());
|
|
25
|
+
const timer = setInterval(() => setNow(Date.now()), TICK_MS);
|
|
26
|
+
return () => clearInterval(timer);
|
|
27
|
+
}, [enabled]);
|
|
28
|
+
return now;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The loading view of the report execution, in place of the computing spinner: the "Rendering
|
|
32
|
+
* visualisation" header, with the sub-steps appended below it (revealed one by one) when the data comes
|
|
33
|
+
* from the data source. Falls back to the spinner when no progress arrives.
|
|
34
|
+
*
|
|
35
|
+
* Everything sits in one fixed-width box, so the block keeps its place while the text changes.
|
|
36
|
+
*/
|
|
37
|
+
export function ExecutionProgressPanel({ isExecutionRunning }) {
|
|
38
|
+
const viewModel = useSelector(getExecutionProgressViewModel);
|
|
39
|
+
// the view follows a stream that lags behind the settled report (e.g. a mocked stream); a
|
|
40
|
+
// finished stream closes it at once — there is no hold after the finish
|
|
41
|
+
const streamLagging = !viewModel.unavailable &&
|
|
42
|
+
viewModel.hasEvents &&
|
|
43
|
+
(viewModel.phase === "running" || viewModel.phase === "waiting") &&
|
|
44
|
+
viewModel.reportFinishedAt !== undefined &&
|
|
45
|
+
Date.now() - viewModel.reportFinishedAt < MAX_STREAM_LAG_MS;
|
|
46
|
+
const active = isExecutionRunning || streamLagging;
|
|
47
|
+
const now = useNow(active);
|
|
48
|
+
// the view re-renders on every tick; the steps change only with the progress
|
|
49
|
+
const loading = useMemo(() => buildExecutionLoadingViewModel(viewModel), [viewModel]);
|
|
50
|
+
if (!active) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const showsProgress = viewModel.source === "browserCache" ||
|
|
54
|
+
viewModel.hasEvents ||
|
|
55
|
+
(!viewModel.unavailable &&
|
|
56
|
+
(viewModel.reportStartedAt === undefined ||
|
|
57
|
+
now - viewModel.reportStartedAt < NO_EVENT_FALLBACK_MS));
|
|
58
|
+
if (!showsProgress) {
|
|
59
|
+
return isExecutionRunning ? _jsx(ReportComputing, {}) : null;
|
|
60
|
+
}
|
|
61
|
+
return (_jsx("div", { className: "adi-execution-progress s-execution-progress", "data-phase": viewModel.phase, "data-mode": loading.mode, "data-cache-hit": viewModel.cacheHit || viewModel.source === "browserCache" ? "true" : undefined, children: _jsx("div", { className: "adi-execution-progress-box", children: _jsx(LoadingSteps, { steps: loading.steps, serverNow: now - viewModel.clockOffsetMs }, viewModel.reportStartedAt ?? "none") }) }));
|
|
62
|
+
}
|
|
63
|
+
const COLLAPSED_STORAGE_KEY = "adi-execution-progress-collapsed";
|
|
64
|
+
function readCollapsed() {
|
|
65
|
+
try {
|
|
66
|
+
return window.localStorage?.getItem(COLLAPSED_STORAGE_KEY) === "true";
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function writeCollapsed(collapsed) {
|
|
73
|
+
try {
|
|
74
|
+
window.localStorage?.setItem(COLLAPSED_STORAGE_KEY, String(collapsed));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// a convenience only: without storage the state is not remembered
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The persistent "Rendering visualisation" header with the animated sparkle and, once there are
|
|
82
|
+
* sub-steps, the collapse toggle; below it the sub-steps revealed so far in chronological order, at
|
|
83
|
+
* least STEP_REVEAL_GAP_MS apart even when they started together.
|
|
84
|
+
*/
|
|
85
|
+
function LoadingSteps({ steps, serverNow }) {
|
|
86
|
+
const intl = useIntl();
|
|
87
|
+
const [reveal, setReveal] = useState(initialStepRevealState);
|
|
88
|
+
const [collapsed, setCollapsed] = useState(readCollapsed);
|
|
89
|
+
const started = steps.length;
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const dueAt = nextStepRevealAt(reveal, started);
|
|
92
|
+
if (dueAt === undefined) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
const timer = setTimeout(() => setReveal((current) => advanceStepReveal(current, started, Date.now())), Math.max(0, dueAt - Date.now()));
|
|
96
|
+
return () => clearTimeout(timer);
|
|
97
|
+
}, [reveal, started]);
|
|
98
|
+
const shown = revealedLoadingSteps(steps, Math.min(reveal.revealed, started));
|
|
99
|
+
const header = intl.formatMessage({ id: "executionProgress.loading.render" });
|
|
100
|
+
const toggleLabel = collapsed
|
|
101
|
+
? intl.formatMessage({ id: "executionProgress.toggle.expand" })
|
|
102
|
+
: intl.formatMessage({ id: "executionProgress.toggle.collapse" });
|
|
103
|
+
const toggle = () => {
|
|
104
|
+
setCollapsed(!collapsed);
|
|
105
|
+
writeCollapsed(!collapsed);
|
|
106
|
+
};
|
|
107
|
+
// only the step transitions are announced, not the ticking durations or the toggle
|
|
108
|
+
const latest = shown[shown.length - 1];
|
|
109
|
+
const announcement = latest ? loadingStepLabel(intl, latest) : header;
|
|
110
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", role: "status", "aria-live": "polite", children: announcement }), _jsxs("div", { className: "adi-execution-progress-header s-execution-progress-header", children: [_jsx("span", { className: "adi-execution-progress-step-marker", children: _jsx(UiAiThinkingIcon, {}) }), _jsx("span", { className: "adi-execution-progress-header-label", title: header, children: header }), shown.length > 0 ? (_jsx("span", { className: "adi-execution-progress-toggle", children: _jsx(UiIconButton, { icon: collapsed ? "chevronDown" : "chevronUp", size: "medium", variant: "tertiary", label: toggleLabel, onClick: toggle, dataTestId: "s-execution-progress-toggle", ariaAttributes: { role: "button", "aria-expanded": !collapsed } }) })) : null] }), shown.length > 0 && !collapsed ? (_jsx("ol", { className: "adi-execution-progress-list s-execution-progress-list", children: shown.map((step) => (_jsx(LoadingStep, { step: step, serverNow: serverNow }, step.kind))) })) : null] }));
|
|
111
|
+
}
|
|
112
|
+
function LoadingStep({ step, serverNow }) {
|
|
113
|
+
const intl = useIntl();
|
|
114
|
+
const duration = loadingStepDuration(step, serverNow);
|
|
115
|
+
const label = loadingStepLabel(intl, step);
|
|
116
|
+
return (_jsxs("li", { className: classNames("adi-execution-progress-step", "s-execution-progress-step", `s-execution-progress-step-${step.kind}`, `is-${step.state}`), "data-step": step.kind, "data-state": step.state, children: [_jsxs("div", { className: "adi-execution-progress-step-row", children: [_jsx("span", { className: "adi-execution-progress-step-marker", "aria-hidden": "true", children: _jsx("span", { className: "adi-execution-progress-dot" }) }), _jsx("span", { className: "adi-execution-progress-step-label", title: label, children: label }), _jsx("span", { className: "adi-execution-progress-step-duration s-execution-progress-step-duration", children: duration ?? "" })] }), step.kind === "query" && step.sources && step.sources.length > 1 ? (_jsx(LoadingSources, { step: step, serverNow: serverNow })) : null] }));
|
|
117
|
+
}
|
|
118
|
+
function loadingStepLabel(intl, step) {
|
|
119
|
+
switch (step.kind) {
|
|
120
|
+
case "cache":
|
|
121
|
+
return intl.formatMessage({ id: "executionProgress.loading.cache" });
|
|
122
|
+
case "prepare":
|
|
123
|
+
return intl.formatMessage({ id: "executionProgress.loading.prepare" });
|
|
124
|
+
case "query":
|
|
125
|
+
return step.dataSourceId && !(step.sources && step.sources.length > 1)
|
|
126
|
+
? intl.formatMessage({ id: "executionProgress.loading.query.dataSource" }, { dataSource: dataSourceLabel(step.dataSourceId, step.dataSourceName) })
|
|
127
|
+
: intl.formatMessage({ id: "executionProgress.loading.query" });
|
|
128
|
+
case "render":
|
|
129
|
+
return intl.formatMessage({ id: "executionProgress.loading.render" });
|
|
130
|
+
default:
|
|
131
|
+
return "";
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** the federated data sources: one row each, the slowest highlighted */
|
|
135
|
+
function LoadingSources({ step, serverNow }) {
|
|
136
|
+
const intl = useIntl();
|
|
137
|
+
const sources = step.sources ?? [];
|
|
138
|
+
const spanStart = step.startedAt ?? serverNow;
|
|
139
|
+
const spanEnd = step.finishedAt ?? serverNow;
|
|
140
|
+
const bars = new Map(computeGanttBars(sources.map((source) => ({
|
|
141
|
+
id: source.resultId,
|
|
142
|
+
startedAt: source.startedAt,
|
|
143
|
+
finishedAt: source.finishedAt,
|
|
144
|
+
})), spanStart, spanEnd).map((bar) => [bar.id, bar]));
|
|
145
|
+
const slowest = sources.find((source) => source.resultId === step.slowestSourceResultId);
|
|
146
|
+
const waitingOn = step.state === "running" && slowest?.dataSourceId
|
|
147
|
+
? intl.formatMessage({ id: "executionProgress.waitingOn" }, { dataSource: dataSourceLabel(slowest.dataSourceId, slowest.dataSourceName) })
|
|
148
|
+
: undefined;
|
|
149
|
+
return (_jsxs("div", { className: "adi-execution-progress-federation", children: [waitingOn ? (_jsx("div", { className: "adi-execution-progress-waiting s-execution-progress-waiting", title: waitingOn, children: waitingOn })) : null, _jsx("ul", { className: "adi-execution-progress-sources", children: sources.map((source) => {
|
|
150
|
+
const bar = bars.get(source.resultId);
|
|
151
|
+
const duration = loadingStepDuration(source, serverNow);
|
|
152
|
+
const name = source.dataSourceId
|
|
153
|
+
? dataSourceLabel(source.dataSourceId, source.dataSourceName)
|
|
154
|
+
: source.resultId;
|
|
155
|
+
return (_jsxs("li", { className: classNames("adi-execution-progress-source", "s-execution-progress-source", `is-${source.state}`, { "is-slowest": source.resultId === step.slowestSourceResultId }), "data-data-source": source.dataSourceId, "data-state": source.state, children: [_jsx("span", { className: "adi-execution-progress-source-name", title: name, children: name }), _jsx("span", { className: "adi-execution-progress-source-track", children: bar ? (_jsx("span", { className: "adi-execution-progress-source-bar", style: { left: `${bar.offsetPct}%`, width: `${bar.widthPct}%` } })) : null }), _jsx("span", { className: "adi-execution-progress-source-duration", children: duration ?? "" })] }, source.resultId));
|
|
156
|
+
}) })] }));
|
|
157
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ExecutionCacheSaving, type IExecutionProgressStepViewModel } from "../../../store/execution_progress/execution_progress_view_model.js";
|
|
2
|
+
/** the largest whole unit of a time span in the past, e.g. [-2, "hour"] */
|
|
3
|
+
export declare function toRelativeTime(agoMs: number): [number, Intl.RelativeTimeFormatUnit];
|
|
4
|
+
export declare function ExecutionProgressSteps({ steps, serverNow, }: {
|
|
5
|
+
steps: IExecutionProgressStepViewModel[];
|
|
6
|
+
serverNow: number;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
/** the display name of a data source; its id when the backend could not resolve the name */
|
|
9
|
+
export declare function dataSourceLabel(dataSourceId: string, dataSourceName?: string): string;
|
|
10
|
+
/** the original end-to-end time; "~" when it ends before the post-processing */
|
|
11
|
+
export declare function formatOriginalTotal(totalDurationMs: number, approximate?: boolean): string;
|
|
12
|
+
/** what a cache hit saved: the time when it is meaningful, otherwise the queries not run */
|
|
13
|
+
export declare function CacheSaving({ saving, className }: {
|
|
14
|
+
saving: ExecutionCacheSaving;
|
|
15
|
+
className: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=ExecutionProgressSteps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionProgressSteps.d.ts","sourceRoot":"","sources":["../../../../src/components/report/executionProgress/ExecutionProgressSteps.tsx"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,oBAAoB,EAEzB,KAAK,+BAA+B,EACvC,MAAM,oEAAoE,CAAC;AAc5E,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAInF;AAED,wBAAgB,sBAAsB,CAAC,EACnC,KAAK,EACL,SAAS,GACZ,EAAE;IACC,KAAK,EAAE,+BAA+B,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;CACrB,2CA6BA;AA4LD,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAErF;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAE1F;AAmDD,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,2CAmBrG"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
4
|
+
import { computeGanttBars, computeSegments, formatDuration } from "./timeline.js";
|
|
5
|
+
// The detailed step list of an execution (timeline, steps, federation bars, query breakdown) and
|
|
6
|
+
// helpers shared by the execution stats popover.
|
|
7
|
+
const RELATIVE_UNITS = [
|
|
8
|
+
["day", 24 * 60 * 60 * 1000],
|
|
9
|
+
["hour", 60 * 60 * 1000],
|
|
10
|
+
["minute", 60 * 1000],
|
|
11
|
+
["second", 1000],
|
|
12
|
+
];
|
|
13
|
+
/** the largest whole unit of a time span in the past, e.g. [-2, "hour"] */
|
|
14
|
+
export function toRelativeTime(agoMs) {
|
|
15
|
+
const ms = Math.max(agoMs, 0);
|
|
16
|
+
const [unit, size] = RELATIVE_UNITS.find(([, unitMs]) => ms >= unitMs) ?? RELATIVE_UNITS[3];
|
|
17
|
+
return [-Math.floor(ms / size), unit];
|
|
18
|
+
}
|
|
19
|
+
export function ExecutionProgressSteps({ steps, serverNow, }) {
|
|
20
|
+
const segments = computeSegments(steps.map((step) => ({ id: step.kind, startedAt: step.startedAt, finishedAt: step.finishedAt })), serverNow);
|
|
21
|
+
const stateByKind = new Map(steps.map((step) => [step.kind, step.state]));
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "adi-execution-progress-timeline", "aria-hidden": "true", children: segments.map((segment) => (_jsx("div", { className: classNames("adi-execution-progress-timeline-segment", `is-${segment.id}`, `is-${stateByKind.get(segment.id)}`), style: { width: `${segment.widthPct}%` } }, segment.id))) }), _jsx("ol", { className: "adi-execution-progress-steps", children: steps.map((step) => (_jsx(Step, { step: step, serverNow: serverNow }, step.kind))) })] }));
|
|
23
|
+
}
|
|
24
|
+
function Step({ step, serverNow }) {
|
|
25
|
+
const durationMs = step.startedAt === undefined ? undefined : (step.finishedAt ?? serverNow) - step.startedAt;
|
|
26
|
+
return (_jsxs("li", { className: classNames("adi-execution-progress-step", "s-execution-progress-step", `s-execution-progress-step-${step.kind}`, `is-${step.state}`), "data-step": step.kind, "data-state": step.state, children: [_jsxs("div", { className: "adi-execution-progress-step-row", children: [_jsx("span", { className: "adi-execution-progress-step-indicator", "aria-hidden": "true" }), _jsx("span", { className: "adi-execution-progress-step-label", children: _jsx(StepLabel, { step: step }) }), step.state === "running" && step.kind === "federation" ? _jsx(WaitingOn, { step: step }) : null, _jsx("span", { className: "adi-execution-progress-step-duration", children: durationMs === undefined ? "" : formatDuration(durationMs) })] }), step.kind === "federation" && step.sources ? (_jsx(FederationSources, { step: step, serverNow: serverNow })) : null, step.kind === "query" && step.state === "done" && step.queryBreakdown ? (_jsx(QueryBreakdown, { breakdown: step.queryBreakdown })) : null] }));
|
|
27
|
+
}
|
|
28
|
+
function StepLabel({ step }) {
|
|
29
|
+
switch (step.kind) {
|
|
30
|
+
case "preparing":
|
|
31
|
+
return _jsx(FormattedMessage, { id: "executionProgress.step.preparing" });
|
|
32
|
+
case "sqlGeneration":
|
|
33
|
+
return _jsx(FormattedMessage, { id: "executionProgress.step.sqlGeneration" });
|
|
34
|
+
case "federation":
|
|
35
|
+
return (_jsx(FormattedMessage, { id: "executionProgress.step.federation", values: { count: step.sources?.length ?? 0 } }));
|
|
36
|
+
case "query":
|
|
37
|
+
if (step.cacheHit) {
|
|
38
|
+
return _jsx(FormattedMessage, { id: "executionProgress.step.query.rawCache" });
|
|
39
|
+
}
|
|
40
|
+
return step.dataSourceId ? (_jsx(FormattedMessage, { id: "executionProgress.step.query", values: {
|
|
41
|
+
dataSource: (_jsx("strong", { title: step.dataSourceId, children: dataSourceLabel(step.dataSourceId, step.dataSourceName) })),
|
|
42
|
+
} })) : (_jsx(FormattedMessage, { id: "executionProgress.step.query.unknown" }));
|
|
43
|
+
case "postprocessing":
|
|
44
|
+
return step.postprocessingTypes && step.postprocessingTypes.length > 0 ? (_jsx(FormattedMessage, { id: "executionProgress.step.postprocessing.types", values: { types: step.postprocessingTypes.join(", ") } })) : (_jsx(FormattedMessage, { id: "executionProgress.step.postprocessing" }));
|
|
45
|
+
default:
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function WaitingOn({ step }) {
|
|
50
|
+
const slowest = step.sources?.find((source) => source.resultId === step.slowestSourceResultId);
|
|
51
|
+
if (!slowest?.dataSourceId) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return (_jsx("span", { className: "adi-execution-progress-waiting s-execution-progress-waiting", title: slowest.dataSourceId, children: _jsx(FormattedMessage, { id: "executionProgress.waitingOn", values: { dataSource: dataSourceLabel(slowest.dataSourceId, slowest.dataSourceName) } }) }));
|
|
55
|
+
}
|
|
56
|
+
function FederationSources({ step, serverNow, }) {
|
|
57
|
+
const intl = useIntl();
|
|
58
|
+
const sources = step.sources ?? [];
|
|
59
|
+
const spanStart = step.startedAt ?? serverNow;
|
|
60
|
+
const spanEnd = step.finishedAt ?? serverNow;
|
|
61
|
+
const bars = new Map(computeGanttBars(sources.map((source) => ({
|
|
62
|
+
id: source.resultId,
|
|
63
|
+
startedAt: source.startedAt,
|
|
64
|
+
finishedAt: source.finishedAt,
|
|
65
|
+
})), spanStart, spanEnd).map((bar) => [bar.id, bar]));
|
|
66
|
+
return (_jsx("ul", { className: "adi-execution-progress-sources", children: sources.map((source) => {
|
|
67
|
+
const bar = bars.get(source.resultId);
|
|
68
|
+
const isSlowest = source.resultId === step.slowestSourceResultId && sources.length > 1;
|
|
69
|
+
const durationMs = source.startedAt === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: (source.finishedAt ?? serverNow) - source.startedAt;
|
|
72
|
+
const queuedPct = source.queuedMs !== undefined && durationMs
|
|
73
|
+
? Math.min((source.queuedMs / durationMs) * 100, 100)
|
|
74
|
+
: 0;
|
|
75
|
+
return (_jsxs("li", { className: classNames("adi-execution-progress-source", "s-execution-progress-source", `is-${source.state}`, { "is-slowest": isSlowest }), "data-data-source": source.dataSourceId, "data-state": source.state, children: [_jsx("span", { className: "adi-execution-progress-source-name", title: source.dataSourceId, children: source.dataSourceId
|
|
76
|
+
? dataSourceLabel(source.dataSourceId, source.dataSourceName)
|
|
77
|
+
: source.resultId }), _jsx("span", { className: "adi-execution-progress-source-track", children: bar ? (_jsx("span", { className: "adi-execution-progress-source-bar", style: { left: `${bar.offsetPct}%`, width: `${bar.widthPct}%` }, children: queuedPct > 0 ? (_jsx("span", { className: "adi-execution-progress-source-bar-queued", style: { width: `${queuedPct}%` } })) : null })) : null }), _jsxs("span", { className: "adi-execution-progress-source-duration", children: [source.cacheHit
|
|
78
|
+
? intl.formatMessage({ id: "executionProgress.source.cacheHit" })
|
|
79
|
+
: durationMs === undefined
|
|
80
|
+
? ""
|
|
81
|
+
: formatDuration(durationMs), source.queuedMs === undefined
|
|
82
|
+
? ""
|
|
83
|
+
: ` · ${intl.formatMessage({ id: "executionProgress.source.queued" }, { duration: formatDuration(source.queuedMs) })}`] })] }, source.resultId));
|
|
84
|
+
}) }));
|
|
85
|
+
}
|
|
86
|
+
/** the display name of a data source; its id when the backend could not resolve the name */
|
|
87
|
+
export function dataSourceLabel(dataSourceId, dataSourceName) {
|
|
88
|
+
return dataSourceName || dataSourceId;
|
|
89
|
+
}
|
|
90
|
+
/** the original end-to-end time; "~" when it ends before the post-processing */
|
|
91
|
+
export function formatOriginalTotal(totalDurationMs, approximate) {
|
|
92
|
+
return `${approximate ? "~" : ""}${formatDuration(totalDurationMs)}`;
|
|
93
|
+
}
|
|
94
|
+
const QUERY_PARTS = [
|
|
95
|
+
{ part: "waiting", key: "waitingMs", label: _jsx(FormattedMessage, { id: "executionProgress.query.waiting" }) },
|
|
96
|
+
{
|
|
97
|
+
part: "database",
|
|
98
|
+
key: "databaseMs",
|
|
99
|
+
label: _jsx(FormattedMessage, { id: "executionProgress.query.database" }),
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
part: "transfer",
|
|
103
|
+
key: "transferMs",
|
|
104
|
+
label: _jsx(FormattedMessage, { id: "executionProgress.query.transfer" }),
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
/** where the time of the finished query went: the parts add up to the step's duration */
|
|
108
|
+
function QueryBreakdown({ breakdown }) {
|
|
109
|
+
const totalMs = breakdown.waitingMs + breakdown.databaseMs + breakdown.transferMs;
|
|
110
|
+
let offsetMs = 0;
|
|
111
|
+
return (_jsx("ul", { className: "adi-execution-progress-sources adi-execution-progress-query-breakdown s-execution-progress-query-breakdown", children: QUERY_PARTS.map(({ part, key, label }) => {
|
|
112
|
+
const durationMs = breakdown[key];
|
|
113
|
+
const offsetPct = totalMs > 0 ? (offsetMs / totalMs) * 100 : 0;
|
|
114
|
+
const widthPct = totalMs > 0 ? Math.max((durationMs / totalMs) * 100, 0.5) : 0;
|
|
115
|
+
offsetMs += durationMs;
|
|
116
|
+
return (_jsxs("li", { className: `adi-execution-progress-source adi-execution-progress-query-part is-${part} s-execution-progress-query-part`, "data-part": part, "data-duration-ms": durationMs, children: [_jsx("span", { className: "adi-execution-progress-source-name", children: label }), _jsx("span", { className: "adi-execution-progress-source-track", children: _jsx("span", { className: "adi-execution-progress-source-bar", style: { left: `${Math.min(offsetPct, 99.5)}%`, width: `${widthPct}%` } }) }), _jsx("span", { className: "adi-execution-progress-source-duration", children: formatDuration(durationMs) })] }, part));
|
|
117
|
+
}) }));
|
|
118
|
+
}
|
|
119
|
+
/** what a cache hit saved: the time when it is meaningful, otherwise the queries not run */
|
|
120
|
+
export function CacheSaving({ saving, className }) {
|
|
121
|
+
return (_jsx("div", { className: classNames("adi-execution-progress-original-saved", className), "data-saved-ms": saving.kind === "time" ? saving.savedMs : undefined, children: saving.kind === "time" ? (_jsx(FormattedMessage, { id: "executionProgress.original.saved", values: { duration: formatOriginalTotal(saving.savedMs, saving.approximate) } })) : (_jsx(FormattedMessage, { id: "executionProgress.original.savedQueries", values: { count: saving.count } })) }));
|
|
122
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IExecutionStatsProps {
|
|
2
|
+
isExecutionRunning: boolean;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* The stats of the last report execution, kept after the loading view closed: a small link at the
|
|
6
|
+
* bottom right of the canvas ("Live data" / "Saved result") with a one-line summary on hover and the
|
|
7
|
+
* details on click.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ExecutionStats({ isExecutionRunning }: IExecutionStatsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=ExecutionStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionStats.d.ts","sourceRoot":"","sources":["../../../../src/components/report/executionProgress/ExecutionStats.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,oBAAoB;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,kBAAkB,EAAE,EAAE,oBAAoB,kDA8D1E"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
6
|
+
import { UiIcon, UiPopover, UiTooltip } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
import { executionStatsOpened } from "../../../store/execution_progress/execution_progress_actions.js";
|
|
8
|
+
import { getExecutionStatsViewModel } from "../../../store/execution_progress/execution_progress_selectors.js";
|
|
9
|
+
import { CacheSaving, ExecutionProgressSteps, dataSourceLabel, formatOriginalTotal, toRelativeTime, } from "./ExecutionProgressSteps.js";
|
|
10
|
+
import { formatDuration } from "./timeline.js";
|
|
11
|
+
/**
|
|
12
|
+
* The stats of the last report execution, kept after the loading view closed: a small link at the
|
|
13
|
+
* bottom right of the canvas ("Live data" / "Saved result") with a one-line summary on hover and the
|
|
14
|
+
* details on click.
|
|
15
|
+
*/
|
|
16
|
+
export function ExecutionStats({ isExecutionRunning }) {
|
|
17
|
+
const intl = useIntl();
|
|
18
|
+
const dispatch = useDispatch();
|
|
19
|
+
const stats = useSelector(getExecutionStatsViewModel);
|
|
20
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
21
|
+
if (isExecutionRunning || !stats.available || !stats.reportExecutionId || stats.load === "unknown") {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const reportExecutionId = stats.reportExecutionId;
|
|
25
|
+
const summary = formatSummary(intl, stats);
|
|
26
|
+
const label = intl.formatMessage({ id: "executionStats.title" });
|
|
27
|
+
return (_jsx("div", { className: "adi-execution-stats-anchor", children: _jsx(UiTooltip, { content: summary, triggerBy: ["hover", "focus"], arrowPlacement: "right", disabled: isOpen, anchor: _jsx("span", { className: "adi-execution-stats-tooltip-anchor", children: _jsx(UiPopover, { title: label, closeVisible: true, arrowPlacement: "bottom-end", width: 360, onOpen: () => {
|
|
28
|
+
setIsOpen(true);
|
|
29
|
+
if (stats.showsOriginal) {
|
|
30
|
+
dispatch(executionStatsOpened({ reportExecutionId }));
|
|
31
|
+
}
|
|
32
|
+
}, onClose: () => setIsOpen(false), anchor: _jsxs("button", { type: "button", className: "adi-execution-stats-trigger s-execution-stats-trigger", "aria-label": `${label}: ${summary}`, "data-load": stats.load, children: [stats.load === "fresh" ? (_jsx(DatabaseIcon, {})) : (_jsx(UiIcon, { type: "history", size: 12, color: "currentColor" })), _jsx("span", { className: "adi-execution-stats-trigger-text", children: stats.load === "fresh" ? (_jsx(FormattedMessage, { id: "executionStats.link.live" })) : (_jsx(FormattedMessage, { id: "executionStats.link.saved" })) })] }), content: _jsx(ExecutionStatsContent, { stats: stats, summary: summary }) }) }) }) }));
|
|
33
|
+
}
|
|
34
|
+
function formatSummary(intl, stats) {
|
|
35
|
+
const duration = stats.totalMs === undefined ? "" : formatDuration(stats.totalMs);
|
|
36
|
+
if (stats.failed) {
|
|
37
|
+
return intl.formatMessage({ id: "executionStats.summary.failed" }, { duration });
|
|
38
|
+
}
|
|
39
|
+
switch (stats.load) {
|
|
40
|
+
case "cacheHit":
|
|
41
|
+
return intl.formatMessage({ id: "executionStats.summary.cacheHit" }, { duration });
|
|
42
|
+
case "browserCache":
|
|
43
|
+
return intl.formatMessage({ id: "executionStats.summary.browserCache" }, { duration });
|
|
44
|
+
default:
|
|
45
|
+
// "fresh"; an unknown load shows no stats
|
|
46
|
+
return intl.formatMessage({ id: "executionStats.summary.fresh" }, { duration });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function ExecutionStatsContent({ stats, summary }) {
|
|
50
|
+
const { progress } = stats;
|
|
51
|
+
// the steps of a settled load end at the root's finish; a step the stream did not see finish
|
|
52
|
+
// ends at the report's finish (on the server clock), so its duration does not keep growing
|
|
53
|
+
const serverNow = progress.finishedAt ?? (progress.reportFinishedAt ?? Date.now()) - progress.clockOffsetMs;
|
|
54
|
+
return (_jsxs("div", { className: "adi-execution-stats s-execution-stats", "data-load": stats.load, children: [_jsxs("section", { className: "adi-execution-stats-section s-execution-stats-this-load", children: [_jsx("h4", { className: "adi-execution-stats-heading", children: _jsx(FormattedMessage, { id: "executionStats.thisLoad" }) }), _jsx("div", { className: "adi-execution-stats-summary s-execution-stats-summary", children: summary }), progress.steps.length > 0 ? (_jsx("div", { className: "adi-execution-stats-steps", children: _jsx(ExecutionProgressSteps, { steps: progress.steps, serverNow: serverNow }) })) : null] }), stats.showsOriginal ? (_jsxs("section", { className: "adi-execution-stats-section s-execution-stats-original", children: [_jsx("h4", { className: "adi-execution-stats-heading", children: _jsx(FormattedMessage, { id: "executionStats.original" }) }), _jsx(OriginalComputationStats, { stats: stats, serverNow: Date.now() - progress.clockOffsetMs })] })) : null] }));
|
|
55
|
+
}
|
|
56
|
+
function OriginalComputationStats({ stats, serverNow, }) {
|
|
57
|
+
const intl = useIntl();
|
|
58
|
+
const { status, computation } = stats.original;
|
|
59
|
+
if (status === "idle" || status === "loading") {
|
|
60
|
+
return (_jsx("div", { className: "adi-execution-stats-note s-execution-stats-original-loading", children: _jsx(FormattedMessage, { id: "executionStats.original.loading" }) }));
|
|
61
|
+
}
|
|
62
|
+
if (status === "missing") {
|
|
63
|
+
return (_jsx("div", { className: "adi-execution-stats-note s-execution-stats-original-missing", children: _jsx(FormattedMessage, { id: "executionStats.original.missing" }) }));
|
|
64
|
+
}
|
|
65
|
+
if (!computation) {
|
|
66
|
+
return (_jsx("div", { className: "adi-execution-stats-note s-execution-stats-original-unavailable", children: _jsx(FormattedMessage, { id: "executionStats.original.unavailable" }) }));
|
|
67
|
+
}
|
|
68
|
+
const { computedAt, totalDurationMs } = computation;
|
|
69
|
+
const ago = computedAt === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: intl.formatRelativeTime(...toRelativeTime(serverNow - computedAt));
|
|
72
|
+
const duration = totalDurationMs === undefined
|
|
73
|
+
? undefined
|
|
74
|
+
: formatOriginalTotal(totalDurationMs, computation.totalApproximate);
|
|
75
|
+
const approximateTitle = computation.totalApproximate
|
|
76
|
+
? intl.formatMessage({ id: "executionProgress.original.approximate" })
|
|
77
|
+
: undefined;
|
|
78
|
+
const computedAtTitle = computedAt === undefined
|
|
79
|
+
? undefined
|
|
80
|
+
: intl.formatDate(computedAt, { dateStyle: "medium", timeStyle: "medium" });
|
|
81
|
+
return (_jsxs(_Fragment, { children: [ago === undefined && duration === undefined ? null : (_jsx("div", { className: "adi-execution-stats-computed-at s-execution-stats-computed-at", title: [computedAtTitle, approximateTitle].filter(Boolean).join(" · ") || undefined, "data-total-duration-ms": totalDurationMs, "data-approximate": computation.totalApproximate ? "true" : undefined, children: duration === undefined ? (_jsx(FormattedMessage, { id: "executionStats.original.computedAt", values: { ago } })) : ago === undefined ? (_jsx(FormattedMessage, { id: "executionStats.original.computedIn", values: { duration } })) : (_jsx(FormattedMessage, { id: "executionStats.original.computedInAgo", values: { duration, ago } })) })), computation.sources.length === 1 ? (_jsx(OriginalSourceLine, { source: computation.sources[0] })) : computation.sources.length > 1 ? (_jsxs("table", { className: "adi-execution-stats-sources", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: _jsx(FormattedMessage, { id: "executionStats.original.dataSource" }) }), _jsx("th", { children: _jsx(FormattedMessage, { id: "executionStats.original.querying" }) })] }) }), _jsx("tbody", { children: computation.sources.map((source, index) => (_jsxs("tr", { className: "s-execution-stats-original-source", "data-data-source": source.dataSourceId, "data-querying-ms": source.queryingMs, title: formatSourceBreakdown(intl, source), children: [_jsx("td", { className: "adi-execution-stats-source-name", children: source.dataSourceId
|
|
82
|
+
? dataSourceLabel(source.dataSourceId, source.dataSourceName)
|
|
83
|
+
: "–" }), _jsx("td", { children: source.queryingMs === undefined
|
|
84
|
+
? "–"
|
|
85
|
+
: formatDuration(source.queryingMs) })] }, `${source.dataSourceId ?? ""}-${index}`))) })] })) : null, stats.saved ? _jsx(CacheSaving, { saving: stats.saved, className: "s-execution-stats-saved" }) : null] }));
|
|
86
|
+
}
|
|
87
|
+
/** the database time and the query + upload of a source, for its title */
|
|
88
|
+
function formatSourceBreakdown(intl, source) {
|
|
89
|
+
if (source.dbDurationMs === undefined && source.totalDurationMs === undefined) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
return intl.formatMessage({ id: "executionStats.original.breakdown" }, {
|
|
93
|
+
database: source.dbDurationMs === undefined ? "–" : formatDuration(source.dbDurationMs),
|
|
94
|
+
upload: source.totalDurationMs === undefined ? "–" : formatDuration(source.totalDurationMs),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** the only data source of the original computation: one line instead of a table */
|
|
98
|
+
function OriginalSourceLine({ source }) {
|
|
99
|
+
const intl = useIntl();
|
|
100
|
+
const dataSource = source.dataSourceId ? (_jsx("strong", { title: source.dataSourceId, children: dataSourceLabel(source.dataSourceId, source.dataSourceName) })) : (intl.formatMessage({ id: "executionProgress.original.unknownDataSource" }));
|
|
101
|
+
return (_jsx("div", { className: "adi-execution-stats-original-line s-execution-stats-original-source", "data-data-source": source.dataSourceId, "data-querying-ms": source.queryingMs, title: formatSourceBreakdown(intl, source), children: source.queryingMs === undefined ? (_jsx(FormattedMessage, { id: "executionStats.original.queryingSource.noDuration", values: { dataSource } })) : (_jsx(FormattedMessage, { id: "executionStats.original.queryingSource", values: { dataSource, duration: formatDuration(source.queryingMs) } })) }));
|
|
102
|
+
}
|
|
103
|
+
function DatabaseIcon() {
|
|
104
|
+
return (_jsxs("svg", { className: "adi-execution-stats-trigger-icon", viewBox: "0 0 16 16", width: "12", height: "12", "aria-hidden": "true", children: [_jsx("ellipse", { cx: "8", cy: "3.5", rx: "5.5", ry: "2", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }), _jsx("path", { d: "M2.5 3.5v9c0 1.1 2.5 2 5.5 2s5.5-.9 5.5-2v-9M2.5 8c0 1.1 2.5 2 5.5 2s5.5-.9 5.5-2", fill: "none", stroke: "currentColor", strokeWidth: "1.4" })] }));
|
|
105
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bar geometry of the execution progress panel. Adapted from the gen-ai interaction timeline
|
|
3
|
+
* (sdk-ui-gen-ai components/intelligence/data/timeline.ts): a floor keeps very short items visible
|
|
4
|
+
* next to the long ones.
|
|
5
|
+
*/
|
|
6
|
+
/** Floor of an item's share of the track, in percent. */
|
|
7
|
+
export declare const MIN_BAR_WIDTH_PCT = 1.5;
|
|
8
|
+
export interface ITimedItem {
|
|
9
|
+
id: string;
|
|
10
|
+
startedAt?: number;
|
|
11
|
+
/** absent while running: the bar grows up to `now` */
|
|
12
|
+
finishedAt?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ITimelineSegment {
|
|
15
|
+
id: string;
|
|
16
|
+
widthPct: number;
|
|
17
|
+
}
|
|
18
|
+
export interface IGanttBar {
|
|
19
|
+
id: string;
|
|
20
|
+
offsetPct: number;
|
|
21
|
+
widthPct: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One segment per item, tiling the whole track in order (the overall step timeline). Items that
|
|
25
|
+
* have not started get no segment.
|
|
26
|
+
*/
|
|
27
|
+
export declare function computeSegments(items: ITimedItem[], now: number): ITimelineSegment[];
|
|
28
|
+
/**
|
|
29
|
+
* One bar per item placed on the shared time span `[spanStart, spanEnd]` — the parallel data
|
|
30
|
+
* source queries of a federated execution.
|
|
31
|
+
*/
|
|
32
|
+
export declare function computeGanttBars(items: ITimedItem[], spanStart: number, spanEnd: number): IGanttBar[];
|
|
33
|
+
export declare function formatDuration(ms: number): string;
|
|
34
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../../src/components/report/executionProgress/timeline.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAYpF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,CAcrG;AAUD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAKjD"}
|