medium: ui_resource: Flatten, then filter

Fix for previous commit: First flatten tags, then filter
out resources.