Skip to content
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

Merged
merged 5 commits into from
Jun 18, 2019
Merged

Use MultiListPage for BaremetalHostsPage #1698

merged 5 commits into from
Jun 18, 2019

Conversation

jtomasek
Copy link

This allows to use machines and nodes data in hosts page

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 12, 2019
@knowncitizen
Copy link
Contributor

/assign @jhadvig

@spadgett
Copy link
Member

Do you mind transitioning to PF4 tables? See #1465

@jtomasek
Copy link
Author

jtomasek commented Jun 12, 2019

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 @patternfly/react-table version (https://github.com/openshift/console/pull/1465/files#diff-0a6694dd0d6b93a2aa14f32e3d873b4cR67)

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.

@spadgett
Copy link
Member

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!

@spadgett spadgett added this to the v4.2 milestone Jun 13, 2019
@jtomasek
Copy link
Author

Updated PR with commit which updates the Baremetal Hosts listing to use new PF4 table

Jiri Tomasek added 2 commits June 13, 2019 18:18
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'),
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Jiri Tomasek added 2 commits June 14, 2019 13:23
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',
Copy link
Member

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

Copy link
Contributor

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']);
Copy link
Member

@spadgett spadgett Jun 14, 2019

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.

Copy link
Author

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

Copy link
Member

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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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

Copy link
Author

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[]) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer NodeKind

Suggested change
export const getMachineNode = (machine: K8sResourceKind, nodes: K8sResourceKind[]) =>
export const getMachineNode = (machine: K8sResourceKind, nodes: NodeKind[]) =>

Copy link
Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
machine: K8sResourceKind;
machine: MachineKind;

Copy link
Author

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] },
Copy link
Member

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?

Copy link
Author

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 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
obj: K8sResourceKind & { machine: K8sResourceKind; node: K8sResourceKind };
obj: K8sResourceKind & { machine: MachineKind; node: NodeKind };

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@spadgett
Copy link
Member

/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';
Copy link
Member

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']);
Copy link
Member

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.

Copy link
Member

@spadgett spadgett left a 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
Copy link
Member

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.

Copy link
Author

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.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2019
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 890db4c into openshift:master Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants