aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/templates/oauth2/data-list.html
blob: 6c05845c2b9ab4a18910af91e1e5befaa9bf3a59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{%extends "base.html"%}
{%from "oauth2/profile_nav.html" import profile_nav%}
{%from "oauth2/display_error.html" import display_error%}
{%block title%}View User{%endblock%}
{%block content%}
  <div class="container" style="min-width: 1250px;">
    {{profile_nav("data", user_privileges)}}

    {{flash_me()}}

    <div class="container-fluid">
      <div class="row">
	<form method="POST" action="{{url_for('oauth2.data.list_data')}}">
	  <legend>Dataset Type</legend>
	  <div class="form-group">
	    <input type="hidden" name="offset" value="0" />
	    <label for="dataset_type" class="form-label">Dataset Type</label>
	    <select name="dataset_type" required="required">
	      <option value="">Select dataset type</option>
	      <option value="mrna"
		      {%if dataset_type=="mrna"%}
			selected="selected"
		      {%endif%}>mRNA Assay Datasets</option>
		      <option value="genotype"
			      {%if dataset_type=="genotype"%}
				selected="selected"
			      {%endif%}>Genotype Datasets</option>
			      <option value="phenotype"
				      {%if dataset_type=="phenotype"%}
					selected="selected"
				      {%endif%}>Phenotype/Publish Datasets</option>
	    </select>
	  </div>
	  <input type="submit" value="Fetch Unlinked Data" class="btn btn-primary" />
	</form>
      </div>

      {%if dataset_type is defined%}
	{%if data_items_error is defined%}
	  {{display_error("Data Error", data_items_error)}}
	{%else%}
	  <div class="row">
	    <table class="table">
	      <caption>Link Data to Group</caption>

	      <thead>
		<tr>
		  <th>Dataset Name</th>
		  <th>Dataset Full Name</th>
		  <th>Group</th>
		  <th>Link</th>
		</tr>
	      </thead>

	      <tbody>
		{%for data_item in data_items%}
		  <tr>
		    <form method="POST" action="#/link-data">
		      <input type="hidden" name="dataset_id" value="{{data_item.Id}}" />
		      <input type="hidden" name="dataset_type" value="{{dataset_type}}" />
		      <td>
			<a href="https://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId={{data_item.accession_id}}&InfoPageName={{data_item.Name}}"
			   title="Link to information on dataset '{{data_item.dataset_fullname}}'"
			   target="_blank">
			   {{data_item.Name}}
			</a>
		      </td>
		      <td>{{data_item.FullName}}</td>
		      <td>
			<select name="group_id" required="required">
			  <option value="">Select group</option>
			  {%for group in groups%}
			    <option value="{{group.group_id}}">{{group.group_name}}</option>
			  {%endfor%}
			</select>
		      </td>
		      <td>
			<input type="submit" value="Link" class="btn btn-info" />
		      </td>
		    </form>
		  </tr>
		{%else%}
		  <tr>
		    <td colspan="4">
		      <span class="glyphicon glyphicon-info-sign text-danger">
		      </span>
		      &nbsp;
		      <strong class="text-info">No available data to link</strong>
		    </td>
		  </tr>
		{%endfor%}
	      </tbody>
	    </table>

	    <form method="POST" action="{{url_for('oauth2.data.list_data')}}">
	      <input type="hidden" name="dataset_type" value="{{dataset_type}}" />
	      <input type="hidden" name="offset" value="{{offset or 0}}" />
	      <div class="form-group" style="margin: auto;width: 50%;">
		{%if offset != 0%}
		  <input type="submit" name="offset_submit" value="Previous" class="btn btn-warning" />
		{%endif%}
		{%if data_items | length == 100:%}
		  <input type="submit" name="offset_submit" value="Next" class="btn btn-warning" />
		{%endif%}
	      </div>
	    </form>
	  </div>
	{%endif%}
      {%endif%}

    </div>

  </div>
{%endblock%}