-
Notifications
You must be signed in to change notification settings - Fork 297
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
feat: Create notebook copies #2227
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice looks great! I think just some small tweaks and it's there
<div> | ||
<SessionShutdownButton filePath={file.path} /> | ||
</div> | ||
<CopyNotebookButton filePath={file.path} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can put this in notebook actions - so it automatically appears in the notebook dropdown and in the command palette. It doesn't need to be its own button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I was just going off the issue author's suggestions, thought it'd be a simple add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea I didn't see the second part of the issue mentioning that. I don't know how common it'll be and does complicate the routes. I think we hold off homepage and consider later
<SessionShutdownButton filePath={file.path} /> | ||
</div> | ||
<CopyNotebookButton filePath={file.path} /> | ||
<SessionShutdownButton filePath={file.path} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this on the homepage - at least for now.
This is also probably why you were getting mismatch sessions. Since the homepage doesn't have an active session
frontend/src/core/wasm/bridge.ts
Outdated
@@ -187,6 +187,11 @@ export class PyodideBridge implements RunRequests, EditRequests { | |||
return null; | |||
}; | |||
|
|||
sendCopy: EditRequests["sendCopy"] = async () => { | |||
// TODO: Implement copy with pyodide! | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can throw not implemented. And I think we can hide this action in the notebook dropdown when isWasm is true
if (!source) { | ||
return null; | ||
} | ||
const pathBuilder = new PathBuilder("/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const pathBuilder = PathBuilder.guessDeliminator(source)
filename, | ||
destination, | ||
); | ||
window.open(notebookCopy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would just directly do:
window.open(`/?file=${destination}`, "_blank");
window.open(notebookCopy); | ||
}) | ||
.catch((error) => { | ||
toast({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we already toast from the request wrapper in requests-toasting.tsx
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.8.12-dev7 |
📝 Summary
Adds "Create notebook copy" option to the notebook actions menu.
Closes #2068.
🔍 Description of Changes
/api/kernel/copy
endpoint📋 Checklist
📜 Reviewers
@akshayka
@mscolnick