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
Migrate Helm actions on topology to use the new extensions #9313
Conversation
/assign @rohitkrai03 |
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.
/hold
@debsmita1 This PR seems to be just using ActionLoader
to get extension based action but still using the old KebabMenu
components. The goal of the story was to use new KebabMenu
components potentially after https://issues.redhat.com/browse/ODC-5749 which would lead to some more refactoring in how topology uses actions.
)} | ||
<div className="co-actions"> | ||
<ActionsLoader contextId="helm-actions" scope={actionsScope}> | ||
{(actions, loaded) => loaded && <ActionsMenu actions={actions} />} |
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.
Does this actually work? Type of the actions coming from extensions is a bit different than that of old actions. Seems like this would break somewhere.
onClick={onClick} | ||
autoFocus={focusItem ? option === focusItem : undefined} | ||
/> | ||
<div className="pf-c-dropdown__menu-item"> |
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.
Added this so that the menu items in the context menu are rendered with proper spacing and are focused when the cursor hovers on them
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.
This might add some unnecessary styles to normal menu items.
Fixing the alignment of the Sub Menu and grouped menu items in the Context Menu |
@debsmita1 #9306 just merged. So you can remove the duplicate changes from this PR now. |
onClick={onClick} | ||
autoFocus={focusItem ? option === focusItem : undefined} | ||
/> | ||
<div className="pf-c-dropdown__menu-item"> |
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.
This might add some unnecessary styles to normal menu items.
export const contextMenuActions = (element: Node): React.ReactElement[] => { | ||
return [ | ||
<ActionsLoader contextId="topology-actions" scope={element}> | ||
{(loader) => loader.loaded && <ActionMenuContent options={loader.options} />} |
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.
Changed the implementation here. PTAL
/cc @christianvogt |
/hold cancel |
label: string; | ||
/** To send translation key for label */ | ||
labelKey?: string; |
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 don't think we need this prop. Since all new extensions are hook based, strings will be translated in the hook itself
export const contextMenuActions = (element: Node): React.ReactElement[] => { | ||
return [ | ||
<ActionsLoader | ||
key={`topology-actions-${element.getType()}`} |
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.
key
here can be a constant because there's no conflicts
topology
is sufficient
return [ | ||
<ActionsLoader | ||
key={`topology-actions-${element.getType()}`} | ||
contextId="topology-actions" |
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 also need resource
contextId
for this util to be reused for other nodes.
@rohitkrai03 we need a way to avoid doing it this way and have a single loader
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.
Yeah, I am working on adding support for resource actions in action loader. So we can provide the resource model along with contextId to the action loader and get back all the actions for a specific resource as well as a context.
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.
do we put this PR on hold till then ?
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 think we can get this merged now. The follow up story that I am working on will take care of resource actions.
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: debsmita1, rohitkrai03 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 |
JIRA ticket:
https://issues.redhat.com/browse/ODC-5693
Solution description:
GIF/Screenshot: