mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Allow controllers to be selected
This commit is contained in:
parent
0abc42fb40
commit
3ffe667f9e
2 changed files with 24 additions and 4 deletions
|
@ -51,13 +51,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="controller-region" data-has-controllers="<%= !@agent.controllers.empty? %>">
|
||||
<div class="controller-region">
|
||||
<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>
|
||||
<%= f.select(:controller_ids,
|
||||
options_for_select(current_user.agents.select(&:can_control_other_agents?).pluck(:name, :id),
|
||||
@agent.controller_ids),
|
||||
{}, { multiple: true, size: 5, class: 'select2-linked-tags form-control', data: {url_prefix: '/agents'}}) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -80,6 +80,25 @@ describe "Creating a new agent", js: true do
|
|||
|
||||
expect(agent.control_targets).to eq([bob_weather_agent])
|
||||
end
|
||||
|
||||
it "creates an agent with a controller" do
|
||||
visit "/"
|
||||
page.find("a", text: "Agents").trigger(:mouseover)
|
||||
click_on("New Agent")
|
||||
|
||||
select_agent_type("Weather Agent")
|
||||
fill_in(:agent_name, with: "Test Weather Agent")
|
||||
|
||||
select2("Example Scheduler", from: 'Controllers')
|
||||
|
||||
click_on "Save"
|
||||
|
||||
expect(page).to have_text("Test Weather Agent")
|
||||
|
||||
agent = Agent.find_by(name: "Test Weather Agent")
|
||||
|
||||
expect(agent.controllers).to eq([bob_scheduler_agent])
|
||||
end
|
||||
end
|
||||
|
||||
it "creates an alert if a new agent with invalid json is submitted" do
|
||||
|
|
Loading…
Add table
Reference in a new issue