bbovenzi commented on code in PR #37436:
URL: https://github.com/apache/airflow/pull/37436#discussion_r1496812864
##########
airflow/www/static/js/dags.js:
##########
@@ -126,16 +126,75 @@ $(".typeahead").typeahead({
success: callback,
});
},
+ matcher(item) {
+ const it = this.displayText(item);
+ const query = this.query.toLowerCase();
+ const queryValue = query.replace(/^([a-z]+:\s*)/i, "");
+
+ return it.toLowerCase().indexOf(queryValue) !== -1;
+ },
+ displayText(item) {
+ if (typeof item !== "undefined" && typeof item.name !== "undefined") {
+ if (item.type === "task") {
+ return `${item.type}: ${item.name} <i>in ${item.dag_id}</i>`;
+ }
+ return `${item.type}: ${item.name}`;
+ }
+ return item;
+ },
+ sorter(items) {
+ const beginswith = [];
+ const caseSensitive = [];
+ const caseInsensitive = [];
+ let item;
+ let { query } = this;
+ query = query.replace(/^([a-z]+:\s*)/i, "");
Review Comment:
Let's create a new variable for query instead of using `let` and reassigning
its value.
--
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]