Skip to content

Commit 6b79522

Browse files
Remove "RTC" drive prefix from filepath added by jupyter-collaboration when using notebook scheduler widget (#577)
* Remove RTC drive prefix from filepath added by jupyter-collaboration when using notebook scheduler widget * Updated UI tests to match job creation UI from file browser and toolbar to the same snapshot
1 parent e6aa27a commit 6b79522

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ function activatePlugin(
303303
commands.addCommand(CommandIDs.createJobCurrentNotebook, {
304304
execute: async () => {
305305
eventLogger('notebook-header.create-job');
306-
// Get the current notebook's name and path
307-
const contentsModel =
308-
notebookTracker.currentWidget?.context?.contentsModel;
309-
const filePath = contentsModel?.path ?? '';
310-
const fileName = contentsModel?.name ?? '';
306+
// Get the current notebook's path and name
307+
const widget = fileBrowserTracker.currentWidget;
308+
const filePath =
309+
getSelectedFilePath(widget, app.serviceManager.contents) ?? '';
310+
const fileName = getSelectedFileBaseName(widget) ?? '';
311311

312312
// Update the job form inside the notebook jobs widget
313313
const newCreateModel = emptyCreateJobModel();

ui-tests/tests/jupyter_scheduler.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { expect, test } from '@jupyterlab/galata';
22
import { SchedulerHelper } from '../helpers/SchedulerHelper';
33

4+
/**
5+
* Snapshot files are mapped by Galata basis the configuration set in file:
6+
* https://github.com/jupyterlab/jupyterlab/blob/main/galata/update_snapshots.py
7+
*/
48
enum FILENAMES {
59
LAUNCHER = 'launcher.png',
610
NOTEBOOK_TOOLBAR = 'notebook-toolbar.png',
711
FILEBROWSER_MENU = 'filebrowser-menu.png',
8-
// TODO: resolve this inconsistency in our frontend code. One entry point
9-
// includes the file extension in the job name, the other does not.
10-
CREATE_VIEW_FROM_TOOLBAR = 'create-view-from-toolbar.png',
11-
CREATE_VIEW_FROM_FILEBROWSER = 'create-view-from-filebrowser.png',
12+
CREATE_JOB_VIEW = 'create-job-view.png',
1213
LIST_VIEW = 'list-view.png'
1314
}
1415

@@ -49,7 +50,7 @@ test.describe('Jupyter Scheduler', () => {
4950
await scheduler.createJobTbutton.click();
5051
await page.waitForSelector('text=Loading …', { state: 'hidden' });
5152
await page.waitForSelector('text=Saving Completed', { state: 'hidden' });
52-
await scheduler.assertSnapshot(FILENAMES.CREATE_VIEW_FROM_TOOLBAR);
53+
await scheduler.assertSnapshot(FILENAMES.CREATE_JOB_VIEW);
5354
});
5455

5556
test('shows filebrowser menu item', async ({ page }) => {
@@ -66,7 +67,7 @@ test.describe('Jupyter Scheduler', () => {
6667
test('opens create job view from filebrowser menu item', async () => {
6768
await scheduler.createNotebook();
6869
await scheduler.openCreateJobFromFilebrowser();
69-
await scheduler.assertSnapshot(FILENAMES.CREATE_VIEW_FROM_FILEBROWSER);
70+
await scheduler.assertSnapshot(FILENAMES.CREATE_JOB_VIEW);
7071
});
7172

7273
test('shows newly created job in job list view', async ({ page }) => {

0 commit comments

Comments
 (0)