webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

feat(api-headless-cms-tasks): HCMS bulk actions via background tasks

Open leopuleo opened this issue 1 year ago • 0 comments
trafficstars

Changes

With this PR, we are introducing the bulk actions handled via background tasks.

By default, the users will be able to perform the following bulk actions:

  • Publish entries
  • Unpublish entries
  • Move entries to a folder
  • Move entries to the trash bin
  • Restore entries from the trash bin
  • Permanently delete entries

api-headless-cms-tasks

The package is responsible for:

  • adding task definitions that create subtasks after listing entries selected for the provided bulk action
  • adding task definitions responsible for processing the subtasks created after listing
  • registering the CmsGraphQLSchemaPlugin allowing to trigger bulk actions via custom mutation

app-headless-cms + app-trash-bin

When all entries are selected, a new banner will prompt asking if the user wants to select all of them.

The banner will appear if:

  • more entries are present but not yet loaded in the list (hasMoreItems: true)
  • the current folder contains child folders - currently, we are not checking if child folders are empty

In case the user confirms the selection, the action will be performed by the designated background task instead of the default in-series client worker.

At the moment:

  • In the case of selecting “all entries,” the selected count (e.g., 15 entries selected) will be replaced by a generic “All entries selected” as the application doesn't know the number of entries in sub-folders without additional queries.
  • We are not providing real-time feedback on the background task status. The user needs to reload the page to see the status update.

How Has This Been Tested?

Jest + manually

Documentation

Needed user guide + developer guide

leopuleo avatar May 06 '24 06:05 leopuleo