can now toggle between folder or flat view, its a bit ugly, but it works
This commit is contained in:
2
TODO
2
TODO
@@ -1,6 +1,4 @@
|
||||
## GENERAL
|
||||
* storage_path viewing needs to be by folder / not a big grab bag of files (by default - DONE)
|
||||
-> EITHER view by folders (and hide the oldest 50 by Day section), or view flat and show it
|
||||
* need a way for search results to show we found something in import_path or storage_path:
|
||||
- now we can use the in_path, then have a series of icons, e.g. disk for storage, ? for import, and bin for recycling
|
||||
-- only show these on the thumbs *IF* we search (where it may not be obvious where it came from)
|
||||
|
||||
5
main.py
5
main.py
@@ -6,7 +6,7 @@ from flask_bootstrap import Bootstrap
|
||||
from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerField, TextAreaField, validators
|
||||
from flask_wtf import FlaskForm
|
||||
from status import st, Status
|
||||
from shared import CreateSelect, DB_URL
|
||||
from shared import CreateSelect, CreateFoldersSelect, DB_URL
|
||||
import re
|
||||
import socket
|
||||
|
||||
@@ -44,6 +44,7 @@ app.jinja_env.globals['GetNumActiveJobs'] = GetNumActiveJobs
|
||||
app.jinja_env.globals['GetJM_Message'] = GetJM_Message
|
||||
app.jinja_env.globals['ClearJM_Message'] = ClearJM_Message
|
||||
app.jinja_env.globals['CreateSelect'] = CreateSelect
|
||||
app.jinja_env.globals['CreateFoldersSelect'] = CreateFoldersSelect
|
||||
|
||||
# default page, just the navbar
|
||||
@app.route("/", methods=["GET"])
|
||||
@@ -54,4 +55,4 @@ if __name__ == "__main__":
|
||||
if hostname == PROD_HOST:
|
||||
app.run(ssl_context=('/etc/letsencrypt/live/book.depaoli.id.au/cert.pem', '/etc/letsencrypt/live/book.depaoli.id.au/privkey.pem'), host="0.0.0.0", debug=False)
|
||||
else:
|
||||
app.run(host="0.0.0.0", debug=True)
|
||||
app.run(host="0.0.0.0", debug=True)
|
||||
|
||||
@@ -1129,6 +1129,9 @@ def ValidateSettingsPaths():
|
||||
if not ip_exists:
|
||||
print("ERROR: None of the import paths in the settings exist - Please fix now");
|
||||
paths = settings.import_path.split("#")
|
||||
if not rbp_exists or not sp_exists or not ip_exists:
|
||||
print("ERROR: Existing until above errors are fixed by paths being created or settings being updated to valid paths" )
|
||||
exit(-1)
|
||||
return
|
||||
|
||||
|
||||
|
||||
14
shared.py
14
shared.py
@@ -29,6 +29,20 @@ def CreateSelect(name, selected, list, js=""):
|
||||
str += '</select>'
|
||||
return str
|
||||
|
||||
def CreateFoldersSelect(selected):
|
||||
str = f'<select id="folders" name="folders" style="color:#5bc0de;border:1px solid #5bc0de;"'
|
||||
str += f'class="sm-txt form-control form-conrol-info" onChange="this.form.submit()">'
|
||||
# if selected is true, then folders == true, so make this the selected option
|
||||
if( selected ):
|
||||
str += '<option selected value="True">In Folders</option>'
|
||||
str += '<option value="False">Flat View</option>'
|
||||
else:
|
||||
str += '<option value="True">In Folders</option>'
|
||||
str += '<option selected value="False">Flat View</option>'
|
||||
str += '</select>'
|
||||
return str
|
||||
|
||||
|
||||
def SymlinkName(ptype, path, file):
|
||||
sig_bit=file.replace(path, "")
|
||||
last_dir=os.path.basename(path[0:-1])
|
||||
|
||||
@@ -10,29 +10,38 @@
|
||||
|
||||
<div class="container-fluid">
|
||||
<form id="main_form" method="POST"">
|
||||
<input type="hidden" name="folders" id="folders" value="{{folders}}">
|
||||
<input type="hidden" name="cwd" id="cwd" value="{{cwd}}">
|
||||
{% if search_term is defined %}
|
||||
<input type="hidden" name="term" id="view_term" value="{{search_term}}">
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
{% if "files_ip" in request.url %}
|
||||
I
|
||||
{% elif "files_sp" in request.url %}
|
||||
S
|
||||
{% else %}
|
||||
R
|
||||
{% endif %}
|
||||
{% if folders %}
|
||||
<div class="my-auto">
|
||||
<span class="alert alert-primary">In: {{cwd}}</span>
|
||||
<div class="mx-3 my-auto">
|
||||
<span class="alert alert-primary">
|
||||
{% if "files_ip" in request.url %}
|
||||
<i class="fas fa-file-upload"></i>
|
||||
{% set tmp_path=cwd | replace( "static/Import", "" ) + "/" %}
|
||||
{% elif "files_sp" in request.url %}
|
||||
<i class="fas fa-database"></i>
|
||||
{% set tmp_path=cwd | replace( "static/Storage", "" ) + "/" %}
|
||||
{% else %}
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
{% set tmp_path=cwd | replace( "static/Bin", "" ) + "/" %}
|
||||
{% endif %}
|
||||
In: {{tmp_path}}</span>
|
||||
</div class="col my-auto">
|
||||
{% endif %}
|
||||
<div class="input-group col-lg-4">
|
||||
{{CreateSelect( "noo", noo, ["Oldest", "Newest"], "$('#offset').val(0)")|safe }}
|
||||
{{CreateSelect( "how_many", how_many, ["10", "25", "50", "75", "100", "150", "200", "500"])|safe }}
|
||||
<span style="border:0" class="sm-txt my-auto h-100 btn btn-outline-info disabled">grouped by:</span>
|
||||
{{CreateSelect( "grouping", grouping, ["None", "Day", "Week", "Month"])|safe }}
|
||||
{% if folders %}
|
||||
<input type="hidden" name="grouping" id="grouping" value="{{grouping}}">
|
||||
{{CreateFoldersSelect( folders )|safe }}
|
||||
{% else %}
|
||||
{{CreateFoldersSelect( folders )|safe }}
|
||||
<span style="border:0" class="sm-txt my-auto h-100 btn btn-outline-info disabled">grouped by:</span>
|
||||
{{CreateSelect( "grouping", grouping, ["None", "Day", "Week", "Month"])|safe }}
|
||||
{% endif %}
|
||||
</div class="input-group">
|
||||
{% if search_term is defined %}
|
||||
<div class="col my-auto">
|
||||
@@ -114,6 +123,9 @@
|
||||
</figure class="figure">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if not folders and obj.type.name == "Directory" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
{% if grouping == "Day" %}
|
||||
{% if last.printed != obj.file_details.day %}
|
||||
{% if last.printed > 0 %}
|
||||
|
||||
Reference in New Issue
Block a user