Skip to content
This repository was archived by the owner on Nov 23, 2026. It is now read-only.

feat: add registering nav items via extension - #9814

Merged
JammingBen merged 2 commits into
masterfrom
nav-item-extension
Oct 17, 2023
Merged

JammingBen merged 2 commits into
masterfrom
nav-item-extension

Conversation

@JammingBen

@JammingBen JammingBen commented Oct 16, 2023 •

Copy link
Copy Markdown
Contributor

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

update-docs Bot commented Oct 16, 2023

Copy link
Copy Markdown

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.

@dschmidt dschmidt left a comment

Copy link
Copy Markdown
Member

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
@sonarqubecloud

Copy link
Copy Markdown

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
@delete-merged-branch
delete-merged-branch Bot deleted the nav-item-extension branch October 17, 2023 06:38
@lookacat

Copy link
Copy Markdown
Contributor

very nice change 👍🏼

@elizavetaRa

Copy link
Copy Markdown
Contributor

Very cool!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Nav-Items to left sidebar

5 participants