Skip to content

Commit b928dd9

Browse files
committed
Fix checkbox styling and other errors for extension to be JupyterLab 3.x compatible
1 parent 0fd7a67 commit b928dd9

File tree

7 files changed

+538
-546
lines changed

7 files changed

+538
-546
lines changed

package-lock.json

Lines changed: 36 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"author": "Amit Rathi",
1616
"files": [
1717
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
18-
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
19-
"style/index.js"
18+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
2019
],
2120
"main": "lib/index.js",
2221
"types": "lib/index.d.ts",
@@ -50,6 +49,7 @@
5049
"@jupyterlab/fileeditor": "^3.0.11",
5150
"@jupyterlab/mainmenu": "^3.0.9",
5251
"@jupyterlab/notebook": "^3.0.11",
52+
"@lumino/application": "1.8.4",
5353
"@lumino/disposable": "^1.4.3",
5454
"axios": "^0.19.2"
5555
},
@@ -73,6 +73,5 @@
7373
"jupyterlab": {
7474
"extension": true,
7575
"outputDir": "jupyterlab_gitplus/labextension"
76-
},
77-
"styleModule": "style/index.js"
78-
}
76+
}
77+
}

src/api_client.ts

Lines changed: 71 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,88 @@
1-
import { PageConfig } from "@jupyterlab/coreutils";
2-
import { Dialog } from "@jupyterlab/apputils";
1+
import { PageConfig } from '@jupyterlab/coreutils';
2+
import { Dialog } from '@jupyterlab/apputils';
33
import axios from 'axios';
44
import { show_spinner } from './index';
55

66
export const HTTP = axios.create({
7-
baseURL: PageConfig.getBaseUrl()
7+
baseURL: PageConfig.getBaseUrl()
88
});
99

10-
HTTP.defaults.headers.post['X-CSRFToken'] = _get_cookie("_xsrf")
10+
HTTP.defaults.headers.post['X-CSRFToken'] = _get_cookie('_xsrf');
1111

1212
function _get_cookie(name: string) {
13-
// Source: https://blog.jupyter.org/security-release-jupyter-notebook-4-3-1-808e1f3bb5e2
14-
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
15-
return r ? r[1] : undefined;
13+
// Source: https://blog.jupyter.org/security-release-jupyter-notebook-4-3-1-808e1f3bb5e2
14+
const r = document.cookie.match('\\b' + name + '=([^;]*)\\b');
15+
return r ? r[1] : undefined;
1616
}
1717

18-
1918
export function get_server_config() {
20-
return HTTP.get("gitplus/expanded_server_root")
21-
.then(function (response) {
22-
return response.data;
23-
})
24-
.catch(function (error) {
25-
console.log(error)
26-
});
19+
return HTTP.get('gitplus/expanded_server_root')
20+
.then(response => {
21+
return response.data;
22+
})
23+
.catch(error => {
24+
console.log(error);
25+
});
2726
}
2827

29-
export function get_modified_repositories(data: {}, show_repository_selection_dialog: Function, command: string, show_repository_selection_failure_dialog: Function) {
30-
let repo_names: string[][] = []
31-
return HTTP.post("gitplus/modified_repo", data)
32-
.then(function (response) {
33-
let repo_list = response.data;
34-
for (const repo of repo_list) {
35-
let display_name = repo['name'] + ' (' + repo['path'] + ')';
36-
repo_names.push([display_name, repo['path']])
37-
}
38-
show_repository_selection_dialog(repo_names, command);
39-
})
40-
.catch(function (error) {
41-
show_repository_selection_failure_dialog()
42-
console.log(error)
43-
});
28+
export function get_modified_repositories(
29+
data: {},
30+
show_repository_selection_dialog: Function,
31+
command: string,
32+
show_repository_selection_failure_dialog: Function
33+
) {
34+
const repo_names: string[][] = [];
35+
return HTTP.post('gitplus/modified_repo', data)
36+
.then(response => {
37+
const repo_list = response.data;
38+
for (const repo of repo_list) {
39+
const display_name = repo['name'] + ' (' + repo['path'] + ')';
40+
repo_names.push([display_name, repo['path']]);
41+
}
42+
show_repository_selection_dialog(repo_names, command);
43+
})
44+
.catch(error => {
45+
show_repository_selection_failure_dialog();
46+
console.log(error);
47+
});
4448
}
4549

46-
47-
export function create_pull_request(data: {}, show_pr_created_dialog: Function) {
48-
show_spinner();
49-
return HTTP.post("gitplus/pull_request", data)
50-
.then(function (response) {
51-
let result = response.data;
52-
let github_url = result['github_url']
53-
let reviewnb_url = result['reviewnb_url']
54-
Dialog.flush(); // remove spinner
55-
show_pr_created_dialog(github_url, reviewnb_url)
56-
})
57-
.catch(function (error) {
58-
console.log(error)
59-
Dialog.flush(); // remove spinner
60-
show_pr_created_dialog()
61-
});
50+
export function create_pull_request(
51+
data: {},
52+
show_pr_created_dialog: Function
53+
) {
54+
show_spinner();
55+
return HTTP.post('gitplus/pull_request', data)
56+
.then(response => {
57+
const result = response.data;
58+
const github_url = result['github_url'];
59+
const reviewnb_url = result['reviewnb_url'];
60+
Dialog.flush(); // remove spinner
61+
show_pr_created_dialog(github_url, reviewnb_url);
62+
})
63+
.catch(error => {
64+
console.log(error);
65+
Dialog.flush(); // remove spinner
66+
show_pr_created_dialog();
67+
});
6268
}
6369

64-
65-
export function create_and_push_commit(data: {}, show_commit_pushed_dialog: Function) {
66-
show_spinner();
67-
return HTTP.post("gitplus/commit", data)
68-
.then(function (response) {
69-
let result = response.data;
70-
let github_url = result['github_url']
71-
let reviewnb_url = result['reviewnb_url']
72-
Dialog.flush(); // remove spinner
73-
show_commit_pushed_dialog(github_url, reviewnb_url)
74-
})
75-
.catch(function (error) {
76-
console.log(error)
77-
Dialog.flush(); // remove spinner
78-
show_commit_pushed_dialog()
79-
});
80-
}
70+
export function create_and_push_commit(
71+
data: {},
72+
show_commit_pushed_dialog: Function
73+
) {
74+
show_spinner();
75+
return HTTP.post('gitplus/commit', data)
76+
.then(response => {
77+
const result = response.data;
78+
const github_url = result['github_url'];
79+
const reviewnb_url = result['reviewnb_url'];
80+
Dialog.flush(); // remove spinner
81+
show_commit_pushed_dialog(github_url, reviewnb_url);
82+
})
83+
.catch(error => {
84+
console.log(error);
85+
Dialog.flush(); // remove spinner
86+
show_commit_pushed_dialog();
87+
});
88+
}

0 commit comments

Comments
 (0)