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

AIP-38 | List Import Errors #44021

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

shubhamraj-git
Copy link
Contributor

@shubhamraj-git shubhamraj-git commented Nov 14, 2024

closes: #43711

Screenshot 2024-11-16 at 2 13 09 AM Screenshot 2024-11-16 at 2 13 18 AM Screenshot 2024-11-16 at 2 13 57 AM Screenshot 2024-11-16 at 2 14 24 AM

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Nov 14, 2024
@@ -18,7 +18,8 @@
*/
import { Box, Heading } from "@chakra-ui/react";

import { Health } from "./Health";
import { Health } from "./Health/Health";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can create Health/index.ts to have export { Health } from './Health' to avoid ./Health/Health and just ./Health . Similar change for Stats.

@tirkarthi
Copy link
Contributor

One point to add is that current import errors are shown all at once in the legacy home page which makes using Ctrl+F easier to search especially on large Airflow instances with lot of users and hundreds of import errors which might not be possible anymore with pagination.

Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! I left a few comments that should make this PR simpler.

airflow/ui/src/pages/Dashboard/Dashboard.tsx Outdated Show resolved Hide resolved
airflow/ui/src/queries/useDagsImportErrors.tsx Outdated Show resolved Hide resolved
airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx Outdated Show resolved Hide resolved
airflow/ui/src/pages/Dashboard/Stats/Stats.tsx Outdated Show resolved Hide resolved
{importErrorsCount}
</Badge>
<Box alignItems="center" display="flex" gap={1}>
<Text fontWeight="bold">DAG Import Errors</Text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dag is used instead of DAG in most parts with renaming done in #43325 . Probably could also be done in this PR for user visible content. Thanks.

@shubhamraj-git
Copy link
Contributor Author

One point to add is that current import errors are shown all at once in the legacy home page which makes using Ctrl+F easier to search especially on large Airflow instances with lot of users and hundreds of import errors which might not be possible anymore with pagination.

@tirkarthi I have added a search option to do that.

open: boolean;
};

const PAGE_LIMIT = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing some manual testing. I think we can increase this to 15

<Heading size="xl">Dag Import Errors</Heading>
<Input
mt={4}
onChange={(letters) => setSearchQuery(letters.target.value)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange={(letters) => setSearchQuery(letters.target.value)}
onChange={(event) => setSearchQuery(event.target.value)}

We're accessing a ChangeEvent. Let's not rename it.


<Pagination.Root
count={filteredErrors.length}
onPageChange={(each) => setPage(each.page)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onPageChange={(each) => setPage(each.page)}
onPageChange={(event) => setPage(event.page)}

Comment on lines +100 to +102
<Text color="fg.error" fontSize="sm" whiteSpace="pre-wrap">
<code>{importError.stack_trace}</code>
</Text>
Copy link
Contributor

@bbovenzi bbovenzi Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Text color="fg.error" fontSize="sm" whiteSpace="pre-wrap">
<code>{importError.stack_trace}</code>
</Text>
<Code color="fg.error" fontSize="sm" whiteSpace="pre-wrap">
{importError.stack_trace}
</Code>

We can just use chakra's Code component


const {
data,
error: DagImportErrorFailure,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error: DagImportErrorFailure,
error,

First, we don't want to capitalize regular variable names. Second, I think just error is fine, apiError if you want to be more specific

const importErrorsCount = data?.total_entries ?? 0;
const importErrors = data?.import_errors ?? [];

if (isFetching || isLoading) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isFetching || isLoading) {
if (iisLoading) {

Let's do just isLoading, so we can fetch in the background without bothering the user.

Comment on lines +55 to +63
useEffect(() => {
const query = searchQuery.toLowerCase();
const filtered = importErrors.filter((error) =>
error.filename.toLowerCase().includes(query),
);

setFilteredErrors(filtered);
setPage(1);
}, [searchQuery, importErrors]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we probably want to add a search param to the request and handle all search+pagination through the API.

Let's leave a TODO comment for that at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIP-38 | List Import Errors
3 participants