can now toggle between folder or flat view, its a bit ugly, but it works

This commit is contained in:
2021-06-06 14:09:11 +10:00
parent b6156dad34
commit 7e2494884e
5 changed files with 44 additions and 16 deletions

2
TODO
View File

@@ -1,6 +1,4 @@
## GENERAL ## 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: * 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 - 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) -- only show these on the thumbs *IF* we search (where it may not be obvious where it came from)

View File

@@ -6,7 +6,7 @@ from flask_bootstrap import Bootstrap
from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerField, TextAreaField, validators from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerField, TextAreaField, validators
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from status import st, Status from status import st, Status
from shared import CreateSelect, DB_URL from shared import CreateSelect, CreateFoldersSelect, DB_URL
import re import re
import socket import socket
@@ -44,6 +44,7 @@ app.jinja_env.globals['GetNumActiveJobs'] = GetNumActiveJobs
app.jinja_env.globals['GetJM_Message'] = GetJM_Message app.jinja_env.globals['GetJM_Message'] = GetJM_Message
app.jinja_env.globals['ClearJM_Message'] = ClearJM_Message app.jinja_env.globals['ClearJM_Message'] = ClearJM_Message
app.jinja_env.globals['CreateSelect'] = CreateSelect app.jinja_env.globals['CreateSelect'] = CreateSelect
app.jinja_env.globals['CreateFoldersSelect'] = CreateFoldersSelect
# default page, just the navbar # default page, just the navbar
@app.route("/", methods=["GET"]) @app.route("/", methods=["GET"])

View File

@@ -1129,6 +1129,9 @@ def ValidateSettingsPaths():
if not ip_exists: if not ip_exists:
print("ERROR: None of the import paths in the settings exist - Please fix now"); print("ERROR: None of the import paths in the settings exist - Please fix now");
paths = settings.import_path.split("#") 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 return

View File

@@ -29,6 +29,20 @@ def CreateSelect(name, selected, list, js=""):
str += '</select>' str += '</select>'
return str 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): def SymlinkName(ptype, path, file):
sig_bit=file.replace(path, "") sig_bit=file.replace(path, "")
last_dir=os.path.basename(path[0:-1]) last_dir=os.path.basename(path[0:-1])

View File

@@ -10,29 +10,38 @@
<div class="container-fluid"> <div class="container-fluid">
<form id="main_form" method="POST""> <form id="main_form" method="POST"">
<input type="hidden" name="folders" id="folders" value="{{folders}}">
<input type="hidden" name="cwd" id="cwd" value="{{cwd}}"> <input type="hidden" name="cwd" id="cwd" value="{{cwd}}">
{% if search_term is defined %} {% if search_term is defined %}
<input type="hidden" name="term" id="view_term" value="{{search_term}}"> <input type="hidden" name="term" id="view_term" value="{{search_term}}">
{% endif %} {% endif %}
<div class="row"> <div class="row">
{% if "files_ip" in request.url %}
I
{% elif "files_sp" in request.url %}
S
{% else %}
R
{% endif %}
{% if folders %} {% if folders %}
<div class="my-auto"> <div class="mx-3 my-auto">
<span class="alert alert-primary">In: {{cwd}}</span> <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"> </div class="col my-auto">
{% endif %} {% endif %}
<div class="input-group col-lg-4"> <div class="input-group col-lg-4">
{{CreateSelect( "noo", noo, ["Oldest", "Newest"], "$('#offset').val(0)")|safe }} {{CreateSelect( "noo", noo, ["Oldest", "Newest"], "$('#offset').val(0)")|safe }}
{{CreateSelect( "how_many", how_many, ["10", "25", "50", "75", "100", "150", "200", "500"])|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> {% if folders %}
{{CreateSelect( "grouping", grouping, ["None", "Day", "Week", "Month"])|safe }} <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"> </div class="input-group">
{% if search_term is defined %} {% if search_term is defined %}
<div class="col my-auto"> <div class="col my-auto">
@@ -114,6 +123,9 @@
</figure class="figure"> </figure class="figure">
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if not folders and obj.type.name == "Directory" %}
{% continue %}
{% endif %}
{% if grouping == "Day" %} {% if grouping == "Day" %}
{% if last.printed != obj.file_details.day %} {% if last.printed != obj.file_details.day %}
{% if last.printed > 0 %} {% if last.printed > 0 %}