Skip to content

Commit ebd6d9a

Browse files
authored
Merge pull request #67 from ian-r-rose/0.34
Updates for JupyterLab 0.34
2 parents d524ed7 + c2cf7e3 commit ebd6d9a

File tree

9 files changed

+165
-38
lines changed

9 files changed

+165
-38
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyterlab/github",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "JupyterLab viewer for GitHub repositories",
55
"keywords": [
66
"github",
@@ -41,14 +41,14 @@
4141
"watch": "tsc -w"
4242
},
4343
"dependencies": {
44-
"@jupyterlab/application": "^0.17.0",
45-
"@jupyterlab/apputils": "^0.17.0",
46-
"@jupyterlab/coreutils": "^2.0.0",
47-
"@jupyterlab/docmanager": "^0.17.0",
48-
"@jupyterlab/docregistry": "^0.17.0",
49-
"@jupyterlab/filebrowser": "^0.17.0",
50-
"@jupyterlab/observables": "^2.0.0",
51-
"@jupyterlab/services": "^3.0.0",
44+
"@jupyterlab/application": "^0.18.0",
45+
"@jupyterlab/apputils": "^0.18.0",
46+
"@jupyterlab/coreutils": "^2.1.0",
47+
"@jupyterlab/docmanager": "^0.18.0",
48+
"@jupyterlab/docregistry": "^0.18.0",
49+
"@jupyterlab/filebrowser": "^0.18.2",
50+
"@jupyterlab/observables": "^2.0.3",
51+
"@jupyterlab/services": "^3.1.0",
5252
"@phosphor/algorithm": "^1.1.2",
5353
"@phosphor/signaling": "^1.2.2",
5454
"@phosphor/widgets": "^1.6.0",

schema/drive.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jupyter.lab.setting-icon-class": "jp-GitHub-tablogo",
2+
"jupyter.lab.setting-icon-class": "jp-GitHub-icon",
33
"jupyter.lab.setting-icon-label": "GitHub",
44
"title": "GitHub",
55
"description": "Settings for the GitHub plugin.",

src/browser.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ export class GitHubFileBrowser extends Widget {
7878
}
7979
window.open(url);
8080
},
81-
className: 'jp-GitHubIcon',
81+
iconClassName: 'jp-GitHub-icon jp-Icon jp-Icon-16',
8282
tooltip: 'Open this repository on GitHub'
8383
});
84+
this._openGitHubButton.addClass('jp-GitHub-toolbar-item');
8485
this._browser.toolbar.addItem('GitHub', this._openGitHubButton);
8586

8687
// Create a button the opens MyBinder to the appropriate repo.
@@ -105,10 +106,23 @@ export class GitHubFileBrowser extends Widget {
105106
window.open(url + `?urlpath=${tree}`);
106107
},
107108
tooltip: 'Launch this repository on mybinder.org',
108-
className: 'jp-MyBinderButton'
109+
iconClassName: 'jp-MyBinderButton jp-Icon jp-Icon-16'
109110
});
111+
this._launchBinderButton.addClass('jp-GitHub-toolbar-item');
110112
this._browser.toolbar.addItem('binder', this._launchBinderButton);
111113

114+
// Add our own refresh button, since the other one is hidden
115+
// via CSS.
116+
let refresher = new ToolbarButton({
117+
iconClassName: 'jp-RefreshIcon jp-Icon jp-Icon-16',
118+
onClick: () => {
119+
this._browser.model.refresh();
120+
},
121+
tooltip: 'Refresh File List'
122+
});
123+
refresher.addClass('jp-GitHub-toolbar-item');
124+
this._browser.toolbar.addItem('gh-refresher', refresher);
125+
112126
// Set up a listener to check if we can launch mybinder.
113127
this._browser.model.pathChanged.connect(
114128
this._onPathChanged,
@@ -355,7 +369,7 @@ export class GitHubErrorPanel extends Widget {
355369
* A module-Private namespace.
356370
*/
357371
namespace Private {
358-
export /**
372+
/**
359373
* Given a text node and an input element, replace the text
360374
* node wiht the input element, allowing the user to reset the
361375
* value of the text node.
@@ -367,7 +381,7 @@ namespace Private {
367381
* @returns a Promise that resolves when the editing is complete,
368382
* or has been canceled.
369383
*/
370-
function changeField(
384+
export function changeField(
371385
text: HTMLElement,
372386
edit: HTMLInputElement
373387
): Promise<string> {

src/contents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export class GitHubDrive implements Contents.IDrive {
445445
// If we are looking at the currently authenticated user,
446446
// get all the repositories they own, which includes private ones.
447447
if (currentUser.login === user) {
448-
reposPath = URLExt.join('user', 'repos', '?type=owner');
448+
reposPath = 'user/repos?type=owner';
449449
} else {
450450
reposPath = URLExt.encodeParts(
451451
URLExt.join('users', user, 'repos')

src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,21 @@ function activateFileBrowser(
6060
const drive = new GitHubDrive(app.docRegistry);
6161
manager.services.contents.addDrive(drive);
6262

63+
// Create the embedded filebrowser. GitHub repos likely
64+
// don't need as often of a refresh interval as normal ones,
65+
// and rate-limiting can be an issue, so we give a 5 minute
66+
// refresh interval.
6367
const browser = factory.createFileBrowser(NAMESPACE, {
6468
commands,
65-
driveName: drive.name
69+
driveName: drive.name,
70+
refreshInterval: 300000
6671
});
6772

6873
const gitHubBrowser = new GitHubFileBrowser(browser, drive);
6974

70-
gitHubBrowser.title.iconClass = 'jp-GitHub-tablogo';
75+
gitHubBrowser.title.iconClass = 'jp-GitHub-icon jp-SideBar-tabIcon';
76+
gitHubBrowser.title.caption = 'Browse GitHub';
77+
7178
gitHubBrowser.id = 'github-file-browser';
7279

7380
// Add the file browser widget to the application restorer.

style/index.css

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
| Distributed under the terms of the Modified BSD License.
44
|----------------------------------------------------------------------------*/
55

6-
.jp-GitHub-tablogo {
7-
background-size: 100%;
8-
width: var(--jp-private-sidebar-tab-width);
9-
height: var(--jp-private-sidebar-tab-width);
10-
background-image: url(octocat.png);
6+
[data-theme-light='true'] .jp-GitHub-icon {
7+
background-image: url(octocat-light.svg);
8+
}
9+
10+
[data-theme-light='false'] .jp-GitHub-icon {
11+
background-image: url(octocat-dark.svg);
1112
}
1213

1314
.jp-GitHubBrowser {
@@ -31,11 +32,11 @@
3132

3233
.jp-GitHubBrowser .jp-GitHubEditableName-display {
3334
border: 1px solid transparent;
35+
width: 100%;
3436
}
3537

3638
.jp-GitHubBrowser .jp-GitHubEditableName-display:hover {
3739
border: 1px solid var(--jp-border-color1);
38-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.24);
3940
}
4041

4142
.jp-GitHubBrowser .jp-GitHubEditableName-input {
@@ -46,19 +47,11 @@
4647
width: 100%;
4748
}
4849

49-
.jp-GitHubBrowser .jp-Toolbar-button.jp-RefreshIcon {
50-
display: none;
51-
}
52-
53-
.jp-GitHubBrowser .jp-Toolbar-button.jp-AddIcon {
54-
display: none;
55-
}
56-
57-
.jp-GitHubBrowser .jp-Toolbar-button.jp-newFolderIcon {
58-
display: none;
50+
.jp-GitHubBrowser .jp-ToolbarButton.jp-Toolbar-item.jp-GitHub-toolbar-item {
51+
display: block;
5952
}
6053

61-
.jp-GitHubBrowser .jp-Toolbar-button.jp-id-upload {
54+
.jp-GitHubBrowser .jp-ToolbarButton.jp-Toolbar-item {
6255
display: none;
6356
}
6457

@@ -99,15 +92,15 @@
9992
}
10093

10194
.jp-GitHubBrowser .jp-MyBinderButton {
102-
flex: 1 1;
10395
background-image: url(binder.svg);
10496
}
10597

10698
.jp-GitHubBrowser .jp-MyBinderButton-disabled {
10799
opacity: 0.3;
108100
}
109101

110-
.jp-GitHubBrowser .jp-GitHubIcon {
111-
flex: 1 1;
112-
background-image: url(octocat.png);
102+
#setting-editor .jp-PluginList-icon.jp-GitHub-icon {
103+
background-size: 85%;
104+
background-repeat: no-repeat;
105+
background-position: center;
113106
}

style/octocat-dark.svg

Lines changed: 57 additions & 0 deletions
Loading

style/octocat-light.svg

Lines changed: 56 additions & 0 deletions
Loading

style/octocat.png

-4.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)