Merge pull request #5243 from solgenomics/topic/observations_upload_catch_error
[sgn.git] / mason / brapiclient / studies_layout.mas
blobf1f90267d76292837f41d855562271a509a3c702
1 <%args>
2 </%args>
4 <div id="brapi_home_study_layout_detail_div">
6     <h4>Study Layout</h4>
7     <input name="brapi_home_studylayoutdbid" id="brapi_home_studylayoutdbid" class="form-control" type="text" placeholder="StudyDbId e.g. 139" value="139"/>
8     <button class="btn btn-primary" name="brapi_home_studylayoutdbid_submit" id="brapi_home_studylayoutdbid_submit">Get Layout</button>
9     <br/><br/>
10     <div id="brapi_studylayout_data_result_div">
11     </div>
13 </div>
15 <script>
17 jQuery(document).ready(function() {
18     jQuery("#brapi_home_studylayoutdbid_submit").click(function() {
19         jQuery.ajax( {
20           'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studylayoutdbid').val()+'/layout',
21           'method': 'GET',
22           'beforeSend': function() {
23             jQuery('#working_modal').modal('show');
24           },
25           'success': function(response) {
26             jQuery('#working_modal').modal('hide');
27             console.log(response);
28             brapi_create_paginated_table(response.result.data, response.metadata.pagination, 'brapi_studylayout_data_result_div', jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studylayoutdbid').val()+'/layout', undefined);
30           },
31           error: function(response) {
32             jQuery('#working_modal').modal('hide');
33             alert('An error occurred');
34           }
35         });
36     });
37 });
39 </script>