-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity picker/new search item component #42009
Conversation
8fc53eb
to
cb642f7
Compare
cb642f7
to
56de155
Compare
PLUGIN_COLLECTIONS.getIcon = getIcon; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be part of verified collections rather than audit app
Codenotify: Notifying subscribers in CODENOTIFY files for diff 6065763...f9ac80d. No notifications. |
@@ -59,7 +59,7 @@ export const getIcon = (item: ObjectWithModel): IconData => { | |||
}; | |||
} | |||
|
|||
if (item.model === "dataset" && item.authority_level === "official") { | |||
if (item.model === "dataset" && item.moderated_status === "verified") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
models are verified, collections are official 🥴
${({ isLast }) => | ||
!isLast ? `border-bottom: 1px solid ${color("border")}` : ""}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately we need to do this programmatically, because the virtualizer adds some wrapping divs so we can't just check last-of-type in css 😢
// required to get the tooltip to show up over the entity picker modal 😢 | ||
zIndex: "450 !important" as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel very bad about this, but the default zIndex for tooltips is 300, and the entity picker modal is at z-index 400 so it doesn't get overlapped by notifications that should be underneath it. Open to alternative ideas!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit and proof that i'm a fuddy duddy, i've seen emojis break tooling in the past and prefer to avoid using them in code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my only real feedback about the use of a very specific z-index # is that the context gets lots. i've previously used a constants file in the past that records all z-indexes so folks can understand the hierarchy in one file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is a result of a series of sins. I will
- remove descriptions from this PR altogether so that this can merge
- in a separate PR, hopefully tomorrow, fix the series of z-index sins in a separate PR
- open a third PR to put descriptions back into this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or can't you merge and just improve z-index sins in a follow up? That does sound like a lot only to avoid a magic number 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key={item.model + item.id} | ||
result={Search.wrapEntity(item, dispatch)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very happy that we no longer need redux involved here, just to get an icon
|
2102cde
to
c9bcbe6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good! I am noticing though that the UI flashes the loading spinner crazy fast before showing results. I think you could introduce a small delay before showing the spinner or show the stale results with a loading indicator elsewhere. Doing so would make this feel really polished! Great work!
...metabase/common/components/EntityPicker/components/EntityPickerSearch/EntityPickerSearch.tsx
Show resolved
Hide resolved
...tend/src/metabase/common/components/EntityPicker/components/ResultItem/ResultItem.styled.tsx
Show resolved
Hide resolved
frontend/src/metabase/common/components/EntityPicker/components/ResultItem/ResultItem.tsx
Outdated
Show resolved
Hide resolved
frontend/src/metabase/common/components/EntityPicker/components/ResultItem/ResultItem.tsx
Outdated
Show resolved
Hide resolved
// required to get the tooltip to show up over the entity picker modal 😢 | ||
zIndex: "450 !important" as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit and proof that i'm a fuddy duddy, i've seen emojis break tooling in the past and prefer to avoid using them in code.
// required to get the tooltip to show up over the entity picker modal 😢 | ||
zIndex: "450 !important" as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my only real feedback about the use of a very specific z-index # is that the context gets lots. i've previously used a constants file in the past that records all z-indexes so folks can understand the hierarchy in one file.
I updated this to use the delayed loading spinner, but I think the real problem is that the old search hook goes into loading mode and doesn't distinguish between refetching. I'd rather punt that to other planned work to use RTK query in this component, rather than enlarging the scope of this small PR. |
b25b0f5
to
f9ac80d
Compare
@iethree Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
@@ -57,4 +59,9 @@ export const getIconBase = ( | |||
return { name: modelIconMap?.[item.model] ?? "unknown" }; | |||
}; | |||
|
|||
export const getIcon = PLUGIN_COLLECTIONS.getIcon ?? getIconBase; | |||
export const getIcon = (item: ObjectWithModel, options: IconOptions = {}) => { | |||
if (PLUGIN_COLLECTIONS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also take PLUGIN_MODERATION
into account?
It also seems that getCollectionIcon
has not been fully ported. Was this intentional?
Part of #39528
Description
Adds a new search results component that we will use for both recents and search. This implements it in search first so it can get into master while we work on some backend changes for recents.
When picking a collection (new > dashboard)
When picking a question (any dashboard > edit > hover a card > replace question)
Checklist