Skip to content
Snippets Groups Projects
Commit a68315ae authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Improved storage sections (naming, ordering).

parent a7521a26
No related branches found
No related tags found
No related merge requests found
...@@ -440,10 +440,11 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI): ...@@ -440,10 +440,11 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI):
# Get the storage based on the "root" folder name # Get the storage based on the "root" folder name
# TODO: this is extremely weak.. # TODO: this is extremely weak..
storage_id = path.split('/')[1] storage_id = path.split('/')[1]
storage_name = storage_id.split('@')[0]
try: try:
computing_name = storage_id.split('@')[1] computing_name = storage_id.split(':')[0]
storage_name = storage_id.split(':')[1]
except IndexError: except IndexError:
storage_name = storage_id
computing_name = None computing_name = None
# Get all the storages this user has access to: # Get all the storages this user has access to:
...@@ -725,6 +726,10 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI): ...@@ -725,6 +726,10 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI):
# Get storages # Get storages
storages = list(Storage.objects.filter(group=None)) + list(Storage.objects.filter(group__user=request.user)) storages = list(Storage.objects.filter(group=None)) + list(Storage.objects.filter(group__user=request.user))
# Oder storages (re-orderded in the file manager anyway)
storages.sort(key=lambda storage: storage.id)
# Prepare the output
for storage in storages: for storage in storages:
# For now, we only support generic posix, SSH-based storages # For now, we only support generic posix, SSH-based storages
......
...@@ -364,7 +364,7 @@ class Storage(models.Model): ...@@ -364,7 +364,7 @@ class Storage(models.Model):
@property @property
def id(self): def id(self):
return (self.name if not self.computing else '{}@{}'.format(self.name,self.computing.name)) return (self.name if not self.computing else '{}:{}'.format(self.computing.name,self.name))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment