[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17057369#comment-17057369 ] ASF GitHub Bot commented on AIRFLOW-3981: - samblackk commented on pull request #7693: [AIRFLOW-3981] Locale-formatted datetimes (UI only) URL: https://github.com/apache/airflow/pull/7693 In addition to Airflow being timezone aware, this PR handles formatting datetime in the UI. This PR **does not** modify the timestamps to that of the users current time - instead translates the servers UTC timestamps to a readable format(s). This project is split about 50/50 between a new `wwwutils` def: ``` def localized_f(attr_name): def dt(attr): f = attr.get(attr_name) if f is None: return Markup('{}').format(f, f) else: f = f.strftime(date_format) return Markup('{}').format(f, f) return dt ``` And 2 new global javascript funcs in `static/base.js`: ``` export function localizedDate(date) { const locale = window.navigator.userLanguage || window.navigator.language; if (date) return moment(date).locale(locale).format('LLL'); return ''; } export function localizedTime(time) { const locale = window.navigator.userLanguage || window.navigator.language; if (time) return moment(time).locale(locale).format('LTS'); return ''; } ``` Previews (with different locales; english, french, german): https://user-images.githubusercontent.com/6862485/76462335-e2980500-63b7-11ea-87cf-4194713ff6d4.png;> https://user-images.githubusercontent.com/6862485/76462050-66052680-63b7-11ea-8d03-cb5ca267668d.png;> https://user-images.githubusercontent.com/6862485/76462056-68678080-63b7-11ea-888e-ecd1659cae1f.png;> --- Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg) Make sure to mark the boxes below before creating PR: [x] - [x] Description above provides context of the change - [x] Commit message/PR title starts with `[AIRFLOW-]`. AIRFLOW- = JIRA ID* - [x] Unit tests coverage for changes (not needed for documentation changes) - [x] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)" - [x] Relevant documentation is updated including usage instructions. - [x] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example). * For document-only changes commit message can start with `[AIRFLOW-]`. --- In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed. In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md). Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement > Components: ui >Reporter: Tao Feng >Assignee: Andrew Stahlman >Priority: Major > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16789025#comment-16789025 ] Andrew Stahlman commented on AIRFLOW-3981: -- I've opened [https://github.com/apache/airflow/pull/4893] to share my progress. So far it only addresses only the Graph View page. If there are no major objections to this approach, then I'll incorporate any feedback and address the remaining pages. > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Assignee: Andrew Stahlman >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16787047#comment-16787047 ] Andrew Stahlman commented on AIRFLOW-3981: -- Yeah, using moment to convert the time should be doable - I'll take a stab it if I get some time this weekend. Unfortunately, I don't see a way to customize the formatting of the selected date to include the time zone, which could be a little confusing since all of the other timestamps in the UI would include the UTC offset. > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Assignee: Andrew Stahlman >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16785617#comment-16785617 ] Ash Berlin-Taylor commented on AIRFLOW-3981: https://github.com/dpgaspar/Flask-AppBuilder/blob/master/flask_appbuilder/static/appbuilder/datepicker/bootstrap-datepicker.js which points at http://www.eyecon.ro/bootstrap-datepicker which doesn't show anything about Timezone support - so we'd have to use some other library to convert times in to UTC before sending them to the server https://momentjs.com/timezone/ perhaps (we are already using moment, so moment-timezone seems like a good compliment) > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Assignee: Andrew Stahlman >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16785079#comment-16785079 ] Tao Feng commented on AIRFLOW-3981: --- cc [~verdan] our Airflow UI expect [~tronbabylove] I asked your question trough FAB issues(https://github.com/dpgaspar/Flask-AppBuilder/issues/920). > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Assignee: Andrew Stahlman >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16783583#comment-16783583 ] Andrew Stahlman commented on AIRFLOW-3981: -- I took a stab at this starting only with the Graph View page to try and determine what would be required. I managed to add a drop-down in the navbar next to the clock that toggles between the browser local time zone and UTC. When the timezone selection changes, all of the DOM elements that contain timestamps are updated. The only UI element that I wasn't able to update was the DateTimePicker widget for the {{Base date}} field. This widget seems to be shipped with Flask-AppBuilder, but I can't actually find it's source. I see references to what looks like two different widget libraries: * [datepicker|https://github.com/dpgaspar/Flask-AppBuilder/blob/master/flask_appbuilder/static/appbuilder/datepicker/bootstrap-datepicker.js#L6] * [datetimepicker|https://github.com/dpgaspar/Flask-AppBuilder/blob/bb6da4c8b68c4f0b9aed7942a52c9898de64f1c0/flask_appbuilder/fieldwidgets.py#L33] But since the source is minified, I can't tell which one is actually used, and I'm not sure if changing the format string is supported (I tried several combinations with no success) > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (AIRFLOW-3981) Make Airflow UI timezone aware
[ https://issues.apache.org/jira/browse/AIRFLOW-3981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16781842#comment-16781842 ] zhongjiajie commented on AIRFLOW-3981: -- If no one assignee when I finish my other PR in hand. I will do it. > Make Airflow UI timezone aware > -- > > Key: AIRFLOW-3981 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3981 > Project: Apache Airflow > Issue Type: Improvement >Reporter: Tao Feng >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)