diff --git a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json index 4142b53c9..3db602ca4 100644 --- a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json +++ b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json @@ -39,7 +39,6 @@ "Clear all filters": "Clear all filters", "Click the update credentials button to save your changes, button is disabled until a change is detected.": "Click the update credentials button to save your changes, button is disabled until a change is detected.", "Close": "Close", - "Cluster": "Cluster", "Clusters": "Clusters", "Concerns": "Concerns", "Conditions": "Conditions", @@ -116,27 +115,17 @@ "Error: VDDK init image must be valid.": "Error: VDDK init image must be valid.", "Failed": "Failed", "False": "False", - "Filter by cluster": "Filter by cluster", "Filter by endpoint": "Filter by endpoint", - "Filter by flavor": "Filter by flavor", - "Filter by host": "Filter by host", - "Filter by image": "Filter by image", "Filter by name": "Filter by name", "Filter by namespace": "Filter by namespace", "Filter by network": "Filter by network", - "Filter by path": "Filter by path", - "Filter by status": "Filter by status", - "Filter by tenant": "Filter by tenant", - "Flavor": "Flavor", "From": "From", "Hide values": "Hide values", "Hooks for virtualization": "Hooks for virtualization", - "Host": "Host", "Host cluster": "Host cluster", "Hosts": "Hosts", "If true, the provider's REST API TLS certificate won't be validated.": "If true, the provider's REST API TLS certificate won't be validated.", "If true, the provider's TLS certificate won't be validated.": "If true, the provider's TLS certificate won't be validated.", - "Image": "Image", "Invalid application credential ID.": "Invalid application credential ID.", "Invalid application credential name.": "Invalid application credential name.", "Invalid application credential secret.": "Invalid application credential secret.", @@ -247,11 +236,9 @@ "OpenStack REST API user name.": "OpenStack REST API user name.", "Operator": "Operator", "Operator conditions define the current state of the controller": "Operator conditions define the current state of the controller", - "OvaPath": "OvaPath", "Overview": "Overview", "Owner": "Owner", "Password": "Password", - "Path": "Path", "Plans": "Plans", "Plans for virtualization": "Plans for virtualization", "Please choose a NetworkAttachmentDefinition for default data transfer.": "Please choose a NetworkAttachmentDefinition for default data transfer.", @@ -335,8 +322,6 @@ "Succeeded": "Succeeded", "Target and Source": "Target and Source", "Target provider": "Target provider", - "Template": "Template", - "Tenant": "Tenant", "The CA certificate is the /etc/pki/ovirt-engine/apache-ca.pem file on the Manager machine.": "The CA certificate is the /etc/pki/ovirt-engine/apache-ca.pem file on the Manager machine.", "The interval in minutes for precopy. Default value is 60.": "The interval in minutes for precopy. Default value is 60.", "The interval in seconds for snapshot pooling. Default value is 10.": "The interval in seconds for snapshot pooling. Default value is 10.", diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/ProviderDetailsPage.style.css b/packages/forklift-console-plugin/src/modules/Providers/views/details/ProviderDetailsPage.style.css index 8a4e20c62..32efaac34 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/ProviderDetailsPage.style.css +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/ProviderDetailsPage.style.css @@ -10,3 +10,7 @@ padding-bottom: var(--pf-global--spacer--lg); } +.forklift-page-provider-vm_concern-button { + padding: var(--pf-global--spacer--xs); +} + diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx index 13c579521..521212468 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx @@ -32,62 +32,6 @@ export const oVirtVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }), }, }, - { - resourceFieldId: 'cluster', - jsonPath: '$.vm.cluster', - label: t('Cluster'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by cluster'), - }, - sortable: true, - }, - { - resourceFieldId: 'host', - jsonPath: '$.vm.host', - label: t('Host'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by host'), - }, - sortable: true, - }, - { - resourceFieldId: 'path', - jsonPath: '$.vm.path', - label: t('Path'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by path'), - }, - sortable: true, - }, - { - resourceFieldId: 'status', - jsonPath: '$.vm.status', - label: t('Status'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by status'), - }, - sortable: true, - }, - { - resourceFieldId: 'description', - jsonPath: '$.vm.description', - label: t('Description'), - isVisible: true, - isIdentity: false, - sortable: false, - }, ]; export const OVirtVirtualMachinesList: React.FC = ({ diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx index 6fe4271a6..f5da3c9ae 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx @@ -32,78 +32,6 @@ export const openStackVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }), }, }, - { - resourceFieldId: 'hostID', - jsonPath: '$.vm.hostID', - label: t('Host'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by host'), - }, - sortable: true, - }, - { - resourceFieldId: 'path', - jsonPath: '$.vm.path', - label: t('Path'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by path'), - }, - sortable: true, - }, - { - resourceFieldId: 'status', - jsonPath: '$.vm.status', - label: t('Status'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by status'), - }, - sortable: true, - }, - { - resourceFieldId: 'tenantID', - jsonPath: '$.vm.tenantID', - label: t('Tenant'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by tenant'), - }, - sortable: true, - }, - { - resourceFieldId: 'imageID', - jsonPath: '$.vm.imageID', - label: t('Image'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by image'), - }, - sortable: true, - }, - { - resourceFieldId: 'flavorID', - jsonPath: '$.vm.flavorID', - label: t('Flavor'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by flavor'), - }, - sortable: true, - }, ]; export const OpenStackVirtualMachinesList: React.FC = ({ diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx index 2c9cdfbd9..065a106fb 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx @@ -32,18 +32,6 @@ export const ovaVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }), }, }, - { - resourceFieldId: 'ovaPath', - jsonPath: '$.vm.OvaPath', - label: t('OvaPath'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by path'), - }, - sortable: true, - }, ]; export const OvaVirtualMachinesList: React.FC = ({ diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx index 2413a605c..aca627a8a 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx @@ -32,50 +32,6 @@ export const vSphereVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }), }, }, - { - resourceFieldId: 'isTemplate', - jsonPath: '$.vm.isTemplate', - label: t('Template'), - isVisible: true, - isIdentity: false, - sortable: true, - }, - { - resourceFieldId: 'host', - jsonPath: '$.vm.host', - label: t('Host'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by host'), - }, - sortable: true, - }, - { - resourceFieldId: 'path', - jsonPath: '$.vm.path', - label: t('Path'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by path'), - }, - sortable: true, - }, - { - resourceFieldId: 'status', - jsonPath: '$.vm.powerState', - label: t('Status'), - isVisible: true, - isIdentity: false, - filter: { - type: 'freetext', - placeholderLabel: t('Filter by status'), - }, - sortable: true, - }, ]; export const VSphereVirtualMachinesList: React.FC = ({ diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMConcernsCellRenderer.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMConcernsCellRenderer.tsx index 457892503..4ffa45037 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMConcernsCellRenderer.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/VMConcernsCellRenderer.tsx @@ -1,41 +1,90 @@ import React from 'react'; import { TableCell } from 'src/modules/Providers/utils'; +import { Concern } from '@kubev2v/types'; import { BlueInfoCircleIcon, RedExclamationCircleIcon, YellowExclamationTriangleIcon, } from '@openshift-console/dynamic-plugin-sdk'; -import { Stack, StackItem } from '@patternfly/react-core'; +import { Button, Flex, FlexItem, Label, Popover, Stack, StackItem } from '@patternfly/react-core'; import { VMCellProps } from './VMCellProps'; -const statusIcons = { - Critical: , - Information: , - Warning: , -}; - -const categoryWeights = { - Critical: 1, - Warning: 2, - Information: 3, +type ConcernCategories = { + category: 'Critical' | 'Information' | 'Warning'; + label: string; }; export const VMConcernsCellRenderer: React.FC = ({ data }) => { + const groupedConcerns = groupConcernsByCategory(data?.vm?.concerns); + return ( - - {data?.vm?.concerns - ?.sort((a, b) => categoryWeights[a.category] - categoryWeights[b.category]) - ?.map((c) => { - return ( - - {statusIcons?.[c.category]} {c.label} - - ); - })} - + + {['Critical', 'Information', 'Warning'].map((category) => ( + + + + ))} + ); }; + +const groupConcernsByCategory = (concerns: Concern[]): Record => { + return ( + concerns?.reduce((acc, concern) => { + acc[concern.category] = (acc[concern.category] || []).concat(concern); + return acc; + }, {}) || {} + ); +}; + +const ConcernPopover: React.FC<{ + category: string; + concerns: ConcernCategories[]; +}> = ({ category, concerns }) => { + if (concerns.length < 1) return <>; + + return ( + {category} Concerns} + bodyContent={} + footerContent={`Total: ${concerns.length}`} + > + + + ); +}; + +const ConcernList: React.FC<{ concerns: ConcernCategories[] }> = ({ concerns }) => ( + + {concerns.map((c) => ( + + {statusIcons[c.category]} {c.label} + + ))} + +); + +const ConcernLabel: React.FC<{ category: string; count: number }> = ({ category, count }) => ( + +); + +const statusIcons = { + Critical: , + Information: , + Warning: , +}; + +const categoryColors = { + Critical: 'red', + Information: 'blue', + Warning: 'orange', +};