Skip to content

Commit

Permalink
Require and pass app.serviceManager.contents to getSelectedFilePath, …
Browse files Browse the repository at this point in the history
…not whole app
  • Loading branch information
andrii-i committed Aug 28, 2024
1 parent f36faa5 commit cb0693d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ function getSelectedFileBaseName(widget: FileBrowser | null): string | null {
// Get the file name, with all parent directories, of the currently selected file.
function getSelectedFilePath(
widget: FileBrowser | null,
app: JupyterFrontEnd<JupyterFrontEnd.IShell, 'desktop' | 'mobile'>
contents: Contents.IManager
): string | null {
const selectedItem = getSelectedItem(widget);
if (selectedItem === null) {
return null;
}

if (app.serviceManager.contents.driveName(selectedItem.path) === 'RTC') {
return app.serviceManager.contents.localPath(selectedItem.path);
if (contents.driveName(selectedItem.path) === 'RTC') {
return contents.localPath(selectedItem.path);
}

return selectedItem.path;
Expand Down Expand Up @@ -268,8 +268,8 @@ function activatePlugin(
execute: async () => {
eventLogger('file-browser.create-job');
const widget = fileBrowserTracker.currentWidget;
const filePath = getSelectedFilePath(widget, app) ?? '';
console.log(filePath);
const filePath =
getSelectedFilePath(widget, app.serviceManager.contents) ?? '';

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

0 comments on commit cb0693d

Please sign in to comment.