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

[dagit] Sectioned left nav #8017

Merged
merged 1 commit into from May 24, 2022

Conversation

hellendag
Copy link
Member

@hellendag hellendag commented May 23, 2022

Summary & Motivation

Split the left nav into expandable repository sections, with the list of the repo's jobs rendered below it.

  • Show the name of the repo and a tag with the number of (non-asset-group) jobs in that repo
  • Make the repo name/count clickable to expand/collapse the list of jobs below it
  • Show empty repositories, but make them disabled and gray them out
  • Surface repositories with jobs to the top of the list
  • For repository names that are repeated in multiple repo locations, additionally display the repo location under the repo name

This is behind a feature flag, settable at User Settings.

Will follow with a Jest test once we're settled on the layout and interactions.

How I Tested These Changes

View Dagit and Storybook example. Verify correct rendering, disabled state, expandability, collapsibility, job count, scrollability.

@linear
Copy link

linear bot commented May 23, 2022

DAGIT-34 Group left nav by repository

Organize all the jobs in the left nav by repository.

  • if a workspace has multiple repositories with the same name, show the repository location underneath the name
  • users can still filter out repositories at the bottom
  • when a group is collapsed, show the number of items it contains
  • Figma design

Mock:

image.png

@vercel
Copy link

vercel bot commented May 23, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated
dagit-storybook ⬜️ Ignored (Inspect) May 24, 2022 at 2:33PM (UTC)
dagster ⬜️ Ignored (Inspect) May 24, 2022 at 2:33PM (UTC)

@hellendag
Copy link
Member Author

hellendag commented May 23, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@hellendag hellendag force-pushed the dish/dagit-34-group-left-nav-by-repository branch from dcd1077 to 69824cb Compare May 23, 2022 19:16
@hellendag
Copy link
Member Author

Screen Shot 2022-05-23 at 1 52 22 PM

Screen Shot 2022-05-23 at 1 52 29 PM

Screen Shot 2022-05-23 at 2 16 12 PM

Copy link
Collaborator

@bengotow bengotow left a comment

Choose a reason for hiding this comment

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

This looks really great - I left a couple comments inline but nothing blocking, I'm excited to play around with this behind the flag and see if we can ditch the old version.

Curious if @braunjj has thoughts about whether we keep the "4 / 7 repos shown" behavior now that things can be collapsed? Maybe it's more useful to have both layers if you're grouping on another axis?

const EXPANDED_REPO_KEYS = 'dagit.expanded-repo-keys';

export const SectionedLeftNav = () => {
const {loading, visibleRepos} = React.useContext(WorkspaceContext);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it may be beyond the scope of this PR, but long term I'm not sure we want to have both hidden and collapsed, it may be ok to show all repos as collapsed all the time? The only scenario I can think of where you'd still want to HIDE a few is if you had a ton of them. (15+?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that many-repo case might be a genuine scenario that we need to cover. Either way, it's easy enough to change. :)

const {basePath} = React.useContext(AppContext);

const [expandedKeys, setExpandedKeys] = useStateWithStorage<string[]>(
basePath + ':' + EXPANDED_REPO_KEYS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It'd be interesting to explore baking this prefixing into useStateWithStorage. I can't think of any cases where this would be detrimental and I don't think I've been doing it...

const reposWithoutJobs = [];
for (const repo of alphaSorted) {
const jobs = repo.repository.pipelines;
if (jobs.length > 1 && jobs.some((job) => !isAssetGroup(job.name))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm I think this should be jobs.length > 0, because it'd be possible to have a repo with no assets that doesn't expose an asset group job and only one standard job? i don't /think/ asset group jobs are generated for repos that have no assets.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

overflow-x: hidden;
`;

const SectionHeader = styled.button<{$open: boolean; $showRepoLocation: boolean}>`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Props for using a nice semantic tag for this!

<BaseTag
fillColor={Colors.Gray10}
textColor={Colors.Dark}
label={new Intl.NumberFormat().format(jobItems.length)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we do this elsewhere with Number(1000).toLocaleString() , maybe they're short-hands for each other? (Actually need to read up on this version...)

@hellendag hellendag force-pushed the dish/dagit-34-group-left-nav-by-repository branch from 69824cb to d03fde3 Compare May 24, 2022 14:33
@hellendag hellendag merged commit aebfe43 into master May 24, 2022
@hellendag hellendag deleted the dish/dagit-34-group-left-nav-by-repository branch May 24, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants