Skip to content

Commit

Permalink
Use latest version of binderhub-client
Browse files Browse the repository at this point in the history
- Also construct URL to binder dynamically, assumed to be under
  /services/binder on the same host
- Use a submodule to bring in latest version of the binderhub-client
  for now, as things move fast. Currently at jupyterhub/binderhub#1742
  • Loading branch information
yuvipanda committed Sep 15, 2023
1 parent 150cee7 commit 2f9b899
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "binderhub"]
path = binderhub
url = https://github.com/yuvipanda/binderhub.git
1 change: 1 addition & 0 deletions binderhub
Submodule binderhub added at c6ad4f
18 changes: 9 additions & 9 deletions kubespawner_dynamic_building_ui/static/form.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"watch": "webpack --watch"
},
"dependencies": {
"@jupyterhub/binderhub-client": "^0.3.0",
"@jupyterhub/binderhub-client": "file:binderhub/js/packages/binderhub-client",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"xterm": "^5.1.0"
Expand Down
9 changes: 6 additions & 3 deletions src/ImageBuilder.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

import { Terminal } from 'xterm';
import { useEffect, useState } from 'react';
import BinderImage from '@jupyterhub/binderhub-client';
import { BinderRepository } from '@jupyterhub/binderhub-client';

function buildImage(repo, ref, term) {
const providerSpec = "gh/" + repo + "/" + ref;
const image = new BinderImage(providerSpec, "https://mybinder.org/")
// FIXME: Assume the binder api is available in the same hostname, under /services/binder/
let binderUrl = new URL(window.location.origin);
binderUrl.pathname = '/services/binder/';
const image = new BinderRepository(providerSpec, binderUrl.toString(), null, true)
image.onStateChange('*', (oldState, newState, data) => {
term.write(data.message);
})
Expand Down Expand Up @@ -59,4 +62,4 @@ export function ImageBuilder() {

</div>
</div>
}
}

0 comments on commit 2f9b899

Please sign in to comment.