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

feat(frontend/ingestion): Support flagged / warning / connection failure statuses; add recipe #8920

Merged
merged 4 commits into from
Oct 18, 2023

Conversation

asikowitz
Copy link
Collaborator

@asikowitz asikowitz commented Sep 28, 2023

Prepares frontend to be able to render new ingestion statuses. I was going to put these statuses in the metadata model, but that seems kind of committal. I make two changes to the existing statuses on the frontend:

  • Change cancelled status icon
  • Adds periods to the status description copy

Also adds a recipe section because I want this all the time when debugging.

Screenshot 2023-09-28 at 4 39 27 PM Screenshot 2023-09-28 at 4 39 32 PM Screenshot 2023-09-28 at 4 37 17 PM Screenshot 2023-09-28 at 4 37 28 PM Screenshot 2023-09-28 at 4 37 35 PM Screenshot 2023-09-28 at 4 37 44 PM

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

const isOutputExpandable = output.length > 100;

const recipeJson = data?.executionRequest?.input.arguments?.find((arg) => arg.key === 'recipe')?.value;
const recipeYaml = recipeJson && YAML.stringify(JSON.parse(recipeJson), 8, 2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need error handling here? maybe fallback to raw string if json parsing fails?

<ShowMoreButton type="link" onClick={() => setShowExpandedLogs(!showExpandedLogs)}>
{showExpandedLogs ? 'Hide' : 'Show More'}
</ShowMoreButton>
)}
</Typography.Paragraph>
</LogsSection>
{recipe && (
<RecipeSection>
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm very excited for this

Copy link
Collaborator

Choose a reason for hiding this comment

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

w00000hoooo

(status === FAILURE && 'red') ||
(status === CONNECTION_FAILURE && 'crimson') ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably want to refactor this to be a map of status -> {color, text, icon} and then make all of these methods just to a map lookup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, would be a nice follow-up

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator

@hsheth2 hsheth2 left a comment

Choose a reason for hiding this comment

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

LGTM

want to get chris's eyes on this too

try {
recipeYaml = recipeJson && YAML.stringify(JSON.parse(recipeJson), 8, 2);
} catch (e) {
recipeYaml = '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can also just fall back to

Suggested change
recipeYaml = '';
recipeYaml = recipeJson;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd probably want to alter the expanding logic if I supported this, so going to hold off on making this change for simplicity. If this is a common occurrence we can revisit

@@ -40,7 +43,10 @@ export function getPlaceholderRecipe(ingestionSources: SourceConfig[], type?: st

export const RUNNING = 'RUNNING';
export const SUCCESS = 'SUCCESS';
export const FLAGGED = 'FLAGGED';
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does flagged mean?

export const FAILURE = 'FAILURE';
export const CONNECTION_FAILURE = 'CONNECTION_FAILURE';
Copy link
Collaborator

Choose a reason for hiding this comment

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

really happy to finally see us adding more rich statuses.

we are doing the same in datahub-monitors-service when running a test. we should align on the error types where possible.

Copy link
Collaborator

@chriscollins3456 chriscollins3456 left a comment

Choose a reason for hiding this comment

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

nice! the code looks solid. as far as UX goes I'd vote for making the recipe section expandable to show or hide the whole section as opposed to always showing a truncated recipe (since some users won't care about the recipe)

I could be overruled though and don't feel too strongly here

<ShowMoreButton type="link" onClick={() => setShowExpandedLogs(!showExpandedLogs)}>
{showExpandedLogs ? 'Hide' : 'Show More'}
</ShowMoreButton>
)}
</Typography.Paragraph>
</LogsSection>
{recipe && (
<RecipeSection>
<SectionHeader level={5}>Recipe</SectionHeader>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this whole recipe should be hidden by default and expanded only if they care to see it, as opposed to showing a truncated recipe with ... inside of the code block for the recipe itself that you show more or less of - which feels weird itself tbh (even though we do that with logs above it)

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can make it more like the "Advanced" section at the end of defining a recipe with a toggle button to the side of the title "Recipe" (which could remain the same styling as you have now) that would show or hide the whole recipe section, so users who don't care about the recipe don't see it at all

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

alternatively to hiding the whole section, I'd like to show less of the recipe so that it doesn't show so much right away like i'm seeing in your screenshot (seems like we show 75% of the recipe right away and takes up much more room than the logs part)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm happy to do either, just not sure the best way to do the styling... like the > Advanced is pretty clear it's expandable but how to do the same for the recipe section lol.

I am showing exactly 10 lines of the recipe right now. I'll just drop that down to 1-3

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2023-10-17 at 7 11 28 PM This good?

Copy link
Collaborator

Choose a reason for hiding this comment

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

much better!

Comment on lines +196 to +210
<SectionSubHeader>
<SubHeaderParagraph type="secondary">
The recipe used for this ingestion run.
</SubHeaderParagraph>
</SectionSubHeader>
<Typography.Paragraph ellipsis>
<pre>{`${recipe}${!showExpandedRecipe && isRecipeExpandable ? '\n...' : ''}`}</pre>
</Typography.Paragraph>
{isRecipeExpandable && (
<ShowMoreButton type="link" onClick={() => setShowExpandedRecipe((v) => !v)}>
{showExpandedRecipe ? 'Hide' : 'Show More'}
</ShowMoreButton>
)}
</RecipeSection>
)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'd advocate for bringing this out into its own small component and we could put shared styled components in a shared file or something

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Considering the other sections aren't in their own components, and this component isn't really reusable, I'd rather leave this as is. Eventually I think we'll redesign this entire modal so I don't feel as bad about leaving this like this

Copy link
Collaborator

Choose a reason for hiding this comment

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

i mean that's fine, but in general just because other pieces aren't broken out into their own components doesn't mean we can't write cleaner frontend code going forward.

@asikowitz asikowitz merged commit b3ac42b into datahub-project:master Oct 18, 2023
37 of 39 checks passed
@asikowitz asikowitz deleted the ingestion-status-frontend branch October 18, 2023 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX release-0.12.0 PRs targeted for Release 0.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants