nbgitpuller-jl-interface 0.2.5__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/CHANGELOG.md +19 -2
  2. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/PKG-INFO +1 -1
  3. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/_version.py +1 -1
  4. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/package.json +2 -2
  5. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/schemas/nbgitpuller-jl-interface/package.json.orig +1 -1
  6. nbgitpuller_jl_interface-0.3.0/nbgitpuller_jl_interface/labextension/static/293.7e24a188a3691a1deaa8.js +1 -0
  7. nbgitpuller_jl_interface-0.2.5/nbgitpuller_jl_interface/labextension/static/remoteEntry.34a78c2aa73e0e0f2b81.js → nbgitpuller_jl_interface-0.3.0/nbgitpuller_jl_interface/labextension/static/remoteEntry.b250a24d9f9650f8659a.js +1 -1
  8. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/package.json +1 -1
  9. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/src/__tests__/nbgitpuller_jb_interface.spec.ts +20 -34
  10. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/src/index.ts +6 -8
  11. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/src/utils.ts +33 -33
  12. nbgitpuller_jl_interface-0.2.5/nbgitpuller_jl_interface/labextension/static/293.d9c8968d6d528bad2399.js +0 -1
  13. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/.copier-answers.yml +0 -0
  14. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/.gitignore +0 -0
  15. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/.prettierignore +0 -0
  16. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/.vscode/settings.json +0 -0
  17. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/.yarnrc.yml +0 -0
  18. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/LICENSE +0 -0
  19. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/README.md +0 -0
  20. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/RELEASE.md +0 -0
  21. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/babel.config.js +0 -0
  22. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/conftest.py +0 -0
  23. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/install.json +0 -0
  24. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/jest.config.js +0 -0
  25. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/jupyter-config/server-config/nbgitpuller_jl_interface.json +0 -0
  26. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/__init__.py +0 -0
  27. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/schemas/nbgitpuller-jl-interface/plugin.json +0 -0
  28. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/static/728.c80bd4566fc22d8dd093.js +0 -0
  29. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/static/style.js +0 -0
  30. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/labextension/static/third-party-licenses.json +0 -0
  31. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/routes.py +0 -0
  32. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/tests/__init__.py +0 -0
  33. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/tests/test_routes.py +0 -0
  34. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/tests/test_utils.py +0 -0
  35. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/nbgitpuller_jl_interface/utils.py +0 -0
  36. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/pyproject.toml +0 -0
  37. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/schema/plugin.json +0 -0
  38. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/setup.py +0 -0
  39. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/src/request.ts +0 -0
  40. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/style/base.css +0 -0
  41. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/style/index.css +0 -0
  42. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/style/index.js +0 -0
  43. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/style/tmp_logo.svg +0 -0
  44. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/tsconfig.json +0 -0
  45. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/tsconfig.test.json +0 -0
  46. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/README.md +0 -0
  47. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/jupyter_server_test_config.py +0 -0
  48. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/package.json +0 -0
  49. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/playwright.config.js +0 -0
  50. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/tests/nbgitpuller_jl_interface.spec.ts +0 -0
  51. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/ui-tests/yarn.lock +0 -0
  52. {nbgitpuller_jl_interface-0.2.5 → nbgitpuller_jl_interface-0.3.0}/yarn.lock +0 -0
@@ -2,6 +2,25 @@
2
2
 
3
3
  <!-- <START NEW CHANGELOG ENTRY> -->
4
4
 
5
+ ## 0.3.0
6
+
7
+ ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.2.5...eab8732c960fecc43d3cda8560330cc3b692a5bf))
8
+
9
+ ### Bugs fixed
10
+
11
+ - Make compatable with jupyterhub environment [#4](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/pull/4) ([@segallagher](https://github.com/segallagher), [@dgpalmieri](https://github.com/dgpalmieri))
12
+
13
+ ### Contributors to this release
14
+
15
+ The following people contributed discussions, new ideas, code and documentation contributions, and review.
16
+ See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/use/#how-does-this-tool-define-contributions-in-the-reports).
17
+
18
+ ([GitHub contributors page for this release](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/graphs/contributors?from=2026-04-09&to=2026-04-10&type=c))
19
+
20
+ @dgpalmieri ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Adgpalmieri+updated%3A2026-04-09..2026-04-10&type=Issues)) | @segallagher ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Asegallagher+updated%3A2026-04-09..2026-04-10&type=Issues))
21
+
22
+ <!-- <END NEW CHANGELOG ENTRY> -->
23
+
5
24
  ## 0.2.5
6
25
 
7
26
  ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.2.4...acb905136fd3b05e07da5e1c3da4ee88bec7aba9))
@@ -19,8 +38,6 @@ See [our definition of contributors](https://github-activity.readthedocs.io/en/l
19
38
 
20
39
  @emlundell ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Aemlundell+updated%3A2026-04-07..2026-04-09&type=Issues)) | @segallagher ([activity](https://github.com/search?q=repo%3AASFOpenSARlab%2Fnbgitpuller-jl-interface+involves%3Asegallagher+updated%3A2026-04-07..2026-04-09&type=Issues))
21
40
 
22
- <!-- <END NEW CHANGELOG ENTRY> -->
23
-
24
41
  ## 0.2.4
25
42
 
26
43
  ([Full Changelog](https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/compare/v0.2.1...fa249abe827af836d7aa2ac0a870c4d30eff516e))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbgitpuller_jl_interface
3
- Version: 0.2.5
3
+ Version: 0.3.0
4
4
  Summary: A human interface with nbgitpuller in JupyterBook
5
5
  Project-URL: Homepage, https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface
6
6
  Project-URL: Bug Tracker, https://github.com/ASFOpenSARlab/nbgitpuller-jl-interface/issues
@@ -1,4 +1,4 @@
1
1
  # This file is auto-generated by Hatchling. As such, do not:
2
2
  # - modify
3
3
  # - track in version control e.g. be sure to add to .gitignore
4
- __version__ = VERSION = '0.2.5'
4
+ __version__ = VERSION = '0.3.0'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -117,7 +117,7 @@
117
117
  "outputDir": "nbgitpuller_jl_interface/labextension",
118
118
  "schemaDir": "schema",
119
119
  "_build": {
120
- "load": "static/remoteEntry.34a78c2aa73e0e0f2b81.js",
120
+ "load": "static/remoteEntry.b250a24d9f9650f8659a.js",
121
121
  "extension": "./extension",
122
122
  "style": "./style"
123
123
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[]).push([[293],{293(t,e,n){n.r(e),n.d(e,{default:()=>b,getJupyterAppInstance:()=>g});var o=n(813),r=n(778),i=n(53),a=n(41);const s="nbgitpuller-jl-interface-update-btn";let l,c=!1;async function p(t){const e=await async function(t){var e;let n=0,o=0;for(const r of t){const t=r.repoUrl,i=r.branch,s=r.destPath,l=a.PageConfig.getBaseUrl(),c=a.URLExt.join(l,"nbgitpuller-jl-interface","update-check"),p=null===(e=document.cookie.split(";").find(t=>t.startsWith("_xsrf=")))||void 0===e?void 0:e.split("=")[1],u=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=p?p:""},body:JSON.stringify({repositoryUrl:t,repositoryBranch:i,destination:s})}),d=await u.json();0!==d.returncode?o+=1:d.updatefound&&(n+=1)}return{response:{numToBeUpdated:n,numWithErrors:o},statuscode:0}}(t);if(0===e.statuscode){const n=e.response;let o="";n.numToBeUpdated+n.numWithErrors?(n.numToBeUpdated&&(o+=`${n.numToBeUpdated} notebooks awaiting updates\n`),n.numWithErrors&&(o+=`${n.numWithErrors} notebooks with errors`)):o=`${t.length} Notebooks up to date`;const r=await async function(t,e,n){const o=document.getElementById(s);if(!o)return{error:"Unable to find nbgitpuller widget",returncode:1};let r;function i(t,e){return`\n <div class="lm-Widget jp-ToolbarButton nbgitpuller-jl-interface-wrapper"\n title="${t}">\n <jp-button class="nbgitpuller-jl-interface-update-btn jp-ToolbarButtonComponent">\n ${e}\n </jp-button>\n </div>`}return r=t?'<p><span class="success">◉</span> Up to Date</p>':'<p><span class="failure blink">◉</span> Update Notebooks</p>',o.innerHTML=i(e,r),o.addEventListener("click",async()=>{if(c)return;c=!0;o.innerHTML=i("Updating Notebooks...",'<p><span class="lds-dual-ring"></span> Updating</p>');const t=await async function(t){var e;const n=a.PageConfig.getBaseUrl(),o=a.URLExt.join(n,"nbgitpuller-jl-interface","gitpuller"),r=null===(e=document.cookie.split(";").find(t=>t.startsWith("_xsrf=")))||void 0===e?void 0:e.split("=")[1],i=[];for(const e of t){const t=e.repoUrl,n=e.branch,a=e.destPath,s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=r?r:""},body:JSON.stringify({repositoryUrl:t,repositoryBranch:n,destination:a})}),l=await s.json();0!==l.returncode&&i.push({repo:t,reason:l.error})}return i}(n);if(await p(n),0!==t.length){let e="Failed to update the following notebooks: \n";for(const n of t)e+=`${n.repo}`;console.log(e),alert(e)}c=!1}),{error:"",returncode:0}}(n.numToBeUpdated+n.numWithErrors===0,o,t);0!==r.returncode&&console.error(r)}}var u=n(726);let d=null;function g(t){if(!d&&t&&(d=t),!d)throw new Error("App instance has not been initialized yet");return d}const f={id:"nbgitpuller-jl-interface:plugin",description:"A human interface with nbgitpuller in JupyterBook",autoStart:!0,optional:[],requires:[o.ILabShell,r.ICommandPalette,u.ISettingRegistry,o.JupyterFrontEnd.IPaths],activate:(t,e,n,o,a)=>{o?(Promise.all([t.restored,o.load(f.id)]).then(async([,e])=>{async function n(e){e.get("reloadWidget").composite&&(await async function(t,e){const n=e.get("repos").composite,o=e.get("rank").composite,a=(0,i.find)(t.shell.widgets("top"),t=>t.id===s);a&&a.dispose();const l=new r.ToolbarButton({className:"nbgitpuller-jl-interface-update-btn",label:"◉ Initializing",tooltip:"Initializing nbgitpuller"});l.id=s,l.addClass("nbgitpuller-jl-interface-wrapper"),t.shell.add(l,"top",{rank:o}),await new Promise(t=>setTimeout(t,1e3)),await p(n),console.log("nbgitpuller-jl-interface settings loaded")}(t,e),await async function(t){const e=t.get("repos").composite,n=t.get("probeInterval").composite;clearInterval(l),l=setInterval(async()=>{await p(e)},n)}(e),await e.set("reloadWidget",!1))}await e.set("reloadWidget",!0),n(e),e.changed.connect(n),console.log("JupyterLab extension nbgitpuller-jl-interface is fully operational!")}).catch(t=>{console.error(`Something went wrong...${t}`)}),console.log("JupyterLab extension nbgitpuller-jl-interface is activated!")):console.log("Settings not found. nbgitpuller-jl-interface cannot be established.")}},b=f}}]);
@@ -1 +1 @@
1
- var _JUPYTERLAB;(()=>{"use strict";var e,r,t,n,o,a,i,l,u,f,s,c,p,d,h,v,g,b,m,y={234(e,r,t){var n={"./index":()=>t.e(293).then(()=>()=>t(293)),"./extension":()=>t.e(293).then(()=>()=>t(293)),"./style":()=>t.e(728).then(()=>()=>t(728))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},w={};function j(e){var r=w[e];if(void 0!==r)return r.exports;var t=w[e]={id:e,exports:{}};return y[e](t,t.exports,j),t.exports}j.m=y,j.c=w,j.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return j.d(r,{a:r}),r},j.d=(e,r)=>{for(var t in r)j.o(r,t)&&!j.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},j.f={},j.e=e=>Promise.all(Object.keys(j.f).reduce((r,t)=>(j.f[t](e,r),r),[])),j.u=e=>e+"."+{293:"d9c8968d6d528bad2399",728:"c80bd4566fc22d8dd093"}[e]+".js?v="+{293:"d9c8968d6d528bad2399",728:"c80bd4566fc22d8dd093"}[e],j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),j.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="nbgitpuller-jl-interface:",j.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==o)for(var u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var s=u[f];if(s.getAttribute("src")==t||s.getAttribute("data-webpack")==r+o){i=s;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",j.nc&&i.setAttribute("nonce",j.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var c=(r,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=c.bind(null,i.onerror),i.onload=c.bind(null,i.onload),l&&document.head.appendChild(i)}},j.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{j.S={};var e={},r={};j.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];j.o(j.S,t)||(j.S[t]={});var a=j.S[t],i="nbgitpuller-jl-interface",l=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(1!=!l.eager?n:i>l.from))&&(o[r]={get:()=>j.e(293).then(()=>()=>j(293)),from:i,eager:!1})})("nbgitpuller-jl-interface","0.2.5"),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{var e;j.g.importScripts&&(e=j.g.location+"");var r=j.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),j.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(l=e[a]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+u()+")":1===l?"("+u()+" || "+u()+")":2===l?i.pop()+" "+i.pop():o(l))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,l=1,u=!0;;l++,i++){var f,s,c=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(s=(typeof(f=r[i]))[0]))return!u||("u"==c?l>n&&!o:""==c!=o);if("u"==s){if(!u||"u"!=c)return!1}else if(u)if(c==s)if(l<=n){if(f!=e[l])return!1}else{if(o?f>e[l]:f<e[l])return!1;f!=e[l]&&(u=!1)}else if("s"!=c&&"n"!=c){if(o||l<=n)return!1;u=!1,l--}else{if(l<=n||s<c!=o)return!1;u=!1}else"s"!=c&&"n"!=c&&(u=!1,l--)}}var p=[],d=p.pop.bind(p);for(i=1;i<e.length;i++){var h=e[i];p.push(1==h?d()|d():2==h?d()&d():h?a(h,r):!d())}return!!d()},i=(e,r)=>e&&j.o(e,r),l=e=>(e.loaded=1,e.get()),u=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),f=(e,r,t)=>{var o=t?u(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},s=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",c=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},d=(e,r,t)=>t?t():((e,r)=>c("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),h=(e=>function(r,t,n,o,a){var i=j.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,j.S[r],t,!1,o,a)):e(r,j.S[r],t,n,o,a)})((e,r,t,n,o,u)=>{if(!i(r,t))return d(e,t,u);var c=f(r,t,n);return a(o,c)||p(s(r,t,c,o)),l(r[t][c])}),v={},g={53:()=>h("default","@lumino/algorithm",!1,[1,2,0,0]),726:()=>h("default","@jupyterlab/settingregistry",!1,[1,4,5,6]),778:()=>h("default","@jupyterlab/apputils",!1,[1,4,6,6]),813:()=>h("default","@jupyterlab/application",!1,[1,4,5,6])},b={293:[53,726,778,813]},m={},j.f.consumes=(e,r)=>{j.o(b,e)&&b[e].forEach(e=>{if(j.o(v,e))return r.push(v[e]);if(!m[e]){var t=r=>{v[e]=0,j.m[e]=t=>{delete j.c[e],t.exports=r()}};m[e]=!0;var n=r=>{delete v[e],j.m[e]=t=>{throw delete j.c[e],r}};try{var o=g[e]();o.then?r.push(v[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={34:0};j.f.j=(r,t)=>{var n=j.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=j.p+j.u(r),i=new Error;j.l(a,t=>{if(j.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,l]=t,u=0;if(a.some(r=>0!==e[r])){for(n in i)j.o(i,n)&&(j.m[n]=i[n]);l&&l(j)}for(r&&r(t);u<a.length;u++)o=a[u],j.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),j.nc=void 0;var S=j(234);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["nbgitpuller-jl-interface"]=S})();
1
+ var _JUPYTERLAB;(()=>{"use strict";var e,r,t,n,o,a,i,l,u,f,s,c,p,d,h,v,g,b,m,y={234(e,r,t){var n={"./index":()=>t.e(293).then(()=>()=>t(293)),"./extension":()=>t.e(293).then(()=>()=>t(293)),"./style":()=>t.e(728).then(()=>()=>t(728))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},w={};function j(e){var r=w[e];if(void 0!==r)return r.exports;var t=w[e]={id:e,exports:{}};return y[e](t,t.exports,j),t.exports}j.m=y,j.c=w,j.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return j.d(r,{a:r}),r},j.d=(e,r)=>{for(var t in r)j.o(r,t)&&!j.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},j.f={},j.e=e=>Promise.all(Object.keys(j.f).reduce((r,t)=>(j.f[t](e,r),r),[])),j.u=e=>e+"."+{293:"7e24a188a3691a1deaa8",728:"c80bd4566fc22d8dd093"}[e]+".js?v="+{293:"7e24a188a3691a1deaa8",728:"c80bd4566fc22d8dd093"}[e],j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),j.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="nbgitpuller-jl-interface:",j.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==o)for(var u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var s=u[f];if(s.getAttribute("src")==t||s.getAttribute("data-webpack")==r+o){i=s;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",j.nc&&i.setAttribute("nonce",j.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var c=(r,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=c.bind(null,i.onerror),i.onload=c.bind(null,i.onload),l&&document.head.appendChild(i)}},j.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{j.S={};var e={},r={};j.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];j.o(j.S,t)||(j.S[t]={});var a=j.S[t],i="nbgitpuller-jl-interface",l=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},l=o[r];(!l||!l.loaded&&(1!=!l.eager?n:i>l.from))&&(o[r]={get:()=>j.e(293).then(()=>()=>j(293)),from:i,eager:!1})})("nbgitpuller-jl-interface","0.3.0"),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{var e;j.g.importScripts&&(e=j.g.location+"");var r=j.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),j.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(l=e[a]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+u()+")":1===l?"("+u()+" || "+u()+")":2===l?i.pop()+" "+i.pop():o(l))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,l=1,u=!0;;l++,i++){var f,s,c=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(s=(typeof(f=r[i]))[0]))return!u||("u"==c?l>n&&!o:""==c!=o);if("u"==s){if(!u||"u"!=c)return!1}else if(u)if(c==s)if(l<=n){if(f!=e[l])return!1}else{if(o?f>e[l]:f<e[l])return!1;f!=e[l]&&(u=!1)}else if("s"!=c&&"n"!=c){if(o||l<=n)return!1;u=!1,l--}else{if(l<=n||s<c!=o)return!1;u=!1}else"s"!=c&&"n"!=c&&(u=!1,l--)}}var p=[],d=p.pop.bind(p);for(i=1;i<e.length;i++){var h=e[i];p.push(1==h?d()|d():2==h?d()&d():h?a(h,r):!d())}return!!d()},i=(e,r)=>e&&j.o(e,r),l=e=>(e.loaded=1,e.get()),u=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),f=(e,r,t)=>{var o=t?u(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},s=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",c=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},d=(e,r,t)=>t?t():((e,r)=>c("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),h=(e=>function(r,t,n,o,a){var i=j.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,j.S[r],t,!1,o,a)):e(r,j.S[r],t,n,o,a)})((e,r,t,n,o,u)=>{if(!i(r,t))return d(e,t,u);var c=f(r,t,n);return a(o,c)||p(s(r,t,c,o)),l(r[t][c])}),v={},g={41:()=>h("default","@jupyterlab/coreutils",!1,[1,6,5,6]),53:()=>h("default","@lumino/algorithm",!1,[1,2,0,0]),726:()=>h("default","@jupyterlab/settingregistry",!1,[1,4,5,6]),778:()=>h("default","@jupyterlab/apputils",!1,[1,4,6,6]),813:()=>h("default","@jupyterlab/application",!1,[1,4,5,6])},b={293:[41,53,726,778,813]},m={},j.f.consumes=(e,r)=>{j.o(b,e)&&b[e].forEach(e=>{if(j.o(v,e))return r.push(v[e]);if(!m[e]){var t=r=>{v[e]=0,j.m[e]=t=>{delete j.c[e],t.exports=r()}};m[e]=!0;var n=r=>{delete v[e],j.m[e]=t=>{throw delete j.c[e],r}};try{var o=g[e]();o.then?r.push(v[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={34:0};j.f.j=(r,t)=>{var n=j.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=j.p+j.u(r),i=new Error;j.l(a,t=>{if(j.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,l]=t,u=0;if(a.some(r=>0!==e[r])){for(n in i)j.o(i,n)&&(j.m[n]=i[n]);l&&l(j)}for(r&&r(t);u<a.length;u++)o=a[u],j.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),j.nc=void 0;var S=j(234);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["nbgitpuller-jl-interface"]=S})();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbgitpuller-jl-interface",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "A human interface with nbgitpuller in JupyterBook",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -34,10 +34,9 @@ describe('nbgitpuller-jl-interface utils checkForRepoUpdates', () => {
34
34
  }) as unknown as Response
35
35
  );
36
36
 
37
- const returnValue = await checkForRepoUpdates(
38
- [{ repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }],
39
- '/'
40
- );
37
+ const returnValue = await checkForRepoUpdates([
38
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
39
+ ]);
41
40
 
42
41
  expect(returnValue).toStrictEqual({
43
42
  response: { numToBeUpdated: 1, numWithErrors: 0 },
@@ -61,10 +60,9 @@ describe('nbgitpuller-jl-interface utils checkForRepoUpdates', () => {
61
60
  );
62
61
 
63
62
  // const returnValue = await fetch("https://aaagaag.com")
64
- const returnValue = await checkForRepoUpdates(
65
- [{ repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }],
66
- '/'
67
- );
63
+ const returnValue = await checkForRepoUpdates([
64
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
65
+ ]);
68
66
 
69
67
  expect(returnValue).toStrictEqual({
70
68
  response: { numToBeUpdated: 0, numWithErrors: 1 },
@@ -116,14 +114,11 @@ describe('nbgitpuller-jl-interface utils checkForRepoUpdates', () => {
116
114
  );
117
115
 
118
116
  // const returnValue = await fetch("https://aaagaag.com")
119
- const returnValue = await checkForRepoUpdates(
120
- [
121
- { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' },
122
- { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' },
123
- { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
124
- ],
125
- '/'
126
- );
117
+ const returnValue = await checkForRepoUpdates([
118
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' },
119
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' },
120
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
121
+ ]);
127
122
  expect(returnValue).toStrictEqual({
128
123
  response: { numToBeUpdated: 2, numWithErrors: 1 },
129
124
  statuscode: 0
@@ -144,12 +139,9 @@ describe('nbgitpuller-jl-interface utils setUpdateButtonDisplay', () => {
144
139
  widget.id = 'nbgitpuller-jl-interface-update-btn';
145
140
  document.body.appendChild(widget);
146
141
 
147
- const returnValue = await setUpdateButtonDisplay(
148
- true,
149
- '',
150
- [{ repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }],
151
- '/'
152
- );
142
+ const returnValue = await setUpdateButtonDisplay(true, '', [
143
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
144
+ ]);
153
145
 
154
146
  expect(returnValue).toStrictEqual({ error: '', returncode: 0 });
155
147
  expect(widget.innerHTML).toContain(`<span class="success">◉</span>`);
@@ -160,24 +152,18 @@ describe('nbgitpuller-jl-interface utils setUpdateButtonDisplay', () => {
160
152
  widget.id = 'nbgitpuller-jl-interface-update-btn';
161
153
  document.body.appendChild(widget);
162
154
 
163
- const returnValue = await setUpdateButtonDisplay(
164
- false,
165
- '',
166
- [{ repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }],
167
- '/'
168
- );
155
+ const returnValue = await setUpdateButtonDisplay(false, '', [
156
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
157
+ ]);
169
158
 
170
159
  expect(returnValue).toStrictEqual({ error: '', returncode: 0 });
171
160
  expect(widget.innerHTML).toContain(`<span class="failure blink">◉</span>`);
172
161
  });
173
162
 
174
163
  it('widget not found', async () => {
175
- const returnValue = await setUpdateButtonDisplay(
176
- false,
177
- '',
178
- [{ repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }],
179
- '/'
180
- );
164
+ const returnValue = await setUpdateButtonDisplay(false, '', [
165
+ { repoUrl: 'https://fakerepo.com', branch: 'main', destPath: 'mypath' }
166
+ ]);
181
167
 
182
168
  expect(returnValue).toStrictEqual({
183
169
  error: 'Unable to find nbgitpuller widget',
@@ -44,8 +44,6 @@ const plugin: JupyterFrontEndPlugin<void> = {
44
44
  settingRegistry: ISettingRegistry | null,
45
45
  paths: JupyterFrontEnd.IPaths
46
46
  ) => {
47
- const baseUrl = paths?.urls?.base;
48
-
49
47
  // Wait for the application to be restored and
50
48
  // for the settings for this plugin to be loaded
51
49
  if (!settingRegistry) {
@@ -62,23 +60,23 @@ const plugin: JupyterFrontEndPlugin<void> = {
62
60
  await settings.set('reloadWidget', true);
63
61
 
64
62
  async function loadSettings(
65
- allSettings: ISettingRegistry.ISettings,
66
- baseUrl: string
63
+ allSettings: ISettingRegistry.ISettings
67
64
  ): Promise<void> {
68
65
  const reloadWidget = allSettings.get('reloadWidget')
69
66
  .composite as boolean;
67
+
70
68
  if (reloadWidget) {
71
- await nbgitpullerUpdateButton(app, allSettings, baseUrl);
72
- await repoUpdateProbe(allSettings, baseUrl);
69
+ await nbgitpullerUpdateButton(app, allSettings);
70
+ await repoUpdateProbe(allSettings);
73
71
  await allSettings.set('reloadWidget', false);
74
72
  }
75
73
  }
76
74
 
77
75
  // Read the settings
78
- loadSettings(settings, baseUrl);
76
+ loadSettings(settings);
79
77
 
80
78
  // Listen for your plugin setting changes using Signal
81
- settings.changed.connect(settings => loadSettings(settings, baseUrl));
79
+ settings.changed.connect(loadSettings);
82
80
 
83
81
  console.log(
84
82
  'JupyterLab extension nbgitpuller-jl-interface is fully operational!'
@@ -6,6 +6,8 @@ import { find } from '@lumino/algorithm';
6
6
 
7
7
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
8
8
 
9
+ import { PageConfig, URLExt } from '@jupyterlab/coreutils';
10
+
9
11
  const widget_id = 'nbgitpuller-jl-interface-update-btn';
10
12
  let intervalID: ReturnType<typeof setInterval>;
11
13
  let currentlyUpdating: boolean = false;
@@ -18,8 +20,7 @@ export interface IRepository {
18
20
 
19
21
  export async function nbgitpullerUpdateButton(
20
22
  app: JupyterFrontEnd,
21
- allSettings: ISettingRegistry.ISettings,
22
- baseUrl: string
23
+ allSettings: ISettingRegistry.ISettings
23
24
  ): Promise<void> {
24
25
  const repositories = allSettings.get('repos')
25
26
  .composite as any as IRepository[];
@@ -42,18 +43,18 @@ export async function nbgitpullerUpdateButton(
42
43
  // 1-899 left justified, 900+ right justified
43
44
  app.shell.add(updateReposBtn, 'top', { rank: rank });
44
45
 
46
+ // Wait one second for initial creation timing
47
+ await new Promise(f => setTimeout(f, 1000));
48
+
45
49
  // Check for updates
46
- checkForUpdatesAndSetDisplay(repositories, baseUrl);
50
+ await checkForUpdatesAndSetDisplay(repositories);
47
51
 
48
52
  console.log('nbgitpuller-jl-interface settings loaded');
49
53
  }
50
54
 
51
- export async function makeNbgitpullerRequest(
52
- repositories: IRepository[],
53
- baseUrl: string
54
- ) {
55
- const url =
56
- window.location.origin + baseUrl + 'nbgitpuller-jl-interface/gitpuller';
55
+ export async function makeNbgitpullerRequest(repositories: IRepository[]) {
56
+ const baseUrl = PageConfig.getBaseUrl();
57
+ const url = URLExt.join(baseUrl, 'nbgitpuller-jl-interface', 'gitpuller');
57
58
  const xsrfToken = document.cookie
58
59
  .split(';')
59
60
  .find(row => row.startsWith('_xsrf='))
@@ -90,8 +91,7 @@ export async function makeNbgitpullerRequest(
90
91
  }
91
92
 
92
93
  export async function repoUpdateProbe(
93
- allSettings: ISettingRegistry.ISettings,
94
- baseUrl: string
94
+ allSettings: ISettingRegistry.ISettings
95
95
  ): Promise<void> {
96
96
  const repositories = allSettings.get('repos')
97
97
  .composite as any as IRepository[];
@@ -102,13 +102,12 @@ export async function repoUpdateProbe(
102
102
 
103
103
  // Create interval
104
104
  intervalID = setInterval(async () => {
105
- checkForUpdatesAndSetDisplay(repositories, baseUrl);
105
+ await checkForUpdatesAndSetDisplay(repositories);
106
106
  }, probeInterval);
107
107
  }
108
108
 
109
109
  export async function checkForRepoUpdates(
110
- repositories: IRepository[],
111
- baseUrl: string
110
+ repositories: IRepository[]
112
111
  ): Promise<{
113
112
  response: { numToBeUpdated: number; numWithErrors: number };
114
113
  statuscode: number;
@@ -123,10 +122,12 @@ export async function checkForRepoUpdates(
123
122
  const destination = repo['destPath'];
124
123
 
125
124
  // Poll repo for any new commits
126
- const url =
127
- window.location.origin +
128
- baseUrl +
129
- 'nbgitpuller-jl-interface/update-check';
125
+ const baseUrl = PageConfig.getBaseUrl();
126
+ const url = URLExt.join(
127
+ baseUrl,
128
+ 'nbgitpuller-jl-interface',
129
+ 'update-check'
130
+ );
130
131
  const xsrfToken = document.cookie
131
132
  .split(';')
132
133
  .find(row => row.startsWith('_xsrf='))
@@ -162,11 +163,11 @@ export async function checkForRepoUpdates(
162
163
  }
163
164
 
164
165
  export async function checkForUpdatesAndSetDisplay(
165
- repositories: IRepository[],
166
- baseUrl: string
166
+ repositories: IRepository[]
167
167
  ) {
168
168
  // Check for updates
169
- const repoUpdates = await checkForRepoUpdates(repositories, baseUrl);
169
+ const repoUpdates = await checkForRepoUpdates(repositories);
170
+
170
171
  // Update display
171
172
  if (repoUpdates['statuscode'] === 0) {
172
173
  const updateCheckResponse = repoUpdates['response'] as {
@@ -180,21 +181,21 @@ export async function checkForUpdatesAndSetDisplay(
180
181
  updateCheckResponse['numWithErrors']
181
182
  ) {
182
183
  if (updateCheckResponse['numToBeUpdated']) {
183
- tooltip += `${updateCheckResponse['numToBeUpdated']} awaiting updates\n`;
184
+ tooltip += `${updateCheckResponse['numToBeUpdated']} notebooks awaiting updates\n`;
184
185
  }
185
186
  if (updateCheckResponse['numWithErrors']) {
186
- tooltip += `${updateCheckResponse['numWithErrors']} repos with errors`;
187
+ tooltip += `${updateCheckResponse['numWithErrors']} notebooks with errors`;
187
188
  }
188
189
  } else {
189
- tooltip = `${repositories.length} Repos up to date`;
190
+ tooltip = `${repositories.length} Notebooks up to date`;
190
191
  }
192
+
191
193
  const updateDisplayResponse = await setUpdateButtonDisplay(
192
194
  updateCheckResponse['numToBeUpdated'] +
193
195
  updateCheckResponse['numWithErrors'] ===
194
196
  0,
195
197
  tooltip,
196
- repositories,
197
- baseUrl
198
+ repositories
198
199
  );
199
200
  if (updateDisplayResponse.returncode !== 0) {
200
201
  console.error(updateDisplayResponse);
@@ -205,8 +206,7 @@ export async function checkForUpdatesAndSetDisplay(
205
206
  export async function setUpdateButtonDisplay(
206
207
  upToDate: boolean,
207
208
  tooltip: string,
208
- repositories: IRepository[],
209
- baseUrl: string
209
+ repositories: IRepository[]
210
210
  ): Promise<{ error: string; returncode: number }> {
211
211
  // Get widget
212
212
  const widget: HTMLElement | null = document.getElementById(widget_id);
@@ -219,7 +219,7 @@ export async function setUpdateButtonDisplay(
219
219
  if (upToDate) {
220
220
  labelHTML = '<p><span class="success">◉</span> Up to Date</p>';
221
221
  } else {
222
- labelHTML = '<p><span class="failure blink">◉</span> Update Repos</p>';
222
+ labelHTML = '<p><span class="failure blink">◉</span> Update Notebooks</p>';
223
223
  }
224
224
 
225
225
  function generateWidgetHTML(tooltip: string, labelHTML: string): string {
@@ -242,20 +242,20 @@ export async function setUpdateButtonDisplay(
242
242
  // Set updating flag
243
243
  currentlyUpdating = true;
244
244
  // Update widget to running animation
245
- const pendingTooltip = 'Updating Repos...';
245
+ const pendingTooltip = 'Updating Notebooks...';
246
246
  const pendingLabelHTML =
247
247
  '<p><span class="lds-dual-ring"></span> Updating</p>';
248
248
  widget.innerHTML = generateWidgetHTML(pendingTooltip, pendingLabelHTML);
249
249
 
250
250
  // Pull each repository
251
- const failed_updates = await makeNbgitpullerRequest(repositories, baseUrl);
251
+ const failed_updates = await makeNbgitpullerRequest(repositories);
252
252
 
253
253
  // Update widget to all updated or pending updates
254
- checkForUpdatesAndSetDisplay(repositories, baseUrl);
254
+ await checkForUpdatesAndSetDisplay(repositories);
255
255
 
256
256
  // Notify users of any failure
257
257
  if (failed_updates.length !== 0) {
258
- let failure_message = 'Failed to update the following repos: \n';
258
+ let failure_message = 'Failed to update the following notebooks: \n';
259
259
  for (const failure of failed_updates) {
260
260
  failure_message += `${failure['repo']}`;
261
261
  }
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunknbgitpuller_jl_interface=self.webpackChunknbgitpuller_jl_interface||[]).push([[293],{293(t,e,n){n.r(e),n.d(e,{default:()=>f,getJupyterAppInstance:()=>d});var o=n(813),r=n(778),i=n(53);const a="nbgitpuller-jl-interface-update-btn";let l,s=!1;async function c(t,e){const n=await async function(t,e){var n;let o=0,r=0;for(const i of t){const t=i.repoUrl,a=i.branch,l=i.destPath,s=window.location.origin+e+"nbgitpuller-jl-interface/update-check",c=null===(n=document.cookie.split(";").find(t=>t.startsWith("_xsrf=")))||void 0===n?void 0:n.split("=")[1],p=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=c?c:""},body:JSON.stringify({repositoryUrl:t,repositoryBranch:a,destination:l})}),u=await p.json();0!==u.returncode?r+=1:u.updatefound&&(o+=1)}return{response:{numToBeUpdated:o,numWithErrors:r},statuscode:0}}(t,e);if(0===n.statuscode){const o=n.response;let r="";o.numToBeUpdated+o.numWithErrors?(o.numToBeUpdated&&(r+=`${o.numToBeUpdated} awaiting updates\n`),o.numWithErrors&&(r+=`${o.numWithErrors} repos with errors`)):r=`${t.length} Repos up to date`;const i=await async function(t,e,n,o){const r=document.getElementById(a);if(!r)return{error:"Unable to find nbgitpuller widget",returncode:1};let i;function l(t,e){return`\n <div class="lm-Widget jp-ToolbarButton nbgitpuller-jl-interface-wrapper"\n title="${t}">\n <jp-button class="nbgitpuller-jl-interface-update-btn jp-ToolbarButtonComponent">\n ${e}\n </jp-button>\n </div>`}return i=t?'<p><span class="success">◉</span> Up to Date</p>':'<p><span class="failure blink">◉</span> Update Repos</p>',r.innerHTML=l(e,i),r.addEventListener("click",async()=>{if(s)return;s=!0;r.innerHTML=l("Updating Repos...",'<p><span class="lds-dual-ring"></span> Updating</p>');const t=await async function(t,e){var n;const o=window.location.origin+e+"nbgitpuller-jl-interface/gitpuller",r=null===(n=document.cookie.split(";").find(t=>t.startsWith("_xsrf=")))||void 0===n?void 0:n.split("=")[1],i=[];for(const e of t){const t=e.repoUrl,n=e.branch,a=e.destPath,l=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-XSRFToken":null!=r?r:""},body:JSON.stringify({repositoryUrl:t,repositoryBranch:n,destination:a})}),s=await l.json();0!==s.returncode&&i.push({repo:t,reason:s.error})}return i}(n,o);if(c(n,o),0!==t.length){let e="Failed to update the following repos: \n";for(const n of t)e+=`${n.repo}`;console.log(e),alert(e)}s=!1}),{error:"",returncode:0}}(o.numToBeUpdated+o.numWithErrors===0,r,t,e);0!==i.returncode&&console.error(i)}}var p=n(726);let u=null;function d(t){if(!u&&t&&(u=t),!u)throw new Error("App instance has not been initialized yet");return u}const g={id:"nbgitpuller-jl-interface:plugin",description:"A human interface with nbgitpuller in JupyterBook",autoStart:!0,optional:[],requires:[o.ILabShell,r.ICommandPalette,p.ISettingRegistry,o.JupyterFrontEnd.IPaths],activate:(t,e,n,o,s)=>{var p;const u=null===(p=null==s?void 0:s.urls)||void 0===p?void 0:p.base;o?(Promise.all([t.restored,o.load(g.id)]).then(async([,e])=>{async function n(e,n){e.get("reloadWidget").composite&&(await async function(t,e,n){const o=e.get("repos").composite,l=e.get("rank").composite,s=(0,i.find)(t.shell.widgets("top"),t=>t.id===a);s&&s.dispose();const p=new r.ToolbarButton({className:"nbgitpuller-jl-interface-update-btn",label:"◉ Initializing",tooltip:"Initializing nbgitpuller"});p.id=a,p.addClass("nbgitpuller-jl-interface-wrapper"),t.shell.add(p,"top",{rank:l}),c(o,n),console.log("nbgitpuller-jl-interface settings loaded")}(t,e,n),await async function(t,e){const n=t.get("repos").composite,o=t.get("probeInterval").composite;clearInterval(l),l=setInterval(async()=>{c(n,e)},o)}(e,n),await e.set("reloadWidget",!1))}await e.set("reloadWidget",!0),n(e,u),e.changed.connect(t=>n(t,u)),console.log("JupyterLab extension nbgitpuller-jl-interface is fully operational!")}).catch(t=>{console.error(`Something went wrong...${t}`)}),console.log("JupyterLab extension nbgitpuller-jl-interface is activated!")):console.log("Settings not found. nbgitpuller-jl-interface cannot be established.")}},f=g}}]);