Skip to content

Conversation

@bipuladh
Copy link
Contributor

@openshift-ci-robot openshift-ci-robot added the component/ceph Related to ceph-storage-plugin label Apr 13, 2020
@openshift-ci-robot openshift-ci-robot added the component/core Related to console core functionality label Apr 13, 2020
@gnehapk
Copy link
Contributor

gnehapk commented Apr 13, 2020

This looks like a big change to me. We should merge this post baremetal changes as the changes are in same file and can delay the baremetal PR to get merge. PR - https://github.com/openshift/console/pull/5016/files

customData={{ selectedNodes, setSelectedNodes, visibleRows, setVisibleRows }}
/>
<p className="control-label help-block" data-test-id="nodes-selected">
{selectedNodes?.length ?? 0} node(s) selected

Choose a reason for hiding this comment

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

Consider using pluralize here.

Choose a reason for hiding this comment

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

Additionally this count can be inside the NodeList component to keep the margin aligned.
Screenshot from 2020-04-13 17-57-26

Comment on lines 86 to 102
nodeObject: node,
cpuSpec,
memSpec,
id: node.metadata.uid,

Choose a reason for hiding this comment

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

Custom props can be given under props field.
This will ensure correct typings.

props: {
  nodeObject: node,
  cpuSpec,
  memSpec,
  id: node.metadata.uid,
}

Choose a reason for hiding this comment

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

The rows of Pf are of IRow type

{
    cells?: (React.ReactNode | IRowCell)[];
    isOpen?: boolean;
    parent?: number;
    compoundParent?: number;
    props?: any;
    fullWidth?: boolean;
    noPadding?: boolean;
    heightAuto?: boolean;
    showSelect?: boolean;
    isExpanded?: boolean;
    isFirstVisible?: boolean;
    isLastVisible?: boolean;
    selected?: boolean;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting will do.

Comment on lines 50 to 51
// intentionally keeping the taint logic as its required in 4.3 and will be handled with checkbox selection
// promises.push(...makeTaintNodesRequest(selectedData));

Choose a reason for hiding this comment

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

Can be removed now

Copy link
Contributor

Choose a reason for hiding this comment

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

Done as a part of #5016

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return !_.isEmpty(node.spec.taints);
return !_.isEmpty(node.spec?.taints);

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2020
@bipuladh bipuladh requested review from afreen23 and cloudbehl April 14, 2020 19:54
Copy link
Contributor

Choose a reason for hiding this comment

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

Error also needs to be handled here -

.catch((err) => {
        setProgress(false);	  
        setError(err.message);
      });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

handlePromise does this for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

ack

customData={{ selectedNodes, setSelectedNodes, visibleRows, setVisibleRows }}
/>
<p className="control-label help-block" data-test-id="nodes-selected">
{selectedNodes?.length ?? 0} node(s) selected

Choose a reason for hiding this comment

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

Additionally this count can be inside the NodeList component to keep the margin aligned.
Screenshot from 2020-04-13 17-57-26

Choose a reason for hiding this comment

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

We had this bug fixed in #4676. Please add it.

Suggested change
{(isIndependent === false || mode === MODES.CONVERGED) && (
<CreateOCSServiceForm match={match} />
)}
{(isIndependent === false || mode === MODES.CONVERGED) && clusterServiceVersion (
<CreateOCSServiceForm match={match} />
)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are not passing it anymore.

Choose a reason for hiding this comment

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

Its no more CustomNodeTable now :)

Comment on lines 151 to 153

Choose a reason for hiding this comment

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

You can import the type from patternfly IRow['cells']

Comment on lines 70 to 71

Choose a reason for hiding this comment

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

Suggested change
const [selectedNodes, setSelectedNodes] = React.useState(null);
const [visibleRows, setVisibleRows] = React.useState(null);
const [selectedNodes, setSelectedNodes] = React.useState<NodeKind[]>([]);
const [visibleRows, setVisibleRows] = React.useState<NodeKind[]>([]);

Initial state as empty array would be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but null is used for handling first render logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add types though.

Choose a reason for hiding this comment

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

Suggested change
type NodeRow = {
type NodeTableRow = {

Choose a reason for hiding this comment

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

All labels should be of same style.

Screenshot from 2020-04-15 14-19-31
Screenshot from 2020-04-15 14-19-41

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Select Nodes is defined as title IDK if that needs change. For now, I don't want to touch it.

Choose a reason for hiding this comment

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

With the updated designs , yes we need to change that .
Refer this: https://marvelapp.com/a3abjjd/screen/66836688

Choose a reason for hiding this comment

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

May we can use PF forms here for overall consistency. I think I can send a followup PR for this and the CR changes on top of yours.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@afreen23 that design does not have OCS Service Capacity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And helper text are not matching. Selected nodes will be labeled with <code>cluster.ocs.openshift.io/openshift-storage=&quot;&quot;</code> to create the OCS Service
This one is missing from the design

Choose a reason for hiding this comment

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

If you make initial state as an empty array, you can skip this logic.

Suggested change
{`${pluralize(selectedNodes?.length || 0, 'node', 'nodes')} selected`}
{`${pluralize(selectedNodes.length, 'node')} selected`}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mentioned above

Choose a reason for hiding this comment

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

Suggested change
<label className="control-label" htmlFor="ocs-service-stoargeclass">
<label className="control-label" htmlFor="ocs-service-capacity">

Add the corresponding matching id to the component

@afreen23
Copy link

Can you fix the alignment here and change text to Create Storage Cluster ?
Screenshot from 2020-04-15 14-21-07

@bipuladh bipuladh requested review from afreen23 and gnehapk April 15, 2020 10:28
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const taints: Taint[] = node.spec.taints || [];
const taints: Taint[] = node.spec?.taints || [];

Copy link
Contributor

Choose a reason for hiding this comment

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

use cephStorageLabel from index.ts

Copy link
Contributor

Choose a reason for hiding this comment

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

line 97 in create-form.tsx use the same variable

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (JSON.stringify(filteredData) !== JSON.stringify(visibleRows)) {
if (!_.isEqual(filteredData, visibleRows)) {

Copy link
Contributor

Choose a reason for hiding this comment

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

We should take data from Example CSV of storage-cluster rather than using this const.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const [selectedNodes, setSelectedNodes] = React.useState<NodeKind[]>(null);
const [selectedNodes, setSelectedNodes] = React.useState<NodeKind[]>([]);

Copy link
Contributor

Choose a reason for hiding this comment

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

Doing this you don't need to do selectedNodes?.length

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need this for the first render. I use it to set the preselection of nodes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not hardcode. There is a function which changes / to ~. Let use the function and do string concatenation on OCS_LABEL.

@bipuladh bipuladh force-pushed the refactor-install branch 2 times, most recently from 578af65 to 8d8f6a7 Compare April 15, 2020 11:44
@bipuladh bipuladh requested a review from cloudbehl April 15, 2020 11:54

Choose a reason for hiding this comment

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

With the updated designs , yes we need to change that .
Refer this: https://marvelapp.com/a3abjjd/screen/66836688

Choose a reason for hiding this comment

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

May we can use PF forms here for overall consistency. I think I can send a followup PR for this and the CR changes on top of yours.

const NodeTable: React.FC<NodeTableProps> = (props) => {
const { selectedNodes, setSelectedNodes, visibleRows } = props.customData;

const onSelect = (_event, isSelected: boolean, rowIndex: number, rowData: IRowData) => {

Choose a reason for hiding this comment

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

Use the onSelect type from PF table props

@cloudbehl
Copy link
Contributor

/retest

@cloudbehl
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bipuladh, cloudbehl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@bipuladh bipuladh requested review from afreen23 and gnehapk April 16, 2020 09:34
@openshift-merge-robot openshift-merge-robot merged commit 748cf07 into openshift:master Apr 16, 2020
@spadgett spadgett added this to the v4.5 milestone Apr 16, 2020
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. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants