Skip to content

Comments

feat(sidebar): provide public API to register a sidebar tab#1305

Closed
susnux wants to merge 1 commit intomainfrom
feat/sidebar-api
Closed

feat(sidebar): provide public API to register a sidebar tab#1305
susnux wants to merge 1 commit intomainfrom
feat/sidebar-api

Conversation

@susnux
Copy link
Contributor

@susnux susnux commented Aug 13, 2025

This replaces the legacy OCA.Files.Sidebar.
It also allows to define the order of the tab to prevent different order depending on the localized name like with the legacy tabs.

We probably need to support both in the files app for at least one version as we too short on the feature freeze - but at least this allows to properly use the Node API from this library inside tabs - instead of the old FileInfo model.

@susnux susnux requested a review from skjnldsv August 13, 2025 16:56
@susnux susnux added type: enhancement 🚀 New feature or request 2. developing 2️⃣ Work in progress labels Aug 13, 2025
@susnux susnux added 3. to review 3️⃣ Waiting for reviews and removed 2. developing 2️⃣ Work in progress labels Aug 13, 2025
skjnldsv

This comment was marked as resolved.

*
* @param active - The new active state of this tab
*/
setActive: (active: boolean) => void | Promise<void>
Copy link
Contributor

Choose a reason for hiding this comment

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

So, we've been using events lately since you introduced them :)
Maybe it's time to make it a common pattern at Nextcloud?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this is the opposite direction - currently this is used by the sidebar to notify a tab that is was "navigated to".
So that it could e.g. refresh its content.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah 🤦

* The lifecycle method for unmounting the sidebar tab.
* This is called if the sidebar is unmounted from the files app and thus the sidebar tab needs to do its cleanup and unmounting.
*/
unmount: () => void | Promise<void>
Copy link
Contributor

Choose a reason for hiding this comment

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

destroy maybe? I think unmounting is an odd edge case. We should maybe be clearer and let devs know the sidebar is actually destroyed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would work for me - no strong opinion. I just used the names of the Vue lifecyles (mount and unmount).

But it could also be that the tab is only unmounted but the sidebar is not destroyed (e.g. the current node is changed to something this tab is not enabled for).

Copy link
Contributor

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

See comments :)

This replaces the legacy `OCA.Files.Sidebar`.
It also allows to define the order of the tab to prevent diffent order
depending on the localized name like with the legacy tabs.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux requested a review from skjnldsv August 14, 2025 08:16
Copy link
Contributor Author

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Question about this:

  • keep this approach
  • use web components as we do for workflowengine and files_sharing?

Just to align on a common API pattern :)

@skjnldsv
Copy link
Contributor

  • use web components as we do for workflowengine and files_sharing?

This.
Incoming Viewer app is also using web components

@susnux
Copy link
Contributor Author

susnux commented Oct 28, 2025

@skjnldsv thank you for confirmation! :)

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

Labels

3. to review 3️⃣ Waiting for reviews type: enhancement 🚀 New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants