Merge branch 'master' into 2871-preload-objects
[arvados.git] / apps / workbench / app / views / users / _tables.html.erb
1 <% if current_user.andand.is_active %>
2   <div>
3     <strong>Recent jobs</strong>
4     <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
5     <%= link_to raw("Show all jobs &rarr;"), jobs_path, class: 'pull-right' %>
6     <% if not current_user.andand.is_active or @my_jobs.empty? %>
7       <p>(None)</p>
8     <% else %>
9       <table class="table table-bordered table-condensed table-fixedlayout">
10         <colgroup>
11           <col width="20%" />
12           <col width="20%" />
13           <col width="20%" />
14           <col width="13%" />
15           <col width="13%" />
16           <col width="20%" />
17         </colgroup>
18
19         <tr>
20           <th>Script</th>
21           <th>Output</th>
22           <th>Log</th>
23           <th>Age</th>
24           <th>Status</th>
25           <th>Progress</th>
26         </tr>
27
28         <% 
29           job_outputs = []
30           job_logs = []
31           @my_jobs[0..6].each do |j|
32             job_outputs << j.output
33             job_logs << j.log
34           end
35
36           preload_collections job_outputs
37           preload_log_collections job_logs
38         %>
39         <% @my_jobs[0..6].each do |j| %>
40           <tr data-object-uuid="<%= j.uuid %>">
41             <td>
42               <small>
43                 <%= link_to((j.script.andand[0..31] || j.uuid), job_path(j.uuid)) %>
44               </small>
45             </td>
46
47             <td>
48               <small>
49                 <% if j.success and j.output %>
50                   <a href="<%= collection_path(j.output) %>">
51                     <% get_collection(j.output).each do |c| %>
52                       <% c.files.each do |file| %>
53                         <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %>
54                       <% end %>
55                      <% end %>
56                   </a>
57               <% end %>
58             </small>
59           </td>
60
61 <td>
62   <small>
63     <% if j.log %>
64       <% get_log_collection(j.log).each do |c| %>
65         <% c.files.each do |file| %>
66           <a href="<%= collection_path(j.log) %>/<%= file[1] %>?disposition=inline&size=<%= file[2] %>">Log</a>
67         <% end %>
68       <% end %>
69     <% elsif j.respond_to? :log_buffer and j.log_buffer.is_a? String %>
70       <% buf = j.log_buffer.strip.split("\n").last %>
71       <span title="<%= buf %>"><%= buf %></span>
72     <% end %>
73   </small>
74 </td>
75
76 <td>
77   <small>
78     <%= raw(distance_of_time_in_words(j.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if j.created_at %>
79   </small>
80 </td>
81
82 <td>
83   <%= render partial: 'job_status_label', locals: {:j => j} %>
84 </td>
85 <td>
86   <div class="inline-progress-container">
87   <%= render partial: 'job_progress', locals: {:j => j} %>
88   </div>
89 </td>
90
91 </tr>
92 <% end %>
93 </table>
94 <% end %>
95 </div>
96
97 <div>
98   <strong>Recent pipeline instances</strong>
99   <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
100   <%= link_to raw("Show all pipeline instances &rarr;"), pipeline_instances_path, class: 'pull-right' %>
101   <% if not current_user.andand.is_active or @my_pipelines.empty? %>
102     <p>(None)</p>
103   <% else %>
104     <table class="table table-bordered table-condensed table-fixedlayout">
105       <colgroup>
106         <col width="30%" />
107         <col width="30%" />
108         <col width="13%" />
109         <col width="13%" />
110         <col width="20%" />
111       </colgroup>
112
113       <tr>
114         <th>Instance</th>
115         <th>Template</th>
116         <th>Age</th>
117         <th>Status</th>
118         <th>Progress</th>
119       </tr>
120
121       <% @my_pipelines[0..6].each do |p| %>
122         <tr data-object-uuid="<%= p.uuid %>">
123           <td>
124             <small>
125               <%= link_to_if_arvados_object p.uuid, friendly_name: true %>
126             </small>
127           </td>
128
129           <td>
130             <small>
131               <%= link_to_if_arvados_object p.pipeline_template_uuid, friendly_name: true %>
132             </small>
133           </td>
134
135           <td>
136             <small>
137               <%= raw(distance_of_time_in_words(p.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if p.created_at %>
138             </small>
139           </td>
140
141           <td>
142             <%= render partial: 'pipeline_status_label', locals: {:p => p} %>
143           </td>
144
145           <td>
146             <div class="inline-progress-container">
147               <%= render partial: 'pipeline_progress', locals: {:p => p} %>
148             </div>
149           </td>
150         </tr>
151       <% end %>
152     </table>
153   <% end %>
154 </div>
155
156 <div>
157   <strong>Recent collections</strong>
158   <%= link_to '(refresh)', {format: :js}, {class: 'refresh', remote: true, method: 'get'} %>
159   <%= link_to raw("Show all collections &rarr;"), collections_path, class: 'pull-right' %>
160   <div class="pull-right" style="padding-right: 1em; width: 30%;">
161     <%= form_tag collections_path,
162           method: 'get',
163           class: 'form-search small-form-margin' do %>
164     <div class="input-group input-group-sm">
165       <%= text_field_tag :search, params[:search], class: 'form-control', placeholder: 'Search' %>
166       <span class="input-group-btn">
167         <%= button_tag(class: 'btn btn-info') do %>
168         <span class="glyphicon glyphicon-search"></span>
169         <% end %>
170       </span>
171     </div>
172     <% end %>
173   </div>
174   <% if not current_user.andand.is_active or @my_collections.empty? %>
175     <p>(None)</p>
176   <% else %>
177     <table class="table table-bordered table-condensed table-fixedlayout">
178       <colgroup>
179         <col width="46%" />
180         <col width="32%" />
181         <col width="10%" />
182         <col width="12%" />
183       </colgroup>
184
185       <tr>
186         <th>Contents</th>
187         <th>Tags</th>
188         <th>Age</th>
189         <th>Storage</th>
190       </tr>
191
192       <% @my_collections[0..6].each do |c| %>
193         <tr data-object-uuid="<%= c.uuid %>">
194           <td>
195             <small>
196               <a href="<%= collection_path(c.uuid) %>">
197                 <% c.files.each do |file| %>
198                   <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %>
199                 <% end %>
200               </a>
201             </small>
202           </td>
203           <td>
204             <% if @my_tag_links[c.uuid] %>
205             <small>
206               <%= @my_tag_links[c.uuid].collect(&:name).join(", ") %>
207             </small>
208             <% end %>
209           </td>
210           <td>
211             <small>
212               <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if c.created_at %>
213             </small>
214           </td>
215           <td>
216             <%= render partial: 'collections/toggle_persist', locals: { uuid: c.uuid, current_state: @persist_state[c.uuid] } %>
217           </td>
218         </tr>
219       <% end %>
220     </table>
221   <% end %>
222 </div>
223
224 <% else %>
225
226   <div class="row-fluid">
227     <div class="col-sm-4">
228       <%= image_tag "dax.png", style: "max-width:100%" %>
229     </div>
230     <div class="col-sm-8">
231       <h2>Welcome to Arvados, <%= current_user.first_name %>!</h2>
232       <div class="well">
233         <p>
234           Your account must be activated by an Arvados administrator.  If this
235           is your first time accessing Arvados and would like to request
236           access, or you believe you are seeing the page in error, please
237           <%= link_to "contact us", Rails.configuration.activation_contact_link %>.
238           You should receive an email at the address you used to log in when
239           your account is activated.  In the mean time, you can
240           <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
241           and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
242         </p>
243         <p style="padding-bottom: 1em">
244           <%= link_to raw('Contact us &#x2709;'),
245               Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
246       </div>
247     </div>
248   </div>
249 <% end %>
250
251 <% content_for :js do %>
252 setInterval(function(){$('a.refresh:eq(0)').click()}, 60000);
253 <% end %>