@gooddata/sdk-ui-dashboard 11.53.0-alpha.5 → 11.53.0-alpha.7
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPdfPresentationHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportDashboardToPptPresentationHandler.js +3 -1
- package/esm/model/commandHandlers/dashboard/exportToTabularHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/exportToTabularHandler.js +5 -3
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.d.ts.map +1 -1
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js +9 -2
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts +12 -0
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.d.ts.map +1 -0
- package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/loadExportTimezone.js +25 -0
- package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/timezone/changeDashboardTimezoneOverrideHandler.js +4 -3
- package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportImageInsightWidgetHandler.js +3 -1
- package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportInsightWidgetHandler.js +4 -2
- package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportRawInsightWidgetHandler.js +7 -1
- package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.d.ts.map +1 -1
- package/esm/model/commandHandlers/widgets/exportSlidesInsightWidgetHandler.js +3 -1
- package/esm/model/store/config/configSelectors.d.ts +6 -0
- package/esm/model/store/config/configSelectors.d.ts.map +1 -1
- package/esm/model/store/config/configSelectors.js +8 -0
- package/esm/model/store/meta/metaSelectors.d.ts +16 -0
- package/esm/model/store/meta/metaSelectors.d.ts.map +1 -1
- package/esm/model/store/meta/metaSelectors.js +28 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/utils/convertors.js +6 -1
- package/esm/presentation/automations/alerting/state/useAlertFormState.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/state/useAlertFormState.js +6 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.js +29 -3
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts +39 -0
- package/esm/presentation/automations/contexts/AutomationsContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +33 -10
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts +15 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/components/ScheduleTimezoneSelect/ScheduleTimezoneSelect.js +58 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts +52 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useExportTimezones.js +46 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts +47 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.d.ts.map +1 -0
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useScheduleTimezone.js +90 -0
- package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledEmailDialogStateProvider.js +21 -0
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts +2 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportActionsContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts +5 -2
- package/esm/presentation/automations/scheduledEmail/state/ScheduledExportDraftContext.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts +19 -2
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/exportDefinitions.js +35 -2
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts +9 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailExportSettings.js +10 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/state/useScheduledEmailFormState.js +14 -2
- package/esm/presentation/automations/scheduledEmail/types.d.ts +64 -0
- package/esm/presentation/automations/scheduledEmail/types.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts +12 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js +17 -2
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/DefaultDashboardSettingsDialog.js +3 -1
- package/esm/presentation/dashboardSettingsDialog/TimezoneOption.d.ts.map +1 -1
- package/esm/presentation/dashboardSettingsDialog/TimezoneOption.js +5 -6
- package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.d.ts.map +1 -1
- package/esm/presentation/filterBar/filterBar/useExecutionTimestampMessage.js +6 -1
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +48 -4
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-US.localization-bundle.js +51 -7
- package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts +1 -1
- package/esm/presentation/timezoneDialog/TimezoneDialog.d.ts.map +1 -1
- package/esm/presentation/timezoneDialog/TimezoneDialog.js +7 -6
- package/esm/presentation/topBar/menuButton/useDefaultMenuItems.d.ts.map +1 -1
- package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js +6 -2
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts +4 -3
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.d.ts.map +1 -1
- package/esm/presentation/topBar/timezoneIndicator/TimezoneIndicator.js +10 -9
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +6 -1
- package/esm/sdk-ui-dashboard.d.ts +134 -3
- package/package.json +21 -21
- package/styles/css/main.css +41 -0
- package/styles/css/main.css.map +1 -1
- package/styles/css/scheduleTimezone.css +30 -0
- package/styles/css/scheduleTimezone.css.map +1 -0
- package/styles/scss/main.scss +1 -0
- package/styles/scss/scheduleTimezone.scss +37 -0
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts +0 -2
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.d.ts.map +0 -1
- package/esm/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.js +0 -39
- package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/AlertingConnector.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/AlertingConnector.test.js +0 -201
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/ScheduledEmailConnector.test.js +0 -225
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.js +0 -95
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildAutomationsContext.test.js +0 -185
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailDialogContext.test.js +0 -175
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts +0 -2
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/connectors/hooks/useBuildScheduledEmailManagementDialogContext.test.js +0 -48
- package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts +0 -2
- package/esm/presentation/automations/contexts/AutomationsContext.test.d.ts.map +0 -1
- package/esm/presentation/automations/contexts/AutomationsContext.test.js +0 -9
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts +0 -2
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.d.ts.map +0 -1
- package/esm/presentation/automations/shared/automationFilters/components/AutomationDateFilter.test.js +0 -159
- package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts +0 -2
- package/esm/presentation/export/DefaultDashboardExportVariables.test.d.ts.map +0 -1
- package/esm/presentation/export/DefaultDashboardExportVariables.test.js +0 -58
- package/esm/presentation/widget/insight/LayeredTableView.test.d.ts +0 -2
- package/esm/presentation/widget/insight/LayeredTableView.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/LayeredTableView.test.js +0 -149
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts +0 -2
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertsNew.test.js +0 -124
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts +0 -2
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/geoDefaultDisplayFormRefs.test.js +0 -139
- package/esm/presentation/widget/insight/insightToTable.test.d.ts +0 -2
- package/esm/presentation/widget/insight/insightToTable.test.d.ts.map +0 -1
- package/esm/presentation/widget/insight/insightToTable.test.js +0 -325
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.gd-schedule-timezone-field {
|
|
2
|
+
align-items: flex-start;
|
|
3
|
+
}
|
|
4
|
+
.gd-schedule-timezone-field .gd-label {
|
|
5
|
+
line-height: 28px;
|
|
6
|
+
}
|
|
7
|
+
.gd-schedule-timezone-field__content {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
flex: 1 1 auto;
|
|
12
|
+
}
|
|
13
|
+
.gd-schedule-timezone-field__row {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 10px;
|
|
17
|
+
}
|
|
18
|
+
.gd-schedule-timezone-field__current-time {
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
}
|
|
21
|
+
.gd-schedule-timezone-field__message {
|
|
22
|
+
color: var(--gd-palette-complementary-7);
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 400;
|
|
26
|
+
line-height: 21px;
|
|
27
|
+
margin-top: 5px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*# sourceMappingURL=scheduleTimezone.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../scss/scheduleTimezone.scss"],"names":[],"mappings":"AAEA;EAGI;;AAEA;EACI;;AAGJ;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA","file":"scheduleTimezone.css"}
|
package/styles/scss/main.scss
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
|
|
3
|
+
.gd-schedule-timezone-field {
|
|
4
|
+
// The section stacks the dropdown row and its helper text in a column next to the label;
|
|
5
|
+
// top-align the label with the dropdown instead of centering it against the whole column.
|
|
6
|
+
align-items: flex-start;
|
|
7
|
+
|
|
8
|
+
.gd-label {
|
|
9
|
+
line-height: 28px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__content {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
flex: 1 1 auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__row {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__current-time {
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__message {
|
|
30
|
+
color: var(--gd-palette-complementary-7);
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
line-height: 21px;
|
|
35
|
+
margin-top: 5px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PauseAlertRunner.test.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingManagementDialog/components/PauseAlertRunner.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { render, waitFor } from "@testing-library/react";
|
|
4
|
-
import { describe, expect, it, vi } from "vitest";
|
|
5
|
-
const fixtures = vi.hoisted(() => {
|
|
6
|
-
return {
|
|
7
|
-
pauseAlert: vi.fn(),
|
|
8
|
-
resumeAlert: vi.fn(),
|
|
9
|
-
};
|
|
10
|
-
});
|
|
11
|
-
vi.mock("../../../contexts/AlertingManagementDialogContext.js", () => ({
|
|
12
|
-
useAlertingManagementDialogContext: () => ({
|
|
13
|
-
pauseAlert: fixtures.pauseAlert,
|
|
14
|
-
resumeAlert: fixtures.resumeAlert,
|
|
15
|
-
}),
|
|
16
|
-
}));
|
|
17
|
-
import { PauseAlertRunner } from "./PauseAlertRunner.js";
|
|
18
|
-
describe("PauseAlertRunner", () => {
|
|
19
|
-
it("passes the updated paused alert returned by the context to onSuccess", async () => {
|
|
20
|
-
const originalAlert = { id: "alert-1", alert: { trigger: { state: "ACTIVE" } } };
|
|
21
|
-
const updatedAlert = { id: "alert-1", alert: { trigger: { state: "PAUSED" } } };
|
|
22
|
-
fixtures.pauseAlert.mockResolvedValueOnce(updatedAlert);
|
|
23
|
-
const onSuccess = vi.fn();
|
|
24
|
-
render(_jsx(PauseAlertRunner, { alert: originalAlert, pause: true, onSuccess: onSuccess }));
|
|
25
|
-
await waitFor(() => {
|
|
26
|
-
expect(onSuccess).toHaveBeenCalledWith(updatedAlert, true);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it("passes the updated resumed alert returned by the context to onSuccess", async () => {
|
|
30
|
-
const originalAlert = { id: "alert-1", alert: { trigger: { state: "PAUSED" } } };
|
|
31
|
-
const updatedAlert = { id: "alert-1", alert: { trigger: { state: "ACTIVE" } } };
|
|
32
|
-
fixtures.resumeAlert.mockResolvedValueOnce(updatedAlert);
|
|
33
|
-
const onSuccess = vi.fn();
|
|
34
|
-
render(_jsx(PauseAlertRunner, { alert: originalAlert, pause: false, onSuccess: onSuccess }));
|
|
35
|
-
await waitFor(() => {
|
|
36
|
-
expect(onSuccess).toHaveBeenCalledWith(updatedAlert, false);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlertingConnector.test.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/connectors/AlertingConnector.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
const fixtures = vi.hoisted(() => {
|
|
6
|
-
const buildAutomationUrl = vi.fn(() => "/target-url");
|
|
7
|
-
const navigate = vi.fn();
|
|
8
|
-
const onAlertingManagementEdit = vi.fn();
|
|
9
|
-
let managementDialogProps;
|
|
10
|
-
let dialogProps;
|
|
11
|
-
let automationsError;
|
|
12
|
-
const alertsState = { isAlertDialogOpen: false, isAlertManagementDialogOpen: true };
|
|
13
|
-
return {
|
|
14
|
-
buildAutomationUrl,
|
|
15
|
-
navigate,
|
|
16
|
-
onAlertingManagementEdit,
|
|
17
|
-
alertsState,
|
|
18
|
-
get managementDialogProps() {
|
|
19
|
-
return managementDialogProps;
|
|
20
|
-
},
|
|
21
|
-
set managementDialogProps(value) {
|
|
22
|
-
managementDialogProps = value;
|
|
23
|
-
},
|
|
24
|
-
get dialogProps() {
|
|
25
|
-
return dialogProps;
|
|
26
|
-
},
|
|
27
|
-
set dialogProps(value) {
|
|
28
|
-
dialogProps = value;
|
|
29
|
-
},
|
|
30
|
-
get automationsError() {
|
|
31
|
-
return automationsError;
|
|
32
|
-
},
|
|
33
|
-
set automationsError(value) {
|
|
34
|
-
automationsError = value;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
vi.mock("@gooddata/sdk-ui", () => ({
|
|
39
|
-
buildAutomationUrl: fixtures.buildAutomationUrl,
|
|
40
|
-
navigate: fixtures.navigate,
|
|
41
|
-
useWorkspaceStrict: () => "workspace-id",
|
|
42
|
-
}));
|
|
43
|
-
vi.mock("../../../model/react/DashboardStoreProvider.js", () => ({
|
|
44
|
-
useDashboardSelector: vi.fn((selector) => selector()),
|
|
45
|
-
}));
|
|
46
|
-
vi.mock("../../../model/react/useDashboardAlerting/useDashboardAlerts.js", () => ({
|
|
47
|
-
useDashboardAlerts: () => ({
|
|
48
|
-
isInitialized: true,
|
|
49
|
-
get isAlertDialogOpen() {
|
|
50
|
-
return fixtures.alertsState.isAlertDialogOpen;
|
|
51
|
-
},
|
|
52
|
-
get isAlertManagementDialogOpen() {
|
|
53
|
-
return fixtures.alertsState.isAlertManagementDialogOpen;
|
|
54
|
-
},
|
|
55
|
-
alertToEdit: undefined,
|
|
56
|
-
automations: [],
|
|
57
|
-
automationsError: fixtures.automationsError,
|
|
58
|
-
automationsLoading: false,
|
|
59
|
-
notificationChannels: [],
|
|
60
|
-
onAlertingCancel: vi.fn(),
|
|
61
|
-
onAlertingCreateSuccess: vi.fn(),
|
|
62
|
-
onAlertingCreateError: vi.fn(),
|
|
63
|
-
onAlertingSaveSuccess: vi.fn(),
|
|
64
|
-
onAlertingSaveError: vi.fn(),
|
|
65
|
-
onAlertingManagementClose: vi.fn(),
|
|
66
|
-
onAlertingManagementAdd: vi.fn(),
|
|
67
|
-
onAlertingManagementEdit: fixtures.onAlertingManagementEdit,
|
|
68
|
-
onAlertingManagementDeleteSuccess: vi.fn(),
|
|
69
|
-
onAlertingManagementDeleteError: vi.fn(),
|
|
70
|
-
onAlertingManagementPauseSuccess: vi.fn(),
|
|
71
|
-
onAlertingManagementPauseError: vi.fn(),
|
|
72
|
-
widget: undefined,
|
|
73
|
-
insight: undefined,
|
|
74
|
-
}),
|
|
75
|
-
}));
|
|
76
|
-
vi.mock("../../../model/store/config/configSelectors.js", () => ({
|
|
77
|
-
selectExternalRecipient: () => "recipient@example.com",
|
|
78
|
-
selectIsEmbedded: () => false,
|
|
79
|
-
selectSettings: () => ({
|
|
80
|
-
enableShellApplication: true,
|
|
81
|
-
enableShellApplication_dashboards: true,
|
|
82
|
-
}),
|
|
83
|
-
}));
|
|
84
|
-
vi.mock("../../../model/store/meta/metaSelectors.js", () => ({
|
|
85
|
-
selectDashboardId: () => "current-dashboard",
|
|
86
|
-
}));
|
|
87
|
-
vi.mock("../alerting/AlertingDialog.js", () => ({
|
|
88
|
-
AlertingDialog: (props) => {
|
|
89
|
-
fixtures.dialogProps = props;
|
|
90
|
-
return null;
|
|
91
|
-
},
|
|
92
|
-
}));
|
|
93
|
-
vi.mock("../alerting/AlertingManagementDialog.js", () => ({
|
|
94
|
-
AlertingManagementDialog: (props) => {
|
|
95
|
-
fixtures.managementDialogProps = props;
|
|
96
|
-
return null;
|
|
97
|
-
},
|
|
98
|
-
}));
|
|
99
|
-
vi.mock("../contexts/AlertingDialogContext.js", () => ({
|
|
100
|
-
AlertingDialogContextProvider: ({ children }) => children,
|
|
101
|
-
}));
|
|
102
|
-
vi.mock("../contexts/AlertingManagementDialogContext.js", () => ({
|
|
103
|
-
AlertingManagementDialogContextProvider: ({ children }) => children,
|
|
104
|
-
}));
|
|
105
|
-
vi.mock("../contexts/AutomationsContext.js", () => ({
|
|
106
|
-
AutomationsContextProvider: ({ children }) => children,
|
|
107
|
-
}));
|
|
108
|
-
vi.mock("./hooks/useBuildAlertingDialogContext.js", () => ({
|
|
109
|
-
useBuildAlertingDialogContext: () => ({}),
|
|
110
|
-
}));
|
|
111
|
-
vi.mock("./hooks/useBuildAlertingManagementDialogContext.js", () => ({
|
|
112
|
-
useBuildAlertingManagementDialogContext: () => ({
|
|
113
|
-
dashboardId: "current-dashboard",
|
|
114
|
-
isEmbedded: false,
|
|
115
|
-
canManageWorkspace: true,
|
|
116
|
-
currentUser: { login: "user" },
|
|
117
|
-
dashboardTitle: "Current Dashboard",
|
|
118
|
-
isAlertDialogOpen: false,
|
|
119
|
-
managementDialogContext: {},
|
|
120
|
-
enableAccessibilityMode: false,
|
|
121
|
-
getWidgetByRef: () => undefined,
|
|
122
|
-
getInsightByWidgetRef: () => undefined,
|
|
123
|
-
pauseAlert: vi.fn(),
|
|
124
|
-
resumeAlert: vi.fn(),
|
|
125
|
-
}),
|
|
126
|
-
}));
|
|
127
|
-
vi.mock("./hooks/useBuildAutomationsContext.js", () => ({
|
|
128
|
-
useBuildAutomationsContext: () => ({}),
|
|
129
|
-
}));
|
|
130
|
-
import { AlertingConnector } from "./AlertingConnector.js";
|
|
131
|
-
describe("AlertingConnector", () => {
|
|
132
|
-
beforeEach(() => {
|
|
133
|
-
fixtures.buildAutomationUrl.mockClear();
|
|
134
|
-
fixtures.navigate.mockClear();
|
|
135
|
-
fixtures.onAlertingManagementEdit.mockClear();
|
|
136
|
-
fixtures.managementDialogProps = undefined;
|
|
137
|
-
fixtures.dialogProps = undefined;
|
|
138
|
-
fixtures.automationsError = undefined;
|
|
139
|
-
fixtures.alertsState.isAlertDialogOpen = false;
|
|
140
|
-
fixtures.alertsState.isAlertManagementDialogOpen = true;
|
|
141
|
-
});
|
|
142
|
-
it("uses host routes when editing an alert on another dashboard in shell mode", () => {
|
|
143
|
-
render(_jsx(AlertingConnector, {}));
|
|
144
|
-
const onEdit = fixtures.managementDialogProps?.["onEdit"];
|
|
145
|
-
expect(onEdit).toBeDefined();
|
|
146
|
-
onEdit?.({
|
|
147
|
-
id: "alert-1",
|
|
148
|
-
dashboard: { id: "other-dashboard" },
|
|
149
|
-
});
|
|
150
|
-
expect(fixtures.buildAutomationUrl).toHaveBeenCalledWith({
|
|
151
|
-
workspaceId: "workspace-id",
|
|
152
|
-
dashboardId: "other-dashboard",
|
|
153
|
-
automationId: "alert-1",
|
|
154
|
-
isEmbedded: false,
|
|
155
|
-
useHostRoute: true,
|
|
156
|
-
queryParams: { recipient: "recipient@example.com" },
|
|
157
|
-
});
|
|
158
|
-
expect(fixtures.navigate).toHaveBeenCalledWith("/target-url");
|
|
159
|
-
expect(fixtures.onAlertingManagementEdit).not.toHaveBeenCalled();
|
|
160
|
-
});
|
|
161
|
-
it("falls back to local edit when the target dashboard id is missing", () => {
|
|
162
|
-
render(_jsx(AlertingConnector, {}));
|
|
163
|
-
const onEdit = fixtures.managementDialogProps?.["onEdit"];
|
|
164
|
-
onEdit?.({
|
|
165
|
-
id: "alert-2",
|
|
166
|
-
dashboard: undefined,
|
|
167
|
-
});
|
|
168
|
-
expect(fixtures.navigate).not.toHaveBeenCalled();
|
|
169
|
-
expect(fixtures.buildAutomationUrl).not.toHaveBeenCalled();
|
|
170
|
-
expect(fixtures.onAlertingManagementEdit).toHaveBeenCalledWith({
|
|
171
|
-
id: "alert-2",
|
|
172
|
-
dashboard: undefined,
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
it("does not supply the deprecated data props to the create/edit dialog", () => {
|
|
176
|
-
fixtures.alertsState.isAlertDialogOpen = true;
|
|
177
|
-
fixtures.alertsState.isAlertManagementDialogOpen = false;
|
|
178
|
-
render(_jsx(AlertingConnector, {}));
|
|
179
|
-
expect(fixtures.dialogProps).toBeDefined();
|
|
180
|
-
for (const prop of [
|
|
181
|
-
"alertToEdit",
|
|
182
|
-
"users",
|
|
183
|
-
"usersError",
|
|
184
|
-
"notificationChannels",
|
|
185
|
-
"widget",
|
|
186
|
-
"insight",
|
|
187
|
-
"isLoading",
|
|
188
|
-
]) {
|
|
189
|
-
expect(fixtures.dialogProps?.[prop]).toBeUndefined();
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
it("renders the management dialog without the deprecated data props", () => {
|
|
193
|
-
fixtures.automationsError = new Error("automations failed to load");
|
|
194
|
-
render(_jsx(AlertingConnector, {}));
|
|
195
|
-
expect(fixtures.managementDialogProps).toBeDefined();
|
|
196
|
-
expect(fixtures.managementDialogProps?.["automations"]).toBeUndefined();
|
|
197
|
-
expect(fixtures.managementDialogProps?.["notificationChannels"]).toBeUndefined();
|
|
198
|
-
expect(fixtures.managementDialogProps?.["alertDataError"]).toBeUndefined();
|
|
199
|
-
expect(fixtures.managementDialogProps?.["isLoadingAlertingData"]).toBeUndefined();
|
|
200
|
-
});
|
|
201
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScheduledEmailConnector.test.d.ts","sourceRoot":"","sources":["../../../../src/presentation/automations/connectors/ScheduledEmailConnector.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { render } from "@testing-library/react";
|
|
4
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
const fixtures = vi.hoisted(() => {
|
|
6
|
-
const buildAutomationUrl = vi.fn(() => "/target-url");
|
|
7
|
-
const navigate = vi.fn();
|
|
8
|
-
const onScheduleEmailingManagementEdit = vi.fn();
|
|
9
|
-
let managementDialogProps;
|
|
10
|
-
let dialogProps;
|
|
11
|
-
let automationsError;
|
|
12
|
-
const seState = {
|
|
13
|
-
isScheduleEmailingDialogOpen: false,
|
|
14
|
-
isScheduleEmailingManagementDialogOpen: true,
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
buildAutomationUrl,
|
|
18
|
-
navigate,
|
|
19
|
-
onScheduleEmailingManagementEdit,
|
|
20
|
-
seState,
|
|
21
|
-
get managementDialogProps() {
|
|
22
|
-
return managementDialogProps;
|
|
23
|
-
},
|
|
24
|
-
set managementDialogProps(value) {
|
|
25
|
-
managementDialogProps = value;
|
|
26
|
-
},
|
|
27
|
-
get dialogProps() {
|
|
28
|
-
return dialogProps;
|
|
29
|
-
},
|
|
30
|
-
set dialogProps(value) {
|
|
31
|
-
dialogProps = value;
|
|
32
|
-
},
|
|
33
|
-
get automationsError() {
|
|
34
|
-
return automationsError;
|
|
35
|
-
},
|
|
36
|
-
set automationsError(value) {
|
|
37
|
-
automationsError = value;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
vi.mock("@gooddata/sdk-ui", () => ({
|
|
42
|
-
buildAutomationUrl: fixtures.buildAutomationUrl,
|
|
43
|
-
navigate: fixtures.navigate,
|
|
44
|
-
useWorkspaceStrict: () => "workspace-id",
|
|
45
|
-
}));
|
|
46
|
-
vi.mock("../../../model/react/DashboardStoreProvider.js", () => ({
|
|
47
|
-
useDashboardSelector: vi.fn((selector) => selector()),
|
|
48
|
-
}));
|
|
49
|
-
vi.mock("../../../model/react/useDasboardScheduledEmails/useDashboardScheduledEmails.js", () => ({
|
|
50
|
-
useDashboardScheduledEmails: () => ({
|
|
51
|
-
isInitialized: true,
|
|
52
|
-
get isScheduleEmailingDialogOpen() {
|
|
53
|
-
return fixtures.seState.isScheduleEmailingDialogOpen;
|
|
54
|
-
},
|
|
55
|
-
get isScheduleEmailingManagementDialogOpen() {
|
|
56
|
-
return fixtures.seState.isScheduleEmailingManagementDialogOpen;
|
|
57
|
-
},
|
|
58
|
-
scheduledExportToEdit: { id: "se-existing", title: "Existing schedule" },
|
|
59
|
-
automations: [],
|
|
60
|
-
get automationsError() {
|
|
61
|
-
return fixtures.automationsError;
|
|
62
|
-
},
|
|
63
|
-
automationsLoading: false,
|
|
64
|
-
notificationChannels: [],
|
|
65
|
-
onScheduleEmailingCancel: vi.fn(),
|
|
66
|
-
onScheduleEmailingBack: vi.fn(),
|
|
67
|
-
onScheduleEmailingCreateSuccess: vi.fn(),
|
|
68
|
-
onScheduleEmailingCreateError: vi.fn(),
|
|
69
|
-
onScheduleEmailingSaveSuccess: vi.fn(),
|
|
70
|
-
onScheduleEmailingSaveError: vi.fn(),
|
|
71
|
-
onScheduleEmailingManagementClose: vi.fn(),
|
|
72
|
-
onScheduleEmailingManagementAdd: vi.fn(),
|
|
73
|
-
onScheduleEmailingManagementEdit: fixtures.onScheduleEmailingManagementEdit,
|
|
74
|
-
onScheduleEmailingManagementDeleteSuccess: vi.fn(),
|
|
75
|
-
onScheduleEmailingManagementDeleteError: vi.fn(),
|
|
76
|
-
widget: { type: "insight", ref: { identifier: "widget-1" } },
|
|
77
|
-
insight: { insight: { identifier: "insight-1", title: "Insight" } },
|
|
78
|
-
}),
|
|
79
|
-
}));
|
|
80
|
-
vi.mock("../../../model/store/config/configSelectors.js", () => ({
|
|
81
|
-
selectExternalRecipient: () => "recipient@example.com",
|
|
82
|
-
selectIsEmbedded: () => false,
|
|
83
|
-
selectSettings: () => ({
|
|
84
|
-
enableShellApplication: true,
|
|
85
|
-
enableShellApplication_dashboards: true,
|
|
86
|
-
}),
|
|
87
|
-
selectEnableAccessibilityMode: () => false,
|
|
88
|
-
}));
|
|
89
|
-
vi.mock("../../../model/store/meta/metaSelectors.js", () => ({
|
|
90
|
-
selectDashboardId: () => "current-dashboard",
|
|
91
|
-
selectDashboardTitle: () => "Current Dashboard",
|
|
92
|
-
}));
|
|
93
|
-
vi.mock("../../../model/store/filtering/dashboardFilterSelectors.js", () => ({
|
|
94
|
-
selectAutomationDefaultSelectedFilters: () => [],
|
|
95
|
-
selectDashboardHiddenFilters: () => [],
|
|
96
|
-
}));
|
|
97
|
-
vi.mock("../../../model/store/insights/insightsSelectors.js", () => ({
|
|
98
|
-
selectInsightsMap: () => ({ get: () => undefined }),
|
|
99
|
-
}));
|
|
100
|
-
vi.mock("../../../model/store/tabs/layout/layoutSelectors.js", () => ({
|
|
101
|
-
selectWidgetsMap: () => ({ get: () => undefined }),
|
|
102
|
-
}));
|
|
103
|
-
vi.mock("../../../model/store/ui/uiSelectors.js", () => ({
|
|
104
|
-
selectIsScheduleEmailDialogOpen: () => false,
|
|
105
|
-
selectScheduleEmailDialogReturnFocusTo: () => undefined,
|
|
106
|
-
selectAutomationsInvalidationId: () => 0,
|
|
107
|
-
}));
|
|
108
|
-
vi.mock("../scheduledEmail/ScheduledEmailDialog.js", () => ({
|
|
109
|
-
ScheduledEmailDialog: (props) => {
|
|
110
|
-
fixtures.dialogProps = props;
|
|
111
|
-
return null;
|
|
112
|
-
},
|
|
113
|
-
}));
|
|
114
|
-
vi.mock("../scheduledEmail/ScheduledEmailManagementDialog.js", () => ({
|
|
115
|
-
ScheduledEmailManagementDialog: (props) => {
|
|
116
|
-
fixtures.managementDialogProps = props;
|
|
117
|
-
return null;
|
|
118
|
-
},
|
|
119
|
-
}));
|
|
120
|
-
vi.mock("../contexts/AutomationsContext.js", () => ({
|
|
121
|
-
AutomationsContextProvider: ({ children }) => children,
|
|
122
|
-
}));
|
|
123
|
-
vi.mock("../contexts/ScheduledEmailDialogContext.js", () => ({
|
|
124
|
-
ScheduledEmailDialogContextProvider: ({ children }) => children,
|
|
125
|
-
}));
|
|
126
|
-
vi.mock("../contexts/ScheduledEmailManagementDialogContext.js", () => ({
|
|
127
|
-
ScheduledEmailManagementDialogContextProvider: ({ children }) => children,
|
|
128
|
-
}));
|
|
129
|
-
vi.mock("./hooks/useBuildAutomationsContext.js", () => ({
|
|
130
|
-
useBuildAutomationsContext: () => ({}),
|
|
131
|
-
}));
|
|
132
|
-
vi.mock("./hooks/useBuildScheduledEmailDialogContext.js", () => ({
|
|
133
|
-
useBuildScheduledEmailDialogContext: () => ({}),
|
|
134
|
-
}));
|
|
135
|
-
vi.mock("./hooks/useBuildScheduledEmailManagementDialogContext.js", () => ({
|
|
136
|
-
useBuildScheduledEmailManagementDialogContext: () => ({}),
|
|
137
|
-
}));
|
|
138
|
-
vi.mock("./hooks/useWidgetAutomationFilters.js", () => ({
|
|
139
|
-
useWidgetAutomationFilters: () => ({ result: undefined, status: "success", error: undefined }),
|
|
140
|
-
}));
|
|
141
|
-
vi.mock("../../../_staging/automation/index.js", () => ({
|
|
142
|
-
getAutomationDashboardFilters: () => undefined,
|
|
143
|
-
getAutomationVisualizationFilters: () => ({ executionFilters: [] }),
|
|
144
|
-
}));
|
|
145
|
-
vi.mock("../shared/filters/index.js", () => ({
|
|
146
|
-
getAppliedDashboardFilters: () => [],
|
|
147
|
-
}));
|
|
148
|
-
import { ScheduledEmailConnector } from "./ScheduledEmailConnector.js";
|
|
149
|
-
describe("ScheduledEmailConnector", () => {
|
|
150
|
-
beforeEach(() => {
|
|
151
|
-
fixtures.buildAutomationUrl.mockClear();
|
|
152
|
-
fixtures.navigate.mockClear();
|
|
153
|
-
fixtures.onScheduleEmailingManagementEdit.mockClear();
|
|
154
|
-
fixtures.managementDialogProps = undefined;
|
|
155
|
-
fixtures.dialogProps = undefined;
|
|
156
|
-
fixtures.automationsError = undefined;
|
|
157
|
-
fixtures.seState.isScheduleEmailingDialogOpen = false;
|
|
158
|
-
fixtures.seState.isScheduleEmailingManagementDialogOpen = true;
|
|
159
|
-
});
|
|
160
|
-
it("navigates cross-dashboard when editing a schedule on another dashboard in shell mode", () => {
|
|
161
|
-
render(_jsx(ScheduledEmailConnector, {}));
|
|
162
|
-
const onEdit = fixtures.managementDialogProps?.["onEdit"];
|
|
163
|
-
expect(onEdit).toBeDefined();
|
|
164
|
-
onEdit?.({
|
|
165
|
-
id: "se-1",
|
|
166
|
-
dashboard: { id: "other-dashboard" },
|
|
167
|
-
});
|
|
168
|
-
expect(fixtures.buildAutomationUrl).toHaveBeenCalledWith({
|
|
169
|
-
workspaceId: "workspace-id",
|
|
170
|
-
dashboardId: "other-dashboard",
|
|
171
|
-
automationId: "se-1",
|
|
172
|
-
isEmbedded: false,
|
|
173
|
-
useHostRoute: true,
|
|
174
|
-
queryParams: { recipient: "recipient@example.com" },
|
|
175
|
-
});
|
|
176
|
-
expect(fixtures.navigate).toHaveBeenCalledWith("/target-url");
|
|
177
|
-
expect(fixtures.onScheduleEmailingManagementEdit).not.toHaveBeenCalled();
|
|
178
|
-
});
|
|
179
|
-
it("falls back to local edit when the target dashboard id is missing", () => {
|
|
180
|
-
render(_jsx(ScheduledEmailConnector, {}));
|
|
181
|
-
const onEdit = fixtures.managementDialogProps?.["onEdit"];
|
|
182
|
-
onEdit?.({
|
|
183
|
-
id: "se-2",
|
|
184
|
-
dashboard: undefined,
|
|
185
|
-
});
|
|
186
|
-
expect(fixtures.navigate).not.toHaveBeenCalled();
|
|
187
|
-
expect(fixtures.buildAutomationUrl).not.toHaveBeenCalled();
|
|
188
|
-
expect(fixtures.onScheduleEmailingManagementEdit).toHaveBeenCalledWith({
|
|
189
|
-
id: "se-2",
|
|
190
|
-
dashboard: undefined,
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
it("does not supply the deprecated data props to the create/edit dialog", () => {
|
|
194
|
-
fixtures.seState.isScheduleEmailingDialogOpen = true;
|
|
195
|
-
fixtures.seState.isScheduleEmailingManagementDialogOpen = false;
|
|
196
|
-
render(_jsx(ScheduledEmailConnector, {}));
|
|
197
|
-
expect(fixtures.dialogProps).toBeDefined();
|
|
198
|
-
for (const prop of [
|
|
199
|
-
"scheduledExportToEdit",
|
|
200
|
-
"users",
|
|
201
|
-
"usersError",
|
|
202
|
-
"notificationChannels",
|
|
203
|
-
"widget",
|
|
204
|
-
"insight",
|
|
205
|
-
"dashboardFilters",
|
|
206
|
-
"widgetFilters",
|
|
207
|
-
"isLoading",
|
|
208
|
-
]) {
|
|
209
|
-
expect(fixtures.dialogProps?.[prop]).toBeUndefined();
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
it("does not supply the deprecated data props to the management dialog", () => {
|
|
213
|
-
fixtures.automationsError = new Error("automations failed to load");
|
|
214
|
-
render(_jsx(ScheduledEmailConnector, {}));
|
|
215
|
-
expect(fixtures.managementDialogProps).toBeDefined();
|
|
216
|
-
for (const prop of [
|
|
217
|
-
"automations",
|
|
218
|
-
"isLoadingScheduleData",
|
|
219
|
-
"notificationChannels",
|
|
220
|
-
"scheduleDataError",
|
|
221
|
-
]) {
|
|
222
|
-
expect(fixtures.managementDialogProps?.[prop]).toBeUndefined();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
});
|
package/esm/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBuildAlertingDialogContext.test.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/connectors/hooks/useBuildAlertingDialogContext.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { renderHook } from "@testing-library/react";
|
|
3
|
-
import { describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { idRef, } from "@gooddata/sdk-model";
|
|
5
|
-
const fixtures = vi.hoisted(() => {
|
|
6
|
-
// A single, referentially stable execution-result envelope, simulating an
|
|
7
|
-
// unchanged normalized store entity across renders.
|
|
8
|
-
const stableExecutionResult = { readAll: () => Promise.resolve({}) };
|
|
9
|
-
const stableEnvelope = { isLoading: false, executionResult: stableExecutionResult };
|
|
10
|
-
// Any serialized ObjRef key resolves to the same stable envelope.
|
|
11
|
-
const entities = new Proxy({}, {
|
|
12
|
-
get: () => stableEnvelope,
|
|
13
|
-
});
|
|
14
|
-
return { stableEnvelope, entities };
|
|
15
|
-
});
|
|
16
|
-
vi.mock("@gooddata/sdk-ui", () => ({
|
|
17
|
-
useBackendStrict: vi.fn(() => ({ workspace: () => ({ automations: () => ({}) }) })),
|
|
18
|
-
useWorkspaceStrict: vi.fn(() => "workspace"),
|
|
19
|
-
}));
|
|
20
|
-
vi.mock("../../../../model/react/DashboardStoreProvider.js", () => ({
|
|
21
|
-
useDashboardSelector: vi.fn((selector) => selector()),
|
|
22
|
-
}));
|
|
23
|
-
vi.mock("../../../../model/react/useDashboardCommandProcessing.js", () => ({
|
|
24
|
-
useDashboardCommandProcessing: vi.fn(() => ({ run: vi.fn() })),
|
|
25
|
-
}));
|
|
26
|
-
vi.mock("../../../../model/commands/alerts.js", () => ({
|
|
27
|
-
createAlert: vi.fn(),
|
|
28
|
-
saveAlert: vi.fn(),
|
|
29
|
-
}));
|
|
30
|
-
vi.mock("../../../../model/store/executionResults/executionResultsSelectors.js", () => ({
|
|
31
|
-
selectExecutionResultEntities: () => fixtures.entities,
|
|
32
|
-
}));
|
|
33
|
-
vi.mock("../../../../model/store/filtering/dashboardFilterSelectors.js", () => ({
|
|
34
|
-
selectAutomationCommonDateFilterId: () => undefined,
|
|
35
|
-
selectAutomationDefaultSelectedFilters: () => [],
|
|
36
|
-
selectDashboardHiddenFilters: () => [],
|
|
37
|
-
}));
|
|
38
|
-
vi.mock("../../../../model/store/meta/metaSelectors.js", () => ({
|
|
39
|
-
selectDashboardId: () => "dashboard-1",
|
|
40
|
-
selectEvaluationFrequency: () => undefined,
|
|
41
|
-
}));
|
|
42
|
-
const parameterSentinels = vi.hoisted(() => ({
|
|
43
|
-
parameterValues: [],
|
|
44
|
-
dashboardParameters: [],
|
|
45
|
-
}));
|
|
46
|
-
vi.mock("../../../../model/store/tabs/parameters/parametersSelectors.js", () => ({
|
|
47
|
-
selectEffectiveParameterValuesForWidget: () => () => parameterSentinels.parameterValues,
|
|
48
|
-
selectEffectiveDashboardParametersForWidget: () => () => parameterSentinels.dashboardParameters,
|
|
49
|
-
}));
|
|
50
|
-
vi.mock("../../../../model/utils/dashboardItemUtils.js", () => ({
|
|
51
|
-
getWidgetTitle: () => "widget title",
|
|
52
|
-
}));
|
|
53
|
-
import { useBuildAlertingDialogContext } from "./useBuildAlertingDialogContext.js";
|
|
54
|
-
describe("useBuildAlertingDialogContext", () => {
|
|
55
|
-
it("returns a referentially stable execution-result envelope across renders (no render loop)", () => {
|
|
56
|
-
const ref = idRef("widget-1");
|
|
57
|
-
const { result, rerender } = renderHook(() => useBuildAlertingDialogContext({
|
|
58
|
-
mode: "create",
|
|
59
|
-
notificationChannels: [],
|
|
60
|
-
isLoading: false,
|
|
61
|
-
}));
|
|
62
|
-
const first = result.current.executionResultByRef(ref);
|
|
63
|
-
rerender();
|
|
64
|
-
const second = result.current.executionResultByRef(ref);
|
|
65
|
-
// The envelope must keep the same identity when the underlying store entity
|
|
66
|
-
// is unchanged. A fresh object each call makes useAttributeValuesFromExecResults'
|
|
67
|
-
// useEffect([execResult]) re-fire every render -> infinite readAll() loop ->
|
|
68
|
-
// the alerting dialog Overlay never stabilizes and stays hidden.
|
|
69
|
-
expect(second).toBe(first);
|
|
70
|
-
expect(first?.executionResult).toBe(fixtures.stableEnvelope.executionResult);
|
|
71
|
-
});
|
|
72
|
-
it("passes the create/edit inputs through to the context unchanged", () => {
|
|
73
|
-
const alertToEdit = { id: "alert-1", title: "My alert" };
|
|
74
|
-
const notificationChannels = [
|
|
75
|
-
{ id: "channel-1", type: "notificationChannel" },
|
|
76
|
-
];
|
|
77
|
-
const { result } = renderHook(() => useBuildAlertingDialogContext({
|
|
78
|
-
mode: "edit",
|
|
79
|
-
alertToEdit,
|
|
80
|
-
notificationChannels,
|
|
81
|
-
isLoading: true,
|
|
82
|
-
}));
|
|
83
|
-
expect(result.current.alertToEdit).toBe(alertToEdit);
|
|
84
|
-
expect(result.current.notificationChannels).toBe(notificationChannels);
|
|
85
|
-
expect(result.current.isLoading).toBe(true);
|
|
86
|
-
});
|
|
87
|
-
it("forwards the widget's effective dashboard parameters onto the alerting dialog context", () => {
|
|
88
|
-
const { result } = renderHook(() => useBuildAlertingDialogContext({
|
|
89
|
-
mode: "create",
|
|
90
|
-
notificationChannels: [],
|
|
91
|
-
isLoading: false,
|
|
92
|
-
}));
|
|
93
|
-
expect(result.current.dashboardParameters).toBe(parameterSentinels.dashboardParameters);
|
|
94
|
-
});
|
|
95
|
-
});
|