This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 7de5ac36770 UI: Remove unused filter count helper (#75760)
7de5ac36770 is described below
commit 7de5ac367706ad803ba780bc6e346a26a9bcb93c
Author: Hussein Awala <[email protected]>
AuthorDate: Tue Oct 27 16:00:56 2026 +0100
UI: Remove unused filter count helper (#75760)
---
.../src/airflow/ui/src/utils/filterUtils.test.ts | 106 ---------------------
.../src/airflow/ui/src/utils/filterUtils.ts | 27 ------
2 files changed, 133 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/utils/filterUtils.test.ts
b/airflow-core/src/airflow/ui/src/utils/filterUtils.test.ts
deleted file mode 100644
index f11b2ee6efa..00000000000
--- a/airflow-core/src/airflow/ui/src/utils/filterUtils.test.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/*!
- * 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.
- */
-import { describe, it, expect } from "vitest";
-
-import { getFilterCount } from "./filterUtils";
-
-describe("getFilterCount", () => {
- it("counts non-undefined values correctly", () => {
- const filters = {
- count: 5,
- enabled: true,
- name: "test",
- nullValue: undefined,
- status: "active",
- undefinedValue: undefined,
- };
-
- expect(getFilterCount(filters)).toBe(4);
- });
-
- it("handles array fields correctly", () => {
- const filters = {
- emptyTags: [],
- nullValue: undefined,
- status: "active",
- tags: ["tag1", "tag2"],
- };
-
- expect(getFilterCount(filters)).toBe(2);
- });
-
- it("returns 0 for empty filters", () => {
- expect(getFilterCount({})).toBe(0);
- });
-
- it("returns 0 when all values are undefined/undefined", () => {
- const filters = {
- nullValue: undefined,
- undefinedValue: undefined,
- };
-
- expect(getFilterCount(filters)).toBe(0);
- });
-
- it("handles boolean values correctly", () => {
- const filters = {
- disabled: false,
- enabled: true,
- nullValue: undefined,
- };
-
- expect(getFilterCount(filters)).toBe(2);
- });
-
- it("handles zero values correctly", () => {
- const filters = {
- amount: 0.0,
- count: 0,
- nullValue: undefined,
- };
-
- expect(getFilterCount(filters)).toBe(2);
- });
-
- it("handles empty strings correctly", () => {
- const filters = {
- emptyString: "",
- nonEmptyString: "value",
- nullValue: undefined,
- };
-
- expect(getFilterCount(filters)).toBe(2);
- });
-});
-
-it("handles complex filters pattern", () => {
- const filters = {
- after: "2024-01-01",
- before: ["tag1", "tag2"],
- dagId: "test-dag",
- eventType: "event",
- mapIndex: undefined,
- runId: "test-run",
- taskId: undefined,
- tryNumber: undefined,
- user: "admin",
- };
-
- expect(getFilterCount(filters)).toBe(6);
-});
diff --git a/airflow-core/src/airflow/ui/src/utils/filterUtils.ts
b/airflow-core/src/airflow/ui/src/utils/filterUtils.ts
deleted file mode 100644
index 9df5a5a9995..00000000000
--- a/airflow-core/src/airflow/ui/src/utils/filterUtils.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*!
- * 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.
- */
-
-export const getFilterCount = (filters: Record<string, unknown>): number =>
- Object.values(filters).reduce((count: number, value) => {
- if (Array.isArray(value)) {
- return count + (value.length > 0 ? 1 : 0);
- }
-
- return count + (value !== null && value !== undefined ? 1 : 0);
- }, 0);