aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/templates/oauth2/data-list.html
blob: 019e23461a9828125887ad7d638f2016f619dafc (about) (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{%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>
	  <input type="hidden" name="offset" value="0" />
	  <input type="hidden" name="menus" value="{{menus | tojson}}" />
	  <div class="form-group">
	    <label for="select-menu">Dataset</label>
	    <select id="select-menu" name="dataset">
	      {%for species_id, species_data in menus.items()%}
	      <optgroup label="{{species_data.display_name}}">
		{%for group_id, group_data in species_data["groups"].items()%}
		<optgroup label=" {{group_data.group_name}}">
		  {%for type_id, type_data in group_data["types"].items()%}
		  <optgroup label="{{type_data.menu_heading}}">
		    {%for dataset in type_data["datasets"]%}
		    <option value="{{dataset.dataset_id}}">
		      {{dataset.dataset_fullname}}
		    </option>
		    {%endfor%}
		  </optgroup>
		  {%endfor%}
		</optgroup>
		{%endfor%}
	      </optgroup>
	      {%endfor%}
	    </select>
	  </div>
	  <div class="form-group">
	    <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">
	<form method="POST" action="{{url_for('oauth2.data.link_data')}}">
	  <legend>Link Data to Group</legend>
	  <input type="hidden" name="offset" value="{{offset or 0}}" />
	  <input type="hidden" name="dataset_type" value="{{dataset_type}}" />

	  <div class="form-group">
	    <label for="select-group-id">Group</label>
	    <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>
	  </div>

	  <table class="table">
	    <caption>Link Data to Group</caption>

	    <thead>
	      <tr>
		<th>Select</th>
		{%if dataset_type == "phenotype"%}
		<th>Trait ID</th>
		<th>Data Group</th>
		{%endif%}
		<th>Dataset Name</th>
		<th>Dataset Full Name</th>
		<th>Link</th>
	      </tr>
	    </thead>

	    <tbody>
	      {%for data_item in data_items%}
	      <tr>
		<td>
		  <input type="checkbox" value="{{data_item.Id}}"
			 name="dataset_ids" />
		</td>
		{%if dataset_type == "phenotype"%}
		<td>
		  <a href="/show_trait?trait_id={{data_item.Id}}&dataset={{data_item.dataset_name}}"
		     title="Trait Page">
		    {{data_item.Id}}
		  </a>
		</td>
		<td>{{data_item.InbredSetName}}</td>
		{%endif%}
		<td>
		  <a href="https://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId={{data_item.accession_id}}&InfoPageName={{data_item.dataset_name}}"
		     title="Link to information on dataset '{{data_item.dataset_fullname}}'"
		     target="_blank">
		    {{data_item.dataset_name}}
		  </a>
		</td>
		<td>{{data_item.dataset_fullname}}</td>
		<td>
		  <input type="submit" value="Link" class="btn btn-info" />
		</td>
	      </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>

	<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%}