-
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.
Merge pull request #1298 from sgratch/ovirt-filter-vms-by-available-d…
…ynamic-enum-host-list oVirt - filter VMs by available dynamic enum list of hosts
- Loading branch information
Showing
5 changed files
with
33 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'; | ||
|
||
const labelToFilterItem = (label: string): EnumValue => | ||
label !== '' ? { id: label, label } : { id: label, label: 'Undefined' }; | ||
|
||
/** | ||
* 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(labelToFilterItem), | ||
], | ||
}), | ||
}; | ||
}; |
7 changes: 5 additions & 2 deletions
7
...rtualMachines/utils/filters/hostFilter.ts → ...chines/utils/filters/VsphereHostFilter.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
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 |