-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1695 from kreuzwerker/missing-agent-warning
Rescue from AR:SubclassNotFound and allow to delete agents
- Loading branch information
Showing
10 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div class="container"> | ||
<div class='row'> | ||
<div class='col-md-12'> | ||
<div class="page-header"> | ||
<h3> | ||
<div class="alert alert-danger" role="alert"> | ||
Error: Agent(s) are 'missing in action' | ||
</div> | ||
</h3> | ||
</div> | ||
<blockquote> | ||
<p> | ||
You have one or more Agents registered in the database for which no corresponding definition is available in the source code: | ||
</p> | ||
<ul> | ||
<% @undefined_agent_types.each do |type| %> | ||
<li><%= agent_type_to_human(type) %></li> | ||
<% end %> | ||
</ul> | ||
<br/> | ||
<p> | ||
The issue most probably occurred because of one or more of the following reasons: | ||
</p> | ||
<ul> | ||
<li>If the respective Agent is distributed as a Ruby gem, it might have been removed from the <code>ADDITIONAL_GEMS</code> environment setting.</li> | ||
<li>If the respective Agent is distributed as part of the Huginn application codebase, it might have been removed from that either on purpose (because the Agent has been deprecated or been moved to an Agent gem) or accidentally. Please check if the Agent(s) in question are available in your Huginn codebase under the path <code>app/models/agents/</code>.</li> | ||
</ul> | ||
<br/> | ||
<p> | ||
You can fix the issue by adding the Agent(s) back to the application codebase by | ||
</p> | ||
<ul> | ||
<li>adding the respective Agent(s) to the the <code>ADDITIONAL_GEMS</code> environment setting. Please see <a href="https://github.com/cantino/huginn_agent" target="_blank">https://github.com/cantino/huginn_agent</a> for documentation on how to properly set it.</li> | ||
<li>adding the respective Agent(s) code to the Huginn application codebase (in case it was deleted accidentally).</li> | ||
<li>deleting the respective Agent(s) from the database using the button below.</li> | ||
</ul> | ||
<br/> | ||
<div class="btn-group"> | ||
<%= link_to icon_tag('glyphicon-trash') + ' Delete Missing Agents', undefined_agents_path, class: "btn btn-danger", method: :DELETE, data: { confirm: 'Are you sure all missing Agents should be deleted from the database?'} %> | ||
</div> | ||
</blockquote> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'capybara_helper' | ||
|
||
describe "handling undefined agents" do | ||
before do | ||
login_as(users(:bob)) | ||
agent = agents(:bob_website_agent) | ||
agent.update_attribute(:type, 'Agents::UndefinedAgent') | ||
end | ||
|
||
it 'renders the error page' do | ||
visit agents_path | ||
expect(page).to have_text("Error: Agent(s) are 'missing in action'") | ||
expect(page).to have_text('Undefined Agent') | ||
end | ||
|
||
it 'deletes all undefined agents' do | ||
visit agents_path | ||
click_on('Delete Missing Agents') | ||
expect(page).to have_text('Your Agents') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters