Lee-W commented on code in PR #70190:
URL: https://github.com/apache/airflow/pull/70190#discussion_r3636684232


##########
dev/registry/registry_tools/types.py:
##########
@@ -139,11 +181,19 @@
 
 # Class-level sections used by extract_parameters.py (subset of flat that
 # list full class paths rather than simple entries).
+#
+# "plugins" and "dialects" are also flat/class-path sections, but each entry 
is a
+# dict (plugin-class / dialect-class-name) rather than a bare string, so they 
are
+# handled by their own loops in extract_parameters.py instead of this generic 
one.
 CLASS_LEVEL_SECTIONS: dict[str, str] = {
     "notifications": "notifier",
     "secrets-backends": "secret",
     "logging": "logging",
     "executors": "executor",
+    "extra-links": "extra_link",

Review Comment:
   Thanks for pointing out! It wasn't intentional. `extract_versions.py` now 
uses `CLASS_LEVEL_SECTIONS` in `types.py` instead of a separate hardcoded list, 
so backfilled version will show all the same categories . Also moved the 
category-override rule into a shared `CLASS_LEVEL_CATEGORY_OVERRIDES` constant 
so `extract_parameters.py` and `extract_versions.py` won't drift again.



##########
registry/src/js/provider-detail.js:
##########
@@ -155,6 +157,44 @@
     });
   });
 
+  // "More" overflow menu for module tabs that don't fit in the visible row.
+  var moduleTabMoreBtn = document.getElementById('module-tab-more-btn');
+  var moduleTabMoreMenu = document.getElementById('module-tab-more-menu');
+
+  if (moduleTabMoreBtn && moduleTabMoreMenu) {
+    function closeMoreMenu() {
+      moduleTabMoreBtn.setAttribute('aria-expanded', 'false');
+      moduleTabMoreMenu.hidden = true;
+    }
+
+    moduleTabMoreBtn.addEventListener('click', function(e) {
+      e.stopPropagation();
+      var isOpen = moduleTabMoreBtn.getAttribute('aria-expanded') === 'true';
+      if (isOpen) {
+        closeMoreMenu();
+      } else {
+        moduleTabMoreBtn.setAttribute('aria-expanded', 'true');
+        moduleTabMoreMenu.hidden = false;
+      }
+    });
+
+    document.addEventListener('click', function(e) {
+      if (!moduleTabMoreMenu.contains(e.target) && e.target !== 
moduleTabMoreBtn) {
+        closeMoreMenu();
+      }
+    });
+
+    document.addEventListener('keydown', function(e) {
+      if (e.key === 'Escape') closeMoreMenu();
+    });
+
+    // Selecting a tab inside the menu also closes it (filtering itself is
+    // handled by the shared moduleTabs click listener above).
+    moduleTabMoreMenu.querySelectorAll('.module-tab').forEach(function(tab) {
+      tab.addEventListener('click', closeMoreMenu);

Review Comment:
   "More" button is now `active` while the selected type is in the overflow 
menu, so it's still visible what the list is filtered by.
   



##########
registry/src/js/provider-detail.js:
##########
@@ -155,6 +157,44 @@
     });
   });
 
+  // "More" overflow menu for module tabs that don't fit in the visible row.
+  var moduleTabMoreBtn = document.getElementById('module-tab-more-btn');
+  var moduleTabMoreMenu = document.getElementById('module-tab-more-menu');
+
+  if (moduleTabMoreBtn && moduleTabMoreMenu) {
+    function closeMoreMenu() {
+      moduleTabMoreBtn.setAttribute('aria-expanded', 'false');
+      moduleTabMoreMenu.hidden = true;
+    }
+
+    moduleTabMoreBtn.addEventListener('click', function(e) {
+      e.stopPropagation();
+      var isOpen = moduleTabMoreBtn.getAttribute('aria-expanded') === 'true';
+      if (isOpen) {
+        closeMoreMenu();
+      } else {
+        moduleTabMoreBtn.setAttribute('aria-expanded', 'true');
+        moduleTabMoreMenu.hidden = false;
+      }
+    });
+
+    document.addEventListener('click', function(e) {
+      if (!moduleTabMoreMenu.contains(e.target) && e.target !== 
moduleTabMoreBtn) {
+        closeMoreMenu();
+      }
+    });
+
+    document.addEventListener('keydown', function(e) {
+      if (e.key === 'Escape') closeMoreMenu();

Review Comment:
   `closeMoreMenu` now returns focus to the trigger when focus was inside the 
menu. I also dropped `role="menu"` / `role="menuitem"`.



##########
dev/registry/registry_tools/types.py:
##########
@@ -147,11 +189,39 @@
 
 # Class-level sections used by extract_parameters.py (subset of flat that
 # list full class paths rather than simple entries).
+#
+# "plugins" and "dialects" are also flat/class-path sections, but each entry 
is a
+# dict (plugin-class / dialect-class-name) rather than a bare string, and the
+# integration-name field they carry differs between the two, so 
extract_parameters.py
+# still walks them with their own loops instead of this generic one. The 
class-path
+# field name itself is shared via DICT_SHAPED_CLASS_LEVEL_SECTIONS below so 
both
+# extract_versions.py and extract_parameters.py read it from one place.
 CLASS_LEVEL_SECTIONS: dict[str, str] = {
     "notifications": "notifier",
     "secrets-backends": "secret",
     "logging": "logging",
     "executors": "executor",
+    "extra-links": "extra_link",
+    "queues": "queue",
+    "auth-managers": "auth_manager",
+    "db-managers": "db_manager",
+}
+
+# Maps yaml section key -> (type id, class-path field name) for dict-shaped
+# class-level sections (each yaml entry is a dict, not a bare class-path
+# string), shared by extract_versions.py and extract_parameters.py so the
+# field name is defined exactly once.
+DICT_SHAPED_CLASS_LEVEL_SECTIONS: dict[str, tuple[str, str]] = {
+    "plugins": ("plugin", "plugin-class"),
+    "dialects": ("dialect", "dialect-class-name"),
+}

Review Comment:
   sounds good, just updated it



##########
dev/registry/tests/test_extract_parameters.py:
##########
@@ -1086,3 +1157,31 @@ def test_extra_whitespace_is_tolerated(self):
 
     def test_duplicate_providers_collapsed(self):
         assert _parse_requested_providers("amazon amazon google") == 
{"amazon", "google"}
+
+
+class TestResolveDottedPath:
+    @pytest.mark.parametrize(
+        "class_path",
+        (
+            "no_dot_here",
+            "this.module.does.not.exist.at.all.Foo",
+        ),
+    )
+    def test__resolve_dotted_path_returns_none(self, class_path: str):
+        assert _resolve_dotted_path(class_path) is None
+
+    @pytest.mark.parametrize(
+        ("class_path", "expected"),
+        (
+            (
+                "extract_parameters.ThisAttrDoesNotExist",
+                ("extract_parameters", "ThisAttrDoesNotExist", None),
+            ),
+            (
+                "extract_parameters.get_category",
+                ("extract_parameters", "get_category", get_category),
+            ),
+        ),
+    )
+    def test__resolve_dottted_path(self, class_path: str, expected: tuple[str, 
str, object]):

Review Comment:
   fixed



##########
dev/registry/extract_versions.py:
##########
@@ -300,15 +320,13 @@ def process_module(module_path: str, module_type: str, 
integration: str, categor
         if mp:
             process_module(mp, "transfer", source, get_category(source))
 
-    # Class-level sections (full class paths, no source file parsing needed)
-    FQCN_SECTIONS: dict[str, tuple[str, str, str]] = {
-        # yaml_key: (module_type, category, description_suffix)
-        "notifications": ("notifier", "notifications", "notifier"),
-        "secrets-backends": ("secret", "secrets", "secrets backend"),
-        "logging": ("logging", "logging", "log handler"),
-        "executors": ("executor", "executors", "executor"),
-    }
-    for yaml_key, (mod_type, category, desc_suffix) in FQCN_SECTIONS.items():
+    # Class-level sections (full class paths, no source file parsing needed).
+    # Iterating CLASS_LEVEL_SECTIONS keeps this in sync with the single
+    # source of truth in types.py; a section added there without a matching
+    # FQCN_DESC_SUFFIXES entry raises KeyError instead of silently skipping.
+    for yaml_key, mod_type in CLASS_LEVEL_SECTIONS.items():

Review Comment:
   `extract_versions.py` now walks `DICT_SHAPED_CLASS_LEVEL_SECTIONS` alongside 
`CLASS_LEVEL_SECTIONS`, so plugins and dialects show up on backfilled version 
pages as well.
   
   The test is parametrized over that dict as well, so a new dict-shaped 
section will be covered.
   



##########
registry/src/_data/types.json:
##########
@@ -58,5 +58,35 @@
     "id": "toolset",
     "label": "Toolsets",
     "icon": "U"
+  },
+  {
+    "id": "extra_link",

Review Comment:
   Added the missing `.type-icon`, `.share-bar` and `.provider-card .modules` 
rules for the new ids, plus `toolset` and `retry_policy` which had the same 
gap. They use `rgb(from var(--color-X) r g b / 0.2)` like the existing 
`.tab-icon` block rather than hardcoded colours.



##########
dev/registry/registry_tools/types.py:
##########
@@ -139,11 +181,27 @@
 
 # Class-level sections used by extract_parameters.py (subset of flat that
 # list full class paths rather than simple entries).
+#
+# "plugins" and "dialects" are also flat/class-path sections, but each entry 
is a
+# dict (plugin-class / dialect-class-name) rather than a bare string, so they 
are
+# handled by their own loops in extract_parameters.py instead of this generic 
one.
 CLASS_LEVEL_SECTIONS: dict[str, str] = {
     "notifications": "notifier",
     "secrets-backends": "secret",
     "logging": "logging",
     "executors": "executor",
+    "extra-links": "extra_link",
+    "queues": "queue",

Review Comment:
   Yep, will create a follow up PR for this.



##########
dev/registry/registry_tools/types.py:
##########
@@ -116,6 +116,48 @@
         "label": "Retry Policies",
         "icon": "R",
     },
+    "extra_link": {
+        "yaml_key": "extra-links",
+        "level": "flat",
+        "suffixes": [],
+        "label": "Extra Links",
+        "icon": "I",
+    },
+    "queue": {
+        "yaml_key": "queues",
+        "level": "flat",
+        "suffixes": [],
+        "label": "Message Queues",
+        "icon": "Q",
+    },
+    "plugin": {
+        "yaml_key": "plugins",
+        "level": "flat",
+        "suffixes": [],
+        "label": "Plugins",
+        "icon": "P",
+    },
+    "auth_manager": {
+        "yaml_key": "auth-managers",
+        "level": "flat",
+        "suffixes": [],
+        "label": "Auth Managers",
+        "icon": "A",
+    },
+    "db_manager": {
+        "yaml_key": "db-managers",
+        "level": "flat",
+        "suffixes": [],
+        "label": "DB Managers",
+        "icon": "D",
+    },
+    "dialect": {
+        "yaml_key": "dialects",
+        "level": "flat",
+        "suffixes": [],
+        "label": "Dialects",
+        "icon": "C",

Review Comment:
   Making 
   * `dialect` -> `D`
   * `db_manager` -> `M`
   
   so `C` is left for connection.
   
   Thought of whether we have better combinations, but this seems to be the 
best we can get 



-- 
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]

Reply via email to