mik-laj commented on a change in pull request #4787: [AIRFLOW-3967] Extract Jinja directive from Javascript URL: https://github.com/apache/airflow/pull/4787#discussion_r278065820
########## File path: airflow/www/templates/airflow/dags.html ########## @@ -207,14 +214,21 @@ <h2>DAGs</h2> {% block tail %} {{ super() }} + <script src="{{ url_for_asset('utils.js') }}"></script> <script src="{{ url_for_asset('d3.min.js') }}"></script> <script src="{{ url_for_asset('jquery.dataTables.min.js') }}"></script> <script src="{{ url_for_asset('dataTables.bootstrap.min.js') }}"></script> <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script> <script src="{{ url_for_asset('bootstrap3-typeahead.min.js') }}"></script> <script> - const DAGS_INDEX = "{{ url_for('Airflow.index') }}"; + const DAGS_INDEX = getMetaValue('base-url-index'); + const BASE_URL_BLOCKED = getMetaValue('base-url-blocked'); + const BASE_URL_DAG_STATS = getMetaValue("base-url-dag-stats"); Review comment: Introduction your suggestion will also add confusion in the code, because the "var" syntax is used in the same file. The code does not work on older versions of the Internet Explorer. However, there are a lot of reasons why this does not work and the best solution is to extract the code for separate files and transpile all JS using Babel. Transpilation will allow the developer to use new syntax and functionality, but browsers will execute code that conforms to the old standards. Please note that some of the JS code is currently being transpiled. https://github.com/apache/airflow/blob/master/airflow/www/package.json#L29-L34 This is not a problem that we want to solve in this PR. The JS code has many issues that have to be gradually solved. ---------------------------------------------------------------- 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 With regards, Apache Git Services