Skip to content

Commit 9c2239b

Browse files
Move webserver config to fab provider (apache#50774)
* Move webserver navbar config to fab provider * Remove x_frame_enabled config (cherry picked from commit 649309e)
1 parent cc80c66 commit 9c2239b

File tree

20 files changed

+94
-130
lines changed

20 files changed

+94
-130
lines changed

airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
class ConfigResponse(BaseModel):
2525
"""configuration serializer."""
2626

27-
navbar_color: str
28-
navbar_text_color: str
29-
navbar_hover_color: str
30-
navbar_text_hover_color: str
3127
page_size: int
3228
auto_refresh_interval: int
3329
hide_paused_dags_by_default: bool

airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -728,18 +728,6 @@ components:
728728
description: Base Node serializer for responses.
729729
ConfigResponse:
730730
properties:
731-
navbar_color:
732-
type: string
733-
title: Navbar Color
734-
navbar_text_color:
735-
type: string
736-
title: Navbar Text Color
737-
navbar_hover_color:
738-
type: string
739-
title: Navbar Hover Color
740-
navbar_text_hover_color:
741-
type: string
742-
title: Navbar Text Hover Color
743731
page_size:
744732
type: integer
745733
title: Page Size
@@ -783,10 +771,6 @@ components:
783771
title: Dashboard Alert
784772
type: object
785773
required:
786-
- navbar_color
787-
- navbar_text_color
788-
- navbar_hover_color
789-
- navbar_text_hover_color
790774
- page_size
791775
- auto_refresh_interval
792776
- hide_paused_dags_by_default

airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
config_router = AirflowRouter(tags=["Config"])
3131

3232
WEBSERVER_CONFIG_KEYS = [
33-
"navbar_color",
3433
"page_size",
3534
"auto_refresh_interval",
3635
"hide_paused_dags_by_default",
@@ -39,9 +38,6 @@
3938
"require_confirmation_dag_change",
4039
"enable_swagger_ui",
4140
"instance_name_has_markup",
42-
"navbar_text_color",
43-
"navbar_hover_color",
44-
"navbar_text_hover_color",
4541
]
4642

4743

airflow-core/src/airflow/cli/commands/config_command.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,26 @@ def message(self) -> str | None:
387387
config=ConfigParameter("webserver", "expose_hostname"),
388388
renamed_to=ConfigParameter("fab", "expose_hostname"),
389389
),
390+
ConfigChange(
391+
config=ConfigParameter("webserver", "navbar_color"),
392+
renamed_to=ConfigParameter("fab", "navbar_color"),
393+
),
394+
ConfigChange(
395+
config=ConfigParameter("webserver", "navbar_text_color"),
396+
renamed_to=ConfigParameter("fab", "navbar_text_color"),
397+
),
398+
ConfigChange(
399+
config=ConfigParameter("webserver", "navbar_hover_color"),
400+
renamed_to=ConfigParameter("fab", "navbar_hover_color"),
401+
),
402+
ConfigChange(
403+
config=ConfigParameter("webserver", "navbar_text_hover_color"),
404+
renamed_to=ConfigParameter("fab", "navbar_text_hover_color"),
405+
),
406+
ConfigChange(
407+
config=ConfigParameter("webserver", "x_frame_enabled"),
408+
was_deprecated=False,
409+
),
390410
ConfigChange(
391411
config=ConfigParameter("webserver", "base_url"),
392412
renamed_to=ConfigParameter("api", "base_url"),

airflow-core/src/airflow/config_templates/config.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,48 +1771,13 @@ webserver:
17711771
type: string
17721772
example: ~
17731773
default: "50"
1774-
navbar_color:
1775-
description: |
1776-
Define the color of navigation bar
1777-
version_added: ~
1778-
type: string
1779-
example: ~
1780-
default: "#fff"
1781-
navbar_text_color:
1782-
description: |
1783-
Define the color of text in the navigation bar
1784-
version_added: 2.8.0
1785-
type: string
1786-
example: ~
1787-
default: "#51504f"
1788-
navbar_hover_color:
1789-
description: |
1790-
Define the color of navigation bar links when hovered
1791-
version_added: 2.9.0
1792-
type: string
1793-
example: ~
1794-
default: "#eee"
1795-
navbar_text_hover_color:
1796-
description: |
1797-
Define the color of text in the navigation bar when hovered
1798-
version_added: 2.9.0
1799-
type: string
1800-
example: ~
1801-
default: "#51504f"
18021774
default_wrap:
18031775
description: |
18041776
Default setting for wrap toggle on DAG code and TI log views.
18051777
version_added: 1.10.4
18061778
type: boolean
18071779
example: ~
18081780
default: "False"
1809-
x_frame_enabled:
1810-
description: |
1811-
Allow the UI to be rendered in a frame
1812-
version_added: 1.10.8
1813-
type: boolean
1814-
example: ~
1815-
default: "True"
18161781
instance_name:
18171782
description: |
18181783
Sets a custom page title for the DAGs overview page and site title for all pages

airflow-core/src/airflow/configuration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ def sensitive_config_values(self) -> set[tuple[str, str]]:
358358
("api", "expose_config"): ("webserver", "expose_config", "3.0.1"),
359359
("fab", "access_denied_message"): ("webserver", "access_denied_message", "3.0.2"),
360360
("fab", "expose_hostname"): ("webserver", "expose_hostname", "3.0.2"),
361+
("fab", "navbar_color"): ("webserver", "navbar_color", "3.0.2"),
362+
("fab", "navbar_text_color"): ("webserver", "navbar_text_color", "3.0.2"),
363+
("fab", "navbar_hover_color"): ("webserver", "navbar_hover_color", "3.0.2"),
364+
("fab", "navbar_text_hover_color"): ("webserver", "navbar_text_hover_color", "3.0.2"),
361365
}
362366

363367
# A mapping of new section -> (old section, since_version).

airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5786,22 +5786,6 @@ export const $BaseNodeResponse = {
57865786

57875787
export const $ConfigResponse = {
57885788
properties: {
5789-
navbar_color: {
5790-
type: "string",
5791-
title: "Navbar Color",
5792-
},
5793-
navbar_text_color: {
5794-
type: "string",
5795-
title: "Navbar Text Color",
5796-
},
5797-
navbar_hover_color: {
5798-
type: "string",
5799-
title: "Navbar Hover Color",
5800-
},
5801-
navbar_text_hover_color: {
5802-
type: "string",
5803-
title: "Navbar Text Hover Color",
5804-
},
58055789
page_size: {
58065790
type: "integer",
58075791
title: "Page Size",
@@ -5860,10 +5844,6 @@ export const $ConfigResponse = {
58605844
},
58615845
type: "object",
58625846
required: [
5863-
"navbar_color",
5864-
"navbar_text_color",
5865-
"navbar_hover_color",
5866-
"navbar_text_hover_color",
58675847
"page_size",
58685848
"auto_refresh_interval",
58695849
"hide_paused_dags_by_default",

airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,10 +1449,6 @@ export type type =
14491449
* configuration serializer.
14501450
*/
14511451
export type ConfigResponse = {
1452-
navbar_color: string;
1453-
navbar_text_color: string;
1454-
navbar_hover_color: string;
1455-
navbar_text_hover_color: string;
14561452
page_size: number;
14571453
auto_refresh_interval: number;
14581454
hide_paused_dags_by_default: boolean;

airflow-core/src/airflow/ui/src/mocks/handlers/config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ export const handlers: Array<HttpHandler> = [
2828
enable_swagger_ui: true,
2929
hide_paused_dags_by_default: false,
3030
instance_name: "Airflow",
31-
instance_name_has_markup: false,
32-
navbar_color: "#fff",
33-
navbar_hover_color: "#eee",
34-
navbar_text_color: "#51504f",
35-
navbar_text_hover_color: "#51504f",
3631
page_size: 15,
3732
require_confirmation_dag_change: false,
3833
test_connection: "Disabled",

airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_config.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
pytestmark = pytest.mark.db_test
2424

2525
mock_config_response = {
26-
"navbar_color": "#fff",
27-
"navbar_text_color": "#51504f",
28-
"navbar_hover_color": "#eee",
29-
"navbar_text_hover_color": "#51504f",
3026
"page_size": 100,
3127
"auto_refresh_interval": 3,
3228
"hide_paused_dags_by_default": False,
@@ -51,10 +47,6 @@ def mock_config_data():
5147
with patch("airflow.configuration.conf.as_dict") as mock_conf:
5248
mock_conf.return_value = {
5349
"webserver": {
54-
"navbar_color": "#fff",
55-
"navbar_text_color": "#51504f",
56-
"navbar_hover_color": "#eee",
57-
"navbar_text_hover_color": "#51504f",
5850
"page_size": "100",
5951
"auto_refresh_interval": "3",
6052
"hide_paused_dags_by_default": "false",

providers/fab/provider.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ source-date-epoch: 1741121873
3232

3333
# note that those versions are maintained by release manager - do not update them manually
3434
versions:
35-
- 2.0.3
35+
- 2.2.0
36+
- 2.1.0
3637
- 2.0.2
3738
- 2.0.1
3839
- 2.0.0
@@ -57,6 +58,34 @@ config:
5758
fab:
5859
description: This section contains configs specific to FAB provider.
5960
options:
61+
navbar_color:
62+
description: |
63+
Define the color of navigation bar
64+
version_added: 2.2.0
65+
type: string
66+
example: ~
67+
default: "#fff"
68+
navbar_text_color:
69+
description: |
70+
Define the color of text in the navigation bar
71+
version_added: 2.2.0
72+
type: string
73+
example: ~
74+
default: "#51504f"
75+
navbar_hover_color:
76+
description: |
77+
Define the color of navigation bar links when hovered
78+
version_added: 2.2.0
79+
type: string
80+
example: ~
81+
default: "#eee"
82+
navbar_text_hover_color:
83+
description: |
84+
Define the color of text in the navigation bar when hovered
85+
version_added: 2.2.0
86+
type: string
87+
example: ~
88+
default: "#51504f"
6089
access_denied_message:
6190
description: |
6291
The message displayed when a user attempts to execute actions beyond their authorised privileges.

providers/fab/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ build-backend = "flit_core.buildapi"
2525

2626
[project]
2727
name = "apache-airflow-providers-fab"
28-
version = "2.0.3"
28+
version = "2.2.0"
2929
description = "Provider package apache-airflow-providers-fab for Apache Airflow"
3030
readme = "README.rst"
3131
authors = [
@@ -127,8 +127,8 @@ apache-airflow-providers-common-sql = {workspace = true}
127127
apache-airflow-providers-standard = {workspace = true}
128128

129129
[project.urls]
130-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.0.3"
131-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.0.3/changelog.html"
130+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.2.0"
131+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-fab/2.2.0/changelog.html"
132132
"Bug Tracker" = "https://github.com/apache/airflow/issues"
133133
"Source Code" = "https://github.com/apache/airflow"
134134
"Slack Chat" = "https://s.apache.org/airflow-slack"

providers/fab/src/airflow/providers/fab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
__all__ = ["__version__"]
3131

32-
__version__ = "2.0.3"
32+
__version__ = "2.2.0"
3333

3434
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
3535
"3.0.2"

providers/fab/src/airflow/providers/fab/get_provider_info.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@ def get_provider_info():
3030
"fab": {
3131
"description": "This section contains configs specific to FAB provider.",
3232
"options": {
33+
"navbar_color": {
34+
"description": "Define the color of navigation bar\n",
35+
"version_added": "2.2.0",
36+
"type": "string",
37+
"example": None,
38+
"default": "#fff",
39+
},
40+
"navbar_text_color": {
41+
"description": "Define the color of text in the navigation bar\n",
42+
"version_added": "2.2.0",
43+
"type": "string",
44+
"example": None,
45+
"default": "#51504f",
46+
},
47+
"navbar_hover_color": {
48+
"description": "Define the color of navigation bar links when hovered\n",
49+
"version_added": "2.2.0",
50+
"type": "string",
51+
"example": None,
52+
"default": "#eee",
53+
},
54+
"navbar_text_hover_color": {
55+
"description": "Define the color of text in the navigation bar when hovered\n",
56+
"version_added": "2.2.0",
57+
"type": "string",
58+
"example": None,
59+
"default": "#51504f",
60+
},
3361
"access_denied_message": {
3462
"description": "The message displayed when a user attempts to execute actions beyond their authorised privileges.\n",
3563
"version_added": "2.0.3",

providers/fab/src/airflow/providers/fab/www/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from airflow.providers.fab.www.extensions.init_appbuilder import init_appbuilder
3434
from airflow.providers.fab.www.extensions.init_jinja_globals import init_jinja_globals
3535
from airflow.providers.fab.www.extensions.init_manifest_files import configure_manifest_files
36-
from airflow.providers.fab.www.extensions.init_security import init_api_auth, init_xframe_protection
36+
from airflow.providers.fab.www.extensions.init_security import init_api_auth
3737
from airflow.providers.fab.www.extensions.init_session import init_airflow_session_interface
3838
from airflow.providers.fab.www.extensions.init_views import (
3939
init_api_auth_provider,
@@ -101,7 +101,6 @@ def create_app(enable_plugins: bool):
101101
init_api_auth_provider(flask_app)
102102
init_api_error_handlers(flask_app)
103103
init_jinja_globals(flask_app, enable_plugins=enable_plugins)
104-
init_xframe_protection(flask_app)
105104
init_airflow_session_interface(flask_app)
106105
return flask_app
107106

providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def prepare_jinja_globals():
5252
extra_globals = {
5353
"server_timezone": server_timezone,
5454
"hostname": hostname,
55-
"navbar_color": conf.get("webserver", "NAVBAR_COLOR"),
56-
"navbar_text_color": conf.get("webserver", "NAVBAR_TEXT_COLOR"),
57-
"navbar_hover_color": conf.get("webserver", "NAVBAR_HOVER_COLOR"),
58-
"navbar_text_hover_color": conf.get("webserver", "NAVBAR_TEXT_HOVER_COLOR"),
55+
"navbar_color": conf.get("fab", "NAVBAR_COLOR"),
56+
"navbar_text_color": conf.get("fab", "NAVBAR_TEXT_COLOR"),
57+
"navbar_hover_color": conf.get("fab", "NAVBAR_HOVER_COLOR"),
58+
"navbar_text_hover_color": conf.get("fab", "NAVBAR_TEXT_HOVER_COLOR"),
5959
"airflow_version": airflow_version,
6060
"git_version": git_version,
6161
"show_plugin_message": enable_plugins,

providers/fab/src/airflow/providers/fab/www/extensions/init_security.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,6 @@
2525
log = logging.getLogger(__name__)
2626

2727

28-
def init_xframe_protection(app):
29-
"""
30-
Add X-Frame-Options header.
31-
32-
Use it to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.
33-
34-
See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
35-
"""
36-
x_frame_enabled = conf.getboolean("webserver", "X_FRAME_ENABLED", fallback=True)
37-
if x_frame_enabled:
38-
return
39-
40-
def apply_caching(response):
41-
response.headers["X-Frame-Options"] = "DENY"
42-
return response
43-
44-
app.after_request(apply_caching)
45-
46-
4728
def init_api_auth(app):
4829
"""Load authentication backends."""
4930
auth_backends = conf.get(

providers/fab/tests/unit/fab/decorators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def no_op(*args, **kwargs):
3737
"init_api_auth_provider",
3838
"init_api_error_handlers",
3939
"init_jinja_globals",
40-
"init_xframe_protection",
4140
"init_airflow_session_interface",
4241
"init_appbuilder",
4342
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy