Skip to content
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
59 changes: 0 additions & 59 deletions airflow-core/docs/howto/customize-ui.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,6 @@ Customizing the UI

.. _customizing-the-ui:

Customizing state colours
-------------------------

.. versionadded:: 1.10.11

To change the colors for TaskInstance/DagRun State in the Airflow Webserver, perform the
following steps:

1. Add the following contents to ``airflow_local_settings.py`` file. Change the colors to whatever you
would like.

.. code-block:: python

STATE_COLORS = {
"deferred": "mediumpurple",
"failed": "firebrick",
"queued": "darkgray",
"removed": "lightgrey",
"restarting": "violet",
"running": "#01FF70",
"scheduled": "tan",
"skipped": "darkorchid",
"success": "#2ECC40",
"up_for_reschedule": "turquoise",
"up_for_retry": "yellow",
"upstream_failed": "orange",
}

See :ref:`Configuring local settings <set-config:configuring-local-settings>` for details on how to
configure local settings.

2. Restart Airflow Webserver.

Screenshots
^^^^^^^^^^^

Before
""""""

.. image:: ../img/change-ui-colors/dags-page-old.png

.. image:: ../img/change-ui-colors/graph-view-old.png

.. image:: ../img/change-ui-colors/tree-view-old.png

After
""""""

.. image:: ../img/change-ui-colors/dags-page-new.png

.. image:: ../img/change-ui-colors/graph-view-new.png

.. image:: ../img/change-ui-colors/tree-view-new.png


.. note::

See :doc:`/administration-and-deployment/modules_management` for details on how Python and Airflow manage modules.

Customizing DAG UI Header and Airflow Page Titles
-------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ class ConfigResponse(BaseModel):
audit_view_excluded_events: str
audit_view_included_events: str
test_connection: str
state_color_mapping: dict
dashboard_alert: list[UIAlert]
Original file line number Diff line number Diff line change
Expand Up @@ -8226,10 +8226,6 @@ components:
test_connection:
type: string
title: Test Connection
state_color_mapping:
additionalProperties: true
type: object
title: State Color Mapping
dashboard_alert:
items:
$ref: '#/components/schemas/UIAlert'
Expand All @@ -8255,7 +8251,6 @@ components:
- audit_view_excluded_events
- audit_view_included_events
- test_connection
- state_color_mapping
- dashboard_alert
title: ConfigResponse
description: configuration serializer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc
from airflow.api_fastapi.core_api.security import requires_access_configuration
from airflow.configuration import conf
from airflow.settings import DASHBOARD_UIALERTS, STATE_COLORS
from airflow.settings import DASHBOARD_UIALERTS

config_router = AirflowRouter(tags=["Config"])

Expand Down Expand Up @@ -63,7 +63,6 @@ def get_configs() -> ConfigResponse:
"audit_view_included_events": conf.get("webserver", "audit_view_included_events", fallback=""),
"audit_view_excluded_events": conf.get("webserver", "audit_view_excluded_events", fallback=""),
"test_connection": conf.get("core", "test_connection", fallback="Disabled"),
"state_color_mapping": STATE_COLORS,
"dashboard_alert": DASHBOARD_UIALERTS,
}

Expand Down
19 changes: 0 additions & 19 deletions airflow-core/src/airflow/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from airflow.logging_config import configure_logging
from airflow.utils.orm_event_handlers import setup_event_handlers
from airflow.utils.sqlalchemy import is_sqlalchemy_v1
from airflow.utils.state import State
from airflow.utils.timezone import local_timezone, parse_timezone, utc

if TYPE_CHECKING:
Expand Down Expand Up @@ -113,23 +112,6 @@
# The JSON library to use for DAG Serialization and De-Serialization
json = json

# Dictionary containing State and colors associated to each state to
# display on the Webserver
STATE_COLORS = {
"deferred": "mediumpurple",
"failed": "red",
"queued": "gray",
"removed": "lightgrey",
"restarting": "violet",
"running": "lime",
"scheduled": "tan",
"skipped": "hotpink",
"success": "green",
"up_for_reschedule": "turquoise",
"up_for_retry": "gold",
"upstream_failed": "orange",
}

# Display alerts on the dashboard
# Useful for warning about setup issues or announcing changes to end users
# List of UIAlerts, which allows for specifying the content and category
Expand Down Expand Up @@ -633,7 +615,6 @@ def initialize():
prepare_syspath_for_dags_folder()
global LOGGING_CLASS_PATH
LOGGING_CLASS_PATH = configure_logging()
State.state_color.update(STATE_COLORS)

configure_adapters()
# The webservers import this file from models.py with the default settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,11 +1235,6 @@ export const $ConfigResponse = {
type: "string",
title: "Test Connection",
},
state_color_mapping: {
additionalProperties: true,
type: "object",
title: "State Color Mapping",
},
dashboard_alert: {
items: {
$ref: "#/components/schemas/UIAlert",
Expand Down Expand Up @@ -1268,7 +1263,6 @@ export const $ConfigResponse = {
"audit_view_excluded_events",
"audit_view_included_events",
"test_connection",
"state_color_mapping",
"dashboard_alert",
],
title: "ConfigResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,6 @@ export type ConfigResponse = {
audit_view_excluded_events: string;
audit_view_included_events: string;
test_connection: string;
state_color_mapping: {
[key: string]: unknown;
};
dashboard_alert: Array<UIAlert>;
};

Expand Down
14 changes: 0 additions & 14 deletions airflow-core/src/airflow/ui/src/mocks/handlers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ export const handlers: Array<HttpHandler> = [
navbar_text_hover_color: "#51504f",
page_size: 15,
require_confirmation_dag_change: false,
state_color_mapping: {
deferred: "mediumpurple",
failed: "red",
queued: "gray",
removed: "lightgrey",
restarting: "violet",
running: "lime",
scheduled: "tan",
skipped: "hotpink",
success: "green",
up_for_reschedule: "turquoise",
up_for_retry: "gold",
upstream_failed: "orange",
},
test_connection: "Disabled",
warn_deployment_exposure: true,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@
"audit_view_excluded_events": "",
"audit_view_included_events": "",
"test_connection": "Disabled",
"state_color_mapping": {
"deferred": "mediumpurple",
"failed": "red",
"queued": "gray",
"removed": "lightgrey",
"restarting": "violet",
"running": "lime",
"scheduled": "tan",
"skipped": "hotpink",
"success": "green",
"up_for_reschedule": "turquoise",
"up_for_retry": "gold",
"upstream_failed": "orange",
},
"dashboard_alert": [],
}

Expand Down Expand Up @@ -86,24 +72,7 @@ def mock_config_data():
"audit_view_included_events": "",
}
}
with patch(
"airflow.settings.STATE_COLORS",
{
"deferred": "mediumpurple",
"failed": "red",
"queued": "gray",
"removed": "lightgrey",
"restarting": "violet",
"running": "lime",
"scheduled": "tan",
"skipped": "hotpink",
"success": "green",
"up_for_reschedule": "turquoise",
"up_for_retry": "gold",
"upstream_failed": "orange",
},
):
yield mock_conf
yield mock_conf


class TestGetConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import airflow
from airflow.api_fastapi.app import get_auth_manager
from airflow.configuration import conf
from airflow.settings import STATE_COLORS
from airflow.utils.net import get_hostname
from airflow.utils.platform import get_airflow_git_version

Expand Down Expand Up @@ -67,7 +66,6 @@ def prepare_jinja_globals():
"navbar_hover_color": conf.get("webserver", "NAVBAR_HOVER_COLOR"),
"navbar_text_hover_color": conf.get("webserver", "NAVBAR_TEXT_HOVER_COLOR"),
"navbar_logo_text_color": conf.get("webserver", "NAVBAR_LOGO_TEXT_COLOR"),
"state_color_mapping": STATE_COLORS,
"airflow_version": airflow_version,
"git_version": git_version,
"show_plugin_message": enable_plugins,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
<link rel="stylesheet" type="text/css" href="{{ url_for_asset('main.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for_asset('loadingDots.css') }}">
<link rel="stylesheet" type="text/css" href="{{ url_for_asset('jquery-ui.min.css') }}">
<style type="text/css">
{% for state, state_color in state_color_mapping.items() %}
span.{{state}} {
background-color: {{state_color}};
}
{% endfor %}
.navbar-nav > li > a {
color: {{ navbar_text_color }};
}
.navbar-nav > li > a:hover {
background-color: {{ navbar_hover_color }};
color: {{ navbar_text_hover_color }};
}
</style>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='pin_32.png') }}">
{% endblock %}

Expand Down
1 change: 0 additions & 1 deletion providers/fab/tests/unit/fab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def local_context(self):
"navbar_hover_color",
"navbar_text_hover_color",
"navbar_logo_text_color",
"state_color_mapping",
"airflow_version",
"git_version",
"k8s_or_k8scelery_executor",
Expand Down
Loading