Drive integration opens diagrams in Draw (link file, no renderer needed)#19
Merged
Conversation
…renderer) register_in_drive now registers a diagram as a Drive LINK file whose target is the Draw editor route (/draw/d/<name>), via drive.api.files.create_link. So a diagram appears in Frappe Drive AND clicking it opens the diagram in Draw — with NO Drive-side renderer required (a Drive-repo change was the only remaining gap). - api/drive_integration.py: diagram_link(name) -> /draw/d/<name>; register_in_drive creates the Drive link in the user's team (idempotent by file_url), still a safe no-op when Drive is absent / has no team. Dropped the native-doc content_doctype linkage (which needed a Drive viewer). - test: assert the registered File is a link to /draw/d/<name> + idempotent. Verified locally with Drive installed: run-tests --app draw -> 9 pass (creates a team, registers the link, confirms file_url + idempotency). CI (no Drive) skips the Drive-present case, as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Confidence Score: 4/5Safe to merge; the only gap is a stale module-level comment describing the old approach. The logic change is small and well-tested. The module docstring at the top of drive_integration.py still describes the discarded content_doctype approach, which will mislead future readers, but does not affect runtime behaviour. draw/api/drive_integration.py — the header comment (lines 6–10) needs to be updated to reflect the link-file approach. Reviews (1): Last reviewed commit: "Frappe Draw: Drive integration opens dia..." | Re-trigger Greptile |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
register_in_drivenow registers a Draw diagram in Frappe Drive as a link File whose target is the Draw editor route (/draw/d/<name>), viadrive.api.files.create_link.So a diagram shows up in the user's Drive and clicking it opens the diagram in Draw — closing the last launch gap (#4) with no Drive-side renderer/repo change required.
Why this approach
The previous native-doc linkage (
content_doctype=Draw Diagram) would have needed a Drive-side viewer for the content type — a change in the Drive repo, out of scope for this app. A link file needs nothing on the Drive side and still lands the diagram in Drive with a working open action.Changes
api/drive_integration.py:diagram_link(name)→/draw/d/<name>;register_in_drivecreates the Drive link in the user's team, idempotent byfile_url, still a clean no-op when Drive is absent / has no team.test_draw_diagram.py: asserts the registered File is a link to/draw/d/<name>+ idempotency.Testing
Verified locally with Drive installed:
run-tests --app draw→ 9 pass (creates a team, registers the link, confirmsfile_url+ idempotency). CI (fresh site, no Drive) skips the Drive-present case, as before.🤖 Generated with Claude Code