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_r267573261
##########
File path: airflow/www/templates/airflow/dag.html
##########
@@ -290,6 +294,7 @@ <h4 class="modal-title" id="dagModalLabel">
{% endblock %}
{% block tail %}
{{ super() }}
+ <script src="{{ url_for_asset('utils.js') }}"></script>
Review comment:
I would prefer to deal with this problem in a separate PR. When the JS code
will be in separate files and it will be possible to introduce mechanisms that
will be much more efficient in loading the JS code. Currently, it is not
possible to implement a solution that will solve the problem completely and I
will be 100% sure. I can make another change depending on this in seperate PR,
but it creates another chain of PR. Already in the case of CSS code, we are
blocked from making changes, because the introduction of new changes involves
the necessity to fix the old problems first.
I could introduce your solution now, but it will complicate the code, which
is not in good condition.
It is worth noting that if a reference to the same JS file appears in the
HTML code, the file is only loaded once. This is a simple and easy module
loader. This is not a bad thing if you see the dependency twice in the HTML
code. This means that a given fragment is needed in two places. The browser
will provide an automatic and 100% sure way that the code will not be executed
twice. This is not a bad practice, but a simple way to ensure that the module
is loaded.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services