Hi everyone,
I am the developer of the HEIC/ HEIF Image Converter app and currently try to port it to Nextcloud 28, since I noticed that this time a simple version bump is not enough to get it running again.
In this application, I make heavy use of methods/ properties from the OCA.Files namespace, and it seems like using those is more or less deprecated.
As far as I am concerned, “modern” apps should use the methods of the separate NPM module: @nextcloud/files
While this approach seems to be working fine to register file actions I noticed that it doesn’t give me the same parameters in the handler.
Especially, I am missing the “context” parameter that was present on the legacy (?) OCA.Files.FileAction.registerAction() method’s “action” handler signature.
I used this context object to set the busy state of the files (context.fileList.showFileBusyState()) and trigger a reload (context.fileList.reload()) once my action was completed.
I guess that this is just not yet part of the new API, or am I missing something?
Maybe even out of scope for the NPM modules, because it’s too low level? I don’t know…
Anyway, the real problem that I have is that even once the whole Nextcloud website finished loading, I don’t have access to the old OCA.Files.App and OCA.Files.fileActions APIs anymore.
The only thing that is returned is this:
This is of course just a fraction of the old OCA.Files APIs.
Is this a bug, or am I doing something wrong here?
As you can see in my test case I am using the browser console, once everything has finished loading, but I also tried to access them from within my app, both using Util::addInitScript and Util::addScript.
In both cases the results were the same.
Edit: I am using Nextcloud 28.0.3 RC1 for my development setup.
Oh okay seems like i missed this part of the changelog. Thanks for the hint.
I think that’s a pretty drastic change, especially since those APIs weren’t deprecated before.
So what is the suggested alternative to set the busy state of a file or reload the fileList?
Is there any?
Oh wow I am really surprised and disappointed by that.
I had hoped that the existing public APIs had only been moved to a new repository, not completely removed without any deprecation notice before.
Is there any chance that a feature request to add those APIs to the new modules would be accepted?
I guess the only alternative that I have otherwise is to completely reload the page whenever I add a new file on the server side, right?
OCA is never public API but private API of the app, only OCP is considered public (thats what the P stands for) and will get proper deprecation.
So what is the suggested alternative to set the busy state of a file or reload the fileList?
Currently available API is this one:
You can interact with the files list using the Nextcloud eventbus and following events:
files:node:created → Add a new node without need of reload
files:node:deleted → Delete a node from the list
files:node:updated → Update a node
All that events take a node as the parameter see the @nextcloud/files documentation for the Node class interface. Those events will then update the files list view.
And also OCP.Files.Router with:
/**
* Trigger a route change on the files app
*
* @param path the url path, eg: '/trashbin?dir=/Deleted'
* @param replace replace the current history (default false)
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goTo(path: string, replace?: boolean): Promise<Route>;
/**
* Trigger a route change on the files App
*
* @param name the route name
* @param params the route parameters
* @param query the url query parameters
* @param replace replace the current history
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goToRoute(
name?: string,
params?: Record<string, string>,
query?: Record<string, string | (string | null)[] | null | undefined>,
replace?: boolean,
): Promise<Route>;
Hello @susnux ,
Thanks for the clarification about the OCA namespace, I didn’t know about it.
I will see how far i get with the current eventbus and router implementation and report when I’m done.
Are you really searching for the same feature as the original poster? If yes, all right, go ahead. If no, please open a new topic (possibly adding a link to this topic) to keep concerns separated.
Side question:
Where should the button be? What is a view in your terms?
thanks u, after researching, i think i did it, based on recommendations app in github,
First time I try search at docker code mount in folder, but it is so hard.
After searching, I found solution at app recommendations github, I created button at headers
successful