@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.
- 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 +36 -38
- 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 +12 -5
- 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 +71 -37
- 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 +16 -6
- 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
|
@@ -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[];
|
|
@@ -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}
|
|
@@ -3,60 +3,61 @@ import { ConnectedIcon, ExclamationCircleIcon } from '@patternfly/react-icons';
|
|
|
3
3
|
import { global_danger_color_100 as dangerColor } from '@patternfly/react-tokens';
|
|
4
4
|
import { hostStatus } from '../../../common';
|
|
5
5
|
import { HostStatus } from '../../../common/components/hosts/types';
|
|
6
|
+
import { TFunction } from 'i18next';
|
|
6
7
|
|
|
7
|
-
export const bmhStatus: HostStatus<string>
|
|
8
|
+
export const bmhStatus = (t: TFunction): HostStatus<string> => ({
|
|
8
9
|
'bmh-error': {
|
|
9
10
|
key: 'bmh-error',
|
|
10
|
-
title: 'Error',
|
|
11
|
+
title: t('ai:Error'),
|
|
11
12
|
category: 'Bare Metal Host related',
|
|
12
13
|
},
|
|
13
14
|
registering: {
|
|
14
15
|
key: 'registering',
|
|
15
|
-
title: 'Registering',
|
|
16
|
+
title: t('ai:Registering'),
|
|
16
17
|
category: 'Bare Metal Host related',
|
|
17
18
|
},
|
|
18
19
|
provisioning: {
|
|
19
20
|
key: 'provisioning',
|
|
20
|
-
title: 'Provisioning',
|
|
21
|
+
title: t('ai:Provisioning'),
|
|
21
22
|
category: 'Bare Metal Host related',
|
|
22
23
|
},
|
|
23
24
|
provisioned: {
|
|
24
25
|
key: 'provisioned',
|
|
25
|
-
title: 'Provisioned',
|
|
26
|
+
title: t('ai:Provisioned'),
|
|
26
27
|
category: 'Bare Metal Host related',
|
|
27
28
|
},
|
|
28
29
|
deprovisioning: {
|
|
29
30
|
key: 'deprovisioning',
|
|
30
|
-
title: 'Deprovisioning',
|
|
31
|
+
title: t('ai:Deprovisioning'),
|
|
31
32
|
category: 'Bare Metal Host related',
|
|
32
33
|
},
|
|
33
34
|
inspecting: {
|
|
34
35
|
key: 'inspecting',
|
|
35
|
-
title: 'Inspecting',
|
|
36
|
+
title: t('ai:Inspecting'),
|
|
36
37
|
category: 'Bare Metal Host related',
|
|
37
38
|
},
|
|
38
39
|
pending: {
|
|
39
40
|
key: 'pending',
|
|
40
|
-
title: 'Pending',
|
|
41
|
+
title: t('ai:Pending'),
|
|
41
42
|
category: 'Bare Metal Host related',
|
|
42
43
|
},
|
|
43
|
-
};
|
|
44
|
+
});
|
|
44
45
|
|
|
45
|
-
export const agentStatus: HostStatus<string>
|
|
46
|
-
...hostStatus,
|
|
46
|
+
export const agentStatus = (t: TFunction): HostStatus<string> => ({
|
|
47
|
+
...hostStatus(t),
|
|
47
48
|
discovered: {
|
|
48
49
|
key: 'discovered',
|
|
49
|
-
title: 'Discovered',
|
|
50
|
+
title: t('ai:Discovered'),
|
|
50
51
|
icon: <ConnectedIcon />,
|
|
51
52
|
noPopover: true,
|
|
52
53
|
category: 'Discovery related',
|
|
53
|
-
details: 'The host has been discovered and needs to be approved to before further use.',
|
|
54
|
+
details: t('ai:The host has been discovered and needs to be approved to before further use.'),
|
|
54
55
|
},
|
|
55
|
-
...bmhStatus,
|
|
56
|
+
...bmhStatus(t),
|
|
56
57
|
specSyncErr: {
|
|
57
58
|
key: 'spec-sync-err',
|
|
58
|
-
title: 'Sync error',
|
|
59
|
+
title: t('ai:Sync error'),
|
|
59
60
|
icon: <ExclamationCircleIcon color={dangerColor.value} />,
|
|
60
61
|
category: 'Discovery related',
|
|
61
62
|
},
|
|
62
|
-
};
|
|
63
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AgentStatus } from './status';
|
|
1
|
+
import { AgentStatus, getAgentStatusKey } from './status';
|
|
2
2
|
import { Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
3
3
|
import { AgentK8sResource, BareMetalHostK8sResource } from '../../types';
|
|
4
|
-
import { getAgentStatus } from './status';
|
|
5
4
|
import { INFRAENV_AGENTINSTALL_LABEL_KEY } from '../common/constants';
|
|
6
5
|
|
|
7
6
|
const AGENT_FOR_SELECTION_STATUSES: AgentStatus[] = [
|
|
@@ -21,8 +20,8 @@ export const hostToAgent = (agents: AgentK8sResource[] = [], host: Host) =>
|
|
|
21
20
|
|
|
22
21
|
export const getAgentsForSelection = (agents: AgentK8sResource[]) =>
|
|
23
22
|
agents.filter((agent) => {
|
|
24
|
-
const
|
|
25
|
-
return AGENT_FOR_SELECTION_STATUSES.includes(
|
|
23
|
+
const key = getAgentStatusKey(agent);
|
|
24
|
+
return AGENT_FOR_SELECTION_STATUSES.includes(key as AgentStatus);
|
|
26
25
|
});
|
|
27
26
|
|
|
28
27
|
export const getAgentRole = (agent: AgentK8sResource) => agent.spec.role || agent.status?.role;
|
|
@@ -22,8 +22,9 @@ import {
|
|
|
22
22
|
wizardStepsValidationsMap,
|
|
23
23
|
} from '../ClusterDeployment/wizardTransition';
|
|
24
24
|
import { HostStatusDef } from '../../../common';
|
|
25
|
-
import { agentStatus
|
|
25
|
+
import { agentStatus } from './agentStatus';
|
|
26
26
|
import { TFunction } from 'i18next';
|
|
27
|
+
import { HostStatus } from '../../../common/components/hosts/types';
|
|
27
28
|
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
30
|
const conditionsByTypeReducer = <K>(
|
|
@@ -125,29 +126,40 @@ export type AgentStatus = Host['status'] | 'discovered';
|
|
|
125
126
|
const getInsufficientState = (agent: AgentK8sResource) =>
|
|
126
127
|
agent?.spec?.clusterDeploymentName?.name ? 'insufficient' : 'insufficient-unbound';
|
|
127
128
|
|
|
128
|
-
export const
|
|
129
|
-
agent: AgentK8sResource,
|
|
130
|
-
excludeDiscovered = false,
|
|
131
|
-
): { status: HostStatusDef; validationsInfo: ValidationsInfo; autoCSR?: boolean } => {
|
|
129
|
+
export const getAgentStatusKey = (agent: AgentK8sResource, excludeDiscovered = false) => {
|
|
132
130
|
const specSyncErr = agent.status?.conditions?.find(
|
|
133
131
|
(c) => c.type === 'SpecSynced' && c.status === 'False',
|
|
134
132
|
);
|
|
135
|
-
|
|
136
|
-
let status: HostStatusDef;
|
|
137
|
-
let validationsInfo: ValidationsInfo = {};
|
|
138
133
|
if (specSyncErr) {
|
|
139
|
-
|
|
134
|
+
return 'specSyncError';
|
|
140
135
|
} else {
|
|
141
|
-
status = agentStatus[agent.status?.debugInfo?.state || getInsufficientState(agent)];
|
|
142
|
-
validationsInfo = agent.status?.validationsInfo || {};
|
|
143
136
|
if (!excludeDiscovered && !agent.spec.approved) {
|
|
144
|
-
|
|
137
|
+
return 'discovered';
|
|
138
|
+
} else {
|
|
139
|
+
return agent.status?.debugInfo?.state || getInsufficientState(agent);
|
|
145
140
|
}
|
|
146
|
-
// TODO(jtomasek): Implement this
|
|
147
|
-
// const sublabel = areOnlyClusterSoftValidationsFailing(agentStatus.validationsInfo)
|
|
148
|
-
// ? 'Some validations failed'
|
|
149
|
-
// : undefined;
|
|
150
141
|
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const getAgentStatus = (
|
|
145
|
+
agent: AgentK8sResource,
|
|
146
|
+
agentStatuses: HostStatus<string>,
|
|
147
|
+
excludeDiscovered = false,
|
|
148
|
+
): { status: HostStatusDef; validationsInfo: ValidationsInfo; autoCSR?: boolean } => {
|
|
149
|
+
const key = getAgentStatusKey(agent, excludeDiscovered);
|
|
150
|
+
|
|
151
|
+
let validationsInfo: ValidationsInfo = {};
|
|
152
|
+
|
|
153
|
+
const status = agentStatuses[key];
|
|
154
|
+
if (key !== 'specSyncError') {
|
|
155
|
+
validationsInfo = agent.status?.validationsInfo || {};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// TODO(jtomasek): Implement this
|
|
159
|
+
// const sublabel = areOnlyClusterSoftValidationsFailing(agentStatus.validationsInfo)
|
|
160
|
+
// ? 'Some validations failed'
|
|
161
|
+
// : undefined;
|
|
162
|
+
|
|
151
163
|
return { status, validationsInfo };
|
|
152
164
|
};
|
|
153
165
|
|
|
@@ -157,13 +169,15 @@ export const getWizardStepAgentStatus = (
|
|
|
157
169
|
t: TFunction,
|
|
158
170
|
excludeDiscovered = false,
|
|
159
171
|
): { status: HostStatusDef; validationsInfo: ValidationsInfo } => {
|
|
160
|
-
const
|
|
161
|
-
|
|
172
|
+
const agentStatuses = agentStatus(t);
|
|
173
|
+
const aStatus = getAgentStatus(agent, agentStatuses, excludeDiscovered);
|
|
174
|
+
|
|
175
|
+
if ([agentStatuses.discovered, agentStatuses.specSyncErr].includes(aStatus.status)) {
|
|
162
176
|
return aStatus;
|
|
163
177
|
}
|
|
164
178
|
|
|
165
179
|
const status =
|
|
166
|
-
|
|
180
|
+
agentStatuses[
|
|
167
181
|
getWizardStepHostStatus(wizardStepId, wizardStepsValidationsMap, {
|
|
168
182
|
status: aStatus.status.key as Host['status'],
|
|
169
183
|
validationsInfo: aStatus.validationsInfo,
|
|
@@ -188,13 +202,19 @@ export const getWizardStepAgentStatus = (
|
|
|
188
202
|
};
|
|
189
203
|
};
|
|
190
204
|
|
|
191
|
-
export const
|
|
192
|
-
let bmhState = bmhStatus.pending;
|
|
193
|
-
|
|
205
|
+
export const getBMHStatusKey = (bmh: BareMetalHostK8sResource) => {
|
|
194
206
|
if (bmh.status?.errorType) {
|
|
195
|
-
|
|
207
|
+
return 'bmh-error';
|
|
196
208
|
} else if (bmh.status?.provisioning?.state) {
|
|
197
|
-
|
|
209
|
+
return bmh.status?.provisioning?.state;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const getBMHStatus = (bmh: BareMetalHostK8sResource, bmhStatuses: HostStatus<string>) => {
|
|
214
|
+
let bmhState = bmhStatuses.pending;
|
|
215
|
+
const statusKey = getBMHStatusKey(bmh);
|
|
216
|
+
if (statusKey) {
|
|
217
|
+
bmhState = bmhStatuses[statusKey] || bmhState;
|
|
198
218
|
}
|
|
199
219
|
|
|
200
220
|
return {
|
|
@@ -3,7 +3,7 @@ import { AgentK8sResource } from '../../types/k8s/agent';
|
|
|
3
3
|
import { Cluster, Host, Inventory } from '@openshift-assisted/types/assisted-installer-service';
|
|
4
4
|
import { ClusterDeploymentK8sResource } from '../../types/k8s/cluster-deployment';
|
|
5
5
|
import { AgentClusterInstallK8sResource } from '../../types/k8s/agent-cluster-install';
|
|
6
|
-
import {
|
|
6
|
+
import { getAgentStatusKey, getClusterStatus } from './status';
|
|
7
7
|
import { getHostNetworks } from './network';
|
|
8
8
|
import { BareMetalHostK8sResource, InfraEnvK8sResource } from '../../types';
|
|
9
9
|
import {
|
|
@@ -21,7 +21,7 @@ export const getAIHosts = (
|
|
|
21
21
|
) => {
|
|
22
22
|
const bmhAgents: string[] = [];
|
|
23
23
|
const hosts = agents.map((agent): Host => {
|
|
24
|
-
const
|
|
24
|
+
const statusKey = getAgentStatusKey(agent, true);
|
|
25
25
|
const statusInfo = agent.status?.debugInfo?.stateInfo || '';
|
|
26
26
|
// TODO(mlibra) Remove that workaround once https://issues.redhat.com/browse/MGMT-7052 is fixed
|
|
27
27
|
const inventory: Inventory = cloneDeep(agent.status?.inventory || {});
|
|
@@ -50,7 +50,7 @@ export const getAIHosts = (
|
|
|
50
50
|
kind: 'Host',
|
|
51
51
|
id: agent.metadata?.uid || '',
|
|
52
52
|
href: '',
|
|
53
|
-
status:
|
|
53
|
+
status: statusKey as Host['status'],
|
|
54
54
|
statusInfo,
|
|
55
55
|
role: getAgentRole(agent),
|
|
56
56
|
requestedHostname: agent.spec.hostname || inventory.hostname,
|
|
@@ -21,6 +21,7 @@ import { getErrorMessage } from '../../../common/utils';
|
|
|
21
21
|
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
|
|
22
22
|
import { TFunction } from 'i18next';
|
|
23
23
|
import { Host } from '@openshift-assisted/types/assisted-installer-service';
|
|
24
|
+
import { HostStatus } from '../../../common/components/hosts/types';
|
|
24
25
|
|
|
25
26
|
type ApproveTableRowProps = {
|
|
26
27
|
agent?: AgentK8sResource;
|
|
@@ -51,7 +52,11 @@ const hostnameColumn = (agents: AgentK8sResource[], t: TFunction): TableRow<Host
|
|
|
51
52
|
};
|
|
52
53
|
};
|
|
53
54
|
|
|
54
|
-
const statusColumn = (
|
|
55
|
+
const statusColumn = (
|
|
56
|
+
agents: AgentK8sResource[],
|
|
57
|
+
agentStatuses: HostStatus<string>,
|
|
58
|
+
t: TFunction,
|
|
59
|
+
): TableRow<Host> => {
|
|
55
60
|
return {
|
|
56
61
|
header: {
|
|
57
62
|
title: t('ai:Status'),
|
|
@@ -62,8 +67,10 @@ const statusColumn = (agents: AgentK8sResource[], t: TFunction): TableRow<Host>
|
|
|
62
67
|
},
|
|
63
68
|
cell: (host) => {
|
|
64
69
|
const agent = agents.find((a) => a.metadata?.uid === host.id);
|
|
65
|
-
const status = agent?.spec.approved
|
|
66
|
-
|
|
70
|
+
const status = agent?.spec.approved
|
|
71
|
+
? t('ai:Already approved')
|
|
72
|
+
: agentStatuses.discovered.title;
|
|
73
|
+
const icon = agentStatuses.discovered.icon;
|
|
67
74
|
return {
|
|
68
75
|
title: (
|
|
69
76
|
<ApproveTableRow agent={agent}>
|
|
@@ -99,6 +106,7 @@ const MassApproveAgentModal: React.FC<MassApproveAgentModalProps> = ({
|
|
|
99
106
|
const [progress, setProgress] = React.useState<number | null>(null);
|
|
100
107
|
const [error, setError] = React.useState<{ title: string; message: string }>();
|
|
101
108
|
const { t } = useTranslation();
|
|
109
|
+
const agentStatuses = agentStatus(t);
|
|
102
110
|
const onClick = async () => {
|
|
103
111
|
setError(undefined);
|
|
104
112
|
let i = 0;
|
|
@@ -122,10 +130,10 @@ const MassApproveAgentModal: React.FC<MassApproveAgentModalProps> = ({
|
|
|
122
130
|
};
|
|
123
131
|
const { content, hosts } = React.useMemo(
|
|
124
132
|
() => ({
|
|
125
|
-
content: [hostnameColumn(agents, t), statusColumn(agents, t)],
|
|
133
|
+
content: [hostnameColumn(agents, t), statusColumn(agents, agentStatuses, t)],
|
|
126
134
|
hosts: getAIHosts(agents),
|
|
127
135
|
}),
|
|
128
|
-
[agents, t],
|
|
136
|
+
[agentStatuses, agents, t],
|
|
129
137
|
);
|
|
130
138
|
|
|
131
139
|
const paginationProps = usePagination(hosts.length);
|