feat(files): add space header extension point#2725
Conversation
Add `app.files.space-header` extension point that allows extensions to provide a custom component in place of the default SpaceHeader on project space frontpages. When an extension registers at this point, its component is rendered instead of the built-in SpaceHeader. When no extension is registered, the default SpaceHeader is shown as before. This enables folder view extensions to render their own space header with domain-specific information without modifying the core.
| <template v-else> | ||
| <space-header v-if="isSpaceFrontpage" :space="space" class="px-4" /> | ||
| <custom-component-target | ||
| v-if="isSpaceFrontpage && hasSpaceHeaderExtension" |
There was a problem hiding this comment.
I'd rather make this extension point a bit more generic by removing the check on isSpaceFrontpage. This way, it would not only go for project spaces, but for all generic spaces. You can then further specify in your extension when it should be displayed.
And then maybe rather name the extension point app.files.generic-space-header.
| <space-header | ||
| v-else-if="isSpaceFrontpage" | ||
| :space="space" | ||
| class="px-4" | ||
| /> |
There was a problem hiding this comment.
Please don't hide this if a generic space header extension was found. There might be extensions were you actually want both.
We don't have a final solution for this yet, but for the time being, you could hide the space header in your custom extension via CSS.
…ader Per review feedback: - Extension point renamed to app.files.generic-space-header - Removed isSpaceFrontpage check — extensions decide visibility - Default SpaceHeader always rendered (not hidden by extension) - Extensions can hide the default SpaceHeader via CSS if needed
- CustomComponentTarget: track mounted children, show fallback slot when no extension renders visible content (Comment nodes skipped) - GenericSpace: use fallback slot for SpaceHeader — only rendered when extension decides not to render its own header - Ensures extension point works as passthrough: if extension renders nothing (v-if="false"), default SpaceHeader appears as fallback
|
This was just missing a format and a rebase (same as your other PR #2726). The last commit 1e3a9d0 I don't quite like. The approach will become an issue as soon as What were you missing without that commit? |
|
Thanks for the review! Let me clarify the intent here: This extension point is specifically a replacement pattern, not an additive one. The use case is: an app provides its own complete space header, replacing the default one entirely. Showing both headers side by side doesn't make sense in this scenario — it would look broken. The fallback mechanism handles this cleanly: if the extension renders visible content, the default header is hidden. If it doesn't (e.g. the extension decides it's not applicable), the default header shows up as normal. This is more robust than hiding the default header via CSS from the extension side. Regarding making it more generic (removing the |
I get your intention, still, development for the extension system always needs a broader view on the ecosystem. The current implementation is good for your use case, when there is exactly extension on that extension point. But it won't work for multiple extensions (e.g. another app wants to display additional content, not replace it). Hence I'd prefer build it in a more generic way that satisfies both use cases. The only thing missing for you would be a way to hide the existing space header. Doing this via CSS feels quite brittle, I agree. Another, cleaner approach would be to first register the existing space header on the new extension point (this should be done anyways), then, in your app, disable or unregister it via its id. |
Summary
Add
app.files.space-headerextension point (typecustomComponent) that allows extensions to replace the defaultSpaceHeaderon project space frontpages with a custom component.Motivation
Folder view extensions (e.g. typed folder views, DMS views) need to render their own space header with domain-specific information (icons, metadata, action buttons). Currently the only option is to modify GenericSpace.vue in the core, which creates maintenance burden and tight coupling.
This extension point follows the same pattern as the existing
app.files.sidebar.*andapp.files.folder-views.*extension points.Changes
extensionPoints.tsspaceHeaderExtensionPointdefinitionGenericSpace.vueCustomComponentTargetif present, otherwise defaultSpaceHeaderHow extensions use it
Backward compatibility
No breaking changes. When no extension registers at this point, the default
SpaceHeaderrenders exactly as before.