-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MultiListPage for BaremetalHostsPage #1698
Use MultiListPage for BaremetalHostsPage #1698
Conversation
/assign @jhadvig |
Do you mind transitioning to PF4 tables? See #1465 |
I am happy to do so, but I did not want to make this dependent on #1465 as it does not seem to be ready yet. It also seems to be using temporary Edit: Hmm, I see react-table version has been updated and the PR is merged now. I'll create a new PR which changes the table to PF4. |
Yeah, it's already merged. The only tables not transitioned are the ones in our static plugins. When we update those, we can remove the legacy list components. Thanks! |
Updated PR with commit which updates the Baremetal Hosts listing to use new PF4 table |
This allows to use machines and nodes data in hosts page
</ListHeader> | ||
); | ||
const tableColumnClasses = [ | ||
classNames('pf-m-5-col-on-lg', 'pf-m-8-col-on-md', 'pf-m-12-col-on-sm'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if we're asking you to code to a moving target, but we removed these classes. They aren't standard Patternfly classes. See #1707
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
due to false positives in typescript when using React.FC
|
||
// Prevent missing props validation in a React component definition | ||
// Off due to false positives in typescript | ||
'react/prop-types': 'off', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christianvogt fyi, looks like this will conflict with #1721
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave the suggestion. That's fine. Whichever comes first.
import { getName } from './common'; | ||
|
||
export const getMachineRole = (machine) => | ||
_.get(machine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a helper for this here:
https://github.com/openshift/console/blob/master/frontend/public/components/machine.tsx#L26
It looks like the label is different though. We should check what's correct and only have this helper in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking here https://github.com/openshift/machine-api-operator it seems that the label has been changed to machine.openshift.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking here https://github.com/openshift/machine-api-operator it seems that the label has been changed to
machine.openshift.io
@jtomasek We need to evaluate whether this was shipped as a bug in 4.1. If it was, we should open a Bugzilla to fix it in 4.1.z.
|
||
export const getMachineRole = (machine) => | ||
_.get(machine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); | ||
export const getMachineNodeName = (machine) => _.get(machine, 'status.nodeRef.name'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to update the components/machine.tsx to use selectors from @console/shared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
_.get(machine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); | ||
export const getMachineNodeName = (machine) => _.get(machine, 'status.nodeRef.name'); | ||
|
||
export const getMachineNode = (machine: K8sResourceKind, nodes: K8sResourceKind[]) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer NodeKind
export const getMachineNode = (machine: K8sResourceKind, nodes: K8sResourceKind[]) => | |
export const getMachineNode = (machine: K8sResourceKind, nodes: NodeKind[]) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
import { K8sResourceKind } from '@console/internal/module/k8s'; | ||
|
||
type BaremetalHostRoleProps = { | ||
machine: K8sResourceKind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
machine: K8sResourceKind; | |
machine: MachineKind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
title: 'Machine', | ||
sortField: 'spec.machineRef.name', | ||
transforms: [sortable], | ||
props: { className: tableColumnClasses[2] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're skipping a column class. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that one is going to be used by Host Status
. I've updated first column to span its space for the time being.
]; | ||
|
||
type HostsTableRowProps = { | ||
obj: K8sResourceKind & { machine: K8sResourceKind; node: K8sResourceKind }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obj: K8sResourceKind & { machine: K8sResourceKind; node: K8sResourceKind }; | |
obj: K8sResourceKind & { machine: MachineKind; node: NodeKind }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/assign |
* update machine selector types to use specific kinds * remove selectors definition from machine module * use machine selectors from @console/shared in machine, machine-set and machine-deployment modules
@@ -0,0 +1,6 @@ | |||
import * as _ from 'lodash-es'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider a different name for this folder. "selectors" has a specific meaning in k8s (label selectors)
import { getName } from './common'; | ||
|
||
export const getMachineRole = (machine) => | ||
_.get(machine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking here https://github.com/openshift/machine-api-operator it seems that the label has been changed to
machine.openshift.io
@jtomasek We need to evaluate whether this was shipped as a bug in 4.1. If it was, we should open a Bugzilla to fix it in 4.1.z.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
|
||
const flatten = (resources) => { | ||
// TODO(jtomasek): Remove loaded check once ListPageWrapper_ is updated to call flatten only | ||
// when resources are loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we want to make that change in ListPageWrapper_
? I'd think we'd want to show the data as it comes in. Otherwise we'd block rendering the table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create a separate issue for this and try to elaborate on the issue I am seeing.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jtomasek, knowncitizen, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
This allows to use machines and nodes data in hosts page