gabotorresruiz commented on code in PR #44821:
URL: https://github.com/apache/superset/pull/44821#discussion_r4362408850


##########
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:
   That works for me on both counts. `Related to #42564` is the right link 
given the issue asks for values and this deliberately stops short, and I can 
see the body already carries it. Keeping `{id, name, hasValue}` is a sensible 
default to ship, and leaving the values to a follow-up on the issue means 
whoever picks it up gets to decide the config flag question with the retention 
side in view. Thanks for the patience on the scope question.



-- 
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]

Reply via email to