|
1 | | -Hello! |
| 1 | +<script type="text/javascript" nonce="<%=scriptNonce%>"> |
| 2 | + |
| 3 | +(function($, LABKEY) { |
| 4 | + $(function(){ |
| 5 | + $( document ).ready(function() { |
| 6 | + LABKEY.Query.selectRows({ |
| 7 | + schemaName: 'studies', |
| 8 | + queryName: 'studies', |
| 9 | + scope: this, |
| 10 | + failure: LDK.Utils.getErrorCallback(), |
| 11 | + success: function (results) { |
| 12 | + // TODO: render some sort of card/tile view |
| 13 | + //console.log(results) |
| 14 | + } |
| 15 | + }) |
| 16 | + |
| 17 | + LABKEY.Query.selectRows({ |
| 18 | + schemaName: 'study', |
| 19 | + queryName: 'datasets', |
| 20 | + columns: 'Name,Label,CategoryId/Label', |
| 21 | + scope: this, |
| 22 | + failure: LDK.Utils.getErrorCallback(), |
| 23 | + success: function (results) { |
| 24 | + let div = $('<div>') |
| 25 | + |
| 26 | + const dataByCategory = {} |
| 27 | + results.rows.sort((a, b) => a.Label.localeCompare(b.Label)).forEach(row => { |
| 28 | + const dsUrl = LABKEY.ActionURL.buildURL('query', 'executeQuery', null, { |
| 29 | + schemaName: 'study', |
| 30 | + queryName: row.Name |
| 31 | + }); |
| 32 | + |
| 33 | + dataByCategory[row['CategoryId/Label']] = dataByCategory[row['CategoryId/Label']] || [] |
| 34 | + dataByCategory[row['CategoryId/Label']].push(`<li><a href="${dsUrl}">${row.Label}</a></li>`) |
| 35 | + }) |
| 36 | + |
| 37 | + Object.keys(dataByCategory).sort().forEach(category => { |
| 38 | + div.append('<h4 style="font-weight: bold;">' + category + '</h4>').append('<ul>') |
| 39 | + dataByCategory[category].forEach(item => { |
| 40 | + div.append(item) |
| 41 | + }) |
| 42 | + div.append('</ul>') |
| 43 | + }) |
| 44 | + |
| 45 | + var webpart = <%=webpartContext%>; |
| 46 | + $('#' + webpart.wrapperDivId).append(div) |
| 47 | + } |
| 48 | + }) |
| 49 | + }) |
| 50 | + }); |
| 51 | +}(jQuery, LABKEY)); |
| 52 | + |
| 53 | +</script> |
| 54 | + |
| 55 | +Below is a list of the datasets managed in this folder. |
| 56 | + |
| 57 | +<br> |
2 | 58 |
|
3 | | -TODO: |
4 | | -- Query list of studies, perhaps tile/card view? |
5 | | -- Query list of datasets |
|
0 commit comments