Skip to content

container clean ups#100

Merged
bloodearnest merged 5 commits intomainfrom
container-clean-ups
Feb 22, 2024
Merged

container clean ups#100
bloodearnest merged 5 commits intomainfrom
container-clean-ups

Conversation

@bloodearnest
Copy link
Copy Markdown
Member

A bevy of pre-factors and cleanups in prepartion for support filegroups in
navigation.

  • Move selected path into container
  • Add UrlPath type to use for all relative url paths
  • Make breadcrumbs include root
  • Refactor url routing

Previously, it was in PathItem, which was awkward, especially when
making changes for file group tree view. This moves it to being an
ephemeral attribute set on the container, and thus available to all
PathIems.

I added it as an attribute, so it can be set, and to do that I switched
from a regular base class to `typing.Protocol`, which allows for
specifying attributes. The original motiviation for using a base class
(code reuse) had gone away previously
Previously, url paths mapped directly on to file paths, so using a full
Path for both made a lot of sense.

However, filegroups introduces a separation betweent the two. e.g. the
absolute url path "/requests/view/REQUEST_ID/default/output/file" has
a url path of `default/output/file` relative to the url root, but the
file path of `output/file` relative to the directory root.

So we use a renamed PurePosixPath as a convenient implementation of
a UrlPath.  This helps distinguish between the two types of paths via
type annotations, but also prevents accidentally doing IO operations
on the Pure path.

Also added a convenient constant ROOT_PATH, which is the empty relative
path.
Previously, this was done manually in the template. This was is self
contained and better.
Previously, we had two separately named path for workspace and requests
views.

This gives them the same name, and provides a default value for path, as
per recommend way in django docs.

This allows us to consolidate our url handling to just one reverse call,
that defaults to the root path if none is specified.
Copy link
Copy Markdown
Contributor

@rebkwok rebkwok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some suggested changes to comments

Comment thread airlock/api.py Outdated
Comment thread airlock/api.py Outdated
Comment thread airlock/api.py Outdated
Comment thread airlock/api.py
Co-authored-by: Becky Smith <becky.smith@thedatalab.org>
@bloodearnest bloodearnest merged commit bab7da5 into main Feb 22, 2024
@bloodearnest bloodearnest deleted the container-clean-ups branch February 22, 2024 14:39
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