Merge pull request #1462 from dsander/fix-job-management

Fix internal jobs being shown as deleted

Dominik Sander преди 8 години
родител
ревизия
01596c7ff1
променени са 2 файла, в които са добавени 12 реда и са изтрити 2 реда
  1. 9 1
      app/helpers/jobs_helper.rb
  2. 3 1
      app/views/jobs/index.html.erb

+ 9 - 1
app/helpers/jobs_helper.rb

@@ -24,8 +24,16 @@ module JobsHelper
24 24
   #
25 25
   # Can return nil, or an instance of Agent.
26 26
   def agent_from_job(job)
27
-    if data = YAML.load(job.handler.to_s).try(:job_data)
27
+    data = YAML.load(job.handler.to_s).try(:job_data)
28
+    case data['job_class']
29
+    when 'AgentCheckJob', 'AgentReceiveJob'
28 30
       Agent.find_by_id(data['arguments'][0])
31
+    when 'AgentRunScheduleJob'
32
+      "Run Agent schedule '#{data['arguments'][0]}'"
33
+    when 'AgentCleanupExpiredJob'
34
+      'Run Event cleanup'
35
+    when 'AgentPropagateJob'
36
+      'Run Event propagation'
29 37
     else
30 38
       false
31 39
     end

+ 3 - 1
app/views/jobs/index.html.erb

@@ -11,7 +11,7 @@
11 11
         <table class='table table-striped events'>
12 12
           <tr>
13 13
             <th>Status</th>
14
-            <th>Agent</th>
14
+            <th>Agent / Job</th>
15 15
             <th>Created</th>
16 16
             <th>Next Run</th>
17 17
             <th>Attempts</th>
@@ -25,6 +25,8 @@
25 25
             <td><% case agent = agent_from_job(job)
26 26
                    when Agent
27 27
                    %><%= link_to(agent.name, agent_path(agent)) %><%
28
+                   when String
29
+                   %><%= agent %><%
28 30
                    when false
29 31
                    %>(system)<%
30 32
                    when nil