sfirke commented on code in PR #45591:
URL: https://github.com/apache/superset/pull/45591#discussion_r4342861501
##########
superset-frontend/src/features/groups/utils.ts:
##########
@@ -19,9 +19,39 @@
import { t } from '@apache-superset/core/translation';
import { SupersetClient } from '@superset-ui/core';
import rison from 'rison';
+import {
+ SUBJECT_DETAIL_PROP,
+ SUBJECT_TEXT_LABEL_PROP,
+ SubjectSelectLabel,
+} from 'src/features/subjects/SubjectSelectLabel';
import { getUserDisplayLabel } from 'src/features/users/utils';
import { FormValues } from './types';
+type UserRecord = { id: number; email?: string } & Parameters<
+ typeof getUserDisplayLabel
+>[0];
+
+/**
+ * Build a select option for a user picker.
+ *
+ * The option shows the email under the display name, like the subject-based
+ * owner pickers do, so that a server-side match on email is visible to the
+ * person searching. Plain-text copies of both lines are attached under the
+ * subject filter props so AsyncSelect's client-side re-filter can match them
+ * (a React label is otherwise filtered as an empty string), and under `title`
+ * so ListView can serialize the chosen option's label into the URL.
+ */
+export const toUserSelectOption = (user: UserRecord) => {
+ const textLabel = getUserDisplayLabel(user);
+ return {
+ value: user.id,
+ label: SubjectSelectLabel({ label: textLabel, secondaryLabel: user.email
}),
+ title: textLabel,
+ [SUBJECT_TEXT_LABEL_PROP]: textLabel,
+ [SUBJECT_DETAIL_PROP]: user.email,
Review Comment:
Confirmed and addressed in 2fc26ac50e. The option now carries the username
and both pickers include it in their client-side filter props, so a user
matched by username alone is no longer hidden. Added regression tests for both
pickers.
---
🤖 _Drafted by Claude Code, reviewed and approved by @sfirke._
--
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]