Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/kanban/dashboard/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
if (!boardData) return null;
const q = search.trim().toLowerCase();
const filterTask = function (t) {
if (tenantFilter && t.tenant !== tenantFilter) return false;
if (assigneeFilter && t.assignee !== assigneeFilter) return false;
if (q) {
const hay = `${t.id} ${t.title || ""} ${t.assignee || ""} ${t.tenant || ""}`.toLowerCase();
Expand All @@ -474,7 +475,7 @@
return Object.assign({}, col, { tasks: col.tasks.filter(filterTask) });
}),
});
}, [boardData, assigneeFilter, search]);
}, [boardData, tenantFilter, assigneeFilter, search]);

// --- actions ------------------------------------------------------------
const moveTask = useCallback(function (taskId, newStatus) {
Expand Down
37 changes: 37 additions & 0 deletions tests/plugins/test_kanban_dashboard_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,43 @@ def test_tenant_filter(client):
assert total == 1


def test_dashboard_select_filters_use_sdk_value_change_handler():
"""Tenant/assignee filters must work with the dashboard SDK Select API.

The dashboard Select component is shadcn-like and calls
``onValueChange(value)`` instead of native ``onChange(event)``. A native-only
handler leaves the tenant dropdown visually selectable but never updates the
filtered board query.
"""

repo_root = Path(__file__).resolve().parents[2]
bundle = repo_root / "plugins" / "kanban" / "dashboard" / "dist" / "index.js"
js = bundle.read_text()

assert "function selectChangeHandler(setter)" in js
assert "onValueChange: function (v)" in js
assert "onChange: function (e)" in js
assert "selectChangeHandler(props.setTenantFilter)" in js
assert "selectChangeHandler(props.setAssigneeFilter)" in js


def test_dashboard_client_side_filtering_includes_tenant_filter():
"""The rendered board must also filter by tenant.

The API request includes ``?tenant=...``, but the dashboard also filters the
locally cached board for search/assignee changes. Without checking
``tenantFilter`` here, switching tenants can leave stale cards visible until a
full reload finishes.
"""

repo_root = Path(__file__).resolve().parents[2]
bundle = repo_root / "plugins" / "kanban" / "dashboard" / "dist" / "index.js"
js = bundle.read_text()

assert "if (tenantFilter && t.tenant !== tenantFilter) return false;" in js
assert "[boardData, tenantFilter, assigneeFilter, search]" in js


# ---------------------------------------------------------------------------
# GET /tasks/:id returns body + comments + events + links
# ---------------------------------------------------------------------------
Expand Down