Hello, I am having trouble with the `extra_params`...
# avo-2
w
Hello, I am having trouble with the
extra_params
in the custom Resource Tool. The extra parameters I'm sending in the
:create
are not ones being saved on my database, but rather, getting JSON-ified in order to send to an AWS Secrets Manager. In my Resource tool, I have
Copy code
self.extra_params = [{
    the_secrets: %i[some_key some_token some_provider_id some_account_id]
}]
Then, like the docs say, I have a method in my model to parse the hash I'm receiving from `the_secrets`:
Copy code
def handle_secrets=(value)
  @those_secrets = value.to_json
end
The issue is, the
extra_params
method seems to be conflicting with the other permit I have for the required params needed for AWS (let's just say they're
:name, :type, :id
). I'm seeing two warnings for
Unpermitted parameters
with different values. Only one includes
the_secrets
hash I created. Does anyone know why this could be happening? https://docs.avohq.io/2.0/resource-tools.html#add-custom-fields-on-forms
l
Hey @wooden-pizza-89220. Happy to help. Shouldn't you have
def the_secrets=(value)
instead of
handle_secrets=
?
w
you're right - I just switched that over and I still have that error
l
but is the data being passed to the method?
that error is there because we run the
params.permit
method twice. once for the regular params and once for the extra params and the first time we don't permite the extra ones
w
The data is being correctly passed:
Copy code
def the_secrets=(value)
    @csecret_params = value.to_json
  end

def persist_in_secrets_manager
  -using @secret_params in here-
end
I'm able to create all of my data successfully and it persists in AWS in my QA instance. There are still 3
Unpermitted Parameters
that aren't getting used for AWS but are persisted to the DB.
l
perfect! glad to hear
w
Hey @lemon-wall-20836 do you think you'll ever add the styles for the main panel component to the generated
html.erb
file for resource tools/`Avo::PanelComponent`? I noticed you had a utility class called
input_classes
and was very thankful. I was able to copy-paste the classes from the main panel to get my resource tool to look similar, but thought that would be a nice-to-have. Also, in the docs for the native Panel Component, one of the options to include is
data
. I added it in after the title and description, made sure it was a hash, but I couldn't seem to access it even in pry. Could there be an addition to the docs on implementation?
l
Hey @wooden-pizza-89220. Are these two issues here?
Could I ask you to open issues on our repo? https://avo.cool/new-issue
I made it a "rule" not to offer technical support here. The reason is that Discord is not public and others might not get here to fix their issues. Most people go and search GitHub when they have an issue and I'd love it that anyone can get the help they need
also, discord is not the best medium for that. GH issues is a much better medium with proper code support and refernce
I'd love to help there
Thank you!
4 Views