Skip to content

Commit a2bbc15

Browse files
Update following code review
1 parent 573a0b9 commit a2bbc15

File tree

10 files changed

+30
-25
lines changed

10 files changed

+30
-25
lines changed

airflow-core/docs/administration-and-deployment/plugins.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ definitions in Airflow.
206206
# Optional icon, url to an svg file.
207207
"icon": "https://example.com/icon.svg",
208208
# Optional dark icon for the dark theme, url to an svg file. If not provided, "icon" will be used for both light and dark themes.
209-
"dark_mode_icon": "https://example.com/dark_icon.svg",
209+
"icon_dark_mode": "https://example.com/dark_icon.svg",
210210
# Optional parameters, relative URL location for the iframe rendering. If not provided, external view will be rendeded as an external link. Should
211211
# not contain a leading slash.
212212
"url_route": "my_iframe_view",

airflow-core/src/airflow/api_fastapi/core_api/datamodels/plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ExternalViewResponse(BaseModel):
7777
name: str
7878
href: str
7979
icon: str | None = None
80-
dark_mode_icon: str | None = None
80+
icon_dark_mode: str | None = None
8181
url_route: str | None = None
8282
category: str | None = None
8383
destination: Literal["nav", "dag", "dag_run", "task", "task_instance"] = "nav"

airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9305,11 +9305,11 @@ components:
93059305
- type: string
93069306
- type: 'null'
93079307
title: Icon
9308-
dark_mode_icon:
9308+
icon_dark_mode:
93099309
anyOf:
93109310
- type: string
93119311
- type: 'null'
9312-
title: Dark Mode Icon
9312+
title: Icon Dark Mode
93139313
url_route:
93149314
anyOf:
93159315
- type: string

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,7 +3283,7 @@ export const $ExternalViewResponse = {
32833283
],
32843284
title: 'Icon'
32853285
},
3286-
dark_mode_icon: {
3286+
icon_dark_mode: {
32873287
anyOf: [
32883288
{
32893289
type: 'string'
@@ -3292,7 +3292,7 @@ export const $ExternalViewResponse = {
32923292
type: 'null'
32933293
}
32943294
],
3295-
title: 'Dark Mode Icon'
3295+
title: 'Icon Dark Mode'
32963296
},
32973297
url_route: {
32983298
anyOf: [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ export type ExternalViewResponse = {
878878
name: string;
879879
href: string;
880880
icon?: string | null;
881-
dark_mode_icon?: string | null;
881+
icon_dark_mode?: string | null;
882882
url_route?: string | null;
883883
category?: string | null;
884884
destination?: 'nav' | 'dag' | 'dag_run' | 'task' | 'task_instance';

airflow-core/src/airflow/ui/src/layouts/Nav/PluginMenuItem.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,15 @@ export const PluginMenuItem = ({ href, icon, name, topLevel = false, url_route:
4444
to={href}
4545
/>
4646
) : (
47-
<Box alignItems="center" display="flex" gap={2} outline="none" px={2}>
48-
<Link aria-label={name} href={href} rel="noopener noreferrer" target="_blank" width="100%">
47+
<Box alignItems="center" display="flex" gap={2} outline="none" px={2} py="6px">
48+
<Link
49+
aria-label={name}
50+
fontSize="sm"
51+
href={href}
52+
rel="noopener noreferrer"
53+
target="_blank"
54+
width="100%"
55+
>
4956
{name}
5057
</Link>
5158
</Box>
@@ -72,7 +79,7 @@ export const PluginMenuItem = ({ href, icon, name, topLevel = false, url_route:
7279

7380
return (
7481
<RouterLink to={`plugin/${urlRoute}`}>
75-
<Box alignItems="center" display="flex" gap={2} px={2}>
82+
<Box alignItems="center" display="flex" fontSize="sm" gap={2} px={2} py="6px">
7683
{typeof icon === "string" ? (
7784
<Image height="1.25rem" src={icon} width="1.25rem" />
7885
) : (

airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,30 @@ def test_external_views_model_validator(self, test_client):
7777
assert test_plugin["external_views"] == [
7878
# external_views
7979
{
80-
"name": "Test IFrame Plugin",
81-
"href": "https://www.google.com",
82-
"icon": "https://example.com/icon.svg",
83-
"dark_mode_icon": "https://example.com/dark_icon.svg",
80+
"name": "Test IFrame Airflow Docs",
81+
"href": "https://airflow.apache.org/",
82+
"icon": "https://raw.githubusercontent.com/lucide-icons/lucide/refs/heads/main/icons/plug.svg",
83+
"icon_dark_mode": None,
8484
"url_route": "test_iframe_plugin",
8585
"destination": "nav",
8686
"category": "browse",
8787
},
8888
# appbuilder_menu_items
8989
{
9090
"category": "Search",
91-
"dark_mode_icon": None,
9291
"destination": "nav",
9392
"href": "https://www.google.com",
9493
"icon": None,
94+
"icon_dark_mode": None,
9595
"name": "Google",
9696
"url_route": None,
9797
},
9898
{
9999
"category": None,
100-
"dark_mode_icon": None,
101100
"destination": "nav",
102101
"href": "https://www.apache.org/",
103102
"icon": None,
103+
"icon_dark_mode": None,
104104
"label": "The Apache Software Foundation",
105105
"name": "apache",
106106
"url_route": None,

airflow-core/tests/unit/cli/commands/test_plugins_command.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ def test_should_display_one_plugin(self):
9393
"external_views": [
9494
{
9595
"destination": "nav",
96-
"icon": "https://example.com/icon.svg",
97-
"dark_mode_icon": "https://example.com/dark_icon.svg",
98-
"name": "Test IFrame Plugin",
99-
"href": "https://www.google.com",
96+
"icon": "https://raw.githubusercontent.com/lucide-icons/lucide/refs/heads/main/icons/plug.svg",
97+
"name": "Test IFrame Airflow Docs",
98+
"href": "https://airflow.apache.org/",
10099
"url_route": "test_iframe_plugin",
101100
"category": "browse",
102101
},

airflow-core/tests/unit/plugins/test_plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ async def dispatch(self, request, call_next):
103103
}
104104

105105
external_view_with_metadata = {
106-
"name": "Test IFrame Plugin",
107-
"href": "https://www.google.com",
108-
"icon": "https://example.com/icon.svg",
109-
"dark_mode_icon": "https://example.com/dark_icon.svg",
106+
"name": "Test IFrame Airflow Docs",
107+
"href": "https://airflow.apache.org/",
108+
"icon": "https://raw.githubusercontent.com/lucide-icons/lucide/refs/heads/main/icons/plug.svg",
110109
"url_route": "test_iframe_plugin",
111110
"destination": "nav",
112111
"category": "browse",

airflow-ctl/src/airflowctl/api/datamodels/generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ class ExternalViewResponse(BaseModel):
533533
name: Annotated[str, Field(title="Name")]
534534
href: Annotated[str, Field(title="Href")]
535535
icon: Annotated[str | None, Field(title="Icon")] = None
536-
dark_mode_icon: Annotated[str | None, Field(title="Dark Mode Icon")] = None
536+
icon_dark_mode: Annotated[str | None, Field(title="Icon Dark Mode")] = None
537537
url_route: Annotated[str | None, Field(title="Url Route")] = None
538538
category: Annotated[str | None, Field(title="Category")] = None
539539
destination: Annotated[Destination | None, Field(title="Destination")] = "nav"

0 commit comments

Comments
 (0)