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

Migrate Helm actions on topology to use the new extensions #9313

Merged
merged 1 commit into from Jul 9, 2021

Conversation

debsmita1
Copy link
Contributor

@debsmita1 debsmita1 commented Jun 22, 2021

JIRA ticket:
https://issues.redhat.com/browse/ODC-5693

Solution description:

  • Updated the topology context menu actions for helm release to use the new extension

GIF/Screenshot:
Screenshot from 2021-07-08 01-25-23
topology-context-menu
Peek 2021-07-08 01-37

@openshift-ci openshift-ci bot added component/core Related to console core functionality component/helm Related to helm-plugin component/topology Related to topology labels Jun 22, 2021
@debsmita1
Copy link
Contributor Author

/assign @rohitkrai03

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a 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.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 22, 2021
)}
<div className="co-actions">
<ActionsLoader contextId="helm-actions" scope={actionsScope}>
{(actions, loaded) => loaded && <ActionsMenu actions={actions} />}
Copy link
Contributor

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.

@debsmita1 debsmita1 changed the title Migrate Helm actions on topology to use the new extensions [WIP] Migrate Helm actions on topology to use the new extensions Jun 23, 2021
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 23, 2021
@openshift-ci openshift-ci bot added the component/shared Related to console-shared label Jul 6, 2021
@debsmita1 debsmita1 changed the title [WIP] Migrate Helm actions on topology to use the new extensions Migrate Helm actions on topology to use the new extensions Jul 6, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2021
onClick={onClick}
autoFocus={focusItem ? option === focusItem : undefined}
/>
<div className="pf-c-dropdown__menu-item">
Copy link
Contributor Author

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

Copy link
Contributor

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.

@debsmita1
Copy link
Contributor Author

Fixing the alignment of the Sub Menu and grouped menu items in the Context Menu

@rohitkrai03
Copy link
Contributor

@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">
Copy link
Contributor

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} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sending an onClick handler keeps the context menu open even after the callback has been called.
Screenshot 2021-07-07 at 5 41 50 PM

Copy link
Contributor Author

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

@debsmita1
Copy link
Contributor Author

Fixing the alignment of the Sub Menu and grouped menu items in the Context Menu

Created util createContextMenuItems which returns the context menu items in a way similar to the menu rendering logic in ActionMenuContent

Screenshot from 2021-07-08 01-25-23

@debsmita1
Copy link
Contributor Author

/cc @christianvogt
/cc @sahil143

@debsmita1
Copy link
Contributor Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 7, 2021
label: string;
/** To send translation key for label */
labelKey?: string;
Copy link
Contributor

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()}`}
Copy link
Contributor

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"
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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 ?

Copy link
Contributor

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.

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 9, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 9, 2021

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2021
@openshift-merge-robot openshift-merge-robot merged commit c224f28 into openshift:master Jul 9, 2021
@spadgett spadgett added this to the v4.9 milestone Jul 14, 2021
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/core Related to console core functionality component/helm Related to helm-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared component/topology Related to topology lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants