Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-8231 Displaying CQL errors or external CQL errors only if their e… #177

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/components/editCqlLibrary/EditCqlLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
setErrorMessage("An error occurred while fetching the CQL Library!");
});
}
}, [id, resetForm, loadedCqlLibrary, cqlLibraryServiceApi]);

Check warning on line 176 in src/components/editCqlLibrary/EditCqlLibrary.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'handleAnnotations'. Either include it or remove the dependency array

// fetch organizations DB using measure service and sorts alphabetically
useEffect(() => {
Expand All @@ -189,7 +189,7 @@
const message = `Error fetching organizations`;
handleToast("danger", message, true);
});
}, []);

Check warning on line 192 in src/components/editCqlLibrary/EditCqlLibrary.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'organizationApi'. Either include it or remove the dependency array

async function updateCqlLibrary(cqlLibrary: CqlLibrary) {
setActiveSpinner(true);
Expand Down Expand Up @@ -232,7 +232,10 @@
const cqlElmErrors =
!_.isEmpty(
_.filter(validationResult?.errors, { errorSeverity: "Error" })
) || !_.isEmpty(validationResult?.externalErrors);
) ||
!_.isEmpty(
_.filter(validationResult?.externalErrors, { errorSeverity: "Error" })
);

const cqlErrors = updatedContent.cql?.trim().length
? parseErrors || cqlElmErrors
Expand Down Expand Up @@ -332,8 +335,10 @@
// right now we are only displaying the external errors related to included libraries
// and only the first error returned by elm translator
if (errors?.length > 0 || externalErrors?.length > 0) {
const elmErrors = _.filter(errors, { errorSeverity: "Error" });
setError(!_.isEmpty(elmErrors) || externalErrors.length > 0);
setError(
!_.isEmpty(_.filter(errors, { errorSeverity: "Error" })) ||
!_.isEmpty(_.filter(externalErrors, { errorSeverity: "Error" }))
);
}
setErrorMessage(externalErrors[0]?.message);
setElmAnnotations(mapElmErrorsToAceAnnotations(errors));
Expand Down
Loading