forked from kubev2v/forklift-console-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oVirt - filter VMs by available dynamic enum list of hosts
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]>
- Loading branch information
Showing
5 changed files
with
34 additions
and
10 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
22 changes: 22 additions & 0 deletions
22
...src/modules/Providers/views/details/tabs/VirtualMachines/utils/filters/OvirtHostFilter.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,22 @@ | ||
import { EnumValue } from '@kubev2v/common'; | ||
|
||
/** | ||
* This component enables filtering the oVirt virtual machines | ||
* by the hostname that they are running on. | ||
*/ | ||
export const OvirtHostFiler = (t: (string) => string) => { | ||
return { | ||
type: 'host', | ||
primary: true, | ||
placeholderLabel: t('Host'), | ||
dynamicFilter: (items: { vm: { host: string } }[]) => ({ | ||
values: [ | ||
...Array.from(new Set(items.map((item) => item.vm.host))) // at this point the list contains unique strings that can be used as ID | ||
.map( | ||
(label: string): EnumValue => | ||
label !== '' ? { id: label, label } : { id: label, label: 'Undefined' }, | ||
), | ||
], | ||
}), | ||
}; | ||
}; |
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
3 changes: 2 additions & 1 deletion
3
...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,4 +1,5 @@ | ||
// @index(['./*', /style/g], f => `export * from '${f.path}';`) | ||
export * from './concernFilter'; | ||
export * from './hostFilter'; | ||
export * from './OvirtHostFilter'; | ||
export * from './VsphereHostFilter'; | ||
// @endindex |