|
1 | 1 | {% extends sitebase.html %}
|
2 | 2 | {% block head %}
|
| 3 | +{% from future.utils import viewitems %} |
| 4 | +{% from itertools import chain %} |
3 | 5 | <script src="/static/vendor/js/moi.js"></script>
|
4 | 6 | <script type="text/javascript">
|
| 7 | + |
5 | 8 | function error(evt) { $('#ws-error').html("<b>Server communication error. Sample removal will not be recorded. Please try again later.</b>"); };
|
6 | 9 | function check_color() {
|
7 | 10 | if($('.row').length === 0) {
|
8 | 11 | $('#dflt-sel-info').removeAttr('style');
|
9 | 12 | $('#create-button').remove();
|
| 13 | + $('#clear-button').remove(); |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +function clear() { |
| 18 | + if(confirm('Are you sure you want to remove all samples?')) { |
| 19 | + moi.send('clear', {'pids': {% raw [int(p) for p in chain.from_iterable(pid.keys() for sid, pid in viewitems(sel_data))] %} }); |
10 | 20 | }
|
11 | 21 | }
|
12 | 22 |
|
| 23 | +function clear_from_html(data) { |
| 24 | + $.each($('.row'), function(index, value) { value.remove(); }); |
| 25 | + check_color(); |
| 26 | +} |
| 27 | + |
13 | 28 | function remove_proc_data(pid, sid) {
|
14 | 29 | if(confirm('Are you sure you want to remove all samples for this processed data?')) {
|
15 | 30 | moi.send('remove_pd', {'proc_data': pid, 'samples': [], 'sid': sid});
|
|
46 | 61 | moi.init(window.location.host + '/analysis/selected/socket/', null, function(){}, error, error);
|
47 | 62 | moi.add_callback('remove_pd', remove_pd_from_html);
|
48 | 63 | moi.add_callback('remove_sample', remove_sample_from_html);
|
| 64 | + moi.add_callback('clear', clear_from_html); |
| 65 | + $('#clear-button').on('click', clear); |
49 | 66 | });
|
50 | 67 | </script>
|
51 | 68 | {% end %}
|
52 | 69 |
|
53 | 70 | {% block content %}
|
54 | 71 | {% from qiita_db.study import Study %}
|
55 |
| -{% from future.utils import viewitems %} |
56 | 72 | {% set static_info = {'data_type', 'processed_date', 'algorithm', 'reference_name', 'reference_version', 'sequence_filepath', 'taxonomy_filepath', 'tree_filepath'}%}
|
57 | 73 | <h1>Selected Samples</h1>
|
58 | 74 | <span id="ws-error" style="color:red"></span>
|
@@ -122,6 +138,9 @@ <h4 class="modal-title" id="myModalLabel">Processed Data {{pid}}</h4>
|
122 | 138 | <button type="button" class="btn btn-success btn-lg" id="create-button" name="create-button" data-toggle="modal" data-target="#create-analysis-modal-view">
|
123 | 139 | Create Analysis
|
124 | 140 | </button>
|
| 141 | +<button type="button" class="btn btn-danger btn-lg" id="clear-button" name="clear-button"> |
| 142 | + Clear Selected |
| 143 | +</button> |
125 | 144 | {% end %}
|
126 | 145 |
|
127 | 146 | <!-- modal view to enter analysis information -->
|
|
0 commit comments