Skip to content

Commit

Permalink
Merge pull request huginn#1462 from dsander/fix-job-management
Browse files Browse the repository at this point in the history
Fix internal jobs being shown as deleted
  • Loading branch information
dsander committed Apr 29, 2016
2 parents e436a89 + f1ecae6 commit 01596c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/helpers/jobs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ def relative_distance_of_time_in_words(time)
#
# Can return nil, or an instance of Agent.
def agent_from_job(job)
if data = YAML.load(job.handler.to_s).try(:job_data)
data = YAML.load(job.handler.to_s).try(:job_data)
case data['job_class']
when 'AgentCheckJob', 'AgentReceiveJob'
Agent.find_by_id(data['arguments'][0])
when 'AgentRunScheduleJob'
"Run Agent schedule '#{data['arguments'][0]}'"
when 'AgentCleanupExpiredJob'
'Run Event cleanup'
when 'AgentPropagateJob'
'Run Event propagation'
else
false
end
Expand Down
4 changes: 3 additions & 1 deletion app/views/jobs/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<table class='table table-striped events'>
<tr>
<th>Status</th>
<th>Agent</th>
<th>Agent / Job</th>
<th>Created</th>
<th>Next Run</th>
<th>Attempts</th>
Expand All @@ -25,6 +25,8 @@
<td><% case agent = agent_from_job(job)
when Agent
%><%= link_to(agent.name, agent_path(agent)) %><%
when String
%><%= agent %><%
when false
%>(system)<%
when nil
Expand Down

0 comments on commit 01596c7

Please sign in to comment.