ForestAdmin / forest-express

🧱 Dependency of Express Lianas for Forest Admin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for custom routes for Smart Actions

j0nd0n7 opened this issue · comments

Smart actions maps automatically the action name to the action route converting to lowercase and replacing spaces with -
Cancel Order => cancel-order

There is no way to allow an smart action to be displayed like "Cancel" but the route be "cancel-order" or "cancel-payment" in the same app.

Another use case is to display an action in some Language different to english but keep code in english.

hey @jdonzet, you can actually do this with current Forest lianas.
The endpoint option should do the job for your use cases.

screen shot 2018-04-29 at 21 09 39

Cool Thanks! my bad!
From where is that screenshot?

No problem. The screenshot is from the "Lumber" part of the documentation (Lumber uses the forest-express-sequelize). This part of the documentation is more recent than the express-sequelize and express-mongoose documentation. This is actually our fault, with a better documentation, you would never have posted an issue.

🌲🌲🌲

Doesn't work with current version of forest-express-mongoose@2.8.3
When endpoint is specified, no api call is made from the admin web app (I checked the network traffic to confirm it).
If no endpoint is specified, everything works fine.

Hey @jdonzet, here is an example of code that perfectly works on my side:

const Liana = require('forest-express-mongoose');

Liana.collection('Customer', {
  actions: [{
    name: 'Refresh cache',
    endpoint: '/forest/customer/actions/refresh-cache',
  }],
});