@openshift-assisted/ui-lib 2.9.14-cim → 2.9.16-cim

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/build/@types/cim/components/Agent/AgentStatus.d.ts.map +1 -1
  2. package/build/@types/cim/components/Agent/AgentTable.d.ts.map +1 -1
  3. package/build/@types/cim/components/Agent/AgentsSelectionTable.d.ts.map +1 -1
  4. package/build/@types/cim/components/Agent/tableUtils.d.ts +11 -6
  5. package/build/@types/cim/components/Agent/tableUtils.d.ts.map +1 -1
  6. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.d.ts.map +1 -1
  7. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.d.ts.map +1 -1
  8. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.d.ts.map +1 -1
  9. package/build/@types/cim/components/Hypershift/utils/status.d.ts.map +1 -1
  10. package/build/@types/cim/components/InfraEnv/InfraEnvAgentTable.d.ts.map +1 -1
  11. package/build/@types/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.d.ts.map +1 -1
  12. package/build/@types/cim/components/InfraEnv/InfraTableToolbar.d.ts.map +1 -1
  13. package/build/@types/cim/components/helpers/agentStatus.d.ts +3 -2
  14. package/build/@types/cim/components/helpers/agentStatus.d.ts.map +1 -1
  15. package/build/@types/cim/components/helpers/agents.d.ts.map +1 -1
  16. package/build/@types/cim/components/helpers/status.d.ts +5 -2
  17. package/build/@types/cim/components/helpers/status.d.ts.map +1 -1
  18. package/build/@types/cim/components/modals/MassApproveAgentModal.d.ts.map +1 -1
  19. package/build/@types/cim/components/modals/MassDeleteAgentModal.d.ts.map +1 -1
  20. package/build/@types/common/components/hosts/HostRowDetail.d.ts.map +1 -1
  21. package/build/@types/common/components/hosts/HostStatus.d.ts.map +1 -1
  22. package/build/@types/common/components/hosts/status.d.ts +2 -1
  23. package/build/@types/common/components/hosts/status.d.ts.map +1 -1
  24. package/build/@types/common/components/hosts/tableUtils.d.ts +1 -1
  25. package/build/@types/common/components/hosts/tableUtils.d.ts.map +1 -1
  26. package/build/@types/common/components/storage/StorageDetail.d.ts.map +1 -1
  27. package/build/@types/ocm/components/clusterDetail/HostInventoryExpandable.d.ts.map +1 -1
  28. package/build/@types/ocm/components/hosts/HardwareStatus.d.ts.map +1 -1
  29. package/build/@types/ocm/components/hosts/NetworkingStatus.d.ts.map +1 -1
  30. package/build/cjs/cim/components/Agent/AgentStatus.js +4 -3
  31. package/build/cjs/cim/components/Agent/AgentStatus.js.map +1 -1
  32. package/build/cjs/cim/components/Agent/AgentTable.js +4 -1
  33. package/build/cjs/cim/components/Agent/AgentTable.js.map +1 -1
  34. package/build/cjs/cim/components/Agent/AgentsSelectionTable.js +4 -0
  35. package/build/cjs/cim/components/Agent/AgentsSelectionTable.js.map +1 -1
  36. package/build/cjs/cim/components/Agent/tableUtils.js +36 -38
  37. package/build/cjs/cim/components/Agent/tableUtils.js.map +1 -1
  38. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.js +4 -1
  39. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.js.map +1 -1
  40. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js +19 -2
  41. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js.map +1 -1
  42. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.js +18 -3
  43. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.js.map +1 -1
  44. package/build/cjs/cim/components/Hypershift/utils/status.js +3 -1
  45. package/build/cjs/cim/components/Hypershift/utils/status.js.map +1 -1
  46. package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js +20 -7
  47. package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js.map +1 -1
  48. package/build/cjs/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.js +5 -2
  49. package/build/cjs/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.js.map +1 -1
  50. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js +12 -5
  51. package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js.map +1 -1
  52. package/build/cjs/cim/components/helpers/agentStatus.js +17 -15
  53. package/build/cjs/cim/components/helpers/agentStatus.js.map +1 -1
  54. package/build/cjs/cim/components/helpers/agents.js +2 -2
  55. package/build/cjs/cim/components/helpers/agents.js.map +1 -1
  56. package/build/cjs/cim/components/helpers/status.js +40 -22
  57. package/build/cjs/cim/components/helpers/status.js.map +1 -1
  58. package/build/cjs/cim/components/helpers/toAssisted.js +2 -2
  59. package/build/cjs/cim/components/helpers/toAssisted.js.map +1 -1
  60. package/build/cjs/cim/components/modals/MassApproveAgentModal.js +8 -5
  61. package/build/cjs/cim/components/modals/MassApproveAgentModal.js.map +1 -1
  62. package/build/cjs/cim/components/modals/MassDeleteAgentModal.js +40 -33
  63. package/build/cjs/cim/components/modals/MassDeleteAgentModal.js.map +1 -1
  64. package/build/cjs/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.js +1 -1
  65. package/build/cjs/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.js.map +1 -1
  66. package/build/cjs/common/components/hosts/HostRowDetail.js +14 -14
  67. package/build/cjs/common/components/hosts/HostRowDetail.js.map +1 -1
  68. package/build/cjs/common/components/hosts/HostStatus.js +2 -1
  69. package/build/cjs/common/components/hosts/HostStatus.js.map +1 -1
  70. package/build/cjs/common/components/hosts/status.js +54 -53
  71. package/build/cjs/common/components/hosts/status.js.map +1 -1
  72. package/build/cjs/common/components/hosts/tableUtils.js +3 -3
  73. package/build/cjs/common/components/hosts/tableUtils.js.map +1 -1
  74. package/build/cjs/common/components/storage/DisksTable.js +8 -8
  75. package/build/cjs/common/components/storage/DisksTable.js.map +1 -1
  76. package/build/cjs/common/components/storage/StorageDetail.js +3 -1
  77. package/build/cjs/common/components/storage/StorageDetail.js.map +1 -1
  78. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.js +1 -1
  79. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.js.map +1 -1
  80. package/build/cjs/ocm/components/clusterDetail/HostInventoryExpandable.js +3 -1
  81. package/build/cjs/ocm/components/clusterDetail/HostInventoryExpandable.js.map +1 -1
  82. package/build/cjs/ocm/components/hosts/HardwareStatus.js +3 -1
  83. package/build/cjs/ocm/components/hosts/HardwareStatus.js.map +1 -1
  84. package/build/cjs/ocm/components/hosts/NetworkingStatus.js +3 -1
  85. package/build/cjs/ocm/components/hosts/NetworkingStatus.js.map +1 -1
  86. package/lib/cim/components/Agent/AgentStatus.tsx +4 -3
  87. package/lib/cim/components/Agent/AgentTable.tsx +4 -1
  88. package/lib/cim/components/Agent/AgentsSelectionTable.tsx +4 -0
  89. package/lib/cim/components/Agent/tableUtils.tsx +71 -37
  90. package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.tsx +4 -1
  91. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.tsx +21 -2
  92. package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.tsx +18 -3
  93. package/lib/cim/components/Hypershift/utils/status.tsx +3 -1
  94. package/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx +20 -7
  95. package/lib/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.tsx +5 -2
  96. package/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +16 -6
  97. package/lib/cim/components/helpers/agentStatus.tsx +17 -16
  98. package/lib/cim/components/helpers/agents.ts +3 -4
  99. package/lib/cim/components/helpers/status.ts +44 -24
  100. package/lib/cim/components/helpers/toAssisted.ts +3 -3
  101. package/lib/cim/components/modals/MassApproveAgentModal.tsx +13 -5
  102. package/lib/cim/components/modals/MassDeleteAgentModal.tsx +63 -56
  103. package/lib/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.tsx +3 -3
  104. package/lib/common/components/hosts/HostRowDetail.tsx +20 -17
  105. package/lib/common/components/hosts/HostStatus.tsx +3 -1
  106. package/lib/common/components/hosts/status.tsx +227 -212
  107. package/lib/common/components/hosts/tableUtils.tsx +3 -3
  108. package/lib/common/components/storage/DisksTable.tsx +8 -8
  109. package/lib/common/components/storage/StorageDetail.tsx +4 -1
  110. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.tsx +1 -1
  111. package/lib/ocm/components/clusterDetail/HostInventoryExpandable.tsx +3 -1
  112. package/lib/ocm/components/hosts/HardwareStatus.tsx +3 -1
  113. package/lib/ocm/components/hosts/NetworkingStatus.tsx +3 -1
  114. package/package.json +3 -3
@@ -26,6 +26,7 @@ import { usePagination } from '../../../common/components/hosts/usePagination';
26
26
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
27
27
  import { TFunction } from 'i18next';
28
28
  import { Host } from '@openshift-assisted/types/assisted-installer-service';
29
+ import { agentStatus, bmhStatus } from '../helpers/agentStatus';
29
30
 
30
31
  const hostnameColumn = (agents: AgentK8sResource[], t: TFunction): TableRow<Host> => {
31
32
  return {
@@ -56,65 +57,71 @@ const statusColumn = (
56
57
  agents: AgentK8sResource[],
57
58
  bmhs: BareMetalHostK8sResource[],
58
59
  t: TFunction,
59
- ): TableRow<Host> => ({
60
- header: {
61
- title: t('ai:Status'),
62
- props: {
63
- id: 'col-header-status',
60
+ ): TableRow<Host> => {
61
+ const agentStatuses = agentStatus(t);
62
+ const bmhStatuses = bmhStatus(t);
63
+ return {
64
+ header: {
65
+ title: t('ai:Status'),
66
+ props: {
67
+ id: 'col-header-status',
68
+ },
69
+ transforms: [sortable],
64
70
  },
65
- transforms: [sortable],
66
- },
67
- cell: (host) => {
68
- const agent = agents.find((a) => a.metadata?.uid === host.id);
69
- const clusterName = agent?.spec.clusterDeploymentName?.name;
70
- const bmh = bmhs?.find((b) => b.metadata?.uid === host.id);
71
+ cell: (host) => {
72
+ const agent = agents.find((a) => a.metadata?.uid === host.id);
73
+ const clusterName = agent?.spec.clusterDeploymentName?.name;
74
+ const bmh = bmhs?.find((b) => b.metadata?.uid === host.id);
71
75
 
72
- let bmhStatus;
73
- let title: React.ReactNode = '--';
74
- if (agent) {
75
- title = clusterName ? (
76
- <Flex>
77
- <FlexItem>
78
- <AgentStatus agent={agent} zIndex={7000} />
79
- </FlexItem>
80
- <FlexItem align={{ default: 'alignRight' }}>
81
- <Popover
82
- aria-label={t('ai:Cluster popover')}
83
- headerContent={<div>{t('ai:Cannot be deleted')}</div>}
84
- bodyContent={
85
- <div>
86
- {t(
87
- 'ai:Hosts that are bound to a cluster cannot be deleted. Remove the host from the cluster and try again.',
88
- )}
89
- </div>
90
- }
91
- footerContent={
92
- <Link to={`/multicloud/infrastructure/clusters/details/${clusterName}/`}>
93
- {t('ai:Go to cluster {{clusterName}}', { clusterName })}
94
- </Link>
95
- }
96
- >
97
- <Button variant="link" icon={<InfoCircleIcon color={blueInfoColor.value} />}>
98
- {t('ai:Cannot be deleted')}
99
- </Button>
100
- </Popover>
101
- </FlexItem>
102
- </Flex>
103
- ) : (
104
- <AgentStatus agent={agent} />
105
- );
106
- } else if (bmh) {
107
- bmhStatus = getBMHStatus(bmh);
108
- title = <BMHStatus bmhStatus={bmhStatus} />;
109
- }
76
+ let bmhStatus;
77
+ let title: React.ReactNode = '--';
78
+ if (agent) {
79
+ title = clusterName ? (
80
+ <Flex>
81
+ <FlexItem>
82
+ <AgentStatus agent={agent} zIndex={7000} />
83
+ </FlexItem>
84
+ <FlexItem align={{ default: 'alignRight' }}>
85
+ <Popover
86
+ aria-label={t('ai:Cluster popover')}
87
+ headerContent={<div>{t('ai:Cannot be deleted')}</div>}
88
+ bodyContent={
89
+ <div>
90
+ {t(
91
+ 'ai:Hosts that are bound to a cluster cannot be deleted. Remove the host from the cluster and try again.',
92
+ )}
93
+ </div>
94
+ }
95
+ footerContent={
96
+ <Link to={`/multicloud/infrastructure/clusters/details/${clusterName}/`}>
97
+ {t('ai:Go to cluster {{clusterName}}', { clusterName })}
98
+ </Link>
99
+ }
100
+ >
101
+ <Button variant="link" icon={<InfoCircleIcon color={blueInfoColor.value} />}>
102
+ {t('ai:Cannot be deleted')}
103
+ </Button>
104
+ </Popover>
105
+ </FlexItem>
106
+ </Flex>
107
+ ) : (
108
+ <AgentStatus agent={agent} />
109
+ );
110
+ } else if (bmh) {
111
+ bmhStatus = getBMHStatus(bmh, bmhStatuses);
112
+ title = <BMHStatus bmhStatus={bmhStatus} />;
113
+ }
110
114
 
111
- return {
112
- title,
113
- props: { 'data-testid': 'host-status' },
114
- sortableValue: agent ? getAgentStatus(agent).status.title : bmhStatus?.state.title || '',
115
- };
116
- },
117
- });
115
+ return {
116
+ title,
117
+ props: { 'data-testid': 'host-status' },
118
+ sortableValue: agent
119
+ ? getAgentStatus(agent, agentStatuses).status.title
120
+ : bmhStatus?.state.title || '',
121
+ };
122
+ },
123
+ };
124
+ };
118
125
 
119
126
  const tableContent = (
120
127
  agents: AgentK8sResource[],
@@ -51,9 +51,9 @@ export const ManagedNetworkingControlGroup = ({
51
51
  <>
52
52
  <span>{t('ai:User-Managed Networking')}</span>{' '}
53
53
  <PopoverIcon
54
- bodyContent={
55
- "With User-Managed Networking, you'll need to provide and configure a load balancer for the API and ingress endpoints."
56
- }
54
+ bodyContent={t(
55
+ "ai:With User-Managed Networking, you'll need to provide and configure a load balancer for the API and ingress endpoints.",
56
+ )}
57
57
  />
58
58
  </>
59
59
  }
@@ -24,6 +24,7 @@ import SectionTitle from '../ui/SectionTitle';
24
24
  import { OnDiskRoleType } from './DiskRole';
25
25
  import StorageDetail from '../storage/StorageDetail';
26
26
  import { stringToJSON } from '../../utils';
27
+ import { TFunction } from 'i18next';
27
28
 
28
29
  type HostDetailProps = {
29
30
  host: Host;
@@ -53,12 +54,12 @@ const SectionColumn: React.FC<SectionColumnProps> = ({ children }) => (
53
54
  </GridItem>
54
55
  );
55
56
 
56
- const nicsColumns = [
57
- { title: 'Name' },
58
- { title: 'MAC address' },
59
- { title: 'IPv4 address' },
60
- { title: 'IPv6 address' },
61
- { title: 'Speed' },
57
+ const nicsColumns = (t: TFunction) => [
58
+ { title: t('ai:Name') },
59
+ { title: t('ai:MAC address') },
60
+ { title: t('ai:IPv4 address') },
61
+ { title: t('ai:IPv6 address') },
62
+ { title: t('ai:Speed') },
62
63
  // { title: 'Vendor' }, TODO(mlibra): search HW database for humanized values
63
64
  // { title: 'Product' },
64
65
  ];
@@ -71,6 +72,7 @@ const NICsTableRowWrapper = (props: RowWrapperProps) => (
71
72
  );
72
73
 
73
74
  const NicsTable: React.FC<NicsTableProps & WithTestID> = ({ interfaces, testId }) => {
75
+ const { t } = useTranslation();
74
76
  const rows: IRow[] = interfaces
75
77
  .sort((nicA, nicB) => nicA.name?.localeCompare(nicB.name || '') || 0)
76
78
  .map((nic) => ({
@@ -92,12 +94,12 @@ const NicsTable: React.FC<NicsTableProps & WithTestID> = ({ interfaces, testId }
92
94
  ],
93
95
  key: nic.name,
94
96
  }));
95
- const { t } = useTranslation();
97
+
96
98
  return (
97
99
  <Table
98
100
  data-testid={testId}
99
101
  rows={rows}
100
- cells={nicsColumns}
102
+ cells={nicsColumns(t)}
101
103
  variant={TableVariant.compact}
102
104
  aria-label={t("ai:Host's network interfaces table")}
103
105
  borders={false}
@@ -148,9 +150,9 @@ export const HostDetail = ({
148
150
 
149
151
  return (
150
152
  <Grid hasGutter>
151
- <SectionTitle testId={'host-details-section'} title="Host details" />
153
+ <SectionTitle testId={'host-details-section'} title={t('ai:Host details')} />
152
154
  <SectionColumn>
153
- <DetailItem testId={'uuid'} title="UUID" value={id} />
155
+ <DetailItem testId={'uuid'} title={t('ai:UUID')} value={id} />
154
156
  <DetailItem
155
157
  testId={'manufacturer'}
156
158
  title={t('ai:Manufacturer')}
@@ -161,7 +163,11 @@ export const HostDetail = ({
161
163
  title={t('ai:Product')}
162
164
  value={inventory.systemVendor?.productName || DASH}
163
165
  />
164
- <DetailItem testId={'serial-number'} title="Serial number" value={rowInfo.serialNumber} />
166
+ <DetailItem
167
+ testId={'serial-number'}
168
+ title={t('ai:Serial number')}
169
+ value={rowInfo.serialNumber}
170
+ />
165
171
  </SectionColumn>
166
172
  <SectionColumn>
167
173
  <DetailItem
@@ -186,8 +192,8 @@ export const HostDetail = ({
186
192
  />
187
193
  </SectionColumn>
188
194
  <SectionColumn>
189
- <DetailItem testId={'hw-type'} title="Hardware type" value={hardwareType} />
190
- <DetailItem testId={'bmc-address'} title="BMC address" value={bmcAddress} />
195
+ <DetailItem testId={'hw-type'} title={t('ai:Hardware type')} value={hardwareType} />
196
+ <DetailItem testId={'bmc-address'} title={t('ai:BMC address')} value={bmcAddress} />
191
197
  <DetailItem
192
198
  testId={'boot-mode'}
193
199
  title={t('ai:Boot mode')}
@@ -215,10 +221,7 @@ export const HostDetail = ({
215
221
  updateDiskSkipFormatting={updateDiskSkipFormatting}
216
222
  />
217
223
  )}
218
- <SectionTitle
219
- testId={'nics-section'}
220
- title={`${nics.length} NIC${nics.length === 1 ? '' : 's'}`}
221
- />
224
+ <SectionTitle testId={'nics-section'} title={t('ai:NIC', { count: nics.length })} />
222
225
  <GridItem>
223
226
  <NicsTable interfaces={nics} testId={'nics-table'} />
224
227
  </GridItem>
@@ -230,6 +230,8 @@ const HostStatus: React.FC<HostStatusProps> = ({
230
230
  onEditHostname?.();
231
231
  }, [keepOnOutsideClick, onEditHostname]);
232
232
 
233
+ const { t } = useTranslation();
234
+
233
235
  const { title, icon, sublabel, details, noPopover } = status;
234
236
  const titleWithProgress = getTitleWithProgress(host, status);
235
237
  const popoverProps: WithHostStatusPopoverProps = {
@@ -251,7 +253,7 @@ const HostStatus: React.FC<HostStatusProps> = ({
251
253
  {
252
254
  <FlexItem>
253
255
  {(autoCSR && status.key === 'added-to-existing-cluster'
254
- ? hostStatus.installed.icon
256
+ ? hostStatus(t).installed.icon
255
257
  : icon) || <UnknownIcon />}
256
258
  </FlexItem>
257
259
  }