@openshift-assisted/ui-lib 2.9.14-cim → 2.9.15-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.
- package/build/@types/cim/components/Agent/AgentStatus.d.ts.map +1 -1
- package/build/@types/cim/components/Agent/AgentTable.d.ts.map +1 -1
- package/build/@types/cim/components/Agent/AgentsSelectionTable.d.ts.map +1 -1
- package/build/@types/cim/components/Agent/tableUtils.d.ts +11 -6
- package/build/@types/cim/components/Agent/tableUtils.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/utils/status.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/InfraEnvAgentTable.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/InfraTableToolbar.d.ts.map +1 -1
- package/build/@types/cim/components/helpers/agentStatus.d.ts +3 -2
- package/build/@types/cim/components/helpers/agentStatus.d.ts.map +1 -1
- package/build/@types/cim/components/helpers/agents.d.ts.map +1 -1
- package/build/@types/cim/components/helpers/status.d.ts +5 -2
- package/build/@types/cim/components/helpers/status.d.ts.map +1 -1
- package/build/@types/cim/components/modals/MassApproveAgentModal.d.ts.map +1 -1
- package/build/@types/cim/components/modals/MassDeleteAgentModal.d.ts.map +1 -1
- package/build/@types/common/components/hosts/HostRowDetail.d.ts.map +1 -1
- package/build/@types/common/components/hosts/HostStatus.d.ts.map +1 -1
- package/build/@types/common/components/hosts/status.d.ts +2 -1
- package/build/@types/common/components/hosts/status.d.ts.map +1 -1
- package/build/@types/common/components/hosts/tableUtils.d.ts +1 -1
- package/build/@types/common/components/hosts/tableUtils.d.ts.map +1 -1
- package/build/@types/common/components/storage/StorageDetail.d.ts.map +1 -1
- package/build/@types/ocm/components/clusterDetail/HostInventoryExpandable.d.ts.map +1 -1
- package/build/@types/ocm/components/hosts/HardwareStatus.d.ts.map +1 -1
- package/build/@types/ocm/components/hosts/NetworkingStatus.d.ts.map +1 -1
- package/build/cjs/cim/components/Agent/AgentStatus.js +4 -3
- package/build/cjs/cim/components/Agent/AgentStatus.js.map +1 -1
- package/build/cjs/cim/components/Agent/AgentTable.js +4 -1
- package/build/cjs/cim/components/Agent/AgentTable.js.map +1 -1
- package/build/cjs/cim/components/Agent/AgentsSelectionTable.js +4 -0
- package/build/cjs/cim/components/Agent/AgentsSelectionTable.js.map +1 -1
- package/build/cjs/cim/components/Agent/tableUtils.js +35 -37
- package/build/cjs/cim/components/Agent/tableUtils.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.js +4 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js +19 -2
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.js +18 -3
- package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/utils/status.js +3 -1
- package/build/cjs/cim/components/Hypershift/utils/status.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js +20 -7
- package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.js +5 -2
- package/build/cjs/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js +17 -10
- package/build/cjs/cim/components/InfraEnv/InfraTableToolbar.js.map +1 -1
- package/build/cjs/cim/components/helpers/agentStatus.js +17 -15
- package/build/cjs/cim/components/helpers/agentStatus.js.map +1 -1
- package/build/cjs/cim/components/helpers/agents.js +2 -2
- package/build/cjs/cim/components/helpers/agents.js.map +1 -1
- package/build/cjs/cim/components/helpers/status.js +40 -22
- package/build/cjs/cim/components/helpers/status.js.map +1 -1
- package/build/cjs/cim/components/helpers/toAssisted.js +2 -2
- package/build/cjs/cim/components/helpers/toAssisted.js.map +1 -1
- package/build/cjs/cim/components/modals/MassApproveAgentModal.js +8 -5
- package/build/cjs/cim/components/modals/MassApproveAgentModal.js.map +1 -1
- package/build/cjs/cim/components/modals/MassDeleteAgentModal.js +40 -33
- package/build/cjs/cim/components/modals/MassDeleteAgentModal.js.map +1 -1
- package/build/cjs/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.js +1 -1
- package/build/cjs/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.js.map +1 -1
- package/build/cjs/common/components/hosts/HostRowDetail.js +14 -14
- package/build/cjs/common/components/hosts/HostRowDetail.js.map +1 -1
- package/build/cjs/common/components/hosts/HostStatus.js +2 -1
- package/build/cjs/common/components/hosts/HostStatus.js.map +1 -1
- package/build/cjs/common/components/hosts/status.js +54 -53
- package/build/cjs/common/components/hosts/status.js.map +1 -1
- package/build/cjs/common/components/hosts/tableUtils.js +3 -3
- package/build/cjs/common/components/hosts/tableUtils.js.map +1 -1
- package/build/cjs/common/components/storage/DisksTable.js +8 -8
- package/build/cjs/common/components/storage/DisksTable.js.map +1 -1
- package/build/cjs/common/components/storage/StorageDetail.js +3 -1
- package/build/cjs/common/components/storage/StorageDetail.js.map +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.js +1 -1
- package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.js.map +1 -1
- package/build/cjs/ocm/components/clusterDetail/HostInventoryExpandable.js +3 -1
- package/build/cjs/ocm/components/clusterDetail/HostInventoryExpandable.js.map +1 -1
- package/build/cjs/ocm/components/hosts/HardwareStatus.js +3 -1
- package/build/cjs/ocm/components/hosts/HardwareStatus.js.map +1 -1
- package/build/cjs/ocm/components/hosts/NetworkingStatus.js +3 -1
- package/build/cjs/ocm/components/hosts/NetworkingStatus.js.map +1 -1
- package/lib/cim/components/Agent/AgentStatus.tsx +4 -3
- package/lib/cim/components/Agent/AgentTable.tsx +4 -1
- package/lib/cim/components/Agent/AgentsSelectionTable.tsx +4 -0
- package/lib/cim/components/Agent/tableUtils.tsx +70 -36
- package/lib/cim/components/ClusterDeployment/ClusterDeploymentDetailsTable.tsx +4 -1
- package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostDiscoveryTable.tsx +21 -2
- package/lib/cim/components/ClusterDeployment/ClusterDeploymentHostsNetworkTable.tsx +18 -3
- package/lib/cim/components/Hypershift/utils/status.tsx +3 -1
- package/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx +20 -7
- package/lib/cim/components/InfraEnv/InfraEnvHostsTabAgentsWarning.tsx +5 -2
- package/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +21 -11
- package/lib/cim/components/helpers/agentStatus.tsx +17 -16
- package/lib/cim/components/helpers/agents.ts +3 -4
- package/lib/cim/components/helpers/status.ts +44 -24
- package/lib/cim/components/helpers/toAssisted.ts +3 -3
- package/lib/cim/components/modals/MassApproveAgentModal.tsx +13 -5
- package/lib/cim/components/modals/MassDeleteAgentModal.tsx +63 -56
- package/lib/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.tsx +3 -3
- package/lib/common/components/hosts/HostRowDetail.tsx +20 -17
- package/lib/common/components/hosts/HostStatus.tsx +3 -1
- package/lib/common/components/hosts/status.tsx +227 -212
- package/lib/common/components/hosts/tableUtils.tsx +3 -3
- package/lib/common/components/storage/DisksTable.tsx +8 -8
- package/lib/common/components/storage/StorageDetail.tsx +4 -1
- package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationTableBase.tsx +1 -1
- package/lib/ocm/components/clusterDetail/HostInventoryExpandable.tsx +3 -1
- package/lib/ocm/components/hosts/HardwareStatus.tsx +3 -1
- package/lib/ocm/components/hosts/NetworkingStatus.tsx +3 -1
- package/package.json +3 -3
|
@@ -16,17 +16,24 @@ import { AgentTableActions, ClusterDeploymentWizardStepsType } from '../ClusterD
|
|
|
16
16
|
import { hostActionResolver } from '../../../common/components/hosts/tableUtils';
|
|
17
17
|
import { getAgentClusterInstallOfAgent, getAIHosts, getInfraEnvNameOfAgent } from '../helpers';
|
|
18
18
|
import { isInstallationInProgress } from '../ClusterDeployment/helpers';
|
|
19
|
-
import { AGENT_BMH_NAME_LABEL_KEY } from '../common';
|
|
19
|
+
import { AGENT_BMH_NAME_LABEL_KEY, INFRAENV_GENERATED_AI_FLOW } from '../common';
|
|
20
20
|
import { BareMetalHostK8sResource } from '../../types/k8s/bare-metal-host';
|
|
21
21
|
import BMHStatus from './BMHStatus';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
getAgentStatus,
|
|
24
|
+
getAgentStatusKey,
|
|
25
|
+
getBMHStatus,
|
|
26
|
+
getBMHStatusKey,
|
|
27
|
+
getWizardStepAgentStatus,
|
|
28
|
+
} from '../helpers/status';
|
|
23
29
|
import { filterByHostname } from '../../../common/components/hosts/utils';
|
|
24
|
-
import { agentStatus
|
|
30
|
+
import { agentStatus } from '../helpers/agentStatus';
|
|
25
31
|
import noop from 'lodash-es/noop.js';
|
|
26
32
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
27
33
|
import { TFunction } from 'i18next';
|
|
28
34
|
import { AgentMachineK8sResource } from '../Hypershift/types';
|
|
29
35
|
import { Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
36
|
+
import { HostStatus } from '../../../common/components/hosts/types';
|
|
30
37
|
|
|
31
38
|
export const agentHostnameColumn = (
|
|
32
39
|
t: TFunction,
|
|
@@ -117,7 +124,9 @@ export const discoveryTypeColumn = (
|
|
|
117
124
|
|
|
118
125
|
type AgentStatusColumnProps = {
|
|
119
126
|
agents: AgentK8sResource[];
|
|
127
|
+
agentStatuses: HostStatus<string>;
|
|
120
128
|
bareMetalHosts?: BareMetalHostK8sResource[];
|
|
129
|
+
bmhStatuses?: HostStatus<string>;
|
|
121
130
|
onEditHostname?: AgentTableActions['onEditHost'];
|
|
122
131
|
onApprove?: AgentTableActions['onApprove'];
|
|
123
132
|
wizardStepId?: ClusterDeploymentWizardStepsType;
|
|
@@ -127,7 +136,9 @@ type AgentStatusColumnProps = {
|
|
|
127
136
|
|
|
128
137
|
export const agentStatusColumn = ({
|
|
129
138
|
agents,
|
|
139
|
+
agentStatuses,
|
|
130
140
|
bareMetalHosts,
|
|
141
|
+
bmhStatuses,
|
|
131
142
|
onEditHostname,
|
|
132
143
|
onApprove,
|
|
133
144
|
wizardStepId,
|
|
@@ -158,8 +169,8 @@ export const agentStatusColumn = ({
|
|
|
158
169
|
isDay2={isDay2}
|
|
159
170
|
/>
|
|
160
171
|
);
|
|
161
|
-
} else if (bmh) {
|
|
162
|
-
bmhStatus = getBMHStatus(bmh);
|
|
172
|
+
} else if (bmh && bmhStatuses) {
|
|
173
|
+
bmhStatus = getBMHStatus(bmh, bmhStatuses);
|
|
163
174
|
title = <BMHStatus bmhStatus={bmhStatus} />;
|
|
164
175
|
}
|
|
165
176
|
|
|
@@ -169,7 +180,7 @@ export const agentStatusColumn = ({
|
|
|
169
180
|
sortableValue: agent
|
|
170
181
|
? wizardStepId
|
|
171
182
|
? getWizardStepAgentStatus(agent, wizardStepId, t).status.title
|
|
172
|
-
: getAgentStatus(agent).status.title
|
|
183
|
+
: getAgentStatus(agent, agentStatuses).status.title
|
|
173
184
|
: bmhStatus?.state.title || '',
|
|
174
185
|
};
|
|
175
186
|
},
|
|
@@ -254,11 +265,7 @@ export const infraEnvColumn = (agents: AgentK8sResource[], t: TFunction): TableR
|
|
|
254
265
|
};
|
|
255
266
|
|
|
256
267
|
export const canEditBMH = (bmh: BareMetalHostK8sResource, t: TFunction): ActionCheck => {
|
|
257
|
-
const canEdit = [
|
|
258
|
-
bmhStatus.deprovisioning.key,
|
|
259
|
-
bmhStatus.pending.key,
|
|
260
|
-
bmhStatus.registering.key,
|
|
261
|
-
].includes(getBMHStatus(bmh).state.key);
|
|
268
|
+
const canEdit = ['deprovisioning', 'pending', 'registering'].includes(getBMHStatusKey(bmh) || '');
|
|
262
269
|
|
|
263
270
|
return [
|
|
264
271
|
canEdit,
|
|
@@ -270,8 +277,12 @@ export const canEditBMH = (bmh: BareMetalHostK8sResource, t: TFunction): ActionC
|
|
|
270
277
|
];
|
|
271
278
|
};
|
|
272
279
|
|
|
273
|
-
export const canEditAgent = (
|
|
274
|
-
|
|
280
|
+
export const canEditAgent = (
|
|
281
|
+
agent: AgentK8sResource,
|
|
282
|
+
agentStatuses: HostStatus<string>,
|
|
283
|
+
t: TFunction,
|
|
284
|
+
): ActionCheck => {
|
|
285
|
+
const enabled = getAgentStatus(agent, agentStatuses).status.category !== 'Installation related';
|
|
275
286
|
return [
|
|
276
287
|
enabled,
|
|
277
288
|
enabled
|
|
@@ -283,13 +294,14 @@ export const canEditAgent = (agent: AgentK8sResource, t: TFunction): ActionCheck
|
|
|
283
294
|
export const canChangeHostname =
|
|
284
295
|
(
|
|
285
296
|
agents: AgentK8sResource[],
|
|
297
|
+
agentStatuses: HostStatus<string>,
|
|
286
298
|
bareMetalHosts: BareMetalHostK8sResource[],
|
|
287
299
|
t: TFunction,
|
|
288
300
|
): ((h: Host) => ActionCheck) =>
|
|
289
301
|
(h: Host) => {
|
|
290
302
|
const agent = agents.find((a) => a.metadata?.uid === h.id);
|
|
291
303
|
if (agent) {
|
|
292
|
-
return canEditAgent(agent, t);
|
|
304
|
+
return canEditAgent(agent, agentStatuses, t);
|
|
293
305
|
}
|
|
294
306
|
const bmh = bareMetalHosts.find((bmh) => bmh.metadata?.uid === h.id);
|
|
295
307
|
if (bmh) {
|
|
@@ -302,13 +314,12 @@ export const canUnbindAgent = (
|
|
|
302
314
|
agentClusterInstalls: AgentClusterInstallK8sResource[] | undefined,
|
|
303
315
|
agent: AgentK8sResource,
|
|
304
316
|
t: TFunction,
|
|
305
|
-
infraEnv?: InfraEnvK8sResource,
|
|
306
317
|
): ActionCheck => {
|
|
307
318
|
if (!agent?.spec.clusterDeploymentName?.name) {
|
|
308
319
|
return [false, t('ai:The agent is not bound to a cluster.')];
|
|
309
320
|
}
|
|
310
321
|
|
|
311
|
-
const
|
|
322
|
+
const statusKey = getAgentStatusKey(agent);
|
|
312
323
|
if (
|
|
313
324
|
[
|
|
314
325
|
'preparing-for-installation',
|
|
@@ -316,13 +327,13 @@ export const canUnbindAgent = (
|
|
|
316
327
|
'installing-in-progress',
|
|
317
328
|
'installing-pending-user-action',
|
|
318
329
|
'resetting-pending-user-action',
|
|
319
|
-
].includes(
|
|
330
|
+
].includes(statusKey)
|
|
320
331
|
) {
|
|
321
332
|
return [false, t('ai:It is not possible to remove a host which is being installed.')];
|
|
322
333
|
}
|
|
323
334
|
|
|
324
335
|
if (
|
|
325
|
-
['installed', 'error', 'cancelled'].includes(
|
|
336
|
+
['installed', 'error', 'cancelled'].includes(statusKey) &&
|
|
326
337
|
(agent.status?.role === 'master' || agent.status?.role === 'bootstrap')
|
|
327
338
|
) {
|
|
328
339
|
return [
|
|
@@ -346,7 +357,8 @@ export const canUnbindAgent = (
|
|
|
346
357
|
|
|
347
358
|
if (
|
|
348
359
|
!agent.metadata?.labels?.hasOwnProperty(AGENT_BMH_NAME_LABEL_KEY) &&
|
|
349
|
-
|
|
360
|
+
agent.metadata?.labels?.hasOwnProperty(INFRAENV_GENERATED_AI_FLOW) &&
|
|
361
|
+
!!agent.spec.clusterDeploymentName
|
|
350
362
|
) {
|
|
351
363
|
return [false, t('ai:It is not possible to remove this node from the cluster.')];
|
|
352
364
|
}
|
|
@@ -354,8 +366,12 @@ export const canUnbindAgent = (
|
|
|
354
366
|
return [true, undefined];
|
|
355
367
|
};
|
|
356
368
|
|
|
357
|
-
const canDeleteAgent = (
|
|
358
|
-
|
|
369
|
+
const canDeleteAgent = (
|
|
370
|
+
agent: AgentK8sResource,
|
|
371
|
+
agentStatuses: HostStatus<string>,
|
|
372
|
+
t: TFunction,
|
|
373
|
+
): ActionCheck => {
|
|
374
|
+
const enabled = getAgentStatus(agent, agentStatuses).status.category !== 'Installation related';
|
|
359
375
|
|
|
360
376
|
return [
|
|
361
377
|
enabled,
|
|
@@ -386,6 +402,7 @@ export const useAgentsTable = (
|
|
|
386
402
|
onSetInstallationDiskId,
|
|
387
403
|
} = tableActions || {};
|
|
388
404
|
const { t } = useTranslation();
|
|
405
|
+
const agentStatuses = agentStatus(t);
|
|
389
406
|
const [hosts, actions] = React.useMemo(
|
|
390
407
|
(): [Host[], HostsTableActions] => [
|
|
391
408
|
getAIHosts(agents, bmhs, infraEnv),
|
|
@@ -408,7 +425,7 @@ export const useAgentsTable = (
|
|
|
408
425
|
if (!agent) {
|
|
409
426
|
return false;
|
|
410
427
|
}
|
|
411
|
-
return canEditAgent(agent, t);
|
|
428
|
+
return canEditAgent(agent, agentStatuses, t);
|
|
412
429
|
},
|
|
413
430
|
onDeleteHost: onDeleteHost
|
|
414
431
|
? (host: Host) => {
|
|
@@ -422,7 +439,7 @@ export const useAgentsTable = (
|
|
|
422
439
|
const bmh = bmhs?.find((a) => a.metadata?.uid === host.id);
|
|
423
440
|
|
|
424
441
|
if (agent) {
|
|
425
|
-
return canDeleteAgent(agent, t);
|
|
442
|
+
return canDeleteAgent(agent, agentStatuses, t);
|
|
426
443
|
} else if (bmh) {
|
|
427
444
|
return [true, undefined];
|
|
428
445
|
}
|
|
@@ -476,7 +493,7 @@ export const useAgentsTable = (
|
|
|
476
493
|
const agent = agents.find((a) => a.metadata?.uid === host.id);
|
|
477
494
|
|
|
478
495
|
if (agent) {
|
|
479
|
-
return canUnbindAgent(agentClusterInstalls, agent, t
|
|
496
|
+
return canUnbindAgent(agentClusterInstalls, agent, t);
|
|
480
497
|
}
|
|
481
498
|
const bmh = bmhs?.find((bmh) => bmh.metadata?.uid === host.id);
|
|
482
499
|
if (bmh) {
|
|
@@ -488,6 +505,7 @@ export const useAgentsTable = (
|
|
|
488
505
|
],
|
|
489
506
|
[
|
|
490
507
|
agents,
|
|
508
|
+
t,
|
|
491
509
|
bmhs,
|
|
492
510
|
infraEnv,
|
|
493
511
|
onEditHost,
|
|
@@ -497,7 +515,7 @@ export const useAgentsTable = (
|
|
|
497
515
|
onSelect,
|
|
498
516
|
onEditBMH,
|
|
499
517
|
onUnbindHost,
|
|
500
|
-
|
|
518
|
+
agentStatuses,
|
|
501
519
|
agentClusterInstalls,
|
|
502
520
|
],
|
|
503
521
|
);
|
|
@@ -508,14 +526,15 @@ export const useAgentsTable = (
|
|
|
508
526
|
const filterByStatus = (
|
|
509
527
|
hosts: Host[],
|
|
510
528
|
agents: AgentK8sResource[],
|
|
529
|
+
agentStatuses: HostStatus<string>,
|
|
511
530
|
bareMetalHosts: BareMetalHostK8sResource[],
|
|
512
531
|
statusFilter: string[],
|
|
513
532
|
) => {
|
|
514
533
|
if (!statusFilter?.length) {
|
|
515
534
|
return hosts;
|
|
516
535
|
}
|
|
517
|
-
const statusKeys = Object.keys(
|
|
518
|
-
statusFilter.includes(
|
|
536
|
+
const statusKeys = Object.keys(agentStatuses).filter((k) =>
|
|
537
|
+
statusFilter.includes(agentStatuses[k].title),
|
|
519
538
|
);
|
|
520
539
|
return hosts.filter((h) => {
|
|
521
540
|
const agent = agents.find((a) => a.metadata?.uid === h.id);
|
|
@@ -524,10 +543,9 @@ const filterByStatus = (
|
|
|
524
543
|
if (!bmh) {
|
|
525
544
|
return false;
|
|
526
545
|
}
|
|
527
|
-
|
|
528
|
-
return statusKeys.includes(bmhStatus.state.key);
|
|
546
|
+
return statusKeys.includes(getBMHStatusKey(bmh) || '');
|
|
529
547
|
}
|
|
530
|
-
const { status } = getAgentStatus(agent);
|
|
548
|
+
const { status } = getAgentStatus(agent, agentStatuses);
|
|
531
549
|
return statusKeys.includes(status.key);
|
|
532
550
|
});
|
|
533
551
|
};
|
|
@@ -535,44 +553,60 @@ const filterByStatus = (
|
|
|
535
553
|
export const filterHosts = (
|
|
536
554
|
hosts: Host[],
|
|
537
555
|
agents: AgentK8sResource[],
|
|
556
|
+
agentStatuses: HostStatus<string>,
|
|
538
557
|
bareMetalHosts: BareMetalHostK8sResource[],
|
|
539
558
|
hostnameFilter: string | undefined,
|
|
540
559
|
statusFilter: string[],
|
|
541
560
|
) => {
|
|
542
561
|
const byHostname = filterByHostname(hosts, hostnameFilter);
|
|
543
|
-
const byStatus = filterByStatus(byHostname, agents, bareMetalHosts, statusFilter);
|
|
562
|
+
const byStatus = filterByStatus(byHostname, agents, agentStatuses, bareMetalHosts, statusFilter);
|
|
544
563
|
|
|
545
564
|
return byStatus;
|
|
546
565
|
};
|
|
547
566
|
|
|
548
567
|
type UseAgentsFilterArgs = {
|
|
549
568
|
agents: AgentK8sResource[];
|
|
569
|
+
agentStatuses: HostStatus<string>;
|
|
550
570
|
bmhs: BareMetalHostK8sResource[];
|
|
571
|
+
bmhStatuses: HostStatus<string>;
|
|
551
572
|
hosts: Host[];
|
|
552
573
|
};
|
|
553
574
|
|
|
554
575
|
export type StatusCount = Record<string, number>;
|
|
555
576
|
|
|
556
|
-
export const useAgentsFilter = ({
|
|
577
|
+
export const useAgentsFilter = ({
|
|
578
|
+
agents,
|
|
579
|
+
agentStatuses,
|
|
580
|
+
bmhs,
|
|
581
|
+
bmhStatuses,
|
|
582
|
+
hosts,
|
|
583
|
+
}: UseAgentsFilterArgs) => {
|
|
557
584
|
const [hostnameFilter, setHostnameFilter] = React.useState<string>();
|
|
558
585
|
const [statusFilter, setStatusFilter] = React.useState<string[]>([]);
|
|
559
586
|
const statusCount = Object.keys(agentStatus).reduce((acc, curr) => {
|
|
560
|
-
acc[
|
|
587
|
+
acc[agentStatuses[curr].title] = 0;
|
|
561
588
|
return acc;
|
|
562
589
|
}, {} as StatusCount);
|
|
563
590
|
hosts.forEach((host) => {
|
|
564
591
|
const agent = agents.find((a) => a.metadata?.uid === host.id);
|
|
565
592
|
const bmh = bmhs.find((bmh) => bmh.metadata?.uid === host.id);
|
|
566
593
|
if (agent) {
|
|
567
|
-
const { status } = getAgentStatus(agent);
|
|
594
|
+
const { status } = getAgentStatus(agent, agentStatuses);
|
|
568
595
|
statusCount[status.title]++;
|
|
569
596
|
} else if (bmh) {
|
|
570
|
-
const { state } = getBMHStatus(bmh);
|
|
597
|
+
const { state } = getBMHStatus(bmh, bmhStatuses);
|
|
571
598
|
statusCount[state.title]++;
|
|
572
599
|
}
|
|
573
600
|
});
|
|
574
601
|
|
|
575
|
-
const filteredHosts = filterHosts(
|
|
602
|
+
const filteredHosts = filterHosts(
|
|
603
|
+
hosts,
|
|
604
|
+
agents,
|
|
605
|
+
agentStatuses,
|
|
606
|
+
bmhs,
|
|
607
|
+
hostnameFilter,
|
|
608
|
+
statusFilter,
|
|
609
|
+
);
|
|
576
610
|
|
|
577
611
|
return {
|
|
578
612
|
statusCount,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import HostsTable, { DefaultExpandComponent } from '../../../common/components/hosts/HostsTable';
|
|
14
14
|
import { usePagination } from '../../../common/components/hosts/usePagination';
|
|
15
15
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
16
|
+
import { agentStatus } from '../helpers/agentStatus';
|
|
16
17
|
|
|
17
18
|
export const getAgentId = (agent: AgentK8sResource) => agent.metadata?.uid as string;
|
|
18
19
|
|
|
@@ -39,12 +40,14 @@ const ClusterDeploymentDetailsTable: React.FC<ClusterDeploymentDetailsTableProps
|
|
|
39
40
|
const agentClusterInstalls = React.useMemo(() => [agentClusterInstall], [agentClusterInstall]);
|
|
40
41
|
const [hosts, , actionResolver] = useAgentsTable({ agents, agentClusterInstalls });
|
|
41
42
|
const { t } = useTranslation();
|
|
43
|
+
const agentStatuses = agentStatus(t);
|
|
42
44
|
const content = React.useMemo(
|
|
43
45
|
() => [
|
|
44
46
|
hostnameColumn(t),
|
|
45
47
|
roleColumn(t),
|
|
46
48
|
agentStatusColumn({
|
|
47
49
|
agents,
|
|
50
|
+
agentStatuses,
|
|
48
51
|
t,
|
|
49
52
|
}),
|
|
50
53
|
infraEnvColumn(agents, t),
|
|
@@ -52,7 +55,7 @@ const ClusterDeploymentDetailsTable: React.FC<ClusterDeploymentDetailsTableProps
|
|
|
52
55
|
memoryColumn(t),
|
|
53
56
|
disksColumn(t),
|
|
54
57
|
],
|
|
55
|
-
[agents, t],
|
|
58
|
+
[agentStatuses, agents, t],
|
|
56
59
|
);
|
|
57
60
|
|
|
58
61
|
const paginationProps = usePagination(agents.length);
|
|
@@ -34,6 +34,7 @@ import { usePagination } from '../../../common/components/hosts/usePagination';
|
|
|
34
34
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
35
35
|
import { ExpandComponent } from '../Agent/AgentsSelectionTable';
|
|
36
36
|
import { HostsTableDetailContextProvider } from '../../../common/components/hosts/HostsTableDetailContext';
|
|
37
|
+
import { agentStatus, bmhStatus } from '../helpers/agentStatus';
|
|
37
38
|
|
|
38
39
|
const ClusterDeploymentHostDiscoveryTable: React.FC<ClusterDeploymentHostDiscoveryTableProps> = ({
|
|
39
40
|
agents,
|
|
@@ -53,7 +54,11 @@ const ClusterDeploymentHostDiscoveryTable: React.FC<ClusterDeploymentHostDiscove
|
|
|
53
54
|
const [isMassChangeHostOpen, setMassChangeHostOpen] = React.useState(false);
|
|
54
55
|
const [isMassApproveOpen, setMassApproveOpen] = React.useState(false);
|
|
55
56
|
const [selectedHostIDs, setSelectedHostIDs] = React.useState<string[]>([]);
|
|
57
|
+
|
|
56
58
|
const { t } = useTranslation();
|
|
59
|
+
const agentStatuses = agentStatus(t);
|
|
60
|
+
const bmhStatuses = bmhStatus(t);
|
|
61
|
+
|
|
57
62
|
const onSelect = (host: Host, isSelected: boolean) => {
|
|
58
63
|
if (isSelected) {
|
|
59
64
|
setSelectedHostIDs([...selectedHostIDs, host.id]);
|
|
@@ -79,7 +84,9 @@ const ClusterDeploymentHostDiscoveryTable: React.FC<ClusterDeploymentHostDiscove
|
|
|
79
84
|
...(addAll ? [discoveryTypeColumn(agents, bareMetalHosts, t)] : []),
|
|
80
85
|
agentStatusColumn({
|
|
81
86
|
agents,
|
|
87
|
+
agentStatuses,
|
|
82
88
|
bareMetalHosts,
|
|
89
|
+
bmhStatuses,
|
|
83
90
|
onEditHostname: onEditHost,
|
|
84
91
|
onApprove,
|
|
85
92
|
wizardStepId: 'hosts-discovery',
|
|
@@ -90,7 +97,19 @@ const ClusterDeploymentHostDiscoveryTable: React.FC<ClusterDeploymentHostDiscove
|
|
|
90
97
|
? [discoveredAtColumn(t), cpuCoresColumn(t), memoryColumn(t), disksColumn(t)]
|
|
91
98
|
: []),
|
|
92
99
|
],
|
|
93
|
-
[
|
|
100
|
+
[
|
|
101
|
+
t,
|
|
102
|
+
hostActions.onEditHost,
|
|
103
|
+
hostActions.canEditRole,
|
|
104
|
+
hostActions.onEditRole,
|
|
105
|
+
addAll,
|
|
106
|
+
agents,
|
|
107
|
+
bareMetalHosts,
|
|
108
|
+
agentStatuses,
|
|
109
|
+
bmhStatuses,
|
|
110
|
+
onEditHost,
|
|
111
|
+
onApprove,
|
|
112
|
+
],
|
|
94
113
|
);
|
|
95
114
|
|
|
96
115
|
const selectedAgents = agents.filter((a) => selectedHostIDs.includes(a.metadata?.uid || ''));
|
|
@@ -168,7 +187,7 @@ const ClusterDeploymentHostDiscoveryTable: React.FC<ClusterDeploymentHostDiscove
|
|
|
168
187
|
selectedHostIDs={selectedHostIDs}
|
|
169
188
|
onChangeHostname={onAgentChangeHostname}
|
|
170
189
|
onClose={() => setMassChangeHostOpen(false)}
|
|
171
|
-
canChangeHostname={canChangeHostname(agents, bareMetalHosts, t)}
|
|
190
|
+
canChangeHostname={canChangeHostname(agents, agentStatuses, bareMetalHosts, t)}
|
|
172
191
|
/>
|
|
173
192
|
)}
|
|
174
193
|
{isMassApproveOpen && (
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import { usePagination } from '../../../common/components/hosts/usePagination';
|
|
21
21
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
22
22
|
import { Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
23
|
+
import { agentStatus } from '../helpers/agentStatus';
|
|
23
24
|
|
|
24
25
|
type ExpandComponentContextType = {
|
|
25
26
|
onSetInstallationDiskId?: ClusterDeploymentHostsNetworkTableProps['onSetInstallationDiskId'];
|
|
@@ -79,6 +80,7 @@ const ClusterDeploymentHostsNetworkTable: React.FC<ClusterDeploymentHostsNetwork
|
|
|
79
80
|
onSetInstallationDiskId,
|
|
80
81
|
}) => {
|
|
81
82
|
const { t } = useTranslation();
|
|
83
|
+
const agentStatuses = agentStatus(t);
|
|
82
84
|
const cluster = React.useMemo(
|
|
83
85
|
() => getAICluster({ clusterDeployment, agentClusterInstall, agents }),
|
|
84
86
|
[clusterDeployment, agentClusterInstall, agents],
|
|
@@ -100,24 +102,37 @@ const ClusterDeploymentHostsNetworkTable: React.FC<ClusterDeploymentHostsNetwork
|
|
|
100
102
|
hostnameColumn(t, hostActions.onEditHost, hosts),
|
|
101
103
|
agentStatusColumn({
|
|
102
104
|
agents,
|
|
105
|
+
agentStatuses,
|
|
103
106
|
onEditHostname: onEditHost,
|
|
104
107
|
wizardStepId: 'networking',
|
|
105
108
|
t,
|
|
106
109
|
}),
|
|
107
|
-
activeNICColumn(cluster),
|
|
110
|
+
activeNICColumn(cluster, t),
|
|
108
111
|
]
|
|
109
112
|
: [
|
|
110
113
|
hostnameColumn(t, hostActions.onEditHost, hosts),
|
|
111
114
|
roleColumn(t, hostActions.canEditRole, hostActions.onEditRole),
|
|
112
115
|
agentStatusColumn({
|
|
113
116
|
agents,
|
|
117
|
+
agentStatuses,
|
|
114
118
|
onEditHostname: onEditHost,
|
|
115
119
|
wizardStepId: 'networking',
|
|
116
120
|
t,
|
|
117
121
|
}),
|
|
118
|
-
activeNICColumn(cluster),
|
|
122
|
+
activeNICColumn(cluster, t),
|
|
119
123
|
],
|
|
120
|
-
[
|
|
124
|
+
[
|
|
125
|
+
isSNOCluster,
|
|
126
|
+
t,
|
|
127
|
+
hostActions.onEditHost,
|
|
128
|
+
hostActions.canEditRole,
|
|
129
|
+
hostActions.onEditRole,
|
|
130
|
+
hosts,
|
|
131
|
+
agents,
|
|
132
|
+
agentStatuses,
|
|
133
|
+
onEditHost,
|
|
134
|
+
cluster,
|
|
135
|
+
],
|
|
121
136
|
);
|
|
122
137
|
|
|
123
138
|
const paginationProps = usePagination(hosts.length);
|
|
@@ -9,6 +9,7 @@ import { AgentK8sResource } from '../../../types';
|
|
|
9
9
|
import { getAgentStatus } from '../../helpers';
|
|
10
10
|
import { NodePoolK8sResource } from '../types';
|
|
11
11
|
import { TFunction } from 'i18next';
|
|
12
|
+
import { agentStatus } from '../../helpers/agentStatus';
|
|
12
13
|
|
|
13
14
|
export type NodePoolStatus = {
|
|
14
15
|
type: 'error' | 'pending' | 'ok' | 'warning';
|
|
@@ -31,7 +32,8 @@ export const getNodePoolStatus = (
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
+
const allAgentStatuses = agentStatus(t);
|
|
36
|
+
const agentStatuses = agents.map((a) => getAgentStatus(a, allAgentStatuses));
|
|
35
37
|
|
|
36
38
|
const hasErrorAgents = agentStatuses.some(({ status }) => status.key === 'error');
|
|
37
39
|
|
|
@@ -37,6 +37,7 @@ import MassApproveAction from '../modals/MassApproveAction';
|
|
|
37
37
|
import { usePagination } from '../../../common/components/hosts/usePagination';
|
|
38
38
|
import InfraTableToolbar from './InfraTableToolbar';
|
|
39
39
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
40
|
+
import { agentStatus, bmhStatus } from '../helpers/agentStatus';
|
|
40
41
|
|
|
41
42
|
type NoFilterMatchStateProps = {
|
|
42
43
|
onClearFilters: VoidFunction;
|
|
@@ -107,6 +108,8 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
107
108
|
},
|
|
108
109
|
);
|
|
109
110
|
const { t } = useTranslation();
|
|
111
|
+
const agentStatuses = agentStatus(t);
|
|
112
|
+
const bmhStatuses = bmhStatus(t);
|
|
110
113
|
const {
|
|
111
114
|
statusCount,
|
|
112
115
|
hostnameFilter,
|
|
@@ -114,7 +117,13 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
114
117
|
setStatusFilter,
|
|
115
118
|
statusFilter,
|
|
116
119
|
filteredHosts: hosts,
|
|
117
|
-
} = useAgentsFilter({
|
|
120
|
+
} = useAgentsFilter({
|
|
121
|
+
agents,
|
|
122
|
+
agentStatuses,
|
|
123
|
+
bmhs: bareMetalHosts,
|
|
124
|
+
bmhStatuses,
|
|
125
|
+
hosts: allHosts,
|
|
126
|
+
});
|
|
118
127
|
|
|
119
128
|
const content = React.useMemo(
|
|
120
129
|
() =>
|
|
@@ -131,6 +140,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
131
140
|
discoveryTypeColumn(agents, bareMetalHosts, t),
|
|
132
141
|
agentStatusColumn({
|
|
133
142
|
agents,
|
|
143
|
+
agentStatuses,
|
|
134
144
|
bareMetalHosts,
|
|
135
145
|
onEditHostname: onEditHost,
|
|
136
146
|
onApprove: onApprove,
|
|
@@ -143,15 +153,18 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
143
153
|
disksColumn(t),
|
|
144
154
|
].filter(Boolean),
|
|
145
155
|
[
|
|
156
|
+
t,
|
|
146
157
|
hosts,
|
|
147
158
|
agents,
|
|
148
|
-
|
|
159
|
+
bareMetalHosts,
|
|
160
|
+
hostActions.onEditHost,
|
|
161
|
+
hostActions.canEditHostname,
|
|
162
|
+
hostActions.canEditBMH,
|
|
163
|
+
agentStatuses,
|
|
149
164
|
onEditHost,
|
|
150
165
|
onApprove,
|
|
166
|
+
agentMachines,
|
|
151
167
|
getClusterDeploymentLink,
|
|
152
|
-
hostActions,
|
|
153
|
-
bareMetalHosts,
|
|
154
|
-
t,
|
|
155
168
|
],
|
|
156
169
|
);
|
|
157
170
|
|
|
@@ -162,7 +175,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
162
175
|
|
|
163
176
|
const canEditHostname =
|
|
164
177
|
selectedBMHs.some((bmh) => canEditBMH(bmh, t)[0]) ||
|
|
165
|
-
selectedAgents.some((a) => canEditAgent(a, t)[0]);
|
|
178
|
+
selectedAgents.some((a) => canEditAgent(a, agentStatuses, t)[0]);
|
|
166
179
|
|
|
167
180
|
const massActions = [
|
|
168
181
|
<DropdownItem
|
|
@@ -252,7 +265,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
252
265
|
selectedHostIDs={selectedHostIDs}
|
|
253
266
|
onChangeHostname={onAgentChangeHostname}
|
|
254
267
|
onClose={() => setMassChangeHostOpen(false)}
|
|
255
|
-
canChangeHostname={canChangeHostname(agents, bareMetalHosts, t)}
|
|
268
|
+
canChangeHostname={canChangeHostname(agents, agentStatuses, bareMetalHosts, t)}
|
|
256
269
|
/>
|
|
257
270
|
)}
|
|
258
271
|
{isMassDeleteOpen && (
|
|
@@ -6,6 +6,7 @@ import { AgentK8sResource, BareMetalHostK8sResource } from '../../types';
|
|
|
6
6
|
import { AGENT_BMH_NAME_LABEL_KEY } from '../common';
|
|
7
7
|
import { Tooltip } from '@patternfly/react-core';
|
|
8
8
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
9
|
+
import { agentStatus, bmhStatus } from '../helpers/agentStatus';
|
|
9
10
|
|
|
10
11
|
export type InfraEnvHostsTabAgentsWarning = {
|
|
11
12
|
infraAgents: AgentK8sResource[];
|
|
@@ -26,9 +27,11 @@ const InfraEnvHostsTabAgentsWarning: React.FC<InfraEnvHostsTabAgentsWarning> = (
|
|
|
26
27
|
const bmhsWithoutAgents = infraBMHs.filter((bmh) =>
|
|
27
28
|
agentsBMHNames.includes(bmh.metadata?.name || ''),
|
|
28
29
|
);
|
|
30
|
+
const agentStatuses = agentStatus(t);
|
|
31
|
+
const bmhStatuses = bmhStatus(t);
|
|
29
32
|
|
|
30
|
-
const agentStates = infraAgents.map((agent) => getAgentStatus(agent, true).status);
|
|
31
|
-
const bmhStates = bmhsWithoutAgents.map((bmh) => getBMHStatus(bmh).state);
|
|
33
|
+
const agentStates = infraAgents.map((agent) => getAgentStatus(agent, agentStatuses, true).status);
|
|
34
|
+
const bmhStates = bmhsWithoutAgents.map((bmh) => getBMHStatus(bmh, bmhStatuses).state);
|
|
32
35
|
|
|
33
36
|
const hostStates = [...agentStates, ...bmhStates];
|
|
34
37
|
|
|
@@ -14,15 +14,16 @@ import {
|
|
|
14
14
|
} from '@patternfly/react-core';
|
|
15
15
|
import { FilterIcon } from '@patternfly/react-icons';
|
|
16
16
|
import * as React from 'react';
|
|
17
|
-
import { HostStatus } from '../../../common/components/hosts/types';
|
|
17
|
+
import { HostStatus, HostStatusDef } from '../../../common/components/hosts/types';
|
|
18
18
|
import { agentStatus } from '../helpers/agentStatus';
|
|
19
19
|
import { TableToolbar } from '../../../common';
|
|
20
20
|
import { usePagination } from '../../../common/components/hosts/usePagination';
|
|
21
21
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
22
22
|
import { StatusCount } from '../Agent/tableUtils';
|
|
23
23
|
import { Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
24
|
+
import { TFunction } from 'i18next';
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const getStatusesForFilter = (statuses: HostStatus<string>) => {
|
|
26
27
|
const filterStatuses: {
|
|
27
28
|
[category: string]: {
|
|
28
29
|
[label: string]: string[];
|
|
@@ -34,19 +35,19 @@ const getStatusesForFiler = (statuses: HostStatus<string>) => {
|
|
|
34
35
|
);
|
|
35
36
|
|
|
36
37
|
sortedStatuses.forEach((status) => {
|
|
37
|
-
const { category,
|
|
38
|
+
const { category, key } = statuses[status];
|
|
38
39
|
if (filterStatuses[category]) {
|
|
39
|
-
if (filterStatuses[category][
|
|
40
|
-
filterStatuses[category][
|
|
40
|
+
if (filterStatuses[category][key]) {
|
|
41
|
+
filterStatuses[category][key].push(status);
|
|
41
42
|
} else {
|
|
42
43
|
filterStatuses[category] = {
|
|
43
44
|
...filterStatuses[category],
|
|
44
|
-
[
|
|
45
|
+
[key]: [status],
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
} else {
|
|
48
49
|
filterStatuses[category] = {
|
|
49
|
-
[
|
|
50
|
+
[key]: [status],
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
});
|
|
@@ -54,6 +55,12 @@ const getStatusesForFiler = (statuses: HostStatus<string>) => {
|
|
|
54
55
|
return filterStatuses;
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
const getCategoryLabels = (t: TFunction): { [k in HostStatusDef['category']]: string } => ({
|
|
59
|
+
'Installation related': t('ai:Installation related'),
|
|
60
|
+
'Discovery related': t('ai:Discovery related'),
|
|
61
|
+
'Bare Metal Host related': t('ai:Bare Metal Host related'),
|
|
62
|
+
});
|
|
63
|
+
|
|
57
64
|
type InfraTableToolbarProps = ReturnType<typeof usePagination> & {
|
|
58
65
|
setSelectedHostIDs: (items: string[]) => void;
|
|
59
66
|
massActions: React.ReactNode[];
|
|
@@ -78,10 +85,13 @@ const InfraTableToolbar: React.FC<InfraTableToolbarProps> = ({
|
|
|
78
85
|
selectedHostIDs,
|
|
79
86
|
...paginationProps
|
|
80
87
|
}) => {
|
|
81
|
-
const [statusFilterOpen, setStatusFilterOpen] = React.useState(false);
|
|
82
|
-
const filterStatuses = React.useMemo(() => getStatusesForFiler(agentStatus), []);
|
|
83
88
|
const { t } = useTranslation();
|
|
89
|
+
const agentStatuses = agentStatus(t);
|
|
90
|
+
const [statusFilterOpen, setStatusFilterOpen] = React.useState(false);
|
|
84
91
|
const itemIDs = React.useMemo(() => hosts.map((h) => h.id), [hosts]);
|
|
92
|
+
const filterStatuses = React.useMemo(() => getStatusesForFilter(agentStatuses), [agentStatuses]);
|
|
93
|
+
const categoryLabels = getCategoryLabels(t);
|
|
94
|
+
|
|
85
95
|
return (
|
|
86
96
|
<TableToolbar
|
|
87
97
|
selectedIDs={selectedHostIDs || []}
|
|
@@ -104,7 +114,7 @@ const InfraTableToolbar: React.FC<InfraTableToolbarProps> = ({
|
|
|
104
114
|
<ToolbarItem>
|
|
105
115
|
<ToolbarFilter
|
|
106
116
|
chips={statusFilter}
|
|
107
|
-
deleteChip={(
|
|
117
|
+
deleteChip={(_, chip) => setStatusFilter(statusFilter?.filter((f) => f !== chip))}
|
|
108
118
|
deleteChipGroup={() => setStatusFilter([])}
|
|
109
119
|
categoryName="Status"
|
|
110
120
|
>
|
|
@@ -130,7 +140,7 @@ const InfraTableToolbar: React.FC<InfraTableToolbarProps> = ({
|
|
|
130
140
|
<Grid key="statuses" hasGutter className="table-toolbar__dropdown">
|
|
131
141
|
{Object.keys(filterStatuses).map((category) => (
|
|
132
142
|
<GridItem key={category} span={4}>
|
|
133
|
-
<SelectGroup label={category}>
|
|
143
|
+
<SelectGroup label={categoryLabels[category as HostStatusDef['category']]}>
|
|
134
144
|
{Object.keys(filterStatuses[category]).map((label) => (
|
|
135
145
|
<SelectOption
|
|
136
146
|
key={label}
|