|
| 1 | + |
| 2 | +<%- |
| 3 | +# |
| 4 | +# CBRAIN Project |
| 5 | +# |
| 6 | +# Copyright (C) 2008-2025 |
| 7 | +# The Royal Institution for the Advancement of Learning |
| 8 | +# McGill University |
| 9 | +# |
| 10 | +# This program is free software: you can redistribute it and/or modify |
| 11 | +# it under the terms of the GNU General Public License as published by |
| 12 | +# the Free Software Foundation, either version 3 of the License, or |
| 13 | +# (at your option) any later version. |
| 14 | +# |
| 15 | +# This program is distributed in the hope that it will be useful, |
| 16 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | +# GNU General Public License for more details. |
| 19 | +# |
| 20 | +# You should have received a copy of the GNU General Public License |
| 21 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | +# |
| 23 | +-%> |
| 24 | + |
| 25 | +<% title @bac.pretty_name %> |
| 26 | + |
| 27 | +<%= show_table(@bac, :as => :background_activity, :header => "Background Activity") do |t| %> |
| 28 | + |
| 29 | + <% t.cell("Type") do %> |
| 30 | + <%= @bac.class.to_s.demodulize %> |
| 31 | + <% end %> |
| 32 | + |
| 33 | + <% t.cell("Status") do %> |
| 34 | + <%= @bac.status %> |
| 35 | + <% end %> |
| 36 | + |
| 37 | + <% t.cell("User") do %> |
| 38 | + <%= link_to_user_if_accessible(@bac.user) %> |
| 39 | + <% end %> |
| 40 | + |
| 41 | + <% t.cell("Execution Server") do %> |
| 42 | + <%= link_to_bourreau_if_accessible(@bac.remote_resource) %> |
| 43 | + <% end %> |
| 44 | + |
| 45 | + <% t.cell("Total Number Of Items") do %> |
| 46 | + <%= if @bac.is_configured_for_dynamic_items? |
| 47 | + "(Dynamic items list)" |
| 48 | + elsif @bac.items.size == 0 |
| 49 | + "(None ?)" |
| 50 | + else |
| 51 | + @bac.items.size |
| 52 | + end |
| 53 | + %> |
| 54 | + <% end %> |
| 55 | + |
| 56 | + <% t.cell("Number Of Successes") do %> |
| 57 | + <%= if @bac.is_configured_for_dynamic_items? |
| 58 | + "-" |
| 59 | + elsif @bac.num_successes == 0 |
| 60 | + "0 (None)" |
| 61 | + elsif @bac.items.size == @bac.num_successes |
| 62 | + "#{@bac.num_successes} (All of them)" |
| 63 | + else |
| 64 | + @bac.num_successes |
| 65 | + end |
| 66 | + %> |
| 67 | + <% end %> |
| 68 | + |
| 69 | + <% t.cell("Number Of Items Processed") do %> |
| 70 | + <%= if @bac.is_configured_for_dynamic_items? |
| 71 | + "-" |
| 72 | + elsif @bac.current_item == 0 |
| 73 | + "0 (None yet!)" |
| 74 | + elsif @bac.items.size == @bac.current_item |
| 75 | + "#{@bac.current_item} (All of them)" |
| 76 | + else |
| 77 | + @bac.current_item |
| 78 | + end |
| 79 | + %> |
| 80 | + <% end %> |
| 81 | + |
| 82 | + <% t.cell("Number Of Failures") do %> |
| 83 | + <%= if @bac.is_configured_for_dynamic_items? |
| 84 | + "-" |
| 85 | + elsif @bac.num_failures == 0 |
| 86 | + "0 (None)" |
| 87 | + elsif @bac.items.size == @bac.num_failures |
| 88 | + "#{@bac.num_failures} (All of them)" |
| 89 | + else |
| 90 | + @bac.num_failures |
| 91 | + end |
| 92 | + %> |
| 93 | + <% end %> |
| 94 | + |
| 95 | +<% end %> |
| 96 | + |
| 97 | +<% if (!@bac.is_configured_for_dynamic_items? && @bac.items.size > 0) %> |
| 98 | + |
| 99 | +<fieldset> |
| 100 | + <legend>Items</legend> |
| 101 | + <% bad_hash = @bac.failed_items.index_by(&:itself) %> |
| 102 | + <% num_processed = @bac.current_item %> |
| 103 | + <%= array_to_table(@bac.items.each_with_index.to_a, :table_class => 'xsimple', :cols => 10) do |(item,i),r,c| %> |
| 104 | + <%= i %> : |
| 105 | + <%= if i > num_processed |
| 106 | + item.to_s |
| 107 | + else |
| 108 | + red_if(bad_hash[item],item,nil, :color1 => 'green', :color2 => 'red') |
| 109 | + end |
| 110 | + %> |
| 111 | + <% end %> |
| 112 | +</fieldset> |
| 113 | + |
| 114 | +<% end %> |
| 115 | + |
| 116 | +<%= (render :partial => "background_activities/#{@bac.class.to_s.demodulize}") rescue nil %> |
0 commit comments