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

AIP-68 | Develop new UI plugins #42702

Open
bbovenzi opened this issue Oct 3, 2024 · 1 comment
Open

AIP-68 | Develop new UI plugins #42702

bbovenzi opened this issue Oct 3, 2024 · 1 comment
Assignees
Labels
AIP-68 Extended Plugin Interface for React Views area:UI Related to UI/UX. For Frontend Developers. kind:meta High-level information important to the community

Comments

@bbovenzi
Copy link
Contributor

bbovenzi commented Oct 3, 2024

In an Airflow plugin appbuilder_views will be deprecated. They need to be replaced with react_views.

Fields to include when registering ui_views

{
  name: string, // plugin name
  type: 'react' | 'iframe', // is the plugin a react component or an iframe?
  title: string, // display name to show on buttons
  icon: string, // (optional) path to an icon file to display next to the title
  url_route: string, // (optional) what to display in the url route, defaults to the plugin name
  iframe_link: string // url of the page to load in an iframe
  src: string, // path to the react component as a built javascript bundle file
  location: string[] // where in the UI the component can live:
    // "nav" add as a top-level nav button
    // "dag" add as a tab in the DAG details view
    // "dag_run" add as a tab in the DAG details view but only for dag runs
    // "task" add as a tab in the DAG details view but only for that task instance
    // "dashboard" add a panel on the dashboard homepage
    // "wildcard" add to the BaseLayout component so that it can appear on any/all pages
  conditions: {key: value } // (optional) object of key/value pairs to match against the host page to determine if the plugin should mount (ex: only render for a certain operator or asset type)
  props: string[ ] // (optional) keys of properties to pass to the react component or iframe 
}

The plugins manager then needs to add the icon and component static files to be hosted by FastAPI.
We can dynamically lazy load the components with lazy(() => import(/* @vite-ignore */ plugin.src)
FastAPI will need a GET /plugins component to send all react-views data to the UI.

Other issues:

  • Rename appbuilder_menu_items to menu_items and send the array to the UI to render in the main nav page AIP-68 | Migrate plugin menu_items to FastAPI and new UI #42706
  • Add support for plugins that are simply urls to render inside of an iframe, saving developers the hassle of building a custom react component just to render a 3rd part website anyway Create iframe UI plugins #42708
  • Add a CLI command to build all the boilerplate code for a react component project so plugin developers don't need to worry about project setup
  • Develop an API for what props a react plugin component can expect from the UI depending on its location.

Other questions:

  • Should we still have a webserver run when the FAB provider exists in order to host legacy plugins and render them as iframes?
  • What props should we specify to pass to either react components or to iframe plugins?
@bbovenzi bbovenzi converted this from a draft issue Oct 3, 2024
@bbovenzi bbovenzi added the AIP-68 Extended Plugin Interface for React Views label Oct 3, 2024
@dosubot dosubot bot added the area:UI Related to UI/UX. For Frontend Developers. label Oct 3, 2024
@bbovenzi bbovenzi self-assigned this Oct 3, 2024
@bbovenzi bbovenzi added the kind:meta High-level information important to the community label Oct 3, 2024
@bbovenzi bbovenzi changed the title Develop new UI plugins AIP-68 | Develop new UI plugins Oct 3, 2024
@bbovenzi
Copy link
Contributor Author

POC of a react plugin on the Nav level:

Image

I also used https://bolt.new/ as an AI to generate frontend code. I wonder if we can suggest similar tools to help developers who might not know frontend technologies well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AIP-68 Extended Plugin Interface for React Views area:UI Related to UI/UX. For Frontend Developers. kind:meta High-level information important to the community
Projects
Development

No branches or pull requests

1 participant