Skip to content

Commit

Permalink
fix(ui): TE-2617 fix evaluate API error in create alert flow on date …
Browse files Browse the repository at this point in the history
…range change (#1740)
  • Loading branch information
nalin-patidar authored Jan 10, 2025
1 parent 1889dd7 commit d6fbe2d
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import { getAlertsAllPath } from "../../../utils/routes/routes.util";
import { AlertCreatedGuidedPageOutletContext } from "../../alerts-create-guided-page/alerts-create-guided-page.interfaces";
import { SETUP_DETAILS_TEST_IDS } from "../../alerts-create-guided-page/setup-details/setup-details-page.interface";
import { easyAlertStyles } from "./alerts-create-easy-page.styles";
import { generateInputFieldConfigsForAlertTemplate } from "../../../components/alert-wizard-v3/threshold-setup/threshold-setup.utils";

const PROPERTIES_TO_COPY = [
"dataSource",
Expand Down Expand Up @@ -644,7 +645,29 @@ export const AlertsCreateEasyPage: FunctionComponent = () => {
): void => {
const copiedAlert = { ...alertConfigForPreview, ...(alert ?? {}) };
delete copiedAlert.id;
getEvaluation(createAlertEvaluation(copiedAlert, start, end));
if (selectedAlertTemplate && algorithmOption) {
const requiredProperties =
generateInputFieldConfigsForAlertTemplate(
selectedAlertTemplate
);
const requiredPropertiesName = requiredProperties.map(
(requiredProperty) => requiredProperty.templatePropertyName
);
const alertProperties = alert?.templateProperties;
if (alertProperties) {
if (
requiredPropertiesName.every(
(requiredProperty) => alertProperties[requiredProperty]
)
) {
getEvaluation(
createAlertEvaluation(copiedAlert, start, end)
);
}
}
} else {
getEvaluation(createAlertEvaluation(copiedAlert, start, end));
}
};
// Update the preview config if selections change
useEffect(() => {
Expand Down Expand Up @@ -1891,7 +1914,8 @@ export const AlertsCreateEasyPage: FunctionComponent = () => {
) => {
fetchAlertEvaluation(
newStart,
newEnd
newEnd,
alert
);
}}
/>
Expand Down

0 comments on commit d6fbe2d

Please sign in to comment.