Sairaj-24 commented on code in PR #44821:
URL: https://github.com/apache/superset/pull/44821#discussion_r4192069369
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/utils.ts:
##########
@@ -190,6 +190,39 @@ export const getFiltersToApply = (
})
.map(([filterId]) => filterId);
+export type AppliedFilterLogEntry = {
+ id: string;
+ name?: string;
+ hasValue: boolean;
+};
+
+/**
+ * Build the `change_dashboard_filter` payload for filters about to be applied.
+ *
+ * Records the filter id, display name, and whether a value is selected. The
+ * selected value itself is omitted because filter values can contain personal
+ * data and this event is written to the logs table.
+ */
+export const getAppliedFilterLogPayload = (
+ filterIds: string[],
+ filtersById: Record<string, { name?: string } | undefined>,
+ dataMaskSelected: DataMaskStateWithId,
+): AppliedFilterLogEntry[] =>
+ filterIds.flatMap(filterId => {
+ const filter = filtersById[filterId];
+ if (!filter) {
+ return [];
+ }
+ const value = dataMaskSelected[filterId]?.filterState?.value;
+ return [
+ {
+ id: filterId,
+ name: filter.name,
+ hasValue: value !== undefined && value !== null,
Review Comment:
Thanks for the review. I'll switch this PR to `Related to #42564` so it
doesn't auto-close the issue. This change keeps `{id, name, hasValue}` and
omits selected values on purpose. Logging the actual values (or putting them
behind a config flag) can stay as follow-up on that issue.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]