new: Modal for admin tasks.

pull/652/head
Raphaël Vinot 2023-03-29 15:15:17 +02:00
parent 9ff153ea44
commit 854a045cba
4 changed files with 60 additions and 24 deletions

38
poetry.lock generated
View File

@ -2370,14 +2370,14 @@ files = [
[[package]] [[package]]
name = "pytz" name = "pytz"
version = "2023.2" version = "2023.3"
description = "World timezone definitions, modern and historical" description = "World timezone definitions, modern and historical"
category = "main" category = "main"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = [
{file = "pytz-2023.2-py2.py3-none-any.whl", hash = "sha256:8a8baaf1e237175b02f5c751eea67168043a749c843989e2b3015aa1ad9db68b"}, {file = "pytz-2023.3-py2.py3-none-any.whl", hash = "sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"},
{file = "pytz-2023.2.tar.gz", hash = "sha256:a27dcf612c05d2ebde626f7d506555f10dfc815b3eddccfaadfc7d99b11c9a07"}, {file = "pytz-2023.3.tar.gz", hash = "sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588"},
] ]
[[package]] [[package]]
@ -2546,14 +2546,14 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]] [[package]]
name = "setuptools" name = "setuptools"
version = "67.6.0" version = "67.6.1"
description = "Easily download, build, install, upgrade, and uninstall Python packages" description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "setuptools-67.6.0-py3-none-any.whl", hash = "sha256:b78aaa36f6b90a074c1fa651168723acbf45d14cb1196b6f02c0fd07f17623b2"}, {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"},
{file = "setuptools-67.6.0.tar.gz", hash = "sha256:2ee892cd5f29f3373097f5a814697e397cf3ce313616df0af11231e2ad118077"}, {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"},
] ]
[package.extras] [package.extras]
@ -2710,14 +2710,14 @@ files = [
[[package]] [[package]]
name = "types-pillow" name = "types-pillow"
version = "9.4.0.18" version = "9.4.0.19"
description = "Typing stubs for Pillow" description = "Typing stubs for Pillow"
category = "dev" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = [
{file = "types-Pillow-9.4.0.18.tar.gz", hash = "sha256:6a92c4ebcb9cdbe034d17235b9011cc3a63c04ebfc9bff87f46e3b7295b93fae"}, {file = "types-Pillow-9.4.0.19.tar.gz", hash = "sha256:a04401181979049977e318dae4523ab5ae8246314fc68fcf50b043ac885a5468"},
{file = "types_Pillow-9.4.0.18-py3-none-any.whl", hash = "sha256:df3342b13f5e9b8b1a12832f930fb47a5477e58dd2dd8ef5948da6c92a22ca90"}, {file = "types_Pillow-9.4.0.19-py3-none-any.whl", hash = "sha256:b55f2508be21e68a39f0a41830f1f1725aba0888e727e2eccd253c78cd5357a5"},
] ]
[[package]] [[package]]
@ -2777,14 +2777,14 @@ types-pyOpenSSL = "*"
[[package]] [[package]]
name = "types-requests" name = "types-requests"
version = "2.28.11.16" version = "2.28.11.17"
description = "Typing stubs for requests" description = "Typing stubs for requests"
category = "dev" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = [
{file = "types-requests-2.28.11.16.tar.gz", hash = "sha256:9d4002056df7ebc4ec1f28fd701fba82c5c22549c4477116cb2656aa30ace6db"}, {file = "types-requests-2.28.11.17.tar.gz", hash = "sha256:0d580652ce903f643f8c3b494dd01d29367ea57cea0c7ad7f65cf3169092edb0"},
{file = "types_requests-2.28.11.16-py3-none-any.whl", hash = "sha256:a86921028335fdcc3aaf676c9d3463f867db6af2303fc65aa309b13ae1e6dd53"}, {file = "types_requests-2.28.11.17-py3-none-any.whl", hash = "sha256:cc1aba862575019306b2ed134eb1ea994cab1c887a22e18d3383e6dd42e9789b"},
] ]
[package.dependencies] [package.dependencies]
@ -2792,14 +2792,14 @@ types-urllib3 = "<1.27"
[[package]] [[package]]
name = "types-urllib3" name = "types-urllib3"
version = "1.26.25.9" version = "1.26.25.10"
description = "Typing stubs for urllib3" description = "Typing stubs for urllib3"
category = "dev" category = "dev"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = [
{file = "types-urllib3-1.26.25.9.tar.gz", hash = "sha256:160727879bdbe52f11f5feeca092a473f38d68ed3be88abb461b59cda40fb9bc"}, {file = "types-urllib3-1.26.25.10.tar.gz", hash = "sha256:c44881cde9fc8256d05ad6b21f50c4681eb20092552351570ab0a8a0653286d6"},
{file = "types_urllib3-1.26.25.9-py3-none-any.whl", hash = "sha256:b327d360ba4a9edd80ea82f5990ba19e76175a20b5b64be4b4813d9a1c424caa"}, {file = "types_urllib3-1.26.25.10-py3-none-any.whl", hash = "sha256:12c744609d588340a07e45d333bf870069fc8793bcf96bae7a96d4712a42591d"},
] ]
[[package]] [[package]]
@ -2816,14 +2816,14 @@ files = [
[[package]] [[package]]
name = "tzdata" name = "tzdata"
version = "2023.2" version = "2023.3"
description = "Provider of IANA time zone data" description = "Provider of IANA time zone data"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=2" python-versions = ">=2"
files = [ files = [
{file = "tzdata-2023.2-py2.py3-none-any.whl", hash = "sha256:905ae9e6744dd9ef5ce94d2aaa2dd00282fee38b670b2133407f23c388f110a1"}, {file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"},
{file = "tzdata-2023.2.tar.gz", hash = "sha256:c3b51b235b07f9f1889089c2264bcbeaaba260a63f89bea09e350ea4205eb95f"}, {file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"},
] ]
[[package]] [[package]]
@ -3145,4 +3145,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.8,<3.12" python-versions = ">=3.8,<3.12"
content-hash = "f3c467037d243f00d6bfa87aadf0fa01bf1f12cc9d74e0c452566e8b7bfafda2" content-hash = "90c87185cbe7b1ac8cc1b958a832284124e1373d51186bb464f310ae90539272"

View File

@ -77,13 +77,13 @@ pylookyloomonitoring = "^0.2.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
mypy = "^1.1.1" mypy = "^1.1.1"
ipython = "^8.11.0" ipython = "^8.11.0"
types-redis = {version = "^4.5.1.0,!=4.5.2.0,!=4.5.3.0"} types-redis = {version = "^4.5.1.0,!=4.5.2.0,!=4.5.3.0,!=4.5.3.1"}
types-requests = "^2.28.11.16" types-requests = "^2.28.11.17"
types-pkg-resources = "^0.1.3" types-pkg-resources = "^0.1.3"
types-Deprecated = "^1.2.9.2" types-Deprecated = "^1.2.9.2"
types-python-dateutil = "^2.8.19.11" types-python-dateutil = "^2.8.19.11"
types-beautifulsoup4 = "^4.12.0.1" types-beautifulsoup4 = "^4.12.0.1"
types-Pillow = "^9.4.0.18" types-Pillow = "^9.4.0.19"
[build-system] [build-system]
requires = ["poetry_core>=1.1"] requires = ["poetry_core>=1.1"]

View File

@ -632,6 +632,7 @@ def bulk_captures(base_tree_uuid: str):
@flask_login.login_required @flask_login.login_required
def hide_capture(tree_uuid: str): def hide_capture(tree_uuid: str):
lookyloo.hide_capture(tree_uuid) lookyloo.hide_capture(tree_uuid)
flash('Successfully hidden.', 'success')
return redirect(url_for('tree', tree_uuid=tree_uuid)) return redirect(url_for('tree', tree_uuid=tree_uuid))
@ -640,6 +641,7 @@ def hide_capture(tree_uuid: str):
def rebuild_tree(tree_uuid: str): def rebuild_tree(tree_uuid: str):
try: try:
lookyloo.remove_pickle(tree_uuid) lookyloo.remove_pickle(tree_uuid)
flash('Successfully rebuilt.', 'success')
return redirect(url_for('tree', tree_uuid=tree_uuid)) return redirect(url_for('tree', tree_uuid=tree_uuid))
except Exception: except Exception:
return redirect(url_for('index')) return redirect(url_for('index'))

View File

@ -264,8 +264,8 @@
<a href="{{ url_for('recapture', tree_uuid=tree_uuid) }}" role="button">Re-Capture</a> <a href="{{ url_for('recapture', tree_uuid=tree_uuid) }}" role="button">Re-Capture</a>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<a href="#downloadModal" data-remote="{{ url_for('hashlookup', tree_uuid=tree_uuid) }}" <a href="#downloadModal" data-bs-toggle="modal"
data-bs-toggle="modal" data-bs-target="#downloadModal" role="button">Download elements</a> data-bs-target="#downloadModal" role="button">Download elements</a>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<a href="#bodyHashesModal" data-remote="{{ url_for('tree_body_hashes', tree_uuid=tree_uuid) }}" <a href="#bodyHashesModal" data-remote="{{ url_for('tree_body_hashes', tree_uuid=tree_uuid) }}"
@ -277,6 +277,10 @@
<div class="vr"></div> <div class="vr"></div>
<div class="col-md"> <div class="col-md">
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item">
<a href="#adminModal" data-bs-toggle="modal"
data-bs-target="#adminModal" role="button">Admin tasks</a>
</li>
<li class="list-group-item"> <li class="list-group-item">
<a href="#historyModal" data-remote="{{ url_for('historical_lookups', tree_uuid=tree_uuid, force=False) }}" <a href="#historyModal" data-remote="{{ url_for('historical_lookups', tree_uuid=tree_uuid, force=False) }}"
data-bs-toggle="modal" data-bs-target="#historyModal" role="button">Historical lookups</a> data-bs-toggle="modal" data-bs-target="#historyModal" role="button">Historical lookups</a>
@ -650,6 +654,36 @@
</div> </div>
</div> </div>
<div class="modal fade" id="adminModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="adminModalLabel">
RUn admin only tasks on the capture
</h4>
</br>
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</br>
<div class="modal-body">
<ul>
<li>
<a href="{{ url_for('rebuild_tree', tree_uuid=tree_uuid) }}" role="button">Rebuild capture</a>
</li>
<li>
<a href="{{ url_for('hide_capture', tree_uuid=tree_uuid) }}" role="button">Hide capture</a>
</li>
<li>
<a href="{{ url_for('logout') }}" role="button">Logout</a>
</li>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="hashlookupModal" tabindex="-1" role="dialog"> <div class="modal fade" id="hashlookupModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
<div class="modal-content"> <div class="modal-content">