Skip to content

Commit 2463050

Browse files
committed
Use base_url to form metrics url
Otherwise this ends up not working in cases where the notebook is hosted (like JupyterHub) with a different base_url
1 parent 30f8be5 commit 2463050

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

nbresuse/static/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
define(['jquery'], function ($) {
2-
var displayDiv = null;
3-
1+
define(['jquery', 'base/js/utils'], function ($, utils) {
42
function createDisplayDiv() {
53
$('#maintoolbar-container').append(
64
$('<div>').attr('id', 'nbresuse-display')
@@ -16,7 +14,7 @@ define(['jquery'], function ($) {
1614
}
1715

1816
var displayMetrics = function() {
19-
$.getJSON('/metrics', function(data) {
17+
$.getJSON(utils.get_body_data('baseUrl') + 'metrics', function(data) {
2018
// FIXME: Proper setups for MB and GB. MB should have 0 things
2119
// after the ., but GB should have 2.
2220
var displayRSS = (data['rss'] / (1024 * 1024)).toFixed(0);

0 commit comments

Comments
 (0)