_options.erb 2.1 KB

123456789101112131415161718192021222324252627282930
  1. <% if agent.is_form_configurable? %>
  2. <fieldset>
  3. <% if agent.persisted? %>
  4. <%= hidden_field_tag 'agent[type]', @agent.type %>
  5. <% end %>
  6. <legend>Options</legend>
  7. <% agent.form_configurable_attributes.each do |attribute| %>
  8. <div class="form-group">
  9. <%= label_tag attribute %>
  10. <%= agent.option_field_for(attribute) %>
  11. <span class="glyphicon glyphicon-ok form-control-feedback hidden"></span>
  12. <span class="glyphicon glyphicon-remove form-control-feedback hidden"></span>
  13. </div>
  14. <% end %>
  15. </fieldset>
  16. <% else %>
  17. <div class="form-group">
  18. <%= label_tag :options %>
  19. <span class="glyphicon glyphicon-question-sign hover-help" data-content="In this JSON hash, interpolation is available in almost all values using the Liquid templating language.<p>Available template variables include the following:<dl><dt><code>message</code>, <code>url</code>, etc.</dt><dd>Refers to the corresponding key's value of each incoming event's payload.</dd><dt><code>agent</code></dt><dd>Refers to the agent that created each incoming event. It has attributes like <code>type</code>, <code>name</code> and <code>options</code>, so <code>{{agent.type}}</code> will expand to <code>WebsiteAgent</code> if an incoming event is created by that agent.</dd></dl></p><p>To access user credentials, use the <code>credential</code> tag like this: <code>{% credential <em>bare_key_name</em> %}</code></p>"></span>
  20. <textarea rows="15" id="agent_options" name="agent[options]" class="form-control live-json-editor">
  21. <%= Utils.jsonify((agent.new_record? && agent.options == {}) ? agent.default_options : agent.options) %>
  22. </textarea>
  23. </div>
  24. <% end %>
  25. <div class="form-group">
  26. <%= submit_tag "Save", :class => "btn btn-primary" %>
  27. <% if agent.can_dry_run? %>
  28. <%= button_tag class: 'btn btn-default agent-dry-run-button', type: 'button', 'data-action-url' => agent.persisted? ? agent_dry_runs_path(agent) : dry_runs_path(type: agent.type), 'data-with-event-mode' => agent_dry_run_with_event_mode(agent) do %><%= icon_tag('glyphicon-refresh') %> Dry Run<% end %>
  29. <% end %>
  30. </div>