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

Add catalogAddMenu filter to CatalogCategory #3722

Merged
merged 2 commits into from
Sep 13, 2021

Conversation

panuhorsmalahti
Copy link
Contributor

  • Add filter for catalogAddMenu context menu items. Extension can e.g. filter certain menu items from the context menu.
  • Example use:
const disposer = kubernetesClusterCategory.addMenuFilter(item => item.title === "Add from kubeconfig");

The filter can be removed with the returned disposer:

disposer();
  • This is supported for all CatalogCategory classes.

@panuhorsmalahti panuhorsmalahti requested a review from a team as a code owner September 2, 2021 12:48
@panuhorsmalahti panuhorsmalahti force-pushed the feature/add-catalog-menu-filter branch from ac128f6 to bcd777d Compare September 2, 2021 12:48
@panuhorsmalahti panuhorsmalahti added the enhancement New feature or request label Sep 2, 2021
@panuhorsmalahti panuhorsmalahti added this to the 5.3.0 milestone Sep 2, 2021
@panuhorsmalahti panuhorsmalahti changed the title Add catalog menu filter Add catalogAddMenu filter to CatalogCategory Sep 2, 2021
chenhunghan
chenhunghan previously approved these changes Sep 2, 2021
Copy link
Contributor

@chenhunghan chenhunghan left a comment

Choose a reason for hiding this comment

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

LGTM

chenhunghan
chenhunghan previously approved these changes Sep 6, 2021
Copy link
Contributor

@chenhunghan chenhunghan left a comment

Choose a reason for hiding this comment

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

Looks great

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2021

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

public addMenuFilter(fn: AddMenuFilter): Disposer {
this.filters.add(fn);

return once(() => void this.filters.delete(fn));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only nit would be that if the category is removed, these should be removed too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? Do you mean if I call the Disposer returned by CatalogCategoryRegistry::add, I should remove the filters from the CatalogCategory instance? Doesn't sound right to me

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah probably not.

@Nokel81 Nokel81 merged commit 8e9dd50 into master Sep 13, 2021
@Nokel81 Nokel81 deleted the feature/add-catalog-menu-filter branch September 13, 2021 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants