Skip to content
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

oVirt - filter VMs by available dynamic enum list of hosts #1298

Conversation

sgratch
Copy link
Collaborator

@sgratch sgratch commented Jul 30, 2024

Reference: #1275

This includes the following changes for the oVirt provider VMs list only:

  1. Set the 'Host' filter to be a primary filter.
  2. Display a dynamic list of hosts that the VMs run on as an enum filter to select.
  3. All VMs that are not assigned to any host, will be filtered out by the "Undefined" option.
  4. Enable selecting any number of hosts from the enum filter list. If none, all VMs are filtered.
  5. Enable to type-ahead input for displaying a subset of the enum filter list of hosts.

Before:

Screenshot from 2024-07-31 00-25-26


After:

Screenshot from 2024-07-31 00-51-45



Screenshot from 2024-07-31 00-29-53

@sgratch sgratch requested a review from yaacov July 30, 2024 21:52
return {
type: 'host',
primary: true,
placeholderLabel: t('Host'),
dynamicFilter: (items: { hostName: string }[]) => ({
values: [
...Array.from(new Set(items.map((item) => item.hostName))) // at this point the list contains unique strings that can be used as ID
.map((label: string): EnumValue => ({ id: label, label })),
//.map((label: string): EnumValue => ({ id: label, label })),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to remove the commented code ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry.

Comment on lines 16 to 19
.map(
(label: string): EnumValue =>
label !== '' ? { id: label, label } : { id: label, label: 'Undefined' },
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map(
(label: string): EnumValue =>
label !== '' ? { id: label, label } : { id: label, label: 'Undefined' },
),
.map(labelToFilterItem),
/* ...
 */
const labelToFilterItem = (label: string): EnumValue =>  label !== '' ? { id: label, label } : { id: label, label: 'Undefined' }

Reference: kubev2v#1275

This includes the following changes for the oVirt provider VMs list only:

 1. Set the 'Host' filter to be a primary filter.
 2. Display a dynamic list of hosts that the VMs run on as an enum filter to select.
 3. All VMs that are not assigned to any host, will be filtered out by
    the "Undefined" option.
 4. Enable selecting any number of hosts from the enum filter list. If none, all VMs are filtered.
 5. Enable to type-ahead input for displaying a subset of the enum filter list of hosts.

Signed-off-by: Sharon Gratch <[email protected]>
@sgratch sgratch force-pushed the ovirt-filter-vms-by-available-dynamic-enum-host-list branch from 025fac6 to 092aa5e Compare July 31, 2024 08:27
Copy link

@sgratch sgratch requested a review from yaacov July 31, 2024 08:40
@yaacov yaacov merged commit 730f53c into kubev2v:main Jul 31, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants