generated from google-gemini/aistudio-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Add node export/import workflow using shared transfer utilities #185
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import React, { useState } from 'react'; | ||
|
|
||
| export interface NodeExportOptions { | ||
| includeHistory: boolean; | ||
| includePythonSettings: boolean; | ||
| } | ||
|
|
||
| interface NodeExportModalProps { | ||
| selectedCount: number; | ||
| isExporting: boolean; | ||
| onCancel: () => void; | ||
| onConfirm: (options: NodeExportOptions) => void; | ||
| } | ||
|
|
||
| const NodeExportModal: React.FC<NodeExportModalProps> = ({ | ||
| selectedCount, | ||
| isExporting, | ||
| onCancel, | ||
| onConfirm, | ||
| }) => { | ||
| const [includeHistory, setIncludeHistory] = useState(false); | ||
| const [includePythonSettings, setIncludePythonSettings] = useState(true); | ||
|
|
||
| const handleSubmit = (e: React.FormEvent) => { | ||
| e.preventDefault(); | ||
| onConfirm({ includeHistory, includePythonSettings }); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40"> | ||
| <div className="w-full max-w-md rounded-lg bg-background p-6 shadow-xl"> | ||
| <h2 className="text-lg font-semibold text-text-main">Export selection</h2> | ||
| <p className="mt-1 text-sm text-text-secondary"> | ||
| {selectedCount === 1 | ||
| ? 'Export the selected node as a reusable JSON package.' | ||
| : `Export ${selectedCount} nodes as a reusable JSON package.`} | ||
| </p> | ||
|
|
||
| <form onSubmit={handleSubmit} className="mt-4 space-y-4"> | ||
| <label className="flex items-start gap-3"> | ||
| <input | ||
| type="checkbox" | ||
| className="mt-1 h-4 w-4 rounded border-border-color text-primary focus:ring-primary" | ||
| checked={includeHistory} | ||
| onChange={(event) => setIncludeHistory(event.target.checked)} | ||
| /> | ||
| <span className="text-sm text-text-main"> | ||
| <span className="font-medium">Include document history</span> | ||
| <br /> | ||
| <span className="text-text-secondary"> | ||
| Adds previous versions for each document so timelines are preserved when importing. | ||
| </span> | ||
| </span> | ||
| </label> | ||
|
|
||
| <label className="flex items-start gap-3"> | ||
| <input | ||
| type="checkbox" | ||
| className="mt-1 h-4 w-4 rounded border-border-color text-primary focus:ring-primary" | ||
| checked={includePythonSettings} | ||
| onChange={(event) => setIncludePythonSettings(event.target.checked)} | ||
| /> | ||
| <span className="text-sm text-text-main"> | ||
| <span className="font-medium">Include Python settings</span> | ||
| <br /> | ||
| <span className="text-text-secondary"> | ||
| Bundles interpreter selections and auto-detect preferences for Python-enabled nodes. | ||
| </span> | ||
| </span> | ||
| </label> | ||
|
|
||
| <div className="flex justify-end gap-2 pt-2"> | ||
| <button | ||
| type="button" | ||
| onClick={onCancel} | ||
| className="rounded-md border border-border-color px-4 py-2 text-sm font-medium text-text-main hover:bg-secondary disabled:cursor-not-allowed disabled:opacity-50" | ||
| disabled={isExporting} | ||
| > | ||
| Cancel | ||
| </button> | ||
| <button | ||
| type="submit" | ||
| className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-text hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-70" | ||
| disabled={isExporting} | ||
| > | ||
| {isExporting ? 'Exporting…' : 'Export'} | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default NodeExportModal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The same ordering issue occurs in the Electron-backed import: the loop iterates the serialized
node.versionsin the order provided and assignslatestVersionIdon every iteration. Because exported histories are newest-first, the value left inlatestVersionIdafter the loop is the oldest revision, sodocuments.current_version_idwill reference stale content even though newer versions were inserted. Imports that include histories will therefore load the wrong document content. Choose the first entry or iterate oldest-to-newest before setting the current version.Useful? React with 👍 / 👎.