fix BUG-64: can now move files into import or storage path

This commit is contained in:
2021-09-26 21:14:08 +10:00
parent 25a50d029f
commit 23c8d16a5b
7 changed files with 119 additions and 41 deletions

26
path.py
View File

@@ -1,3 +1,5 @@
from shared import PA, ICON
from flask import url_for
from flask_wtf import FlaskForm
from main import db, app, ma
from sqlalchemy import Sequence
@@ -31,13 +33,29 @@ class Path(db.Model):
def __repr__(self):
return f"<id: {self.id}, path_prefix: {self.path_prefix}, num_files={self.num_files}, type={self.type}>"
################################################################################
# helper function to find StoragePathNames - used in html for move DBox to show
# potential storage paths to move files into
# Class describing PathDeatil (quick connvenence class for MovePathDetails())
################################################################################
def StoragePathNames():
class PathDetail(PA):
def __init__(self,type,path):
self.type=type
self.path=path
self.icon_url=url_for('internal', filename='icons.svg') + '#' + ICON[self.type]
return
################################################################################
# helper function to find oath details for move destinations - used in html
# for move DBox to show potential storage paths to move files into
################################################################################
def MovePathDetails():
ret=[]
sps=Path.query.join(PathType).filter(PathType.name=='Storage').all()
for p in sps:
ret.append(p.path_prefix.replace('static/Storage/','') )
obj = PathDetail( type='Storage', path=p.path_prefix.replace('static/Storage/','') )
ret.append( obj )
ips=Path.query.join(PathType).filter(PathType.name=='Import').all()
for p in ips:
obj = PathDetail( type='Import', path=p.path_prefix.replace('static/Import/','') )
ret.append( obj )
return ret