[Fraud Protection] Add overview and logs tabs to the portal#5791
[Fraud Protection] Add overview and logs tabs to the portal#5791jimmycwc wants to merge 10 commits into
Conversation
|
Is this ready for review? |
|
@jimmycwc I have added a skill for reviewing PRs in your branch. Please pull the latest commits and use it with And here are the issues discovered: Code quality issues
Bugs
Performance issues
|
| topIPsQuery := s.SQLBuilder. | ||
| Select( | ||
| "ip_address", | ||
| `COALESCE(MODE() WITHIN GROUP (ORDER BY NULLIF(UPPER(data#>>'{payload,record,geo_location_code}'), '')), '') AS geo_country_code`, |
There was a problem hiding this comment.
I am concerned about the performance impact of this column.
Actually, we can simply resolve the geo location using the geo ip database again so we do not need to query it from the db. (Using pkg/util/geoip/geoip.go)
Add hourly timeBuckets to the fraud protection overview query for the requests-by-action chart, and resolve the dominant geo country per source IP via a two-query merge instead of a correlated subquery. Co-authored-by: Cursor <cursoragent@cursor.com>
Add an optional time picker to DateRangeDialog/DateTimePicker, let DateRangeFilterDropdown render a custom range label, and add a formatCustomDateRangeLabel helper for compact date range display. Co-authored-by: Cursor <cursoragent@cursor.com>
Add the requests-by-action stacked bar chart (hourly for 24h, daily for 7d), wire the overview metrics, SMS destinations, IP locations and top source IPs to real query data, and register the Chart.js Legend plugin. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a customizable columns dropdown with persisted visibility, make the filter bar responsive, fetch logs and log details from the Admin API, and remove the experimental Logs B tab variant. Co-authored-by: Cursor <cursoragent@cursor.com>
Format the logs timestamp column with formatDatetime instead of showing the raw ISO string, and restore the default-visible optional columns (reason codes, IP country) when stored preferences are empty. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the expensive SQL MODE() aggregation with geoip.IPString lookups for the top-10 source IPs, and gofmt the overview structs. Co-authored-by: Cursor <cursoragent@cursor.com>
Add maxDateTime support to DateTimePicker and forward the existing from/to max date props when showTimePicker is enabled so Logs custom ranges cannot select future times. Co-authored-by: Cursor <cursoragent@cursor.com>
Localize chart labels, use the portal locale for country names, rename the calendar-day range to Today, honor an explicit empty column selection in localStorage, and align the time-range control font. Co-authored-by: Cursor <cursoragent@cursor.com>
Limit hourly time-bucket results so unbounded Admin API callers cannot return an arbitrarily large set of buckets. Co-authored-by: Cursor <cursoragent@cursor.com>
5a72cd5 to
5657e46
Compare
|
@tung2744 Thanks for the review. I've addressed the findings and rebased onto the latest Fixed
Please take another look when you have a chance. Thanks! |
Summary
Adds the Fraud Protection Overview and Logs experiences to the portal, backed by real Admin API data.
fraudProtectionLogsquery, with customizable columns (persisted per app), result/reason-code/date-range filters, and a log detail screen.formatDatetime(instead of the raw ISO string), and restore default-visible optional columns (reason codes, IP country) when stored preferences are empty.Test plan
make -C portal typecheckpassesMade with Cursor