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

feat: add registering nav items via extension #9814

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Conversation

JammingBen
Copy link
Contributor

@JammingBen JammingBen commented Oct 16, 2023

Description

Nav items can be registered with the new extension type SidebarNavExtension, which consists of a AppNavigationItem and optionally scopes (a list of app IDs where the nav item should show).

This PR also adds 2 new optional properties to the AppNavigationItem interface:

  • handler - a click handler that get executes on click. It takes priority over a given route.
  • priority - a number that determines the nav item's position.

Example extension:

{
  id: 'com.github.owncloud.web.nav.foobar',
  type: 'sidebarNav',
  scopes: ['admin-settings', 'files'],
  navItem: {
    isActive: () => false,
    enabled: () => true,
    name: () => 'Foo Bar',
    icon: 'close',
    handler: () => {
      console.log('some handler')
    },
    priority: 10
  }
}

Related Issue

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

@update-docs
Copy link

update-docs bot commented Oct 16, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Copy link
Member

@dschmidt dschmidt left a comment

Choose a reason for hiding this comment

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

I'm biased, so another review would be appreciated, but I'm surprisingly cool with this ;-)

@dschmidt dschmidt changed the title feat: add registering nav items via extenion feat: add registering nav items via extension Oct 16, 2023
@JammingBen JammingBen marked this pull request as ready for review October 16, 2023 14:22
@sonarcloud
Copy link

sonarcloud bot commented Oct 16, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

22.6% 22.6% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@JammingBen JammingBen merged commit b8bf549 into master Oct 17, 2023
1 of 2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the nav-item-extension branch October 17, 2023 06:38
@lookacat
Copy link
Contributor

very nice change 👍🏼

@elizavetaRa
Copy link
Member

Very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Nav-Items to left sidebar
5 participants