Skip to content

Conversation

@astahlman
Copy link
Contributor

Note: this PR isn't fit to be merged, as it only addresses the Graph
view page. I'm sharing this for early review to make sure it's on the
right track. If there are no major objections to this approach, then
I'll apply similar changes to the other views.

Make sure you have checked all steps below.

Jira

Description

  • [ X ] Here are some details about my PR, including screenshots of any UI changes:

The clock element in the navbar is now a drop-down that allows time-zone
selection from two options: 'UTC' or 'Local' (the browser default). The
default is UTC, and this selection does not persist across page
refreshes. I'm open to suggestions here on whether the time-zone
selection should be "sticky", and if so, what's the right way to make it
so.

The Base date: datetimepicker requires a bit of hackery, since the
datetimepicker element bundled with Flask-AppBuilder doesn't seem to
have time zone support (see [1]). To work around this, we have to add an
offset to the (UTC) value in the picker so that the date string
displayed in the picker appears to be in the selected time zone, then
subtract the offset when we read the actual (UTC) value from the picker.

[1] dpgaspar/Flask-AppBuilder#920

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Front-end changes only

Commits

  • [ X ] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Code Quality

  • [ X ] Passes flake8

Note: this PR isn't fit to be merged, as it only addresses the Graph
view page. I'm sharing this for early review to make sure it's on the
right track. If there are no major objections to this approach, then
I'll apply similar changes to the other views.

The clock element in the navbar is now a drop-down that allows time-zone
selection from two options: 'UTC' or 'Local' (the browser default). The
default is UTC, and this selection does not persist across page
refreshes. I'm open to suggestions here on whether the time-zone
selection should be "sticky", and if so, what's the right way to make it
so.

The `Base date:` datetimepicker requires a bit of hackery, since the
datetimepicker element bundled with Flask-AppBuilder doesn't seem to
have time zone support (see [1]). To work around this, we have to add an
offset to the (UTC) value in the picker so that the date string
displayed in the picker appears to be in the selected time zone, then
subtract the offset when we read the actual (UTC) value from the picker.

[1] dpgaspar/Flask-AppBuilder#920
@astahlman
Copy link
Contributor Author

Screen Shot 2019-03-10 at 1 24 34 PM
Screen Shot 2019-03-10 at 1 24 51 PM
Screen Shot 2019-03-10 at 1 25 03 PM

@codecov-io
Copy link

codecov-io commented Mar 10, 2019

Codecov Report

Merging #4893 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #4893   +/-   ##
======================================
  Coverage    75.3%   75.3%           
======================================
  Files         450     450           
  Lines       29023   29023           
======================================
  Hits        21855   21855           
  Misses       7168    7168
Impacted Files Coverage Δ
airflow/models/__init__.py 92.85% <0%> (-0.06%) ⬇️
airflow/contrib/operators/ssh_operator.py 83.54% <0%> (+1.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e220ac5...5fbfc7a. Read the comment docs.

@feng-tao
Copy link
Member

hey @astahlman , does the default timezone in UI based on a config? Currently there is a config(https://github.com/apache/airflow/blob/master/airflow/config_templates/default_airflow.cfg#L78) to decide the default timezone for scheduler. I wonder whether we could do something similar in webserver as well.

@ashb
Copy link
Member

ashb commented Mar 13, 2019

I'm open to suggestions here on whether the time-zone selection should be "sticky", and if so, what's the right way to make it so.

Yes, it probably should be. Using a (client-side) cookie would be the way to go.

I agree with Feng - the default TZ should probably be what is in the config file. So we possibly need three options (depending on the values of the tzs): UTC, Airflow configured, Browser local.

@@ -0,0 +1,21 @@
/**
Copy link
Member

Choose a reason for hiding this comment

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

Should probably call this "base" or "common" or something - "index" is a unmeaningful to work out what might be in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I picked 'index' only because that's the file name that the webpack docs on Libraries used. I'm guessing there's a way to override that - I'll dig in a bit more and see if I can use base.js instead.

Copy link
Member

Choose a reason for hiding this comment

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

Not that important actually.

<script src="{{ url_for_asset('graph.js') }}"></script>
<script src="{{ url_for_asset('index.js') }}"></script>
<script type="text/javascript">
let dagTz = '{{ dag.timezone.name }}';
Copy link
Member

Choose a reason for hiding this comment

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

We've started putting thins like this in <meta> tags, rather than blocks of JS (or we have open PRs by @mik-laj to do that. I forget if we've merged them yet)

Copy link
Member

@mik-laj mik-laj Mar 14, 2019

Choose a reason for hiding this comment

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

@ashb PR is still waiting for you. :-) #4787

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, @mik-laj's PR looks good to me. I'll be happy to update this once #4787 is merged.

@ashb
Copy link
Member

ashb commented Mar 13, 2019

I like where this is going though.


</script>
<script src="{{ url_for_asset('graph.js') }}"></script>
<script src="{{ url_for_asset('index.js') }}"></script>
Copy link
Member

Choose a reason for hiding this comment

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

How does this play with the import of export { initRefreshButton, update_nodes_states } from './graph'; inside index.js? Is the include of graph.js on the previous line the same file?

@stale
Copy link

stale bot commented Sep 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 3, 2019
@stale stale bot closed this Sep 11, 2019
@eschachar eschachar deleted the astahlman/airflow-3981 branch September 24, 2022 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants