123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <% if @agent.errors.any? %>
- <div class="row well model-errors">
- <h2><%= pluralize(@agent.errors.count, "error") %> prohibited this Agent from being saved:</h2>
- <% @agent.errors.full_messages.each do |msg| %>
- <p class='text-warning'><%= msg %></p>
- <% end %>
- </div>
- <% end %>
- <%= form_for(@agent,
- :as => :agent,
- :url => @agent.new_record? ? agents_path : agent_path(@agent),
- :method => @agent.new_record? ? "POST" : "PUT") do |f| %>
- <div class="row">
- <div class="col-md-6">
- <div class="row">
- <div class="col-md-12">
- <% if @agent.new_record? %>
- <div class="form-group type-select">
- <%= f.label :type %>
- <%= f.select :type, options_for_select([['Select an Agent Type', 'Agent']] + Agent.types.map(&:to_s).sort.map {|type| [type.gsub(/^.*::/, ''), type] }, @agent.type), {}, :class => 'select2 form-control' %>
- </div>
- <% end %>
- </div>
- <div class="agent-settings">
- <div class="col-md-12">
- <div class="form-group">
- <%= f.label :name %>
- <%= f.text_field :name, :class => 'form-control' %>
- </div>
- <div class='oauthable-form'>
- <%= render partial: 'oauth_dropdown', locals: { agent: @agent } %>
- </div>
- <div class="form-group">
- <%= f.label :schedule, :class => 'control-label' %>
- <div class="schedule-region" data-can-be-scheduled="<%= @agent.can_be_scheduled? %>">
- <div class="can-be-scheduled">
- <%= f.select :schedule, options_for_select(Agent::SCHEDULES.map {|s| [s.humanize.titleize, s] }, @agent.schedule), {}, :class => 'form-control' %>
- </div>
- <span class='cannot-be-scheduled text-info'>This type of Agent cannot be scheduled.</span>
- </div>
- </div>
- <div class="controller-region" data-has-controllers="<%= !@agent.controllers.empty? %>">
- <div class="form-group">
- <%= f.label :controllers %>
- <span class="glyphicon glyphicon-question-sign hover-help" data-content="Other than the system-defined schedule above, this agent may be run or controlled by these user-defined Agents."></span>
- <div class="controller-list">
- <%= agent_controllers(@agent) || 'None' %>
- </div>
- </div>
- </div>
- <div class="control-link-region" data-can-control-other-agents="<%= @agent.can_control_other_agents? %>">
- <div class="can-control-other-agents">
- <div class="form-group">
- <%= f.label :control_targets %>
- <% eventControlTargets = current_user.agents.select(&:can_be_scheduled?) %>
- <%= f.select(:control_target_ids,
- options_for_select(eventControlTargets.map {|s| [s.name, s.id] },
- @agent.control_target_ids),
- {}, { multiple: true, size: 5, class: 'select2 form-control' }) %>
- </div>
- </div>
- </div>
- <div class='event-related-region' data-can-create-events="<%= @agent.can_create_events? %>">
- <div class="form-group">
- <%= f.label :keep_events_for, "Keep events" %>
- <span class="glyphicon glyphicon-question-sign hover-help" data-content="In order to conserve disk space, you can choose to have events created by this Agent expire after a certain period of time. Make sure you keep them long enough to allow any subsequent Agents to make use of them."></span>
- <%= f.select :keep_events_for, options_for_select(Agent::EVENT_RETENTION_SCHEDULES, @agent.keep_events_for), {}, :class => 'form-control' %>
- </div>
- </div>
- <div class="form-group">
- <%= f.label :sources %>
- <div class="link-region" data-can-receive-events="<%= @agent.can_receive_events? %>">
- <% eventSources = (current_user.agents - [@agent]).find_all { |a| a.can_create_events? } %>
- <%= f.select(:source_ids,
- options_for_select(eventSources.map {|s| [s.name, s.id] },
- @agent.source_ids),
- {}, { :multiple => true, :size => 5, :class => 'select2 form-control' }) %>
- <span class='cannot-receive-events text-info'>This type of Agent cannot receive events.</span>
- <%= f.label :propagate_immediately, :class => 'propagate-immediately' do %>Propagate immediately
- <%= f.check_box :propagate_immediately %>
- <% end %>
- </div>
- </div>
- <% if current_user.scenario_count > 0 %>
- <div class="form-group">
- <%= f.label :scenarios %>
- <span class="glyphicon glyphicon-question-sign hover-help" data-content="Use Scenarios to group sets of Agents, both for organization, and to make them easy to export and share."></span>
- <%= f.select(:scenario_ids,
- options_for_select(current_user.scenarios.pluck(:name, :id), @agent.scenario_ids),
- {}, { :multiple => true, :size => 5, :class => 'select2 form-control' }) %>
- </div>
- <% end %>
- </div>
- <div class="col-md-12 agent-options">
- <%= render partial: 'options', locals: { agent: @agent } %>
- </div>
- </div>
- </div>
- </div>
- <div class="col-md-6">
- <div class="row">
- <div class="col-md-12">
- <div class='well description'>
- <%= @agent.html_description unless @agent.new_record? %>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <div class='well event-descriptions' style='display: none'></div>
- </div>
- </div>
- </div>
- </div>
- <% end %>
|