@gooddata/sdk-ui-dashboard 11.42.0-alpha.1 → 11.42.0-alpha.3
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 +6 -6
- package/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/_staging/automation/index.d.ts +14 -1
- package/esm/_staging/automation/index.d.ts.map +1 -1
- package/esm/_staging/automation/index.js +50 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- 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/tabs/parameters/parametersHelpers.d.ts +6 -0
- package/esm/model/store/tabs/parameters/parametersHelpers.d.ts.map +1 -1
- package/esm/model/store/tabs/parameters/parametersHelpers.js +11 -0
- package/esm/model/store/tabs/parameters/parametersSelectors.d.ts +7 -0
- package/esm/model/store/tabs/parameters/parametersSelectors.d.ts.map +1 -1
- package/esm/model/store/tabs/parameters/parametersSelectors.js +18 -7
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js +2 -2
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts +5 -0
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts.map +1 -1
- package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.js +20 -3
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +16 -2
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts +2 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts.map +1 -1
- package/esm/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js +32 -12
- package/esm/presentation/automations/shared/automationFilters/automationParameters.d.ts +75 -0
- package/esm/presentation/automations/shared/automationFilters/automationParameters.d.ts.map +1 -0
- package/esm/presentation/automations/shared/automationFilters/automationParameters.js +155 -0
- package/esm/presentation/automations/shared/automationFilters/components/AutomationFiltersSelect.d.ts +47 -2
- package/esm/presentation/automations/shared/automationFilters/components/AutomationFiltersSelect.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/components/AutomationFiltersSelect.js +69 -25
- package/esm/presentation/automations/shared/automationFilters/components/AutomationParameter.d.ts +21 -0
- package/esm/presentation/automations/shared/automationFilters/components/AutomationParameter.d.ts.map +1 -0
- package/esm/presentation/automations/shared/automationFilters/components/AutomationParameter.js +38 -0
- package/esm/presentation/automations/shared/automationFilters/hooks/useValidateExistingAutomationFilters.d.ts +23 -1
- package/esm/presentation/automations/shared/automationFilters/hooks/useValidateExistingAutomationFilters.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/hooks/useValidateExistingAutomationFilters.js +93 -2
- package/esm/presentation/automations/shared/automationFilters/useAutomationAlertParameters.d.ts +32 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationAlertParameters.d.ts.map +1 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationAlertParameters.js +57 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationExportParameters.d.ts +75 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationExportParameters.d.ts.map +1 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationExportParameters.js +143 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationFilters.d.ts +1 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationFilters.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/useAutomationFilters.js +1 -0
- package/esm/presentation/automations/shared/automationFilters/useAutomationFiltersSelect.d.ts.map +1 -1
- package/esm/presentation/automations/shared/automationFilters/useAutomationFiltersSelect.js +15 -2
- package/esm/presentation/automations/shared/automationFilters/useParameterAnnouncements.d.ts +15 -0
- package/esm/presentation/automations/shared/automationFilters/useParameterAnnouncements.d.ts.map +1 -0
- package/esm/presentation/automations/shared/automationFilters/useParameterAnnouncements.js +28 -0
- package/esm/presentation/dashboard/components/DashboardLoading.d.ts.map +1 -1
- package/esm/presentation/dashboard/components/DashboardLoading.js +12 -2
- package/esm/presentation/export/types.d.ts +1 -1
- package/esm/presentation/export/types.d.ts.map +1 -1
- package/esm/presentation/export/useExportData.d.ts +1 -1
- package/esm/presentation/export/useExportData.d.ts.map +1 -1
- package/esm/presentation/filterBar/attributeFilter/addAttributeFilter/AttributesDropdown.d.ts +20 -1
- package/esm/presentation/filterBar/attributeFilter/addAttributeFilter/AttributesDropdown.d.ts.map +1 -1
- package/esm/presentation/filterBar/attributeFilter/addAttributeFilter/AttributesDropdown.js +41 -6
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/de-DE.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-AU.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-GB.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts +20 -0
- package/esm/presentation/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/en-US.localization-bundle.js +20 -0
- package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/es-419.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/es-ES.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fi-FI.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fr-CA.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/fr-FR.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/id-ID.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/it-IT.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ja-JP.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ko-KR.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/nl-NL.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pl-PL.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pt-BR.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/pt-PT.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/ru-RU.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/sl-SI.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/th-TH.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/tr-TR.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/uk-UA.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/vi-VN.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-HK.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-Hans.localization-bundle.js +3 -11
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts +3 -11
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
- package/esm/presentation/localization/bundles/zh-Hant.localization-bundle.js +3 -11
- package/esm/presentation/widget/widget/InsightWidget/EditableDashboardInsightWidget.d.ts.map +1 -1
- package/esm/presentation/widget/widget/InsightWidget/EditableDashboardInsightWidget.js +10 -1
- package/esm/presentation/widget/widget/warningPartialResult/InsightWidgetWarningPartialResult.d.ts +5 -4
- package/esm/presentation/widget/widget/warningPartialResult/InsightWidgetWarningPartialResult.d.ts.map +1 -1
- package/esm/presentation/widget/widget/warningPartialResult/InsightWidgetWarningPartialResult.js +3 -3
- package/esm/sdk-ui-dashboard.d.ts +30 -3
- package/package.json +20 -20
- package/styles/css/dashboard.css +4 -1
- package/styles/css/dashboard.css.map +1 -1
- package/styles/css/main.css +5 -2
- package/styles/css/main.css.map +1 -1
- package/styles/css/warningPartialResult.css +1 -1
- package/styles/scss/dashboard.scss +9 -1
- package/styles/scss/warningPartialResult.scss +1 -1
|
@@ -10,7 +10,7 @@ import { selectIsInEditMode } from "../../renderMode/renderModeSelectors.js";
|
|
|
10
10
|
import { selectAllTabsInsightWidgetContexts } from "../layout/layoutSelectors.js";
|
|
11
11
|
import { selectActiveTab, selectTabs } from "../tabsSelectors.js";
|
|
12
12
|
import { DEFAULT_TAB_ID } from "../tabsState.js";
|
|
13
|
-
import { EMPTY_EXPORT_PARAMETERS, buildPersistedByTabAndRef, buildWidgetScopeTabRefSelections, collectExportOverrides, collectReferencedParameterRefs, computeParameterResetTargets, computeParameterResetValue, smartPersistResolvedEntry, workspaceParametersByRef, } from "./parametersHelpers.js";
|
|
13
|
+
import { EMPTY_EXPORT_PARAMETERS, applyRuntimeOverride, buildPersistedByTabAndRef, buildWidgetScopeTabRefSelections, collectExportOverrides, collectReferencedParameterRefs, computeParameterResetTargets, computeParameterResetValue, smartPersistResolvedEntry, workspaceParametersByRef, } from "./parametersHelpers.js";
|
|
14
14
|
import { parametersInitialState, pickTabParametersSource, } from "./parametersState.js";
|
|
15
15
|
const EMPTY_PARAMETERS = [];
|
|
16
16
|
const EMPTY_PARAMETER_VALUES = [];
|
|
@@ -48,12 +48,7 @@ export const selectFilterViewParameters = createSelector(selectDashboardParamete
|
|
|
48
48
|
if (entries.length === 0) {
|
|
49
49
|
return undefined;
|
|
50
50
|
}
|
|
51
|
-
return entries.map(
|
|
52
|
-
if (entry.runtimeOverride === undefined) {
|
|
53
|
-
return entry.parameter;
|
|
54
|
-
}
|
|
55
|
-
return { ...entry.parameter, value: entry.runtimeOverride };
|
|
56
|
-
});
|
|
51
|
+
return entries.map(applyRuntimeOverride);
|
|
57
52
|
});
|
|
58
53
|
/**
|
|
59
54
|
* Returns a selector that yields the entry held by the active tab for a given parameter ref,
|
|
@@ -230,6 +225,22 @@ export const selectEffectiveParameterValuesForWidget = createMemoizedSelector((r
|
|
|
230
225
|
}
|
|
231
226
|
return result.length === 0 ? EMPTY_PARAMETER_VALUES : result;
|
|
232
227
|
}));
|
|
228
|
+
/**
|
|
229
|
+
* Returns the effective dashboard parameters (persisted shape with any `runtimeOverride` folded
|
|
230
|
+
* into `value`) held by the widget's owning tab.
|
|
231
|
+
*
|
|
232
|
+
* @internal
|
|
233
|
+
*/
|
|
234
|
+
export const selectEffectiveDashboardParametersForWidget = createMemoizedSelector((ref) => createSelector(selectAllTabsInsightWidgetContexts, selectDashboardParameterEntries, (contexts, activeTabEntries) => {
|
|
235
|
+
if (ref === undefined) {
|
|
236
|
+
return activeTabEntries.map(applyRuntimeOverride);
|
|
237
|
+
}
|
|
238
|
+
// A concrete ref that resolves to no tab means the widget is not on the dashboard;
|
|
239
|
+
// falling back to the active tab would apply an unrelated tab's modes/labels/values.
|
|
240
|
+
const owningTabEntries = contexts.find((context) => areObjRefsEqual(context.widget.ref, ref))?.tab
|
|
241
|
+
.parameters?.parameters;
|
|
242
|
+
return (owningTabEntries ?? parametersInitialState.parameters).map(applyRuntimeOverride);
|
|
243
|
+
}));
|
|
233
244
|
/**
|
|
234
245
|
* Returns the per-tab parameter overrides to send on dashboard tabular export, keyed by
|
|
235
246
|
* tab `localIdentifier`. The shape matches the backend's `dashboardTabsParametersOverrides`
|
package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultAlertingDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.tsx"],"names":[],"mappings":"AAwDA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA4BxD,wBAAgB,sBAAsB,CAAC,EACnC,WAAW,EACX,KAAK,EACL,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EAChB,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"DefaultAlertingDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.tsx"],"names":[],"mappings":"AAwDA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA4BxD,wBAAgB,sBAAsB,CAAC,EACnC,WAAW,EACX,KAAK,EACL,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EAChB,EAAE,oBAAoB,2CA0kBtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,2CAahE"}
|
package/esm/presentation/automations/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js
CHANGED
|
@@ -63,7 +63,7 @@ export function AlertingDialogRenderer({ alertToEdit, users, usersError, notific
|
|
|
63
63
|
automationToEdit: alertToEdit,
|
|
64
64
|
widget,
|
|
65
65
|
});
|
|
66
|
-
const { onTitleChange, onRecipientsChange, onFiltersChange, onApplyCurrentFilters, onMeasureChange, getAttributeValues, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onChange, onBlur, onComparisonTypeChange, onDestinationChange, onTriggerModeChange, onTriggerIntervalChange, selectedMeasure, canChangeMeasure, supportedMeasures, canManageAttributes, selectedAttribute, selectedValue, supportedAttributes, catalogAttributes, catalogDateDatasets, isResultLoading, selectedComparisonOperator, selectedRelativeOperator, selectedAiOperator, value, selectedComparator, selectedSensitivity, onSensitivityChange, selectedGranularity, onGranularityChange, canManageComparison, separators, defaultUser, originalAutomation, editedAutomation, allowOnlyLoggedUserRecipients, allowExternalRecipients, warningMessage, validationErrorMessage, isInvalidConnectionToInsight, isSubmitDisabled, isParentValid, thresholdErrorMessage, allowHourlyRecurrence, } = useEditAlert({
|
|
66
|
+
const { onTitleChange, onRecipientsChange, onFiltersChange, onApplyCurrentFilters, automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, onMeasureChange, getAttributeValues, onAttributeChange, onComparisonOperatorChange, onRelativeOperatorChange, onAnomalyDetectionChange, onChange, onBlur, onComparisonTypeChange, onDestinationChange, onTriggerModeChange, onTriggerIntervalChange, selectedMeasure, canChangeMeasure, supportedMeasures, canManageAttributes, selectedAttribute, selectedValue, supportedAttributes, catalogAttributes, catalogDateDatasets, isResultLoading, selectedComparisonOperator, selectedRelativeOperator, selectedAiOperator, value, selectedComparator, selectedSensitivity, onSensitivityChange, selectedGranularity, onGranularityChange, canManageComparison, separators, defaultUser, originalAutomation, editedAutomation, allowOnlyLoggedUserRecipients, allowExternalRecipients, warningMessage, validationErrorMessage, isInvalidConnectionToInsight, isSubmitDisabled, isParentValid, thresholdErrorMessage, allowHourlyRecurrence, } = useEditAlert({
|
|
67
67
|
insight,
|
|
68
68
|
widget,
|
|
69
69
|
alertToEdit,
|
|
@@ -166,7 +166,7 @@ export function AlertingDialogRenderer({ alertToEdit, users, usersError, notific
|
|
|
166
166
|
}), ref: dialogTitleRef, secondaryTitle: secondaryTitle, secondaryTitleIcon: secondaryTitleIcon, isSecondaryTitleVisible: isSecondaryTitleVisible ? isParentValid : undefined })), children: [
|
|
167
167
|
_jsx("h2", { className: "sr-only", id: titleElementId, children: intl.formatMessage({ id: "dialogs.alert.accessibility.label.title" }) }), _jsxs(ScrollablePanel, { className: "gd-notifications-channel-dialog-content-wrapper gd-notification-channel-dialog-with-automation-filters", children: [
|
|
168
168
|
_jsx("div", { className: "gd-divider-with-margin" }), _jsxs(_Fragment, { children: [
|
|
169
|
-
_jsx(AutomationFiltersSelect, { availableFilters: availableFilters, selectedFilters: editedAutomationFilters, onFiltersChange: onFiltersChange, storeFilters: true, onStoreFiltersChange: () => { }, isDashboardAutomation: false, overlayPositionType: OVERLAY_POSITION_TYPE, disableDateFilters: isAnomalyDetection(editedAutomation?.alert) }), _jsx(ContentDivider, { className: "gd-divider-with-margin" })
|
|
169
|
+
_jsx(AutomationFiltersSelect, { availableFilters: availableFilters, selectedFilters: editedAutomationFilters, onFiltersChange: onFiltersChange, storeFilters: true, onStoreFiltersChange: () => { }, isDashboardAutomation: false, overlayPositionType: OVERLAY_POSITION_TYPE, disableDateFilters: isAnomalyDetection(editedAutomation?.alert), parameters: automationParameters, onParameterChange: onParameterChange, onParameterDelete: onParameterDelete, availableParameters: availableParameters, onParameterAdd: onParameterAdd }), _jsx(ContentDivider, { className: "gd-divider-with-margin" })
|
|
170
170
|
] }), _jsxs(FormFieldGroup, { label: _jsx(FormattedMessage, { id: "insightAlert.config.when" }), children: [
|
|
171
171
|
_jsx(FormField, { label: intl.formatMessage({ id: "insightAlert.config.metric" }), htmlFor: "alert.measure", children: _jsx(AlertMeasureSelect, { selectedMeasure: selectedMeasure, onMeasureChange: onMeasureChange, measures: supportedMeasures, disabled: !canChangeMeasure, overlayPositionType: OVERLAY_POSITION_TYPE, id: "alert.measure", closeOnParentScroll: CLOSE_ON_PARENT_SCROLL }) }), Boolean(canManageAttributes) &&
|
|
172
172
|
supportedAttributes.filter((a) => a.type === "attribute").length >
|
|
@@ -18,6 +18,11 @@ export declare function useEditAlert({ alertToEdit, notificationChannels, insigh
|
|
|
18
18
|
onRecipientsChange: (updatedRecipients: IAutomationRecipient[]) => void;
|
|
19
19
|
onFiltersChange: (filters: FilterContextItem[]) => void;
|
|
20
20
|
onApplyCurrentFilters: () => void;
|
|
21
|
+
automationParameters: import("../../../shared/automationFilters/automationParameters.js").IAutomationParameter[];
|
|
22
|
+
availableParameters: import("../../../shared/automationFilters/automationParameters.js").IAutomationParameter[];
|
|
23
|
+
onParameterChange: (ref: import("@gooddata/sdk-model").IdentifierRef, value: number) => void;
|
|
24
|
+
onParameterDelete: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
|
|
25
|
+
onParameterAdd: (ref: import("@gooddata/sdk-model").IdentifierRef) => void;
|
|
21
26
|
onMeasureChange: (measure: AlertMetric) => void;
|
|
22
27
|
getAttributeValues: (attr: import("@gooddata/sdk-model").IAttributeMetadataObject) => import("./useAttributeValuesFromExecResults.js").AttributeValue[];
|
|
23
28
|
onAttributeChange: (attribute: AlertAttribute | undefined, value: {
|
package/esm/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAI1C,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useEditAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/alerting/DefaultAlertingDialog/hooks/useEditAlert.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAI1C,MAAM,qBAAqB,CAAC;AAsC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AASzF,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAoCvG,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,wBAAwB,EAAE,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE9C,0BAA0B,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IACnE,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,uBAAuB,EAAE,iBAAiB,EAAE,CAAC;IAC7C,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,wBAAgB,YAAY,CAAC,EACzB,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,yBAAyB,EAC5B,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2nBpB"}
|
|
@@ -13,9 +13,12 @@ import { selectExecutionResultByRef } from "../../../../../model/store/execution
|
|
|
13
13
|
import { selectAutomationCommonDateFilterId, selectDashboardHiddenFilters, } from "../../../../../model/store/filtering/dashboardFilterSelectors.js";
|
|
14
14
|
import { selectDashboardDescriptor, selectDashboardId, } from "../../../../../model/store/meta/metaSelectors.js";
|
|
15
15
|
import { selectWidgetLocalIdToTabIdMap } from "../../../../../model/store/tabs/layout/layoutSelectors.js";
|
|
16
|
+
import { selectEffectiveParameterValuesForWidget } from "../../../../../model/store/tabs/parameters/parametersSelectors.js";
|
|
16
17
|
import { selectCurrentUser } from "../../../../../model/store/user/userSelectors.js";
|
|
17
18
|
import { selectUsers } from "../../../../../model/store/users/usersSelectors.js";
|
|
18
19
|
import { isEmail } from "../../../scheduledEmail/utils/validate.js";
|
|
20
|
+
import { setAlertExecutionParameters } from "../../../shared/automationFilters/automationParameters.js";
|
|
21
|
+
import { useAutomationAlertParameters } from "../../../shared/automationFilters/useAutomationAlertParameters.js";
|
|
19
22
|
import { getAppliedWidgetFilters, getVisibleFiltersByFilters, resolveMvfDimensionalityLocalRefs, } from "../../../shared/automationFilters/utils.js";
|
|
20
23
|
import { createDefaultAlert } from "../utils/convertors.js";
|
|
21
24
|
import { getAlertAiOperator, getAlertAttribute, getAlertCompareOperator, getAlertComparison, getAlertGranularity, getAlertMeasure, getAlertRelativeOperator, getAlertSensitivity, getMeasureFormatsFromExecution, } from "../utils/getters.js";
|
|
@@ -47,6 +50,7 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
|
|
|
47
50
|
const commonDateFilterId = useDashboardSelector(selectAutomationCommonDateFilterId);
|
|
48
51
|
const weekStart = useDashboardSelector(selectWeekStart);
|
|
49
52
|
const timezone = useDashboardSelector(selectTimezone);
|
|
53
|
+
const parameterValues = useDashboardSelector(selectEffectiveParameterValuesForWidget(widget?.ref));
|
|
50
54
|
const isInvalidConnectionToInsight = alertToEdit?.metadata?.widget && !insight;
|
|
51
55
|
const minimumRecurrenceMinutesEntitlement = useDashboardSelector(selectEntitlementMinimumRecurrenceMinutes);
|
|
52
56
|
const allowHourlyRecurrence = parseInt(minimumRecurrenceMinutesEntitlement?.value ?? DEFAULT_MIN_RECURRENCE_MINUTES, 10) === 60;
|
|
@@ -101,14 +105,22 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
|
|
|
101
105
|
},
|
|
102
106
|
};
|
|
103
107
|
})();
|
|
104
|
-
const [editedAutomation, setEditedAutomation] = useState(
|
|
105
|
-
|
|
108
|
+
const [editedAutomation, setEditedAutomation] = useState(() => {
|
|
109
|
+
if (resolvedAlertToEdit) {
|
|
110
|
+
return resolvedAlertToEdit;
|
|
111
|
+
}
|
|
112
|
+
const defaultNewAlert = createDefaultAlert(getAppliedWidgetFilters(editedAutomationFilters ?? [], dashboardHiddenFilters, widget, insight, commonDateFilterId, true, false), supportedMeasures, defaultMeasure, defaultNotificationChannelId, defaultRecipient, measureFormatMap, undefined, descriptor.evaluationFrequency
|
|
106
113
|
? {
|
|
107
114
|
cron: descriptor.evaluationFrequency,
|
|
108
115
|
timezone: settings.alertDefault?.defaultTimezone,
|
|
109
116
|
}
|
|
110
|
-
: undefined, getVisibleFiltersByFilters(editedAutomationFilters, availableFiltersAsVisibleFilters, true), widget?.localIdentifier, dashboardId, widget?.title, targetTabIdentifier)
|
|
117
|
+
: undefined, getVisibleFiltersByFilters(editedAutomationFilters, availableFiltersAsVisibleFilters, true), widget?.localIdentifier, dashboardId, widget?.title, targetTabIdentifier);
|
|
118
|
+
return defaultNewAlert && parameterValues.length > 0
|
|
119
|
+
? setAlertExecutionParameters(defaultNewAlert, parameterValues)
|
|
120
|
+
: defaultNewAlert;
|
|
121
|
+
});
|
|
111
122
|
const [originalAutomation] = useState(editedAutomation);
|
|
123
|
+
const { automationParameters, availableParameters, onParameterChange, onParameterDelete, onParameterAdd, } = useAutomationAlertParameters({ editedAutomation, setEditedAutomation, widgetRef: widget?.ref });
|
|
112
124
|
//
|
|
113
125
|
// Selected values
|
|
114
126
|
//
|
|
@@ -315,6 +327,11 @@ export function useEditAlert({ alertToEdit, notificationChannels, insight, widge
|
|
|
315
327
|
onRecipientsChange,
|
|
316
328
|
onFiltersChange,
|
|
317
329
|
onApplyCurrentFilters,
|
|
330
|
+
automationParameters,
|
|
331
|
+
availableParameters,
|
|
332
|
+
onParameterChange,
|
|
333
|
+
onParameterDelete,
|
|
334
|
+
onParameterAdd,
|
|
318
335
|
onMeasureChange,
|
|
319
336
|
getAttributeValues,
|
|
320
337
|
onAttributeChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultScheduledEmailDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultScheduledEmailDialog.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.tsx"],"names":[],"mappings":"AAiEA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAgE9D,wBAAgB,2BAA2B,CAAC,EACxC,qBAAqB,EACrB,KAAK,EACL,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,QAAQ,EACR,eAAe,EACf,aAAa,EACb,OAAO,EACP,MAAM,EACN,WAAW,EACX,aAAa,EACb,QAAQ,EACR,SAAS,EACZ,EAAE,0BAA0B,2CA0kB5B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,0BAA0B,2CAkB5E"}
|
|
@@ -20,6 +20,7 @@ import { IntlWrapper } from "../../../localization/IntlWrapper.js";
|
|
|
20
20
|
import { ApplyCurrentFiltersConfirmDialog } from "../../shared/automationFilters/components/ApplyLatestFiltersConfirmDialog.js";
|
|
21
21
|
import { AutomationFiltersSelect } from "../../shared/automationFilters/components/AutomationFiltersSelect.js";
|
|
22
22
|
import { useValidateExistingAutomationFilters } from "../../shared/automationFilters/hooks/useValidateExistingAutomationFilters.js";
|
|
23
|
+
import { useAutomationExportParameters } from "../../shared/automationFilters/useAutomationExportParameters.js";
|
|
23
24
|
import { useAutomationFiltersSelect } from "../../shared/automationFilters/useAutomationFiltersSelect.js";
|
|
24
25
|
import { DeleteScheduleConfirmDialog } from "../DefaultScheduledEmailManagementDialog/components/DeleteScheduleConfirmDialog.js";
|
|
25
26
|
import { useScheduleEmailDialogAccessibility } from "../hooks/useScheduleEmailDialogAccessibility.js";
|
|
@@ -73,7 +74,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
73
74
|
widget,
|
|
74
75
|
});
|
|
75
76
|
const { locale, dashboardTitle, dateFormat, weekStart, maxAutomationsRecipients, allowHourlyRecurrence, isCrossFiltering, isExecutionTimestampMode, enableNewScheduledExport, enableCustomizableCsvDelimiter, defaultPdfPageSize, } = useDefaultScheduledEmailDialogData();
|
|
76
|
-
const { defaultUser, editedAutomation, originalAutomation, isSubmitDisabled, xlsxSettings, pdfSettings, csvSettings, csvRawSettings, startDate, allowExternalRecipients, allowOnlyLoggedUserRecipients, validationErrorMessage, selectedAttachments, isParentValid, onDashboardAttachmentsChange, onWidgetAttachmentsChange, onXlsxSettingsChange, onPdfSettingsChange, onCsvSettingsChange, onCsvRawSettingsChange, slidesTemplateIds, onSlidesTemplateIdChange, onDestinationChange, onMessageChange, onRecipientsChange, onRecurrenceChange, onEvaluationModeChange, onSubjectChange, onTitleChange, onFiltersChange, onApplyCurrentFilters, onStoreFiltersChange, onFiltersByTabChange, enableAutomationEvaluationMode, } = useEditScheduledEmail({
|
|
77
|
+
const { defaultUser, editedAutomation, originalAutomation, isSubmitDisabled, xlsxSettings, pdfSettings, csvSettings, csvRawSettings, startDate, allowExternalRecipients, allowOnlyLoggedUserRecipients, validationErrorMessage, selectedAttachments, isParentValid, onDashboardAttachmentsChange, onWidgetAttachmentsChange, onXlsxSettingsChange, onPdfSettingsChange, onCsvSettingsChange, onCsvRawSettingsChange, slidesTemplateIds, onSlidesTemplateIdChange, onDestinationChange, onMessageChange, onRecipientsChange, onRecurrenceChange, onEvaluationModeChange, onSubjectChange, onTitleChange, onFiltersChange, onApplyCurrentFilters, onStoreFiltersChange, onFiltersByTabChange, setParametersWire, enableAutomationEvaluationMode, } = useEditScheduledEmail({
|
|
77
78
|
notificationChannels,
|
|
78
79
|
insight,
|
|
79
80
|
widget,
|
|
@@ -94,6 +95,18 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
94
95
|
setEditedAutomationFiltersByTab,
|
|
95
96
|
availableFiltersAsVisibleFiltersByTab,
|
|
96
97
|
});
|
|
98
|
+
const { parametersEnabled, visibleParametersByTab, availableParametersByTab, flatTabId, onParameterAdd, onParameterChange, onParameterDelete, onParameterAddByTab, onParameterChangeByTab, onParameterDeleteByTab, applyLatest: applyLatestParameters, onStoreParametersChange, } = useAutomationExportParameters({
|
|
99
|
+
automationToEdit: scheduledExportToEdit,
|
|
100
|
+
widget,
|
|
101
|
+
storeParameters: storeFilters,
|
|
102
|
+
setParametersWire,
|
|
103
|
+
});
|
|
104
|
+
// The store-filters checkbox gates parameter persistence too; the new value is passed to both
|
|
105
|
+
// sides because the `storeFilters` prop still holds the old one at call time.
|
|
106
|
+
const handleStoreFiltersChange = useCallback((value, filters, filtersByTabParam) => {
|
|
107
|
+
onStoreFiltersChange(value, filters, filtersByTabParam);
|
|
108
|
+
onStoreParametersChange(value);
|
|
109
|
+
}, [onStoreFiltersChange, onStoreParametersChange]);
|
|
97
110
|
const { isValid } = useValidateExistingAutomationFilters({
|
|
98
111
|
automationToEdit: scheduledExportToEdit,
|
|
99
112
|
widget,
|
|
@@ -172,6 +185,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
172
185
|
if (isApplyCurrentFiltersDialogOpen) {
|
|
173
186
|
return (_jsx(ApplyCurrentFiltersConfirmDialog, { automationType: "schedule", onCancel: () => onCancel?.(), onEdit: () => {
|
|
174
187
|
onApplyCurrentFilters();
|
|
188
|
+
applyLatestParameters();
|
|
175
189
|
setIsApplyCurrentFiltersDialogOpen(false);
|
|
176
190
|
} }));
|
|
177
191
|
}
|
|
@@ -209,7 +223,7 @@ export function ScheduledMailDialogRenderer({ scheduledExportToEdit, users, user
|
|
|
209
223
|
}), children: [
|
|
210
224
|
_jsx("div", { className: "gd-divider-with-margin" }), selectedTabId === "filters" ? (_jsx("div", { ref: filtersTabContentRef, className: "gd-schedule-dialog-tab-content", style: tabContentHeight
|
|
211
225
|
? { minHeight: `${tabContentHeight}px` }
|
|
212
|
-
: undefined, children: _jsx(AutomationFiltersSelect, { availableFilters: availableFilters, selectedFilters: editedAutomationFilters, onFiltersChange: onFiltersChange, storeFilters: storeFilters, onStoreFiltersChange:
|
|
226
|
+
: undefined, children: _jsx(AutomationFiltersSelect, { availableFilters: availableFilters, selectedFilters: editedAutomationFilters, onFiltersChange: onFiltersChange, storeFilters: storeFilters, onStoreFiltersChange: handleStoreFiltersChange, isDashboardAutomation: !widget, overlayPositionType: OVERLAY_POSITION_TYPE, hideTitle: true, showAllFilters: true, filtersByTab: filtersByTab, editedFiltersByTab: editedAutomationFiltersByTab, onFiltersByTabChange: onFiltersByTabChange, parameters: flatTabId ? visibleParametersByTab[flatTabId] : undefined, availableParameters: flatTabId ? availableParametersByTab[flatTabId] : undefined, onParameterChange: onParameterChange, onParameterDelete: onParameterDelete, onParameterAdd: onParameterAdd, parametersByTab: visibleParametersByTab, availableParametersByTab: availableParametersByTab, onParameterChangeByTab: onParameterChangeByTab, onParameterDeleteByTab: onParameterDeleteByTab, onParameterAddByTab: onParameterAddByTab, parametersEnabled: parametersEnabled }) })) : (_jsxs("div", { ref: generalTabContentRef, className: "gd-schedule-dialog-tab-content", children: [!widget && hasMultipleTabs ? (_jsx(Message, { type: "progress", className: "gd-schedule-dialog-tab-content-info", children: intl.formatMessage({
|
|
213
227
|
id: "dialogs.schedule.email.tabs.info",
|
|
214
228
|
}) })) : null, _jsx(RecurrenceForm, { startDate: startDate, cronExpression: editedAutomation.schedule?.cron ??
|
|
215
229
|
getDefaultCronExpression(startDate), cronDescription: editedAutomation.schedule?.cronDescription, timezone: editedAutomation.schedule?.timezone ??
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DashboardAttachmentType, type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IExportDefinitionVisualizationObjectSettings, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type WidgetAttachmentType } from "@gooddata/sdk-model";
|
|
1
|
+
import { type DashboardAttachmentType, type FilterContextItem, type IAutomationMetadataObject, type IAutomationMetadataObjectDefinition, type IAutomationRecipient, type IAutomationVisibleFilter, type IDashboardExportParameter, type IExportDefinitionVisualizationObjectSettings, type IFilter, type IInsight, type INotificationChannelIdentifier, type INotificationChannelMetadataObject, type WidgetAttachmentType } from "@gooddata/sdk-model";
|
|
2
2
|
import { type IAutomationFiltersTab } from "../../../../../model/store/filtering/dashboardFilterSelectors.js";
|
|
3
3
|
import { type ExtendedDashboardWidget } from "../../../../../model/types/layoutTypes.js";
|
|
4
4
|
export interface IUseEditScheduledEmailProps {
|
|
@@ -87,6 +87,7 @@ export declare function useEditScheduledEmail({ scheduledExportToEdit, notificat
|
|
|
87
87
|
onApplyCurrentFilters: () => void;
|
|
88
88
|
onStoreFiltersChange: (value: boolean, filters?: FilterContextItem[] | undefined, filtersByTabParam?: Record<string, FilterContextItem[]> | undefined) => void;
|
|
89
89
|
onFiltersByTabChange: (newFiltersByTab: Record<string, FilterContextItem[]>, storeFiltersParam?: boolean | undefined) => void;
|
|
90
|
+
setParametersWire: (wire: Record<string, IDashboardExportParameter[]> | undefined) => void;
|
|
90
91
|
enableAutomationEvaluationMode: boolean;
|
|
91
92
|
};
|
|
92
93
|
//# sourceMappingURL=useEditScheduledEmail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditScheduledEmail.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAE9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"useEditScheduledEmail.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/automations/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAE9B,KAAK,mCAAmC,EACxC,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,4CAA4C,EACjD,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,EAU5B,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EACH,KAAK,qBAAqB,EAG7B,MAAM,kEAAkE,CAAC;AAM1E,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAmBzF,MAAM,WAAW,2BAA2B;IACxC,qBAAqB,CAAC,EAAE,yBAAyB,CAAC;IAClD,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,kCAAkC,EAAE,CAAC;IAC9F,wBAAwB,EAAE,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAC1B,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9C,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACvC,0BAA0B,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAEnE;;;OAGG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACnE;;;OAGG;IACH,+BAA+B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,KAAK,IAAI,CAAC;IACzF,gBAAgB,CAAC,EAAE,qBAAqB,EAAE,GAAG,SAAS,CAAC;IACvD,gCAAgC,CAAC,EAAE,wBAAwB,EAAE,GAAG,SAAS,CAAC;IAC1E,qCAAqC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAEnF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,uBAAuB,EAAE,iBAAiB,EAAE,CAAC;IAC7C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,4CAA4C,CAAC,UAAU,CAAC,CAAC;CACjF;AAED,wBAAgB,qBAAqB,CAAC,EAClC,qBAAqB,EACrB,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,uBAAuB,EACvB,gBAAgB,EAChB,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,qCAAqC,EACxC,EAAE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAu2B7B"}
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { invariant } from "ts-invariant";
|
|
5
|
-
import { DEFAULT_CSV_DELIMITER, insightProperties, isAutomationExternalUserRecipient, isAutomationUnknownUserRecipient, isAutomationUserRecipient, isExportDefinitionDashboardRequestPayload, isExportDefinitionVisualizationObjectRequestPayload, isInsightWidget, isWidget, } from "@gooddata/sdk-model";
|
|
6
|
-
import { areAutomationsEqual, convertCurrentUserToAutomationRecipient, convertCurrentUserToWorkspaceUser, convertExternalRecipientToAutomationRecipient, } from "../../../../../_staging/automation/index.js";
|
|
5
|
+
import { DEFAULT_CSV_DELIMITER, insightProperties, isAutomationExternalUserRecipient, isAutomationUnknownUserRecipient, isAutomationUserRecipient, isExportDefinitionDashboardRequestPayload, isExportDefinitionVisualizationObjectRequestPayload, isInsightWidget, isWidget, objRefToString, } from "@gooddata/sdk-model";
|
|
6
|
+
import { areAutomationsEqual, convertCurrentUserToAutomationRecipient, convertCurrentUserToWorkspaceUser, convertExternalRecipientToAutomationRecipient, getAutomationExportParametersByTab, setExportParametersByTab, } from "../../../../../_staging/automation/index.js";
|
|
7
7
|
import { useDashboardSelector } from "../../../../../model/react/DashboardStoreProvider.js";
|
|
8
8
|
import { selectEnableAutomationEvaluationMode, selectEnableExternalRecipients, selectSettings, selectTimezone, } from "../../../../../model/store/config/configSelectors.js";
|
|
9
9
|
import { selectAutomationCommonDateFilterId, selectDashboardHiddenFilters, } from "../../../../../model/store/filtering/dashboardFilterSelectors.js";
|
|
10
10
|
import { selectDashboardId, selectDashboardTitle } from "../../../../../model/store/meta/metaSelectors.js";
|
|
11
11
|
import { selectWidgetLocalIdToTabIdMap } from "../../../../../model/store/tabs/layout/layoutSelectors.js";
|
|
12
|
+
import { selectExportEffectiveParameters } from "../../../../../model/store/tabs/parameters/parametersSelectors.js";
|
|
12
13
|
import { selectCurrentUser } from "../../../../../model/store/user/userSelectors.js";
|
|
13
14
|
import { selectUsers } from "../../../../../model/store/users/usersSelectors.js";
|
|
15
|
+
import { shouldStoreExportParameters } from "../../../shared/automationFilters/automationParameters.js";
|
|
14
16
|
import { getDefaultSelectedFiltersFromFiltersByTab } from "../../../shared/automationFilters/useAutomationFiltersSelect.js";
|
|
15
17
|
import { getAppliedDashboardFilters, getAppliedWidgetFilters, getVisibleFiltersByFilters, getVisibleFiltersByFiltersByTab, } from "../../../shared/automationFilters/utils.js";
|
|
16
18
|
import { toModifiedISOStringToTimezone, toNormalizedFirstRunAndCron, toNormalizedStartDate, } from "../../utils/date.js";
|
|
@@ -67,6 +69,12 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
67
69
|
}, [editedAutomationFiltersByTab, filtersDataByTab, storeFilters]);
|
|
68
70
|
const effectiveVisibleDashboardFilters = getVisibleFiltersByFilters(editedAutomationFilters ?? [], availableFiltersAsVisibleFilters, storeFilters);
|
|
69
71
|
const effectiveVisibleDashboardFiltersByTab = getVisibleFiltersByFiltersByTab(editedAutomationFiltersByTab, availableFiltersAsVisibleFiltersByTab, storeFilters);
|
|
72
|
+
const effectiveExportParametersByTab = useDashboardSelector(selectExportEffectiveParameters(widget ? [objRefToString(widget.ref)] : undefined));
|
|
73
|
+
// Mirrors the filters seed above, for parameters.
|
|
74
|
+
const parametersByTabForNewAutomation = shouldStoreExportParameters(isWidget, storeFilters) &&
|
|
75
|
+
Object.keys(effectiveExportParametersByTab).length > 0
|
|
76
|
+
? effectiveExportParametersByTab
|
|
77
|
+
: undefined;
|
|
70
78
|
const [editedAutomation, setEditedAutomation] = useState(scheduledExportToEdit ??
|
|
71
79
|
newAutomationMetadataObjectDefinition(isWidget
|
|
72
80
|
? {
|
|
@@ -84,6 +92,7 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
84
92
|
defaultPdfPageSize,
|
|
85
93
|
evaluationMode: "PER_RECIPIENT",
|
|
86
94
|
targetTabId,
|
|
95
|
+
parametersByTab: parametersByTabForNewAutomation,
|
|
87
96
|
}
|
|
88
97
|
: {
|
|
89
98
|
timezone,
|
|
@@ -98,8 +107,13 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
98
107
|
enableNewScheduledExport,
|
|
99
108
|
defaultPdfPageSize,
|
|
100
109
|
evaluationMode: "PER_RECIPIENT",
|
|
110
|
+
parametersByTab: parametersByTabForNewAutomation,
|
|
101
111
|
}));
|
|
102
112
|
const [originalAutomation] = useState(editedAutomation);
|
|
113
|
+
// The user-edit path into `content.parametersByTab`: re-encoded wire in, every export definition
|
|
114
|
+
// patched. Handed to `useAutomationExportParameters`, which owns when to call it. Definition
|
|
115
|
+
// rebuilds preserve the wire separately via `withRebuiltExportDefinitions`.
|
|
116
|
+
const setParametersWire = useCallback((wire) => setEditedAutomation((automation) => setExportParametersByTab(automation, wire)), []);
|
|
103
117
|
const selectedAttachments = useMemo(() => {
|
|
104
118
|
return (editedAutomation.exportDefinitions
|
|
105
119
|
?.map((exportDefinition) => exportDefinition.requestPayload.format)
|
|
@@ -174,10 +188,7 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
174
188
|
format,
|
|
175
189
|
}));
|
|
176
190
|
const updatedExportDefinitions = [...keptExportDefinitions, ...newExportDefinitions];
|
|
177
|
-
return
|
|
178
|
-
...s,
|
|
179
|
-
exportDefinitions: updatedExportDefinitions,
|
|
180
|
-
};
|
|
191
|
+
return withRebuiltExportDefinitions(s, updatedExportDefinitions);
|
|
181
192
|
});
|
|
182
193
|
};
|
|
183
194
|
const onWidgetAttachmentsChange = (formats) => {
|
|
@@ -201,10 +212,7 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
201
212
|
defaultPdfPageSize,
|
|
202
213
|
}));
|
|
203
214
|
const updatedExportDefinitions = [...keptExportDefinitions, ...newExportDefinitions];
|
|
204
|
-
return
|
|
205
|
-
...s,
|
|
206
|
-
exportDefinitions: updatedExportDefinitions,
|
|
207
|
-
};
|
|
215
|
+
return withRebuiltExportDefinitions(s, updatedExportDefinitions);
|
|
208
216
|
});
|
|
209
217
|
};
|
|
210
218
|
const onXlsxSettingsChange = useCallback((settings) => {
|
|
@@ -616,9 +624,21 @@ export function useEditScheduledEmail({ scheduledExportToEdit, notificationChann
|
|
|
616
624
|
onApplyCurrentFilters,
|
|
617
625
|
onStoreFiltersChange,
|
|
618
626
|
onFiltersByTabChange,
|
|
627
|
+
setParametersWire,
|
|
619
628
|
enableAutomationEvaluationMode,
|
|
620
629
|
};
|
|
621
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Replaces an automation's export definitions while preserving the current parameter wire. Freshly
|
|
633
|
+
* built definitions carry no `content.parametersByTab`, so without this the stored parameters would
|
|
634
|
+
* silently drop on any attachment-format change — the one place "rebuild definitions" stays paired
|
|
635
|
+
* with "keep parameters".
|
|
636
|
+
*/
|
|
637
|
+
function withRebuiltExportDefinitions(automation, exportDefinitions) {
|
|
638
|
+
const next = { ...automation, exportDefinitions };
|
|
639
|
+
const parametersByTab = getAutomationExportParametersByTab(automation);
|
|
640
|
+
return parametersByTab ? setExportParametersByTab(next, parametersByTab) : next;
|
|
641
|
+
}
|
|
622
642
|
function newDashboardExportDefinitionMetadataObjectDefinition({ dashboardId, dashboardTitle, dashboardFilters, filtersByTab, format, templateId, }) {
|
|
623
643
|
// Use filtersByTab if provided, otherwise fall back to simple filters
|
|
624
644
|
const filtersObj = filtersByTab
|
|
@@ -704,7 +724,7 @@ function newWidgetExportDefinitionMetadataObjectDefinition({ insight, widget, da
|
|
|
704
724
|
},
|
|
705
725
|
};
|
|
706
726
|
}
|
|
707
|
-
function newAutomationMetadataObjectDefinition({ timezone, dashboardId, notificationChannel, title, insight, widget, recipient, dashboardFilters, filtersByTab, widgetFilters, widgetFiltersWithInsight, visibleFiltersMetadata, visibleFiltersByTab, enableNewScheduledExport, defaultPdfPageSize, evaluationMode, targetTabId, }) {
|
|
727
|
+
function newAutomationMetadataObjectDefinition({ timezone, dashboardId, notificationChannel, title, insight, widget, recipient, dashboardFilters, filtersByTab, widgetFilters, widgetFiltersWithInsight, visibleFiltersMetadata, visibleFiltersByTab, enableNewScheduledExport, defaultPdfPageSize, evaluationMode, targetTabId, parametersByTab, }) {
|
|
708
728
|
const { firstRun, cron } = toNormalizedFirstRunAndCron(timezone);
|
|
709
729
|
const exportDefinition = widget && insight
|
|
710
730
|
? newWidgetExportDefinitionMetadataObjectDefinition({
|
|
@@ -763,5 +783,5 @@ function newAutomationMetadataObjectDefinition({ timezone, dashboardId, notifica
|
|
|
763
783
|
dashboard: dashboardId ? { id: dashboardId } : undefined,
|
|
764
784
|
...metadataObj,
|
|
765
785
|
};
|
|
766
|
-
return automation;
|
|
786
|
+
return parametersByTab ? setExportParametersByTab(automation, parametersByTab) : automation;
|
|
767
787
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type DashboardParameterMode, type IAutomationMetadataObjectDefinition, type IDashboardExportParameter, type IDashboardParameter, type IInsightParameterValue, type INumberParameterConstraints, type IParameterMetadataObject, type IdentifierRef } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* A workspace parameter resolved for display and editing inside an automation (alert/schedule)
|
|
4
|
+
* dialog. The `value` is the current effective value the headless run will capture.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface IAutomationParameter {
|
|
9
|
+
ref: IdentifierRef;
|
|
10
|
+
title: string;
|
|
11
|
+
value: number;
|
|
12
|
+
mode: DashboardParameterMode;
|
|
13
|
+
constraints?: INumberParameterConstraints;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Stored {@link IInsightParameterValue} overrides carry only {ref, value}; title, mode and
|
|
17
|
+
* constraints are re-derived from the current dashboard and workspace catalog.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function reconstructAutomationParametersFromValues(stored: IInsightParameterValue[], dashboardParameters: IDashboardParameter[], catalog: IParameterMetadataObject[]): IAutomationParameter[];
|
|
22
|
+
/**
|
|
23
|
+
* Stored export overrides ({@link IDashboardExportParameter}) carry the value as a string; it is
|
|
24
|
+
* parsed back to a number and non-finite values are dropped. Title, mode and constraints are
|
|
25
|
+
* re-derived from the current dashboard and workspace catalog, mirroring
|
|
26
|
+
* {@link reconstructAutomationParametersFromValues}.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function reconstructAutomationParametersFromExportParameters(stored: IDashboardExportParameter[], dashboardParameters: IDashboardParameter[], catalog: IParameterMetadataObject[]): IAutomationParameter[];
|
|
31
|
+
/**
|
|
32
|
+
* The stored value is carried as a string; non-finite values are dropped.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function exportParametersToValues(stored: IDashboardExportParameter[]): IInsightParameterValue[];
|
|
37
|
+
/**
|
|
38
|
+
* Parameters of unsupported types are dropped (cannot be rendered/clamped). Dashboard-`hidden`
|
|
39
|
+
* and `readonly` ones are dropped too — once added they would derive back to an invisible or
|
|
40
|
+
* locked (undeletable) chip.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function availableAutomationParameters(catalog: IParameterMetadataObject[], selected: IAutomationParameter[], dashboardParameters?: IDashboardParameter[], widgetParameterValues?: IInsightParameterValue[]): IAutomationParameter[];
|
|
45
|
+
/**
|
|
46
|
+
* Returns a copy of the automation with `alert.execution.parameters` replaced. No-op when the
|
|
47
|
+
* automation carries no alert.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function setAlertExecutionParameters(automation: IAutomationMetadataObjectDefinition, parameters: IInsightParameterValue[]): IAutomationMetadataObjectDefinition;
|
|
52
|
+
/**
|
|
53
|
+
* Encodes the display-ready chip set back to the neutral export wire shape ({id, value:string,
|
|
54
|
+
* title}). The full per-tab execution set (including `hidden` entries) is converted, not just the
|
|
55
|
+
* visible chips, so the server resolver does not drop omitted parameters to the workspace default.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare function automationParametersToExportParameters(parameters: IAutomationParameter[]): IDashboardExportParameter[];
|
|
60
|
+
/**
|
|
61
|
+
* Encodes the per-tab execution sets to the neutral export wire shape, or `undefined` when
|
|
62
|
+
* `shouldStore` is false (feature off / store-filters unchecked — signals "omit the field; use
|
|
63
|
+
* latest defaults"). Inverse of {@link reconstructAutomationParametersFromExportParameters}.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare function toEffectiveParametersByTab(parametersByTab: Record<string, IAutomationParameter[]>, shouldStore: boolean): Record<string, IDashboardExportParameter[]> | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* The single home for "does this export persist its parameters": widget schedules always do (they
|
|
70
|
+
* have no store-filters checkbox), dashboard schedules follow the store-filters checkbox.
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function shouldStoreExportParameters(isWidgetSchedule: boolean, storeFilters?: boolean): boolean;
|
|
75
|
+
//# sourceMappingURL=automationParameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automationParameters.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/automations/shared/automationFilters/automationParameters.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,sBAAsB,EAE3B,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAKrB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,CAAC,EAAE,2BAA2B,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,yCAAyC,CACrD,MAAM,EAAE,sBAAsB,EAAE,EAChC,mBAAmB,EAAE,mBAAmB,EAAE,EAC1C,OAAO,EAAE,wBAAwB,EAAE,GACpC,oBAAoB,EAAE,CAkBxB;AAED;;;;;;;GAOG;AACH,wBAAgB,mDAAmD,CAC/D,MAAM,EAAE,yBAAyB,EAAE,EACnC,mBAAmB,EAAE,mBAAmB,EAAE,EAC1C,OAAO,EAAE,wBAAwB,EAAE,GACpC,oBAAoB,EAAE,CAMxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,yBAAyB,EAAE,GAAG,sBAAsB,EAAE,CAQtG;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CACzC,OAAO,EAAE,wBAAwB,EAAE,EACnC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,mBAAmB,GAAE,mBAAmB,EAAO,EAC/C,qBAAqB,GAAE,sBAAsB,EAAO,GACrD,oBAAoB,EAAE,CAqCxB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,UAAU,EAAE,mCAAmC,EAC/C,UAAU,EAAE,sBAAsB,EAAE,GACrC,mCAAmC,CAcrC;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CAClD,UAAU,EAAE,oBAAoB,EAAE,GACnC,yBAAyB,EAAE,CAM7B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACtC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,EACvD,WAAW,EAAE,OAAO,GACrB,MAAM,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,GAAG,SAAS,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,UAAQ,GAAG,OAAO,CAEpG"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { DashboardParameterModeValues, idRef, isIdentifierRef, isNumberParameterDefinition, objRefToString, } from "@gooddata/sdk-model";
|
|
3
|
+
/**
|
|
4
|
+
* Stored {@link IInsightParameterValue} overrides carry only {ref, value}; title, mode and
|
|
5
|
+
* constraints are re-derived from the current dashboard and workspace catalog.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export function reconstructAutomationParametersFromValues(stored, dashboardParameters, catalog) {
|
|
10
|
+
const dashboardByRef = new Map(dashboardParameters.map((parameter) => [objRefToString(parameter.ref), parameter]));
|
|
11
|
+
const workspaceByRef = new Map(catalog.map((parameter) => [objRefToString(parameter.ref), parameter]));
|
|
12
|
+
return stored.map((row) => {
|
|
13
|
+
const refKey = objRefToString(row.ref);
|
|
14
|
+
const dashboardParameter = dashboardByRef.get(refKey);
|
|
15
|
+
const workspaceParameter = workspaceByRef.get(refKey);
|
|
16
|
+
const constraints = numberConstraints(workspaceParameter);
|
|
17
|
+
return {
|
|
18
|
+
ref: row.ref,
|
|
19
|
+
title: dashboardParameter?.label ?? workspaceParameter?.title ?? row.ref.identifier,
|
|
20
|
+
value: row.value,
|
|
21
|
+
mode: dashboardParameter?.mode ?? DashboardParameterModeValues.ACTIVE,
|
|
22
|
+
...(constraints ? { constraints } : {}),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stored export overrides ({@link IDashboardExportParameter}) carry the value as a string; it is
|
|
28
|
+
* parsed back to a number and non-finite values are dropped. Title, mode and constraints are
|
|
29
|
+
* re-derived from the current dashboard and workspace catalog, mirroring
|
|
30
|
+
* {@link reconstructAutomationParametersFromValues}.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export function reconstructAutomationParametersFromExportParameters(stored, dashboardParameters, catalog) {
|
|
35
|
+
return reconstructAutomationParametersFromValues(exportParametersToValues(stored), dashboardParameters, catalog);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The stored value is carried as a string; non-finite values are dropped.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export function exportParametersToValues(stored) {
|
|
43
|
+
return stored.reduce((acc, row) => {
|
|
44
|
+
const value = Number(row.value);
|
|
45
|
+
if (Number.isFinite(value)) {
|
|
46
|
+
acc.push({ ref: idRef(row.id, "parameter"), value });
|
|
47
|
+
}
|
|
48
|
+
return acc;
|
|
49
|
+
}, []);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parameters of unsupported types are dropped (cannot be rendered/clamped). Dashboard-`hidden`
|
|
53
|
+
* and `readonly` ones are dropped too — once added they would derive back to an invisible or
|
|
54
|
+
* locked (undeletable) chip.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export function availableAutomationParameters(catalog, selected, dashboardParameters = [], widgetParameterValues = []) {
|
|
59
|
+
const selectedRefKeys = new Set(selected.map((parameter) => objRefToString(parameter.ref)));
|
|
60
|
+
const dashboardByRef = new Map(dashboardParameters.map((parameter) => [objRefToString(parameter.ref), parameter]));
|
|
61
|
+
const widgetValueByRef = new Map(widgetParameterValues.map((row) => [objRefToString(row.ref), row.value]));
|
|
62
|
+
const result = [];
|
|
63
|
+
for (const workspaceParameter of catalog) {
|
|
64
|
+
if (!isNumberParameterDefinition(workspaceParameter.definition)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const { ref } = workspaceParameter;
|
|
68
|
+
if (!isIdentifierRef(ref)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const refKey = objRefToString(ref);
|
|
72
|
+
const dashboardParameter = dashboardByRef.get(refKey);
|
|
73
|
+
if (selectedRefKeys.has(refKey) ||
|
|
74
|
+
dashboardParameter?.mode === DashboardParameterModeValues.HIDDEN ||
|
|
75
|
+
dashboardParameter?.mode === DashboardParameterModeValues.READONLY) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const { defaultValue, constraints } = workspaceParameter.definition;
|
|
79
|
+
result.push({
|
|
80
|
+
ref,
|
|
81
|
+
title: dashboardParameter?.label ?? workspaceParameter.title,
|
|
82
|
+
// mirror the live-render precedence: runtimeOverride/insight value > dashboard value > default
|
|
83
|
+
value: widgetValueByRef.get(refKey) ?? dashboardParameter?.value ?? defaultValue,
|
|
84
|
+
mode: DashboardParameterModeValues.ACTIVE,
|
|
85
|
+
...(constraints ? { constraints } : {}),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns a copy of the automation with `alert.execution.parameters` replaced. No-op when the
|
|
92
|
+
* automation carries no alert.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
export function setAlertExecutionParameters(automation, parameters) {
|
|
97
|
+
if (!automation.alert) {
|
|
98
|
+
return automation;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
...automation,
|
|
102
|
+
alert: {
|
|
103
|
+
...automation.alert,
|
|
104
|
+
execution: {
|
|
105
|
+
...automation.alert.execution,
|
|
106
|
+
parameters,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Encodes the display-ready chip set back to the neutral export wire shape ({id, value:string,
|
|
113
|
+
* title}). The full per-tab execution set (including `hidden` entries) is converted, not just the
|
|
114
|
+
* visible chips, so the server resolver does not drop omitted parameters to the workspace default.
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
export function automationParametersToExportParameters(parameters) {
|
|
119
|
+
return parameters.map((parameter) => ({
|
|
120
|
+
id: parameter.ref.identifier,
|
|
121
|
+
value: String(parameter.value),
|
|
122
|
+
title: parameter.title,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Encodes the per-tab execution sets to the neutral export wire shape, or `undefined` when
|
|
127
|
+
* `shouldStore` is false (feature off / store-filters unchecked — signals "omit the field; use
|
|
128
|
+
* latest defaults"). Inverse of {@link reconstructAutomationParametersFromExportParameters}.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
export function toEffectiveParametersByTab(parametersByTab, shouldStore) {
|
|
133
|
+
if (!shouldStore) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const result = {};
|
|
137
|
+
for (const [tabId, parameters] of Object.entries(parametersByTab)) {
|
|
138
|
+
result[tabId] = automationParametersToExportParameters(parameters);
|
|
139
|
+
}
|
|
140
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The single home for "does this export persist its parameters": widget schedules always do (they
|
|
144
|
+
* have no store-filters checkbox), dashboard schedules follow the store-filters checkbox.
|
|
145
|
+
*
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
export function shouldStoreExportParameters(isWidgetSchedule, storeFilters = false) {
|
|
149
|
+
return isWidgetSchedule || storeFilters;
|
|
150
|
+
}
|
|
151
|
+
function numberConstraints(workspaceParameter) {
|
|
152
|
+
return workspaceParameter && isNumberParameterDefinition(workspaceParameter.definition)
|
|
153
|
+
? workspaceParameter.definition.constraints
|
|
154
|
+
: undefined;
|
|
155
|
+
}
|