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

Sidebar panel extension #10111

Merged
merged 27 commits into from
Dec 12, 2023
Merged

Sidebar panel extension #10111

merged 27 commits into from
Dec 12, 2023

Conversation

kulmann
Copy link
Member

@kulmann kulmann commented Dec 4, 2023

Description

This PR introduces a new extension point sidebarPanel, which allows apps to register additional panels for the right sidebar. It also extracts the right sidebar that was specific to the files app into a generic FileSideBar component which lives in the web-pkg package. The FileSideBar is then used in all viewer and editor apps so far to display a right sidebar with the files sidebar panels which were registered by the files app. I.e. panels live in web-app-files, but are used in any viewer/editor app as well.

Related Issue

Motivation and Context

Provide files app functionality like viewing file details, sharing, etc, directly in viewers and editors. Make it possible for viewer/editor apps to bring their own right sidebar panels and display them along the other files app sidebar panels.

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

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • either use AppWrapper in preview app or embed the FileSideBar directly in the preview app
  • debug file info panel in apps (missing information, e.g. share indicators and last modified date)
  • double-/triple-check sidebar edge cases in files app regarding shares (e.g. sub-folder inside a share): is the share info loaded correctly?
  • find a place for the right sidebar toggle button in apps
  • details panel: disable previews in file details, the editor/app is BETTER than the preview ;-) only display the icon.
  • update file size and last modified date on save in editors :-)
  • fix panzoom-bug in preview app when navigating through images with open sidebar
  • fix sidebar width in apps

Copy link

update-docs bot commented Dec 4, 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.

@kulmann
Copy link
Member Author

kulmann commented Dec 6, 2023

@janackermann @lookacat @JammingBen @dschmidt this PR is not quite done, but I'd like to ask for a critical review of three specific things (+ discussion together in a video call probably). This PR changes the SideBarPanel interface and exposes a new extension type for the panel. Hence I'd like to give it some extra brain power so that we don't publicly release a new extension point with maybe obvious issues I just didn't see...

The new SideBarPanelExtension interface lives in packages/web-pkg/src/composables/piniaStores/extensionRegistry.ts. Pretty minimalistic, should be ok, but just for the sake of completeness. This is the interface that needs to be implemented in order to register side bar panels for the right sidebar from any app/extension.

The Panel interface has been renamed to SideBarPanel in the course of making this an official extension point. It lives in packages/web-pkg/src/components/SideBar/types.ts. This is the interface where I'd like to ask you guys to look very closely if this has rough edges or even major issues. I decided to go for callbacks instead of getters or props with primitive types because that way we can get rid of the old style of having a generator function.

You can have a look at the new interface in action in packages/web-app-files/src/fileSideBars.ts where all right sidebar panels of the files app are defined. With one major difference: these right sidebar panels are now registered by the files app to be used in every other app which has a file context. That's already working for all the editors we have. It's somewhat broken in the preview app, working on that today. Just wanted you to see how a panel definition and registration looks like with the new interfaces.

There is one new component, which is the FileSideBar.vue. That is the one dynamically querying registered panels.

You can check out the PR and run it, it is already in quite a good shape...

  • within the files app the goal is that you don't recognize any difference ;-)
  • e.g. open a text file in the text editor. For the WIP state of the PR there is a dummy button in the topbar for opening and closing the right sidebar. Still need to figure out a good place for that... you should be able to do really just anything that also works in the files app (sharing, tagging, version management, etc).

There is a list of TODO items in the PR description. Please check there before you throw any missing features at me. ;-)

@AlexAndBear
Copy link
Contributor

Do you plan to have something similar like FileSideBar.vue and fileSideBars.ts for web-app-admin-settings as well?
so we will only have one or two files for the Sidebar here as well? I think that could make sense as the current Views are getting tooo big :(

@AlexAndBear
Copy link
Contributor

AlexAndBear commented Dec 6, 2023

About the correct place for the sidebar toggle in apps:
I'd go with a light transparent toggle button, that is located at the same position as the x button in the sidebar. If that is not an option, because it might look bad with OO or Collabroa, I think it's time to refactor the app-top-bar and give it a 3 dot menu. As it doesn't look so nice anyways, maybe toby can come up with some cool figma mockups

packages/web-app-files/src/fileSideBars.ts Show resolved Hide resolved
packages/web-app-files/src/fileSideBars.ts Outdated Show resolved Hide resolved
packages/web-client/src/helpers/resource/types.ts Outdated Show resolved Hide resolved
packages/web-pkg/src/components/SideBar/FileSideBar.vue Outdated Show resolved Hide resolved
Comment on lines 5 to 9
export interface SideBarPanelContext<P, T extends Item> {
parent?: P
items?: T[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just some unfiltered thought process:

Do we need the space in the future? I'm a bit torn. On one hand, it's quite files-specific since we don't have a space in the admin-settings e.g. But then again, you could say the same about parent.

The only reason to add it here would be to have it available in isVisible and isRoot, right? Might be helpful if I want my panel to be visible in project spaces only. It could also save us from some of the not-so-nice route checks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Trying to keep the generic scope, I added a root field to the context interface and set the space as root wherever possible. Not using it, yet, but I agree that it makes a whole lot of sense to have the space root available.

@@ -0,0 +1,3 @@
export interface Item {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a fan of the naming because it's so generic, even if its just there to extend existing interfaces

Copy link
Member Author

Choose a reason for hiding this comment

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

this interface indeed as generic as it can get, so I kind of like the name... do you have an idea for a better name? open for suggestions!
The reason why I introduced the interface is to be able to always require an id property on the items in a sidebar panel context.

packages/web-pkg/src/components/SideBar/FileSideBar.vue Outdated Show resolved Hide resolved
@JammingBen

This comment was marked as outdated.

@kulmann kulmann force-pushed the sidebar-panel-extension branch 2 times, most recently from 86bf0ab to 4200b4d Compare December 7, 2023 13:14
@dschmidt

This comment was marked as outdated.

@kulmann kulmann force-pushed the sidebar-panel-extension branch 2 times, most recently from 45091a4 to 73f3cca Compare December 11, 2023 11:35
@kulmann kulmann marked this pull request as ready for review December 11, 2023 22:00
@kulmann kulmann self-assigned this Dec 12, 2023
Copy link
Collaborator

@JammingBen JammingBen left a comment

Choose a reason for hiding this comment

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

LGTM 👍

There are still some occurrences of fileSideBars in the code base, we should deprecate/remove them in a follow-up.

Copy link

sonarcloud bot commented Dec 12, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 179 Code Smells

48.6% 48.6% Coverage
0.5% 0.5% Duplication

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

@kulmann kulmann merged commit 673783c into master Dec 12, 2023
3 of 4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the sidebar-panel-extension branch December 12, 2023 10:50
ownclouders pushed a commit that referenced this pull request Dec 12, 2023
* feat: introduce sidebar panels as extension point

---------

Co-authored-by: Dominik Schmidt <dev@dominik-schmidt.de>
Co-authored-by: Jannik Stehle <jannik.stehle@gmail.com>
@dschmidt
Copy link
Member

😍 😍 😍

AlexAndBear pushed a commit that referenced this pull request Dec 13, 2023
* feat: introduce sidebar panels as extension point

---------

Co-authored-by: Dominik Schmidt <dev@dominik-schmidt.de>
Co-authored-by: Jannik Stehle <jannik.stehle@gmail.com>
@micbar micbar mentioned this pull request Dec 15, 2023
71 tasks
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.

None yet

4 participants