Skip to content

Commit c06d9f1

Browse files
author
Andrea Bonomi
committed
add menu link to REST API reference
1 parent 5536f81 commit c06d9f1

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

airflow_code_editor/airflow_code_editor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
except Exception:
2424
api_blueprint = None
2525

26-
from airflow_code_editor.app_builder_view import appbuilder_view
26+
from airflow_code_editor.app_builder_view import api_reference_menu, appbuilder_view
2727
from airflow_code_editor.commons import STATIC, VERSION
2828
from airflow_code_editor.flask_admin_view import admin_view
2929
from airflow_code_editor.utils import is_enabled
@@ -56,4 +56,5 @@ class CodeEditorPlugin(AirflowPlugin):
5656
executors = []
5757
admin_views = [admin_view] if (is_enabled() and admin_view is not None) else []
5858
menu_links = []
59+
appbuilder_menu_items = [api_reference_menu] if (is_enabled() and api_blueprint is not None) else []
5960
appbuilder_views = [appbuilder_view] if is_enabled() else []

airflow_code_editor/app_builder_view.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020

2121
from airflow_code_editor.code_editor_view import AbstractCodeEditorView
2222
from airflow_code_editor.commons import (
23+
API_REFERENCE_LABEL,
24+
API_REFERENCE_MENU_CATEGORY,
2325
JS_FILES,
2426
MENU_CATEGORY,
2527
MENU_LABEL,
2628
ROUTE,
2729
VERSION,
2830
)
2931

30-
__all__ = ["appbuilder_view"]
32+
__all__ = ["appbuilder_view", "api_reference_menu"]
3133

3234
try:
3335
from airflow.security import permissions
@@ -188,3 +190,8 @@ def _render(self, template, *args, **kargs):
188190
"name": MENU_LABEL,
189191
"view": appbuilder_code_editor_view,
190192
}
193+
api_reference_menu = {
194+
"name": API_REFERENCE_LABEL,
195+
"category": API_REFERENCE_MENU_CATEGORY,
196+
"href": ROUTE + "/api/",
197+
}

airflow_code_editor/commons.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
'PLUGIN_NAME',
2323
'MENU_CATEGORY',
2424
'MENU_LABEL',
25+
'API_REFERENCE_MENU_CATEGORY',
26+
'API_REFERENCE_LABEL',
2527
'ROUTE',
2628
'STATIC',
2729
'CONFIG_SECTION',
@@ -52,6 +54,8 @@
5254
PLUGIN_NAME = 'code_editor'
5355
MENU_CATEGORY = 'Admin'
5456
MENU_LABEL = 'DAGs Code Editor'
57+
API_REFERENCE_MENU_CATEGORY = 'Docs'
58+
API_REFERENCE_LABEL = 'Airflow Code Editor REST API Reference'
5559
ROUTE = '/' + PLUGIN_NAME
5660
STATIC = '/static/' + PLUGIN_NAME
5761
CONFIG_SECTION = PLUGIN_NAME + '_plugin'
@@ -67,6 +71,7 @@
6771
'checkout',
6872
'commit',
6973
'diff',
74+
'for-each-ref',
7075
'log',
7176
'ls-tree',
7277
'pull',

airflow_code_editor/static/airflow_code_editor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)