_action_menu.html.erb 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <ul class="dropdown-menu" role="menu">
  2. <% if agent.can_be_scheduled? %>
  3. <li>
  4. <%= link_to icon_tag('glyphicon-refresh', class: 'color-success') + ' Run', run_agent_path(agent, return: return_to), method: :post, tabindex: "-1" %>
  5. </li>
  6. <% end %>
  7. <% if agent.can_dry_run? %>
  8. <li>
  9. <%= link_to icon_tag('glyphicon-refresh') + ' Dry Run', '#', 'data-action-url' => agent_dry_runs_path(agent), 'data-with-event-mode' => agent_dry_run_with_event_mode(agent), tabindex: "-1", onclick: "Utils.handleDryRunButton(this)" %>
  10. </li>
  11. <% end %>
  12. <li>
  13. <%= link_to icon_tag('glyphicon-eye-open') + ' Show'.html_safe, agent_path(agent, return: return_to) %>
  14. </li>
  15. <li class="divider"></li>
  16. <li>
  17. <%= link_to icon_tag('glyphicon-pencil') + ' Edit agent'.html_safe, edit_agent_path(agent, return: return_to) %>
  18. </li>
  19. <li>
  20. <%= link_to icon_tag('fa-copy') + ' Clone agent'.html_safe, new_agent_path(id: agent), tabindex: "-1" %>
  21. </li>
  22. <li>
  23. <%= link_to '#', 'data-toggle' => 'modal', 'data-target' => "#confirm-agent#{agent.id}" do %>
  24. <% if agent.disabled? %>
  25. <%= icon_tag('glyphicon-play') %> Enable agent
  26. <% else %>
  27. <%= icon_tag('glyphicon-pause') %> Disable agent
  28. <% end %>
  29. <% end %>
  30. </li>
  31. <% if agent.scenarios.length > 0 %>
  32. <li class="divider"></li>
  33. <% agent.scenarios.each do |scenario| %>
  34. <li>
  35. <%= link_to icon_tag('glyphicon-remove-circle', class: 'color-warning') + " Remove from #{scenario_label(scenario)}".html_safe, leave_scenario_agent_path(agent, scenario_id: scenario.to_param, return: return_to), method: :put, tabindex: "-1" %>
  36. </li>
  37. <% end %>
  38. <% end %>
  39. <li class="divider"></li>
  40. <% if agent.can_create_events? && agent.events_count > 0 %>
  41. <li>
  42. <%= link_to icon_tag('glyphicon-trash', class: 'color-danger') + ' Delete all events', remove_events_agent_path(agent, return: return_to), method: :delete, data: {confirm: 'Are you sure you want to delete ALL emitted events for this Agent?'}, tabindex: "-1" %>
  43. </li>
  44. <% end %>
  45. <li>
  46. <%= link_to icon_tag('glyphicon-remove', class: 'color-danger') + ' Delete agent', agent_path(agent, return: return_to), method: :delete, data: { confirm: 'Are you sure that you want to permanently delete this Agent?' }, tabindex: "-1" %>
  47. </li>
  48. </ul>
  49. <div id="confirm-agent<%= agent.id %>" class="confirm-agent modal fade" tabindex="-1" role="dialog" aria-labelledby="confirmAgentLabel" aria-hidden="true">
  50. <div class="modal-dialog modal-sm">
  51. <div class="modal-content">
  52. <div class="modal-header">
  53. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  54. <h4 class="modal-title">Confirm</h4>
  55. </div>
  56. <div class="modal-body">
  57. <p><% if agent.disabled? %>Enable<% else %>Disable<% end %> &quot;<%= agent.name %>&quot;?</p>
  58. </div>
  59. <div class="modal-footer">
  60. <%= form_for(agent, as: :agent, url: agent_path(agent, return: return_to), method: 'PUT') do |f| %>
  61. <% if agent.disabled && agent.can_receive_events? %>
  62. <div class="form-group">
  63. <%= f.check_box :drop_pending_events %>
  64. <%= f.label :drop_pending_events, 'Drop pending events' %>
  65. <span class="glyphicon glyphicon-question-sign hover-help" data-content="As soon as you enable this agent, it starts to receive pending events that have not been processed while it was disabled. To prevent that from happening, you can check this option."></span>
  66. </div>
  67. <% end %>
  68. <%= f.hidden_field :disabled, value: (!agent.disabled).to_s %>
  69. <%= f.button 'No', class: 'btn btn-default', 'data-dismiss' => 'modal' %>
  70. <%= f.submit 'Yes', class: 'btn btn-primary' %>
  71. <% end %>
  72. </div>
  73. </div>
  74. </div>
  75. </div>