Git Product home page Git Product logo

chore_runner's People

Contributors

berkelmas avatar chris-allen-pepsi avatar cjfreeze avatar eamouzou avatar ericsullivan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chore_runner's Issues

Support for {phoenix_live_view ~> "0.18"}?

Hey,

The dep seems great, but it uses and older live_view version.
Any chance to support newer versions?

I added override: true to my phoenix_live_view dep, which allows me to install chore_runner, but compilation fails.

warning: passing a string as a layout template in use options is deprecated, please pass an atom, such as :live instead of "live.html"
  (phoenix_live_view 0.18.3) 

Thanks

Feature idea: ability to pass chore input values via URL query parameters on an opt-in basis as part of the inputs options spec.

Hey Chris & co,

Love the library and have found it invaluable to create custom one-off admin job tooling with papertrail and the likes baked in.

One little feature idea we had recently was to make it possible to pass in chore input values via URL query string params, as this would allow us to set up nicely deep-linked shortcuts to open a chore from another admin page with some job details pre-filled.

Example use-case:

If we have some admin page with a list of users, and need to run a one-off chore for a particular user, amazing to be able to link to the relevant chore job with the user's id input argument pre-filled in the chore, to avoid us making one-off copy-pasta mistakes when running the job.

Would be great to be able to opt-in as part of the chore inputs options DSL, which ones we want to be pre-fillable via query parameter.

Then from the chore URL in the route, the values for those inputs could be pre-filled based on the decoded corresponding query param from the URL.

Concrete example, say I have a chore called TopupUserPointsBalance and it takes a user_id as one of its inputs.

In the inputs DSL I could specify eg (placeholder name proposal of a new allow_query_param option to specify opt-in to this behavior, although I personally wouldn't mind if it was default supported for all input fields that are expressible in query params!):

  def inputs,
    do: [
      string(:user_id, validators: [&check_user_id/1], allow_query_param: true),
    ]

Then say my chore runner route is specified as /chores/, I could visit this URL then to have the user_id input pre-filled on the job:

/chores?chore=TopupUserPointsBalance&user_id=the_user_id

to have the_user_id prefilled in the user_id input field.

Thanks & LMK if you / others would see value in this addition!

Understand the project cannot take PRs directly due to licensing/corporate constraints, but would still be happy to contribute a reference PR if this would be helpful.

Think possible to keep the changes very narrowly scoped with a small helper fn addition to ChoreLive and the Input.input_options spec.

All the best & thanks again for sharing this project with the broader community,
Ethan

Inputs form not rendered correctly (always empty)

First of all, thanks for the library, it's awesome!
I watched your talk on ElixirConf 2021 and I was amazed. Fortunately, I got a chance to give it a try now.

However, when I followed the README document and my input definition doesn't work.

The issue

My module is quite simple:

defmodule MyApp.Chores.MyChore do
  use ChoreRunner.Chore

  def input do
    [
      string(:platform)
    ]
  end
  
  def run(inputs) do
    log(["hi, I'm running, inputs:", inspect(inputs)])
    :ok
  end
end

Expected behavior

An input form that allows me to enter some text.

Actual behavior

The input form in the UI is empty and the logged inputs value is always %{}.

The cause

After some digging, I found that actually, the function name should be inputs (plural form).
I changed the name to inputs and it now works.

So, I think in the README, it should be inputs/0 instead of input/0, and we can add @impl true before these callback functions so that the compiler can help validate the names.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.