kaxil commented on code in PR #77143:
URL: https://github.com/apache/airflow/pull/77143#discussion_r4604135424


##########
registry/src/operators.njk:
##########
@@ -0,0 +1,109 @@
+---
+layout: base.njk
+title: Operators
+description: Operators, hooks, sensors, triggers and other modules across all 
Airflow providers, filterable by durable and deferrable support
+mainClass: operators-page
+---
+
+{% set counts = operatorModules.counts %}
+
+<div class="container">
+  <header class="page-header">
+    <h1>Operators</h1>
+    <p>{{ counts.all }} operators, hooks, sensors, triggers and other modules 
across {{ operatorModules.groups.length }} providers. Filter by type, provider, 
or durable and deferrable support.</p>
+  </header>
+
+  <dl class="capabilities">
+    <div>
+      <dt><span class="durable-badge">Durable</span> {{ counts.durable }}</dt>
+      <dd>On retry, reconnects to the job it already started, or replays the 
progress it saved, instead of starting over. Controlled by the operator's 
<code>durable</code> flag: on by default for most, opt-in for the AI agent 
operators. Several only reconnect on Airflow 3.3+.</dd>
+    </div>
+    <div>
+      <dt><span class="deferrable-badge">Deferrable</span> {{ 
counts.deferrable }}</dt>
+      <dd>Frees the worker slot while waiting: a Triggerer does the waiting, 
and if it dies another Triggerer restarts the wait. Off by default: pass 
<code>deferrable=True</code> (or set <code>[operators] 
default_deferrable</code>) where the operator exposes it; some always 
defer.</dd>
+    </div>
+  </dl>
+
+  <div class="filters">
+    <div class="search-wrapper">
+      <svg class="search-icon" fill="none" stroke="currentColor" viewBox="0 0 
24 24" aria-hidden="true">
+        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
+      </svg>
+      <input id="operator-search" type="text" placeholder="Search modules..." 
aria-label="Search modules">
+    </div>
+
+    <div class="filter-group">
+      <label id="capability-label">Capability:</label>
+      <div class="capability-buttons" role="group" 
aria-labelledby="capability-label">
+        <button class="capability-btn active" data-capability="all" 
aria-pressed="true">All (<span class="count">{{ counts.all }}</span>)</button>
+        <button class="capability-btn" data-capability="durable-or-deferrable" 
aria-pressed="false">Durable or deferrable (<span class="count">{{ 
counts.durableOrDeferrable }}</span>)</button>
+        <button class="capability-btn" data-capability="durable" 
aria-pressed="false">Durable (<span class="count">{{ counts.durable 
}}</span>)</button>
+        <button class="capability-btn" data-capability="deferrable" 
aria-pressed="false">Deferrable (<span class="count">{{ counts.deferrable 
}}</span>)</button>
+      </div>
+    </div>
+
+    <div class="filter-group">
+      <label for="operator-provider-filter">Provider:</label>
+      <select id="operator-provider-filter">
+        <option value="all">All providers</option>
+        {% for group in operatorModules.groups %}
+        <option value="{{ group.id }}">{{ group.name }} ({{ 
group.modules.length }})</option>

Review Comment:
   These counts are across all types, but the page opens on Operators and 
`apply()` only recounts the capability buttons. 41 of the 107 providers have no 
`operator` modules (MySQL, Postgres, Celery, ...), so picking "MySQL (5)" from 
the default view shows "No modules found", and "Amazon (493)" lists 205 rows. 
The Type options on line 60 go stale the same way once a provider or capability 
is picked. Could `apply()` recount the option labels too, or drop the numbers 
from them?



##########
registry/src/js/operator-filters.js:
##########
@@ -17,48 +17,65 @@
  * under the License.
  */
 
-// Filters for the /durable/ page. State lives in the query string
-// (?capability=deferrable&provider=amazon&type=sensor&q=glue) so a filtered
-// view can be shared.
+// Filters for the /operators/ page. State lives in the query string
+// (?capability=durable&provider=amazon&type=sensor&q=glue) so a filtered
+// view can be shared. Type defaults to operator, so "all types" is written
+// to the URL as type=all.
 (function() {
-  const searchInput = document.getElementById('durable-search');
+  const searchInput = document.getElementById('operator-search');
   const capabilityButtons = document.querySelectorAll('.capability-btn');
-  const providerSelect = document.getElementById('durable-provider-filter');
-  const typeSelect = document.getElementById('durable-type-filter');
-  const status = document.getElementById('durable-status');
-  const emptyState = document.getElementById('durable-empty');
-  const groups = document.querySelectorAll('.durable-page .provider-group');
+  const providerSelect = document.getElementById('operator-provider-filter');
+  const typeSelect = document.getElementById('operator-type-filter');
+  const status = document.getElementById('operator-status');
+  const emptyState = document.getElementById('operator-empty');
+  const groups = document.querySelectorAll('.operators-page .provider-group');
 
   if (!searchInput || !providerSelect || !typeSelect) return;
 
-  const state = { capability: 'all', provider: 'all', type: 'all', q: '' };
+  const defaults = { capability: 'all', provider: 'all', type: 'operator', q: 
'' };

Review Comment:
   Defaulting to `type: 'operator'` leaves out sensors, transfers and 
decorators, which are also things you put in a Dag (`GCSToS3Operator` is a 
`transfer`). On the live data the default view's Deferrable filter misses 70 
deferrable sensors, and Durable misses `@task.agent` and `@task.kubernetes`. 
Should the page cover the task-level types (`operator`, `sensor`, `transfer`, 
`decorator`) and leave hooks, triggers, executors and the rest to the provider 
pages? 337 hooks and 209 triggers don't really belong on a page called 
Operators.



##########
registry/src/operators.njk:
##########
@@ -0,0 +1,109 @@
+---
+layout: base.njk
+title: Operators
+description: Operators, hooks, sensors, triggers and other modules across all 
Airflow providers, filterable by durable and deferrable support
+mainClass: operators-page
+---
+
+{% set counts = operatorModules.counts %}
+
+<div class="container">
+  <header class="page-header">
+    <h1>Operators</h1>
+    <p>{{ counts.all }} operators, hooks, sensors, triggers and other modules 
across {{ operatorModules.groups.length }} providers. Filter by type, provider, 
or durable and deferrable support.</p>
+  </header>
+
+  <dl class="capabilities">
+    <div>
+      <dt><span class="durable-badge">Durable</span> {{ counts.durable }}</dt>

Review Comment:
   This says 18 (and Deferrable 252 below) because `counts` is over every type, 
while the buttons right under it read Durable (15) and Deferrable (175) once 
the script switches to Operators. Same for the intro on line 13 ("2038 
operators, hooks, sensors, triggers and other modules") and the initial "2038 
modules" on line 66. Can the server render the default view instead, with the 
default type selected and counts computed for it? Then the static numbers and 
the JS agree, and a slower machine doesn't paint all 2038 rows before the 
script hides half of them.



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