agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 523 forks source link

[FR] Custom buttons to call outer actions (eg. build command for SSG websites) #1454

Open szegheo opened 3 years ago

szegheo commented 3 years ago

Cockpit is great ❤️ , I'm using it to feed my static generated websites but there's one thing I miss so much:

Custom buttons to call outer actions (URLs) like: Build production site, Build preview site, whatever...

Registering these buttons should be implemented almost the same as webhooks with a form like this:

Registered buttons could be visible on the Dashboard or in the top menu with a dropdown showing the registered actions (buttons).

What do you think? Thank you!

andersanmiguel commented 3 years ago

Hi, I am facing the same problem, my first thought was to simply use webhooks with some event like singleton.saveData.after (I am using only singletons at the moment) but I wanted to be able to call this action on demand.

Also, I am using Github Actions to build my site and it is required to send a custom field in the body (event_type) and is not possible to do that with the current webhook implementation: https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event

I've done an addon very tailored to my needs, it adds a button to the menu and requests the Github URL. https://github.com/andersanmiguel/cockpit-github-webhook/

I was thinking on make a pull request to try to integrate the ability to add custom body fields to the webhooks and then modify the addon to simply trigger an event, but I don't know if it would be better to make an addon that duplicates almost all the webhook functionality and leave the core as it is.

What do you think is better?