Repository navigation
refactor(erd): ErdViewController, toolbar, group menu and card cache out of _ErdViewState (#1690) - #1723
Merged
Conversation
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.
Refs #1690 (first of the small PRs the issue asks for: the controller first, the canvas second)
erd_view.dart: 1844 -> 1482 lines; behaviour and look unchanged.ErdViewController(erd_view_controller.dart, no widget imports) owns the user's state of a diagram: the pick, picked relation and marks, density (detail, collapsed, hidden), header colours, groups, notes, saved views, the search flags, and the rules on them as plain methods:createGroup/addToGroup/updateGroup/ungroup/removeFromGroup,toggleMarked,hide,setHeaderColor,applyState, notemove/resize/followTables,canvasSize, view ids / rename / remove,pick/pickRelation/clearPicks,escape()(one step per press, returns which),currentFocusandcardFocusFor._ErdViewStatekeeps the layout, routes, viewport, dialogs and the decision when to rebuild and save, and calls it.ErdToolbar(widgets/erd_toolbar.dart): the 110-line toolbar ofbuild.erdGroupMenu(widgets/erd_group_menu.dart) andErdCardInputs(widgets/erd_card_inputs.dart): the card's group menu and the key by which a card is reused.ErdCardCache(widgets/erd_card_cache.dart): the ci(bench): erd_open_200 scenario times out in app_perf_bench; make bench failures exit non-zero #1546 card reuse and chunked mounting, as a class with its own constants.Tests:
erd_view_controller_test.dart(20 tests, noWidgetTester): group creation / adding / removal and the marks, hide / collapse / colours, applying a saved state, notes (update, move and resize at a zoom, following a table, canvas growth), views (ids, rename, remove), pick vs picked relation, the Esc sequence, focus and fading. The existing 120 ERD tests pass unchanged, and so do workspace, core/erd and e2e (803 locally). Bench after the change: erd_open_200 build p90 18.4 ms, erd_hover and erd_drag 0.3 ms p90.Not done here, for the next PR: the canvas (viewport / zoom / fit / hover / edge tip and the layers of
build) asErdCanvas.erd_view.dartis still above the ~900 lines of the acceptance list, so the issue stays open.