directories first in browser
This commit is contained in:
parent
1017da3839
commit
07d8120d35
3 changed files with 17 additions and 3 deletions
|
@ -63,6 +63,8 @@ Set this variable to `True` to enable Git integration. This feature requires [Gi
|
|||
to be installed on the system that is running the configurator. For thechnical reasons this feature can't be enabled with a static configuration file.
|
||||
To push local commits to a remote repository, you have to add the remote manually: `git remote add origin ssh://somehost:/user/repo.git`
|
||||
Verify, that the user that is running the configurator is allowed to push without any interaction (by using SSH PubKey authentication for example).
|
||||
#### DIRSFIRST (bool)
|
||||
if set to `true`, directories will be displayed at the top
|
||||
|
||||
__Note regarding `ALLOWED_NETWORKS`, `BANNED_IPS` and `BANLIMIT`__:
|
||||
The way this is implemented works in the following order:
|
||||
|
|
|
@ -53,6 +53,8 @@ GIT = False
|
|||
# Files to ignore in the UI. A good example list that cleans up the UI is
|
||||
# [".*", "*.log", "deps", "icloud", "*.conf", "*.json", "certs", "__pycache__"]
|
||||
IGNORE_PATTERN = []
|
||||
# if DIRSFIRST is set to `true`, directories will be displayed at the top
|
||||
DIRSFIRST = False
|
||||
### End of options
|
||||
|
||||
LOGLEVEL = logging.INFO
|
||||
|
@ -2732,7 +2734,7 @@ def signal_handler(sig, frame):
|
|||
def load_settings(settingsfile):
|
||||
global LISTENIP, LISTENPORT, BASEPATH, SSL_CERTIFICATE, SSL_KEY, HASS_API, \
|
||||
HASS_API_PASSWORD, CREDENTIALS, ALLOWED_NETWORKS, BANNED_IPS, BANLIMIT, DEV, \
|
||||
IGNORE_PATTERN
|
||||
IGNORE_PATTERN, DIRSFIRST
|
||||
try:
|
||||
if os.path.isfile(settingsfile):
|
||||
with open(settingsfile) as fptr:
|
||||
|
@ -2750,6 +2752,7 @@ def load_settings(settingsfile):
|
|||
BANLIMIT = settings.get("BANLIMIT", BANLIMIT)
|
||||
DEV = settings.get("DEV", DEV)
|
||||
IGNORE_PATTERN = settings.get("IGNORE_PATTERN", IGNORE_PATTERN)
|
||||
DIRSFIRST = settings.get("DIRSFIRST", DIRSFIRST)
|
||||
except Exception as err:
|
||||
LOG.warning(err)
|
||||
LOG.warning("Not loading static settings")
|
||||
|
@ -2776,7 +2779,15 @@ def get_dircontent(path, repo=None):
|
|||
staged = {}
|
||||
unstaged = {}
|
||||
|
||||
for elem in sorted(os.listdir(path), key=lambda x: x.lower()):
|
||||
def sorted_file_list():
|
||||
dirlist = [x for x in os.listdir(path) if os.path.isdir(os.path.join(path, x))]
|
||||
filelist = [x for x in os.listdir(path) if not os.path.isdir(os.path.join(path, x))]
|
||||
if DIRSFIRST:
|
||||
return sorted(dirlist, key=lambda x: x.lower()) + sorted(filelist, key=lambda x: x.lower())
|
||||
else:
|
||||
return sorted(dirlist + filelist, key=lambda x: x.lower())
|
||||
|
||||
for elem in sorted_file_list():
|
||||
edata = {}
|
||||
edata['name'] = elem
|
||||
edata['dir'] = path
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
"ALLOWED_NETWORKS": [],
|
||||
"BANNED_IPS": [],
|
||||
"BANLIMIT": 0,
|
||||
"IGNORE_PATTERN": []
|
||||
"IGNORE_PATTERN": [],
|
||||
"DIRSFIRST": false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue