Refactor route and template organisation #28
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
help wanted
invalid
maintenance
peach-lib
peach-network
peach-oled
peach-stats
peach-web
question
refactor
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: PeachCloud/peach-workspace#28
Loading…
Reference in New Issue
No description provided.
Delete Branch "route_reorganisation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Major Changes
This is a major refactor which aims to group routes and templates into logical categories, as previously discussed in issue #1. It also introduces relative paths for routes so that they can be grouped categorically by mountpoint in
src/main.rs
.It's challenging to have precise consistency across the whole codebase (taking into account HTML routes, JSON routes and templates) but I think this is a big step in the right direction and can be refined as we introduce new code.
All tests are passing, though I noticed that we are missing a lot of coverage. I can work on this next.
Perhaps trees are the easiest way to describe the new structure:
Routes
Templates
Minor Changes
A few small UI changes snuck into this PR; things like updated icons on the
/status
page, a new 'power' icon in the bottom-right of the home page (replacing the question mark) etc.WIP: Refactor route and template organisationto Refactor route and template organisation@notplants
This is now ready for the review. Apologies for the large number of changes; I got in the zone. Let me know if anything is unclear and we can always hop on a call to walk through it together.
@glyph glad you got in the zone, and looks good to me.
The diagram you made makes it pretty easy to parse and understand how it works, as well as the groupings of routes in main.rs.
I could imagine as someone trying to look through the codebase,
I might be confused by the json api routes being grouped separately from the HTML routes -- like if I am looking at the admin page, and trying to figure out where admin related routes are, I actually have to look in two places.
But I can also see why they are separated. So more just a comment on the tradeoff than a request for change. Having json and html routes, which are somewhat separate, is one of the more unconventional things about our app I think. I've sometimes been wondering if there are ways we could streamline that more. Maybe even some way using macros at some point (I think Plume does something like this, making a custom macro for routes, that does just what they need, so they can write simple, legible, minimal code, with less boilerplate).
@notplants
Thanks for the review!
Yeah I'd like to figure out a way to better integrate the JSON API. It has always been a secondary concern for me and that reflects in the design. I'd be intersted in learning how other Rocket applications like Plume are handling routes and JSON.
I also had some difficultly deciding on clear separations. For example, separating
admin
andauth
routes.Hopefully we can continue improving this in waves. Moving through the codebase already feels like a more streamlined experience to me. Let's continue feeling for friction and discomfort when we're navigating; then use those sensations to target refactors and improvements.