From 242eca343e19571e639d080e24f56ec81104aabf Mon Sep 17 00:00:00 2001 From: vsoch Date: Wed, 10 Nov 2021 21:57:24 -0700 Subject: [PATCH 1/2] adding support for container descriptions an owner will see an input in the container interface to add a description, and a non owner will just see the description. Signed-off-by: vsoch --- CHANGELOG.md | 1 + VERSION | 2 +- shub/apps/main/models/containers.py | 4 ++ .../containers/container_details.html | 43 ++++++++++++++++++- shub/apps/main/urls/containers.py | 5 +++ shub/apps/main/views/__init__.py | 1 + shub/apps/main/views/containers.py | 21 ++++++++- 7 files changed, 73 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aecab09d..36b24c96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ represented by the pull requests that fixed them. Critical items to know are: ## [master](https://github.com/singularityhub/sregistry/tree/master) (master) + - Adding container descriptions, editable by owners (1.1.39) - fix issues with psycopg2-binary and saml auth (1.1.38) - Pin psycopg2-binary 2.8.6 to deal with UTC errors - change formatting of the login URL to fix saml auth diff --git a/VERSION b/VERSION index 54eae6b4..1b507d18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.38 +1.1.39 diff --git a/shub/apps/main/models/containers.py b/shub/apps/main/models/containers.py index 6641f0fe..c08de070 100644 --- a/shub/apps/main/models/containers.py +++ b/shub/apps/main/models/containers.py @@ -99,6 +99,10 @@ def get_uri(self, include_version=True): # shub://username/reponame:branch@tag return self.get_short_uri() return self.get_storage() + @property + def description(self): + return self.metadata.get("description") + def get_storage(self): """Return the full storage path, which includes the version string""" if "/" in self.name: diff --git a/shub/apps/main/templates/containers/container_details.html b/shub/apps/main/templates/containers/container_details.html index 1e7f92a7..e73109c8 100644 --- a/shub/apps/main/templates/containers/container_details.html +++ b/shub/apps/main/templates/containers/container_details.html @@ -41,6 +41,13 @@ {% include "messages/message.html" %} + + +