Skip to content

Drive integration opens diagrams in Draw (link file, no renderer needed)#19

Merged
vibhavkatre merged 1 commit into
mainfrom
feat/drive-open-link
Jul 20, 2026
Merged

Drive integration opens diagrams in Draw (link file, no renderer needed)#19
vibhavkatre merged 1 commit into
mainfrom
feat/drive-open-link

Conversation

@vibhavkatre

Copy link
Copy Markdown
Collaborator

What

register_in_drive now registers a Draw diagram in Frappe Drive as a link File whose target is the Draw editor route (/draw/d/<name>), via drive.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_drive creates the Drive link in the user's team, idempotent by file_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 draw9 pass (creates a team, registers the link, confirms file_url + idempotency). CI (fresh site, no Drive) skips the Drive-present case, as before.

🤖 Generated with Claude Code

…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>
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Safe 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

@vibhavkatre
vibhavkatre merged commit 5e5831e into main Jul 20, 2026
3 checks passed
@vibhavkatre
vibhavkatre deleted the feat/drive-open-link branch July 20, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants