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

feat(developer_manual): 28 files-to-vue upgrade guide #11185

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ Front-end changes
Added APIs
^^^^^^^^^^

* tbd
* File actions: to register file actions, please use the dedicated API from https://npmjs.org/@nextcloud/files or
https://nextcloud-libraries.github.io/nextcloud-files/functions/registerFileAction.html
* New file menu: to register entries in the new file menu, please use the dedicated API from https://npmjs.org/@nextcloud/files or
https://nextcloud-libraries.github.io/nextcloud-files/functions/addNewFileMenuEntry.html
* Reminder from 27, to interact with the Files app router, use ``OCP.Files.Router``. See :ref:`FilesAPI`
* To Interact with the Files app data, please use the following events. All of them have a `Node object <https://nextcloud-libraries.github.io/nextcloud-files/classes/Node.html>`_ as main parameter.

* ``files:node:created``: the node has been created
* ``files:node:deleted``: the node has been deleted
* ``files:node:moved``: the node has been moved (and its data is already updated)
* ``files:node:updated``: the node data has been updated

Changed APIs
^^^^^^^^^^^^
Expand All @@ -39,6 +49,7 @@ Removed APIs

* ``OC.loadScript`` and ``OC.loadStyle``: Use ``OCP.Loader`` instead.
* ``OC.appSettings``: There is no replacement.
* ``OCA.Files``: Everything removed but Sidebar and Settings. See the Added API section for replacements.

Back-end changes
----------------
Expand Down
29 changes: 27 additions & 2 deletions developer_manual/client_apis/files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,33 @@ We will update and document the new files app APIs and methods here.
.. note:: Some external libraries offers in-depth technical documentation.
Please have a look at the following:

* https://github.com/nextcloud/nextcloud-files (`documentation <https://nextcloud.github.io/nextcloud-files/>`__)
* https://github.com/nextcloud/nextcloud-upload
* https://github.com/nextcloud-libraries/nextcloud-event-bus (`documentation <https://nextcloud-libraries.github.io/nextcloud-event-bus>`__)
* https://github.com/nextcloud-libraries/nextcloud-files (`documentation <https://nextcloud-libraries.github.io/nextcloud-files>`__)
* https://github.com/nextcloud-libraries/nextcloud-upload (`documentation <https://nextcloud-libraries.github.io/nextcloud-upload>`__)


Events
^^^^^^

To listen to files or folder changes or to trigger changes, you need to use
the ``event-bus`` and use the following events:

* ``files:node:created``: the node has been created
* ``files:node:deleted``: the node has been deleted
* ``files:node:moved``: the node has been moved (and its data is already updated)
* ``files:node:updated``: the node data has been updated

Example
-------

.. code-block:: ts

import type { Node } from '@nextcloud/files'
import { subscribe } from '@nextcloud/event-bus'

subscribe('files:node:created', (node: Node) => {
console.log('Node created', node)
})


Router
Expand Down