-
Notifications
You must be signed in to change notification settings - Fork 667
Refactored Node Selection Page for OCS Installation Flow #5017
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
Refactored Node Selection Page for OCS Installation Flow #5017
Conversation
|
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 |
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.
Consider using pluralize here.
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.
| nodeObject: node, | ||
| cpuSpec, | ||
| memSpec, | ||
| id: node.metadata.uid, |
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.
Custom props can be given under props field.
This will ensure correct typings.
props: {
nodeObject: node,
cpuSpec,
memSpec,
id: node.metadata.uid,
}
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.
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;
}
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.
Interesting will do.
| // intentionally keeping the taint logic as its required in 4.3 and will be handled with checkbox selection | ||
| // promises.push(...makeTaintNodesRequest(selectedData)); |
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.
Can be removed now
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 as a part of #5016
f9d4e19 to
813922c
Compare
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.
| return !_.isEmpty(node.spec.taints); | |
| return !_.isEmpty(node.spec?.taints); |
813922c to
38cac31
Compare
38cac31 to
65b3a54
Compare
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.
Error also needs to be handled here -
.catch((err) => {
setProgress(false);
setError(err.message);
});
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.
handlePromise does this for me.
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.
ack
| customData={{ selectedNodes, setSelectedNodes, visibleRows, setVisibleRows }} | ||
| /> | ||
| <p className="control-label help-block" data-test-id="nodes-selected"> | ||
| {selectedNodes?.length ?? 0} node(s) selected |
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.
We had this bug fixed in #4676. Please add it.
| {(isIndependent === false || mode === MODES.CONVERGED) && ( | |
| <CreateOCSServiceForm match={match} /> | |
| )} | |
| {(isIndependent === false || mode === MODES.CONVERGED) && clusterServiceVersion ( | |
| <CreateOCSServiceForm match={match} /> | |
| )} |
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.
No need for it.
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.
Since we are not passing it anymore.
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.
Its no more CustomNodeTable now :)
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.
You can import the type from patternfly IRow['cells']
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.
| 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
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 but null is used for handling first render logic.
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 can add types though.
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.
| type NodeRow = { | |
| type NodeTableRow = { |
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.
Select Nodes is defined as title IDK if that needs change. For now, I don't want to touch it.
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.
With the updated designs , yes we need to change that .
Refer this: https://marvelapp.com/a3abjjd/screen/66836688
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.
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.
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.
@afreen23 that design does not have OCS Service Capacity.
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.
And helper text are not matching. Selected nodes will be labeled with <code>cluster.ocs.openshift.io/openshift-storage=""</code> to create the OCS Service
This one is missing from the design
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.
If you make initial state as an empty array, you can skip this logic.
| {`${pluralize(selectedNodes?.length || 0, 'node', 'nodes')} selected`} | |
| {`${pluralize(selectedNodes.length, 'node')} selected`} |
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.
mentioned above
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.
| <label className="control-label" htmlFor="ocs-service-stoargeclass"> | |
| <label className="control-label" htmlFor="ocs-service-capacity"> |
Add the corresponding matching id to the component
65b3a54 to
b3c306a
Compare
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.
| const taints: Taint[] = node.spec.taints || []; | |
| const taints: Taint[] = node.spec?.taints || []; |
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.
use cephStorageLabel from index.ts
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.
line 97 in create-form.tsx use the same variable
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.
| if (JSON.stringify(filteredData) !== JSON.stringify(visibleRows)) { | |
| if (!_.isEqual(filteredData, visibleRows)) { |
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 take data from Example CSV of storage-cluster rather than using this const.
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.
| const [selectedNodes, setSelectedNodes] = React.useState<NodeKind[]>(null); | |
| const [selectedNodes, setSelectedNodes] = React.useState<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.
Doing this you don't need to do selectedNodes?.length
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 need this for the first render. I use it to set the preselection of nodes.
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.
Let's not hardcode. There is a function which changes / to ~. Let use the function and do string concatenation on OCS_LABEL.
578af65 to
8d8f6a7
Compare
frontend/packages/ceph-storage-plugin/src/components/ocs-install/create-form.tsx
Show resolved
Hide resolved
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.
With the updated designs , yes we need to change that .
Refer this: https://marvelapp.com/a3abjjd/screen/66836688
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
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.
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.
frontend/packages/ceph-storage-plugin/src/components/ocs-install/create-form.tsx
Outdated
Show resolved
Hide resolved
| const NodeTable: React.FC<NodeTableProps> = (props) => { | ||
| const { selectedNodes, setSelectedNodes, visibleRows } = props.customData; | ||
|
|
||
| const onSelect = (_event, isSelected: boolean, rowIndex: number, rowData: IRowData) => { |
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.
Use the onSelect type from PF table props
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx
Outdated
Show resolved
Hide resolved
8d8f6a7 to
25d8a1c
Compare
25d8a1c to
db82f7f
Compare
|
/retest |
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |




cc @afreen23
/assign @cloudbehl @gnehapk @afreen23