Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / mason / analyses / model_details.mas
blobe392dd83e442c15a81f19d49736b116ff930f978
1 <%args>
2 $trial_id
3 $trial_name
4 $analysis_metadata
5 </%args>
7 <div class="row">
8     <div class="col-sm-12">
10         <table class="table table-hover table-bordered" >
12         <tr>
13             <td><b>Model Name</b></td>
14             <td>
15                 <div id="model_name">
16                 </div>
17             </td>
18         </tr>
20         <tr>
21             <td><b>Model Description</b></td>
22             <td>
23                 <div id="model_description">
24                 </div>
25             </td>
26         </tr>
28         <tr>
29             <td><b>Model Type</b></td>
30             <td>
31                 <div id="model_type">
32                 </div>
33             </td>
34         </tr>
36         <tr>
37             <td><b>Model Properties</b></td>
38             <td>
39                 <div id="model_properties">
40                 </div>
41             </td>
42         </tr>
44         <tr>
45             <td><b>Model Files</b></td>
46             <td>
47                 <div id="model_files">
48                 </div>
49             </td>
50         </tr>
52         </table>
54     </div>
55 </div>
57 <script>
58 jQuery(document).ready(function(){
60     jQuery.ajax({
61         type: 'GET',
62         url : '/ajax/analysis/<% $trial_id %>/retrieve',
63         beforeSend: function() {
64             jQuery('#working_modal').modal('show');
65         },
66         success: function(response){
67             jQuery('#working_modal').modal('hide');
68             console.log(response);
69             if (response.error) {
70                 alert(response.error);
71             }
72             else {
73                 jQuery('#model_name').html("<a href=\"/analyses_model/"+response.model_info.model_id+"\">"+response.model_info.model_name+"</a>");
74                 jQuery('#model_description').html(response.model_info.model_description);
75                 jQuery('#model_type').html(response.model_info.model_type_name);
77                 var model_properties_string = '';
78                 for (var key in response.model_info.model_properties) {
79                     if (response.model_info.model_properties.hasOwnProperty(key)) {
80                         model_properties_string = model_properties_string + key + " : " + response.model_info.model_properties[key] + "<br/>";
81                     }
82                 }
83                 jQuery('#model_properties').html(model_properties_string);
85                 var model_files_string = '';
86                 for (var key in response.model_info.model_file_ids) {
87                     if (response.model_info.model_file_ids.hasOwnProperty(key)) {
88                         if (key) {
89                             model_files_string = model_files_string + response.model_info.model_file_ids[key] + " : <a href='/breeders/phenotyping/download/" + key + "'>Download</a><br/>";
90                         }
91                     }
92                 }
93                 jQuery('#model_files').html(model_files_string);
94             }
95         },
96         error: function(response){
97             jQuery('#working_modal').modal('hide');
98             alert('Error getting analysis details!');
99         }
100     });
103 </script>