-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Add React Apps to plugin #52255
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 React Apps to plugin #52255
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,20 +69,35 @@ class AppBuilderMenuItemResponse(BaseModel): | |
category: str | None = None | ||
|
||
|
||
class ExternalViewResponse(BaseModel): | ||
"""Serializer for IFrame Plugin responses.""" | ||
class BaseUIResponse(BaseModel): | ||
"""Base serializer for UI Plugin responses.""" | ||
|
||
model_config = ConfigDict(extra="allow") | ||
|
||
name: str | ||
href: str | ||
icon: str | None = None | ||
icon_dark_mode: str | None = None | ||
url_route: str | None = None | ||
category: str | None = None | ||
destination: Literal["nav", "dag", "dag_run", "task", "task_instance"] = "nav" | ||
|
||
|
||
class ExternalViewResponse(BaseUIResponse): | ||
"""Serializer for External View Plugin responses.""" | ||
|
||
model_config = ConfigDict(extra="allow") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why actually do we allow extras here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is how plugin attributes are built, every members of the Plugin allow extra attributes and are serialized and returned. This was the behavior in 2.x, so we kept the same parttern in 3.x. Newly added attributes (react_apps, fastapi_apps, eternal_views) also follow the same pattern. Meaning that you can attach some extra metadata to your plugin members, and it will be returned by the API. |
||
|
||
href: str | ||
|
||
|
||
class ReactAppResponse(BaseUIResponse): | ||
"""Serializer for React App Plugin responses.""" | ||
|
||
model_config = ConfigDict(extra="allow") | ||
|
||
bundle_url: str | ||
|
||
|
||
class PluginResponse(BaseModel): | ||
"""Plugin serializer.""" | ||
|
||
|
@@ -94,6 +109,7 @@ class PluginResponse(BaseModel): | |
external_views: list[ExternalViewResponse] = Field( | ||
description="Aggregate all external views. Both 'external_views' and 'appbuilder_menu_items' are included here." | ||
) | ||
react_apps: list[ReactAppResponse] | ||
appbuilder_views: list[AppBuilderViewResponse] | ||
appbuilder_menu_items: list[AppBuilderMenuItemResponse] = Field( | ||
deprecated="Kept for backward compatibility, use `external_views` instead.", | ||
|
Uh oh!
There was an error while loading. Please reload this page.