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

Use entities in dropdown choice arguments #247

Closed
FieldofClay opened this issue Mar 16, 2024 · 3 comments
Closed

Use entities in dropdown choice arguments #247

FieldofClay opened this issue Mar 16, 2024 · 3 comments
Labels
type: feature-request New feature request

Comments

@FieldofClay
Copy link

Is your feature request related to a problem? Please describe.
It would be awesome to use the new entities functionality to populate the choices for an action.

Describe the solution you'd like
Something like:

 - title: Restart Docker Container
   icon: restart
   shell: docker restart {{ container }}
   arguments:
     - name: container
       title: Container name
       entity: container
       choices:
         - value: {{ container.name }}

Describe alternatives you've considered
The dashboard functionality works, but having a single "restart" action with a dropdown would be less cluttered than a dozen "restart container" actions.

@jamesread
Copy link
Collaborator

Hey @FieldofClay , thanks for taking the time to write up this feature request.

This is entirely logical, I'm not sure why I didn't think of this before. I'm happy to implement this feature.

I'd need to look into how the arguments list is populated at the moment to remind myself of how that part of the code works, I want to make sure that the implementation of these doesn't make things too messy. Adding an entity field to the argument as well, might be the way to go. For example:

actions: 
  - title: restart container
    shell: docker restart {{ containerToRestart}} 
    arguments: 
      - name: containerToRestart 
        entity: container
        title: {{ container.name }} 

@jamesread
Copy link
Collaborator

This has now been implemented in the code and will be available in the next release of OliveTin, possibly tonight, possibly the next few days.

It is documented here; http://localhost/docs.olivetin.app/docs/arg-dropdowns.html#args-dropdown-entities

@jamesread
Copy link
Collaborator

Released in 2024.03.24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature-request New feature request
Development

No branches or pull requests

2 participants