Commit a68315ae authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Improved storage sections (naming, ordering).

parent a7521a26
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -440,10 +440,11 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI):
        # Get the storage based on the "root" folder name
        # TODO: this is extremely weak..
        storage_id = path.split('/')[1]
        storage_name = storage_id.split('@')[0]
        try:
            computing_name = storage_id.split('@')[1]
            computing_name = storage_id.split(':')[0]
            storage_name = storage_id.split(':')[1]
        except IndexError:
            storage_name = storage_id
            computing_name = None
            
        # Get all the storages this user has access to:
@@ -725,6 +726,10 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI):
                # Get storages
                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 now, we only support generic posix, SSH-based storages
+1 −1
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ class Storage(models.Model):
 
    @property
    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))