jedcunningham commented on code in PR #44464:
URL: https://github.com/apache/airflow/pull/44464#discussion_r1868772181
##########
providers/src/airflow/providers/fab/www/package.json:
##########
@@ -0,0 +1,156 @@
+{
+ "name": "airflow-www",
+ "version": "1.0.0",
+ "description": "Apache Airflow is a platform to programmatically author,
schedule and monitor workflows.",
+ "scripts": {
Review Comment:
Yep, sounds good.
##########
providers/src/airflow/providers/fab/www/extensions/init_appbuilder.py:
##########
@@ -0,0 +1,580 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# mypy: disable-error-code=var-annotated
+from __future__ import annotations
+
+import logging
+from functools import reduce
+from typing import TYPE_CHECKING
+
+from flask import Blueprint, current_app, url_for
+from flask_appbuilder import __version__
+from flask_appbuilder.babel.manager import BabelManager
+from flask_appbuilder.const import (
+ LOGMSG_ERR_FAB_ADD_PERMISSION_MENU,
+ LOGMSG_ERR_FAB_ADD_PERMISSION_VIEW,
+ LOGMSG_ERR_FAB_ADDON_IMPORT,
+ LOGMSG_ERR_FAB_ADDON_PROCESS,
+ LOGMSG_INF_FAB_ADD_VIEW,
+ LOGMSG_INF_FAB_ADDON_ADDED,
+ LOGMSG_WAR_FAB_VIEW_EXISTS,
+)
+from flask_appbuilder.filters import TemplateFilters
+from flask_appbuilder.menu import Menu
+from flask_appbuilder.views import IndexView
+
+from airflow import settings
+from airflow.configuration import conf
+from airflow.www.extensions.init_auth_manager import init_auth_manager
Review Comment:
Might be worth leaving a comment in the file itself :)
##########
providers/src/airflow/providers/fab/www/package.json:
##########
@@ -0,0 +1,156 @@
+{
+ "name": "airflow-www",
+ "version": "1.0.0",
+ "description": "Apache Airflow is a platform to programmatically author,
schedule and monitor workflows.",
+ "scripts": {
+ "test": "jest",
+ "dev": "NODE_ENV=development webpack --watch --progress --devtool
eval-cheap-source-map --mode development",
+ "prod": "NODE_ENV=production node --max_old_space_size=4096
./node_modules/webpack/bin/webpack.js --mode production --progress",
+ "build": "NODE_ENV=production webpack --progress --mode production",
+ "lint": "eslint --ignore-path=.eslintignore --max-warnings=0 --ext
.js,.jsx,.ts,.tsx . && tsc",
+ "lint:fix": "eslint --fix --ignore-path=.eslintignore --ext
.js,.jsx,.ts,.tsx . && tsc",
+ "format": "yarn prettier --write .",
+ "generate-api-types": "npx openapi-typescript
\"../api_connexion/openapi/v1.yaml\" --output static/js/types/api-generated.ts
&& node alias-rest-types.js static/js/types/api-generated.ts"
+ },
+ "author": "Apache",
+ "license": "Apache-2.0",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/apache/airflow.git"
+ },
+ "homepage": "https://airflow.apache.org/",
+ "keywords": [
+ "big",
+ "data",
+ "workflow",
+ "airflow",
+ "d3",
+ "nerds",
+ "database",
+ "flask"
+ ],
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
+ },
+ "devDependencies": {
Review Comment:
@bbovenzi may be able to help us here. I'd imagine we can get rid of a lot
of these.
##########
providers/src/airflow/providers/fab/www/templates/airflow/main.html:
##########
@@ -0,0 +1,85 @@
+{#
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+#}
+
+{% extends 'appbuilder/baselayout.html' %}
+{% from 'airflow/_messages.html' import show_message %}
+
+{% block page_title -%}
+ Airflow - Airflow 2 plugins compatibility view
+{% endblock %}
+
+{% block head_css %}
+ {{ super() }}
+
+ {% if not appbuilder.app_theme %}
+ {# airflowDefaultTheme.css file contains the styles from local
bootstrap-theme.css #}
+ <link rel="stylesheet" type="text/css" href="{{
url_for_asset('airflowDefaultTheme.css') }}">
+ {% endif %}
+ <link rel="stylesheet" type="text/css" href="{{
url_for_asset('materialIcons.css') }}">
+ <link rel="stylesheet" type="text/css" href="{{ url_for_asset('main.css')
}}">
+ <link rel="stylesheet" type="text/css" href="{{
url_for_asset('loadingDots.css') }}">
+ <link rel="stylesheet" type="text/css" href="{{
url_for_asset('jquery-ui.min.css') }}">
+ <style type="text/css">
+ {% for state, state_color in state_color_mapping.items() %}
+ span.{{state}} {
+ background-color: {{state_color}};
+ }
+ {% endfor %}
+ .navbar-nav > li > a {
+ color: {{ navbar_text_color }};
+ }
+ .navbar-nav > li > a:hover {
+ background-color: {{ navbar_hover_color }};
+ color: {{ navbar_text_hover_color }};
+ }
+ </style>
+ <link rel="icon" type="image/png" href="{{ url_for('static',
filename='pin_32.png') }}">
+{% endblock %}
+
+{% block messages %}
+ {% call show_message(category='warning', dismissible=false) %}
+ <p>
+ This is a limited version of an Airflow 2 environment. The reason why
you are using this environment is that
+ you are accessing a page defined in an Airflow plugin only compatible
with Airflow 2.
+ This is also why the UI is different from the rest of your Airflow
environment.
+ </p>
+ <p>
+ To have the plugin be integrated with the rest of your environment,
+ please update your plugin to make it compatible with Airflow 3.
Review Comment:
```suggestion
You have a plugin that is using a FAB view or Flask Blueprint, which
was used for the Airflow 2 UI, and is now
deprecated. Please update your plugin to be compatible with the
Airflow 3 UI.
```
Maybe something like this?
We probably need to revisit anyways, because we likely need to leave this UI
around for the FAB auth manager too - we we may need this behind a conditional
on plugin stuff. But this is a problem for later :)
##########
providers/src/airflow/providers/fab/www/templates/appbuilder/navbar.html:
##########
@@ -0,0 +1,53 @@
+{#
Review Comment:
Keeping it simple sounds good to me.
##########
providers/src/airflow/providers/fab/www/static/js/toggle_theme.js:
##########
@@ -0,0 +1,46 @@
+/*!
Review Comment:
I think we can drop support for dark mode. It won't be consistent with AF3
anyways.
##########
providers/src/airflow/providers/fab/www/extensions/init_views.py:
##########
@@ -0,0 +1,67 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import logging
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from flask import Flask
+
+log = logging.getLogger(__name__)
+
+
+def init_plugins(app):
+ """Integrate Flask and FAB with plugins."""
+ from airflow import plugins_manager
+
+ plugins_manager.initialize_flask_plugins()
+
+ appbuilder = app.appbuilder
+
+ for view in plugins_manager.flask_appbuilder_views:
Review Comment:
Somewhere in here we should issue a deprecation warning. In `init_plugins`
is probably the right place. Fine with a follow up as long as we drop a TODO.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]