feat: add summary section to workspace create/edit#966
feat: add summary section to workspace create/edit#966paulovmr wants to merge 1 commit intokubeflow:notebooks-v2from
Conversation
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/assign |
|
/ok-to-test |
There was a problem hiding this comment.
Left a few comments inline, please check if they make sense. :)
Here are some things I noticed and wrote down to consider as FUP:
-
When navigating back to the Workspace Kind selection step after completing subsequent steps, consider showing a confirmation dialog warning that changing the kind will reset all previous selections (image, pod config, properties). This would prevent accidental data loss. Only applicable to create mode though, since workspace kind cannot be changed in edit mode.
-
The delayed hide on the summary redirect popover is a nice touch. It allows users to copy text and interact with the "Switch to" button. Two suggestions:
- Consider applying the same delayed-hide behavior to the redirect popovers on the Image and Pod Config selection cards in the grid view, for consistency.
- Extend the hover-sensitive area to cover the entire popover (including the header and close button). Currently, the popover can be dismissed before the cursor reaches those areas.
-
Not blocking, but something to consider for a follow-up: the pencil (edit) icon on each summary card suggests inline editing, when it actually navigates to the corresponding wizard step. This could be slightly misleading, especially in edit mode for the Workspace Kind card, where clicking the icon navigates to a step where no change is allowed. A different icon (e.g., an arrow or "go to" indicator) or disabling the button for non-editable sections in edit mode might better communicate the intended action.
|
|
||
| const DEFAULT_NAMESPACE = 'default'; | ||
|
|
||
| describe.skip('Summary Redirect Popover - Delayed Hide Behavior', () => { |
There was a problem hiding this comment.
Can we add a ticket reference associated with the reason for skipping the entire test so we don't lose track of it?
| createWorkspace.clickNext(); // Properties | ||
|
|
||
| // Find redirect icon in summary | ||
| cy.get('[data-testid="redirect-icon-1-new"]').should('exist'); |
There was a problem hiding this comment.
Please replace all occurrences of cy.get('[data-testid=" with cy.findByTestId(.
|
|
||
| // Hover to show popover | ||
| cy.get('[data-testid="redirect-icon-1-new"]').trigger('mouseenter'); | ||
| cy.get('.pf-v6-c-popover').should('be.visible'); |
There was a problem hiding this comment.
Can we use data-testid instead of cy.get('.pf-v6-c-popover') (this could match with unwanted other things)?
| it('should apply workspace-option-card__header--with-icons class to cards with hidden flag', () => { | ||
| createWorkspace.checkExtraFilter('showHidden'); | ||
|
|
||
| cy.get('#hidden-image .pf-v6-c-card__header').should( |
There was a problem hiding this comment.
Consider using data-testid (entire file)
| it('should hide popover after 1 second if mouse does not enter popover', () => { | ||
| createWorkspace.clickNext(); // Pod config | ||
| createWorkspace.clickNext(); // Properties | ||
|
|
||
| // Hover to show popover | ||
| cy.get('[data-testid="redirect-icon-1-new"]').trigger('mouseenter'); | ||
| cy.get('.pf-v6-c-popover').should('be.visible'); | ||
|
|
||
| // Move mouse away from icon | ||
| cy.get('[data-testid="redirect-icon-1-new"]').trigger('mouseleave'); | ||
|
|
||
| // Popover should be hidden after delay (using clock.tick would require cy.clock() setup) | ||
| cy.get('.pf-v6-c-popover', { timeout: 2000 }).should('not.be.visible'); | ||
| }); |
There was a problem hiding this comment.
This is maybe a nitpick but I believe tests should tell a story that is simple to read. Complexity should be moved to page objects. It also avoids the need to add comments on every line.
Example:
createWorkspace.hoverPopover...
createWorkspace.assertPopoverVisible(true)
createWorkspace.moveMouseAway...
createWorkspace.assertPopoverVisible(false)
| @@ -0,0 +1,654 @@ | |||
| import React, { useCallback, useState, useRef, useEffect } from 'react'; | |||
There was a problem hiding this comment.
Consider extracting the diff rendering, the properties section, and the normalizeLabels helper into separate components or utility functions to improve readability and testability.
| }; | ||
| onClickTarget: () => void; | ||
| }) => React.ReactNode; | ||
| hideTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>; |
There was a problem hiding this comment.
There are 6 occurrences of // eslint-disable-next-line no-param-reassign to mutate ref .current values. While mutating refs is legitimate in React, the pattern of passing refs as props and mutating them from a child component is unusual. Consider managing the hideTimeoutRef and isHoveringPopoverRef state internally within WorkspaceFormSummaryPanel (where the refs are owned) and passing down only the necessary callbacks, which would eliminate the need for these lint suppressions entirely.
thaorell
left a comment
There was a problem hiding this comment.
Hi Paulo, thank you for the work. The summary section is very helpful to recap information. There are two issues I want to highlight:
- The right side panel could contain a lot of information that needs to be displayed (For example, an Image that has a very long description about the image, or PodConfig with a lot of hardware information). We could make Summary an additional step in the WorkspaceForm component (at least for Workspace Create), and the cards should be clickable card that navigates the user back to the Step they click on. That way, there is more real estate on the Summary page (maybe even a YAML view in the future)
- The OLD vs NEW section is very valuable on Edit, but comparisons are usually done side by side. We could consider a Split layout for better comparison view
|
|
||
| return ( | ||
| <StackItem key={step}> | ||
| <Card isCompact> |
There was a problem hiding this comment.
Consider a clickable card instead of the Pencil Icon button
| </StackItem> | ||
| <Divider /> | ||
| {/* OLD section */} | ||
| <StackItem> |
There was a problem hiding this comment.
For a side-by-side comparison, consider using Split instead of Stack, because it is easier to translate and compare the information.
| {/* OLD section */} | ||
| <StackItem> | ||
| <Content component={ContentVariants.p}> | ||
| <strong>OLD:</strong> |
| {/* NEW section */} | ||
| <StackItem> | ||
| <Content component={ContentVariants.p}> | ||
| <strong>NEW:</strong> |
| </StackItem> | ||
| {redirect.message?.text && <StackItem>{redirect.message.text}</StackItem>} | ||
| <StackItem> | ||
| <Button |
There was a problem hiding this comment.
I would consider not having the Button in the Popover, actions should be performed after the user navigates back to the Step.
closes #959
demo-summary.webm