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

Remember expanded task groups in localStorage #14661

Merged
merged 3 commits into from
Mar 12, 2021

Conversation

yuqian90
Copy link
Contributor

@yuqian90 yuqian90 commented Mar 8, 2021

This PR makes the web UI restore previously expanded TaskGroups when the page is refreshed or re-opened. This is to preserve the look of the DAG across sessions. This is done by storing the list of expanded group_ids in localStorage.

Previous behaviour:

When the page is refreshed, the Graph View resets to the initial view (with all the TaskGroup collapsed by default).

Behaviour after this PR:

When the page is refreshed, the Graph View expands previously expanded TaskGroups, and puts the previously focused TaskGroup back in focus.

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Mar 8, 2021
@bbovenzi
Copy link
Contributor

bbovenzi commented Mar 8, 2021

Good idea! I like the pruning as well for when Dags change.
+1

Copy link
Contributor

@ryanahamilton ryanahamilton left a comment

Choose a reason for hiding this comment

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

@yuqian90 this is a nice feature, thank you!

We're in the process of migrating all of our JavaScript to external files (#14115) so we can integrate linting in our pre-commit hooks (#14154). There is some syntax currently that doesn't align with our current config. Would you mind updating those (left comments inline) to save us some time with these other efforts? (please double-check that my suggestions are indeed correct)

airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
airflow/www/templates/airflow/graph.html Outdated Show resolved Hide resolved
@yuqian90 yuqian90 force-pushed the remember_expanded_task_groups branch from 9bc2218 to c428329 Compare March 12, 2021 14:13
@yuqian90 yuqian90 force-pushed the remember_expanded_task_groups branch from c428329 to 06327ef Compare March 12, 2021 14:14
@yuqian90
Copy link
Contributor Author

@yuqian90 this is a nice feature, thank you!

We're in the process of migrating all of our JavaScript to external files (#14115) so we can integrate linting in our pre-commit hooks (#14154). There is some syntax currently that doesn't align with our current config. Would you mind updating those (left comments inline) to save us some time with these other efforts? (please double-check that my suggestions are indeed correct)

Thanks for the detailed comments. I corrected these syntax issues. That said, I did not do a thorough check of the entire graph.html to look for other syntax issues to avoid distracting the objective of this PR.

Copy link
Contributor

@ryanahamilton ryanahamilton left a comment

Choose a reason for hiding this comment

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

@yuqian90 thank you for making those updates! I tested this out locally and it works great.

@ryanahamilton ryanahamilton merged commit 456a7dd into apache:master Mar 12, 2021
@kaxil kaxil added this to the Airflow 2.0.2 milestone Mar 16, 2021
ashb pushed a commit that referenced this pull request Mar 19, 2021
* Save expanded and focused state of TaskGroups in localStorage

* Restore focus on refresh

* Address style issues according to comments

(cherry picked from commit 456a7dd)
ashb pushed a commit that referenced this pull request Apr 15, 2021
* Save expanded and focused state of TaskGroups in localStorage

* Restore focus on refresh

* Address style issues according to comments

(cherry picked from commit 456a7dd)
@yuqian90 yuqian90 deleted the remember_expanded_task_groups branch May 29, 2021 08:20
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants