ryanahamilton commented on a change in pull request #12911:
URL: https://github.com/apache/airflow/pull/12911#discussion_r538732518
##########
File path: airflow/www/templates/airflow/dags.html
##########
@@ -104,16 +104,17 @@ <h2>DAGs</h2>
{# Column 1: Turn dag on/off #}
<td style="padding-right:0;">
{% if dag.can_edit %}
- <label class="switch-label js-tooltip"
title="Pause/Unpause DAG">
- <input class="switch-input" id="toggle-{{ dag.dag_id }}"
data-dag-id="{{ dag.dag_id }}"
- type="checkbox" {{ "checked" if not dag.is_paused
else "" }} >
- <span class="switch {{ '' if dag.can_edit else 'disabled'
}}" aria-hidden="true"></span>
+ {% set switch_tooltip = 'Pause/Unpause DAG' %}
+ {% set label_class = 'switch-label' %}
{% else %}
- <label class="switch-label js-tooltip disabled" title="DAG
is {{ 'Paused' if dag.is_paused else 'Active' }}">
- <input class="switch-input" id="toggle-{{ dag.dag_id }}"
data-dag-id="{{ dag.dag_id }}"
- type="checkbox" {{ "checked" if not dag.is_paused
else "" }} disabled>
- <span class="switch disabled" aria-hidden="true"></span>
+ {% set switch_tooltip = 'DAG is Paused' if dag.is_paused
else 'DAG is Active' %}
+ {% set label_class = 'switch-label.disabled' %}
Review comment:
This should use a space instead of the `.`, but I think I'd prefer this
logic inline given that's how these are typically handled throughout the
template files.
##########
File path: airflow/www/templates/airflow/dags.html
##########
@@ -104,16 +104,17 @@ <h2>DAGs</h2>
{# Column 1: Turn dag on/off #}
<td style="padding-right:0;">
{% if dag.can_edit %}
- <label class="switch-label js-tooltip"
title="Pause/Unpause DAG">
- <input class="switch-input" id="toggle-{{ dag.dag_id }}"
data-dag-id="{{ dag.dag_id }}"
- type="checkbox" {{ "checked" if not dag.is_paused
else "" }} >
- <span class="switch {{ '' if dag.can_edit else 'disabled'
}}" aria-hidden="true"></span>
+ {% set switch_tooltip = 'Pause/Unpause DAG' %}
+ {% set label_class = 'switch-label' %}
{% else %}
- <label class="switch-label js-tooltip disabled" title="DAG
is {{ 'Paused' if dag.is_paused else 'Active' }}">
- <input class="switch-input" id="toggle-{{ dag.dag_id }}"
data-dag-id="{{ dag.dag_id }}"
- type="checkbox" {{ "checked" if not dag.is_paused
else "" }} disabled>
- <span class="switch disabled" aria-hidden="true"></span>
+ {% set switch_tooltip = 'DAG is Paused' if dag.is_paused
else 'DAG is Active' %}
+ {% set label_class = 'switch-label.disabled' %}
{% endif %}
+ <label class="{{ label_class }} js-tooltip" title="{{
switch_tooltip }}">
Review comment:
```suggestion
<label class="switch-label{{ " disabled" if not
dag.can_edit else "" }} js-tooltip" title="{{ switch_tooltip }}">
```
----------------------------------------------------------------
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]