Commit 8eb937d5 by Dudás Ádám

Merge branch 'feature-disks-stats' into 'master'

Add detailed file statistics



See merge request !14
parents 7b358f8c 950a98e3
...@@ -88,6 +88,25 @@ def get_storage_stat(path): ...@@ -88,6 +88,25 @@ def get_storage_stat(path):
'free_percent': free_space_percent} 'free_percent': free_space_percent}
@celery.task()
def get_file_statistics(datastore):
disks = [Disk.get(datastore, name).get_desc()
for name in listdir(datastore)
if not name.endswith((".dump", "trash"))]
dumps = [{'name': name,
'size': path.getsize(path.join(datastore, name))}
for name in listdir(datastore) if name.endswith(".dump")]
trash = [{'name': name,
'size': path.getsize(path.join(datastore, trash_directory,
name))}
for name in listdir(path.join(datastore, trash_directory))]
return {
'dumps': dumps,
'trash': trash,
'disks': disks,
}
@celery.task @celery.task
def move_to_trash(datastore, disk_name): def move_to_trash(datastore, disk_name):
''' Move path to the trash directory. ''' Move path to the trash directory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment