Skip to content

Commit

Permalink
Merge pull request #6369 from rawagner/bmh_nodes_name
Browse files Browse the repository at this point in the history
Bug 1869998: Fix broken BMN list page due to name filter
  • Loading branch information
openshift-merge-robot committed Aug 20, 2020
2 parents a16bd72 + 504a47d commit 0077a29
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Expand Up @@ -47,7 +47,7 @@ const flattenResources = (resources: {
const status = bareMetalNodeStatus({ node, nodeMaintenance, csr });
// TODO(jtomasek): name is needed to make 'name' textFilter work.
// Remove it when it is possible to pass custom textFilter as a function
return { name: nodeName, host, machine, node, nodeMaintenance, status, csr };
return { metadata: { name: nodeName }, host, machine, node, nodeMaintenance, status, csr };
});
const csrBundle = getNodeClientCSRs(csrs.data);
return [...csrBundle, ...nodeBundle];
Expand Down
Expand Up @@ -74,7 +74,7 @@ const CSRTableRow: React.FC<BareMetalNodesTableRowProps<CSRBundle>> = ({
}) => {
return (
<TableRow id={obj.csr.metadata.uid} index={index} trKey={rowKey} style={style}>
<TableData className={tableColumnClasses.name}>{obj.name}</TableData>
<TableData className={tableColumnClasses.name}>{obj.metadata.name}</TableData>
<TableData className={tableColumnClasses.status}>
<CSRStatus csr={obj.csr} title={obj.status.status} />
</TableData>
Expand Down
8 changes: 6 additions & 2 deletions frontend/packages/metal3-plugin/src/components/types.ts
Expand Up @@ -29,13 +29,17 @@ export type BareMetalHostBundle = {
};

export type CSRBundle = {
name: string;
metadata: {
name: string;
};
status: StatusProps;
csr: CertificateSigningRequestKind;
};

export type BareMetalNodeBundle = {
name: string;
metadata: {
name: string;
};
node: NodeKind;
machine: MachineKind;
host: BareMetalHostKind;
Expand Down
8 changes: 5 additions & 3 deletions frontend/packages/metal3-plugin/src/selectors/csr.ts
Expand Up @@ -37,18 +37,20 @@ export const getNodeClientCSRs = (csrs: CertificateSigningRequestKind[] = []): C
// '2.5.4.3' is commonName code
const commonName = pkcs10.subject.typesAndValues.find(({ type }) => type === '2.5.4.3');
return {
name: commonName.value.valueBlock.value.replace('system:node:', ''),
metadata: {
name: commonName.value.valueBlock.value.replace('system:node:', ''),
},
csr,
status: { status: 'Discovered' },
};
});

const groupped = _.groupBy<CSRBundle>(nodeCSRs, (csr) => csr.name);
const groupped = _.groupBy<CSRBundle>(nodeCSRs, (csr) => csr.metadata.name);

return Object.keys(groupped).map((key) => {
const { csr, status } = groupped[key][0];
return {
name: key,
metadata: { name: key },
status,
csr,
};
Expand Down

0 comments on commit 0077a29

Please sign in to comment.