[6.x] Asset container actions - #15461
Conversation
|
Nice! 🔥 Out of curiosity, what's your use case for asset container actions? |
|
I have a project where the client needs to upload results exports from running event time tracking systems. They're ZIP files that contain HTML/CSS/JS files as well as CSVs and PDFs. The files all link to each other and would get sanitised or could get disorganised if uploaded individually. There are also two different systems with different file structures. So to ensure everything always lands in the right place and is structured correctly I've built an action that lets them upload the ZIP directly, along with the event title/date, then the action creates the right folder structure and extracts the files (it also does its own checks to make sure there is nothing suspect in the ZIP). |
Refreshing only the listing left the container's own data (e.g. title) stale until a manual reload, unlike the equivalent collection-action flow which does a full reload.
This PR adds actions for asset containers, mirroring #10471 and #13137.
Notes:
actionsandactionUrlon the page as top level props. Containers go inside the existing container object asactionsandactions_url, because Browser.vue only receivescontainer.#headerslot, so container actions never show up inside a fieldtype.router.reload(). Containers refresh the listing in place instead.ContainerActionControllerrather thanAssetContainerActionControllerto matchFolderActionController.afterActionSuccessfullyCompletedmethod that nothing calls. TheItemActionsthere binds no@completedand the page doesn't use the HasActions mixin, so collection actions didnt fire toasts. That's also wired up now.