-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[RFC] File actions API #21835
Comments
How would the proposal handle on which mimetype an action is returned and on which not? We also should have the possibility to make the action availabilty based on permissions, ideally just allow having a callback for the action itself to check if it should be presented. |
Right, so we should add a permission key. And then |
I would actually prefer to have this in a more generic approach so that we are not limiting the properties on which the decision if an action is shown or not is made. Something like this:
Other than that, what would the inline option do? Also there are some file actions that are rendering with more UI elements like the share entry or the files_lock app that might show an avatar and I think we should definitely still allow to provide a somehow richer interface than icon-class and text, but not sure about an ideal API there. |
To be rendered inline, like in files. Comments, sharing for example :) |
Yes, or provide the function with the element to render to as a reference, should work both ways. |
This assumes that you know file actions will be required for the page that is getting rendered. If your app is active on another app's page, it might not be able to trigger this. So in the end – to make the actions available everywhere – each app providing them would have to register at least a tiny portion of js on every page load, that can load the rest of the logic on demand. Unless we are able to load some script on certain occasions, like even after the page load. I don't have any experience with that. It could work, but it might also be fragile. I don't know. |
Php event to |
But |
Isn't it the point? I missed what you wanted to say I think 🤔 |
We can currently include arbitrary scripts when the page is loaded. So in order to decide if your script goes onto a a page you can either know that you need it (hard) or pessimistically load the script and leave it idle until something invokes it. This means lots of files are transferred even when the front-end does not use them. In my opinion the better solution would be to load scripts on demand. Like the page loads, the user interacts with it for a few minutes and then BAM we need file actions. At page load we didn't know this was a requirement, so the scripts are not there. Now it would be nice if we could load them, have them register their things and then use them. My point is that |
Sure, but the initial loaded script can also invoke an async bigger script, no?
But how can we do that? |
Define "fine". It will be one script for each action. So that could be zero, one or 15 if many apps use this integration. We already have lots of files to fetch, so this just adds to the overall slowness of Nextcloud.
Either we fetch a fresh list from the server or the list is sent with the initial page load.
Yep, that is the big downside 😟 |
So either lazy or via initial state I guess?
I have no idea how to do it in js. But that should work right? |
The only thing I can think of is webpack async loading. I'd honestly just go for a simple php Event to fire that call all the Actions scripts our devs registered? |
This comment has been minimized.
This comment has been minimized.
cc @nextcloud/server |
API
Issues
Currently, the file actions is super shady and not very standardised. You cannot request all actions for a file, nor dynamically load all scripts for a specific action.
This makes it hard to implement actions in other apps as the current implementation is deeply rooted into Files.
Goals
Proposal
js
php
With this, we would do the same as Sidebar or Viewer, we would create a dedicated
LoadActions
php event that you app can fire and every app that register actions will have to listen to this php event andaddScript
their own dedicated action script handler.Questions
run
&runMultiple
, any other ideas?Related issues
#9192
#5065
#12967
cc @ChristophWurst @jakobroehrl @juliushaertl @georgehrke @rullzer @MorrisJobke
cc from dedicated issues: @onny, @XA21X, @paspil, @ggeorgg, @dugite-code, @beanaroo, @janis91, @Thatoo, @szaimen, and @trendfischer @nickvergessen @jhass, @Thatoo, @mat-m, @juliushaertl, @kesselb, @sndrr, @ggeorgg
The text was updated successfully, but these errors were encountered: