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