-
Notifications
You must be signed in to change notification settings - Fork 304
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
HPCC-30771 ECL Watch v9 WUs list filter allow multiple clusters #18536
HPCC-30771 ECL Watch v9 WUs list filter allow multiple clusters #18536
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-30771 Jirabot Action Result: |
if (multiSelect) { | ||
const items: IDropdownOption[] = []; | ||
if (selectedItems?.length > 0) { | ||
selectedItems.forEach(item => items.push(item)); |
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.
items = [...selectedItems]
?
item = selOptions?.find(row => row.key === selectedItem?.key) ?? selOptions[0]; | ||
if (multiSelect) { | ||
const items: IDropdownOption[] = []; | ||
if (selectedItems?.length > 0) { |
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 selectedItems be undefined?
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.
Is the if
needed?
} else { | ||
if (selectedKey === "") return; | ||
const keys = selectedKey.split("|"); | ||
if (keys.length > 0) { |
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.
Is the if
needed?
if (selectedKey === "") return; | ||
const keys = selectedKey.split("|"); | ||
if (keys.length > 0) { | ||
keys.forEach(key => items.push({ key: key, text: key })); |
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.
Minor: items = keys.map
?
} | ||
} else { | ||
setSelectedItems(items); | ||
} |
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.
Lines 127 -> 135 is equivalent to:
if (items.length && (!selectedItems.length || JSON.stringify(items.map(item => item.key)) !== JSON.stringify(selectedKey.split("|")))) {
setSelectedItems(items);
}
Is that correct (I am not understanding the !selectedItems.length
condition)?
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.
@jeclrsg bump?
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.
That wouldn't be right to coalesce, because the if condition should do nothing when the items array and selectedKey are the same. Similar to the non-multiselect version (#16904 (comment))
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 did have a !==
in there. But it was more for me to understand why the !selectedItem.length
was specialised - probably to do with initial load?
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.
That's right, it's for the initial loading of selectedItems from the url
if (multiSelect) { | ||
if (!selectedItems.length) return; | ||
if (selectedItems.length > 1) { | ||
if (JSON.stringify(selectedItems.map(item => item.key)) === JSON.stringify(selectedKey.split("|"))) return; |
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.
Minor: The following would be more efficient I suspect (same for above):
if (selectedItems.map(item => item.key).join("|") === selectedKey) return;
eb6dd51
to
d85412d
Compare
Changed our AsyncDropdown component to accept a "multiSelect" parameter (which is already built-in to the extended FluentUI Dropdown) Signed-off-by: Jeremy Clements <[email protected]>
d85412d
to
bab20ed
Compare
Changed our AsyncDropdown component to accept a "multiSelect" parameter (which is already built-in to the extended FluentUI Dropdown)
Type of change:
Checklist:
Smoketest:
Testing: