From 67c80069ab0cb44302d7abbf21be07ae6b6263bc Mon Sep 17 00:00:00 2001 From: yzamir Date: Thu, 11 Apr 2024 10:57:15 +0300 Subject: [PATCH] Be excplicit about hosd id vs name Signed-off-by: yzamir --- .../locales/en/plugin__forklift-console-plugin.json | 2 ++ .../views/details/tabs/Hosts/VSphereHostsList.tsx | 11 +++++++++++ .../views/details/tabs/Hosts/VSphereHostsRow.tsx | 2 ++ .../details/tabs/Hosts/components/IDCellRenderer.tsx | 9 +++++++++ .../views/details/tabs/Hosts/components/index.ts | 1 + .../VirtualMachines/VSphereVirtualMachinesList.tsx | 4 ++-- 6 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/IDCellRenderer.tsx 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 11df1476f..810d0ee8f 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 @@ -154,6 +154,7 @@ "Filter by features": "Filter by features", "Filter by flavor": "Filter by flavor", "Filter by host": "Filter by host", + "Filter by host ID": "Filter by host ID", "Filter by image": "Filter by image", "Filter by name": "Filter by name", "Filter by namespace": "Filter by namespace", @@ -174,6 +175,7 @@ "Hooks for virtualization": "Hooks for virtualization", "Host": "Host", "Host cluster": "Host cluster", + "Host ID": "Host ID", "Hosts": "Hosts", "How to create a migration plan": "How to create a migration plan", "I trust the authenticity of this certificate": "I trust the authenticity of this certificate", diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsList.tsx index 10853a09e..17cae72b8 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsList.tsx @@ -29,6 +29,17 @@ export const hostsFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, sortable: true, }, + { + resourceFieldId: 'id', + jsonPath: '$.inventory.id', + label: t('Host ID'), + isVisible: true, + filter: { + type: 'freetext', + placeholderLabel: t('Filter by host ID'), + }, + sortable: true, + }, { resourceFieldId: 'network', jsonPath: '$.networkAdapter.name', diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsRow.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsRow.tsx index 6e990994f..313252f7e 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsRow.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/VSphereHostsRow.tsx @@ -7,6 +7,7 @@ import { NameCellRenderer } from './components/NameCellRenderer'; import { InventoryHostPair } from './utils/helpers'; import { HostCellProps, + IDCellRenderer, LinkSpeedCellRenderer, MTUCellRenderer, NetworkCellRenderer, @@ -50,6 +51,7 @@ const renderTd = ({ resourceData, resourceFieldId, resourceFields }: RenderTdPro const cellRenderers: Record> = { name: NameCellRenderer, + id: IDCellRenderer, network: NetworkCellRenderer, linkSpeed: LinkSpeedCellRenderer, mtu: MTUCellRenderer, diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/IDCellRenderer.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/IDCellRenderer.tsx new file mode 100644 index 000000000..509556a03 --- /dev/null +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/IDCellRenderer.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { TableCell } from 'src/modules/Providers/utils'; + +import { HostCellProps } from './HostCellProps'; + +// Define cell renderer for 'host id' +export const IDCellRenderer: React.FC = (props) => { + return {props?.data?.inventory.id}; +}; diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/index.ts b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/index.ts index bd9835409..2f1a8ddd6 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/index.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/Hosts/components/index.ts @@ -1,5 +1,6 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) export * from './HostCellProps'; +export * from './IDCellRenderer'; export * from './LinkSpeedCellRenderer'; export * from './MTUCellRenderer'; export * from './NameCellRenderer'; 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 d02820313..cc36ef786 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 @@ -40,12 +40,12 @@ export const vSphereVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ { resourceFieldId: 'host', jsonPath: '$.vm.host', - label: t('Host'), + label: t('Host ID'), isVisible: true, isIdentity: false, filter: { type: 'freetext', - placeholderLabel: t('Filter by host'), + placeholderLabel: t('Filter by host ID'), }, sortable: true, },