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

Expand/collapse all groups #23487

Merged
merged 5 commits into from
May 5, 2022
Merged

Conversation

bbovenzi
Copy link
Contributor

@bbovenzi bbovenzi commented May 4, 2022

Add an expand/collapse all task groups button to grid view.
Place this and the autorefresh button above the grid part, and keep the "Show/hide details panel" button fixed to the right side of the screen.

May-05-2022 09-57-46

Screen Shot 2022-05-05 at 9 58 21 AM


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 newsfragement file, named {pr_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels May 4, 2022
@bbovenzi
Copy link
Contributor Author

bbovenzi commented May 4, 2022

cc: @argibbs

@argibbs
Copy link
Contributor

argibbs commented May 5, 2022

The behaviour looks perfect to me. Is there any way to set an option to select which is the default behaviour? (something as broad spectrum as a config flag would be enough for me...)

const openGroupIds = JSON.parse(localStorage.getItem(storageKey)) || [];

// Default to expand all if at least one group is closed
const [shouldExpand, setShouldExpand] = useState(allGroupIds.length > openGroupIds.length);
Copy link
Contributor Author

@bbovenzi bbovenzi May 5, 2022

Choose a reason for hiding this comment

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

@argibbs Right now, the default is to show "Expand all" if even one group is closed.

We could also do 2 buttons, but icon-only to avoid cluttering up the screen:
Screen Shot 2022-05-05 at 9 23 10 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the icon only approach, especially given the button won't change size when toggling like the text implementation does.

Not sure how I feel about two buttons. With one button, you might have to click it twice to get the desired state. On the other hand, I would imagine "collapse all" to be the most frequent use-case and that would always be just one click.

Copy link
Member

Choose a reason for hiding this comment

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

I too like buttons.

I think two buttons as it doesn't take up much screen space, and it feels more what I'd expect in a UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I updated the gif/screenshot in the PR description too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Default expand all fine for me, it's what I'd pick if there was a config flag anyway ...

@@ -88,11 +87,12 @@ const TaskInstances = ({
</Flex>
);

const storageKey = `${dagId}-open-groups`;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const storageKey = `${dagId}-open-groups`;
const storageKey = `${dagId}/open-groups`;

Just to avoid some kind of possible clash in future? (We could also use : instead -- a character that's not allowed in a dag_id)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Also, updated the variable name

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label May 5, 2022
@github-actions
Copy link

github-actions bot commented May 5, 2022

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@bbovenzi bbovenzi force-pushed the expand/collapse-all-groups branch from eca3631 to c2e2953 Compare May 5, 2022 15:12
@bbovenzi bbovenzi merged commit 83784d9 into apache:main May 5, 2022
@bbovenzi bbovenzi deleted the expand/collapse-all-groups branch May 5, 2022 18:20
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label May 20, 2022
ephraimbuddy pushed a commit that referenced this pull request May 20, 2022
* Add expand/collapse all groups button to Grid

* add tests

* add comments

* Switch to 2 icon buttons

Disable buttons if all groups are expanded or collapsed

* Update localStorage key

(cherry picked from commit 83784d9)
ephraimbuddy pushed a commit that referenced this pull request May 21, 2022
* Add expand/collapse all groups button to Grid

* add tests

* add comments

* Switch to 2 icon buttons

Disable buttons if all groups are expanded or collapsed

* Update localStorage key

(cherry picked from commit 83784d9)
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. area:webserver Webserver related Issues okay to merge It's ok to merge this PR as it does not require more tests type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants