-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VMware - filter VMs by available dynamiclly enum list of hosts
Reference: #1274 This includes the following changes for the VMware provider VMs list: 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. Enable selecting any number of hosts from the enum filter list. If none, all VMs are filtered. 3. Enable to type-ahead input for displaying a subset of the enum filter list of hosts. Signed-off-by: Sharon Gratch <sgratch@redhat.com>
- Loading branch information
Showing
4 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/filters/hostFilter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { EnumValue } from '@kubev2v/common'; | ||
|
||
/** | ||
* This component enables filtering the VMware's virtual machines | ||
* by the hostname that they are running on. | ||
*/ | ||
export const hostFilter = (t: (string) => string) => { | ||
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 })), | ||
], | ||
}), | ||
}; | ||
}; |
1 change: 1 addition & 0 deletions
1
...le-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/filters/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @index(['./*', /style/g], f => `export * from '${f.path}';`) | ||
export * from './concernFilter'; | ||
export * from './hostFilter'; | ||
// @endindex |