Skip to content

Commit

Permalink
Add filter checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Jul 23, 2024
1 parent 6eb3232 commit 599b867
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,7 @@ def get_language_priority(language_code: str) -> int:
mime="application/zip",
)

show_file_list(root_dir)
enable_filter = st.checkbox(label=_("Filter available files by DF variant, operating system, language"), value=True)
glob_filter = f"*_{df_variant}_{operating_system}_{dict_entry.code}.zip" if enable_filter else "*.zip"

show_file_list(root_dir, glob_filter=glob_filter)
4 changes: 2 additions & 2 deletions package_build/file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from package_build.package import get_file_modification_datetime, package_up_to_date


def show_file_list(root_dir: Path) -> None:
def show_file_list(root_dir: Path, glob_filter: str) -> None:
st.subheader(_("Package files awailable to download"))

file_list = [file for file in root_dir.glob("*.zip") if package_up_to_date(file)]
file_list = [file for file in root_dir.glob(glob_filter) if package_up_to_date(file)]

if not file_list:
st.write(_("No package files available."))
Expand Down

0 comments on commit 599b867

Please sign in to comment.