Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ function activatePlugin(
commands.addCommand(CommandIDs.createJobCurrentNotebook, {
execute: async () => {
eventLogger('notebook-header.create-job');
// Get the current notebook's name and path
const contentsModel =
notebookTracker.currentWidget?.context?.contentsModel;
const filePath = contentsModel?.path ?? '';
const fileName = contentsModel?.name ?? '';
// Get the current notebook's path and name
const widget = fileBrowserTracker.currentWidget;
const filePath =
getSelectedFilePath(widget, app.serviceManager.contents) ?? '';
const fileName = getSelectedFileBaseName(widget) ?? '';

// Update the job form inside the notebook jobs widget
const newCreateModel = emptyCreateJobModel();
Expand Down
13 changes: 7 additions & 6 deletions ui-tests/tests/jupyter_scheduler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { expect, test } from '@jupyterlab/galata';
import { SchedulerHelper } from '../helpers/SchedulerHelper';

/**
* Snapshot files are mapped by Galata basis the configuration set in file:
* https://github.com/jupyterlab/jupyterlab/blob/main/galata/update_snapshots.py
*/
enum FILENAMES {
LAUNCHER = 'launcher.png',
NOTEBOOK_TOOLBAR = 'notebook-toolbar.png',
FILEBROWSER_MENU = 'filebrowser-menu.png',
// TODO: resolve this inconsistency in our frontend code. One entry point
// includes the file extension in the job name, the other does not.
CREATE_VIEW_FROM_TOOLBAR = 'create-view-from-toolbar.png',
CREATE_VIEW_FROM_FILEBROWSER = 'create-view-from-filebrowser.png',
CREATE_JOB_VIEW = 'create-job-view.png',
LIST_VIEW = 'list-view.png'
}

Expand Down Expand Up @@ -49,7 +50,7 @@ test.describe('Jupyter Scheduler', () => {
await scheduler.createJobTbutton.click();
await page.waitForSelector('text=Loading …', { state: 'hidden' });
await page.waitForSelector('text=Saving Completed', { state: 'hidden' });
await scheduler.assertSnapshot(FILENAMES.CREATE_VIEW_FROM_TOOLBAR);
await scheduler.assertSnapshot(FILENAMES.CREATE_JOB_VIEW);
});

test('shows filebrowser menu item', async ({ page }) => {
Expand All @@ -66,7 +67,7 @@ test.describe('Jupyter Scheduler', () => {
test('opens create job view from filebrowser menu item', async () => {
await scheduler.createNotebook();
await scheduler.openCreateJobFromFilebrowser();
await scheduler.assertSnapshot(FILENAMES.CREATE_VIEW_FROM_FILEBROWSER);
await scheduler.assertSnapshot(FILENAMES.CREATE_JOB_VIEW);
});

test('shows newly created job in job list view', async ({ page }) => {
Expand Down
Binary file not shown.
Loading