Switch to unified view

a b/qiita_pet/templates/analysis_description.html
1
{% extends sitebase.html %} {% block head %}
2
<link
3
    rel="stylesheet"
4
    href="{% raw qiita_config.portal_dir %}/static/vendor/css/select2.min.css"
5
    type="text/css"
6
/>
7
<script
8
    type="text/javascript"
9
    src="{% raw qiita_config.portal_dir %}/static/vendor/js/select2.min.js"
10
></script>
11
<script
12
    type="text/javascript"
13
    src="{% raw qiita_config.portal_dir %}/static/js/sharing.js"
14
></script>
15
16
<script type="text/javascript">
17
    /*
18
     * update_analysis_reservation will update the analysis resevation
19
     *
20
     * @param analysis_id: The id of the analysis to update
21
     * @param reservation: The reservation
22
     *
23
     */
24
25
    function update_analysis_reservation(analysis_id, reservation) {
26
      $.ajax({
27
        url: '{% raw qiita_config.portal_dir %}/analysis/description/{{analysis_id}}/',
28
        type: 'PATCH',
29
        data: {'op': 'replace', 'path': 'reservation', 'value': reservation},
30
        success: function(data) {
31
          $('#analysis-reservation-modal-view').modal('hide');
32
          if(data.status == 'error') {
33
            bootstrapAlert(data.message, "danger");
34
          } else {
35
            $('#reservation').val(reservation);
36
            $('#analysis-reservation-modal-data').text("Reservation: " + reservation);
37
          }
38
        }
39
      });
40
41
    }
42
43
    $(document).ready(function(){
44
      // Create the processing network view object
45
      newProcessingNetworkVue("#analysis-graph-vue");
46
47
      // Show the alert message, if any
48
      {% if alert_msg %}
49
        bootstrapAlert("{{alert_msg}}", "{{alert_type}}");
50
      {% end %}
51
52
      // starting share
53
      init_sharing("{% raw qiita_config.portal_dir %}");
54
      update_share();
55
56
      $('#studies-artifacts-table').dataTable();
57
58
    });
59
</script>
60
<style>
61
    .graph {
62
        width: 80%;
63
        height: 400px;
64
        border: 1px solid #ccc;
65
    }
66
</style>
67
{% end %} {% block content %}
68
69
<div class="row">
70
    <div class="col">
71
        <form
72
            action="{% raw qiita_config.portal_dir %}/analysis/description/{{analysis_id}}/"
73
            method="post"
74
            id="make-public"
75
        >
76
            <input name="analysis_id" value="{{analysis_id}}" type="hidden" />
77
        </form>
78
        <h2>
79
            {{analysis_name}} - ID {{analysis_id}}
80
            <small>
81
                ({{analysis_description}}) - {% if analysis_is_public %}
82
                <b>Public</b>
83
                {% else %}
84
                <b>Private</b>
85
                {% end %} {% if analysis_mapping_id is not None %}
86
                <a
87
                    class="btn btn-default"
88
                    href="{% raw qiita_config.portal_dir %}/download/{{analysis_mapping_id}}"
89
                    ><span class="glyphicon glyphicon-download-alt"></span>
90
                    Mapping file</a
91
                >
92
                {% end %} {% if not analysis_is_public %}
93
                <a
94
                    class="btn btn-default"
95
                    onclick="if (confirm('Are you sure you want to make this analysis public? Note that this will not allow you to delete your analysis later.')) { $('#make-public').submit(); }"
96
                    ><span class="glyphicon glyphicon-globe"></span> Make
97
                    analysis public</a
98
                >
99
                {% end %}
100
                <a
101
                    class="btn btn-default"
102
                    data-toggle="modal"
103
                    data-target="#analysis-reservation-modal-view"
104
                    ><span
105
                        class="glyphicon glyphicon-pencil"
106
                        name="analysis-reservation-modal-data"
107
                        id="analysis-reservation-modal-data"
108
                    >
109
                        Reservation: {% raw analysis_reservation %}</span
110
                    ></a
111
                >
112
            </small>
113
        </h2>
114
        Owner:
115
        <a href="mailto:{{analysis_owner}}">{{analysis_owner}}</a>
116
        <br />
117
        <a
118
            class="btn btn-info"
119
            data-toggle="modal"
120
            data-target="#share-analysis-modal-view"
121
            onclick="modify_sharing({{analysis_id}});"
122
            ><span class="glyphicon glyphicon-share"></span
123
        ></a>
124
        Shared with: <span id="shared_html_{{analysis_id}}"></span>
125
        <div class="row">
126
            <div class="col-md-12">
127
                <b>Studies and artifacts used in this analysis:</b>
128
                <button
129
                    class="btn btn-default"
130
                    data-toggle="collapse"
131
                    data-target="#studies-artifacts-div"
132
                >
133
                    <span class="glyphicon glyphicon-eye-open"></span>
134
                    Show/Hide
135
                </button>
136
                <div
137
                    id="studies-artifacts-div"
138
                    class="collapse"
139
                    style="
140
                        padding: 10px 10px 10px 10px;
141
                        border-radius: 10px;
142
                        background: #eee;
143
                    "
144
                >
145
                    <table
146
                        id="studies-artifacts-table"
147
                        class="display table-bordered table-hover"
148
                        style="width: 100%"
149
                    >
150
                        <thead>
151
                            <tr>
152
                                <th>Artifact ID</th>
153
                                <th>Study IDs</th>
154
                                <th>Prep IDs</th>
155
                                <th>Study Title</th>
156
                                <th>Parent Processing</th>
157
                                <th>Merging Scheme</th>
158
                                <th>Total Samples Selected</th>
159
                            </tr>
160
                        </thead>
161
                        <tbody>
162
                            {% for aid, data in artifacts.items() %}
163
                            <tr>
164
                                <td>{{aid}}</td>
165
                                <td>{{data[0]}}</td>
166
                                <td>{{', '.join(data[4])}}</td>
167
                                <td>
168
                                    <a
169
                                        href="{% raw qiita_config.portal_dir %}/study/description/{{data[0]}}"
170
                                        target="_blank"
171
                                        >{{data[1]}}</a
172
                                    >
173
                                </td>
174
                                <td>{{data[2][1]}}</td>
175
                                <td>{{data[2][0]}}</td>
176
                                <td>{{ len(data[3]) }}</td>
177
                            </tr>
178
                            {% end %}
179
                        </tbody>
180
                    </table>
181
                </div>
182
            </div>
183
        </div>
184
    </div>
185
    <hr />
186
</div>
187
<div id="analysis-graph-vue" style="margin-left: 15px">
188
    <processing-graph
189
        v-bind:is-analysis-pipeline="true"
190
        ref="procGraph"
191
        portal="{% raw qiita_config.portal_dir %}"
192
        graph-endpoint="/analysis/description/{{analysis_id}}/graph/"
193
        jobs-endpoint="/analysis/description/{{analysis_id}}/jobs/"
194
        element-id="{{analysis_id}}"
195
    ></processing-graph>
196
</div>
197
<div class="row" id="processing-content-div"></div>
198
199
<!-- Modal used to share the analysis -->
200
<div
201
    class="modal fade"
202
    id="share-analysis-modal-view"
203
    tabindex="-1"
204
    role="dialog"
205
    aria-labelledby="myModalLabel"
206
    aria-hidden="true"
207
>
208
    <div class="modal-dialog">
209
        <div class="modal-content">
210
            <div class="modal-header">
211
                <button
212
                    type="button"
213
                    class="close"
214
                    data-dismiss="modal"
215
                    aria-hidden="true"
216
                >
217
                    &times;
218
                </button>
219
                <h4 class="modal-title" id="myModalLabel">
220
                    Modify Sharing Settings
221
                </h4>
222
            </div>
223
            <div class="modal-body">
224
                <div>
225
                    <div class="form-group">
226
                        <label for="shares-select">Add/Remove Users</label>
227
                        <select
228
                            multiple
229
                            class="analysis"
230
                            id="shares-select"
231
                            data-share-url="{% raw qiita_config.portal_dir %}/analysis/sharing/"
232
                            data-current-id="{{analysis_id}}"
233
                            style="width: 50%"
234
                        ></select>
235
                        <br />
236
                        <br />
237
                        Adding or removing email addresses automatically updates
238
                        who the analysis is shared with. Once you click the `X`
239
                        or give mouse focus to the analysis page you'll see your
240
                        new sharing settings.
241
                    </div>
242
                </div>
243
            </div>
244
            <div class="modal-footer"></div>
245
        </div>
246
    </div>
247
</div>
248
249
<!-- Modal used to change reservation -->
250
<div
251
    class="modal fade"
252
    id="analysis-reservation-modal-view"
253
    tabindex="-1"
254
    role="dialog"
255
    aria-labelledby="myModalLabel"
256
    aria-hidden="true"
257
>
258
    <div class="modal-dialog">
259
        <div class="modal-content">
260
            <div class="modal-header">
261
                <button
262
                    type="button"
263
                    class="close"
264
                    data-dismiss="modal"
265
                    aria-hidden="true"
266
                >
267
                    &times;
268
                </button>
269
                <h4 class="modal-title" id="myModalLabel">
270
                    Modify Reservation Setting
271
                </h4>
272
            </div>
273
            <div class="modal-body">
274
                <div>
275
                    <div class="form-group">
276
                        <label for="shares-select"
277
                            >Reservation (optional)</label
278
                        >
279
                        <input
280
                            type="text"
281
                            class="form-control"
282
                            id="reservation"
283
                            name="reservation"
284
                            value="{{ analysis_reservation }}"
285
                            placeholder="Reservation (optional)"
286
                        />
287
                        <button
288
                            id="update-reservation-btn"
289
                            class="btn btn-default"
290
                            onclick="update_analysis_reservation({{analysis_id}}, $('#reservation').val());"
291
                        >
292
                            Update
293
                        </button>
294
                    </div>
295
                </div>
296
            </div>
297
            <div class="modal-footer"></div>
298
        </div>
299
    </div>
300
</div>
301
302
{% end %}