fix: Update URL prefix for Airflow 3 compatibility and adjust base path in Vite config

This commit is contained in:
2025-05-10 19:51:51 +00:00
parent c5576acb19
commit dd2f7edf92
3 changed files with 4 additions and 16 deletions

View File

@@ -71,19 +71,6 @@ class MarkdownViewPlugin(AirflowPlugin):
{ {
"app": markdown_fastapi_app, "app": markdown_fastapi_app,
"name": "markdown_view_app", # A unique name for this FastAPI app "name": "markdown_view_app", # A unique name for this FastAPI app
"url_prefix": "/markdown_view_plugin", # Required for Airflow 3 FastAPI plugins "url_prefix": "/plugins", # Required for Airflow 3 FastAPI plugins
} }
] ]
# Airflow 3+ UI compatibility: use appbuilder_menu_items instead of menu_links
appbuilder_menu_items = [
{
"name": "Markdown Viewer",
"href": "/markdown_view_plugin/markdown_view", # This should match the url_prefix + @markdown_fastapi_app.get path for the UI
"category": "Plugins",
}
]
# For Airflow to pick up the plugin, the class name must match the filename (snake_case to PascalCase)
# or be explicitly defined in an __init__.py in the plugin\'s root directory.
# Assuming filename is markdown_view_plugin.py, class MarkdownViewPlugin is correct.

View File

@@ -4,7 +4,8 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
base: '/markdown_view_plugin_mount/static/markdown_view_plugin/', // Important for Airflow to find assets // The base must match the FastAPI static mount: /<url_prefix>/static/markdown_view_plugin/
base: '/plugins/static/markdown_view_plugin/',
build: { build: {
outDir: 'dist', outDir: 'dist',
rollupOptions: { rollupOptions: {

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "markdown-view-plugin" name = "markdown-view-plugin"
version = "0.1.8" version = "0.1.13"
description = "Airflow UI plugin to render Markdown content using FastAPI and React." description = "Airflow UI plugin to render Markdown content using FastAPI and React."
readme = "README.md" readme = "README.md"
requires-python = ">=3.9" requires-python = ">=3.9"