Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Grid button to Task Instance view #39223

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions airflow/www/templates/airflow/task_instance.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ <h4>
{{ url_for(endpoint, dag_id=dag.dag_id, task_id=task_id, execution_date=execution_date) }}
{%- endif -%}
{% endmacro -%}
<li><a href="{{ url_for('Airflow.grid', dag_id=dag.dag_id, dag_run_id=dag_run_id ,task_id=task_id, map_index=map_index) }}">
<span class="material-icons" aria-hidden="true">grid_on</span>
Grid</a></li>
<li><a href="{{ ti_url('Airflow.task') }}">
<span class="material-icons" aria-hidden="true">details</span>
Task Instance Details</a></li>
Expand Down
6 changes: 6 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,7 @@ def rendered_templates(self, session):
show_trigger_form_if_no_params=conf.getboolean(
"webserver", "show_trigger_form_if_no_params"
),
dag_run_id=dag_run.run_id if dag_run else "",
html_dict=html_dict,
dag=dag,
task_id=task_id,
Expand Down Expand Up @@ -1460,6 +1461,7 @@ def rendered_templates(self, session):
"airflow/ti_code.html",
show_trigger_form_if_no_params=conf.getboolean("webserver", "show_trigger_form_if_no_params"),
html_dict=html_dict,
dag_run_id=dag_run.run_id if dag_run else "",
dag=dag,
task_id=task_id,
task_display_name=task.task_display_name,
Expand Down Expand Up @@ -1524,6 +1526,7 @@ def rendered_k8s(self, *, session: Session = NEW_SESSION):
return self.render_template(
"airflow/ti_code.html",
show_trigger_form_if_no_params=conf.getboolean("webserver", "show_trigger_form_if_no_params"),
dag_run_id=dag_run.run_id if dag_run else "",
html_dict={"k8s": content},
dag=dag,
task_id=task_id,
Expand Down Expand Up @@ -1650,6 +1653,7 @@ def log(self, session: Session = NEW_SESSION):
show_trigger_form_if_no_params=conf.getboolean("webserver", "show_trigger_form_if_no_params"),
logs=logs,
dag=dag_model,
dag_run_id=ti.run_id if ti else "",
title="Log by attempts",
dag_id=dag_id,
task_id=task_id,
Expand Down Expand Up @@ -1806,6 +1810,7 @@ def include_task_attrs(attr_name):
show_trigger_form_if_no_params=conf.getboolean("webserver", "show_trigger_form_if_no_params"),
task_attrs=task_attrs,
ti_attrs=ti_attrs,
dag_run_id=ti.run_id if ti else "",
failed_dep_reasons=failed_dep_reasons or no_failed_deps_result,
task_id=task_id,
execution_date=execution_date,
Expand Down Expand Up @@ -1858,6 +1863,7 @@ def xcom(self, session: Session = NEW_SESSION):
show_trigger_form_if_no_params=conf.getboolean("webserver", "show_trigger_form_if_no_params"),
attributes=attributes,
task_id=task_id,
dag_run_id=ti.run_id if ti else "",
task_display_name=ti.task_display_name,
execution_date=execution_date,
map_index=map_index,
Expand Down
20 changes: 20 additions & 0 deletions tests/www/views/test_views_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,42 @@ def client_ti_without_dag_edit(app):
],
id="delete-dag-button-normal",
),
pytest.param(
f"task?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Grid"],
id="task-grid-button",
),
pytest.param(
f"task?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Task Instance Details"],
id="task",
),
pytest.param(
f"log?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Grid"],
id="log-grid-button",
),
pytest.param(
f"xcom?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["XCom"],
id="xcom",
),
pytest.param(
f"xcom?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Grid"],
id="xcom-grid-button",
),
pytest.param("xcom/list", ["List XComs"], id="xcom-list"),
pytest.param(
f"rendered-templates?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Rendered Template"],
id="rendered-templates",
),
pytest.param(
f"rendered-templates?task_id=runme_0&dag_id=example_bash_operator&execution_date={DEFAULT_VAL}",
["Grid"],
id="rendered-templates-grid-button",
),
pytest.param(
"object/graph_data?dag_id=example_bash_operator",
["runme_1"],
Expand Down