-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(advanced-search): adding select value modal #6026
feat(advanced-search): adding select value modal #6026
Conversation
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.
Looks good! I have some minor comments and nits but mostly around code style / cleaning a few things up. Otherwise looks good to me!
margin-right: 4px; | ||
`; | ||
|
||
export const SelectContainerModal = ({ onCloseModal, defaultValues, onOkOverride, titleOverride }: Props) => { |
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: would you mind changing this or the file name so they're consistent?
|
||
// Renders a search result in the select dropdown. | ||
const renderSearchResult = (entity: Container) => { | ||
const displayName = entity.properties?.name || entity.properties?.qualifiedName || entity.urn; |
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.
could you use entityRegistry.getDisplayName()
?
const filteredContainers = | ||
containerSearchResults?.filter((entity) => entity.urn === newUrn).map((entity) => entity) || []; | ||
|
||
if (filteredContainers.length) { | ||
const container = filteredContainers[0] as Container; |
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: I don't think you need this map
function. also you could use containerSearchResults?.find(entity => entity.urn === newUrn)
and then you'd have the container right then if it exists!
label: defaultValue.entity ? renderDropdownResult(defaultValue.entity) : defaultValue.urn, | ||
value: { | ||
ownerUrn: defaultValue.urn, | ||
ownerEntityType: EntityType.CorpUser, |
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.
could this be a CorpGroup
ever?
const [selectedOwners, setSelectedOwners] = useState<SelectedOwner[]>( | ||
defaultValuesToSelectedOwners(defaultValues || []), | ||
); | ||
console.log({ selectedOwners }); |
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.
can remove this bad boy
console.log({ | ||
deselecting: 'deselecting', | ||
selectedValue, | ||
selectedOwners, | ||
}); |
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.
also can remove this one
); | ||
} | ||
|
||
if (filterField === 'container') { |
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.
could be done in a followup, but it might be nice to have an enum or constants for these different types of filterFields instead of just strings here
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.
ah i see you commented the same thing
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.
will do in the final pr 👍
<Button onClick={onCloseModal} type="text"> | ||
Cancel | ||
</Button> | ||
<Button disabled={stagedValue.length === 0} onClick={() => onOkOverride?.(stagedValue)}> |
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.
onOkOverride
makes it seem like there's a default onOk
method going on here but there's not. How would you feel about just calling the prop onOk
and making it required? I think you can do this with ContainerSelectModal
, SelectPlatformModal
, and EditTextModal
below as well
}: EditTagsModalProps) { | ||
console.log({ defaultValues }); |
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.
can remove
if (entity?.type === EntityType.Tag) { | ||
return ( | ||
<TagLabel | ||
name={(entity as Tag).properties?.name || (entity as Tag).name} |
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.
can you use entityRegistry.getDisplayName
here?
...ub-web-react/src/app/entity/shared/components/styled/search/action/GlossaryTermsDropdown.tsx
Show resolved
Hide resolved
...eb-react/src/app/entity/shared/containers/profile/sidebar/Container/ContainerSelectModal.tsx
Outdated
Show resolved
Hide resolved
); | ||
} | ||
|
||
if (filterField === 'container') { |
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.
ah i see you commented the same thing
This is a helper component that advanced search filters will use to select values.
Checklist