[879b32]: / qiita_pet / templates / list_analyses.html

Download this file

237 lines (221 with data), 8.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
{% extends sitebase.html %}
{% block head %}
<script type="text/javascript">
$(document).ready(function(){
$('#user-analyses-table').dataTable({
"lengthMenu": [[5, 10, 50, -1], [5, 10, 50, "All"]],
columnDefs: [
{"render": function ( data, type, row, meta ) {
data = JSON.parse(data);
if (data !== null && data !== undefined && data.length != 0){
return '<div class="container" style="max-width: 5em;">'+
'<div class="row justify-content-md-center">' +
'<div class="col-md-1 text-center details-control">&nbsp;</div>' +
'<div class="col-md-1 text-center">' + data.length + '</div>' +
'</div>' +
'</div>';
} else {
return 'No artifacts';
}
}, targets: [0]}],
"language": {
"search": "Filter results by analysis name or description",
"loadingRecords": "Please wait - loading information ...",
"zeroRecords": "No analyses found"
},
});
$('#public-analyses-table').dataTable({
"lengthMenu": [[5, 10, 50, -1], [5, 10, 50, "All"]],
"sDom": '<"top">rti<"bottom"p><"clear">',
"bLengthChange": false,
columnDefs: [
{"render": function ( data, type, row, meta ) {
data = JSON.parse(data);
if (data !== null && data !== undefined && data.length != 0){
return '<div class="container" style="max-width: 5em;">'+
'<div class="row justify-content-md-center">' +
'<div class="col-md-1 text-center details-control">&nbsp;</div>' +
'<div class="col-md-1 text-center">' + data.length + '</div>' +
'</div>' +
'</div>';
} else {
return 'No artifacts';
}
}, targets: [0]}],
"language": {
"search": "Filter results by analysis name or description",
"loadingRecords": "Please wait - loading information ...",
"zeroRecords": "No analyses found"
}
});
$('#user-analyses-table tbody').on('click', 'div.details-control', function () {
var table = $('#user-analyses-table').DataTable();
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
} else {
// Open this row
// modified from: https://jsfiddle.net/8rejaL88/2/
tr.addClass('shown');
row.child('<p><center><img src="{% raw qiita_config.portal_dir %}/static/img/waiting.gif" style="display:block;margin-left: auto;margin-right: auto"/></center></p>', 'no-padding' ).show();
$.post('/artifact/info/', {ids: JSON.parse(row.data()[0]), only_biom: 'False' })
.done(function ( data ) {
if (data['status']=='success') {
$('td', row.child()).html(format_biom_rows(data.data, row.index(), for_study_list=false)).show();
} else {
bootstrapAlert('ERROR: ' + data['msg'], "danger", 10000);
}
});
}
});
$('#public-analyses-table tbody').on('click', 'div.details-control', function () {
var table = $('#public-analyses-table').DataTable();
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
} else {
// Open this row
// modified from: https://jsfiddle.net/8rejaL88/2/
tr.addClass('shown');
row.child('<p><center><img src="{% raw qiita_config.portal_dir %}/static/img/waiting.gif" style="display:block;margin-left: auto;margin-right: auto"/></center></p>', 'no-padding' ).show();
$.post('/artifact/info/', {ids: JSON.parse(row.data()[0]), only_biom: 'False' })
.done(function ( data ) {
if (data['status']=='success') {
$('td', row.child()).html(format_biom_rows(data.data, row.index(), for_study_list=false)).show();
} else {
bootstrapAlert('ERROR: ' + data['msg'], "danger", 10000);
}
});
}
});
// connecting searches
$('#user-analyses-table').on('search.dt', function () {
var search_text = $('.dataTables_filter input').val();
$('#public-analyses-table').DataTable().search(search_text).draw();
});
// connecting paging size
$('#user-analyses-table').on('length.dt', function (e, settings, len) {
$('#public-analyses-table').DataTable().page.len(len).draw();
});
var analyses_all_messages = $("#analyses-all-messages");
var data = {% raw messages %};
analyses_all_messages.empty();
for (level in data) {
if (data[level].length != 0) {
var message = $('<div>', { 'class': 'alert fade in alert-'+level, 'role': 'alert', 'id': 'analysis-message-'+level});
message.append(' '+data[level]);
// prepend the "Need help" message
if (level == 'warning' || level == 'danger'){
message.append('<p style="text-align:center">Need help? Send us an <a href="mailto:{% raw qiita_config.portal_dir %}">email</a>.</p>');
}
analyses_all_messages.prepend(message);
}
}
});
</script>
{% end %}
{%block content %}
<div id="analyses-all-messages" class="container-fluid" style="width:97%"></div>
<div class="row">
<div class="col-sm-12" id="user-studies-div">
<h3 class="gray-msg">Your Analyses</h3>
<table id="user-analyses-table" class="table table-bordered gray-msg">
<thead>
<tr>
<th>Artifacts</th>
<th>Analysis ID</th>
<th>Analysis Name</th>
<th>Visibility</th>
<th>Owner</th>
<th>Creation Timestamp</th>
<th>Mapping File</th>
<th>Delete?</th>
</tr>
</thead>
<tbody>
{% for analysis in user_analyses %}
<tr>
<td>
{{analysis['artifacts']}}
</td>
<td>
{{analysis['analysis_id']}}
</td>
<td>
<a href="{% raw qiita_config.portal_dir %}/analysis/description/{{analysis['analysis_id']}}/">{{analysis['name']}}</a>
{% if analysis['description'] %}
({{analysis['description']}})
{% end %}
</td>
<td>
{{analysis['visibility']}}
</td>
<td>
<a href="mailto:{{analysis['owner']}}">{{analysis['owner']}}</a>
</td>
<td>
{{analysis['timestamp']}}
</td>
<td>
{% if analysis['mapping_files'] %}
{% for _map in analysis['mapping_files'] %}
{% raw dlop(_map[1], _map[0], 'mapping file') %}
{% end %}
{% else %}
No mapping files available
{% end %}
</td>
<td>
<a class="btn btn-danger glyphicon glyphicon-trash" onclick="delete_analysis('{{analysis['name']}}', {{analysis['analysis_id']}});"></a>
</td>
</tr>
{% end %}
</tbody>
</table>
<h3 class="gray-msg">Public Analyses</h3>
<table id="public-analyses-table" class="table table-bordered gray-msg">
<thead>
<tr>
<th>Artifacts</th>
<th>Analysis ID</th>
<th>Analysis Name</th>
<th>Owner</th>
<th>Creation Timestamp</th>
<th>Mapping File</th>
</tr>
</thead>
{% for analysis in public_analyses %}
<tr>
<td>
{{analysis['artifacts']}}
</td>
<td>
{{analysis['analysis_id']}}
</td>
<td>
<a href="{% raw qiita_config.portal_dir %}/analysis/description/{{analysis['analysis_id']}}/">{{analysis['name']}}</a>
{% if analysis['description'] %}
({{analysis['description']}})
{% end %}
</td>
<td>
<a href="mailto:{{analysis['owner']}}">{{analysis['owner']}}</a>
</td>
<td>
{{analysis['timestamp']}}
</td>
<td>
{% for _map in analysis['mapping_files'] %}
{% raw dlop(_map[1], _map[0], 'mapping file') %}
{% end %}
</td>
</tr>
{% end %}
</table>
{% end %}