Skip to content

Commit 8dfe7ad

Browse files
committed
Pass "api_path" to widget code
Refs pombase/pombase-gocam#105
1 parent 962cc16 commit 8dfe7ad

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

gocam_connections/templates/gocam_connections/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@
149149
};
150150

151151
const summaryType = '{{summary_type}}';
152+
const apiPath = '{{api_path}}';
152153

153154
let currentModels = [];
154155

155156
document.addEventListener('DOMContentLoaded', async function(){
156-
const url = '/api/v1/dataset/latest/data/gocam/model_summary/' + summaryType;
157+
const url = apiPath + '/' + summaryType;
157158
const response = await fetch(url);
158159

159160
const modelConnections = await response.json();

gocam_connections/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
def index(request):
44
summary_type = request.GET.get('summary_type', 'connected_only').strip()
5+
api_path = request.GET.get('api_path', '').strip()
56

67
context = {
78
'summary_type': summary_type,
9+
'api_path': api_path,
810
}
911

1012
return render(request, 'gocam_connections/index.html', context)

gocam_view/templates/gocam_view/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,9 @@
204204

205205
const fullOrWidget = '{{full_or_widget}}';
206206
const gocamId = '{{gocam_id}}';
207+
const apiPath = '{{api_path}}';
207208

208-
let url = '/api/v1/dataset/latest/data/go-cam-cytoscape/' + gocamId;
209+
let url = apiPath + '/' + gocamId;
209210

210211
let gocamIdNoFlags = gocamId;
211212
let flags = [];

gocam_view/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
def index(request):
44
full_or_widget = request.GET.get('full_or_widget', '').strip()
55
gocam_id = request.GET.get('gocam_id', '').strip()
6+
api_path = request.GET.get('api_path', '').strip()
67
highlight_gene_ids = request.GET.get('highlight_gene_ids', '').strip()
78

89
if full_or_widget == 'widget':
@@ -13,6 +14,7 @@ def index(request):
1314
context = {
1415
'full_or_widget': full_or_widget,
1516
'gocam_id': gocam_id,
17+
'api_path': api_path,
1618
'highlight_gene_ids': highlight_gene_ids.split(','),
1719
}
1820

0 commit comments

Comments
 (0)