Skip to content

Commit

Permalink
Merge branch 'main' into course_titles
Browse files Browse the repository at this point in the history
  • Loading branch information
jeflem committed Feb 19, 2024
2 parents 3e160ad + 12136c2 commit 7cc3969
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
6 changes: 3 additions & 3 deletions nbgrader/server_extensions/course_list/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def check_for_local_formgrader(self, config):
raise gen.Return([{
'course_id': coursedir.course_id,
'course_title': title,
'url': base_url + '/lab',
'url': base_url + '/formgrader',
'kind': 'local'
}])

Expand Down Expand Up @@ -131,7 +131,7 @@ def check_for_noauth_jupyterhub_formgraders(self, config):
courses = [{
'course_id': coursedir.course_id,
'course_title': title,
'url': url + "/lab",
'url': url + "/lab?formgrader=true",
'kind': 'jupyterhub'
}]
raise gen.Return(courses)
Expand Down Expand Up @@ -179,7 +179,7 @@ def check_for_jupyterhub_formgraders(self, config):
courses.append({
'course_id': course,
'course_title': title,
'url': self.get_base_url() + service['prefix'].rstrip('/') + "/lab",
'url': self.get_base_url() + service['prefix'].rstrip('/') + "/lab?formgrader=true",
'kind': 'jupyterhub'
})

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies = [
"python-dateutil>=2.8",
"rapidfuzz>=1.8",
"requests>=2.26",
"setuptools",
"sqlalchemy>=1.4,<3",
"PyYAML>=6.0",
]
Expand Down
2 changes: 1 addition & 1 deletion src/course_list/courselist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function createElementFromCourse(data: any, app: JupyterFrontEnd, isNotebook:boo
} else {
const url = data['url'] as string;
if (isNotebook) {
anchor.href = URLExt.join(url.replace(/lab\/?$/, 'tree'));
anchor.href = url.replace(/\/lab(\/|\?)?/, '/tree$1');
} else {
anchor.href = url
}
Expand Down
17 changes: 13 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ILabShell, ILayoutRestorer, JupyterFrontEnd, JupyterFrontEndPlugin } from "@jupyterlab/application";
import { ILabShell, ILayoutRestorer, IRouter, JupyterFrontEnd, JupyterFrontEndPlugin } from "@jupyterlab/application";
import { ICommandPalette, MainAreaWidget, WidgetTracker } from "@jupyterlab/apputils";
import { PageConfig, URLExt } from "@jupyterlab/coreutils";
import { IMainMenu } from '@jupyterlab/mainmenu';
Expand Down Expand Up @@ -178,7 +178,6 @@ const courseListExtension: JupyterFrontEndPlugin<void> = {
id: pluginIDs.coursesList,
autoStart: true,
optional: [ILayoutRestorer, INotebookTree],

activate: (
app: JupyterFrontEnd,
restorer: ILayoutRestorer | null,
Expand Down Expand Up @@ -240,11 +239,12 @@ const courseListExtension: JupyterFrontEndPlugin<void> = {
const formgraderExtension: JupyterFrontEndPlugin<void> = {
id: pluginIDs.formgrader,
autoStart: true,
optional: [ILayoutRestorer, INotebookTree],
optional: [ILayoutRestorer, INotebookTree, IRouter],
activate: (
app: JupyterFrontEnd,
restorer: ILayoutRestorer | null,
notebookTree: INotebookTree | null
notebookTree: INotebookTree | null,
router: IRouter | null
) => {
// Declare a widget variable
let widget: MainAreaWidget<FormgraderWidget>;
Expand Down Expand Up @@ -290,6 +290,15 @@ const formgraderExtension: JupyterFrontEndPlugin<void> = {
}
});

// Open formgrader from URL.
if (router) {
const formgraderPattern = /(\?|&)formgrader=true/;
router.register({
command: commandIDs.openFormgrader,
pattern: formgraderPattern
});
}

// Restore the widget state
if (restorer != null){
restorer.restore(tracker, {
Expand Down
23 changes: 16 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5424,6 +5424,15 @@ __metadata:
languageName: node
linkType: hard

"nanoid@npm:^3.3.7":
version: 3.3.7
resolution: "nanoid@npm:3.3.7"
bin:
nanoid: bin/nanoid.cjs
checksum: d36c427e530713e4ac6567d488b489a36582ef89da1d6d4e3b87eded11eb10d7042a877958c6f104929809b2ab0bafa17652b076cdf84324aa75b30b722204f2
languageName: node
linkType: hard

"natural-compare-lite@npm:^1.4.0":
version: 1.4.0
resolution: "natural-compare-lite@npm:1.4.0"
Expand Down Expand Up @@ -5980,13 +5989,13 @@ __metadata:
linkType: hard

"postcss@npm:^8.3.11, postcss@npm:^8.4.19, postcss@npm:^8.4.21":
version: 8.4.28
resolution: "postcss@npm:8.4.28"
version: 8.4.32
resolution: "postcss@npm:8.4.32"
dependencies:
nanoid: ^3.3.6
nanoid: ^3.3.7
picocolors: ^1.0.0
source-map-js: ^1.0.2
checksum: f605c24a36f7e400bad379735fbfc893ccb8d293ad6d419bb824db77cdcb69f43d614ef35f9f7091f32ca588d130ec60dbcf53b366e6bf88a8a64bbeb3c05f6d
checksum: 220d9d0bf5d65be7ed31006c523bfb11619461d296245c1231831f90150aeb4a31eab9983ac9c5c89759a3ca8b60b3e0d098574964e1691673c3ce5c494305ae
languageName: node
linkType: hard

Expand Down Expand Up @@ -6985,11 +6994,11 @@ __metadata:
linkType: hard

"systeminformation@npm:^5.8.6":
version: 5.18.15
resolution: "systeminformation@npm:5.18.15"
version: 5.21.18
resolution: "systeminformation@npm:5.21.18"
bin:
systeminformation: lib/cli.js
checksum: 15555c2c0fac29ca8146153c5b9ad146f5fe5ffe109f0cbc20d2d2b902f8b4d2cc57a1add233edc4914c13f984b96250a51ce351bd570a1ac6ba369ed3caa974
checksum: 8cd17aac622b97182c75e49905cd723efd997169bf397aa494bc343fc6c313a2447ba1dbc1545b6c4348d905f83d57784521301c02a4717814c85a0568030ee4
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
languageName: node
linkType: hard
Expand Down

0 comments on commit 7cc3969

Please sign in to comment.