Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jupyter-collaboration by handling RTC prefix in the file paths #541

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,19 @@ 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): string | null {
function getSelectedFilePath(
widget: FileBrowser | null,
app: JupyterFrontEnd<JupyterFrontEnd.IShell, 'desktop' | 'mobile'>
): 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);
}

return selectedItem.path;
}

Expand Down Expand Up @@ -260,7 +268,8 @@ function activatePlugin(
execute: async () => {
eventLogger('file-browser.create-job');
const widget = fileBrowserTracker.currentWidget;
const filePath = getSelectedFilePath(widget) ?? '';
const filePath = getSelectedFilePath(widget, app) ?? '';
console.log(filePath);
dlqqq marked this conversation as resolved.
Show resolved Hide resolved

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