mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-29 13:48:09 -06:00
Compare commits
273 Commits
6aeb5a5503
...
feature-pw
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7a6f79c8b | ||
|
|
87dc22fbf6 | ||
|
|
2332b3f6ad | ||
|
|
5fbc985b67 | ||
|
|
7f95160a63 | ||
|
|
1aaf128bcb | ||
|
|
10db1e6405 | ||
|
|
0e2611163b | ||
|
|
b917db44ed | ||
|
|
bca409d932 | ||
|
|
07d67b3299 | ||
|
|
5fca9bac50 | ||
|
|
b21df970fd | ||
|
|
833890d0ca | ||
|
|
eb1708420e | ||
|
|
3bb74772a9 | ||
|
|
402c9af81b | ||
|
|
c1de78162b | ||
|
|
f888722a73 | ||
|
|
99724a25a2 | ||
|
|
504c824cfe | ||
|
|
01c7a345cb | ||
|
|
985dc9be31 | ||
|
|
890c2d6757 | ||
|
|
00cf026524 | ||
|
|
7604a0b583 | ||
|
|
4e789acf2d | ||
|
|
d9459d04ea | ||
|
|
305d764805 | ||
|
|
eca2ba3657 | ||
|
|
220c70b27d | ||
|
|
ccaebabe0a | ||
|
|
598540fda0 | ||
|
|
b1a75b0166 | ||
|
|
bf38ae98f1 | ||
|
|
84c59f45da | ||
|
|
d8397ac77e | ||
|
|
7c0a13b339 | ||
|
|
7c8db78a62 | ||
|
|
04f81bf17d | ||
|
|
f96a29db5d | ||
|
|
5af3039d62 | ||
|
|
078cba4bd1 | ||
|
|
43e29598b3 | ||
|
|
d9a596d67a | ||
|
|
a1026f03db | ||
|
|
6c8a9b0373 | ||
|
|
7130c0bd06 | ||
|
|
d391fdec64 | ||
|
|
4d7aa8e1a2 | ||
|
|
9bdbfd362f | ||
|
|
9ba1d93e15 | ||
|
|
a9c73e2846 | ||
|
|
332136df8b | ||
|
|
3a1d33225e | ||
|
|
e770ff572e | ||
|
|
402f2ead59 | ||
|
|
3b4d958b97 | ||
|
|
3f81b432ec | ||
|
|
66d363bdc5 | ||
|
|
c845cf0a19 | ||
|
|
317f239d09 | ||
|
|
128c3539d5 | ||
|
|
26975868a0 | ||
|
|
f3fc3febf1 | ||
|
|
8efc998687 | ||
|
|
3f47900f06 | ||
|
|
963a519e5c | ||
|
|
59e5d15cf0 | ||
|
|
ef2f65fcb8 | ||
|
|
555ba8bb19 | ||
|
|
01992bb5c6 | ||
|
|
21032ac008 | ||
|
|
b63e095a60 | ||
|
|
ce642409e8 | ||
|
|
2e5bd02e7e | ||
|
|
7032da53c5 | ||
|
|
6f3451bce0 | ||
|
|
8c5b5cd77b | ||
|
|
919c54c6ba | ||
|
|
4632ad3a36 | ||
|
|
0c43b50f01 | ||
|
|
67d079fe14 | ||
|
|
ca674e5a02 | ||
|
|
71e08a1e98 | ||
|
|
1e61a6cd6a | ||
|
|
a76731ca89 | ||
|
|
ffc56bddda | ||
|
|
4c2cc373f2 | ||
|
|
76bb6d3422 | ||
|
|
85a2a0a416 | ||
|
|
5036aa1ea3 | ||
|
|
f7da273ab7 | ||
|
|
93338a0a82 | ||
|
|
a96db50b0a | ||
|
|
c5e80a7e4f | ||
|
|
bc622d67fc | ||
|
|
4a8d3c858c | ||
|
|
8c335321cd | ||
|
|
27966858fd | ||
|
|
d3bfb186e0 | ||
|
|
cf5ac596ed | ||
|
|
25b5e8fede | ||
|
|
80be6793cf | ||
|
|
7b175ec1b3 | ||
|
|
36d45ecf4d | ||
|
|
4bf681387a | ||
|
|
c05d75dab0 | ||
|
|
7a50157164 | ||
|
|
a93d83119e | ||
|
|
addaf92a61 | ||
|
|
8c7fa4e165 | ||
|
|
22a47a28dc | ||
|
|
20d921142e | ||
|
|
1ed8f1d086 | ||
|
|
46853e10dc | ||
|
|
c31c244b54 | ||
|
|
56493d6640 | ||
|
|
f7f94762b6 | ||
|
|
beb5fe2232 | ||
|
|
c924213f32 | ||
|
|
b053b35332 | ||
|
|
a45692aa0f | ||
|
|
c3ac102eba | ||
|
|
0e5ab7f3e0 | ||
|
|
533b64cb70 | ||
|
|
b3d6359afc | ||
|
|
b6e3827ab1 | ||
|
|
7cd802cf48 | ||
|
|
7470b799a3 | ||
|
|
b5df90156e | ||
|
|
733d2e19a0 | ||
|
|
fe7419484b | ||
|
|
0d827e8511 | ||
|
|
69514d8d70 | ||
|
|
dd6f7fad32 | ||
|
|
c5ad148dc7 | ||
|
|
b12f1e757c | ||
|
|
0cbab1ae80 | ||
|
|
0219df5b67 | ||
|
|
005ef4fce6 | ||
|
|
44f0191bfb | ||
|
|
e9f846ca24 | ||
|
|
2049497b76 | ||
|
|
2a9d1fce0d | ||
|
|
808c074f48 | ||
|
|
7927e5c436 | ||
|
|
cac48c9855 | ||
|
|
3fda648f37 | ||
|
|
95736eebc4 | ||
|
|
85027dbffd | ||
|
|
74f72e417d | ||
|
|
fe3c424d7d | ||
|
|
a0172a2754 | ||
|
|
810bf3d612 | ||
|
|
846cc47565 | ||
|
|
1d396d9160 | ||
|
|
2a4e8f9acd | ||
|
|
a9dfe8f3f7 | ||
|
|
906e841ded | ||
|
|
6684e80ffc | ||
|
|
3dc7cf3da1 | ||
|
|
819f606335 | ||
|
|
ad45e3f747 | ||
|
|
74b10db028 | ||
|
|
cffb9c34f0 | ||
|
|
6f52614817 | ||
|
|
a0d3527d20 | ||
|
|
4e64ca7ca6 | ||
|
|
e9511bd3da | ||
|
|
8b9ca75a90 | ||
|
|
9f0a4ac19d | ||
|
|
8f969ecab5 | ||
|
|
245e52a4eb | ||
|
|
a8c75d95d8 | ||
|
|
d6e2456baf | ||
|
|
3b75d3271e | ||
|
|
e88816d141 | ||
|
|
e5bd4713ac | ||
|
|
b9aced07fb | ||
|
|
6b55740f56 | ||
|
|
9aee063347 | ||
|
|
7fe411bb1a | ||
|
|
34b5f4c565 | ||
|
|
3808a4e14a | ||
|
|
3bd4135aba | ||
|
|
b60fb8ed82 | ||
|
|
3f32ed319a | ||
|
|
03e6d58f86 | ||
|
|
c197487374 | ||
|
|
d718d7d29f | ||
|
|
ce112cda0e | ||
|
|
d904aaef60 | ||
|
|
35bc673648 | ||
|
|
d0bd111eab | ||
|
|
cd81f750b4 | ||
|
|
48d21da13b | ||
|
|
701aafce06 | ||
|
|
cbe8bc35d6 | ||
|
|
1c4fa7237c | ||
|
|
63dab0ab09 | ||
|
|
276dc31abe | ||
|
|
a11a2ec13f | ||
|
|
df9136e7d4 | ||
|
|
1d8fadcb3c | ||
|
|
4e85262781 | ||
|
|
7e5d80fa38 | ||
|
|
3cfd64b77a | ||
|
|
0fc595a16a | ||
|
|
91e2220f23 | ||
|
|
893c05dfdc | ||
|
|
faf3e8dc0d | ||
|
|
41b9fff407 | ||
|
|
26f61c900f | ||
|
|
8d0e07e931 | ||
|
|
bf9e3fca48 | ||
|
|
144dd8cdf3 | ||
|
|
13161ebb01 | ||
|
|
0ebd9f24b5 | ||
|
|
c9f49f390a | ||
|
|
31cee7481b | ||
|
|
78893292f8 | ||
|
|
e4ac079cd7 | ||
|
|
597c2629dd | ||
|
|
264166810c | ||
|
|
a8b42a3c7a | ||
|
|
af7bac03f1 | ||
|
|
363fd5a97f | ||
|
|
fcae006afa | ||
|
|
a206ac78dd | ||
|
|
4456be72c6 | ||
|
|
557612f7a2 | ||
|
|
bf18eaa5c2 | ||
|
|
d1c11bcf08 | ||
|
|
15e6809a71 | ||
|
|
7326224888 | ||
|
|
04a01fb9f4 | ||
|
|
340754d865 | ||
|
|
39c429bb87 | ||
|
|
8686f264cf | ||
|
|
f6c004183e | ||
|
|
d394053ddc | ||
|
|
a36c28418c | ||
|
|
f0d1c75fac | ||
|
|
495159f0b2 | ||
|
|
33fd8a6579 | ||
|
|
e08e34fb90 | ||
|
|
6164bac66e | ||
|
|
df86882e8e | ||
|
|
79b30fbade | ||
|
|
d609b386fe | ||
|
|
502bbb2420 | ||
|
|
27574009e1 | ||
|
|
bd73555ecc | ||
|
|
613c922dd2 | ||
|
|
1659aa08e4 | ||
|
|
68dfb4a930 | ||
|
|
3c439b970f | ||
|
|
962f7994d1 | ||
|
|
93eea80f3e | ||
|
|
5bc27eb4b2 | ||
|
|
b19701cb96 | ||
|
|
9c552bc2d7 | ||
|
|
80fabb0b56 | ||
|
|
af1c235af5 | ||
|
|
92ee906701 | ||
|
|
d6710de486 | ||
|
|
f71b13b82a | ||
|
|
3df43d828a | ||
|
|
643e2b4a8e | ||
|
|
6fa896df39 | ||
|
|
ab7875cc76 | ||
|
|
0114993ac6 |
@@ -1,6 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/node:20-bookworm-slim as main-app
|
FROM --platform=$BUILDPLATFORM docker.io/node:20-trixie-slim as main-app
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
@@ -8,16 +8,17 @@ ARG DEBIAN_FRONTEND=noninteractive
|
|||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
# Can be workflow provided, defaults set for manual building
|
# Can be workflow provided, defaults set for manual building
|
||||||
ARG JBIG2ENC_VERSION=0.29
|
ARG JBIG2ENC_VERSION=0.30
|
||||||
ARG QPDF_VERSION=11.9.0
|
|
||||||
ARG GS_VERSION=10.03.1
|
|
||||||
|
|
||||||
# Set Python environment variables
|
# Set Python environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
# Ignore warning from Whitenoise
|
# Ignore warning from Whitenoise
|
||||||
PYTHONWARNINGS="ignore:::django.http.response:517" \
|
PYTHONWARNINGS="ignore:::django.http.response:517" \
|
||||||
PNGX_CONTAINERIZED=1
|
PNGX_CONTAINERIZED=1 \
|
||||||
|
# https://docs.astral.sh/uv/reference/settings/#link-mode
|
||||||
|
UV_LINK_MODE=copy \
|
||||||
|
UV_CACHE_DIR=/cache/uv/
|
||||||
|
|
||||||
#
|
#
|
||||||
# Begin installation and configuration
|
# Begin installation and configuration
|
||||||
@@ -83,37 +84,15 @@ RUN set -eux \
|
|||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install --yes --quiet ${PYTHON_PACKAGES}
|
&& apt-get install --yes --quiet ${PYTHON_PACKAGES}
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.7.8 /uv /bin/uv
|
COPY --from=ghcr.io/astral-sh/uv:0.9.10 /uv /bin/uv
|
||||||
|
|
||||||
|
|
||||||
RUN set -eux \
|
RUN set -eux \
|
||||||
&& echo "Installing pre-built updates" \
|
&& echo "Installing pre-built updates" \
|
||||||
&& echo "Installing qpdf ${QPDF_VERSION}" \
|
|
||||||
&& curl --fail --silent --show-error --location \
|
|
||||||
--output libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& curl --fail --silent --show-error --location \
|
|
||||||
--output qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& dpkg --install ./libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& dpkg --install ./qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& echo "Installing Ghostscript ${GS_VERSION}" \
|
|
||||||
&& curl --fail --silent --show-error --location \
|
|
||||||
--output libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& curl --fail --silent --show-error --location \
|
|
||||||
--output ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& curl --fail --silent --show-error --location \
|
|
||||||
--output libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
||||||
&& dpkg --install ./libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
||||||
&& dpkg --install ./libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& dpkg --install ./ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& echo "Installing jbig2enc" \
|
&& echo "Installing jbig2enc" \
|
||||||
&& curl --fail --silent --show-error --location \
|
&& curl --fail --silent --show-error --location \
|
||||||
--output jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
--output jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
||||||
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-trixie-v${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
||||||
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb
|
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb
|
||||||
|
|
||||||
# setup docker-specific things
|
# setup docker-specific things
|
||||||
@@ -127,6 +106,7 @@ COPY [ \
|
|||||||
|
|
||||||
RUN set -eux \
|
RUN set -eux \
|
||||||
&& echo "Configuring ImageMagick" \
|
&& echo "Configuring ImageMagick" \
|
||||||
|
&& mkdir -p /etc/ImageMagick-6 \
|
||||||
&& mv paperless-policy.xml /etc/ImageMagick-6/policy.xml
|
&& mv paperless-policy.xml /etc/ImageMagick-6/policy.xml
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +122,7 @@ ARG BUILD_PACKAGES="\
|
|||||||
pkg-config"
|
pkg-config"
|
||||||
|
|
||||||
# hadolint ignore=DL3042
|
# hadolint ignore=DL3042
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv,id=pip-cache \
|
RUN --mount=type=cache,target=/cache/uv/,id=uv-cache \
|
||||||
set -eux \
|
set -eux \
|
||||||
&& echo "Installing build system packages" \
|
&& echo "Installing build system packages" \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ end_of_line = lf
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
max_line_length = 79
|
max_line_length = 79
|
||||||
|
|
||||||
|
[*.sh]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 1
|
||||||
|
|
||||||
[{*.html,*.css,*.js}]
|
[{*.html,*.css,*.js}]
|
||||||
max_line_length = off
|
max_line_length = off
|
||||||
|
|
||||||
|
|||||||
2
.github/DISCUSSION_TEMPLATE/support.yml
vendored
2
.github/DISCUSSION_TEMPLATE/support.yml
vendored
@@ -51,5 +51,5 @@ body:
|
|||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
label: Relevant logs or output
|
label: Relevant logs or output
|
||||||
description: If you have logs, errors that might help, paste it here.
|
description: If you have logs, errors that might help, paste it here. For example other containers or services (database, redis, etc).
|
||||||
render: bash
|
render: bash
|
||||||
|
|||||||
10
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
10
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -6,8 +6,8 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
### ⚠️ Please remember: issues are for *bugs*
|
### ⚠️ Please remember: issues are for *bugs* only! ⚠️
|
||||||
That is, something you believe affects every single user of Paperless-ngx, not just you. If you're not sure, start with one of the other options below.
|
That is, something you believe affects every single user of Paperless-ngx (and the demo, for example), not just you. If you are not sure, start with one of the other options below.
|
||||||
|
|
||||||
Also, note that **Paperless-ngx does not perform OCR or archive file creation itself**, those are handled by other tools. Problems with OCR or archive versions of specific files should likely be raised 'upstream', see https://github.com/ocrmypdf/OCRmyPDF/issues or https://github.com/tesseract-ocr/tesseract/issues
|
Also, note that **Paperless-ngx does not perform OCR or archive file creation itself**, those are handled by other tools. Problems with OCR or archive versions of specific files should likely be raised 'upstream', see https://github.com/ocrmypdf/OCRmyPDF/issues or https://github.com/tesseract-ocr/tesseract/issues
|
||||||
- type: markdown
|
- type: markdown
|
||||||
@@ -59,6 +59,12 @@ body:
|
|||||||
label: Browser logs
|
label: Browser logs
|
||||||
description: Logs from the web browser related to your issue, if needed
|
description: Logs from the web browser related to your issue, if needed
|
||||||
render: bash
|
render: bash
|
||||||
|
- type: textarea
|
||||||
|
id: logs_services
|
||||||
|
attributes:
|
||||||
|
label: Services logs
|
||||||
|
description: Logs from other services (or containers) related to your issue, if needed. For example, the database or redis logs.
|
||||||
|
render: bash
|
||||||
- type: input
|
- type: input
|
||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -35,8 +35,8 @@ NOTE: PRs that do not address the following will not be merged, please do not sk
|
|||||||
|
|
||||||
- [ ] I have read & agree with the [contributing guidelines](https://github.com/paperless-ngx/paperless-ngx/blob/main/CONTRIBUTING.md).
|
- [ ] I have read & agree with the [contributing guidelines](https://github.com/paperless-ngx/paperless-ngx/blob/main/CONTRIBUTING.md).
|
||||||
- [ ] If applicable, I have included testing coverage for new code in this PR, for [backend](https://docs.paperless-ngx.com/development/#testing) and / or [front-end](https://docs.paperless-ngx.com/development/#testing-and-code-style) changes.
|
- [ ] If applicable, I have included testing coverage for new code in this PR, for [backend](https://docs.paperless-ngx.com/development/#testing) and / or [front-end](https://docs.paperless-ngx.com/development/#testing-and-code-style) changes.
|
||||||
- [ ] If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
|
- [ ] If applicable, I have tested my code for breaking changes & regressions on both mobile & desktop devices, using the latest version of major browsers.
|
||||||
- [ ] If applicable, I have checked that all tests pass, see [documentation](https://docs.paperless-ngx.com/development/#back-end-development).
|
- [ ] If applicable, I have checked that all tests pass, see [documentation](https://docs.paperless-ngx.com/development/#back-end-development).
|
||||||
- [ ] I have run all `pre-commit` hooks, see [documentation](https://docs.paperless-ngx.com/development/#code-formatting-with-pre-commit-hooks).
|
- [ ] I have run all `pre-commit` hooks, see [documentation](https://docs.paperless-ngx.com/development/#code-formatting-with-pre-commit-hooks).
|
||||||
- [ ] I have made corresponding changes to the documentation as needed.
|
- [ ] I have made corresponding changes to the documentation as needed.
|
||||||
- [ ] I have checked my modifications for any breaking changes.
|
- [ ] In the description of the PR above I have disclosed the use of AI tools in the coding of this PR.
|
||||||
|
|||||||
50
.github/dependabot.yml
vendored
50
.github/dependabot.yml
vendored
@@ -41,30 +41,56 @@ updates:
|
|||||||
- "backend"
|
- "backend"
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
groups:
|
groups:
|
||||||
|
# Development & CI/CD Tooling
|
||||||
development:
|
development:
|
||||||
patterns:
|
patterns:
|
||||||
- "*pytest*"
|
- "*pytest*"
|
||||||
- "ruff"
|
- "ruff"
|
||||||
- "mkdocs-material"
|
- "mkdocs-material"
|
||||||
- "pre-commit*"
|
- "pre-commit*"
|
||||||
django:
|
# Django & DRF Ecosystem
|
||||||
|
django-ecosystem:
|
||||||
patterns:
|
patterns:
|
||||||
- "*django*"
|
- "*django*"
|
||||||
- "drf-*"
|
- "drf-*"
|
||||||
major-versions:
|
- "djangorestframework"
|
||||||
|
- "whitenoise"
|
||||||
|
- "bleach"
|
||||||
|
- "jinja2"
|
||||||
|
# Async, Task Queuing & Caching
|
||||||
|
async-tasks:
|
||||||
|
patterns:
|
||||||
|
- "celery*"
|
||||||
|
- "channels*"
|
||||||
|
- "flower"
|
||||||
|
- "redis"
|
||||||
|
# Document, PDF, and OCR Processing
|
||||||
|
document-processing:
|
||||||
|
patterns:
|
||||||
|
- "ocrmypdf"
|
||||||
|
- "pdf2image"
|
||||||
|
- "pyzbar"
|
||||||
|
- "zxing-cpp"
|
||||||
|
- "tika-client"
|
||||||
|
- "gotenberg-client"
|
||||||
|
- "python-magic"
|
||||||
|
- "python-gnupg"
|
||||||
|
# Data, NLP, and Search
|
||||||
|
data-nlp-search:
|
||||||
|
patterns:
|
||||||
|
- "nltk"
|
||||||
|
- "scikit-learn"
|
||||||
|
- "langdetect"
|
||||||
|
- "rapidfuzz"
|
||||||
|
- "whoosh-reloaded"
|
||||||
|
# Utilities (Patch Updates)
|
||||||
|
utilities-patch:
|
||||||
update-types:
|
update-types:
|
||||||
- "major"
|
- "patch"
|
||||||
small-changes:
|
# Utilities (Minor Updates)
|
||||||
|
utilities-minor:
|
||||||
update-types:
|
update-types:
|
||||||
- "minor"
|
- "minor"
|
||||||
- "patch"
|
|
||||||
exclude-patterns:
|
|
||||||
- "*django*"
|
|
||||||
- "drf-*"
|
|
||||||
pre-built:
|
|
||||||
patterns:
|
|
||||||
- psycopg*
|
|
||||||
- zxing-cpp
|
|
||||||
# Enable updates for GitHub Actions
|
# Enable updates for GitHub Actions
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: "github-actions"
|
||||||
target-branch: "dev"
|
target-branch: "dev"
|
||||||
|
|||||||
124
.github/workflows/ci.yml
vendored
124
.github/workflows/ci.yml
vendored
@@ -12,7 +12,7 @@ on:
|
|||||||
branches-ignore:
|
branches-ignore:
|
||||||
- 'translations**'
|
- 'translations**'
|
||||||
env:
|
env:
|
||||||
DEFAULT_UV_VERSION: "0.8.x"
|
DEFAULT_UV_VERSION: "0.9.x"
|
||||||
# This is the default version of Python to use in most steps which aren't specific
|
# This is the default version of Python to use in most steps which aren't specific
|
||||||
DEFAULT_PYTHON_VERSION: "3.11"
|
DEFAULT_PYTHON_VERSION: "3.11"
|
||||||
NLTK_DATA: "/usr/share/nltk_data"
|
NLTK_DATA: "/usr/share/nltk_data"
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check if workflow should run
|
- name: Check if workflow should run
|
||||||
id: check
|
id: check
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
@@ -67,9 +67,9 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Install python
|
- name: Install python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
||||||
- name: Check files
|
- name: Check files
|
||||||
@@ -81,14 +81,14 @@ jobs:
|
|||||||
- pre-commit
|
- pre-commit
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
version: ${{ env.DEFAULT_UV_VERSION }}
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
--frozen \
|
--frozen \
|
||||||
mkdocs gh-deploy --force --no-history
|
mkdocs gh-deploy --force --no-history
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: documentation
|
name: documentation
|
||||||
path: site/
|
path: site/
|
||||||
@@ -131,18 +131,18 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Start containers
|
- name: Start containers
|
||||||
run: |
|
run: |
|
||||||
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml pull --quiet
|
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml pull --quiet
|
||||||
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml up --detach
|
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml up --detach
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "${{ matrix.python-version }}"
|
python-version: "${{ matrix.python-version }}"
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
version: ${{ env.DEFAULT_UV_VERSION }}
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
@@ -181,10 +181,11 @@ jobs:
|
|||||||
pytest
|
pytest
|
||||||
- name: Upload backend test results to Codecov
|
- name: Upload backend test results to Codecov
|
||||||
if: always()
|
if: always()
|
||||||
uses: codecov/test-results-action@v1
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
flags: backend-python-${{ matrix.python-version }}
|
flags: backend-python-${{ matrix.python-version }}
|
||||||
files: junit.xml
|
files: junit.xml
|
||||||
|
report_type: test_results
|
||||||
- name: Upload backend coverage to Codecov
|
- name: Upload backend coverage to Codecov
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -201,13 +202,13 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- pre-commit
|
- pre-commit
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -234,13 +235,13 @@ jobs:
|
|||||||
shard-index: [1, 2, 3, 4]
|
shard-index: [1, 2, 3, 4]
|
||||||
shard-count: [4]
|
shard-count: [4]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -260,11 +261,12 @@ jobs:
|
|||||||
- name: Run Jest unit tests
|
- name: Run Jest unit tests
|
||||||
run: cd src-ui && pnpm run test --max-workers=2 --shard=${{ matrix.shard-index }}/${{ matrix.shard-count }}
|
run: cd src-ui && pnpm run test --max-workers=2 --shard=${{ matrix.shard-index }}/${{ matrix.shard-count }}
|
||||||
- name: Upload frontend test results to Codecov
|
- name: Upload frontend test results to Codecov
|
||||||
uses: codecov/test-results-action@v1
|
|
||||||
if: always()
|
if: always()
|
||||||
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
flags: frontend-node-${{ matrix.node-version }}
|
flags: frontend-node-${{ matrix.node-version }}
|
||||||
directory: src-ui/
|
directory: src-ui/
|
||||||
|
report_type: test_results
|
||||||
- name: Upload frontend coverage to Codecov
|
- name: Upload frontend coverage to Codecov
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -273,8 +275,12 @@ jobs:
|
|||||||
tests-frontend-e2e:
|
tests-frontend-e2e:
|
||||||
name: "Frontend E2E Tests (Node ${{ matrix.node-version }} - ${{ matrix.shard-index }}/${{ matrix.shard-count }})"
|
name: "Frontend E2E Tests (Node ${{ matrix.node-version }} - ${{ matrix.shard-index }}/${{ matrix.shard-count }})"
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
container: mcr.microsoft.com/playwright:v1.57.0-noble
|
||||||
needs:
|
needs:
|
||||||
- install-frontend-dependencies
|
- install-frontend-dependencies
|
||||||
|
env:
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
|
||||||
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -282,13 +288,13 @@ jobs:
|
|||||||
shard-index: [1, 2]
|
shard-index: [1, 2]
|
||||||
shard-count: [2]
|
shard-count: [2]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -303,19 +309,8 @@ jobs:
|
|||||||
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
|
||||||
- name: Re-link Angular cli
|
- name: Re-link Angular cli
|
||||||
run: cd src-ui && pnpm link @angular/cli
|
run: cd src-ui && pnpm link @angular/cli
|
||||||
- name: Cache Playwright browsers
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cache/ms-playwright
|
|
||||||
key: ${{ runner.os }}-playwright-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-playwright-
|
|
||||||
- name: Install Playwright system dependencies
|
|
||||||
run: npx playwright install-deps
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: cd src-ui && pnpm install --no-frozen-lockfile
|
run: cd src-ui && pnpm install --no-frozen-lockfile
|
||||||
- name: Install Playwright
|
|
||||||
run: cd src-ui && pnpm exec playwright install
|
|
||||||
- name: Run Playwright e2e tests
|
- name: Run Playwright e2e tests
|
||||||
run: cd src-ui && pnpm exec playwright test --shard ${{ matrix.shard-index }}/${{ matrix.shard-count }}
|
run: cd src-ui && pnpm exec playwright test --shard ${{ matrix.shard-index }}/${{ matrix.shard-count }}
|
||||||
frontend-bundle-analysis:
|
frontend-bundle-analysis:
|
||||||
@@ -325,13 +320,13 @@ jobs:
|
|||||||
- tests-frontend
|
- tests-frontend
|
||||||
- tests-frontend-e2e
|
- tests-frontend-e2e
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -351,9 +346,9 @@ jobs:
|
|||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
run: cd src-ui && pnpm run build --configuration=production
|
run: cd src-ui && pnpm run build --configuration=production
|
||||||
build-docker-image:
|
build-docker-image:
|
||||||
name: Build Docker image for ${{ github.ref_name }}
|
name: Build Docker image for ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/feature-') || startsWith(github.ref, 'refs/heads/fix-') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/beta' || contains(github.ref, 'beta.rc') || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/l10n_'))
|
if: (github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/feature-') || startsWith(github.ref, 'refs/heads/fix-') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/beta' || contains(github.ref, 'beta.rc') || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/l10n_'))) || (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feature-') || startsWith(github.head_ref, 'fix-') || github.head_ref == 'dev' || github.head_ref == 'beta' || contains(github.head_ref, 'beta.rc') || startsWith(github.head_ref, 'l10n_')))
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-build-docker-image-${{ github.ref_name }}
|
group: ${{ github.workflow }}-build-docker-image-${{ github.ref_name }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -362,6 +357,23 @@ jobs:
|
|||||||
- tests-frontend
|
- tests-frontend
|
||||||
- tests-frontend-e2e
|
- tests-frontend-e2e
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare build variables
|
||||||
|
id: build-vars
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
result-encoding: string
|
||||||
|
script: |
|
||||||
|
const isPR = context.eventName === 'pull_request';
|
||||||
|
const defaultRefName = context.ref.replace('refs/heads/', '');
|
||||||
|
const headRef = isPR ? context.payload.pull_request.head.ref : defaultRefName;
|
||||||
|
const buildRef = isPR ? `refs/heads/${headRef}` : context.ref;
|
||||||
|
const buildCacheKey = headRef.split('/').join('-');
|
||||||
|
const canPush = context.eventName === 'push' || (isPR && context.payload.pull_request.head.repo.full_name === `${context.repo.owner}/${context.repo.repo}`);
|
||||||
|
|
||||||
|
core.setOutput('build-ref', buildRef);
|
||||||
|
core.setOutput('build-ref-name', headRef);
|
||||||
|
core.setOutput('build-cache-key', buildCacheKey);
|
||||||
|
core.setOutput('can-push', canPush ? 'true' : 'false');
|
||||||
- name: Check pushing to Docker Hub
|
- name: Check pushing to Docker Hub
|
||||||
id: push-other-places
|
id: push-other-places
|
||||||
# Only push to Dockerhub from the main repo AND the ref is either:
|
# Only push to Dockerhub from the main repo AND the ref is either:
|
||||||
@@ -370,8 +382,11 @@ jobs:
|
|||||||
# beta
|
# beta
|
||||||
# a tag
|
# a tag
|
||||||
# Otherwise forks would require a Docker Hub account and secrets setup
|
# Otherwise forks would require a Docker Hub account and secrets setup
|
||||||
|
env:
|
||||||
|
BUILD_REF: ${{ steps.build-vars.outputs.build-ref }}
|
||||||
|
BUILD_REF_NAME: ${{ steps.build-vars.outputs.build-ref-name }}
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{ github.repository_owner }} == "paperless-ngx" && ( ${{ github.ref_name }} == "dev" || ${{ github.ref_name }} == "beta" || ${{ startsWith(github.ref, 'refs/tags/v') }} == "true" ) ]] ; then
|
if [[ ${{ github.repository_owner }} == "paperless-ngx" && ( "$BUILD_REF_NAME" == "dev" || "$BUILD_REF_NAME" == "beta" || $BUILD_REF == refs/tags/v* || $BUILD_REF == *beta.rc* ) ]] ; then
|
||||||
echo "Enabling DockerHub image push"
|
echo "Enabling DockerHub image push"
|
||||||
echo "enable=true" >> $GITHUB_OUTPUT
|
echo "enable=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
@@ -395,12 +410,14 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
# Tag branches with branch name
|
# Tag branches with branch name
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
|
# Pull requests need a sanitized branch tag for pushing images
|
||||||
|
type=raw,value=${{ steps.build-vars.outputs.build-cache-key }},enable=${{ github.event_name == 'pull_request' }}
|
||||||
# Process semver tags
|
# Process semver tags
|
||||||
# For a tag x.y.z or vX.Y.Z, output an x.y.z and x.y image tag
|
# For a tag x.y.z or vX.Y.Z, output an x.y.z and x.y image tag
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
# If https://github.com/docker/buildx/issues/1044 is resolved,
|
# If https://github.com/docker/buildx/issues/1044 is resolved,
|
||||||
# the append input with a native arm64 arch could be used to
|
# the append input with a native arm64 arch could be used to
|
||||||
# significantly speed up building
|
# significantly speed up building
|
||||||
@@ -437,7 +454,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ steps.build-vars.outputs.can-push == 'true' }}
|
||||||
tags: ${{ steps.docker-meta.outputs.tags }}
|
tags: ${{ steps.docker-meta.outputs.tags }}
|
||||||
labels: ${{ steps.docker-meta.outputs.labels }}
|
labels: ${{ steps.docker-meta.outputs.labels }}
|
||||||
build-args: |
|
build-args: |
|
||||||
@@ -445,19 +462,21 @@ jobs:
|
|||||||
# Get cache layers from this branch, then dev
|
# Get cache layers from this branch, then dev
|
||||||
# This allows new branches to get at least some cache benefits, generally from dev
|
# This allows new branches to get at least some cache benefits, generally from dev
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=registry,ref=ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }}/builder/cache/app:${{ github.ref_name }}
|
type=registry,ref=ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }}/builder/cache/app:${{ steps.build-vars.outputs.build-cache-key }}
|
||||||
type=registry,ref=ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }}/builder/cache/app:dev
|
type=registry,ref=ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }}/builder/cache/app:dev
|
||||||
cache-to: |
|
cache-to: ${{ steps.build-vars.outputs.can-push == 'true' && format('type=registry,mode=max,ref=ghcr.io/{0}/builder/cache/app:{1}', steps.set-ghcr-repository.outputs.ghcr-repository, steps.build-vars.outputs.build-cache-key) || '' }}
|
||||||
type=registry,mode=max,ref=ghcr.io/${{ steps.set-ghcr-repository.outputs.ghcr-repository }}/builder/cache/app:${{ github.ref_name }}
|
|
||||||
- name: Inspect image
|
- name: Inspect image
|
||||||
|
if: steps.build-vars.outputs.can-push == 'true'
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ fromJSON(steps.docker-meta.outputs.json).tags[0] }}
|
docker buildx imagetools inspect ${{ fromJSON(steps.docker-meta.outputs.json).tags[0] }}
|
||||||
- name: Export frontend artifact from docker
|
- name: Export frontend artifact from docker
|
||||||
|
if: steps.build-vars.outputs.can-push == 'true'
|
||||||
run: |
|
run: |
|
||||||
docker create --name frontend-extract ${{ fromJSON(steps.docker-meta.outputs.json).tags[0] }}
|
docker create --name frontend-extract ${{ fromJSON(steps.docker-meta.outputs.json).tags[0] }}
|
||||||
docker cp frontend-extract:/usr/src/paperless/src/documents/static/frontend src/documents/static/frontend/
|
docker cp frontend-extract:/usr/src/paperless/src/documents/static/frontend src/documents/static/frontend/
|
||||||
- name: Upload frontend artifact
|
- name: Upload frontend artifact
|
||||||
uses: actions/upload-artifact@v4
|
if: steps.build-vars.outputs.can-push == 'true'
|
||||||
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: frontend-compiled
|
name: frontend-compiled
|
||||||
path: src/documents/static/frontend/
|
path: src/documents/static/frontend/
|
||||||
@@ -467,17 +486,18 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- build-docker-image
|
- build-docker-image
|
||||||
- documentation
|
- documentation
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
version: ${{ env.DEFAULT_UV_VERSION }}
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
@@ -490,12 +510,12 @@ jobs:
|
|||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -qq --no-install-recommends gettext liblept5
|
sudo apt-get install -qq --no-install-recommends gettext liblept5
|
||||||
- name: Download frontend artifact
|
- name: Download frontend artifact
|
||||||
uses: actions/download-artifact@v5
|
uses: actions/download-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: frontend-compiled
|
name: frontend-compiled
|
||||||
path: src/documents/static/frontend/
|
path: src/documents/static/frontend/
|
||||||
- name: Download documentation artifact
|
- name: Download documentation artifact
|
||||||
uses: actions/download-artifact@v5
|
uses: actions/download-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: documentation
|
name: documentation
|
||||||
path: docs/_build/html/
|
path: docs/_build/html/
|
||||||
@@ -558,7 +578,7 @@ jobs:
|
|||||||
sudo chown -R 1000:1000 paperless-ngx/
|
sudo chown -R 1000:1000 paperless-ngx/
|
||||||
tar -cJf paperless-ngx.tar.xz paperless-ngx/
|
tar -cJf paperless-ngx.tar.xz paperless-ngx/
|
||||||
- name: Upload release artifact
|
- name: Upload release artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: release
|
name: release
|
||||||
path: dist/paperless-ngx.tar.xz
|
path: dist/paperless-ngx.tar.xz
|
||||||
@@ -575,7 +595,7 @@ jobs:
|
|||||||
if: github.ref_type == 'tag' && (startsWith(github.ref_name, 'v') || contains(github.ref_name, '-beta.rc'))
|
if: github.ref_type == 'tag' && (startsWith(github.ref_name, 'v') || contains(github.ref_name, '-beta.rc'))
|
||||||
steps:
|
steps:
|
||||||
- name: Download release artifact
|
- name: Download release artifact
|
||||||
uses: actions/download-artifact@v5
|
uses: actions/download-artifact@v6
|
||||||
with:
|
with:
|
||||||
name: release
|
name: release
|
||||||
path: ./
|
path: ./
|
||||||
@@ -616,16 +636,16 @@ jobs:
|
|||||||
if: needs.publish-release.outputs.prerelease == 'false'
|
if: needs.publish-release.outputs.prerelease == 'false'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
version: ${{ env.DEFAULT_UV_VERSION }}
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
@@ -653,7 +673,7 @@ jobs:
|
|||||||
git commit -am "Changelog ${{ needs.publish-release.outputs.version }} - GHA"
|
git commit -am "Changelog ${{ needs.publish-release.outputs.version }} - GHA"
|
||||||
git push origin ${{ needs.publish-release.outputs.version }}-changelog
|
git push origin ${{ needs.publish-release.outputs.version }}-changelog
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const { repo, owner } = context.repo;
|
const { repo, owner } = context.repo;
|
||||||
|
|||||||
11
.github/workflows/cleanup-tags.yml
vendored
11
.github/workflows/cleanup-tags.yml
vendored
@@ -6,10 +6,9 @@
|
|||||||
# This workflow will not trigger runs on forked repos.
|
# This workflow will not trigger runs on forked repos.
|
||||||
name: Cleanup Image Tags
|
name: Cleanup Image Tags
|
||||||
on:
|
on:
|
||||||
delete:
|
workflow_dispatch:
|
||||||
push:
|
schedule:
|
||||||
paths:
|
- cron: '0 0 * * 0'
|
||||||
- ".github/workflows/cleanup-tags.yml"
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: registry-tags-cleanup
|
group: registry-tags-cleanup
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
@@ -28,7 +27,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Clean temporary images
|
- name: Clean temporary images
|
||||||
if: "${{ env.TOKEN != '' }}"
|
if: "${{ env.TOKEN != '' }}"
|
||||||
uses: stumpylog/image-cleaner-action/ephemeral@v0.11.0
|
uses: stumpylog/image-cleaner-action/ephemeral@v0.12.0
|
||||||
with:
|
with:
|
||||||
token: "${{ env.TOKEN }}"
|
token: "${{ env.TOKEN }}"
|
||||||
owner: "${{ github.repository_owner }}"
|
owner: "${{ github.repository_owner }}"
|
||||||
@@ -54,7 +53,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Clean untagged images
|
- name: Clean untagged images
|
||||||
if: "${{ env.TOKEN != '' }}"
|
if: "${{ env.TOKEN != '' }}"
|
||||||
uses: stumpylog/image-cleaner-action/untagged@v0.11.0
|
uses: stumpylog/image-cleaner-action/untagged@v0.12.0
|
||||||
with:
|
with:
|
||||||
token: "${{ env.TOKEN }}"
|
token: "${{ env.TOKEN }}"
|
||||||
owner: "${{ github.repository_owner }}"
|
owner: "${{ github.repository_owner }}"
|
||||||
|
|||||||
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -34,10 +34,10 @@ jobs:
|
|||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@v4
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -45,4 +45,4 @@ jobs:
|
|||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v4
|
||||||
|
|||||||
2
.github/workflows/crowdin.yml
vendored
2
.github/workflows/crowdin.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PNGX_BOT_PAT }}
|
token: ${{ secrets.PNGX_BOT_PAT }}
|
||||||
- name: crowdin action
|
- name: crowdin action
|
||||||
|
|||||||
8
.github/workflows/pr-bot.yml
vendored
8
.github/workflows/pr-bot.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Label PR by file path or branch name
|
- name: Label PR by file path or branch name
|
||||||
# see .github/labeler.yml for the labeler config
|
# see .github/labeler.yml for the labeler config
|
||||||
uses: actions/labeler@v5
|
uses: actions/labeler@v6
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Label by size
|
- name: Label by size
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
fail_if_xl: 'false'
|
fail_if_xl: 'false'
|
||||||
excluded_files: /\.lock$/ /\.txt$/ ^src-ui/pnpm-lock\.yaml$ ^src-ui/messages\.xlf$ ^src/locale/en_US/LC_MESSAGES/django\.po$
|
excluded_files: /\.lock$/ /\.txt$/ ^src-ui/pnpm-lock\.yaml$ ^src-ui/messages\.xlf$ ^src/locale/en_US/LC_MESSAGES/django\.po$
|
||||||
- name: Label by PR title
|
- name: Label by PR title
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
- name: Label bot-generated PRs
|
- name: Label bot-generated PRs
|
||||||
if: ${{ contains(github.actor, 'dependabot') || contains(github.actor, 'crowdin-bot') }}
|
if: ${{ contains(github.actor, 'dependabot') || contains(github.actor, 'crowdin-bot') }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
@@ -77,7 +77,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
- name: Welcome comment
|
- name: Welcome comment
|
||||||
if: ${{ !contains(github.actor, 'bot') }}
|
if: ${{ !contains(github.actor, 'bot') }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
|
|||||||
8
.github/workflows/repo-maintenance.yml
vendored
8
.github/workflows/repo-maintenance.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
if: github.repository_owner == 'paperless-ngx'
|
if: github.repository_owner == 'paperless-ngx'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v9
|
- uses: actions/stale@v10
|
||||||
with:
|
with:
|
||||||
days-before-stale: 7
|
days-before-stale: 7
|
||||||
days-before-close: 14
|
days-before-close: 14
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
if: github.repository_owner == 'paperless-ngx'
|
if: github.repository_owner == 'paperless-ngx'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v7
|
- uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
if: github.repository_owner == 'paperless-ngx'
|
if: github.repository_owner == 'paperless-ngx'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v7
|
- uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
@@ -206,7 +206,7 @@ jobs:
|
|||||||
if: github.repository_owner == 'paperless-ngx'
|
if: github.repository_owner == 'paperless-ngx'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v7
|
- uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
|
|||||||
10
.github/workflows/translate-strings.yml
vendored
10
.github/workflows/translate-strings.yml
vendored
@@ -11,19 +11,19 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PNGX_BOT_PAT }}
|
token: ${{ secrets.PNGX_BOT_PAT }}
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -qq --no-install-recommends gettext
|
sudo apt-get install -qq --no-install-recommends gettext
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Install backend python dependencies
|
- name: Install backend python dependencies
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
cd src-ui
|
cd src-ui
|
||||||
pnpm run ng extract-i18n
|
pnpm run ng extract-i18n
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v6
|
uses: stefanzweifel/git-auto-commit-action@v7
|
||||||
with:
|
with:
|
||||||
file_pattern: 'src-ui/messages.xlf src/locale/en_US/LC_MESSAGES/django.po'
|
file_pattern: 'src-ui/messages.xlf src/locale/en_US/LC_MESSAGES/django.po'
|
||||||
commit_message: "Auto translate strings"
|
commit_message: "Auto translate strings"
|
||||||
|
|||||||
@@ -49,26 +49,26 @@ repos:
|
|||||||
- 'prettier-plugin-organize-imports@4.1.0'
|
- 'prettier-plugin-organize-imports@4.1.0'
|
||||||
# Python hooks
|
# Python hooks
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.13.0
|
rev: v0.14.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff-check
|
- id: ruff-check
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
- repo: https://github.com/tox-dev/pyproject-fmt
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
||||||
rev: "v2.6.0"
|
rev: "v2.11.1"
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyproject-fmt
|
- id: pyproject-fmt
|
||||||
# Dockerfile hooks
|
# Dockerfile hooks
|
||||||
- repo: https://github.com/AleksaC/hadolint-py
|
- repo: https://github.com/AleksaC/hadolint-py
|
||||||
rev: v2.12.1b3
|
rev: v2.14.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: hadolint
|
- id: hadolint
|
||||||
# Shell script hooks
|
# Shell script hooks
|
||||||
- repo: https://github.com/lovesegfault/beautysh
|
- repo: https://github.com/lovesegfault/beautysh
|
||||||
rev: v6.2.1
|
rev: v6.4.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: beautysh
|
- id: beautysh
|
||||||
additional_dependencies:
|
types: [file]
|
||||||
- setuptools
|
files: (\.sh$|/run$|/finish$)
|
||||||
args:
|
args:
|
||||||
- "--tab"
|
- "--tab"
|
||||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||||
@@ -76,7 +76,9 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: shellcheck
|
- id: shellcheck
|
||||||
- repo: https://github.com/google/yamlfmt
|
- repo: https://github.com/google/yamlfmt
|
||||||
rev: v0.17.2
|
rev: v0.20.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamlfmt
|
- id: yamlfmt
|
||||||
exclude: "^src-ui/pnpm-lock.yaml"
|
exclude: "^src-ui/pnpm-lock.yaml"
|
||||||
|
types:
|
||||||
|
- yaml
|
||||||
|
|||||||
25
Dockerfile
25
Dockerfile
@@ -5,7 +5,7 @@
|
|||||||
# Purpose: Compiles the frontend
|
# Purpose: Compiles the frontend
|
||||||
# Notes:
|
# Notes:
|
||||||
# - Does PNPM stuff with Typescript and such
|
# - Does PNPM stuff with Typescript and such
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/node:20-bookworm-slim AS compile-frontend
|
FROM --platform=$BUILDPLATFORM docker.io/node:20-trixie-slim AS compile-frontend
|
||||||
|
|
||||||
COPY ./src-ui /src/src-ui
|
COPY ./src-ui /src/src-ui
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ RUN set -eux \
|
|||||||
# Purpose: Installs s6-overlay and rootfs
|
# Purpose: Installs s6-overlay and rootfs
|
||||||
# Comments:
|
# Comments:
|
||||||
# - Don't leave anything extra in here either
|
# - Don't leave anything extra in here either
|
||||||
FROM ghcr.io/astral-sh/uv:0.8.22-python3.12-bookworm-slim AS s6-overlay-base
|
FROM ghcr.io/astral-sh/uv:0.9.15-python3.12-trixie-slim AS s6-overlay-base
|
||||||
|
|
||||||
WORKDIR /usr/src/s6
|
WORKDIR /usr/src/s6
|
||||||
|
|
||||||
@@ -102,8 +102,6 @@ ARG TARGETARCH
|
|||||||
|
|
||||||
# Can be workflow provided, defaults set for manual building
|
# Can be workflow provided, defaults set for manual building
|
||||||
ARG JBIG2ENC_VERSION=0.30
|
ARG JBIG2ENC_VERSION=0.30
|
||||||
ARG QPDF_VERSION=11.9.0
|
|
||||||
ARG GS_VERSION=10.03.1
|
|
||||||
|
|
||||||
# Set Python environment variables
|
# Set Python environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
@@ -170,20 +168,8 @@ RUN set -eux \
|
|||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES} \
|
&& apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES} \
|
||||||
&& echo "Installing pre-built updates" \
|
&& echo "Installing pre-built updates" \
|
||||||
&& curl --fail --silent --no-progress-meter --show-error --location --remote-name-all --parallel --parallel-max 4 \
|
&& curl --fail --silent --no-progress-meter --show-error --location --remote-name-all \
|
||||||
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-trixie-v${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
||||||
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
||||||
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& echo "Installing qpdf ${QPDF_VERSION}" \
|
|
||||||
&& dpkg --install ./libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& dpkg --install ./qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
||||||
&& echo "Installing Ghostscript ${GS_VERSION}" \
|
|
||||||
&& dpkg --install ./libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
||||||
&& dpkg --install ./libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& dpkg --install ./ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
||||||
&& echo "Installing jbig2enc" \
|
&& echo "Installing jbig2enc" \
|
||||||
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
||||||
&& echo "Configuring imagemagick" \
|
&& echo "Configuring imagemagick" \
|
||||||
@@ -254,7 +240,8 @@ RUN set -eux \
|
|||||||
&& chown --from root:root --changes --recursive paperless:paperless /usr/src/paperless \
|
&& chown --from root:root --changes --recursive paperless:paperless /usr/src/paperless \
|
||||||
&& echo "Collecting static files" \
|
&& echo "Collecting static files" \
|
||||||
&& s6-setuidgid paperless python3 manage.py collectstatic --clear --no-input --link \
|
&& s6-setuidgid paperless python3 manage.py collectstatic --clear --no-input --link \
|
||||||
&& s6-setuidgid paperless python3 manage.py compilemessages
|
&& s6-setuidgid paperless python3 manage.py compilemessages \
|
||||||
|
&& /usr/local/bin/deduplicate.py --verbose /usr/src/paperless/static/
|
||||||
|
|
||||||
VOLUME ["/usr/src/paperless/data", \
|
VOLUME ["/usr/src/paperless/data", \
|
||||||
"/usr/src/paperless/media", \
|
"/usr/src/paperless/media", \
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# correct networking for the tests
|
# correct networking for the tests
|
||||||
services:
|
services:
|
||||||
gotenberg:
|
gotenberg:
|
||||||
image: docker.io/gotenberg/gotenberg:8.23
|
image: docker.io/gotenberg/gotenberg:8.25
|
||||||
hostname: gotenberg
|
hostname: gotenberg
|
||||||
container_name: gotenberg
|
container_name: gotenberg
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ services:
|
|||||||
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
||||||
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
||||||
gotenberg:
|
gotenberg:
|
||||||
image: docker.io/gotenberg/gotenberg:8.23
|
image: docker.io/gotenberg/gotenberg:8.25
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# The gotenberg chromium route is used to convert .eml files. We do not
|
# The gotenberg chromium route is used to convert .eml files. We do not
|
||||||
# want to allow external content like tracking pixels or even javascript.
|
# want to allow external content like tracking pixels or even javascript.
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- redisdata:/data
|
- redisdata:/data
|
||||||
db:
|
db:
|
||||||
image: docker.io/library/postgres:17
|
image: docker.io/library/postgres:18
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: paperless
|
POSTGRES_DB: paperless
|
||||||
POSTGRES_USER: paperless
|
POSTGRES_USER: paperless
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- redisdata:/data
|
- redisdata:/data
|
||||||
db:
|
db:
|
||||||
image: docker.io/library/postgres:17
|
image: docker.io/library/postgres:18
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: paperless
|
POSTGRES_DB: paperless
|
||||||
POSTGRES_USER: paperless
|
POSTGRES_USER: paperless
|
||||||
@@ -66,7 +66,7 @@ services:
|
|||||||
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
||||||
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
||||||
gotenberg:
|
gotenberg:
|
||||||
image: docker.io/gotenberg/gotenberg:8.23
|
image: docker.io/gotenberg/gotenberg:8.25
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# The gotenberg chromium route is used to convert .eml files. We do not
|
# The gotenberg chromium route is used to convert .eml files. We do not
|
||||||
# want to allow external content like tracking pixels or even javascript.
|
# want to allow external content like tracking pixels or even javascript.
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- redisdata:/data
|
- redisdata:/data
|
||||||
db:
|
db:
|
||||||
image: docker.io/library/postgres:17
|
image: docker.io/library/postgres:18
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: paperless
|
POSTGRES_DB: paperless
|
||||||
POSTGRES_USER: paperless
|
POSTGRES_USER: paperless
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ services:
|
|||||||
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
|
||||||
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
PAPERLESS_TIKA_ENDPOINT: http://tika:9998
|
||||||
gotenberg:
|
gotenberg:
|
||||||
image: docker.io/gotenberg/gotenberg:8.23
|
image: docker.io/gotenberg/gotenberg:8.25
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# The gotenberg chromium route is used to convert .eml files. We do not
|
# The gotenberg chromium route is used to convert .eml files. We do not
|
||||||
# want to allow external content like tracking pixels or even javascript.
|
# want to allow external content like tracking pixels or even javascript.
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ if find /run/s6/container_environment/*"_FILE" -maxdepth 1 > /dev/null 2>&1; the
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "${log_prefix} No *_FILE environment found"
|
echo "${log_prefix} No *_FILE environment found"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,70 +1,66 @@
|
|||||||
#!/command/with-contenv /usr/bin/bash
|
#!/command/with-contenv /usr/bin/bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
# vim: set ft=bash ts=4 sw=4 sts=4 et :
|
||||||
|
|
||||||
declare -r log_prefix="[init-db-wait]"
|
set -euo pipefail
|
||||||
|
|
||||||
|
declare -r LOG_PREFIX="[init-db-wait]"
|
||||||
|
|
||||||
|
declare -ri TIMEOUT=60
|
||||||
|
declare -i ATTEMPT=0
|
||||||
|
declare -i DELAY=0
|
||||||
|
declare -i STARTED_AT=${EPOCHSECONDS:?EPOCHSECONDS var unset}
|
||||||
|
|
||||||
|
delay_next_attempt() {
|
||||||
|
local -i elapsed=$(( EPOCHSECONDS - STARTED_AT ))
|
||||||
|
local -ri remaining=$(( TIMEOUT - elapsed ))
|
||||||
|
|
||||||
|
if (( remaining <= 0 )); then
|
||||||
|
echo "${LOG_PREFIX} Unable to connect after $elapsed seconds."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DELAY+=1
|
||||||
|
|
||||||
|
# clamp to remaining time
|
||||||
|
if (( DELAY > remaining )); then
|
||||||
|
DELAY=$remaining
|
||||||
|
fi
|
||||||
|
|
||||||
|
ATTEMPT+=1
|
||||||
|
echo "${LOG_PREFIX} Attempt $ATTEMPT failed! Trying again in $DELAY seconds..."
|
||||||
|
sleep "$DELAY"
|
||||||
|
}
|
||||||
|
|
||||||
wait_for_postgres() {
|
wait_for_postgres() {
|
||||||
local attempt_num=1
|
echo "${LOG_PREFIX} Waiting for PostgreSQL to start..."
|
||||||
local -r max_attempts=5
|
|
||||||
|
|
||||||
echo "${log_prefix} Waiting for PostgreSQL to start..."
|
|
||||||
|
|
||||||
local -r host="${PAPERLESS_DBHOST:-localhost}"
|
local -r host="${PAPERLESS_DBHOST:-localhost}"
|
||||||
local -r port="${PAPERLESS_DBPORT:-5432}"
|
local -r port="${PAPERLESS_DBPORT:-5432}"
|
||||||
local -r user="${PAPERLESS_DBUSER:-paperless}"
|
local -r user="${PAPERLESS_DBUSER:-paperless}"
|
||||||
|
|
||||||
# Disable warning, host and port can't have spaces
|
while ! pg_isready -h "${host}" -p "${port}" --username "${user}"; do
|
||||||
# shellcheck disable=SC2086
|
delay_next_attempt
|
||||||
while [ ! "$(pg_isready -h ${host} -p ${port} --username ${user})" ]; do
|
|
||||||
|
|
||||||
if [ $attempt_num -eq $max_attempts ]; then
|
|
||||||
echo "${log_prefix} Unable to connect to database."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "${log_prefix} Attempt $attempt_num failed! Trying again in 5 seconds..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempt_num=$(("$attempt_num" + 1))
|
|
||||||
sleep 5
|
|
||||||
done
|
done
|
||||||
# Extra in case this is a first start
|
echo "${LOG_PREFIX} Connected to PostgreSQL"
|
||||||
sleep 5
|
|
||||||
echo "Connected to PostgreSQL"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_mariadb() {
|
wait_for_mariadb() {
|
||||||
echo "${log_prefix} Waiting for MariaDB to start..."
|
echo "${LOG_PREFIX} Waiting for MariaDB to start..."
|
||||||
|
|
||||||
local -r host="${PAPERLESS_DBHOST:=localhost}"
|
local -r host="${PAPERLESS_DBHOST:-localhost}"
|
||||||
local -r port="${PAPERLESS_DBPORT:=3306}"
|
local -r port="${PAPERLESS_DBPORT:-3306}"
|
||||||
|
|
||||||
local attempt_num=1
|
while ! mariadb-admin --host="${host}" --port="${port}" --skip-ssl ping --silent >/dev/null 2>&1; do
|
||||||
local -r max_attempts=5
|
delay_next_attempt
|
||||||
|
|
||||||
# Disable warning, host and port can't have spaces
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
while ! true > /dev/tcp/$host/$port; do
|
|
||||||
|
|
||||||
if [ $attempt_num -eq $max_attempts ]; then
|
|
||||||
echo "${log_prefix} Unable to connect to database."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "${log_prefix} Attempt $attempt_num failed! Trying again in 5 seconds..."
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempt_num=$(("$attempt_num" + 1))
|
|
||||||
sleep 5
|
|
||||||
done
|
done
|
||||||
echo "Connected to MariaDB"
|
echo "${LOG_PREFIX} Connected to MariaDB"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${PAPERLESS_DBENGINE}" == "mariadb" ]]; then
|
if [[ "${PAPERLESS_DBENGINE:-}" == "mariadb" ]]; then
|
||||||
echo "${log_prefix} Waiting for MariaDB to report ready"
|
|
||||||
wait_for_mariadb
|
wait_for_mariadb
|
||||||
elif [[ -n "${PAPERLESS_DBHOST}" ]]; then
|
elif [[ -n "${PAPERLESS_DBHOST:-}" ]]; then
|
||||||
echo "${log_prefix} Waiting for postgresql to report ready"
|
|
||||||
wait_for_postgres
|
wait_for_postgres
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${log_prefix} Database is ready"
|
echo "${LOG_PREFIX} Database is ready"
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ export GRANIAN_WORKERS=${GRANIAN_WORKERS:-${PAPERLESS_WEBSERVER_WORKERS:-1}}
|
|||||||
|
|
||||||
# Only set GRANIAN_URL_PATH_PREFIX if PAPERLESS_FORCE_SCRIPT_NAME is set
|
# Only set GRANIAN_URL_PATH_PREFIX if PAPERLESS_FORCE_SCRIPT_NAME is set
|
||||||
if [[ -n "${PAPERLESS_FORCE_SCRIPT_NAME}" ]]; then
|
if [[ -n "${PAPERLESS_FORCE_SCRIPT_NAME}" ]]; then
|
||||||
export GRANIAN_URL_PATH_PREFIX=${PAPERLESS_FORCE_SCRIPT_NAME}
|
export GRANIAN_URL_PATH_PREFIX=${PAPERLESS_FORCE_SCRIPT_NAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
|
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
|
||||||
exec granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
|
exec granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
|
||||||
else
|
else
|
||||||
exec s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
|
exec s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
|
||||||
fi
|
fi
|
||||||
|
|||||||
167
docker/rootfs/usr/local/bin/deduplicate.py
Executable file
167
docker/rootfs/usr/local/bin/deduplicate.py
Executable file
@@ -0,0 +1,167 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
File deduplication script that replaces identical files with symlinks.
|
||||||
|
Uses SHA256 hashing to identify duplicate files.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
from collections import defaultdict
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import click
|
||||||
|
import humanize
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_sha256(filepath: Path) -> str | None:
|
||||||
|
sha256_hash = hashlib.sha256()
|
||||||
|
try:
|
||||||
|
with filepath.open("rb") as f:
|
||||||
|
# Read file in chunks to handle large files efficiently
|
||||||
|
while chunk := f.read(65536): # 64KB chunks
|
||||||
|
sha256_hash.update(chunk)
|
||||||
|
return sha256_hash.hexdigest()
|
||||||
|
except OSError as e:
|
||||||
|
click.echo(f"Error reading {filepath}: {e}", err=True)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def find_duplicate_files(directory: Path) -> dict[str, list[Path]]:
|
||||||
|
"""
|
||||||
|
Recursively scan directory and group files by their SHA256 hash.
|
||||||
|
Returns a dictionary mapping hash -> list of file paths.
|
||||||
|
"""
|
||||||
|
hash_to_files: dict[str, list[Path]] = defaultdict(list)
|
||||||
|
|
||||||
|
for filepath in directory.rglob("*"):
|
||||||
|
# Skip symlinks
|
||||||
|
if filepath.is_symlink():
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip if not a regular file
|
||||||
|
if not filepath.is_file():
|
||||||
|
continue
|
||||||
|
|
||||||
|
file_hash = calculate_sha256(filepath)
|
||||||
|
if file_hash:
|
||||||
|
hash_to_files[file_hash].append(filepath)
|
||||||
|
|
||||||
|
# Filter to only return hashes with duplicates
|
||||||
|
return {h: files for h, files in hash_to_files.items() if len(files) > 1}
|
||||||
|
|
||||||
|
|
||||||
|
def replace_with_symlinks(
|
||||||
|
duplicate_groups: dict[str, list[Path]],
|
||||||
|
*,
|
||||||
|
dry_run: bool = False,
|
||||||
|
) -> tuple[int, int]:
|
||||||
|
"""
|
||||||
|
Replace duplicate files with symlinks to the first occurrence.
|
||||||
|
Returns (number_of_files_replaced, space_saved_in_bytes).
|
||||||
|
"""
|
||||||
|
total_duplicates = 0
|
||||||
|
space_saved = 0
|
||||||
|
|
||||||
|
for file_hash, file_list in duplicate_groups.items():
|
||||||
|
# Keep the first file as the original, replace others with symlinks
|
||||||
|
original_file = file_list[0]
|
||||||
|
duplicates = file_list[1:]
|
||||||
|
|
||||||
|
click.echo(f"Found {len(duplicates)} duplicate(s) of: {original_file}")
|
||||||
|
|
||||||
|
for duplicate in duplicates:
|
||||||
|
try:
|
||||||
|
# Get file size before deletion
|
||||||
|
file_size = duplicate.stat().st_size
|
||||||
|
|
||||||
|
if dry_run:
|
||||||
|
click.echo(f" [DRY RUN] Would replace: {duplicate}")
|
||||||
|
else:
|
||||||
|
# Remove the duplicate file
|
||||||
|
duplicate.unlink()
|
||||||
|
|
||||||
|
# Create relative symlink if possible, otherwise absolute
|
||||||
|
try:
|
||||||
|
# Try to create a relative symlink
|
||||||
|
rel_path = original_file.relative_to(duplicate.parent)
|
||||||
|
duplicate.symlink_to(rel_path)
|
||||||
|
click.echo(f" Replaced: {duplicate} -> {rel_path}")
|
||||||
|
except ValueError:
|
||||||
|
# Fall back to absolute path
|
||||||
|
duplicate.symlink_to(original_file.resolve())
|
||||||
|
click.echo(f" Replaced: {duplicate} -> {original_file}")
|
||||||
|
|
||||||
|
space_saved += file_size
|
||||||
|
|
||||||
|
total_duplicates += 1
|
||||||
|
|
||||||
|
except OSError as e:
|
||||||
|
click.echo(f" Error replacing {duplicate}: {e}", err=True)
|
||||||
|
|
||||||
|
return total_duplicates, space_saved
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.argument(
|
||||||
|
"directory",
|
||||||
|
type=click.Path(
|
||||||
|
exists=True,
|
||||||
|
file_okay=False,
|
||||||
|
dir_okay=True,
|
||||||
|
readable=True,
|
||||||
|
path_type=Path,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--dry-run",
|
||||||
|
is_flag=True,
|
||||||
|
help="Show what would be done without making changes",
|
||||||
|
)
|
||||||
|
@click.option("--verbose", "-v", is_flag=True, help="Show verbose output")
|
||||||
|
def deduplicate(directory: Path, *, dry_run: bool, verbose: bool) -> None:
|
||||||
|
"""
|
||||||
|
Recursively search DIRECTORY for identical files and replace them with symlinks.
|
||||||
|
|
||||||
|
Uses SHA256 hashing to identify duplicate files. The first occurrence of each
|
||||||
|
unique file is kept, and all duplicates are replaced with symlinks pointing to it.
|
||||||
|
"""
|
||||||
|
directory = directory.resolve()
|
||||||
|
|
||||||
|
click.echo(f"Scanning directory: {directory}")
|
||||||
|
if dry_run:
|
||||||
|
click.echo("Running in DRY RUN mode - no changes will be made")
|
||||||
|
|
||||||
|
# Find all duplicate files
|
||||||
|
click.echo("Calculating file hashes...")
|
||||||
|
duplicate_groups = find_duplicate_files(directory)
|
||||||
|
|
||||||
|
if not duplicate_groups:
|
||||||
|
click.echo("No duplicate files found!")
|
||||||
|
return
|
||||||
|
|
||||||
|
total_files = sum(len(files) - 1 for files in duplicate_groups.values())
|
||||||
|
click.echo(
|
||||||
|
f"Found {len(duplicate_groups)} group(s) of duplicates "
|
||||||
|
f"({total_files} files to deduplicate)",
|
||||||
|
)
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
for file_hash, files in duplicate_groups.items():
|
||||||
|
click.echo(f"Hash: {file_hash}")
|
||||||
|
for f in files:
|
||||||
|
click.echo(f" - {f}")
|
||||||
|
|
||||||
|
# Replace duplicates with symlinks
|
||||||
|
click.echo("Processing duplicates...")
|
||||||
|
num_replaced, space_saved = replace_with_symlinks(duplicate_groups, dry_run=dry_run)
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
click.echo(
|
||||||
|
f"{'Would replace' if dry_run else 'Replaced'} "
|
||||||
|
f"{num_replaced} duplicate file(s)",
|
||||||
|
)
|
||||||
|
if not dry_run:
|
||||||
|
click.echo(f"Space saved: {humanize.naturalsize(space_saved, binary=True)}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
deduplicate()
|
||||||
@@ -294,6 +294,13 @@ The following methods are supported:
|
|||||||
- `"delete_original": true` to delete the original documents after editing.
|
- `"delete_original": true` to delete the original documents after editing.
|
||||||
- `"update_document": true` to update the existing document with the edited PDF.
|
- `"update_document": true` to update the existing document with the edited PDF.
|
||||||
- `"include_metadata": true` to copy metadata from the original document to the edited document.
|
- `"include_metadata": true` to copy metadata from the original document to the edited document.
|
||||||
|
- `remove_password`
|
||||||
|
- Requires `parameters`:
|
||||||
|
- `"password": "PASSWORD_STRING"` The password to remove from the PDF documents.
|
||||||
|
- Optional `parameters`:
|
||||||
|
- `"update_document": true` to replace the existing document with the password-less PDF.
|
||||||
|
- `"delete_original": true` to delete the original document after editing.
|
||||||
|
- `"include_metadata": true` to copy metadata from the original document to the new password-less document.
|
||||||
- `merge`
|
- `merge`
|
||||||
- No additional `parameters` required.
|
- No additional `parameters` required.
|
||||||
- The ordering of the merged document is determined by the list of IDs.
|
- The ordering of the merged document is determined by the list of IDs.
|
||||||
|
|||||||
@@ -1,5 +1,462 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## paperless-ngx 2.20.3
|
||||||
|
|
||||||
|
## paperless-ngx 2.20.2
|
||||||
|
|
||||||
|
### Features / Enhancements
|
||||||
|
|
||||||
|
- Tweakhancement: dim inactive users in users-groups list [@shamoon](https://github.com/shamoon) ([#11537](https://github.com/paperless-ngx/paperless-ngx/pull/11537))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: Expanded SVG validation whitelist and additional checks [@stumpylog](https://github.com/stumpylog) ([#11590](https://github.com/paperless-ngx/paperless-ngx/pull/11590))
|
||||||
|
- Fix: normalize allowed SVG tag and attribute names, add version [@shamoon](https://github.com/shamoon) ([#11586](https://github.com/paperless-ngx/paperless-ngx/pull/11586))
|
||||||
|
- Fix: pass additional arguments to TagSerializer for permissions [@shamoon](https://github.com/shamoon) ([#11576](https://github.com/paperless-ngx/paperless-ngx/pull/11576))
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
|
||||||
|
- Chore(deps): Bump actions/checkout from 5 to 6 in the actions group @[dependabot[bot]](https://github.com/apps/dependabot) ([#11515](https://github.com/paperless-ngx/paperless-ngx/pull/11515))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>6 changes</summary>
|
||||||
|
|
||||||
|
- Chore: update Angular dependencies to 20.3.15 [@shamoon](https://github.com/shamoon) ([#11568](https://github.com/paperless-ngx/paperless-ngx/pull/11568))
|
||||||
|
- Chore(deps): Bump actions/checkout from 5 to 6 in the actions group @[dependabot[bot]](https://github.com/apps/dependabot) ([#11515](https://github.com/paperless-ngx/paperless-ngx/pull/11515))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.102.1 to 5.103.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11513](https://github.com/paperless-ngx/paperless-ngx/pull/11513))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.56.1 to 1.57.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11514](https://github.com/paperless-ngx/paperless-ngx/pull/11514))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11512](https://github.com/paperless-ngx/paperless-ngx/pull/11512))
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.9.14-python3.12-trixie-slim to 0.9.15-python3.12-trixie-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11533](https://github.com/paperless-ngx/paperless-ngx/pull/11533))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>12 changes</summary>
|
||||||
|
|
||||||
|
- Fix: Expanded SVG validation whitelist and additional checks [@stumpylog](https://github.com/stumpylog) ([#11590](https://github.com/paperless-ngx/paperless-ngx/pull/11590))
|
||||||
|
- Fixhancement: pass ordering to tag children [@shamoon](https://github.com/shamoon) ([#11556](https://github.com/paperless-ngx/paperless-ngx/pull/11556))
|
||||||
|
- Performance: avoid unnecessary filename operations on bulk custom field updates [@shamoon](https://github.com/shamoon) ([#11558](https://github.com/paperless-ngx/paperless-ngx/pull/11558))
|
||||||
|
- Fix: normalize allowed SVG tag and attribute names, add version [@shamoon](https://github.com/shamoon) ([#11586](https://github.com/paperless-ngx/paperless-ngx/pull/11586))
|
||||||
|
- Chore: refactor workflows code [@shamoon](https://github.com/shamoon) ([#11563](https://github.com/paperless-ngx/paperless-ngx/pull/11563))
|
||||||
|
- Fix: pass additional arguments to TagSerializer for permissions [@shamoon](https://github.com/shamoon) ([#11576](https://github.com/paperless-ngx/paperless-ngx/pull/11576))
|
||||||
|
- Chore: update Angular dependencies to 20.3.15 [@shamoon](https://github.com/shamoon) ([#11568](https://github.com/paperless-ngx/paperless-ngx/pull/11568))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.102.1 to 5.103.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11513](https://github.com/paperless-ngx/paperless-ngx/pull/11513))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.56.1 to 1.57.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11514](https://github.com/paperless-ngx/paperless-ngx/pull/11514))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11512](https://github.com/paperless-ngx/paperless-ngx/pull/11512))
|
||||||
|
- Tweakhancement: dim inactive users in users-groups list [@shamoon](https://github.com/shamoon) ([#11537](https://github.com/paperless-ngx/paperless-ngx/pull/11537))
|
||||||
|
- Chore: add some output of social login errors [@shamoon](https://github.com/shamoon) ([#11527](https://github.com/paperless-ngx/paperless-ngx/pull/11527))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.20.1
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: set search term when using advanced search from global search [@shamoon](https://github.com/shamoon) ([#11503](https://github.com/paperless-ngx/paperless-ngx/pull/11503))
|
||||||
|
- Fix: change async handling of select custom field updates [@shamoon](https://github.com/shamoon) ([#11490](https://github.com/paperless-ngx/paperless-ngx/pull/11490))
|
||||||
|
- Fix: skip SSL for MariaDB ping in init script [@danielrheinbay](https://github.com/danielrheinbay) ([#11491](https://github.com/paperless-ngx/paperless-ngx/pull/11491))
|
||||||
|
- Fix: handle allauth groups location breaking change [@shamoon](https://github.com/shamoon) ([#11471](https://github.com/paperless-ngx/paperless-ngx/pull/11471))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.9.10-python3.12-trixie-slim to 0.9.11-python3.12-trixie-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11450](https://github.com/paperless-ngx/paperless-ngx/pull/11450))
|
||||||
|
- Chore(deps): Bump @angular/common from 20.3.12 to 20.3.14 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11481](https://github.com/paperless-ngx/paperless-ngx/pull/11481))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>4 changes</summary>
|
||||||
|
|
||||||
|
- Fix: set search term when using advanced search from global search [@shamoon](https://github.com/shamoon) ([#11503](https://github.com/paperless-ngx/paperless-ngx/pull/11503))
|
||||||
|
- Fix: change async handling of select custom field updates [@shamoon](https://github.com/shamoon) ([#11490](https://github.com/paperless-ngx/paperless-ngx/pull/11490))
|
||||||
|
- Chore(deps): Bump @angular/common from 20.3.12 to 20.3.14 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11481](https://github.com/paperless-ngx/paperless-ngx/pull/11481))
|
||||||
|
- Fix: handle allauth groups location breaking change [@shamoon](https://github.com/shamoon) ([#11471](https://github.com/paperless-ngx/paperless-ngx/pull/11471))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.20.0
|
||||||
|
|
||||||
|
### Notable Changes
|
||||||
|
|
||||||
|
- Feature: Upgrade underlying Docker image to Trixie [@stumpylog](https://github.com/stumpylog) ([#10562](https://github.com/paperless-ngx/paperless-ngx/pull/10562))
|
||||||
|
|
||||||
|
### Features / Enhancements
|
||||||
|
|
||||||
|
- Feature: Upgrade underlying Docker image to Trixie [@stumpylog](https://github.com/stumpylog) ([#10562](https://github.com/paperless-ngx/paperless-ngx/pull/10562))
|
||||||
|
- Fixhancement: more log viewer improvements [@shamoon](https://github.com/shamoon) ([#11426](https://github.com/paperless-ngx/paperless-ngx/pull/11426))
|
||||||
|
- Performance: Replace duplicated static files with symlinks [@stumpylog](https://github.com/stumpylog) ([#11418](https://github.com/paperless-ngx/paperless-ngx/pull/11418))
|
||||||
|
- Enhancement: add more relative dates, support modified [@shamoon](https://github.com/shamoon) ([#11411](https://github.com/paperless-ngx/paperless-ngx/pull/11411))
|
||||||
|
- Performance: make move files after select custom field change async [@shamoon](https://github.com/shamoon) ([#11391](https://github.com/paperless-ngx/paperless-ngx/pull/11391))
|
||||||
|
- Enhancement: Use a better check for the MariaDB server to be ready [@stumpylog](https://github.com/stumpylog) ([#11396](https://github.com/paperless-ngx/paperless-ngx/pull/11396))
|
||||||
|
- Enhancement: speed-up docker container startup [@flrgh](https://github.com/flrgh) ([#11134](https://github.com/paperless-ngx/paperless-ngx/pull/11134))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: prevent focus loss from change detection in cf query dropdown [@shamoon](https://github.com/shamoon) ([#11409](https://github.com/paperless-ngx/paperless-ngx/pull/11409))
|
||||||
|
- Fix: sort editing filterable dropdowns sooner [@shamoon](https://github.com/shamoon) ([#11404](https://github.com/paperless-ngx/paperless-ngx/pull/11404))
|
||||||
|
- Fix: support for custom field ordering w advanced search [@shamoon](https://github.com/shamoon) ([#11383](https://github.com/paperless-ngx/paperless-ngx/pull/11383))
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
|
||||||
|
- Chore(deps): Bump the actions group with 7 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11259](https://github.com/paperless-ngx/paperless-ngx/pull/11259))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>16 changes</summary>
|
||||||
|
|
||||||
|
- Chore: Upgrades psycopg to 3.2.12 [@stumpylog](https://github.com/stumpylog) ([#11420](https://github.com/paperless-ngx/paperless-ngx/pull/11420))
|
||||||
|
- Chore(deps-dev): Bump glob from 10.4.1 to 10.5.0 in /src/paperless_mail/templates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11413](https://github.com/paperless-ngx/paperless-ngx/pull/11413))
|
||||||
|
- docker-compose(deps): bump gotenberg/gotenberg from 8.24 to 8.25 in /docker/compose @[dependabot[bot]](https://github.com/apps/dependabot) ([#11393](https://github.com/paperless-ngx/paperless-ngx/pull/11393))
|
||||||
|
- Chore(deps): Bump the frontend-angular-dependencies group in /src-ui with 21 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11260](https://github.com/paperless-ngx/paperless-ngx/pull/11260))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.55.1 to 1.56.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11263](https://github.com/paperless-ngx/paperless-ngx/pull/11263))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.102.0 to 5.102.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11264](https://github.com/paperless-ngx/paperless-ngx/pull/11264))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11262](https://github.com/paperless-ngx/paperless-ngx/pull/11262))
|
||||||
|
- Chore(deps-dev): Bump jest-preset-angular from 15.0.2 to 15.0.3 in /src-ui in the frontend-jest-dependencies group @[dependabot[bot]](https://github.com/apps/dependabot) ([#11261](https://github.com/paperless-ngx/paperless-ngx/pull/11261))
|
||||||
|
- Chore(deps-dev): Bump @types/node from 24.6.1 to 24.9.2 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11265](https://github.com/paperless-ngx/paperless-ngx/pull/11265))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 11 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11337](https://github.com/paperless-ngx/paperless-ngx/pull/11337))
|
||||||
|
- Chore(deps): Bump django-auditlog from 3.2.1 to 3.3.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11021](https://github.com/paperless-ngx/paperless-ngx/pull/11021))
|
||||||
|
- Chore(deps): Bump the actions group with 7 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11259](https://github.com/paperless-ngx/paperless-ngx/pull/11259))
|
||||||
|
- Chore(deps): Bump drf-spectacular-sidecar from 2025.9.1 to 2025.10.1 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11019](https://github.com/paperless-ngx/paperless-ngx/pull/11019))
|
||||||
|
- Chore(deps): Bump django-filter from 25.1 to 25.2 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11020](https://github.com/paperless-ngx/paperless-ngx/pull/11020))
|
||||||
|
- Chore(deps): Update django-allauth[mfa,socialaccount] requirement from ~=65.4.0 to ~=65.12.1 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11198](https://github.com/paperless-ngx/paperless-ngx/pull/11198))
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.9.9-python3.12-bookworm-slim to 0.9.10-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11394](https://github.com/paperless-ngx/paperless-ngx/pull/11394))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>19 changes</summary>
|
||||||
|
|
||||||
|
- Fixhancement: more log viewer improvements [@shamoon](https://github.com/shamoon) ([#11426](https://github.com/paperless-ngx/paperless-ngx/pull/11426))
|
||||||
|
- Chore: Upgrades psycopg to 3.2.12 [@stumpylog](https://github.com/stumpylog) ([#11420](https://github.com/paperless-ngx/paperless-ngx/pull/11420))
|
||||||
|
- Enhancement: add more relative dates, support modified [@shamoon](https://github.com/shamoon) ([#11411](https://github.com/paperless-ngx/paperless-ngx/pull/11411))
|
||||||
|
- Chore(deps-dev): Bump glob from 10.4.1 to 10.5.0 in /src/paperless_mail/templates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11413](https://github.com/paperless-ngx/paperless-ngx/pull/11413))
|
||||||
|
- Performance: make move files after select custom field change async [@shamoon](https://github.com/shamoon) ([#11391](https://github.com/paperless-ngx/paperless-ngx/pull/11391))
|
||||||
|
- Fix: prevent focus loss from change detection in cf query dropdown [@shamoon](https://github.com/shamoon) ([#11409](https://github.com/paperless-ngx/paperless-ngx/pull/11409))
|
||||||
|
- Fix: sort editing filterable dropdowns sooner [@shamoon](https://github.com/shamoon) ([#11404](https://github.com/paperless-ngx/paperless-ngx/pull/11404))
|
||||||
|
- Chore(deps): Bump the frontend-angular-dependencies group in /src-ui with 21 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11260](https://github.com/paperless-ngx/paperless-ngx/pull/11260))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.55.1 to 1.56.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11263](https://github.com/paperless-ngx/paperless-ngx/pull/11263))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.102.0 to 5.102.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11264](https://github.com/paperless-ngx/paperless-ngx/pull/11264))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11262](https://github.com/paperless-ngx/paperless-ngx/pull/11262))
|
||||||
|
- Chore(deps-dev): Bump jest-preset-angular from 15.0.2 to 15.0.3 in /src-ui in the frontend-jest-dependencies group @[dependabot[bot]](https://github.com/apps/dependabot) ([#11261](https://github.com/paperless-ngx/paperless-ngx/pull/11261))
|
||||||
|
- Chore(deps-dev): Bump @types/node from 24.6.1 to 24.9.2 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#11265](https://github.com/paperless-ngx/paperless-ngx/pull/11265))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 11 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11337](https://github.com/paperless-ngx/paperless-ngx/pull/11337))
|
||||||
|
- Chore(deps): Bump django-auditlog from 3.2.1 to 3.3.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11021](https://github.com/paperless-ngx/paperless-ngx/pull/11021))
|
||||||
|
- Chore(deps): Bump drf-spectacular-sidecar from 2025.9.1 to 2025.10.1 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11019](https://github.com/paperless-ngx/paperless-ngx/pull/11019))
|
||||||
|
- Chore(deps): Bump django-filter from 25.1 to 25.2 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11020](https://github.com/paperless-ngx/paperless-ngx/pull/11020))
|
||||||
|
- Chore(deps): Update django-allauth[mfa,socialaccount] requirement from ~=65.4.0 to ~=65.12.1 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11198](https://github.com/paperless-ngx/paperless-ngx/pull/11198))
|
||||||
|
- Fix: support for custom field ordering w advanced search [@shamoon](https://github.com/shamoon) ([#11383](https://github.com/paperless-ngx/paperless-ngx/pull/11383))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.6
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Chore: include password validation on user edit [@shamoon](https://github.com/shamoon) ([#11308](https://github.com/paperless-ngx/paperless-ngx/pull/11308))
|
||||||
|
- Fix: include BASE_URL when constructing for workflows [@ebardsley](https://github.com/ebardsley) ([#11360](https://github.com/paperless-ngx/paperless-ngx/pull/11360))
|
||||||
|
- Fixhancement: refactor email attachment logic [@shamoon](https://github.com/shamoon) ([#11336](https://github.com/paperless-ngx/paperless-ngx/pull/11336))
|
||||||
|
- Fixhancement: trim whitespace for some text searches [@shamoon](https://github.com/shamoon) ([#11357](https://github.com/paperless-ngx/paperless-ngx/pull/11357))
|
||||||
|
- Fix: update Outlook refresh token when refreshed [@shamoon](https://github.com/shamoon) ([#11341](https://github.com/paperless-ngx/paperless-ngx/pull/11341))
|
||||||
|
- Fix: only cache remote version data for version checking [@shamoon](https://github.com/shamoon) ([#11320](https://github.com/paperless-ngx/paperless-ngx/pull/11320))
|
||||||
|
- Fix: include replace none logic in storage path preview, improve jinja conditionals for empty metadata [@shamoon](https://github.com/shamoon) ([#11315](https://github.com/paperless-ngx/paperless-ngx/pull/11315))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.9.7-python3.12-bookworm-slim to 0.9.9-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11338](https://github.com/paperless-ngx/paperless-ngx/pull/11338))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>7 changes</summary>
|
||||||
|
|
||||||
|
- Fix: include BASE_URL when constructing for workflows [@ebardsley](https://github.com/ebardsley) ([#11360](https://github.com/paperless-ngx/paperless-ngx/pull/11360))
|
||||||
|
- Fixhancement: refactor email attachment logic [@shamoon](https://github.com/shamoon) ([#11336](https://github.com/paperless-ngx/paperless-ngx/pull/11336))
|
||||||
|
- Fixhancement: trim whitespace for some text searches [@shamoon](https://github.com/shamoon) ([#11357](https://github.com/paperless-ngx/paperless-ngx/pull/11357))
|
||||||
|
- Fix: update Outlook refresh token when refreshed [@shamoon](https://github.com/shamoon) ([#11341](https://github.com/paperless-ngx/paperless-ngx/pull/11341))
|
||||||
|
- Fix: only cache remote version data for version checking [@shamoon](https://github.com/shamoon) ([#11320](https://github.com/paperless-ngx/paperless-ngx/pull/11320))
|
||||||
|
- Fix: include replace none logic in storage path preview, improve jinja conditionals for empty metadata [@shamoon](https://github.com/shamoon) ([#11315](https://github.com/paperless-ngx/paperless-ngx/pull/11315))
|
||||||
|
- Chore: include password validation on user edit [@shamoon](https://github.com/shamoon) ([#11308](https://github.com/paperless-ngx/paperless-ngx/pull/11308))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.5
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: ensure custom field query propagation, change detection [@shamoon](https://github.com/shamoon) ([#11291](https://github.com/paperless-ngx/paperless-ngx/pull/11291))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.9.4-python3.12-bookworm-slim to 0.9.7-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11283](https://github.com/paperless-ngx/paperless-ngx/pull/11283))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
- Fix: ensure custom field query propagation, change detection [@shamoon](https://github.com/shamoon) ([#11291](https://github.com/paperless-ngx/paperless-ngx/pull/11291))
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.4
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: use original_file when attaching docs to workflow emails with added trigger [@shamoon](https://github.com/shamoon) ([#11266](https://github.com/paperless-ngx/paperless-ngx/pull/11266))
|
||||||
|
- Fix: mark 'Select' button in doc list for translation [@shamoon](https://github.com/shamoon) ([#11278](https://github.com/paperless-ngx/paperless-ngx/pull/11278))
|
||||||
|
- Fix: respect fields parameter for created field [@shamoon](https://github.com/shamoon) ([#11251](https://github.com/paperless-ngx/paperless-ngx/pull/11251))
|
||||||
|
- Fix: improve legibility of processed mail error popover in light mode [@shamoon](https://github.com/shamoon) ([#11258](https://github.com/paperless-ngx/paperless-ngx/pull/11258))
|
||||||
|
- Fixhancement: truncate large logs, improve auto-scroll [@shamoon](https://github.com/shamoon) ([#11239](https://github.com/paperless-ngx/paperless-ngx/pull/11239))
|
||||||
|
- Chore: add max-height and overflow to processedmail error popover [@shamoon](https://github.com/shamoon) ([#11252](https://github.com/paperless-ngx/paperless-ngx/pull/11252))
|
||||||
|
- Fix: delay iframe DOM removal, handle onafterprint error for print in FF [@shamoon](https://github.com/shamoon) ([#11237](https://github.com/paperless-ngx/paperless-ngx/pull/11237))
|
||||||
|
- Fix: de-deduplicate children in tag list when filtering [@shamoon](https://github.com/shamoon) ([#11229](https://github.com/paperless-ngx/paperless-ngx/pull/11229))
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
- Performance: re-enable virtual scroll, bump ng-select [@shamoon](https://github.com/shamoon) ([#11279](https://github.com/paperless-ngx/paperless-ngx/pull/11279))
|
||||||
|
- Performance: use virtual scroll container and log level parsing for logs view [@MickLesk](https://github.com/MickLesk) ([#11233](https://github.com/paperless-ngx/paperless-ngx/pull/11233))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>11 changes</summary>
|
||||||
|
|
||||||
|
- Performance: re-enable virtual scroll, bump ng-select [@shamoon](https://github.com/shamoon) ([#11279](https://github.com/paperless-ngx/paperless-ngx/pull/11279))
|
||||||
|
- Fix: use original_file when attaching docs to workflow emails with added trigger [@shamoon](https://github.com/shamoon) ([#11266](https://github.com/paperless-ngx/paperless-ngx/pull/11266))
|
||||||
|
- Fix: mark 'Select' button in doc list for translation [@shamoon](https://github.com/shamoon) ([#11278](https://github.com/paperless-ngx/paperless-ngx/pull/11278))
|
||||||
|
- Fix: respect fields parameter for created field [@shamoon](https://github.com/shamoon) ([#11251](https://github.com/paperless-ngx/paperless-ngx/pull/11251))
|
||||||
|
- Fix: improve legibility of processed mail error popover in light mode [@shamoon](https://github.com/shamoon) ([#11258](https://github.com/paperless-ngx/paperless-ngx/pull/11258))
|
||||||
|
- Fixhancement: truncate large logs, improve auto-scroll [@shamoon](https://github.com/shamoon) ([#11239](https://github.com/paperless-ngx/paperless-ngx/pull/11239))
|
||||||
|
- Chore: add max-height and overflow to processedmail error popover [@shamoon](https://github.com/shamoon) ([#11252](https://github.com/paperless-ngx/paperless-ngx/pull/11252))
|
||||||
|
- Fix: delay iframe DOM removal, handle onafterprint error for print in FF [@shamoon](https://github.com/shamoon) ([#11237](https://github.com/paperless-ngx/paperless-ngx/pull/11237))
|
||||||
|
- Performance: use virtual scroll container and log level parsing for logs view [@MickLesk](https://github.com/MickLesk) ([#11233](https://github.com/paperless-ngx/paperless-ngx/pull/11233))
|
||||||
|
- Chore: cache Github version check for 15 minutes [@shamoon](https://github.com/shamoon) ([#11235](https://github.com/paperless-ngx/paperless-ngx/pull/11235))
|
||||||
|
- Fix: de-deduplicate children in tag list when filtering [@shamoon](https://github.com/shamoon) ([#11229](https://github.com/paperless-ngx/paperless-ngx/pull/11229))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.3
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: remove unnecessary permission requirements for new email endpoint [@shamoon](https://github.com/shamoon) ([#11215](https://github.com/paperless-ngx/paperless-ngx/pull/11215))
|
||||||
|
- Fix: refactor nested sorting in filterable dropdowns [@shamoon](https://github.com/shamoon) ([#11214](https://github.com/paperless-ngx/paperless-ngx/pull/11214))
|
||||||
|
- Fix: add root tag filtering for tag list page consistency, fix toggle all [@shamoon](https://github.com/shamoon) ([#11208](https://github.com/paperless-ngx/paperless-ngx/pull/11208))
|
||||||
|
- Fix: support ConsumableDocument in email attachments [@shamoon](https://github.com/shamoon) ([#11196](https://github.com/paperless-ngx/paperless-ngx/pull/11196))
|
||||||
|
- Fix: add missing import for ConfirmButtonComponent in user-edit-dialog [@shamoon](https://github.com/shamoon) ([#11167](https://github.com/paperless-ngx/paperless-ngx/pull/11167))
|
||||||
|
- Fix: resolve migration warning in 2.19.2 [@shamoon](https://github.com/shamoon) ([#11157](https://github.com/paperless-ngx/paperless-ngx/pull/11157))
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
- Change: make workflow action only title draggable [@shamoon](https://github.com/shamoon) ([#11209](https://github.com/paperless-ngx/paperless-ngx/pull/11209))
|
||||||
|
- Change: change workflowrun to softdeletemodel [@shamoon](https://github.com/shamoon) ([#11194](https://github.com/paperless-ngx/paperless-ngx/pull/11194))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- Chore(deps): Bump django from 5.2.6 to 5.2.7 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11200](https://github.com/paperless-ngx/paperless-ngx/pull/11200))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>9 changes</summary>
|
||||||
|
|
||||||
|
- Chore(deps): Bump django from 5.2.6 to 5.2.7 @[dependabot[bot]](https://github.com/apps/dependabot) ([#11200](https://github.com/paperless-ngx/paperless-ngx/pull/11200))
|
||||||
|
- Fix: remove unnecessary permission requirements for new email endpoint [@shamoon](https://github.com/shamoon) ([#11215](https://github.com/paperless-ngx/paperless-ngx/pull/11215))
|
||||||
|
- Fix: refactor nested sorting in filterable dropdowns [@shamoon](https://github.com/shamoon) ([#11214](https://github.com/paperless-ngx/paperless-ngx/pull/11214))
|
||||||
|
- Fix: add root tag filtering for tag list page consistency, fix toggle all [@shamoon](https://github.com/shamoon) ([#11208](https://github.com/paperless-ngx/paperless-ngx/pull/11208))
|
||||||
|
- Change: make workflow action only title draggable [@shamoon](https://github.com/shamoon) ([#11209](https://github.com/paperless-ngx/paperless-ngx/pull/11209))
|
||||||
|
- Change: change workflowrun to softdeletemodel [@shamoon](https://github.com/shamoon) ([#11194](https://github.com/paperless-ngx/paperless-ngx/pull/11194))
|
||||||
|
- Chore: Minor migration optimization for workflow titles [@stumpylog](https://github.com/stumpylog) ([#11197](https://github.com/paperless-ngx/paperless-ngx/pull/11197))
|
||||||
|
- Fix: support ConsumableDocument in email attachments [@shamoon](https://github.com/shamoon) ([#11196](https://github.com/paperless-ngx/paperless-ngx/pull/11196))
|
||||||
|
- Fix: add missing import for ConfirmButtonComponent in user-edit-dialog [@shamoon](https://github.com/shamoon) ([#11167](https://github.com/paperless-ngx/paperless-ngx/pull/11167))
|
||||||
|
- Fix: resolve migration warning in 2.19.2 [@shamoon](https://github.com/shamoon) ([#11157](https://github.com/paperless-ngx/paperless-ngx/pull/11157))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.2
|
||||||
|
|
||||||
|
### Features / Enhancements
|
||||||
|
|
||||||
|
- Fixhancement: display loading status for tags instead of 'Private' [@shamoon](https://github.com/shamoon) ([#11140](https://github.com/paperless-ngx/paperless-ngx/pull/11140))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: Remove edit requirement for bulk email, show based on setting [@shamoon](https://github.com/shamoon) ([#11149](https://github.com/paperless-ngx/paperless-ngx/pull/11149))
|
||||||
|
- Fix: handle undefined IDs in getOriginalObject [@shamoon](https://github.com/shamoon) ([#11147](https://github.com/paperless-ngx/paperless-ngx/pull/11147))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>3 changes</summary>
|
||||||
|
|
||||||
|
- Fix: Remove edit requirement for bulk email, show based on setting [@shamoon](https://github.com/shamoon) ([#11149](https://github.com/paperless-ngx/paperless-ngx/pull/11149))
|
||||||
|
- Fix: handle undefined IDs in getOriginalObject [@shamoon](https://github.com/shamoon) ([#11147](https://github.com/paperless-ngx/paperless-ngx/pull/11147))
|
||||||
|
- Fixhancement: display loading status for tags instead of 'Private' [@shamoon](https://github.com/shamoon) ([#11140](https://github.com/paperless-ngx/paperless-ngx/pull/11140))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.1
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: skip workflow title migration for empty titles [@shamoon](https://github.com/shamoon) ([#11136](https://github.com/paperless-ngx/paperless-ngx/pull/11136))
|
||||||
|
- Fix: restore workflow title migration [@shamoon](https://github.com/shamoon) ([#11131](https://github.com/paperless-ngx/paperless-ngx/pull/11131))
|
||||||
|
- Fix: retrieve document_count for tag children [@shamoon](https://github.com/shamoon) ([#11125](https://github.com/paperless-ngx/paperless-ngx/pull/11125))
|
||||||
|
- Fix: move hierarchical order logic in dropdown sorting [@shamoon](https://github.com/shamoon) ([#11128](https://github.com/paperless-ngx/paperless-ngx/pull/11128))
|
||||||
|
- Fix: use original object for children in tag list [@shamoon](https://github.com/shamoon) ([#11127](https://github.com/paperless-ngx/paperless-ngx/pull/11127))
|
||||||
|
- Fix: dont display or fetch users or groups with insufficient perms [@shamoon](https://github.com/shamoon) ([#11111](https://github.com/paperless-ngx/paperless-ngx/pull/11111))
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>6 changes</summary>
|
||||||
|
|
||||||
|
- Fix: skip workflow title migration for empty titles [@shamoon](https://github.com/shamoon) ([#11136](https://github.com/paperless-ngx/paperless-ngx/pull/11136))
|
||||||
|
- Fix: restore workflow title migration [@shamoon](https://github.com/shamoon) ([#11131](https://github.com/paperless-ngx/paperless-ngx/pull/11131))
|
||||||
|
- Fix: retrieve document_count for tag children [@shamoon](https://github.com/shamoon) ([#11125](https://github.com/paperless-ngx/paperless-ngx/pull/11125))
|
||||||
|
- Fix: move hierarchical order logic in dropdown sorting [@shamoon](https://github.com/shamoon) ([#11128](https://github.com/paperless-ngx/paperless-ngx/pull/11128))
|
||||||
|
- Fix: use original object for children in tag list [@shamoon](https://github.com/shamoon) ([#11127](https://github.com/paperless-ngx/paperless-ngx/pull/11127))
|
||||||
|
- Fix: dont display or fetch users or groups with insufficient perms [@shamoon](https://github.com/shamoon) ([#11111](https://github.com/paperless-ngx/paperless-ngx/pull/11111))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## paperless-ngx 2.19.0
|
||||||
|
|
||||||
|
### Notable Changes
|
||||||
|
|
||||||
|
- Feature: Advanced Workflow Filters [@shamoon](https://github.com/shamoon) ([#11029](https://github.com/paperless-ngx/paperless-ngx/pull/11029))
|
||||||
|
- Feature: Nested Tags [@shamoon](https://github.com/shamoon) ([#10833](https://github.com/paperless-ngx/paperless-ngx/pull/10833))
|
||||||
|
|
||||||
|
### Features / Enhancements
|
||||||
|
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.9.2-python3.12-bookworm-slim to 0.9.4-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11091](https://github.com/paperless-ngx/paperless-ngx/pull/11091))
|
||||||
|
- Enhancement: use friendly file names when emailing documents [@JanKleine](https://github.com/JanKleine) ([#11055](https://github.com/paperless-ngx/paperless-ngx/pull/11055))
|
||||||
|
- Feature: Advanced Workflow Filters [@shamoon](https://github.com/shamoon) ([#11029](https://github.com/paperless-ngx/paperless-ngx/pull/11029))
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.8.22-python3.12-bookworm-slim to 0.9.2-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11052](https://github.com/paperless-ngx/paperless-ngx/pull/11052))
|
||||||
|
- Feature: add support for emailing multiple documents [@JanKleine](https://github.com/JanKleine) ([#10666](https://github.com/paperless-ngx/paperless-ngx/pull/10666))
|
||||||
|
- Enhancement: ignore same files in sanity checker as consumer [@shamoon](https://github.com/shamoon) ([#10999](https://github.com/paperless-ngx/paperless-ngx/pull/10999))
|
||||||
|
- Enhancement: open color picker on swatch button click [@shamoon](https://github.com/shamoon) ([#10994](https://github.com/paperless-ngx/paperless-ngx/pull/10994))
|
||||||
|
- Performance: Cache django-guardian permissions when counting documents [@Merinorus](https://github.com/Merinorus) ([#10657](https://github.com/paperless-ngx/paperless-ngx/pull/10657))
|
||||||
|
- Tweakhancement: reorganize some list \& bulk editing buttons [@shamoon](https://github.com/shamoon) ([#10944](https://github.com/paperless-ngx/paperless-ngx/pull/10944))
|
||||||
|
- Enhancement: support workflow path matching of barcode-split documents [@DerRockWolf](https://github.com/DerRockWolf) ([#10723](https://github.com/paperless-ngx/paperless-ngx/pull/10723))
|
||||||
|
- Feature: processed mail UI [@shamoon](https://github.com/shamoon) ([#10866](https://github.com/paperless-ngx/paperless-ngx/pull/10866))
|
||||||
|
- Enhancement: support custom field values on post document [@shamoon](https://github.com/shamoon) ([#10859](https://github.com/paperless-ngx/paperless-ngx/pull/10859))
|
||||||
|
- Feature: Nested Tags [@shamoon](https://github.com/shamoon) ([#10833](https://github.com/paperless-ngx/paperless-ngx/pull/10833))
|
||||||
|
- Enhancement: long text custom field [@jojo2357](https://github.com/jojo2357) ([#10846](https://github.com/paperless-ngx/paperless-ngx/pull/10846))
|
||||||
|
- Enhancement: Add print button [@mpaletti](https://github.com/mpaletti) ([#10626](https://github.com/paperless-ngx/paperless-ngx/pull/10626))
|
||||||
|
- Enhancement: add storage path as workflow trigger filter @david-loe ([#10771](https://github.com/paperless-ngx/paperless-ngx/pull/10771))
|
||||||
|
- Enhancement: jinja template support for workflow title assignment [@sidey79](https://github.com/sidey79) ([#10700](https://github.com/paperless-ngx/paperless-ngx/pull/10700))
|
||||||
|
- Enhancement: Limit excessively long content length when computing suggestions [@Merinorus](https://github.com/Merinorus) ([#10656](https://github.com/paperless-ngx/paperless-ngx/pull/10656))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fix: remove obsolete warning for custom field value index [@shamoon](https://github.com/shamoon) ([#11083](https://github.com/paperless-ngx/paperless-ngx/pull/11083))
|
||||||
|
- Fix: set min-height for drag-drop items container [@shamoon](https://github.com/shamoon) ([#11064](https://github.com/paperless-ngx/paperless-ngx/pull/11064))
|
||||||
|
- Fix custom field query dropdown toggle corners [@shamoon](https://github.com/shamoon) ([#11028](https://github.com/paperless-ngx/paperless-ngx/pull/11028))
|
||||||
|
- Fix: correct save hotkey action when no next document exists [@shamoon](https://github.com/shamoon) ([#11027](https://github.com/paperless-ngx/paperless-ngx/pull/11027))
|
||||||
|
- Fix: require only change permissions for task dismissal, add frontend error handling [@shamoon](https://github.com/shamoon) ([#11023](https://github.com/paperless-ngx/paperless-ngx/pull/11023))
|
||||||
|
- Chore(deps): Bulk upgrade backend dependencies [@stumpylog](https://github.com/stumpylog) ([#10971](https://github.com/paperless-ngx/paperless-ngx/pull/10971))
|
||||||
|
- Chore: remove Codecov token from CI workflow [@shamoon](https://github.com/shamoon) ([#10941](https://github.com/paperless-ngx/paperless-ngx/pull/10941))
|
||||||
|
- Fix: fix select option removal and pagination update [@shamoon](https://github.com/shamoon) ([#10933](https://github.com/paperless-ngx/paperless-ngx/pull/10933))
|
||||||
|
- Fix: skip fuzzy matching for empty document content [@shamoon](https://github.com/shamoon) ([#10914](https://github.com/paperless-ngx/paperless-ngx/pull/10914))
|
||||||
|
- Fix: add extra error handling to \_consume for file checks [@shamoon](https://github.com/shamoon) ([#10897](https://github.com/paperless-ngx/paperless-ngx/pull/10897))
|
||||||
|
- Fix: restore str celery beat schedule filename [@shamoon](https://github.com/shamoon) ([#10893](https://github.com/paperless-ngx/paperless-ngx/pull/10893))
|
||||||
|
- Fix: fix pdf editor hover rotate counterclockwise button [@shamoon](https://github.com/shamoon) ([#10848](https://github.com/paperless-ngx/paperless-ngx/pull/10848))
|
||||||
|
- Fix: warp long words in toast content [@shamoon](https://github.com/shamoon) ([#10839](https://github.com/paperless-ngx/paperless-ngx/pull/10839))
|
||||||
|
- Fix: fix error when bulk adding empty doc link custom fields [@shamoon](https://github.com/shamoon) ([#10832](https://github.com/paperless-ngx/paperless-ngx/pull/10832))
|
||||||
|
- Fix: set match value for correspondents created by mail rule [@shamoon](https://github.com/shamoon) ([#10820](https://github.com/paperless-ngx/paperless-ngx/pull/10820))
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
|
||||||
|
- Chore(deps): Bump the actions group with 5 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10978](https://github.com/paperless-ngx/paperless-ngx/pull/10978))
|
||||||
|
- Chore: remove Codecov token from CI workflow [@shamoon](https://github.com/shamoon) ([#10941](https://github.com/paperless-ngx/paperless-ngx/pull/10941))
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>29 changes</summary>
|
||||||
|
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.9.2-python3.12-bookworm-slim to 0.9.4-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11091](https://github.com/paperless-ngx/paperless-ngx/pull/11091))
|
||||||
|
- docker-compose(deps): Bump gotenberg/gotenberg from 8.23 to 8.24 in /docker/compose @[dependabot[bot]](https://github.com/apps/dependabot) ([#11050](https://github.com/paperless-ngx/paperless-ngx/pull/11050))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 8 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11065](https://github.com/paperless-ngx/paperless-ngx/pull/11065))
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.8.22-python3.12-bookworm-slim to 0.9.2-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#11052](https://github.com/paperless-ngx/paperless-ngx/pull/11052))
|
||||||
|
- Chore(deps): Bump the actions group with 5 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10978](https://github.com/paperless-ngx/paperless-ngx/pull/10978))
|
||||||
|
- Chore(deps): Bump uuid from 11.1.0 to 13.0.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10983](https://github.com/paperless-ngx/paperless-ngx/pull/10983))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.55.0 to 1.55.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10982](https://github.com/paperless-ngx/paperless-ngx/pull/10982))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10981](https://github.com/paperless-ngx/paperless-ngx/pull/10981))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.101.3 to 5.102.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10986](https://github.com/paperless-ngx/paperless-ngx/pull/10986))
|
||||||
|
- Chore(deps-dev): Bump prettier-plugin-organize-imports from 4.2.0 to 4.3.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10985](https://github.com/paperless-ngx/paperless-ngx/pull/10985))
|
||||||
|
- Chore(deps-dev): Bump the frontend-jest-dependencies group in /src-ui with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10980](https://github.com/paperless-ngx/paperless-ngx/pull/10980))
|
||||||
|
- Chore(deps-dev): Bump @types/node from 24.3.0 to 24.6.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10984](https://github.com/paperless-ngx/paperless-ngx/pull/10984))
|
||||||
|
- Chore(deps): Bump the frontend-angular-dependencies group in /src-ui with 21 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10979](https://github.com/paperless-ngx/paperless-ngx/pull/10979))
|
||||||
|
- docker-compose(deps): Bump library/postgres from 17 to 18 in /docker/compose @[dependabot[bot]](https://github.com/apps/dependabot) ([#10965](https://github.com/paperless-ngx/paperless-ngx/pull/10965))
|
||||||
|
- Chore(deps): Bump the major-versions group with 2 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10960](https://github.com/paperless-ngx/paperless-ngx/pull/10960))
|
||||||
|
- Chore(deps): Bump types-colorama from 0.4.15.20240311 to 0.4.15.20250801 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10961](https://github.com/paperless-ngx/paperless-ngx/pull/10961))
|
||||||
|
- Chore(deps): Bump django-guardian from 3.1.3 to 3.2.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10909](https://github.com/paperless-ngx/paperless-ngx/pull/10909))
|
||||||
|
- Chore(deps): Bump django-soft-delete from 1.0.19 to 1.0.21 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10908](https://github.com/paperless-ngx/paperless-ngx/pull/10908))
|
||||||
|
- Chore(deps): Bump whitenoise from 6.10.0 to 6.11.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10910](https://github.com/paperless-ngx/paperless-ngx/pull/10910))
|
||||||
|
- Chore(deps): Bump django-cors-headers from 4.8.0 to 4.9.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10907](https://github.com/paperless-ngx/paperless-ngx/pull/10907))
|
||||||
|
- docker(deps): bump astral-sh/uv from 0.8.17-python3.12-bookworm-slim to 0.8.19-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#10906](https://github.com/paperless-ngx/paperless-ngx/pull/10906))
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.8.15-python3.12-bookworm-slim to 0.8.17-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#10864](https://github.com/paperless-ngx/paperless-ngx/pull/10864))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10880](https://github.com/paperless-ngx/paperless-ngx/pull/10880))
|
||||||
|
- Chore(deps): Bump django-guardian from 3.1.2 to 3.1.3 in the django group @[dependabot[bot]](https://github.com/apps/dependabot) ([#10863](https://github.com/paperless-ngx/paperless-ngx/pull/10863))
|
||||||
|
- Chore(deps): Bump pytest-cov from 6.2.1 to 7.0.0 in the development group across 1 directory @[dependabot[bot]](https://github.com/apps/dependabot) ([#10822](https://github.com/paperless-ngx/paperless-ngx/pull/10822))
|
||||||
|
- Chore(deps): Bump the django group with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10811](https://github.com/paperless-ngx/paperless-ngx/pull/10811))
|
||||||
|
- docker-compose(deps): Bump gotenberg/gotenberg from 8.22 to 8.23 in /docker/compose @[dependabot[bot]](https://github.com/apps/dependabot) ([#10812](https://github.com/paperless-ngx/paperless-ngx/pull/10812))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 8 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10821](https://github.com/paperless-ngx/paperless-ngx/pull/10821))
|
||||||
|
- docker(deps): Bump astral-sh/uv from 0.8.13-python3.12-bookworm-slim to 0.8.15-python3.12-bookworm-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#10810](https://github.com/paperless-ngx/paperless-ngx/pull/10810))
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### All App Changes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>51 changes</summary>
|
||||||
|
|
||||||
|
- Tweak: improve tag parent validation error handling [@shamoon](https://github.com/shamoon) ([#11096](https://github.com/paperless-ngx/paperless-ngx/pull/11096))
|
||||||
|
- Fix: remove obsolete warning for custom field value index [@shamoon](https://github.com/shamoon) ([#11083](https://github.com/paperless-ngx/paperless-ngx/pull/11083))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 8 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#11065](https://github.com/paperless-ngx/paperless-ngx/pull/11065))
|
||||||
|
- Enhancement: use friendly file names when emailing documents [@JanKleine](https://github.com/JanKleine) ([#11055](https://github.com/paperless-ngx/paperless-ngx/pull/11055))
|
||||||
|
- Fix: set min-height for drag-drop items container [@shamoon](https://github.com/shamoon) ([#11064](https://github.com/paperless-ngx/paperless-ngx/pull/11064))
|
||||||
|
- Feature: Advanced Workflow Filters [@shamoon](https://github.com/shamoon) ([#11029](https://github.com/paperless-ngx/paperless-ngx/pull/11029))
|
||||||
|
- Feature: add support for emailing multiple documents [@JanKleine](https://github.com/JanKleine) ([#10666](https://github.com/paperless-ngx/paperless-ngx/pull/10666))
|
||||||
|
- Fix custom field query dropdown toggle corners [@shamoon](https://github.com/shamoon) ([#11028](https://github.com/paperless-ngx/paperless-ngx/pull/11028))
|
||||||
|
- Fix: correct save hotkey action when no next document exists [@shamoon](https://github.com/shamoon) ([#11027](https://github.com/paperless-ngx/paperless-ngx/pull/11027))
|
||||||
|
- Fix: require only change permissions for task dismissal, add frontend error handling [@shamoon](https://github.com/shamoon) ([#11023](https://github.com/paperless-ngx/paperless-ngx/pull/11023))
|
||||||
|
- Enhancement: ignore same files in sanity checker as consumer [@shamoon](https://github.com/shamoon) ([#10999](https://github.com/paperless-ngx/paperless-ngx/pull/10999))
|
||||||
|
- Enhancement: open color picker on swatch button click [@shamoon](https://github.com/shamoon) ([#10994](https://github.com/paperless-ngx/paperless-ngx/pull/10994))
|
||||||
|
- Chore(deps): Bump uuid from 11.1.0 to 13.0.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10983](https://github.com/paperless-ngx/paperless-ngx/pull/10983))
|
||||||
|
- Chore(deps-dev): Bump @playwright/test from 1.55.0 to 1.55.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10982](https://github.com/paperless-ngx/paperless-ngx/pull/10982))
|
||||||
|
- Chore(deps-dev): Bump the frontend-eslint-dependencies group in /src-ui with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10981](https://github.com/paperless-ngx/paperless-ngx/pull/10981))
|
||||||
|
- Chore(deps-dev): Bump webpack from 5.101.3 to 5.102.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10986](https://github.com/paperless-ngx/paperless-ngx/pull/10986))
|
||||||
|
- Chore(deps-dev): Bump prettier-plugin-organize-imports from 4.2.0 to 4.3.0 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10985](https://github.com/paperless-ngx/paperless-ngx/pull/10985))
|
||||||
|
- Chore(deps-dev): Bump the frontend-jest-dependencies group in /src-ui with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10980](https://github.com/paperless-ngx/paperless-ngx/pull/10980))
|
||||||
|
- Chore(deps-dev): Bump @types/node from 24.3.0 to 24.6.1 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#10984](https://github.com/paperless-ngx/paperless-ngx/pull/10984))
|
||||||
|
- Chore(deps): Bump the frontend-angular-dependencies group in /src-ui with 21 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10979](https://github.com/paperless-ngx/paperless-ngx/pull/10979))
|
||||||
|
- Performance: Cache django-guardian permissions when counting documents [@Merinorus](https://github.com/Merinorus) ([#10657](https://github.com/paperless-ngx/paperless-ngx/pull/10657))
|
||||||
|
- Chore(deps): Bulk upgrade backend dependencies [@stumpylog](https://github.com/stumpylog) ([#10971](https://github.com/paperless-ngx/paperless-ngx/pull/10971))
|
||||||
|
- Chore(deps): Bump the major-versions group with 2 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10960](https://github.com/paperless-ngx/paperless-ngx/pull/10960))
|
||||||
|
- Chore(deps): Bump types-colorama from 0.4.15.20240311 to 0.4.15.20250801 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10961](https://github.com/paperless-ngx/paperless-ngx/pull/10961))
|
||||||
|
- Chore(deps): Bump django-guardian from 3.1.3 to 3.2.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10909](https://github.com/paperless-ngx/paperless-ngx/pull/10909))
|
||||||
|
- Chore(deps): Bump django-soft-delete from 1.0.19 to 1.0.21 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10908](https://github.com/paperless-ngx/paperless-ngx/pull/10908))
|
||||||
|
- Chore(deps): Bump whitenoise from 6.10.0 to 6.11.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10910](https://github.com/paperless-ngx/paperless-ngx/pull/10910))
|
||||||
|
- Tweakhancement: reorganize some list \& bulk editing buttons [@shamoon](https://github.com/shamoon) ([#10944](https://github.com/paperless-ngx/paperless-ngx/pull/10944))
|
||||||
|
- Chore(deps): Bump django-cors-headers from 4.8.0 to 4.9.0 @[dependabot[bot]](https://github.com/apps/dependabot) ([#10907](https://github.com/paperless-ngx/paperless-ngx/pull/10907))
|
||||||
|
- Fix: fix select option removal and pagination update [@shamoon](https://github.com/shamoon) ([#10933](https://github.com/paperless-ngx/paperless-ngx/pull/10933))
|
||||||
|
- Enhancement: support workflow path matching of barcode-split documents [@DerRockWolf](https://github.com/DerRockWolf) ([#10723](https://github.com/paperless-ngx/paperless-ngx/pull/10723))
|
||||||
|
- Fix: skip fuzzy matching for empty document content [@shamoon](https://github.com/shamoon) ([#10914](https://github.com/paperless-ngx/paperless-ngx/pull/10914))
|
||||||
|
- Feature: processed mail UI [@shamoon](https://github.com/shamoon) ([#10866](https://github.com/paperless-ngx/paperless-ngx/pull/10866))
|
||||||
|
- Fix: add extra error handling to \_consume for file checks [@shamoon](https://github.com/shamoon) ([#10897](https://github.com/paperless-ngx/paperless-ngx/pull/10897))
|
||||||
|
- Fix: restore str celery beat schedule filename [@shamoon](https://github.com/shamoon) ([#10893](https://github.com/paperless-ngx/paperless-ngx/pull/10893))
|
||||||
|
- Enhancement: support custom field values on post document [@shamoon](https://github.com/shamoon) ([#10859](https://github.com/paperless-ngx/paperless-ngx/pull/10859))
|
||||||
|
- Feature: Nested Tags [@shamoon](https://github.com/shamoon) ([#10833](https://github.com/paperless-ngx/paperless-ngx/pull/10833))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 3 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10880](https://github.com/paperless-ngx/paperless-ngx/pull/10880))
|
||||||
|
- Chore(deps): Bump django-guardian from 3.1.2 to 3.1.3 in the django group @[dependabot[bot]](https://github.com/apps/dependabot) ([#10863](https://github.com/paperless-ngx/paperless-ngx/pull/10863))
|
||||||
|
- Enhancement: long text custom field [@jojo2357](https://github.com/jojo2357) ([#10846](https://github.com/paperless-ngx/paperless-ngx/pull/10846))
|
||||||
|
- Fix: fix pdf editor hover rotate counterclockwise button [@shamoon](https://github.com/shamoon) ([#10848](https://github.com/paperless-ngx/paperless-ngx/pull/10848))
|
||||||
|
- Fix: warp long words in toast content [@shamoon](https://github.com/shamoon) ([#10839](https://github.com/paperless-ngx/paperless-ngx/pull/10839))
|
||||||
|
- Fix: fix error when bulk adding empty doc link custom fields [@shamoon](https://github.com/shamoon) ([#10832](https://github.com/paperless-ngx/paperless-ngx/pull/10832))
|
||||||
|
- Enhancement: Add print button [@mpaletti](https://github.com/mpaletti) ([#10626](https://github.com/paperless-ngx/paperless-ngx/pull/10626))
|
||||||
|
- Enhancement: add storage path as workflow trigger filter @david-loe ([#10771](https://github.com/paperless-ngx/paperless-ngx/pull/10771))
|
||||||
|
- Enhancement: jinja template support for workflow title assignment [@sidey79](https://github.com/sidey79) ([#10700](https://github.com/paperless-ngx/paperless-ngx/pull/10700))
|
||||||
|
- Chore(deps): Bump pytest-cov from 6.2.1 to 7.0.0 in the development group across 1 directory @[dependabot[bot]](https://github.com/apps/dependabot) ([#10822](https://github.com/paperless-ngx/paperless-ngx/pull/10822))
|
||||||
|
- Chore(deps): Bump the django group with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10811](https://github.com/paperless-ngx/paperless-ngx/pull/10811))
|
||||||
|
- Enhancement: Limit excessively long content length when computing suggestions [@Merinorus](https://github.com/Merinorus) ([#10656](https://github.com/paperless-ngx/paperless-ngx/pull/10656))
|
||||||
|
- Chore(deps): Bump the small-changes group across 1 directory with 8 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#10821](https://github.com/paperless-ngx/paperless-ngx/pull/10821))
|
||||||
|
- Fix: set match value for correspondents created by mail rule [@shamoon](https://github.com/shamoon) ([#10820](https://github.com/paperless-ngx/paperless-ngx/pull/10820))
|
||||||
|
</details>
|
||||||
|
|
||||||
## paperless-ngx 2.18.4
|
## paperless-ngx 2.18.4
|
||||||
|
|
||||||
### Features / Enhancements
|
### Features / Enhancements
|
||||||
|
|||||||
@@ -170,11 +170,11 @@ Available options are `postgresql` and `mariadb`.
|
|||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
A small pool is typically sufficient — for example, a size of 4.
|
A small pool is typically sufficient — for example, a size of 4.
|
||||||
Make sure your PostgreSQL server's max_connections setting is large enough to handle:
|
Make sure your PostgreSQL server's max_connections setting is large enough to handle:
|
||||||
```(Paperless workers + Celery workers) × pool size + safety margin```
|
```(Paperless workers + Celery workers) × pool size + safety margin```
|
||||||
For example, with 4 Paperless workers and 2 Celery workers, and a pool size of 4:
|
For example, with 4 Paperless workers and 2 Celery workers, and a pool size of 4:
|
||||||
(4 + 2) × 4 + 10 = 34 connections required.
|
(4 + 2) × 4 + 10 = 34 connections required.
|
||||||
|
|
||||||
#### [`PAPERLESS_DB_READ_CACHE_ENABLED=<bool>`](#PAPERLESS_DB_READ_CACHE_ENABLED) {#PAPERLESS_DB_READ_CACHE_ENABLED}
|
#### [`PAPERLESS_DB_READ_CACHE_ENABLED=<bool>`](#PAPERLESS_DB_READ_CACHE_ENABLED) {#PAPERLESS_DB_READ_CACHE_ENABLED}
|
||||||
|
|
||||||
@@ -184,9 +184,9 @@ Available options are `postgresql` and `mariadb`.
|
|||||||
|
|
||||||
!!! danger
|
!!! danger
|
||||||
|
|
||||||
**Do not modify the database outside the application while it is running.**
|
**Do not modify the database outside the application while it is running.**
|
||||||
This includes actions such as restoring a backup, upgrading the database, or performing manual inserts. All external modifications must be done **only when the application is stopped**.
|
This includes actions such as restoring a backup, upgrading the database, or performing manual inserts. All external modifications must be done **only when the application is stopped**.
|
||||||
After making any such changes, you **must invalidate the DB read cache** using the `invalidate_cachalot` management command.
|
After making any such changes, you **must invalidate the DB read cache** using the `invalidate_cachalot` management command.
|
||||||
|
|
||||||
#### [`PAPERLESS_READ_CACHE_TTL=<int>`](#PAPERLESS_READ_CACHE_TTL) {#PAPERLESS_READ_CACHE_TTL}
|
#### [`PAPERLESS_READ_CACHE_TTL=<int>`](#PAPERLESS_READ_CACHE_TTL) {#PAPERLESS_READ_CACHE_TTL}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ Available options are `postgresql` and `mariadb`.
|
|||||||
|
|
||||||
!!! warning
|
!!! warning
|
||||||
|
|
||||||
A high TTL increases memory usage over time. Memory may be used until end of TTL, even if the cache is invalidated with the `invalidate_cachalot` command.
|
A high TTL increases memory usage over time. Memory may be used until end of TTL, even if the cache is invalidated with the `invalidate_cachalot` command.
|
||||||
|
|
||||||
In case of an out-of-memory (OOM) situation, Redis may stop accepting new data — including cache entries, scheduled tasks, and documents to consume.
|
In case of an out-of-memory (OOM) situation, Redis may stop accepting new data — including cache entries, scheduled tasks, and documents to consume.
|
||||||
If your system has limited RAM, consider configuring a dedicated Redis instance for the read cache, with a memory limit and the eviction policy set to `allkeys-lru`.
|
If your system has limited RAM, consider configuring a dedicated Redis instance for the read cache, with a memory limit and the eviction policy set to `allkeys-lru`.
|
||||||
@@ -980,21 +980,10 @@ paperless will process in parallel on a single document.
|
|||||||
process very large documents faster, use a higher thread per worker
|
process very large documents faster, use a higher thread per worker
|
||||||
count.
|
count.
|
||||||
|
|
||||||
The default is a balance between the two, according to your CPU core
|
If unset, paperless uses `max(floor(cpu_count / PAPERLESS_TASK_WORKERS), 1)`
|
||||||
count, with a slight favor towards threads per worker:
|
threads per worker. The idea behind this is that as long as there are enough cores,
|
||||||
|
the total number of threads should less than or equal to the total number of (logical)
|
||||||
| CPU core count | Workers | Threads |
|
CPU cores.
|
||||||
| -------------- | ------- | ------- |
|
|
||||||
| > 1 | > 1 | > 1 |
|
|
||||||
| > 2 | > 2 | > 1 |
|
|
||||||
| > 4 | > 2 | > 2 |
|
|
||||||
| > 6 | > 2 | > 3 |
|
|
||||||
| > 8 | > 2 | > 4 |
|
|
||||||
| > 12 | > 3 | > 4 |
|
|
||||||
| > 16 | > 4 | > 4 |
|
|
||||||
|
|
||||||
If you only specify PAPERLESS_TASK_WORKERS, paperless will adjust
|
|
||||||
PAPERLESS_THREADS_PER_WORKER automatically.
|
|
||||||
|
|
||||||
#### [`PAPERLESS_WORKER_TIMEOUT=<num>`](#PAPERLESS_WORKER_TIMEOUT) {#PAPERLESS_WORKER_TIMEOUT}
|
#### [`PAPERLESS_WORKER_TIMEOUT=<num>`](#PAPERLESS_WORKER_TIMEOUT) {#PAPERLESS_WORKER_TIMEOUT}
|
||||||
|
|
||||||
@@ -1018,7 +1007,7 @@ still perform some basic text pre-processing before matching.
|
|||||||
|
|
||||||
: See also `PAPERLESS_NLTK_DIR`.
|
: See also `PAPERLESS_NLTK_DIR`.
|
||||||
|
|
||||||
Defaults to 1.
|
Defaults to true, enabling the feature.
|
||||||
|
|
||||||
#### [`PAPERLESS_DATE_PARSER_LANGUAGES=<lang>`](#PAPERLESS_DATE_PARSER_LANGUAGES) {#PAPERLESS_DATE_PARSER_LANGUAGES}
|
#### [`PAPERLESS_DATE_PARSER_LANGUAGES=<lang>`](#PAPERLESS_DATE_PARSER_LANGUAGES) {#PAPERLESS_DATE_PARSER_LANGUAGES}
|
||||||
|
|
||||||
@@ -1065,17 +1054,27 @@ should be a valid crontab(5) expression describing when to run.
|
|||||||
|
|
||||||
#### [`PAPERLESS_SANITY_TASK_CRON=<cron expression>`](#PAPERLESS_SANITY_TASK_CRON) {#PAPERLESS_SANITY_TASK_CRON}
|
#### [`PAPERLESS_SANITY_TASK_CRON=<cron expression>`](#PAPERLESS_SANITY_TASK_CRON) {#PAPERLESS_SANITY_TASK_CRON}
|
||||||
|
|
||||||
: Configures the scheduled sanity checker frequency.
|
: Configures the scheduled sanity checker frequency. The value should be a
|
||||||
|
valid crontab(5) expression describing when to run.
|
||||||
|
|
||||||
: If set to the string "disable", the sanity checker will not run automatically.
|
: If set to the string "disable", the sanity checker will not run automatically.
|
||||||
|
|
||||||
Defaults to `30 0 * * sun` or Sunday at 30 minutes past midnight.
|
Defaults to `30 0 * * sun` or Sunday at 30 minutes past midnight.
|
||||||
|
|
||||||
|
#### [`PAPERLESS_WORKFLOW_SCHEDULED_TASK_CRON=<cron expression>`](#PAPERLESS_WORKFLOW_SCHEDULED_TASK_CRON) {#PAPERLESS_WORKFLOW_SCHEDULED_TASK_CRON}
|
||||||
|
|
||||||
|
: Configures the scheduled workflow check frequency. The value should be a
|
||||||
|
valid crontab(5) expression describing when to run.
|
||||||
|
|
||||||
|
: If set to the string "disable", scheduled workflows will not run.
|
||||||
|
|
||||||
|
Defaults to `5 */1 * * *` or every hour at 5 minutes past the hour.
|
||||||
|
|
||||||
#### [`PAPERLESS_ENABLE_COMPRESSION=<bool>`](#PAPERLESS_ENABLE_COMPRESSION) {#PAPERLESS_ENABLE_COMPRESSION}
|
#### [`PAPERLESS_ENABLE_COMPRESSION=<bool>`](#PAPERLESS_ENABLE_COMPRESSION) {#PAPERLESS_ENABLE_COMPRESSION}
|
||||||
|
|
||||||
: Enables compression of the responses from the webserver.
|
: Enables compression of the responses from the webserver.
|
||||||
|
|
||||||
: Defaults to 1, enabling compression.
|
: Defaults to true, enabling compression.
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
@@ -1282,30 +1281,6 @@ within your documents.
|
|||||||
|
|
||||||
Defaults to false.
|
Defaults to false.
|
||||||
|
|
||||||
## Workflow webhooks
|
|
||||||
|
|
||||||
#### [`PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES=<str>`](#PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES) {#PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES}
|
|
||||||
|
|
||||||
: A comma-separated list of allowed schemes for webhooks. This setting
|
|
||||||
controls which URL schemes are permitted for webhook URLs.
|
|
||||||
|
|
||||||
Defaults to `http,https`.
|
|
||||||
|
|
||||||
#### [`PAPERLESS_WEBHOOKS_ALLOWED_PORTS=<str>`](#PAPERLESS_WEBHOOKS_ALLOWED_PORTS) {#PAPERLESS_WEBHOOKS_ALLOWED_PORTS}
|
|
||||||
|
|
||||||
: A comma-separated list of allowed ports for webhooks. This setting
|
|
||||||
controls which ports are permitted for webhook URLs. For example, if you
|
|
||||||
set this to `80,443`, webhooks will only be sent to URLs that use these
|
|
||||||
ports.
|
|
||||||
|
|
||||||
Defaults to empty list, which allows all ports.
|
|
||||||
|
|
||||||
#### [`PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS=<bool>`](#PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS) {#PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS}
|
|
||||||
|
|
||||||
: If set to false, webhooks cannot be sent to internal URLs (e.g., localhost).
|
|
||||||
|
|
||||||
Defaults to true, which allows internal requests.
|
|
||||||
|
|
||||||
### Polling {#polling}
|
### Polling {#polling}
|
||||||
|
|
||||||
#### [`PAPERLESS_CONSUMER_POLLING=<num>`](#PAPERLESS_CONSUMER_POLLING) {#PAPERLESS_CONSUMER_POLLING}
|
#### [`PAPERLESS_CONSUMER_POLLING=<num>`](#PAPERLESS_CONSUMER_POLLING) {#PAPERLESS_CONSUMER_POLLING}
|
||||||
@@ -1349,6 +1324,30 @@ consumers working on the same file. Configure this to prevent that.
|
|||||||
|
|
||||||
Defaults to 0.5 seconds.
|
Defaults to 0.5 seconds.
|
||||||
|
|
||||||
|
## Workflow webhooks
|
||||||
|
|
||||||
|
#### [`PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES=<str>`](#PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES) {#PAPERLESS_WEBHOOKS_ALLOWED_SCHEMES}
|
||||||
|
|
||||||
|
: A comma-separated list of allowed schemes for webhooks. This setting
|
||||||
|
controls which URL schemes are permitted for webhook URLs.
|
||||||
|
|
||||||
|
Defaults to `http,https`.
|
||||||
|
|
||||||
|
#### [`PAPERLESS_WEBHOOKS_ALLOWED_PORTS=<str>`](#PAPERLESS_WEBHOOKS_ALLOWED_PORTS) {#PAPERLESS_WEBHOOKS_ALLOWED_PORTS}
|
||||||
|
|
||||||
|
: A comma-separated list of allowed ports for webhooks. This setting
|
||||||
|
controls which ports are permitted for webhook URLs. For example, if you
|
||||||
|
set this to `80,443`, webhooks will only be sent to URLs that use these
|
||||||
|
ports.
|
||||||
|
|
||||||
|
Defaults to empty list, which allows all ports.
|
||||||
|
|
||||||
|
#### [`PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS=<bool>`](#PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS) {#PAPERLESS_WEBHOOKS_ALLOW_INTERNAL_REQUESTS}
|
||||||
|
|
||||||
|
: If set to false, webhooks cannot be sent to internal URLs (e.g., localhost).
|
||||||
|
|
||||||
|
Defaults to true, which allows internal requests.
|
||||||
|
|
||||||
## Incoming Mail {#incoming_mail}
|
## Incoming Mail {#incoming_mail}
|
||||||
|
|
||||||
### Email OAuth {#email_oauth}
|
### Email OAuth {#email_oauth}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ are released, dependency support is confirmed, etc.
|
|||||||
|
|
||||||
!!! warning
|
!!! warning
|
||||||
|
|
||||||
Ensure your Redis instance [is secured](https://redis.io/docs/getting-started/#securing-redis).
|
Ensure your Redis instance [is secured](https://redis.io/docs/latest/operate/oss_and_stack/management/security/).
|
||||||
|
|
||||||
7. Create the following directories if they are missing:
|
7. Create the following directories if they are missing:
|
||||||
|
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ fields and permissions, which will be merged.
|
|||||||
|
|
||||||
#### Types {#workflow-trigger-types}
|
#### Types {#workflow-trigger-types}
|
||||||
|
|
||||||
Currently, there are three events that correspond to workflow trigger 'types':
|
Currently, there are four events that correspond to workflow trigger 'types':
|
||||||
|
|
||||||
1. **Consumption Started**: _before_ a document is consumed, so events can include filters by source (mail, consumption
|
1. **Consumption Started**: _before_ a document is consumed, so events can include filters by source (mail, consumption
|
||||||
folder or API), file path, file name, mail rule
|
folder or API), file path, file name, mail rule
|
||||||
@@ -427,7 +427,7 @@ Currently, there are three events that correspond to workflow trigger 'types':
|
|||||||
added, created, updated date or you can specify a (date) custom field. You can also specify a day offset from the date (positive
|
added, created, updated date or you can specify a (date) custom field. You can also specify a day offset from the date (positive
|
||||||
offsets will trigger after the date, negative offsets will trigger before).
|
offsets will trigger after the date, negative offsets will trigger before).
|
||||||
|
|
||||||
The following flow diagram illustrates the three document trigger types:
|
The following flow diagram illustrates the four document trigger types:
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart TD
|
flowchart TD
|
||||||
@@ -443,6 +443,10 @@ flowchart TD
|
|||||||
'Updated'
|
'Updated'
|
||||||
trigger(s)"}
|
trigger(s)"}
|
||||||
|
|
||||||
|
scheduled{"Documents
|
||||||
|
matching
|
||||||
|
trigger(s)"}
|
||||||
|
|
||||||
A[New Document] --> consumption
|
A[New Document] --> consumption
|
||||||
consumption --> |Yes| C[Workflow Actions Run]
|
consumption --> |Yes| C[Workflow Actions Run]
|
||||||
consumption --> |No| D
|
consumption --> |No| D
|
||||||
@@ -455,6 +459,11 @@ flowchart TD
|
|||||||
updated --> |Yes| J[Workflow Actions Run]
|
updated --> |Yes| J[Workflow Actions Run]
|
||||||
updated --> |No| K
|
updated --> |No| K
|
||||||
J --> K[Document Saved]
|
J --> K[Document Saved]
|
||||||
|
L[Scheduled Task Check<br/>hourly at :05] --> M[Get All Scheduled Triggers]
|
||||||
|
M --> scheduled
|
||||||
|
scheduled --> |Yes| N[Workflow Actions Run]
|
||||||
|
scheduled --> |No| O[Document Saved]
|
||||||
|
N --> O
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Filters {#workflow-trigger-filters}
|
#### Filters {#workflow-trigger-filters}
|
||||||
@@ -462,15 +471,24 @@ flowchart TD
|
|||||||
Workflows allow you to filter by:
|
Workflows allow you to filter by:
|
||||||
|
|
||||||
- Source, e.g. documents uploaded via consume folder, API (& the web UI) and mail fetch
|
- Source, e.g. documents uploaded via consume folder, API (& the web UI) and mail fetch
|
||||||
- File name, including wildcards e.g. \*.pdf will apply to all pdfs
|
- File name, including wildcards e.g. \*.pdf will apply to all pdfs.
|
||||||
- File path, including wildcards. Note that enabling `PAPERLESS_CONSUMER_RECURSIVE` would allow, for
|
- File path, including wildcards. Note that enabling `PAPERLESS_CONSUMER_RECURSIVE` would allow, for
|
||||||
example, automatically assigning documents to different owners based on the upload directory.
|
example, automatically assigning documents to different owners based on the upload directory.
|
||||||
- Mail rule. Choosing this option will force 'mail fetch' to be the workflow source.
|
- Mail rule. Choosing this option will force 'mail fetch' to be the workflow source.
|
||||||
- Content matching (`Added`, `Updated` and `Scheduled` triggers only). Filter document content using the matching settings.
|
- Content matching (`Added`, `Updated` and `Scheduled` triggers only). Filter document content using the matching settings.
|
||||||
- Tags (`Added`, `Updated` and `Scheduled` triggers only). Filter for documents with any of the specified tags
|
|
||||||
- Document type (`Added`, `Updated` and `Scheduled` triggers only). Filter documents with this doc type
|
There are also 'advanced' filters available for `Added`, `Updated` and `Scheduled` triggers:
|
||||||
- Correspondent (`Added`, `Updated` and `Scheduled` triggers only). Filter documents with this correspondent
|
|
||||||
- Storage path (`Added`, `Updated` and `Scheduled` triggers only). Filter documents with this storage path
|
- Any Tags: Filter for documents with any of the specified tags.
|
||||||
|
- All Tags: Filter for documents with all of the specified tags.
|
||||||
|
- No Tags: Filter for documents with none of the specified tags.
|
||||||
|
- Document type: Filter documents with this document type.
|
||||||
|
- Not Document types: Filter documents without any of these document types.
|
||||||
|
- Correspondent: Filter documents with this correspondent.
|
||||||
|
- Not Correspondents: Filter documents without any of these correspondents.
|
||||||
|
- Storage path: Filter documents with this storage path.
|
||||||
|
- Not Storage paths: Filter documents without any of these storage paths.
|
||||||
|
- Custom field query: Filter documents with a custom field query (the same as used for the document list filters).
|
||||||
|
|
||||||
### Workflow Actions
|
### Workflow Actions
|
||||||
|
|
||||||
@@ -544,6 +562,7 @@ applied. You can use the following placeholders in the template with any trigger
|
|||||||
- `{{added_time}}`: added time in HH:MM format
|
- `{{added_time}}`: added time in HH:MM format
|
||||||
- `{{original_filename}}`: original file name without extension
|
- `{{original_filename}}`: original file name without extension
|
||||||
- `{{filename}}`: current file name without extension
|
- `{{filename}}`: current file name without extension
|
||||||
|
- `{{doc_title}}`: current document title
|
||||||
|
|
||||||
The following placeholders are only available for "added" or "updated" triggers
|
The following placeholders are only available for "added" or "updated" triggers
|
||||||
|
|
||||||
@@ -637,7 +656,7 @@ When you first delete a document it is moved to the 'trash' until either it is e
|
|||||||
You can set how long documents remain in the trash before being automatically deleted with [`PAPERLESS_EMPTY_TRASH_DELAY`](configuration.md#PAPERLESS_EMPTY_TRASH_DELAY), which defaults
|
You can set how long documents remain in the trash before being automatically deleted with [`PAPERLESS_EMPTY_TRASH_DELAY`](configuration.md#PAPERLESS_EMPTY_TRASH_DELAY), which defaults
|
||||||
to 30 days. Until the file is actually deleted (e.g. the trash is emptied), all files and database content remains intact and can be restored at any point up until that time.
|
to 30 days. Until the file is actually deleted (e.g. the trash is emptied), all files and database content remains intact and can be restored at any point up until that time.
|
||||||
|
|
||||||
Additionally you may configure a directory where deleted files are moved to when they the trash is emptied with [`PAPERLESS_EMPTY_TRASH_DIR`](configuration.md#PAPERLESS_EMPTY_TRASH_DIR).
|
Additionally you may configure a directory where deleted files are moved to when the trash is emptied with [`PAPERLESS_EMPTY_TRASH_DIR`](configuration.md#PAPERLESS_EMPTY_TRASH_DIR).
|
||||||
Note that the empty trash directory only stores the original file, the archive file and all database information is permanently removed once a document is fully deleted.
|
Note that the empty trash directory only stores the original file, the archive file and all database information is permanently removed once a document is fully deleted.
|
||||||
|
|
||||||
## Best practices {#basic-searching}
|
## Best practices {#basic-searching}
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ fi
|
|||||||
# of the provided folder
|
# of the provided folder
|
||||||
if [[ -n $DATABASE_FOLDER ]] ; then
|
if [[ -n $DATABASE_FOLDER ]] ; then
|
||||||
if [[ "$DATABASE_BACKEND" == "postgres" ]] ; then
|
if [[ "$DATABASE_BACKEND" == "postgres" ]] ; then
|
||||||
sed -i "s#- pgdata:/var/lib/postgresql/data#- $DATABASE_FOLDER:/var/lib/postgresql/data#g" docker-compose.yml
|
sed -i "s#- pgdata:/var/lib/postgresql#- $DATABASE_FOLDER:/var/lib/postgresql#g" docker-compose.yml
|
||||||
sed -i "/^\s*pgdata:/d" docker-compose.yml
|
sed -i "/^\s*pgdata:/d" docker-compose.yml
|
||||||
elif [[ "$DATABASE_BACKEND" == "mariadb" ]]; then
|
elif [[ "$DATABASE_BACKEND" == "mariadb" ]]; then
|
||||||
sed -i "s#- dbdata:/var/lib/mysql#- $DATABASE_FOLDER:/var/lib/mysql#g" docker-compose.yml
|
sed -i "s#- dbdata:/var/lib/mysql#- $DATABASE_FOLDER:/var/lib/mysql#g" docker-compose.yml
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "paperless-ngx"
|
name = "paperless-ngx"
|
||||||
version = "2.18.4"
|
version = "2.20.3"
|
||||||
description = "A community-supported supercharged document management system: scan, index and archive all your physical documents"
|
description = "A community-supported supercharged document management system: scan, index and archive all your physical documents"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
@@ -10,13 +10,14 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Programming Language :: Python :: 3.13",
|
"Programming Language :: Python :: 3.13",
|
||||||
|
"Programming Language :: Python :: 3.14",
|
||||||
]
|
]
|
||||||
# TODO: Move certain things to groups and then utilize that further
|
# TODO: Move certain things to groups and then utilize that further
|
||||||
# This will allow testing to not install a webserver, mysql, etc
|
# This will allow testing to not install a webserver, mysql, etc
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"babel>=2.17",
|
"babel>=2.17",
|
||||||
"bleach~=6.2.0",
|
"bleach~=6.3.0",
|
||||||
"celery[redis]~=5.5.1",
|
"celery[redis]~=5.5.1",
|
||||||
"channels~=4.2",
|
"channels~=4.2",
|
||||||
"channels-redis~=4.2",
|
"channels-redis~=4.2",
|
||||||
@@ -25,8 +26,8 @@ dependencies = [
|
|||||||
# WARNING: django does not use semver.
|
# WARNING: django does not use semver.
|
||||||
# Only patch versions are guaranteed to not introduce breaking changes.
|
# Only patch versions are guaranteed to not introduce breaking changes.
|
||||||
"django~=5.2.5",
|
"django~=5.2.5",
|
||||||
"django-allauth[socialaccount,mfa]~=65.4.0",
|
"django-allauth[mfa,socialaccount]~=65.12.1",
|
||||||
"django-auditlog~=3.2.1",
|
"django-auditlog~=3.3.0",
|
||||||
"django-cachalot~=2.8.0",
|
"django-cachalot~=2.8.0",
|
||||||
"django-celery-results~=2.6.0",
|
"django-celery-results~=2.6.0",
|
||||||
"django-compression-middleware~=0.5.0",
|
"django-compression-middleware~=0.5.0",
|
||||||
@@ -40,29 +41,29 @@ dependencies = [
|
|||||||
"djangorestframework~=3.16",
|
"djangorestframework~=3.16",
|
||||||
"djangorestframework-guardian~=0.4.0",
|
"djangorestframework-guardian~=0.4.0",
|
||||||
"drf-spectacular~=0.28",
|
"drf-spectacular~=0.28",
|
||||||
"drf-spectacular-sidecar~=2025.9.1",
|
"drf-spectacular-sidecar~=2025.10.1",
|
||||||
"drf-writable-nested~=0.7.1",
|
"drf-writable-nested~=0.7.1",
|
||||||
"filelock~=3.19.1",
|
"filelock~=3.20.0",
|
||||||
"flower~=2.0.1",
|
"flower~=2.0.1",
|
||||||
"gotenberg-client~=0.11.0",
|
"gotenberg-client~=0.12.0",
|
||||||
"httpx-oauth~=0.16",
|
"httpx-oauth~=0.16",
|
||||||
"imap-tools~=1.11.0",
|
"imap-tools~=1.11.0",
|
||||||
"inotifyrecursive~=0.3",
|
"inotifyrecursive~=0.3",
|
||||||
"jinja2~=3.1.5",
|
"jinja2~=3.1.5",
|
||||||
"langdetect~=1.0.9",
|
"langdetect~=1.0.9",
|
||||||
"nltk~=3.9.1",
|
"nltk~=3.9.1",
|
||||||
"ocrmypdf~=16.11.0",
|
"ocrmypdf~=16.12.0",
|
||||||
"pathvalidate~=3.3.1",
|
"pathvalidate~=3.3.1",
|
||||||
"pdf2image~=1.17.0",
|
"pdf2image~=1.17.0",
|
||||||
"psycopg-pool",
|
|
||||||
"python-dateutil~=2.9.0",
|
"python-dateutil~=2.9.0",
|
||||||
"python-dotenv~=1.1.0",
|
"python-dotenv~=1.2.1",
|
||||||
"python-gnupg~=0.5.4",
|
"python-gnupg~=0.5.4",
|
||||||
"python-ipware~=3.0.0",
|
"python-ipware~=3.0.0",
|
||||||
"python-magic~=0.4.27",
|
"python-magic~=0.4.27",
|
||||||
"pyzbar~=0.1.9",
|
"pyzbar~=0.1.9",
|
||||||
"rapidfuzz~=3.14.0",
|
"rapidfuzz~=3.14.0",
|
||||||
"redis[hiredis]~=5.2.1",
|
"redis[hiredis]~=5.2.1",
|
||||||
|
"regex>=2025.9.18",
|
||||||
"scikit-learn~=1.7.0",
|
"scikit-learn~=1.7.0",
|
||||||
"setproctitle~=1.3.4",
|
"setproctitle~=1.3.4",
|
||||||
"tika-client~=0.10.0",
|
"tika-client~=0.10.0",
|
||||||
@@ -77,10 +78,10 @@ optional-dependencies.mariadb = [
|
|||||||
"mysqlclient~=2.2.7",
|
"mysqlclient~=2.2.7",
|
||||||
]
|
]
|
||||||
optional-dependencies.postgres = [
|
optional-dependencies.postgres = [
|
||||||
"psycopg[c,pool]==3.2.9",
|
"psycopg[c,pool]==3.2.12",
|
||||||
# Direct dependency for proper resolution of the pre-built wheels
|
# Direct dependency for proper resolution of the pre-built wheels
|
||||||
"psycopg-c==3.2.9",
|
"psycopg-c==3.2.12",
|
||||||
"psycopg-pool==3.2.6",
|
"psycopg-pool==3.2.7",
|
||||||
]
|
]
|
||||||
optional-dependencies.webserver = [
|
optional-dependencies.webserver = [
|
||||||
"granian[uvloop]~=2.5.1",
|
"granian[uvloop]~=2.5.1",
|
||||||
@@ -96,7 +97,7 @@ dev = [
|
|||||||
|
|
||||||
docs = [
|
docs = [
|
||||||
"mkdocs-glightbox~=0.5.1",
|
"mkdocs-glightbox~=0.5.1",
|
||||||
"mkdocs-material~=9.6.4",
|
"mkdocs-material~=9.7.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
testing = [
|
testing = [
|
||||||
@@ -115,9 +116,9 @@ testing = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
lint = [
|
lint = [
|
||||||
"pre-commit~=4.3.0",
|
"pre-commit~=4.4.0",
|
||||||
"pre-commit-uv~=4.1.3",
|
"pre-commit-uv~=4.2.0",
|
||||||
"ruff~=0.13.0",
|
"ruff~=0.14.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
typing = [
|
typing = [
|
||||||
@@ -139,6 +140,25 @@ typing = [
|
|||||||
"types-tqdm",
|
"types-tqdm",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.uv]
|
||||||
|
required-version = ">=0.5.14"
|
||||||
|
package = false
|
||||||
|
environments = [
|
||||||
|
"sys_platform == 'darwin'",
|
||||||
|
"sys_platform == 'linux'",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
# Markers are chosen to select these almost exclusively when building the Docker image
|
||||||
|
psycopg-c = [
|
||||||
|
{ url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-bookworm-3.2.12/psycopg_c-3.2.12-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'" },
|
||||||
|
{ url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-bookworm-3.2.12/psycopg_c-3.2.12-cp312-cp312-linux_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64' and python_version == '3.12'" },
|
||||||
|
]
|
||||||
|
zxing-cpp = [
|
||||||
|
{ url = "https://github.com/paperless-ngx/builder/releases/download/zxing-2.3.0/zxing_cpp-2.3.0-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'" },
|
||||||
|
{ url = "https://github.com/paperless-ngx/builder/releases/download/zxing-2.3.0/zxing_cpp-2.3.0-cp312-cp312-linux_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64' and python_version == '3.12'" },
|
||||||
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py310"
|
target-version = "py310"
|
||||||
line-length = 88
|
line-length = 88
|
||||||
@@ -285,24 +305,5 @@ disallow_untyped_defs = true
|
|||||||
warn_redundant_casts = true
|
warn_redundant_casts = true
|
||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
|
|
||||||
[tool.uv]
|
|
||||||
required-version = ">=0.5.14"
|
|
||||||
package = false
|
|
||||||
environments = [
|
|
||||||
"sys_platform == 'darwin'",
|
|
||||||
"sys_platform == 'linux'",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.uv.sources]
|
|
||||||
# Markers are chosen to select these almost exclusively when building the Docker image
|
|
||||||
psycopg-c = [
|
|
||||||
{ url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.9/psycopg_c-3.2.9-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'" },
|
|
||||||
{ url = "https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.9/psycopg_c-3.2.9-cp312-cp312-linux_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64' and python_version == '3.12'" },
|
|
||||||
]
|
|
||||||
zxing-cpp = [
|
|
||||||
{ url = "https://github.com/paperless-ngx/builder/releases/download/zxing-2.3.0/zxing_cpp-2.3.0-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine == 'x86_64' and python_version == '3.12'" },
|
|
||||||
{ url = "https://github.com/paperless-ngx/builder/releases/download/zxing-2.3.0/zxing_cpp-2.3.0-cp312-cp312-linux_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64' and python_version == '3.12'" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.django-stubs]
|
[tool.django-stubs]
|
||||||
django_settings_module = "paperless.settings"
|
django_settings_module = "paperless.settings"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
"fi-FI": "src/locale/messages.fi_FI.xlf",
|
"fi-FI": "src/locale/messages.fi_FI.xlf",
|
||||||
"fr-FR": "src/locale/messages.fr_FR.xlf",
|
"fr-FR": "src/locale/messages.fr_FR.xlf",
|
||||||
"hu-HU": "src/locale/messages.hu_HU.xlf",
|
"hu-HU": "src/locale/messages.hu_HU.xlf",
|
||||||
|
"id-ID": "src/locale/messages.id_ID.xlf",
|
||||||
"it-IT": "src/locale/messages.it_IT.xlf",
|
"it-IT": "src/locale/messages.it_IT.xlf",
|
||||||
"ja-JP": "src/locale/messages.ja_JP.xlf",
|
"ja-JP": "src/locale/messages.ja_JP.xlf",
|
||||||
"lb-LU": "src/locale/messages.lb_LU.xlf",
|
"lb-LU": "src/locale/messages.lb_LU.xlf",
|
||||||
|
|||||||
1201
src-ui/messages.xlf
1201
src-ui/messages.xlf
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paperless-ngx-ui",
|
"name": "paperless-ngx-ui",
|
||||||
"version": "2.18.4",
|
"version": "2.20.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
@@ -11,17 +11,17 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/cdk": "^20.2.2",
|
"@angular/cdk": "^20.2.13",
|
||||||
"@angular/common": "~20.2.4",
|
"@angular/common": "~20.3.15",
|
||||||
"@angular/compiler": "~20.2.4",
|
"@angular/compiler": "~20.3.15",
|
||||||
"@angular/core": "~20.2.4",
|
"@angular/core": "~20.3.15",
|
||||||
"@angular/forms": "~20.2.4",
|
"@angular/forms": "~20.3.15",
|
||||||
"@angular/localize": "~20.2.4",
|
"@angular/localize": "~20.3.15",
|
||||||
"@angular/platform-browser": "~20.2.4",
|
"@angular/platform-browser": "~20.3.15",
|
||||||
"@angular/platform-browser-dynamic": "~20.2.4",
|
"@angular/platform-browser-dynamic": "~20.3.15",
|
||||||
"@angular/router": "~20.2.4",
|
"@angular/router": "~20.3.15",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^19.0.1",
|
"@ng-bootstrap/ng-bootstrap": "^19.0.1",
|
||||||
"@ng-select/ng-select": "^20.1.3",
|
"@ng-select/ng-select": "^20.7.0",
|
||||||
"@ngneat/dirty-check-forms": "^3.0.3",
|
"@ngneat/dirty-check-forms": "^3.0.3",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.8",
|
||||||
@@ -29,47 +29,48 @@
|
|||||||
"mime-names": "^1.0.0",
|
"mime-names": "^1.0.0",
|
||||||
"ng2-pdf-viewer": "^10.4.0",
|
"ng2-pdf-viewer": "^10.4.0",
|
||||||
"ngx-bootstrap-icons": "^1.9.3",
|
"ngx-bootstrap-icons": "^1.9.3",
|
||||||
"ngx-color": "^10.0.0",
|
"ngx-color": "^10.1.0",
|
||||||
"ngx-cookie-service": "^20.1.0",
|
"ngx-cookie-service": "^20.1.1",
|
||||||
"ngx-device-detector": "^10.1.0",
|
"ngx-device-detector": "^10.1.0",
|
||||||
"ngx-ui-tour-ng-bootstrap": "^17.0.1",
|
"ngx-ui-tour-ng-bootstrap": "^17.0.1",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"utif": "^3.1.0",
|
"utif": "^3.1.0",
|
||||||
"uuid": "^11.1.0",
|
"uuid": "^13.0.0",
|
||||||
"zone.js": "^0.15.1"
|
"zone.js": "^0.15.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-builders/custom-webpack": "^20.0.0",
|
"@angular-builders/custom-webpack": "^20.0.0",
|
||||||
"@angular-builders/jest": "^20.0.0",
|
"@angular-builders/jest": "^20.0.0",
|
||||||
"@angular-devkit/core": "^20.2.2",
|
"@angular-devkit/core": "^20.3.13",
|
||||||
"@angular-devkit/schematics": "^20.2.2",
|
"@angular-devkit/schematics": "^20.3.13",
|
||||||
"@angular-eslint/builder": "20.2.0",
|
"@angular-eslint/builder": "20.6.0",
|
||||||
"@angular-eslint/eslint-plugin": "20.2.0",
|
"@angular-eslint/eslint-plugin": "20.6.0",
|
||||||
"@angular-eslint/eslint-plugin-template": "20.2.0",
|
"@angular-eslint/eslint-plugin-template": "20.6.0",
|
||||||
"@angular-eslint/schematics": "20.2.0",
|
"@angular-eslint/schematics": "20.6.0",
|
||||||
"@angular-eslint/template-parser": "20.2.0",
|
"@angular-eslint/template-parser": "20.6.0",
|
||||||
"@angular/build": "^20.2.2",
|
"@angular/build": "^20.3.13",
|
||||||
"@angular/cli": "~20.2.2",
|
"@angular/cli": "~20.3.13",
|
||||||
"@angular/compiler-cli": "~20.2.4",
|
"@angular/compiler-cli": "~20.3.15",
|
||||||
"@codecov/webpack-plugin": "^1.9.1",
|
"@codecov/webpack-plugin": "^1.9.1",
|
||||||
"@playwright/test": "^1.55.0",
|
"@playwright/test": "^1.57.0",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^24.3.0",
|
"@types/node": "^24.10.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
||||||
"@typescript-eslint/parser": "^8.41.0",
|
"@typescript-eslint/parser": "^8.48.1",
|
||||||
"@typescript-eslint/utils": "^8.41.0",
|
"@typescript-eslint/utils": "^8.48.1",
|
||||||
"eslint": "^9.34.0",
|
"eslint": "^9.39.1",
|
||||||
"jest": "30.1.3",
|
"jest": "30.2.0",
|
||||||
"jest-environment-jsdom": "^30.1.2",
|
"jest-environment-jsdom": "^30.2.0",
|
||||||
"jest-junit": "^16.0.0",
|
"jest-junit": "^16.0.0",
|
||||||
"jest-preset-angular": "^15.0.0",
|
"jest-preset-angular": "^15.0.3",
|
||||||
"jest-websocket-mock": "^2.5.0",
|
"jest-websocket-mock": "^2.5.0",
|
||||||
"prettier-plugin-organize-imports": "^4.2.0",
|
"prettier-plugin-organize-imports": "^4.3.0",
|
||||||
"ts-node": "~10.9.1",
|
"ts-node": "~10.9.1",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"webpack": "^5.101.3"
|
"webpack": "^5.103.0"
|
||||||
},
|
},
|
||||||
|
"packageManager": "pnpm@10.17.1",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"onlyBuiltDependencies": [
|
"onlyBuiltDependencies": [
|
||||||
"@parcel/watcher",
|
"@parcel/watcher",
|
||||||
|
|||||||
4034
src-ui/pnpm-lock.yaml
generated
4034
src-ui/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@ import localeFa from '@angular/common/locales/fa'
|
|||||||
import localeFi from '@angular/common/locales/fi'
|
import localeFi from '@angular/common/locales/fi'
|
||||||
import localeFr from '@angular/common/locales/fr'
|
import localeFr from '@angular/common/locales/fr'
|
||||||
import localeHu from '@angular/common/locales/hu'
|
import localeHu from '@angular/common/locales/hu'
|
||||||
|
import localeId from '@angular/common/locales/id'
|
||||||
import localeIt from '@angular/common/locales/it'
|
import localeIt from '@angular/common/locales/it'
|
||||||
import localeJa from '@angular/common/locales/ja'
|
import localeJa from '@angular/common/locales/ja'
|
||||||
import localeKo from '@angular/common/locales/ko'
|
import localeKo from '@angular/common/locales/ko'
|
||||||
@@ -63,6 +64,7 @@ registerLocaleData(localeFa)
|
|||||||
registerLocaleData(localeFi)
|
registerLocaleData(localeFi)
|
||||||
registerLocaleData(localeFr)
|
registerLocaleData(localeFr)
|
||||||
registerLocaleData(localeHu)
|
registerLocaleData(localeHu)
|
||||||
|
registerLocaleData(localeId)
|
||||||
registerLocaleData(localeIt)
|
registerLocaleData(localeIt)
|
||||||
registerLocaleData(localeJa)
|
registerLocaleData(localeJa)
|
||||||
registerLocaleData(localeKo)
|
registerLocaleData(localeKo)
|
||||||
@@ -145,4 +147,18 @@ HTMLCanvasElement.prototype.getContext = <
|
|||||||
typeof HTMLCanvasElement.prototype.getContext
|
typeof HTMLCanvasElement.prototype.getContext
|
||||||
>jest.fn()
|
>jest.fn()
|
||||||
|
|
||||||
|
if (!HTMLElement.prototype.scrollTo) {
|
||||||
|
HTMLElement.prototype.scrollTo = jest.fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
jest.mock('uuid', () => ({
|
||||||
|
v4: jest.fn(() =>
|
||||||
|
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char: string) => {
|
||||||
|
const random = Math.floor(Math.random() * 16)
|
||||||
|
const value = char === 'x' ? random : (random & 0x3) | 0x8
|
||||||
|
return value.toString(16)
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}))
|
||||||
|
|
||||||
jest.mock('pdfjs-dist')
|
jest.mock('pdfjs-dist')
|
||||||
|
|||||||
@@ -3,9 +3,23 @@
|
|||||||
i18n-title
|
i18n-title
|
||||||
info="Review the log files for the application and for email checking."
|
info="Review the log files for the application and for email checking."
|
||||||
i18n-info>
|
i18n-info>
|
||||||
<div class="form-check form-switch">
|
<div class="input-group input-group-sm align-items-center">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" [(ngModel)]="autoRefreshEnabled">
|
<div class="input-group input-group-sm me-3">
|
||||||
<label class="form-check-label" for="autoRefreshSwitch" i18n>Auto refresh</label>
|
<span class="input-group-text text-muted" i18n>Show</span>
|
||||||
|
<input
|
||||||
|
class="form-control"
|
||||||
|
type="number"
|
||||||
|
min="100"
|
||||||
|
step="100"
|
||||||
|
[(ngModel)]="limit"
|
||||||
|
(ngModelChange)="onLimitChange($event)"
|
||||||
|
style="width: 100px;">
|
||||||
|
<span class="input-group-text text-muted" i18n>lines</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-switch mt-1">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" [(ngModel)]="autoRefreshEnabled">
|
||||||
|
<label class="form-check-label" for="autoRefreshSwitch" i18n>Auto refresh</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</pngx-page-header>
|
</pngx-page-header>
|
||||||
|
|
||||||
@@ -27,16 +41,23 @@
|
|||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
<div #logContainer class="bg-dark text-light font-monospace log-container p-3" (scroll)="onScroll()">
|
||||||
|
@if (loading && !logFiles.length) {
|
||||||
<div class="bg-dark p-3 text-light font-monospace log-container" #logContainer>
|
|
||||||
@if (loading && logFiles.length) {
|
|
||||||
<div>
|
<div>
|
||||||
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
||||||
<ng-container i18n>Loading...</ng-container>
|
<ng-container i18n>Loading...</ng-container>
|
||||||
</div>
|
</div>
|
||||||
}
|
} @else {
|
||||||
@for (log of logs; track $index) {
|
@for (log of logs; track log) {
|
||||||
<p class="m-0 p-0 log-entry-{{getLogLevel(log)}}">{{log}}</p>
|
<p class="m-0 p-0" [ngClass]="'log-entry-' + log.level">{{log.message}}</p>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-sm btn-secondary jump-to-bottom position-fixed bottom-0 end-0 m-5"
|
||||||
|
[class.visible]="showJumpToBottom"
|
||||||
|
(click)="scrollToBottom()"
|
||||||
|
>
|
||||||
|
↓ <span i18n>Jump to bottom</span>
|
||||||
|
</button>
|
||||||
|
|||||||
@@ -16,11 +16,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.log-container {
|
.log-container {
|
||||||
overflow-y: scroll;
|
height: calc(100vh - 190px);
|
||||||
height: calc(100vh - 200px);
|
overflow-y: auto;
|
||||||
top: 70px;
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jump-to-bottom {
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: opacity 120ms ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jump-to-bottom.visible {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
import {
|
||||||
|
CdkVirtualScrollViewport,
|
||||||
|
ScrollingModule,
|
||||||
|
} from '@angular/cdk/scrolling'
|
||||||
|
import { CommonModule } from '@angular/common'
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||||
@@ -38,6 +43,9 @@ describe('LogsComponent', () => {
|
|||||||
NgxBootstrapIconsModule.pick(allIcons),
|
NgxBootstrapIconsModule.pick(allIcons),
|
||||||
LogsComponent,
|
LogsComponent,
|
||||||
PageHeaderComponent,
|
PageHeaderComponent,
|
||||||
|
CommonModule,
|
||||||
|
CdkVirtualScrollViewport,
|
||||||
|
ScrollingModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
@@ -54,13 +62,12 @@ describe('LogsComponent', () => {
|
|||||||
fixture = TestBed.createComponent(LogsComponent)
|
fixture = TestBed.createComponent(LogsComponent)
|
||||||
component = fixture.componentInstance
|
component = fixture.componentInstance
|
||||||
reloadSpy = jest.spyOn(component, 'reloadLogs')
|
reloadSpy = jest.spyOn(component, 'reloadLogs')
|
||||||
window.HTMLElement.prototype.scroll = function () {} // mock scroll
|
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should display logs with first log initially', () => {
|
it('should display logs with first log initially', () => {
|
||||||
expect(logSpy).toHaveBeenCalledWith('paperless')
|
expect(logSpy).toHaveBeenCalledWith('paperless', 5000)
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
expect(fixture.debugElement.nativeElement.textContent).toContain(
|
expect(fixture.debugElement.nativeElement.textContent).toContain(
|
||||||
paperless_logs[0]
|
paperless_logs[0]
|
||||||
@@ -71,7 +78,7 @@ describe('LogsComponent', () => {
|
|||||||
fixture.debugElement
|
fixture.debugElement
|
||||||
.queryAll(By.directive(NgbNavLink))[1]
|
.queryAll(By.directive(NgbNavLink))[1]
|
||||||
.nativeElement.dispatchEvent(new MouseEvent('click'))
|
.nativeElement.dispatchEvent(new MouseEvent('click'))
|
||||||
expect(logSpy).toHaveBeenCalledWith('mail')
|
expect(logSpy).toHaveBeenCalledWith('mail', 5000)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should handle error with no logs', () => {
|
it('should handle error with no logs', () => {
|
||||||
@@ -83,6 +90,10 @@ describe('LogsComponent', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should auto refresh, allow toggle', () => {
|
it('should auto refresh, allow toggle', () => {
|
||||||
|
jest
|
||||||
|
.spyOn(CdkVirtualScrollViewport.prototype, 'scrollToIndex')
|
||||||
|
.mockImplementation(() => undefined)
|
||||||
|
|
||||||
jest.advanceTimersByTime(6000)
|
jest.advanceTimersByTime(6000)
|
||||||
expect(reloadSpy).toHaveBeenCalledTimes(2)
|
expect(reloadSpy).toHaveBeenCalledTimes(2)
|
||||||
|
|
||||||
@@ -90,4 +101,20 @@ describe('LogsComponent', () => {
|
|||||||
jest.advanceTimersByTime(6000)
|
jest.advanceTimersByTime(6000)
|
||||||
expect(reloadSpy).toHaveBeenCalledTimes(2)
|
expect(reloadSpy).toHaveBeenCalledTimes(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should debounce limit changes before reloading logs', () => {
|
||||||
|
const initialCalls = reloadSpy.mock.calls.length
|
||||||
|
component.onLimitChange(6000)
|
||||||
|
jest.advanceTimersByTime(299)
|
||||||
|
expect(reloadSpy).toHaveBeenCalledTimes(initialCalls)
|
||||||
|
jest.advanceTimersByTime(1)
|
||||||
|
expect(reloadSpy).toHaveBeenCalledTimes(initialCalls + 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should update jump to bottom visibility on scroll', () => {
|
||||||
|
component.showJumpToBottom = false
|
||||||
|
jest.spyOn(component as any, 'isNearBottom').mockReturnValue(false)
|
||||||
|
component.onScroll()
|
||||||
|
expect(component.showJumpToBottom).toBe(true)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { CommonModule } from '@angular/common'
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
@@ -9,7 +10,7 @@ import {
|
|||||||
} from '@angular/core'
|
} from '@angular/core'
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||||
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { filter, takeUntil, timer } from 'rxjs'
|
import { Subject, debounceTime, filter, takeUntil, timer } from 'rxjs'
|
||||||
import { LogService } from 'src/app/services/rest/log.service'
|
import { LogService } from 'src/app/services/rest/log.service'
|
||||||
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
||||||
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
||||||
@@ -21,6 +22,7 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
|||||||
imports: [
|
imports: [
|
||||||
PageHeaderComponent,
|
PageHeaderComponent,
|
||||||
NgbNavModule,
|
NgbNavModule,
|
||||||
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
],
|
],
|
||||||
@@ -32,7 +34,7 @@ export class LogsComponent
|
|||||||
private logService = inject(LogService)
|
private logService = inject(LogService)
|
||||||
private changedetectorRef = inject(ChangeDetectorRef)
|
private changedetectorRef = inject(ChangeDetectorRef)
|
||||||
|
|
||||||
public logs: string[] = []
|
public logs: Array<{ message: string; level: number }> = []
|
||||||
|
|
||||||
public logFiles: string[] = []
|
public logFiles: string[] = []
|
||||||
|
|
||||||
@@ -40,9 +42,19 @@ export class LogsComponent
|
|||||||
|
|
||||||
public autoRefreshEnabled: boolean = true
|
public autoRefreshEnabled: boolean = true
|
||||||
|
|
||||||
@ViewChild('logContainer') logContainer: ElementRef
|
public limit: number = 5000
|
||||||
|
|
||||||
|
public showJumpToBottom = false
|
||||||
|
|
||||||
|
private readonly limitChange$ = new Subject<number>()
|
||||||
|
|
||||||
|
@ViewChild('logContainer') logContainer: ElementRef<HTMLElement>
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.limitChange$
|
||||||
|
.pipe(debounceTime(300), takeUntil(this.unsubscribeNotifier))
|
||||||
|
.subscribe(() => this.reloadLogs())
|
||||||
|
|
||||||
this.logService
|
this.logService
|
||||||
.list()
|
.list()
|
||||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
@@ -68,16 +80,37 @@ export class LogsComponent
|
|||||||
super.ngOnDestroy()
|
super.ngOnDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLimitChange(limit: number): void {
|
||||||
|
this.limitChange$.next(limit)
|
||||||
|
}
|
||||||
|
|
||||||
reloadLogs() {
|
reloadLogs() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
const shouldStickToBottom = this.isNearBottom()
|
||||||
this.logService
|
this.logService
|
||||||
.get(this.activeLog)
|
.get(this.activeLog, this.limit)
|
||||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
this.logs = result
|
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.scrollToBottom()
|
const parsed = this.parseLogsWithLevel(result)
|
||||||
|
const hasChanges =
|
||||||
|
parsed.length !== this.logs.length ||
|
||||||
|
parsed.some((log, idx) => {
|
||||||
|
const current = this.logs[idx]
|
||||||
|
return (
|
||||||
|
!current ||
|
||||||
|
current.message !== log.message ||
|
||||||
|
current.level !== log.level
|
||||||
|
)
|
||||||
|
})
|
||||||
|
if (hasChanges) {
|
||||||
|
this.logs = parsed
|
||||||
|
if (shouldStickToBottom) {
|
||||||
|
this.scrollToBottom()
|
||||||
|
}
|
||||||
|
this.showJumpToBottom = !shouldStickToBottom
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: () => {
|
error: () => {
|
||||||
this.logs = []
|
this.logs = []
|
||||||
@@ -100,12 +133,35 @@ export class LogsComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private parseLogsWithLevel(
|
||||||
|
logs: string[]
|
||||||
|
): Array<{ message: string; level: number }> {
|
||||||
|
return logs.map((log) => ({
|
||||||
|
message: log,
|
||||||
|
level: this.getLogLevel(log),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
scrollToBottom(): void {
|
scrollToBottom(): void {
|
||||||
|
const viewport = this.logContainer?.nativeElement
|
||||||
|
if (!viewport) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.changedetectorRef.detectChanges()
|
this.changedetectorRef.detectChanges()
|
||||||
this.logContainer?.nativeElement.scroll({
|
viewport.scrollTop = viewport.scrollHeight
|
||||||
top: this.logContainer.nativeElement.scrollHeight,
|
this.showJumpToBottom = false
|
||||||
left: 0,
|
}
|
||||||
behavior: 'auto',
|
|
||||||
})
|
private isNearBottom(): boolean {
|
||||||
|
if (!this.logContainer?.nativeElement) return true
|
||||||
|
const distanceFromBottom =
|
||||||
|
this.logContainer.nativeElement.scrollHeight -
|
||||||
|
this.logContainer.nativeElement.scrollTop -
|
||||||
|
this.logContainer.nativeElement.clientHeight
|
||||||
|
return distanceFromBottom <= 40
|
||||||
|
}
|
||||||
|
|
||||||
|
onScroll(): void {
|
||||||
|
this.showJumpToBottom = !this.isNearBottom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
|||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||||
import { GroupService } from 'src/app/services/rest/group.service'
|
import { GroupService } from 'src/app/services/rest/group.service'
|
||||||
import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
import { SavedViewService } from 'src/app/services/rest/saved-view.service'
|
||||||
@@ -129,7 +128,6 @@ describe('SettingsComponent', () => {
|
|||||||
ConfirmDialogComponent,
|
ConfirmDialogComponent,
|
||||||
CheckComponent,
|
CheckComponent,
|
||||||
ColorComponent,
|
ColorComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
SelectComponent,
|
SelectComponent,
|
||||||
TextComponent,
|
TextComponent,
|
||||||
NumberComponent,
|
NumberComponent,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
NgbNavItem,
|
NgbNavItem,
|
||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { allIcons, NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { allIcons, NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
|
import { throwError } from 'rxjs'
|
||||||
import { routes } from 'src/app/app-routing.module'
|
import { routes } from 'src/app/app-routing.module'
|
||||||
import {
|
import {
|
||||||
PaperlessTask,
|
PaperlessTask,
|
||||||
@@ -28,6 +29,7 @@ import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
|||||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||||
import { TasksService } from 'src/app/services/tasks.service'
|
import { TasksService } from 'src/app/services/tasks.service'
|
||||||
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { environment } from 'src/environments/environment'
|
import { environment } from 'src/environments/environment'
|
||||||
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
||||||
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
||||||
@@ -123,6 +125,7 @@ describe('TasksComponent', () => {
|
|||||||
let router: Router
|
let router: Router
|
||||||
let httpTestingController: HttpTestingController
|
let httpTestingController: HttpTestingController
|
||||||
let reloadSpy
|
let reloadSpy
|
||||||
|
let toastService: ToastService
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -157,6 +160,7 @@ describe('TasksComponent', () => {
|
|||||||
httpTestingController = TestBed.inject(HttpTestingController)
|
httpTestingController = TestBed.inject(HttpTestingController)
|
||||||
modalService = TestBed.inject(NgbModal)
|
modalService = TestBed.inject(NgbModal)
|
||||||
router = TestBed.inject(Router)
|
router = TestBed.inject(Router)
|
||||||
|
toastService = TestBed.inject(ToastService)
|
||||||
fixture = TestBed.createComponent(TasksComponent)
|
fixture = TestBed.createComponent(TasksComponent)
|
||||||
component = fixture.componentInstance
|
component = fixture.componentInstance
|
||||||
jest.useFakeTimers()
|
jest.useFakeTimers()
|
||||||
@@ -249,6 +253,42 @@ describe('TasksComponent', () => {
|
|||||||
expect(dismissSpy).toHaveBeenCalledWith(selected)
|
expect(dismissSpy).toHaveBeenCalledWith(selected)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should show an error and re-enable modal buttons when dismissing multiple tasks fails', () => {
|
||||||
|
component.selectedTasks = new Set([tasks[0].id, tasks[1].id])
|
||||||
|
const error = new Error('dismiss failed')
|
||||||
|
const toastSpy = jest.spyOn(toastService, 'showError')
|
||||||
|
const dismissSpy = jest
|
||||||
|
.spyOn(tasksService, 'dismissTasks')
|
||||||
|
.mockReturnValue(throwError(() => error))
|
||||||
|
|
||||||
|
let modal: NgbModalRef
|
||||||
|
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
||||||
|
|
||||||
|
component.dismissTasks()
|
||||||
|
expect(modal).not.toBeUndefined()
|
||||||
|
|
||||||
|
modal.componentInstance.confirmClicked.emit()
|
||||||
|
|
||||||
|
expect(dismissSpy).toHaveBeenCalledWith(new Set([tasks[0].id, tasks[1].id]))
|
||||||
|
expect(toastSpy).toHaveBeenCalledWith('Error dismissing tasks', error)
|
||||||
|
expect(modal.componentInstance.buttonsEnabled).toBe(true)
|
||||||
|
expect(component.selectedTasks.size).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should show an error when dismissing a single task fails', () => {
|
||||||
|
const error = new Error('dismiss failed')
|
||||||
|
const toastSpy = jest.spyOn(toastService, 'showError')
|
||||||
|
const dismissSpy = jest
|
||||||
|
.spyOn(tasksService, 'dismissTasks')
|
||||||
|
.mockReturnValue(throwError(() => error))
|
||||||
|
|
||||||
|
component.dismissTask(tasks[0])
|
||||||
|
|
||||||
|
expect(dismissSpy).toHaveBeenCalledWith(new Set([tasks[0].id]))
|
||||||
|
expect(toastSpy).toHaveBeenCalledWith('Error dismissing task', error)
|
||||||
|
expect(component.selectedTasks.size).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
it('should support dismiss all tasks', () => {
|
it('should support dismiss all tasks', () => {
|
||||||
let modal: NgbModalRef
|
let modal: NgbModalRef
|
||||||
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { PaperlessTask } from 'src/app/data/paperless-task'
|
|||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||||
import { TasksService } from 'src/app/services/tasks.service'
|
import { TasksService } from 'src/app/services/tasks.service'
|
||||||
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
||||||
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
import { PageHeaderComponent } from '../../common/page-header/page-header.component'
|
||||||
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
||||||
@@ -72,6 +73,7 @@ export class TasksComponent
|
|||||||
tasksService = inject(TasksService)
|
tasksService = inject(TasksService)
|
||||||
private modalService = inject(NgbModal)
|
private modalService = inject(NgbModal)
|
||||||
private readonly router = inject(Router)
|
private readonly router = inject(Router)
|
||||||
|
private readonly toastService = inject(ToastService)
|
||||||
|
|
||||||
public activeTab: TaskTab
|
public activeTab: TaskTab
|
||||||
public selectedTasks: Set<number> = new Set()
|
public selectedTasks: Set<number> = new Set()
|
||||||
@@ -154,11 +156,19 @@ export class TasksComponent
|
|||||||
modal.componentInstance.confirmClicked.pipe(first()).subscribe(() => {
|
modal.componentInstance.confirmClicked.pipe(first()).subscribe(() => {
|
||||||
modal.componentInstance.buttonsEnabled = false
|
modal.componentInstance.buttonsEnabled = false
|
||||||
modal.close()
|
modal.close()
|
||||||
this.tasksService.dismissTasks(tasks)
|
this.tasksService.dismissTasks(tasks).subscribe({
|
||||||
|
error: (e) => {
|
||||||
|
this.toastService.showError($localize`Error dismissing tasks`, e)
|
||||||
|
modal.componentInstance.buttonsEnabled = true
|
||||||
|
},
|
||||||
|
})
|
||||||
this.clearSelection()
|
this.clearSelection()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.tasksService.dismissTasks(tasks)
|
this.tasksService.dismissTasks(tasks).subscribe({
|
||||||
|
error: (e) =>
|
||||||
|
this.toastService.showError($localize`Error dismissing task`, e),
|
||||||
|
})
|
||||||
this.clearSelection()
|
this.clearSelection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||||
import { of, throwError } from 'rxjs'
|
import { of, throwError } from 'rxjs'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { TrashService } from 'src/app/services/trash.service'
|
import { TrashService } from 'src/app/services/trash.service'
|
||||||
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component'
|
||||||
@@ -53,7 +52,6 @@ describe('TrashComponent', () => {
|
|||||||
TrashComponent,
|
TrashComponent,
|
||||||
PageHeaderComponent,
|
PageHeaderComponent,
|
||||||
ConfirmDialogComponent,
|
ConfirmDialogComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
],
|
],
|
||||||
}).compileComponents()
|
}).compileComponents()
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
>
|
>
|
||||||
</pngx-page-header>
|
</pngx-page-header>
|
||||||
|
|
||||||
@if (users) {
|
@if (canViewUsers && users) {
|
||||||
<h4 class="d-flex">
|
<h4 class="d-flex">
|
||||||
<ng-container i18n>Users</ng-container>
|
<ng-container i18n>Users</ng-container>
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary ms-4" (click)="editUser()" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.User }">
|
<button type="button" class="btn btn-sm btn-outline-primary ms-4" (click)="editUser()" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.User }">
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
@for (user of users; track user) {
|
@for (user of users; track user) {
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editUser(user)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.User)">{{user.username}}</button></div>
|
<div class="col d-flex align-items-center" [class.opacity-50]="!user.is_active"><button class="btn btn-link p-0 text-start" type="button" (click)="editUser(user)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.User)">{{user.username}}</button></div>
|
||||||
<div class="col d-flex align-items-center">{{user.first_name}} {{user.last_name}}</div>
|
<div class="col d-flex align-items-center">{{user.first_name}} {{user.last_name}}</div>
|
||||||
<div class="col d-flex align-items-center">{{user.groups?.map(getGroupName, this).join(', ')}}</div>
|
<div class="col d-flex align-items-center">{{user.groups?.map(getGroupName, this).join(', ')}}</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (groups) {
|
@if (canViewGroups && groups) {
|
||||||
<h4 class="mt-4 d-flex">
|
<h4 class="mt-4 d-flex">
|
||||||
<ng-container i18n>Groups</ng-container>
|
<ng-container i18n>Groups</ng-container>
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary ms-4" (click)="editGroup()" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Group }">
|
<button type="button" class="btn btn-sm btn-outline-primary ms-4" (click)="editGroup()" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.Group }">
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!users || !groups) {
|
@if ((canViewUsers && !users) || (canViewGroups && !groups)) {
|
||||||
<div>
|
<div>
|
||||||
<div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div>
|
<div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div>
|
||||||
<div class="visually-hidden" i18n>Loading...</div>
|
<div class="visually-hidden" i18n>Loading...</div>
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ import { Subject, first, takeUntil } from 'rxjs'
|
|||||||
import { Group } from 'src/app/data/group'
|
import { Group } from 'src/app/data/group'
|
||||||
import { User } from 'src/app/data/user'
|
import { User } from 'src/app/data/user'
|
||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
import {
|
||||||
|
PermissionAction,
|
||||||
|
PermissionType,
|
||||||
|
PermissionsService,
|
||||||
|
} from 'src/app/services/permissions.service'
|
||||||
import { GroupService } from 'src/app/services/rest/group.service'
|
import { GroupService } from 'src/app/services/rest/group.service'
|
||||||
import { UserService } from 'src/app/services/rest/user.service'
|
import { UserService } from 'src/app/services/rest/user.service'
|
||||||
import { SettingsService } from 'src/app/services/settings.service'
|
import { SettingsService } from 'src/app/services/settings.service'
|
||||||
@@ -44,30 +48,48 @@ export class UsersAndGroupsComponent
|
|||||||
|
|
||||||
unsubscribeNotifier: Subject<any> = new Subject()
|
unsubscribeNotifier: Subject<any> = new Subject()
|
||||||
|
|
||||||
ngOnInit(): void {
|
public get canViewUsers(): boolean {
|
||||||
this.usersService
|
return this.permissionsService.currentUserCan(
|
||||||
.listAll(null, null, { full_perms: true })
|
PermissionAction.View,
|
||||||
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
PermissionType.User
|
||||||
.subscribe({
|
)
|
||||||
next: (r) => {
|
}
|
||||||
this.users = r.results
|
|
||||||
},
|
|
||||||
error: (e) => {
|
|
||||||
this.toastService.showError($localize`Error retrieving users`, e)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
this.groupsService
|
public get canViewGroups(): boolean {
|
||||||
.listAll(null, null, { full_perms: true })
|
return this.permissionsService.currentUserCan(
|
||||||
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
PermissionAction.View,
|
||||||
.subscribe({
|
PermissionType.Group
|
||||||
next: (r) => {
|
)
|
||||||
this.groups = r.results
|
}
|
||||||
},
|
|
||||||
error: (e) => {
|
ngOnInit(): void {
|
||||||
this.toastService.showError($localize`Error retrieving groups`, e)
|
if (this.canViewUsers) {
|
||||||
},
|
this.usersService
|
||||||
})
|
.listAll(null, null, { full_perms: true })
|
||||||
|
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
||||||
|
.subscribe({
|
||||||
|
next: (r) => {
|
||||||
|
this.users = r.results
|
||||||
|
},
|
||||||
|
error: (e) => {
|
||||||
|
this.toastService.showError($localize`Error retrieving users`, e)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.canViewGroups) {
|
||||||
|
this.groupsService
|
||||||
|
.listAll(null, null, { full_perms: true })
|
||||||
|
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
||||||
|
.subscribe({
|
||||||
|
next: (r) => {
|
||||||
|
this.groups = r.results
|
||||||
|
},
|
||||||
|
error: (e) => {
|
||||||
|
this.toastService.showError($localize`Error retrieving groups`, e)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|||||||
@@ -68,13 +68,15 @@
|
|||||||
<nav id="sidebarMenu" class="d-md-block bg-light sidebar collapse"
|
<nav id="sidebarMenu" class="d-md-block bg-light sidebar collapse"
|
||||||
[ngClass]="slimSidebarEnabled ? 'slim' : 'col-md-3 col-lg-2 col-xxxl-1'" [class.animating]="slimSidebarAnimating"
|
[ngClass]="slimSidebarEnabled ? 'slim' : 'col-md-3 col-lg-2 col-xxxl-1'" [class.animating]="slimSidebarAnimating"
|
||||||
[ngbCollapse]="isMenuCollapsed">
|
[ngbCollapse]="isMenuCollapsed">
|
||||||
<button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="toggleSlimSidebar()">
|
@if (canSaveSettings) {
|
||||||
@if (slimSidebarEnabled) {
|
<button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="toggleSlimSidebar()">
|
||||||
<i-bs width="0.9em" height="0.9em" name="chevron-double-right"></i-bs>
|
@if (slimSidebarEnabled) {
|
||||||
} @else {
|
<i-bs width="0.9em" height="0.9em" name="chevron-double-right"></i-bs>
|
||||||
<i-bs width="0.9em" height="0.9em" name="chevron-double-left"></i-bs>
|
} @else {
|
||||||
}
|
<i-bs width="0.9em" height="0.9em" name="chevron-double-left"></i-bs>
|
||||||
</button>
|
}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
<div class="sidebar-sticky pt-3 d-flex flex-column justify-space-around">
|
<div class="sidebar-sticky pt-3 d-flex flex-column justify-space-around">
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item app-link">
|
<li class="nav-item app-link">
|
||||||
|
|||||||
@@ -152,6 +152,19 @@ export class AppFrameComponent
|
|||||||
return this.settingsService.get(SETTINGS_KEYS.APP_TITLE)
|
return this.settingsService.get(SETTINGS_KEYS.APP_TITLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get canSaveSettings(): boolean {
|
||||||
|
return (
|
||||||
|
this.permissionsService.currentUserCan(
|
||||||
|
PermissionAction.Change,
|
||||||
|
PermissionType.UISettings
|
||||||
|
) &&
|
||||||
|
this.permissionsService.currentUserCan(
|
||||||
|
PermissionAction.Add,
|
||||||
|
PermissionType.UISettings
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
get slimSidebarEnabled(): boolean {
|
get slimSidebarEnabled(): boolean {
|
||||||
return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR)
|
return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,6 +411,9 @@ export class GlobalSearchComponent implements OnInit {
|
|||||||
const ruleType = this.useAdvancedForFullSearch
|
const ruleType = this.useAdvancedForFullSearch
|
||||||
? FILTER_FULLTEXT_QUERY
|
? FILTER_FULLTEXT_QUERY
|
||||||
: FILTER_TITLE_CONTENT
|
: FILTER_TITLE_CONTENT
|
||||||
|
this.documentService.searchQuery = this.useAdvancedForFullSearch
|
||||||
|
? this.query
|
||||||
|
: ''
|
||||||
this.documentListViewService.quickFilter([
|
this.documentListViewService.quickFilter([
|
||||||
{ rule_type: ruleType, value: this.query },
|
{ rule_type: ruleType, value: this.query },
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<p><b>{{messageBold}}</b></p>
|
<p><b>{{messageBold}}</b></p>
|
||||||
}
|
}
|
||||||
@if (message) {
|
@if (message) {
|
||||||
<p class="mb-0" [innerHTML]="message | safeHtml"></p>
|
<p class="mb-0" [innerHTML]="message"></p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { Subject } from 'rxjs'
|
import { Subject } from 'rxjs'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { ConfirmDialogComponent } from './confirm-dialog.component'
|
import { ConfirmDialogComponent } from './confirm-dialog.component'
|
||||||
|
|
||||||
describe('ConfirmDialogComponent', () => {
|
describe('ConfirmDialogComponent', () => {
|
||||||
@@ -11,8 +10,8 @@ describe('ConfirmDialogComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [NgbActiveModal, SafeHtmlPipe],
|
providers: [NgbActiveModal],
|
||||||
imports: [ConfirmDialogComponent, SafeHtmlPipe],
|
imports: [ConfirmDialogComponent],
|
||||||
}).compileComponents()
|
}).compileComponents()
|
||||||
|
|
||||||
modal = TestBed.inject(NgbActiveModal)
|
modal = TestBed.inject(NgbActiveModal)
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ import { DecimalPipe } from '@angular/common'
|
|||||||
import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
|
import { Component, EventEmitter, Input, Output, inject } from '@angular/core'
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { Subject } from 'rxjs'
|
import { Subject } from 'rxjs'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pngx-confirm-dialog',
|
selector: 'pngx-confirm-dialog',
|
||||||
templateUrl: './confirm-dialog.component.html',
|
templateUrl: './confirm-dialog.component.html',
|
||||||
styleUrls: ['./confirm-dialog.component.scss'],
|
styleUrls: ['./confirm-dialog.component.scss'],
|
||||||
imports: [DecimalPipe, SafeHtmlPipe],
|
imports: [DecimalPipe],
|
||||||
})
|
})
|
||||||
export class ConfirmDialogComponent extends LoadingComponentWithPermissions {
|
export class ConfirmDialogComponent extends LoadingComponentWithPermissions {
|
||||||
activeModal = inject(NgbActiveModal)
|
activeModal = inject(NgbActiveModal)
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="modal-basic-title">{{title}}</h4>
|
||||||
|
<button type="button" class="btn-close" aria-label="Close" (click)="cancel()">
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
@if (message) {
|
||||||
|
<p class="mb-3" [innerHTML]="message"></p>
|
||||||
|
}
|
||||||
|
<div class="btn-group mb-3" role="group">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
class="btn-check"
|
||||||
|
name="passwordRemoveMode"
|
||||||
|
id="removeReplace"
|
||||||
|
[(ngModel)]="updateDocument"
|
||||||
|
[value]="true"
|
||||||
|
(ngModelChange)="onUpdateDocumentChange($event)"
|
||||||
|
/>
|
||||||
|
<label class="btn btn-outline-primary btn-sm" for="removeReplace">
|
||||||
|
<i-bs name="pencil"></i-bs>
|
||||||
|
<span class="ms-2" i18n>Replace current document</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
class="btn-check"
|
||||||
|
name="passwordRemoveMode"
|
||||||
|
id="removeCreate"
|
||||||
|
[(ngModel)]="updateDocument"
|
||||||
|
[value]="false"
|
||||||
|
(ngModelChange)="onUpdateDocumentChange($event)"
|
||||||
|
/>
|
||||||
|
<label class="btn btn-outline-primary btn-sm" for="removeCreate">
|
||||||
|
<i-bs name="plus"></i-bs>
|
||||||
|
<span class="ms-2" i18n>Create new document</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
@if (!updateDocument) {
|
||||||
|
<div class="d-flex flex-column flex-md-row w-100 gap-3 align-items-center">
|
||||||
|
<div class="form-group d-flex">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" id="copyMetaRemove" [(ngModel)]="includeMetadata" />
|
||||||
|
<label class="form-check-label" for="copyMetaRemove" i18n> Copy metadata
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check ms-3">
|
||||||
|
<input class="form-check-input" type="checkbox" id="deleteOriginalRemove" [(ngModel)]="deleteOriginal" />
|
||||||
|
<label class="form-check-label" for="deleteOriginalRemove" i18n> Delete original</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer flex-nowrap gap-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn"
|
||||||
|
[class]="cancelBtnClass"
|
||||||
|
(click)="cancel()"
|
||||||
|
[disabled]="!buttonsEnabled"
|
||||||
|
>
|
||||||
|
<span class="d-inline-block" style="padding-bottom: 1px;">
|
||||||
|
{{cancelBtnCaption}}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn"
|
||||||
|
[class]="btnClass"
|
||||||
|
(click)="confirm()"
|
||||||
|
[disabled]="!confirmButtonEnabled || !buttonsEnabled"
|
||||||
|
>
|
||||||
|
{{btnCaption}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||||
|
import { By } from '@angular/platform-browser'
|
||||||
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||||
|
import { PasswordRemovalConfirmDialogComponent } from './password-removal-confirm-dialog.component'
|
||||||
|
|
||||||
|
describe('PasswordRemovalConfirmDialogComponent', () => {
|
||||||
|
let component: PasswordRemovalConfirmDialogComponent
|
||||||
|
let fixture: ComponentFixture<PasswordRemovalConfirmDialogComponent>
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
providers: [NgbActiveModal],
|
||||||
|
imports: [
|
||||||
|
NgxBootstrapIconsModule.pick(allIcons),
|
||||||
|
PasswordRemovalConfirmDialogComponent,
|
||||||
|
],
|
||||||
|
}).compileComponents()
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(PasswordRemovalConfirmDialogComponent)
|
||||||
|
component = fixture.componentInstance
|
||||||
|
fixture.detectChanges()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should default to replacing the document', () => {
|
||||||
|
expect(component.updateDocument).toBe(true)
|
||||||
|
expect(
|
||||||
|
fixture.debugElement.query(By.css('#removeReplace')).nativeElement.checked
|
||||||
|
).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should allow creating a new document with metadata and delete toggle', () => {
|
||||||
|
component.onUpdateDocumentChange(false)
|
||||||
|
fixture.detectChanges()
|
||||||
|
|
||||||
|
expect(component.updateDocument).toBe(false)
|
||||||
|
expect(fixture.debugElement.query(By.css('#copyMetaRemove'))).not.toBeNull()
|
||||||
|
|
||||||
|
component.includeMetadata = false
|
||||||
|
component.deleteOriginal = true
|
||||||
|
component.onUpdateDocumentChange(true)
|
||||||
|
expect(component.updateDocument).toBe(true)
|
||||||
|
expect(component.includeMetadata).toBe(true)
|
||||||
|
expect(component.deleteOriginal).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should emit confirm when confirmed', () => {
|
||||||
|
let confirmed = false
|
||||||
|
component.confirmClicked.subscribe(() => (confirmed = true))
|
||||||
|
component.confirm()
|
||||||
|
expect(confirmed).toBe(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { Component, Input } from '@angular/core'
|
||||||
|
import { FormsModule } from '@angular/forms'
|
||||||
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
|
import { ConfirmDialogComponent } from '../confirm-dialog.component'
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'pngx-password-removal-confirm-dialog',
|
||||||
|
templateUrl: './password-removal-confirm-dialog.component.html',
|
||||||
|
styleUrls: ['./password-removal-confirm-dialog.component.scss'],
|
||||||
|
imports: [FormsModule, NgxBootstrapIconsModule],
|
||||||
|
})
|
||||||
|
export class PasswordRemovalConfirmDialogComponent extends ConfirmDialogComponent {
|
||||||
|
updateDocument: boolean = true
|
||||||
|
includeMetadata: boolean = true
|
||||||
|
deleteOriginal: boolean = false
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
override title = $localize`Remove password protection`
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
override message =
|
||||||
|
$localize`Create an unprotected copy or replace the existing file.`
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
override btnCaption = $localize`Start`
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
onUpdateDocumentChange(updateDocument: boolean) {
|
||||||
|
this.updateDocument = updateDocument
|
||||||
|
if (this.updateDocument) {
|
||||||
|
this.deleteOriginal = false
|
||||||
|
this.includeMetadata = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,10 +28,10 @@
|
|||||||
<div class="modal-footer flex-nowrap">
|
<div class="modal-footer flex-nowrap">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
@if (message) {
|
@if (message) {
|
||||||
<p [innerHTML]="message | safeHtml"></p>
|
<p>{{message}}</p>
|
||||||
}
|
}
|
||||||
@if (messageBold) {
|
@if (messageBold) {
|
||||||
<p class="mb-0 small"><b [innerHTML]="messageBold | safeHtml"></b></p>
|
<p class="mb-0 small"><b>{{messageBold}}</b></p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn" [class]="cancelBtnClass" (click)="cancel()" [disabled]="!buttonsEnabled">
|
<button type="button" class="btn" [class]="cancelBtnClass" (click)="cancel()" [disabled]="!buttonsEnabled">
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { RotateConfirmDialogComponent } from './rotate-confirm-dialog.component'
|
import { RotateConfirmDialogComponent } from './rotate-confirm-dialog.component'
|
||||||
|
|
||||||
describe('RotateConfirmDialogComponent', () => {
|
describe('RotateConfirmDialogComponent', () => {
|
||||||
@@ -15,11 +14,9 @@ describe('RotateConfirmDialogComponent', () => {
|
|||||||
imports: [
|
imports: [
|
||||||
NgxBootstrapIconsModule.pick(allIcons),
|
NgxBootstrapIconsModule.pick(allIcons),
|
||||||
RotateConfirmDialogComponent,
|
RotateConfirmDialogComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
SafeHtmlPipe,
|
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { NgStyle } from '@angular/common'
|
import { NgStyle } from '@angular/common'
|
||||||
import { Component, inject } from '@angular/core'
|
import { Component, inject } from '@angular/core'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||||
import { ConfirmDialogComponent } from '../confirm-dialog.component'
|
import { ConfirmDialogComponent } from '../confirm-dialog.component'
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ import { ConfirmDialogComponent } from '../confirm-dialog.component'
|
|||||||
selector: 'pngx-rotate-confirm-dialog',
|
selector: 'pngx-rotate-confirm-dialog',
|
||||||
templateUrl: './rotate-confirm-dialog.component.html',
|
templateUrl: './rotate-confirm-dialog.component.html',
|
||||||
styleUrl: './rotate-confirm-dialog.component.scss',
|
styleUrl: './rotate-confirm-dialog.component.scss',
|
||||||
imports: [NgStyle, NgxBootstrapIconsModule, SafeHtmlPipe],
|
imports: [NgStyle, NgxBootstrapIconsModule],
|
||||||
})
|
})
|
||||||
export class RotateConfirmDialogComponent extends ConfirmDialogComponent {
|
export class RotateConfirmDialogComponent extends ConfirmDialogComponent {
|
||||||
documentService = inject(DocumentService)
|
documentService = inject(DocumentService)
|
||||||
|
|||||||
@@ -1,28 +1,36 @@
|
|||||||
<div class="btn-group w-100" role="group" ngbDropdown #dropdown="ngbDropdown" (openChange)="onOpenChange($event)" [popperOptions]="popperOptions">
|
@if (useDropdown) {
|
||||||
<button class="btn btn-sm btn-outline-primary" id="dropdown_toggle" ngbDropdownToggle [disabled]="disabled">
|
<div class="btn-group w-100" role="group" ngbDropdown #dropdown="ngbDropdown" (openChange)="onOpenChange($event)" [popperOptions]="popperOptions">
|
||||||
<i-bs name="{{icon}}"></i-bs>
|
<button class="btn btn-sm btn-outline-primary" id="dropdown_toggle" ngbDropdownToggle [disabled]="disabled">
|
||||||
<div class="d-none d-sm-inline"> {{title}}</div>
|
<i-bs name="{{icon}}"></i-bs>
|
||||||
@if (isActive) {
|
<div class="d-none d-sm-inline"> {{title}}</div>
|
||||||
<pngx-clearable-badge [selected]="isActive" (cleared)="reset()"></pngx-clearable-badge>
|
@if (isActive) {
|
||||||
}
|
<pngx-clearable-badge [selected]="isActive" (cleared)="reset()"></pngx-clearable-badge>
|
||||||
</button>
|
|
||||||
<div class="px-3 shadow" ngbDropdownMenu attr.aria-labelledby="dropdown_{{name}}">
|
|
||||||
<div class="list-group list-group-flush">
|
|
||||||
@for (element of selectionModel.queries; track element.id; let i = $index) {
|
|
||||||
<div class="list-group-item px-0 d-flex flex-nowrap">
|
|
||||||
@switch (element.type) {
|
|
||||||
@case (CustomFieldQueryComponentType.Atom) {
|
|
||||||
<ng-container *ngTemplateOutlet="queryAtom; context: { atom: element }"></ng-container>
|
|
||||||
}
|
|
||||||
@case (CustomFieldQueryComponentType.Expression) {
|
|
||||||
<ng-container *ngTemplateOutlet="queryExpression; context: { expression: element }"></ng-container>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
</button>
|
||||||
|
<div class="px-3 shadow" ngbDropdownMenu attr.aria-labelledby="dropdown_{{name}}">
|
||||||
|
<ng-container *ngTemplateOutlet="list; context: { queries: selectionModel.queries }"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
} @else {
|
||||||
|
<ng-container *ngTemplateOutlet="list; context: { queries: selectionModel.queries }"></ng-container>
|
||||||
|
}
|
||||||
|
|
||||||
|
<ng-template #list let-queries="queries">
|
||||||
|
<div class="list-group list-group-flush">
|
||||||
|
@for (element of queries; track element.id; let i = $index) {
|
||||||
|
<div class="list-group-item px-0 d-flex flex-nowrap">
|
||||||
|
@switch (element.type) {
|
||||||
|
@case (CustomFieldQueryComponentType.Atom) {
|
||||||
|
<ng-container *ngTemplateOutlet="queryAtom; context: { atom: element }"></ng-container>
|
||||||
|
}
|
||||||
|
@case (CustomFieldQueryComponentType.Expression) {
|
||||||
|
<ng-container *ngTemplateOutlet="queryExpression; context: { expression: element }"></ng-container>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #comparisonValueTemplate let-atom="atom">
|
<ng-template #comparisonValueTemplate let-atom="atom">
|
||||||
@if (getCustomFieldByID(atom.field)?.data_type === CustomFieldDataType.Date) {
|
@if (getCustomFieldByID(atom.field)?.data_type === CustomFieldDataType.Date) {
|
||||||
@@ -55,6 +63,7 @@
|
|||||||
bindValue="id"
|
bindValue="id"
|
||||||
[(ngModel)]="atom.value"
|
[(ngModel)]="atom.value"
|
||||||
[disabled]="disabled"
|
[disabled]="disabled"
|
||||||
|
[virtualScroll]="getSelectOptionsForField(atom.field)?.length > 100"
|
||||||
(mousedown)="$event.stopImmediatePropagation()"
|
(mousedown)="$event.stopImmediatePropagation()"
|
||||||
></ng-select>
|
></ng-select>
|
||||||
} @else if (getCustomFieldByID(atom.field)?.data_type === CustomFieldDataType.DocumentLink) {
|
} @else if (getCustomFieldByID(atom.field)?.data_type === CustomFieldDataType.DocumentLink) {
|
||||||
|
|||||||
@@ -41,9 +41,3 @@
|
|||||||
min-width: 140px;
|
min-width: 140px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-group-xs {
|
|
||||||
> .btn {
|
|
||||||
border-radius: 0.15rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -354,5 +354,13 @@ describe('CustomFieldsQueryDropdownComponent', () => {
|
|||||||
model.removeElement(atom)
|
model.removeElement(atom)
|
||||||
expect(completeSpy).toHaveBeenCalled()
|
expect(completeSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should subscribe to existing elements when queries are assigned', () => {
|
||||||
|
const expression = new CustomFieldQueryExpression()
|
||||||
|
const nextSpy = jest.spyOn(model.changed, 'next')
|
||||||
|
model.queries = [expression]
|
||||||
|
expression.changed.next(expression)
|
||||||
|
expect(nextSpy).toHaveBeenCalledWith(model)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from '@ng-bootstrap/ng-bootstrap'
|
} from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select'
|
import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { first, Subject, takeUntil } from 'rxjs'
|
import { first, Subject, Subscription, takeUntil } from 'rxjs'
|
||||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||||
import {
|
import {
|
||||||
CUSTOM_FIELD_QUERY_MAX_ATOMS,
|
CUSTOM_FIELD_QUERY_MAX_ATOMS,
|
||||||
@@ -41,10 +41,27 @@ import { ClearableBadgeComponent } from '../clearable-badge/clearable-badge.comp
|
|||||||
import { DocumentLinkComponent } from '../input/document-link/document-link.component'
|
import { DocumentLinkComponent } from '../input/document-link/document-link.component'
|
||||||
|
|
||||||
export class CustomFieldQueriesModel {
|
export class CustomFieldQueriesModel {
|
||||||
public queries: CustomFieldQueryElement[] = []
|
private _queries: CustomFieldQueryElement[] = []
|
||||||
|
private rootSubscriptions: Subscription[] = []
|
||||||
|
|
||||||
public readonly changed = new Subject<CustomFieldQueriesModel>()
|
public readonly changed = new Subject<CustomFieldQueriesModel>()
|
||||||
|
|
||||||
|
public get queries(): CustomFieldQueryElement[] {
|
||||||
|
return this._queries
|
||||||
|
}
|
||||||
|
|
||||||
|
public set queries(value: CustomFieldQueryElement[]) {
|
||||||
|
this.teardownRootSubscriptions()
|
||||||
|
this._queries = value ?? []
|
||||||
|
for (const element of this._queries) {
|
||||||
|
this.rootSubscriptions.push(
|
||||||
|
element.changed.subscribe(() => {
|
||||||
|
this.changed.next(this)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public clear(fireEvent = true) {
|
public clear(fireEvent = true) {
|
||||||
this.queries = []
|
this.queries = []
|
||||||
if (fireEvent) {
|
if (fireEvent) {
|
||||||
@@ -107,19 +124,25 @@ export class CustomFieldQueriesModel {
|
|||||||
public addExpression(
|
public addExpression(
|
||||||
expression: CustomFieldQueryExpression = new CustomFieldQueryExpression()
|
expression: CustomFieldQueryExpression = new CustomFieldQueryExpression()
|
||||||
) {
|
) {
|
||||||
if (this.queries.length > 0) {
|
if (this.queries.length === 0) {
|
||||||
;(
|
this.queries = [expression]
|
||||||
(this.queries[0] as CustomFieldQueryExpression)
|
return
|
||||||
.value as CustomFieldQueryElement[]
|
|
||||||
).push(expression)
|
|
||||||
} else {
|
|
||||||
this.queries.push(expression)
|
|
||||||
}
|
}
|
||||||
|
;(
|
||||||
|
(this.queries[0] as CustomFieldQueryExpression)
|
||||||
|
.value as CustomFieldQueryElement[]
|
||||||
|
).push(expression)
|
||||||
expression.changed.subscribe(() => {
|
expression.changed.subscribe(() => {
|
||||||
this.changed.next(this)
|
this.changed.next(this)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addInitialAtom() {
|
||||||
|
this.addAtom(
|
||||||
|
new CustomFieldQueryAtom([null, CustomFieldQueryOperator.Exists, 'true'])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private findElement(
|
private findElement(
|
||||||
queryElement: CustomFieldQueryElement,
|
queryElement: CustomFieldQueryElement,
|
||||||
elements: any[]
|
elements: any[]
|
||||||
@@ -160,6 +183,13 @@ export class CustomFieldQueriesModel {
|
|||||||
this.changed.next(this)
|
this.changed.next(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private teardownRootSubscriptions() {
|
||||||
|
for (const subscription of this.rootSubscriptions) {
|
||||||
|
subscription.unsubscribe()
|
||||||
|
}
|
||||||
|
this.rootSubscriptions = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -206,6 +236,9 @@ export class CustomFieldsQueryDropdownComponent extends LoadingComponentWithPerm
|
|||||||
@Input()
|
@Input()
|
||||||
applyOnClose = false
|
applyOnClose = false
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
useDropdown: boolean = true
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return this.title ? this.title.replace(/\s/g, '_').toLowerCase() : null
|
return this.title ? this.title.replace(/\s/g, '_').toLowerCase() : null
|
||||||
}
|
}
|
||||||
@@ -258,13 +291,7 @@ export class CustomFieldsQueryDropdownComponent extends LoadingComponentWithPerm
|
|||||||
public onOpenChange(open: boolean) {
|
public onOpenChange(open: boolean) {
|
||||||
if (open) {
|
if (open) {
|
||||||
if (this.selectionModel.queries.length === 0) {
|
if (this.selectionModel.queries.length === 0) {
|
||||||
this.selectionModel.addAtom(
|
this.selectionModel.addInitialAtom()
|
||||||
new CustomFieldQueryAtom([
|
|
||||||
null,
|
|
||||||
CustomFieldQueryOperator.Exists,
|
|
||||||
'true',
|
|
||||||
])
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.selectionModel.queries.length === 1 &&
|
this.selectionModel.queries.length === 1 &&
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
i18n-placeholder
|
i18n-placeholder
|
||||||
(change)="onSetCreatedRelativeDate($event)">
|
(change)="onSetCreatedRelativeDate($event)">
|
||||||
<ng-template ng-option-tmp let-item="item">
|
<ng-template ng-option-tmp let-item="item">
|
||||||
<div class="d-flex">{{ item.name }}<span class="ms-auto text-muted small">{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container></span></div>
|
<ng-container [ngTemplateOutlet]="relativeDateOptionTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-container>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-select>
|
</ng-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
i18n-placeholder
|
i18n-placeholder
|
||||||
(change)="onSetAddedRelativeDate($event)">
|
(change)="onSetAddedRelativeDate($event)">
|
||||||
<ng-template ng-option-tmp let-item="item">
|
<ng-template ng-option-tmp let-item="item">
|
||||||
<div class="d-flex">{{ item.name }}<span class="ms-auto text-muted small">{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container></span></div>
|
<ng-container [ngTemplateOutlet]="relativeDateOptionTemplate" [ngTemplateOutletContext]="{ $implicit: item }"></ng-container>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-select>
|
</ng-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -158,3 +158,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ng-template #relativeDateOptionTemplate let-item>
|
||||||
|
<div class="d-flex">
|
||||||
|
{{ item.name }}
|
||||||
|
<span class="ms-auto text-muted small">
|
||||||
|
@if (item.dateEnd) {
|
||||||
|
{{ item.date | customDate:'MMM d' }} – {{ item.dateEnd | customDate:'mediumDate' }}
|
||||||
|
} @else {
|
||||||
|
{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { NgClass } from '@angular/common'
|
import { NgClass, NgTemplateOutlet } from '@angular/common'
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@@ -42,6 +42,10 @@ export enum RelativeDate {
|
|||||||
THIS_MONTH = 6,
|
THIS_MONTH = 6,
|
||||||
TODAY = 7,
|
TODAY = 7,
|
||||||
YESTERDAY = 8,
|
YESTERDAY = 8,
|
||||||
|
PREVIOUS_WEEK = 9,
|
||||||
|
PREVIOUS_MONTH = 10,
|
||||||
|
PREVIOUS_QUARTER = 11,
|
||||||
|
PREVIOUS_YEAR = 12,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -59,6 +63,7 @@ export enum RelativeDate {
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
NgClass,
|
NgClass,
|
||||||
|
NgTemplateOutlet,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class DatesDropdownComponent implements OnInit, OnDestroy {
|
export class DatesDropdownComponent implements OnInit, OnDestroy {
|
||||||
@@ -111,6 +116,46 @@ export class DatesDropdownComponent implements OnInit, OnDestroy {
|
|||||||
name: $localize`Yesterday`,
|
name: $localize`Yesterday`,
|
||||||
date: new Date().setDate(new Date().getDate() - 1),
|
date: new Date().setDate(new Date().getDate() - 1),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: RelativeDate.PREVIOUS_WEEK,
|
||||||
|
name: $localize`Previous week`,
|
||||||
|
date: new Date(
|
||||||
|
new Date().getFullYear(),
|
||||||
|
new Date().getMonth(),
|
||||||
|
new Date().getDate() - new Date().getDay() - 6
|
||||||
|
),
|
||||||
|
dateEnd: new Date(
|
||||||
|
new Date().getFullYear(),
|
||||||
|
new Date().getMonth(),
|
||||||
|
new Date().getDate() - new Date().getDay()
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: RelativeDate.PREVIOUS_MONTH,
|
||||||
|
name: $localize`Previous month`,
|
||||||
|
date: new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1),
|
||||||
|
dateEnd: new Date(new Date().getFullYear(), new Date().getMonth(), 0),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: RelativeDate.PREVIOUS_QUARTER,
|
||||||
|
name: $localize`Previous quarter`,
|
||||||
|
date: new Date(
|
||||||
|
new Date().getFullYear(),
|
||||||
|
Math.floor(new Date().getMonth() / 3) * 3 - 3,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
dateEnd: new Date(
|
||||||
|
new Date().getFullYear(),
|
||||||
|
Math.floor(new Date().getMonth() / 3) * 3,
|
||||||
|
0
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: RelativeDate.PREVIOUS_YEAR,
|
||||||
|
name: $localize`Previous year`,
|
||||||
|
date: new Date('1/1/' + (new Date().getFullYear() - 1)),
|
||||||
|
dateEnd: new Date('12/31/' + (new Date().getFullYear() - 1)),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
datePlaceHolder: string
|
datePlaceHolder: string
|
||||||
|
|||||||
@@ -38,9 +38,6 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
></ngb-pagination>
|
></ngb-pagination>
|
||||||
}
|
}
|
||||||
@if (object?.id) {
|
|
||||||
<small class="d-block mt-2" i18n>Warning: existing instances of this field will retain their current value index (e.g. option #1, #2, #3) after editing the options here</small>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@case (CustomFieldDataType.Monetary) {
|
@case (CustomFieldDataType.Monetary) {
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
|||||||
import { CustomFieldDataType } from 'src/app/data/custom-field'
|
import { CustomFieldDataType } from 'src/app/data/custom-field'
|
||||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { SettingsService } from 'src/app/services/settings.service'
|
import { SettingsService } from 'src/app/services/settings.service'
|
||||||
import { SelectComponent } from '../../input/select/select.component'
|
import { SelectComponent } from '../../input/select/select.component'
|
||||||
import { TextComponent } from '../../input/text/text.component'
|
import { TextComponent } from '../../input/text/text.component'
|
||||||
@@ -35,7 +34,6 @@ describe('CustomFieldEditDialogComponent', () => {
|
|||||||
IfOwnerDirective,
|
IfOwnerDirective,
|
||||||
SelectComponent,
|
SelectComponent,
|
||||||
TextComponent,
|
TextComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
NgbActiveModal,
|
NgbActiveModal,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
} from 'src/app/data/mail-rule'
|
} from 'src/app/data/mail-rule'
|
||||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||||
import { MailAccountService } from 'src/app/services/rest/mail-account.service'
|
import { MailAccountService } from 'src/app/services/rest/mail-account.service'
|
||||||
@@ -46,7 +45,6 @@ describe('MailRuleEditDialogComponent', () => {
|
|||||||
PermissionsFormComponent,
|
PermissionsFormComponent,
|
||||||
NumberComponent,
|
NumberComponent,
|
||||||
TagsComponent,
|
TagsComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
CheckComponent,
|
CheckComponent,
|
||||||
SwitchComponent,
|
SwitchComponent,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { GroupService } from 'src/app/services/rest/group.service'
|
|||||||
import { UserService } from 'src/app/services/rest/user.service'
|
import { UserService } from 'src/app/services/rest/user.service'
|
||||||
import { SettingsService } from 'src/app/services/settings.service'
|
import { SettingsService } from 'src/app/services/settings.service'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
|
import { ConfirmButtonComponent } from '../../confirm-button/confirm-button.component'
|
||||||
import { PasswordComponent } from '../../input/password/password.component'
|
import { PasswordComponent } from '../../input/password/password.component'
|
||||||
import { SelectComponent } from '../../input/select/select.component'
|
import { SelectComponent } from '../../input/select/select.component'
|
||||||
import { TextComponent } from '../../input/text/text.component'
|
import { TextComponent } from '../../input/text/text.component'
|
||||||
@@ -28,6 +29,7 @@ import { PermissionsSelectComponent } from '../../permissions-select/permissions
|
|||||||
SelectComponent,
|
SelectComponent,
|
||||||
TextComponent,
|
TextComponent,
|
||||||
PasswordComponent,
|
PasswordComponent,
|
||||||
|
ConfirmButtonComponent,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -77,9 +77,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div ngbAccordion [closeOthers]="true" cdkDropList (cdkDropListDropped)="onActionDrop($event)">
|
<div ngbAccordion [closeOthers]="true" cdkDropList (cdkDropListDropped)="onActionDrop($event)">
|
||||||
@for (action of object?.actions; track action; let i = $index){
|
@for (action of object?.actions; track action; let i = $index){
|
||||||
<div ngbAccordionItem cdkDrag [formGroup]="actionFields.controls[i]">
|
<div ngbAccordionItem [formGroup]="actionFields.controls[i]">
|
||||||
<div ngbAccordionHeader>
|
<div ngbAccordionHeader cdkDrag>
|
||||||
<button ngbAccordionButton>{{i + 1}}. {{getActionTypeOptionName(actionFields.controls[i].value.type)}}
|
<button ngbAccordionButton>
|
||||||
|
<i-bs name="grip-vertical" class="ms-n3 pe-1"></i-bs>
|
||||||
|
{{i + 1}}. {{getActionTypeOptionName(actionFields.controls[i].value.type)}}
|
||||||
@if(action.id) {
|
@if(action.id) {
|
||||||
<span class="badge bg-primary text-primary-text-contrast ms-2">ID: {{action.id}}</span>
|
<span class="badge bg-primary text-primary-text-contrast ms-2">ID: {{action.id}}</span>
|
||||||
}
|
}
|
||||||
@@ -156,31 +158,97 @@
|
|||||||
<p class="small" i18n>Trigger for documents that match <em>all</em> filters specified below.</p>
|
<p class="small" i18n>Trigger for documents that match <em>all</em> filters specified below.</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<pngx-input-text i18n-title title="Filter filename" formControlName="filter_filename" i18n-hint hint="Apply to documents that match this filename. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_filename"></pngx-input-text>
|
<pngx-input-text i18n-title title="Filter filename" formControlName="filter_filename" horizontal="true" i18n-hint hint="Apply to documents that match this filename. Wildcards such as *.pdf or *invoice* are allowed. Case insensitive." [error]="error?.filter_filename"></pngx-input-text>
|
||||||
@if (formGroup.get('type').value === WorkflowTriggerType.Consumption) {
|
@if (formGroup.get('type').value === WorkflowTriggerType.Consumption) {
|
||||||
<pngx-input-select i18n-title title="Filter sources" [items]="sourceOptions" [multiple]="true" formControlName="sources" [error]="error?.sources"></pngx-input-select>
|
<pngx-input-select i18n-title title="Filter sources" [items]="sourceOptions" horizontal="true" [multiple]="true" formControlName="sources" [error]="error?.sources"></pngx-input-select>
|
||||||
<pngx-input-text i18n-title title="Filter path" formControlName="filter_path" i18n-hint hint="Apply to documents that match this path. Wildcards specified as * are allowed. Case-normalized.</a>" [error]="error?.filter_path"></pngx-input-text>
|
<pngx-input-text i18n-title title="Filter path" formControlName="filter_path" horizontal="true" i18n-hint hint="Apply to documents that match this path. Wildcards specified as * are allowed. Case-normalized." [error]="error?.filter_path"></pngx-input-text>
|
||||||
<pngx-input-select i18n-title title="Filter mail rule" [items]="mailRules" [allowNull]="true" formControlName="filter_mailrule" i18n-hint hint="Apply to documents consumed via this mail rule." [error]="error?.filter_mailrule"></pngx-input-select>
|
<pngx-input-select i18n-title title="Filter mail rule" [items]="mailRules" horizontal="true" [allowNull]="true" formControlName="filter_mailrule" i18n-hint hint="Apply to documents consumed via this mail rule." [error]="error?.filter_mailrule"></pngx-input-select>
|
||||||
}
|
}
|
||||||
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
|
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
|
||||||
<pngx-input-select i18n-title title="Content matching algorithm" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></pngx-input-select>
|
<pngx-input-select i18n-title title="Content matching algorithm" horizontal="true" [items]="getMatchingAlgorithms()" formControlName="matching_algorithm"></pngx-input-select>
|
||||||
@if (patternRequired) {
|
@if (matchingPatternRequired(formGroup)) {
|
||||||
<pngx-input-text i18n-title title="Content matching pattern" formControlName="match" [error]="error?.match"></pngx-input-text>
|
<pngx-input-text i18n-title title="Content matching pattern" horizontal="true" formControlName="match" [error]="error?.match"></pngx-input-text>
|
||||||
}
|
}
|
||||||
@if (patternRequired) {
|
@if (matchingPatternRequired(formGroup)) {
|
||||||
<pngx-input-check i18n-title title="Case insensitive" formControlName="is_insensitive"></pngx-input-check>
|
<pngx-input-check i18n-title title="Case insensitive" horizontal="true" formControlName="is_insensitive"></pngx-input-check>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
|
|
||||||
<div class="col-md-6">
|
|
||||||
<pngx-input-tags [allowCreate]="false" i18n-title title="Has any of tags" formControlName="filter_has_tags"></pngx-input-tags>
|
|
||||||
<pngx-input-select i18n-title title="Has correspondent" [items]="correspondents" [allowNull]="true" formControlName="filter_has_correspondent"></pngx-input-select>
|
|
||||||
<pngx-input-select i18n-title title="Has document type" [items]="documentTypes" [allowNull]="true" formControlName="filter_has_document_type"></pngx-input-select>
|
|
||||||
<pngx-input-select i18n-title title="Has storage path" [items]="storagePaths" [allowNull]="true" formControlName="filter_has_storage_path"></pngx-input-select>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col">
|
||||||
|
<div class="trigger-filters mb-3">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<label class="form-label mb-0" i18n>Advanced Filters</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-sm btn-outline-primary ms-auto"
|
||||||
|
(click)="addFilter(formGroup)"
|
||||||
|
[disabled]="!canAddFilter(formGroup)"
|
||||||
|
>
|
||||||
|
<i-bs name="plus-circle"></i-bs> <span i18n>Add filter</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<ul class="mt-2 list-group filters" formArrayName="filters">
|
||||||
|
@if (getFiltersFormArray(formGroup).length === 0) {
|
||||||
|
<p class="text-muted small" i18n>No advanced workflow filters defined.</p>
|
||||||
|
}
|
||||||
|
@for (filter of getFiltersFormArray(formGroup).controls; track filter; let filterIndex = $index) {
|
||||||
|
<li [formGroupName]="filterIndex" class="list-group-item">
|
||||||
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
<div class="w-25">
|
||||||
|
<pngx-input-select
|
||||||
|
i18n-title
|
||||||
|
[items]="getFilterTypeOptions(formGroup, filterIndex)"
|
||||||
|
formControlName="type"
|
||||||
|
[allowNull]="false"
|
||||||
|
></pngx-input-select>
|
||||||
|
</div>
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
@if (isTagsFilter(filter.get('type').value)) {
|
||||||
|
<pngx-input-tags
|
||||||
|
[allowCreate]="false"
|
||||||
|
[title]="null"
|
||||||
|
formControlName="values"
|
||||||
|
></pngx-input-tags>
|
||||||
|
} @else if (
|
||||||
|
isCustomFieldQueryFilter(filter.get('type').value)
|
||||||
|
) {
|
||||||
|
<pngx-custom-fields-query-dropdown
|
||||||
|
[selectionModel]="getCustomFieldQueryModel(filter)"
|
||||||
|
(selectionModelChange)="onCustomFieldQuerySelectionChange(filter, $event)"
|
||||||
|
[useDropdown]="false"
|
||||||
|
></pngx-custom-fields-query-dropdown>
|
||||||
|
@if (!isCustomFieldQueryValid(filter)) {
|
||||||
|
<div class="text-danger small" i18n>
|
||||||
|
Complete the custom field query configuration.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<pngx-input-select
|
||||||
|
[items]="getFilterSelectItems(filter.get('type').value)"
|
||||||
|
[allowNull]="true"
|
||||||
|
[multiple]="isSelectMultiple(filter.get('type').value)"
|
||||||
|
formControlName="values"
|
||||||
|
></pngx-input-select>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-link text-danger p-0"
|
||||||
|
(click)="removeFilter(formGroup, filterIndex)"
|
||||||
|
>
|
||||||
|
<i-bs name="trash"></i-bs><span class="ms-1" i18n>Delete</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
@@ -362,6 +430,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@case (WorkflowActionType.PasswordRemoval) {
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<p class="small" i18n>
|
||||||
|
One or more passwords separated by commas or new lines. The workflow will try them in order until one succeeds.
|
||||||
|
</p>
|
||||||
|
<pngx-input-textarea
|
||||||
|
i18n-title
|
||||||
|
title="Passwords"
|
||||||
|
formControlName="passwords"
|
||||||
|
rows="4"
|
||||||
|
[error]="error?.actions?.[i]?.passwords"
|
||||||
|
></pngx-input-textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -7,3 +7,11 @@
|
|||||||
.accordion-button {
|
.accordion-button {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host ::ng-deep .filters .paperless-input-select.mb-3 {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-n3 {
|
||||||
|
margin-left: -1rem !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,8 +11,14 @@ import {
|
|||||||
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgSelectModule } from '@ng-select/ng-select'
|
import { NgSelectModule } from '@ng-select/ng-select'
|
||||||
import { of } from 'rxjs'
|
import { of } from 'rxjs'
|
||||||
|
import { CustomFieldQueriesModel } from 'src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
||||||
import { CustomFieldDataType } from 'src/app/data/custom-field'
|
import { CustomFieldDataType } from 'src/app/data/custom-field'
|
||||||
import { MATCHING_ALGORITHMS, MATCH_AUTO } from 'src/app/data/matching-model'
|
import { CustomFieldQueryLogicalOperator } from 'src/app/data/custom-field-query'
|
||||||
|
import {
|
||||||
|
MATCHING_ALGORITHMS,
|
||||||
|
MATCH_AUTO,
|
||||||
|
MATCH_NONE,
|
||||||
|
} from 'src/app/data/matching-model'
|
||||||
import { Workflow } from 'src/app/data/workflow'
|
import { Workflow } from 'src/app/data/workflow'
|
||||||
import {
|
import {
|
||||||
WorkflowAction,
|
WorkflowAction,
|
||||||
@@ -24,13 +30,13 @@ import {
|
|||||||
} from 'src/app/data/workflow-trigger'
|
} from 'src/app/data/workflow-trigger'
|
||||||
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
import { IfOwnerDirective } from 'src/app/directives/if-owner.directive'
|
||||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
|
||||||
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service'
|
||||||
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
|
||||||
import { MailRuleService } from 'src/app/services/rest/mail-rule.service'
|
import { MailRuleService } from 'src/app/services/rest/mail-rule.service'
|
||||||
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
||||||
import { SettingsService } from 'src/app/services/settings.service'
|
import { SettingsService } from 'src/app/services/settings.service'
|
||||||
|
import { CustomFieldQueryExpression } from 'src/app/utils/custom-field-query-element'
|
||||||
import { ConfirmButtonComponent } from '../../confirm-button/confirm-button.component'
|
import { ConfirmButtonComponent } from '../../confirm-button/confirm-button.component'
|
||||||
import { NumberComponent } from '../../input/number/number.component'
|
import { NumberComponent } from '../../input/number/number.component'
|
||||||
import { PermissionsGroupComponent } from '../../input/permissions/permissions-group/permissions-group.component'
|
import { PermissionsGroupComponent } from '../../input/permissions/permissions-group/permissions-group.component'
|
||||||
@@ -43,6 +49,7 @@ import { EditDialogMode } from '../edit-dialog.component'
|
|||||||
import {
|
import {
|
||||||
DOCUMENT_SOURCE_OPTIONS,
|
DOCUMENT_SOURCE_OPTIONS,
|
||||||
SCHEDULE_DATE_FIELD_OPTIONS,
|
SCHEDULE_DATE_FIELD_OPTIONS,
|
||||||
|
TriggerFilterType,
|
||||||
WORKFLOW_ACTION_OPTIONS,
|
WORKFLOW_ACTION_OPTIONS,
|
||||||
WORKFLOW_TYPE_OPTIONS,
|
WORKFLOW_TYPE_OPTIONS,
|
||||||
WorkflowEditDialogComponent,
|
WorkflowEditDialogComponent,
|
||||||
@@ -97,7 +104,6 @@ describe('WorkflowEditDialogComponent', () => {
|
|||||||
TagsComponent,
|
TagsComponent,
|
||||||
PermissionsUserComponent,
|
PermissionsUserComponent,
|
||||||
PermissionsGroupComponent,
|
PermissionsGroupComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
ConfirmButtonComponent,
|
ConfirmButtonComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -375,6 +381,562 @@ describe('WorkflowEditDialogComponent', () => {
|
|||||||
expect(component.objectForm.get('actions').value[0].webhook).toBeNull()
|
expect(component.objectForm.get('actions').value[0].webhook).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should require matching pattern when algorithm is not none', () => {
|
||||||
|
const triggerGroup = new FormGroup({
|
||||||
|
matching_algorithm: new FormControl(MATCH_AUTO),
|
||||||
|
match: new FormControl(''),
|
||||||
|
})
|
||||||
|
expect(component.matchingPatternRequired(triggerGroup)).toBe(true)
|
||||||
|
triggerGroup.get('matching_algorithm').setValue(MATCHING_ALGORITHMS[0].id)
|
||||||
|
expect(component.matchingPatternRequired(triggerGroup)).toBe(true)
|
||||||
|
triggerGroup.get('matching_algorithm').setValue(MATCH_NONE)
|
||||||
|
expect(component.matchingPatternRequired(triggerGroup)).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should map filter builder values into trigger filters on save', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0)
|
||||||
|
component.addFilter(triggerGroup as FormGroup)
|
||||||
|
component.addFilter(triggerGroup as FormGroup)
|
||||||
|
component.addFilter(triggerGroup as FormGroup)
|
||||||
|
|
||||||
|
const filters = component.getFiltersFormArray(triggerGroup as FormGroup)
|
||||||
|
expect(filters.length).toBe(3)
|
||||||
|
|
||||||
|
filters.at(0).get('values').setValue([1])
|
||||||
|
filters.at(1).get('values').setValue([2, 3])
|
||||||
|
filters.at(2).get('values').setValue([4])
|
||||||
|
|
||||||
|
const addFilterOfType = (type: TriggerFilterType) => {
|
||||||
|
const newFilter = component.addFilter(triggerGroup as FormGroup)
|
||||||
|
newFilter.get('type').setValue(type)
|
||||||
|
return newFilter
|
||||||
|
}
|
||||||
|
|
||||||
|
const correspondentIs = addFilterOfType(TriggerFilterType.CorrespondentIs)
|
||||||
|
correspondentIs.get('values').setValue(1)
|
||||||
|
|
||||||
|
const correspondentNot = addFilterOfType(TriggerFilterType.CorrespondentNot)
|
||||||
|
correspondentNot.get('values').setValue([1])
|
||||||
|
|
||||||
|
const documentTypeIs = addFilterOfType(TriggerFilterType.DocumentTypeIs)
|
||||||
|
documentTypeIs.get('values').setValue(1)
|
||||||
|
|
||||||
|
const documentTypeNot = addFilterOfType(TriggerFilterType.DocumentTypeNot)
|
||||||
|
documentTypeNot.get('values').setValue([1])
|
||||||
|
|
||||||
|
const storagePathIs = addFilterOfType(TriggerFilterType.StoragePathIs)
|
||||||
|
storagePathIs.get('values').setValue(1)
|
||||||
|
|
||||||
|
const storagePathNot = addFilterOfType(TriggerFilterType.StoragePathNot)
|
||||||
|
storagePathNot.get('values').setValue([1])
|
||||||
|
|
||||||
|
const customFieldFilter = addFilterOfType(
|
||||||
|
TriggerFilterType.CustomFieldQuery
|
||||||
|
)
|
||||||
|
const customFieldQuery = JSON.stringify(['AND', [[1, 'exact', 'test']]])
|
||||||
|
customFieldFilter.get('values').setValue(customFieldQuery)
|
||||||
|
|
||||||
|
const formValues = component['getFormValues']()
|
||||||
|
|
||||||
|
expect(formValues.triggers[0].filter_has_tags).toEqual([1])
|
||||||
|
expect(formValues.triggers[0].filter_has_all_tags).toEqual([2, 3])
|
||||||
|
expect(formValues.triggers[0].filter_has_not_tags).toEqual([4])
|
||||||
|
expect(formValues.triggers[0].filter_has_correspondent).toEqual(1)
|
||||||
|
expect(formValues.triggers[0].filter_has_not_correspondents).toEqual([1])
|
||||||
|
expect(formValues.triggers[0].filter_has_document_type).toEqual(1)
|
||||||
|
expect(formValues.triggers[0].filter_has_not_document_types).toEqual([1])
|
||||||
|
expect(formValues.triggers[0].filter_has_storage_path).toEqual(1)
|
||||||
|
expect(formValues.triggers[0].filter_has_not_storage_paths).toEqual([1])
|
||||||
|
expect(formValues.triggers[0].filter_custom_field_query).toEqual(
|
||||||
|
customFieldQuery
|
||||||
|
)
|
||||||
|
expect(formValues.triggers[0].filters).toBeUndefined()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should ignore empty and null filter values when mapping filters', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
const tagsFilter = component.addFilter(triggerGroup)
|
||||||
|
tagsFilter.get('type').setValue(TriggerFilterType.TagsAny)
|
||||||
|
tagsFilter.get('values').setValue([])
|
||||||
|
|
||||||
|
const correspondentFilter = component.addFilter(triggerGroup)
|
||||||
|
correspondentFilter.get('type').setValue(TriggerFilterType.CorrespondentIs)
|
||||||
|
correspondentFilter.get('values').setValue(null)
|
||||||
|
|
||||||
|
const formValues = component['getFormValues']()
|
||||||
|
|
||||||
|
expect(formValues.triggers[0].filter_has_tags).toEqual([])
|
||||||
|
expect(formValues.triggers[0].filter_has_correspondent).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should derive single select filters from array values', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
const addFilterOfType = (type: TriggerFilterType, value: any) => {
|
||||||
|
const filter = component.addFilter(triggerGroup)
|
||||||
|
filter.get('type').setValue(type)
|
||||||
|
filter.get('values').setValue(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
addFilterOfType(TriggerFilterType.CorrespondentIs, [5])
|
||||||
|
addFilterOfType(TriggerFilterType.DocumentTypeIs, [6])
|
||||||
|
addFilterOfType(TriggerFilterType.StoragePathIs, [7])
|
||||||
|
|
||||||
|
const formValues = component['getFormValues']()
|
||||||
|
|
||||||
|
expect(formValues.triggers[0].filter_has_correspondent).toEqual(5)
|
||||||
|
expect(formValues.triggers[0].filter_has_document_type).toEqual(6)
|
||||||
|
expect(formValues.triggers[0].filter_has_storage_path).toEqual(7)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should convert multi-value filter values when aggregating filters', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
const setFilter = (type: TriggerFilterType, value: number): void => {
|
||||||
|
const filter = component.addFilter(triggerGroup) as FormGroup
|
||||||
|
filter.get('type').setValue(type)
|
||||||
|
filter.get('values').setValue(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
setFilter(TriggerFilterType.TagsAll, 11)
|
||||||
|
setFilter(TriggerFilterType.TagsNone, 12)
|
||||||
|
setFilter(TriggerFilterType.CorrespondentNot, 13)
|
||||||
|
setFilter(TriggerFilterType.DocumentTypeNot, 14)
|
||||||
|
setFilter(TriggerFilterType.StoragePathNot, 15)
|
||||||
|
|
||||||
|
const formValues = component['getFormValues']()
|
||||||
|
|
||||||
|
expect(formValues.triggers[0].filter_has_all_tags).toEqual([11])
|
||||||
|
expect(formValues.triggers[0].filter_has_not_tags).toEqual([12])
|
||||||
|
expect(formValues.triggers[0].filter_has_not_correspondents).toEqual([13])
|
||||||
|
expect(formValues.triggers[0].filter_has_not_document_types).toEqual([14])
|
||||||
|
expect(formValues.triggers[0].filter_has_not_storage_paths).toEqual([15])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should reuse filter type options and update disabled state', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
|
||||||
|
const optionsFirst = component.getFilterTypeOptions(triggerGroup, 0)
|
||||||
|
const optionsSecond = component.getFilterTypeOptions(triggerGroup, 0)
|
||||||
|
expect(optionsFirst).toBe(optionsSecond)
|
||||||
|
|
||||||
|
// to force disabled flag
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
const filterArray = component.getFiltersFormArray(triggerGroup)
|
||||||
|
const firstFilter = filterArray.at(0)
|
||||||
|
firstFilter.get('type').setValue(TriggerFilterType.CorrespondentIs)
|
||||||
|
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
const updatedFilters = component.getFiltersFormArray(triggerGroup)
|
||||||
|
const secondFilter = updatedFilters.at(1)
|
||||||
|
const options = component.getFilterTypeOptions(triggerGroup, 1)
|
||||||
|
const correspondentIsOption = options.find(
|
||||||
|
(option) => option.id === TriggerFilterType.CorrespondentIs
|
||||||
|
)
|
||||||
|
expect(correspondentIsOption.disabled).toBe(true)
|
||||||
|
|
||||||
|
firstFilter.get('type').setValue(TriggerFilterType.DocumentTypeNot)
|
||||||
|
secondFilter.get('type').setValue(TriggerFilterType.TagsAll)
|
||||||
|
const postChangeOptions = component.getFilterTypeOptions(triggerGroup, 1)
|
||||||
|
const correspondentOptionAfter = postChangeOptions.find(
|
||||||
|
(option) => option.id === TriggerFilterType.CorrespondentIs
|
||||||
|
)
|
||||||
|
expect(correspondentOptionAfter.disabled).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should keep multi-entry filter options enabled and allow duplicates', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
component.filterDefinitions = [
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.TagsAny,
|
||||||
|
name: 'Any tags',
|
||||||
|
inputType: 'tags',
|
||||||
|
allowMultipleEntries: true,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
} as any,
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CorrespondentIs,
|
||||||
|
name: 'Correspondent is',
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'correspondents',
|
||||||
|
} as any,
|
||||||
|
]
|
||||||
|
|
||||||
|
const firstFilter = component.addFilter(triggerGroup)
|
||||||
|
firstFilter.get('type').setValue(TriggerFilterType.TagsAny)
|
||||||
|
|
||||||
|
const secondFilter = component.addFilter(triggerGroup)
|
||||||
|
expect(secondFilter).not.toBeNull()
|
||||||
|
|
||||||
|
const options = component.getFilterTypeOptions(triggerGroup, 1)
|
||||||
|
const multiEntryOption = options.find(
|
||||||
|
(option) => option.id === TriggerFilterType.TagsAny
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(multiEntryOption.disabled).toBe(false)
|
||||||
|
expect(component.canAddFilter(triggerGroup)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return null when no filter definitions remain available', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
component.filterDefinitions = [
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.TagsAny,
|
||||||
|
name: 'Any tags',
|
||||||
|
inputType: 'tags',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
} as any,
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CorrespondentIs,
|
||||||
|
name: 'Correspondent is',
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'correspondents',
|
||||||
|
} as any,
|
||||||
|
]
|
||||||
|
|
||||||
|
const firstFilter = component.addFilter(triggerGroup)
|
||||||
|
firstFilter.get('type').setValue(TriggerFilterType.TagsAny)
|
||||||
|
const secondFilter = component.addFilter(triggerGroup)
|
||||||
|
secondFilter.get('type').setValue(TriggerFilterType.CorrespondentIs)
|
||||||
|
|
||||||
|
expect(component.canAddFilter(triggerGroup)).toBe(false)
|
||||||
|
expect(component.addFilter(triggerGroup)).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should skip filter definitions without handlers when building form array', () => {
|
||||||
|
const originalDefinitions = component.filterDefinitions
|
||||||
|
component.filterDefinitions = [
|
||||||
|
{
|
||||||
|
id: 999,
|
||||||
|
name: 'Unsupported',
|
||||||
|
inputType: 'text',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
} as any,
|
||||||
|
]
|
||||||
|
|
||||||
|
const trigger = {
|
||||||
|
filter_has_tags: [],
|
||||||
|
filter_has_all_tags: [],
|
||||||
|
filter_has_not_tags: [],
|
||||||
|
filter_has_not_correspondents: [],
|
||||||
|
filter_has_not_document_types: [],
|
||||||
|
filter_has_not_storage_paths: [],
|
||||||
|
filter_has_correspondent: null,
|
||||||
|
filter_has_document_type: null,
|
||||||
|
filter_has_storage_path: null,
|
||||||
|
filter_custom_field_query: null,
|
||||||
|
} as any
|
||||||
|
|
||||||
|
const filters = component['buildFiltersFormArray'](trigger)
|
||||||
|
expect(filters.length).toBe(0)
|
||||||
|
|
||||||
|
component.filterDefinitions = originalDefinitions
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return null when adding filter for unknown trigger form group', () => {
|
||||||
|
expect(component.addFilter(new FormGroup({}) as any)).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should ignore remove filter calls for unknown trigger form group', () => {
|
||||||
|
expect(() =>
|
||||||
|
component.removeFilter(new FormGroup({}) as any, 0)
|
||||||
|
).not.toThrow()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should teardown custom field query model when removing a custom field filter', () => {
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
const filters = component.getFiltersFormArray(triggerGroup)
|
||||||
|
const filterGroup = filters.at(0) as FormGroup
|
||||||
|
filterGroup.get('type').setValue(TriggerFilterType.CustomFieldQuery)
|
||||||
|
|
||||||
|
const model = component.getCustomFieldQueryModel(filterGroup)
|
||||||
|
expect(model).toBeDefined()
|
||||||
|
expect(
|
||||||
|
component['getStoredCustomFieldQueryModel'](filterGroup as any)
|
||||||
|
).toBe(model)
|
||||||
|
|
||||||
|
component.removeFilter(triggerGroup, 0)
|
||||||
|
expect(
|
||||||
|
component['getStoredCustomFieldQueryModel'](filterGroup as any)
|
||||||
|
).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return readable filter names', () => {
|
||||||
|
expect(component.getFilterName(TriggerFilterType.TagsAny)).toBe(
|
||||||
|
'Has any of these tags'
|
||||||
|
)
|
||||||
|
expect(component.getFilterName(999 as any)).toBe('')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should build filter form array from existing trigger filters', () => {
|
||||||
|
const trigger = workflow.triggers[0]
|
||||||
|
trigger.filter_has_tags = [1]
|
||||||
|
trigger.filter_has_all_tags = [2, 3]
|
||||||
|
trigger.filter_has_not_tags = [4]
|
||||||
|
trigger.filter_has_correspondent = 5 as any
|
||||||
|
trigger.filter_has_not_correspondents = [6] as any
|
||||||
|
trigger.filter_has_document_type = 7 as any
|
||||||
|
trigger.filter_has_not_document_types = [8] as any
|
||||||
|
trigger.filter_has_storage_path = 9 as any
|
||||||
|
trigger.filter_has_not_storage_paths = [10] as any
|
||||||
|
trigger.filter_custom_field_query = JSON.stringify([
|
||||||
|
'AND',
|
||||||
|
[[1, 'exact', 'value']],
|
||||||
|
]) as any
|
||||||
|
|
||||||
|
component.object = workflow
|
||||||
|
component.ngOnInit()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
const filters = component.getFiltersFormArray(triggerGroup)
|
||||||
|
expect(filters.length).toBe(10)
|
||||||
|
const customFieldFilter = filters.at(9) as FormGroup
|
||||||
|
expect(customFieldFilter.get('type').value).toBe(
|
||||||
|
TriggerFilterType.CustomFieldQuery
|
||||||
|
)
|
||||||
|
const model = component.getCustomFieldQueryModel(customFieldFilter)
|
||||||
|
expect(model.isValid()).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should expose select metadata helpers', () => {
|
||||||
|
expect(component.isSelectMultiple(TriggerFilterType.CorrespondentNot)).toBe(
|
||||||
|
true
|
||||||
|
)
|
||||||
|
expect(component.isSelectMultiple(TriggerFilterType.CorrespondentIs)).toBe(
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
component.correspondents = [{ id: 1, name: 'C1' } as any]
|
||||||
|
component.documentTypes = [{ id: 2, name: 'DT' } as any]
|
||||||
|
component.storagePaths = [{ id: 3, name: 'SP' } as any]
|
||||||
|
|
||||||
|
expect(
|
||||||
|
component.getFilterSelectItems(TriggerFilterType.CorrespondentIs)
|
||||||
|
).toEqual(component.correspondents)
|
||||||
|
expect(
|
||||||
|
component.getFilterSelectItems(TriggerFilterType.DocumentTypeIs)
|
||||||
|
).toEqual(component.documentTypes)
|
||||||
|
expect(
|
||||||
|
component.getFilterSelectItems(TriggerFilterType.StoragePathIs)
|
||||||
|
).toEqual(component.storagePaths)
|
||||||
|
expect(component.getFilterSelectItems(TriggerFilterType.TagsAll)).toEqual(
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(
|
||||||
|
component.isCustomFieldQueryFilter(TriggerFilterType.CustomFieldQuery)
|
||||||
|
).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return empty select items when definition is missing', () => {
|
||||||
|
const originalDefinitions = component.filterDefinitions
|
||||||
|
component.filterDefinitions = []
|
||||||
|
|
||||||
|
expect(
|
||||||
|
component.getFilterSelectItems(TriggerFilterType.CorrespondentIs)
|
||||||
|
).toEqual([])
|
||||||
|
|
||||||
|
component.filterDefinitions = originalDefinitions
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return empty select items when definition has unknown source', () => {
|
||||||
|
const originalDefinitions = component.filterDefinitions
|
||||||
|
component.filterDefinitions = [
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CorrespondentIs,
|
||||||
|
name: 'Correspondent is',
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'unknown',
|
||||||
|
} as any,
|
||||||
|
]
|
||||||
|
|
||||||
|
expect(
|
||||||
|
component.getFilterSelectItems(TriggerFilterType.CorrespondentIs)
|
||||||
|
).toEqual([])
|
||||||
|
|
||||||
|
component.filterDefinitions = originalDefinitions
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should handle custom field query selection change and validation states', () => {
|
||||||
|
const formGroup = new FormGroup({
|
||||||
|
values: new FormControl(null),
|
||||||
|
})
|
||||||
|
const model = new CustomFieldQueriesModel()
|
||||||
|
|
||||||
|
const changeSpy = jest.spyOn(
|
||||||
|
component as any,
|
||||||
|
'onCustomFieldQueryModelChanged'
|
||||||
|
)
|
||||||
|
|
||||||
|
component.onCustomFieldQuerySelectionChange(formGroup, model)
|
||||||
|
expect(changeSpy).toHaveBeenCalledWith(formGroup, model)
|
||||||
|
|
||||||
|
expect(component.isCustomFieldQueryValid(formGroup)).toBe(true)
|
||||||
|
component['setCustomFieldQueryModel'](formGroup as any, model as any)
|
||||||
|
|
||||||
|
const validSpy = jest.spyOn(model, 'isValid').mockReturnValue(false)
|
||||||
|
const emptySpy = jest.spyOn(model, 'isEmpty').mockReturnValue(false)
|
||||||
|
expect(component.isCustomFieldQueryValid(formGroup)).toBe(false)
|
||||||
|
expect(validSpy).toHaveBeenCalled()
|
||||||
|
|
||||||
|
validSpy.mockReturnValue(true)
|
||||||
|
emptySpy.mockReturnValue(true)
|
||||||
|
expect(component.isCustomFieldQueryValid(formGroup)).toBe(true)
|
||||||
|
|
||||||
|
emptySpy.mockReturnValue(false)
|
||||||
|
expect(component.isCustomFieldQueryValid(formGroup)).toBe(true)
|
||||||
|
|
||||||
|
component['clearCustomFieldQueryModel'](formGroup as any)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should recover from invalid custom field query json and update control on changes', () => {
|
||||||
|
const filterGroup = new FormGroup({
|
||||||
|
values: new FormControl('not-json'),
|
||||||
|
})
|
||||||
|
|
||||||
|
component['ensureCustomFieldQueryModel'](filterGroup, 'not-json')
|
||||||
|
|
||||||
|
const model = component['getStoredCustomFieldQueryModel'](
|
||||||
|
filterGroup as any
|
||||||
|
)
|
||||||
|
expect(model).toBeDefined()
|
||||||
|
expect(model.queries.length).toBeGreaterThan(0)
|
||||||
|
|
||||||
|
const valuesControl = filterGroup.get('values')
|
||||||
|
expect(valuesControl.value).toBeNull()
|
||||||
|
|
||||||
|
const expression = new CustomFieldQueryExpression([
|
||||||
|
CustomFieldQueryLogicalOperator.And,
|
||||||
|
[[1, 'exact', 'value']],
|
||||||
|
])
|
||||||
|
model.queries = [expression]
|
||||||
|
|
||||||
|
jest.spyOn(model, 'isValid').mockReturnValue(true)
|
||||||
|
jest.spyOn(model, 'isEmpty').mockReturnValue(false)
|
||||||
|
|
||||||
|
model.changed.next(model)
|
||||||
|
|
||||||
|
expect(valuesControl.value).toEqual(JSON.stringify(expression.serialize()))
|
||||||
|
|
||||||
|
component['clearCustomFieldQueryModel'](filterGroup as any)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should handle custom field query model change edge cases', () => {
|
||||||
|
const groupWithoutControl = new FormGroup({})
|
||||||
|
const dummyModel = {
|
||||||
|
isValid: jest.fn().mockReturnValue(true),
|
||||||
|
isEmpty: jest.fn().mockReturnValue(false),
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(() =>
|
||||||
|
component['onCustomFieldQueryModelChanged'](
|
||||||
|
groupWithoutControl as any,
|
||||||
|
dummyModel as any
|
||||||
|
)
|
||||||
|
).not.toThrow()
|
||||||
|
|
||||||
|
const groupWithControl = new FormGroup({
|
||||||
|
values: new FormControl('initial'),
|
||||||
|
})
|
||||||
|
const emptyModel = {
|
||||||
|
isValid: jest.fn().mockReturnValue(true),
|
||||||
|
isEmpty: jest.fn().mockReturnValue(true),
|
||||||
|
}
|
||||||
|
|
||||||
|
component['onCustomFieldQueryModelChanged'](
|
||||||
|
groupWithControl as any,
|
||||||
|
emptyModel as any
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(groupWithControl.get('values').value).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should normalize filter values for single and multi selects', () => {
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](TriggerFilterType.TagsAny)
|
||||||
|
).toEqual([])
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](TriggerFilterType.TagsAny, 5)
|
||||||
|
).toEqual([5])
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](TriggerFilterType.TagsAny, [5, 6])
|
||||||
|
).toEqual([5, 6])
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](TriggerFilterType.CorrespondentIs, [7])
|
||||||
|
).toEqual(7)
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](TriggerFilterType.CorrespondentIs, 8)
|
||||||
|
).toEqual(8)
|
||||||
|
const customFieldJson = JSON.stringify(['AND', [[1, 'exact', 'test']]])
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](
|
||||||
|
TriggerFilterType.CustomFieldQuery,
|
||||||
|
customFieldJson
|
||||||
|
)
|
||||||
|
).toEqual(customFieldJson)
|
||||||
|
|
||||||
|
const customFieldObject = ['AND', [[1, 'exact', 'other']]]
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](
|
||||||
|
TriggerFilterType.CustomFieldQuery,
|
||||||
|
customFieldObject
|
||||||
|
)
|
||||||
|
).toEqual(JSON.stringify(customFieldObject))
|
||||||
|
|
||||||
|
expect(
|
||||||
|
component['normalizeFilterValue'](
|
||||||
|
TriggerFilterType.CustomFieldQuery,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should add and remove filter form groups', () => {
|
||||||
|
component['changeDetector'] = { detectChanges: jest.fn() } as any
|
||||||
|
component.object = undefined
|
||||||
|
component.addTrigger()
|
||||||
|
const triggerGroup = component.triggerFields.at(0) as FormGroup
|
||||||
|
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
|
||||||
|
component.removeFilter(triggerGroup, 0)
|
||||||
|
expect(component.getFiltersFormArray(triggerGroup).length).toBe(0)
|
||||||
|
|
||||||
|
component.addFilter(triggerGroup)
|
||||||
|
const filterArrayAfterAdd = component.getFiltersFormArray(triggerGroup)
|
||||||
|
filterArrayAfterAdd.at(0).get('type').setValue(TriggerFilterType.TagsAll)
|
||||||
|
expect(component.getFiltersFormArray(triggerGroup).length).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
it('should remove selected custom field from the form group', () => {
|
it('should remove selected custom field from the form group', () => {
|
||||||
const formGroup = new FormGroup({
|
const formGroup = new FormGroup({
|
||||||
assign_custom_fields: new FormControl([1, 2, 3]),
|
assign_custom_fields: new FormControl([1, 2, 3]),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
import { NgTemplateOutlet } from '@angular/common'
|
import { NgTemplateOutlet } from '@angular/common'
|
||||||
import { Component, OnInit, inject } from '@angular/core'
|
import { Component, OnInit, inject } from '@angular/core'
|
||||||
import {
|
import {
|
||||||
|
AbstractControl,
|
||||||
FormArray,
|
FormArray,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
@@ -14,7 +15,7 @@ import {
|
|||||||
} from '@angular/forms'
|
} from '@angular/forms'
|
||||||
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { first } from 'rxjs'
|
import { Subscription, first, takeUntil } from 'rxjs'
|
||||||
import { Correspondent } from 'src/app/data/correspondent'
|
import { Correspondent } from 'src/app/data/correspondent'
|
||||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||||
import { DocumentType } from 'src/app/data/document-type'
|
import { DocumentType } from 'src/app/data/document-type'
|
||||||
@@ -45,7 +46,12 @@ import { StoragePathService } from 'src/app/services/rest/storage-path.service'
|
|||||||
import { UserService } from 'src/app/services/rest/user.service'
|
import { UserService } from 'src/app/services/rest/user.service'
|
||||||
import { WorkflowService } from 'src/app/services/rest/workflow.service'
|
import { WorkflowService } from 'src/app/services/rest/workflow.service'
|
||||||
import { SettingsService } from 'src/app/services/settings.service'
|
import { SettingsService } from 'src/app/services/settings.service'
|
||||||
|
import { CustomFieldQueryExpression } from 'src/app/utils/custom-field-query-element'
|
||||||
import { ConfirmButtonComponent } from '../../confirm-button/confirm-button.component'
|
import { ConfirmButtonComponent } from '../../confirm-button/confirm-button.component'
|
||||||
|
import {
|
||||||
|
CustomFieldQueriesModel,
|
||||||
|
CustomFieldsQueryDropdownComponent,
|
||||||
|
} from '../../custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
||||||
import { CheckComponent } from '../../input/check/check.component'
|
import { CheckComponent } from '../../input/check/check.component'
|
||||||
import { CustomFieldsValuesComponent } from '../../input/custom-fields-values/custom-fields-values.component'
|
import { CustomFieldsValuesComponent } from '../../input/custom-fields-values/custom-fields-values.component'
|
||||||
import { EntriesComponent } from '../../input/entries/entries.component'
|
import { EntriesComponent } from '../../input/entries/entries.component'
|
||||||
@@ -133,12 +139,241 @@ export const WORKFLOW_ACTION_OPTIONS = [
|
|||||||
id: WorkflowActionType.Webhook,
|
id: WorkflowActionType.Webhook,
|
||||||
name: $localize`Webhook`,
|
name: $localize`Webhook`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: WorkflowActionType.PasswordRemoval,
|
||||||
|
name: $localize`Password removal`,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export enum TriggerFilterType {
|
||||||
|
TagsAny = 'tags_any',
|
||||||
|
TagsAll = 'tags_all',
|
||||||
|
TagsNone = 'tags_none',
|
||||||
|
CorrespondentIs = 'correspondent_is',
|
||||||
|
CorrespondentNot = 'correspondent_not',
|
||||||
|
DocumentTypeIs = 'document_type_is',
|
||||||
|
DocumentTypeNot = 'document_type_not',
|
||||||
|
StoragePathIs = 'storage_path_is',
|
||||||
|
StoragePathNot = 'storage_path_not',
|
||||||
|
CustomFieldQuery = 'custom_field_query',
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TriggerFilterDefinition {
|
||||||
|
id: TriggerFilterType
|
||||||
|
name: string
|
||||||
|
inputType: 'tags' | 'select' | 'customFieldQuery'
|
||||||
|
allowMultipleEntries: boolean
|
||||||
|
allowMultipleValues: boolean
|
||||||
|
selectItems?: 'correspondents' | 'documentTypes' | 'storagePaths'
|
||||||
|
disabled?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
type TriggerFilterOption = TriggerFilterDefinition & {
|
||||||
|
disabled?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
type TriggerFilterAggregate = {
|
||||||
|
filter_has_tags: number[]
|
||||||
|
filter_has_all_tags: number[]
|
||||||
|
filter_has_not_tags: number[]
|
||||||
|
filter_has_not_correspondents: number[]
|
||||||
|
filter_has_not_document_types: number[]
|
||||||
|
filter_has_not_storage_paths: number[]
|
||||||
|
filter_has_correspondent: number | null
|
||||||
|
filter_has_document_type: number | null
|
||||||
|
filter_has_storage_path: number | null
|
||||||
|
filter_custom_field_query: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FilterHandler {
|
||||||
|
apply: (aggregate: TriggerFilterAggregate, values: any) => void
|
||||||
|
extract: (trigger: WorkflowTrigger) => any
|
||||||
|
hasValue: (value: any) => boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const CUSTOM_FIELD_QUERY_MODEL_KEY = Symbol('customFieldQueryModel')
|
||||||
|
const CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY = Symbol(
|
||||||
|
'customFieldQuerySubscription'
|
||||||
|
)
|
||||||
|
|
||||||
|
type CustomFieldFilterGroup = FormGroup & {
|
||||||
|
[CUSTOM_FIELD_QUERY_MODEL_KEY]?: CustomFieldQueriesModel
|
||||||
|
[CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY]?: Subscription
|
||||||
|
}
|
||||||
|
|
||||||
|
const TRIGGER_FILTER_DEFINITIONS: TriggerFilterDefinition[] = [
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.TagsAny,
|
||||||
|
name: $localize`Has any of these tags`,
|
||||||
|
inputType: 'tags',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.TagsAll,
|
||||||
|
name: $localize`Has all of these tags`,
|
||||||
|
inputType: 'tags',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.TagsNone,
|
||||||
|
name: $localize`Does not have these tags`,
|
||||||
|
inputType: 'tags',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CorrespondentIs,
|
||||||
|
name: $localize`Has correspondent`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'correspondents',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CorrespondentNot,
|
||||||
|
name: $localize`Does not have correspondents`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
selectItems: 'correspondents',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.DocumentTypeIs,
|
||||||
|
name: $localize`Has document type`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'documentTypes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.DocumentTypeNot,
|
||||||
|
name: $localize`Does not have document types`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
selectItems: 'documentTypes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.StoragePathIs,
|
||||||
|
name: $localize`Has storage path`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
selectItems: 'storagePaths',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.StoragePathNot,
|
||||||
|
name: $localize`Does not have storage paths`,
|
||||||
|
inputType: 'select',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: true,
|
||||||
|
selectItems: 'storagePaths',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TriggerFilterType.CustomFieldQuery,
|
||||||
|
name: $localize`Matches custom field query`,
|
||||||
|
inputType: 'customFieldQuery',
|
||||||
|
allowMultipleEntries: false,
|
||||||
|
allowMultipleValues: false,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const TRIGGER_MATCHING_ALGORITHMS = MATCHING_ALGORITHMS.filter(
|
const TRIGGER_MATCHING_ALGORITHMS = MATCHING_ALGORITHMS.filter(
|
||||||
(a) => a.id !== MATCH_AUTO
|
(a) => a.id !== MATCH_AUTO
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const FILTER_HANDLERS: Record<TriggerFilterType, FilterHandler> = {
|
||||||
|
[TriggerFilterType.TagsAny]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_tags = Array.isArray(values) ? [...values] : [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_tags,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.TagsAll]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_all_tags = Array.isArray(values)
|
||||||
|
? [...values]
|
||||||
|
: [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_all_tags,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.TagsNone]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_not_tags = Array.isArray(values)
|
||||||
|
? [...values]
|
||||||
|
: [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_not_tags,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.CorrespondentIs]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_correspondent = Array.isArray(values)
|
||||||
|
? (values[0] ?? null)
|
||||||
|
: values
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_correspondent,
|
||||||
|
hasValue: (value) => value !== null && value !== undefined,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.CorrespondentNot]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_not_correspondents = Array.isArray(values)
|
||||||
|
? [...values]
|
||||||
|
: [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_not_correspondents,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.DocumentTypeIs]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_document_type = Array.isArray(values)
|
||||||
|
? (values[0] ?? null)
|
||||||
|
: values
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_document_type,
|
||||||
|
hasValue: (value) => value !== null && value !== undefined,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.DocumentTypeNot]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_not_document_types = Array.isArray(values)
|
||||||
|
? [...values]
|
||||||
|
: [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_not_document_types,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.StoragePathIs]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_storage_path = Array.isArray(values)
|
||||||
|
? (values[0] ?? null)
|
||||||
|
: values
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_storage_path,
|
||||||
|
hasValue: (value) => value !== null && value !== undefined,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.StoragePathNot]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_has_not_storage_paths = Array.isArray(values)
|
||||||
|
? [...values]
|
||||||
|
: [values]
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_has_not_storage_paths,
|
||||||
|
hasValue: (value) => Array.isArray(value) && value.length > 0,
|
||||||
|
},
|
||||||
|
[TriggerFilterType.CustomFieldQuery]: {
|
||||||
|
apply: (aggregate, values) => {
|
||||||
|
aggregate.filter_custom_field_query = values as string
|
||||||
|
},
|
||||||
|
extract: (trigger) => trigger.filter_custom_field_query,
|
||||||
|
hasValue: (value) =>
|
||||||
|
typeof value === 'string' && value !== null && value.trim().length > 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pngx-workflow-edit-dialog',
|
selector: 'pngx-workflow-edit-dialog',
|
||||||
templateUrl: './workflow-edit-dialog.component.html',
|
templateUrl: './workflow-edit-dialog.component.html',
|
||||||
@@ -153,6 +388,7 @@ const TRIGGER_MATCHING_ALGORITHMS = MATCHING_ALGORITHMS.filter(
|
|||||||
TextAreaComponent,
|
TextAreaComponent,
|
||||||
TagsComponent,
|
TagsComponent,
|
||||||
CustomFieldsValuesComponent,
|
CustomFieldsValuesComponent,
|
||||||
|
CustomFieldsQueryDropdownComponent,
|
||||||
PermissionsGroupComponent,
|
PermissionsGroupComponent,
|
||||||
PermissionsUserComponent,
|
PermissionsUserComponent,
|
||||||
ConfirmButtonComponent,
|
ConfirmButtonComponent,
|
||||||
@@ -170,6 +406,8 @@ export class WorkflowEditDialogComponent
|
|||||||
{
|
{
|
||||||
public WorkflowTriggerType = WorkflowTriggerType
|
public WorkflowTriggerType = WorkflowTriggerType
|
||||||
public WorkflowActionType = WorkflowActionType
|
public WorkflowActionType = WorkflowActionType
|
||||||
|
public TriggerFilterType = TriggerFilterType
|
||||||
|
public filterDefinitions = TRIGGER_FILTER_DEFINITIONS
|
||||||
|
|
||||||
private correspondentService: CorrespondentService
|
private correspondentService: CorrespondentService
|
||||||
private documentTypeService: DocumentTypeService
|
private documentTypeService: DocumentTypeService
|
||||||
@@ -189,6 +427,11 @@ export class WorkflowEditDialogComponent
|
|||||||
|
|
||||||
private allowedActionTypes = []
|
private allowedActionTypes = []
|
||||||
|
|
||||||
|
private readonly triggerFilterOptionsMap = new WeakMap<
|
||||||
|
FormArray,
|
||||||
|
TriggerFilterOption[]
|
||||||
|
>()
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.service = inject(WorkflowService)
|
this.service = inject(WorkflowService)
|
||||||
@@ -390,6 +633,416 @@ export class WorkflowEditDialogComponent
|
|||||||
return this.objectForm.get('actions') as FormArray
|
return this.objectForm.get('actions') as FormArray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override getFormValues(): any {
|
||||||
|
const formValues = super.getFormValues()
|
||||||
|
|
||||||
|
if (formValues?.triggers?.length) {
|
||||||
|
formValues.triggers = formValues.triggers.map(
|
||||||
|
(trigger: any, index: number) => {
|
||||||
|
const triggerFormGroup = this.triggerFields.at(index) as FormGroup
|
||||||
|
const filters = this.getFiltersFormArray(triggerFormGroup)
|
||||||
|
|
||||||
|
const aggregate: TriggerFilterAggregate = {
|
||||||
|
filter_has_tags: [],
|
||||||
|
filter_has_all_tags: [],
|
||||||
|
filter_has_not_tags: [],
|
||||||
|
filter_has_not_correspondents: [],
|
||||||
|
filter_has_not_document_types: [],
|
||||||
|
filter_has_not_storage_paths: [],
|
||||||
|
filter_has_correspondent: null,
|
||||||
|
filter_has_document_type: null,
|
||||||
|
filter_has_storage_path: null,
|
||||||
|
filter_custom_field_query: null,
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const control of filters.controls) {
|
||||||
|
const type = control.get('type').value as TriggerFilterType
|
||||||
|
const values = control.get('values').value
|
||||||
|
|
||||||
|
if (values === null || values === undefined) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(values) && values.length === 0) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const handler = FILTER_HANDLERS[type]
|
||||||
|
handler?.apply(aggregate, values)
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger.filter_has_tags = aggregate.filter_has_tags
|
||||||
|
trigger.filter_has_all_tags = aggregate.filter_has_all_tags
|
||||||
|
trigger.filter_has_not_tags = aggregate.filter_has_not_tags
|
||||||
|
trigger.filter_has_not_correspondents =
|
||||||
|
aggregate.filter_has_not_correspondents
|
||||||
|
trigger.filter_has_not_document_types =
|
||||||
|
aggregate.filter_has_not_document_types
|
||||||
|
trigger.filter_has_not_storage_paths =
|
||||||
|
aggregate.filter_has_not_storage_paths
|
||||||
|
trigger.filter_has_correspondent =
|
||||||
|
aggregate.filter_has_correspondent ?? null
|
||||||
|
trigger.filter_has_document_type =
|
||||||
|
aggregate.filter_has_document_type ?? null
|
||||||
|
trigger.filter_has_storage_path =
|
||||||
|
aggregate.filter_has_storage_path ?? null
|
||||||
|
trigger.filter_custom_field_query =
|
||||||
|
aggregate.filter_custom_field_query ?? null
|
||||||
|
|
||||||
|
delete trigger.filters
|
||||||
|
|
||||||
|
return trigger
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return formValues
|
||||||
|
}
|
||||||
|
|
||||||
|
public matchingPatternRequired(formGroup: FormGroup): boolean {
|
||||||
|
return formGroup.get('matching_algorithm').value !== MATCH_NONE
|
||||||
|
}
|
||||||
|
|
||||||
|
private createFilterFormGroup(
|
||||||
|
type: TriggerFilterType,
|
||||||
|
initialValue?: any
|
||||||
|
): FormGroup {
|
||||||
|
const group = new FormGroup({
|
||||||
|
type: new FormControl(type),
|
||||||
|
values: new FormControl(this.normalizeFilterValue(type, initialValue)),
|
||||||
|
})
|
||||||
|
|
||||||
|
group.get('type').valueChanges.subscribe((newType: TriggerFilterType) => {
|
||||||
|
if (newType === TriggerFilterType.CustomFieldQuery) {
|
||||||
|
this.ensureCustomFieldQueryModel(group)
|
||||||
|
} else {
|
||||||
|
this.clearCustomFieldQueryModel(group)
|
||||||
|
group.get('values').setValue(this.getDefaultFilterValue(newType), {
|
||||||
|
emitEvent: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (type === TriggerFilterType.CustomFieldQuery) {
|
||||||
|
this.ensureCustomFieldQueryModel(group, initialValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
return group
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildFiltersFormArray(trigger: WorkflowTrigger): FormArray {
|
||||||
|
const filters = new FormArray([])
|
||||||
|
|
||||||
|
for (const definition of this.filterDefinitions) {
|
||||||
|
const handler = FILTER_HANDLERS[definition.id]
|
||||||
|
if (!handler) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = handler.extract(trigger)
|
||||||
|
if (!handler.hasValue(value)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
filters.push(this.createFilterFormGroup(definition.id, value))
|
||||||
|
}
|
||||||
|
|
||||||
|
return filters
|
||||||
|
}
|
||||||
|
|
||||||
|
getFiltersFormArray(formGroup: FormGroup): FormArray {
|
||||||
|
return formGroup.get('filters') as FormArray
|
||||||
|
}
|
||||||
|
|
||||||
|
getFilterTypeOptions(formGroup: FormGroup, filterIndex: number) {
|
||||||
|
const filters = this.getFiltersFormArray(formGroup)
|
||||||
|
const options = this.getFilterTypeOptionsForArray(filters)
|
||||||
|
const currentType = filters.at(filterIndex).get('type')
|
||||||
|
.value as TriggerFilterType
|
||||||
|
const usedTypes = new Set(
|
||||||
|
filters.controls.map(
|
||||||
|
(control) => control.get('type').value as TriggerFilterType
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for (const option of options) {
|
||||||
|
if (option.allowMultipleEntries) {
|
||||||
|
option.disabled = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
option.disabled = usedTypes.has(option.id) && option.id !== currentType
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
|
||||||
|
canAddFilter(formGroup: FormGroup): boolean {
|
||||||
|
const filters = this.getFiltersFormArray(formGroup)
|
||||||
|
const usedTypes = new Set(
|
||||||
|
filters.controls.map(
|
||||||
|
(control) => control.get('type').value as TriggerFilterType
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return this.filterDefinitions.some((definition) => {
|
||||||
|
if (definition.allowMultipleEntries) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return !usedTypes.has(definition.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
addFilter(triggerFormGroup: FormGroup): FormGroup | null {
|
||||||
|
const triggerIndex = this.triggerFields.controls.indexOf(triggerFormGroup)
|
||||||
|
if (triggerIndex === -1) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const filters = this.getFiltersFormArray(triggerFormGroup)
|
||||||
|
|
||||||
|
const availableDefinition = this.filterDefinitions.find((definition) => {
|
||||||
|
if (definition.allowMultipleEntries) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return !filters.controls.some(
|
||||||
|
(control) => control.get('type').value === definition.id
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!availableDefinition) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
filters.push(this.createFilterFormGroup(availableDefinition.id))
|
||||||
|
triggerFormGroup.markAsDirty()
|
||||||
|
triggerFormGroup.markAsTouched()
|
||||||
|
|
||||||
|
return filters.at(-1) as FormGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
removeFilter(triggerFormGroup: FormGroup, filterIndex: number) {
|
||||||
|
const triggerIndex = this.triggerFields.controls.indexOf(triggerFormGroup)
|
||||||
|
if (triggerIndex === -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const filters = this.getFiltersFormArray(triggerFormGroup)
|
||||||
|
const filterGroup = filters.at(filterIndex) as FormGroup
|
||||||
|
if (filterGroup?.get('type').value === TriggerFilterType.CustomFieldQuery) {
|
||||||
|
this.clearCustomFieldQueryModel(filterGroup)
|
||||||
|
}
|
||||||
|
filters.removeAt(filterIndex)
|
||||||
|
triggerFormGroup.markAsDirty()
|
||||||
|
triggerFormGroup.markAsTouched()
|
||||||
|
}
|
||||||
|
|
||||||
|
getFilterDefinition(
|
||||||
|
type: TriggerFilterType
|
||||||
|
): TriggerFilterDefinition | undefined {
|
||||||
|
return this.filterDefinitions.find((definition) => definition.id === type)
|
||||||
|
}
|
||||||
|
|
||||||
|
getFilterName(type: TriggerFilterType): string {
|
||||||
|
return this.getFilterDefinition(type)?.name ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
isTagsFilter(type: TriggerFilterType): boolean {
|
||||||
|
return this.getFilterDefinition(type)?.inputType === 'tags'
|
||||||
|
}
|
||||||
|
|
||||||
|
isCustomFieldQueryFilter(type: TriggerFilterType): boolean {
|
||||||
|
return this.getFilterDefinition(type)?.inputType === 'customFieldQuery'
|
||||||
|
}
|
||||||
|
|
||||||
|
isMultiValueFilter(type: TriggerFilterType): boolean {
|
||||||
|
switch (type) {
|
||||||
|
case TriggerFilterType.TagsAny:
|
||||||
|
case TriggerFilterType.TagsAll:
|
||||||
|
case TriggerFilterType.TagsNone:
|
||||||
|
case TriggerFilterType.CorrespondentNot:
|
||||||
|
case TriggerFilterType.DocumentTypeNot:
|
||||||
|
case TriggerFilterType.StoragePathNot:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isSelectMultiple(type: TriggerFilterType): boolean {
|
||||||
|
return !this.isTagsFilter(type) && this.isMultiValueFilter(type)
|
||||||
|
}
|
||||||
|
|
||||||
|
getFilterSelectItems(type: TriggerFilterType) {
|
||||||
|
const definition = this.getFilterDefinition(type)
|
||||||
|
if (!definition || definition.inputType !== 'select') {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (definition.selectItems) {
|
||||||
|
case 'correspondents':
|
||||||
|
return this.correspondents
|
||||||
|
case 'documentTypes':
|
||||||
|
return this.documentTypes
|
||||||
|
case 'storagePaths':
|
||||||
|
return this.storagePaths
|
||||||
|
default:
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getCustomFieldQueryModel(control: AbstractControl): CustomFieldQueriesModel {
|
||||||
|
return this.ensureCustomFieldQueryModel(control as FormGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
onCustomFieldQuerySelectionChange(
|
||||||
|
control: AbstractControl,
|
||||||
|
model: CustomFieldQueriesModel
|
||||||
|
) {
|
||||||
|
this.onCustomFieldQueryModelChanged(control as FormGroup, model)
|
||||||
|
}
|
||||||
|
|
||||||
|
isCustomFieldQueryValid(control: AbstractControl): boolean {
|
||||||
|
const model = this.getStoredCustomFieldQueryModel(control as FormGroup)
|
||||||
|
if (!model) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return model.isEmpty() || model.isValid()
|
||||||
|
}
|
||||||
|
|
||||||
|
private getFilterTypeOptionsForArray(
|
||||||
|
filters: FormArray
|
||||||
|
): TriggerFilterOption[] {
|
||||||
|
let cached = this.triggerFilterOptionsMap.get(filters)
|
||||||
|
if (!cached) {
|
||||||
|
cached = this.filterDefinitions.map((definition) => ({
|
||||||
|
...definition,
|
||||||
|
disabled: false,
|
||||||
|
}))
|
||||||
|
this.triggerFilterOptionsMap.set(filters, cached)
|
||||||
|
}
|
||||||
|
return cached
|
||||||
|
}
|
||||||
|
|
||||||
|
private ensureCustomFieldQueryModel(
|
||||||
|
filterGroup: FormGroup,
|
||||||
|
initialValue?: any
|
||||||
|
): CustomFieldQueriesModel {
|
||||||
|
const existingModel = this.getStoredCustomFieldQueryModel(filterGroup)
|
||||||
|
if (existingModel) {
|
||||||
|
return existingModel
|
||||||
|
}
|
||||||
|
|
||||||
|
const model = new CustomFieldQueriesModel()
|
||||||
|
this.setCustomFieldQueryModel(filterGroup, model)
|
||||||
|
|
||||||
|
const rawValue =
|
||||||
|
typeof initialValue === 'string'
|
||||||
|
? initialValue
|
||||||
|
: (filterGroup.get('values').value as string)
|
||||||
|
|
||||||
|
if (rawValue) {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(rawValue)
|
||||||
|
const expression = new CustomFieldQueryExpression(parsed)
|
||||||
|
model.queries = [expression]
|
||||||
|
} catch {
|
||||||
|
model.clear(false)
|
||||||
|
model.addInitialAtom()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const subscription = model.changed
|
||||||
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
|
.subscribe(() => {
|
||||||
|
this.onCustomFieldQueryModelChanged(filterGroup, model)
|
||||||
|
})
|
||||||
|
filterGroup[CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY]?.unsubscribe()
|
||||||
|
filterGroup[CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY] = subscription
|
||||||
|
|
||||||
|
this.onCustomFieldQueryModelChanged(filterGroup, model)
|
||||||
|
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearCustomFieldQueryModel(filterGroup: FormGroup) {
|
||||||
|
const group = filterGroup as CustomFieldFilterGroup
|
||||||
|
group[CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY]?.unsubscribe()
|
||||||
|
delete group[CUSTOM_FIELD_QUERY_SUBSCRIPTION_KEY]
|
||||||
|
delete group[CUSTOM_FIELD_QUERY_MODEL_KEY]
|
||||||
|
}
|
||||||
|
|
||||||
|
private getStoredCustomFieldQueryModel(
|
||||||
|
filterGroup: FormGroup
|
||||||
|
): CustomFieldQueriesModel | null {
|
||||||
|
return (
|
||||||
|
(filterGroup as CustomFieldFilterGroup)[CUSTOM_FIELD_QUERY_MODEL_KEY] ??
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private setCustomFieldQueryModel(
|
||||||
|
filterGroup: FormGroup,
|
||||||
|
model: CustomFieldQueriesModel
|
||||||
|
) {
|
||||||
|
const group = filterGroup as CustomFieldFilterGroup
|
||||||
|
group[CUSTOM_FIELD_QUERY_MODEL_KEY] = model
|
||||||
|
}
|
||||||
|
|
||||||
|
private onCustomFieldQueryModelChanged(
|
||||||
|
filterGroup: FormGroup,
|
||||||
|
model: CustomFieldQueriesModel
|
||||||
|
) {
|
||||||
|
const control = filterGroup.get('values')
|
||||||
|
if (!control) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model.isValid()) {
|
||||||
|
control.setValue(null, { emitEvent: false })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.isEmpty()) {
|
||||||
|
control.setValue(null, { emitEvent: false })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const serialized = JSON.stringify(model.queries[0].serialize())
|
||||||
|
control.setValue(serialized, { emitEvent: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
private getDefaultFilterValue(type: TriggerFilterType) {
|
||||||
|
if (type === TriggerFilterType.CustomFieldQuery) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.isMultiValueFilter(type) ? [] : null
|
||||||
|
}
|
||||||
|
|
||||||
|
private normalizeFilterValue(type: TriggerFilterType, value?: any) {
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return this.getDefaultFilterValue(type)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === TriggerFilterType.CustomFieldQuery) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
return value ? JSON.stringify(value) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isMultiValueFilter(type)) {
|
||||||
|
return Array.isArray(value) ? [...value] : [value]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return value.length > 0 ? value[0] : null
|
||||||
|
}
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
private createTriggerField(
|
private createTriggerField(
|
||||||
trigger: WorkflowTrigger,
|
trigger: WorkflowTrigger,
|
||||||
emitEvent: boolean = false
|
emitEvent: boolean = false
|
||||||
@@ -405,16 +1058,7 @@ export class WorkflowEditDialogComponent
|
|||||||
matching_algorithm: new FormControl(trigger.matching_algorithm),
|
matching_algorithm: new FormControl(trigger.matching_algorithm),
|
||||||
match: new FormControl(trigger.match),
|
match: new FormControl(trigger.match),
|
||||||
is_insensitive: new FormControl(trigger.is_insensitive),
|
is_insensitive: new FormControl(trigger.is_insensitive),
|
||||||
filter_has_tags: new FormControl(trigger.filter_has_tags),
|
filters: this.buildFiltersFormArray(trigger),
|
||||||
filter_has_correspondent: new FormControl(
|
|
||||||
trigger.filter_has_correspondent
|
|
||||||
),
|
|
||||||
filter_has_document_type: new FormControl(
|
|
||||||
trigger.filter_has_document_type
|
|
||||||
),
|
|
||||||
filter_has_storage_path: new FormControl(
|
|
||||||
trigger.filter_has_storage_path
|
|
||||||
),
|
|
||||||
schedule_offset_days: new FormControl(trigger.schedule_offset_days),
|
schedule_offset_days: new FormControl(trigger.schedule_offset_days),
|
||||||
schedule_is_recurring: new FormControl(trigger.schedule_is_recurring),
|
schedule_is_recurring: new FormControl(trigger.schedule_is_recurring),
|
||||||
schedule_recurring_interval_days: new FormControl(
|
schedule_recurring_interval_days: new FormControl(
|
||||||
@@ -493,6 +1137,7 @@ export class WorkflowEditDialogComponent
|
|||||||
headers: new FormControl(action.webhook?.headers),
|
headers: new FormControl(action.webhook?.headers),
|
||||||
include_document: new FormControl(!!action.webhook?.include_document),
|
include_document: new FormControl(!!action.webhook?.include_document),
|
||||||
}),
|
}),
|
||||||
|
passwords: new FormControl(action.passwords),
|
||||||
}),
|
}),
|
||||||
{ emitEvent }
|
{ emitEvent }
|
||||||
)
|
)
|
||||||
@@ -537,6 +1182,12 @@ export class WorkflowEditDialogComponent
|
|||||||
filter_path: null,
|
filter_path: null,
|
||||||
filter_mailrule: null,
|
filter_mailrule: null,
|
||||||
filter_has_tags: [],
|
filter_has_tags: [],
|
||||||
|
filter_has_all_tags: [],
|
||||||
|
filter_has_not_tags: [],
|
||||||
|
filter_has_not_correspondents: [],
|
||||||
|
filter_has_not_document_types: [],
|
||||||
|
filter_has_not_storage_paths: [],
|
||||||
|
filter_custom_field_query: null,
|
||||||
filter_has_correspondent: null,
|
filter_has_correspondent: null,
|
||||||
filter_has_document_type: null,
|
filter_has_document_type: null,
|
||||||
filter_has_storage_path: null,
|
filter_has_storage_path: null,
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modal-basic-title">{{title}}</h4>
|
<h4 class="modal-title" id="modal-basic-title" i18n>{
|
||||||
|
documentIds.length,
|
||||||
|
plural,
|
||||||
|
=1 {Email Document} other {Email {{documentIds.length}} Documents}
|
||||||
|
}</h4>
|
||||||
<button type="button" class="btn-close" aria-label="Close" (click)="close()"></button>
|
<button type="button" class="btn-close" aria-label="Close" (click)="close()"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -22,11 +26,14 @@
|
|||||||
<input class="form-check-input mt-0 me-2" type="checkbox" role="switch" id="useArchiveVersion" [disabled]="!hasArchiveVersion" [(ngModel)]="useArchiveVersion">
|
<input class="form-check-input mt-0 me-2" type="checkbox" role="switch" id="useArchiveVersion" [disabled]="!hasArchiveVersion" [(ngModel)]="useArchiveVersion">
|
||||||
<label class="form-check-label w-100 text-start" for="useArchiveVersion" i18n>Use archive version</label>
|
<label class="form-check-label w-100 text-start" for="useArchiveVersion" i18n>Use archive version</label>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-outline-primary" (click)="emailDocument()" [disabled]="loading || emailAddress.length === 0 || emailMessage.length === 0 || emailSubject.length === 0">
|
<button type="submit" class="btn btn-outline-primary" (click)="emailDocuments()" [disabled]="loading || emailAddress.length === 0 || emailMessage.length === 0 || emailSubject.length === 0">
|
||||||
@if (loading) {
|
@if (loading) {
|
||||||
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
||||||
}
|
}
|
||||||
<ng-container i18n>Send email</ng-container>
|
<ng-container i18n>Send email</ng-container>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-light fst-italic small mt-2">
|
||||||
|
<ng-container i18n>Some email servers may reject messages with large attachments.</ng-container>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,31 +36,59 @@ describe('EmailDocumentDialogComponent', () => {
|
|||||||
documentService = TestBed.inject(DocumentService)
|
documentService = TestBed.inject(DocumentService)
|
||||||
toastService = TestBed.inject(ToastService)
|
toastService = TestBed.inject(ToastService)
|
||||||
component = fixture.componentInstance
|
component = fixture.componentInstance
|
||||||
|
component.documentIds = [1]
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should set hasArchiveVersion and useArchiveVersion', () => {
|
it('should set hasArchiveVersion and useArchiveVersion', () => {
|
||||||
expect(component.hasArchiveVersion).toBeTruthy()
|
expect(component.hasArchiveVersion).toBeTruthy()
|
||||||
|
expect(component.useArchiveVersion).toBeTruthy()
|
||||||
|
|
||||||
component.hasArchiveVersion = false
|
component.hasArchiveVersion = false
|
||||||
expect(component.hasArchiveVersion).toBeFalsy()
|
expect(component.hasArchiveVersion).toBeFalsy()
|
||||||
expect(component.useArchiveVersion).toBeFalsy()
|
expect(component.useArchiveVersion).toBeFalsy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should support sending document via email, showing error if needed', () => {
|
it('should support sending single document via email, showing error if needed', () => {
|
||||||
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||||
const toastSuccessSpy = jest.spyOn(toastService, 'showInfo')
|
const toastSuccessSpy = jest.spyOn(toastService, 'showInfo')
|
||||||
|
component.documentIds = [1]
|
||||||
component.emailAddress = 'hello@paperless-ngx.com'
|
component.emailAddress = 'hello@paperless-ngx.com'
|
||||||
component.emailSubject = 'Hello'
|
component.emailSubject = 'Hello'
|
||||||
component.emailMessage = 'World'
|
component.emailMessage = 'World'
|
||||||
jest
|
jest
|
||||||
.spyOn(documentService, 'emailDocument')
|
.spyOn(documentService, 'emailDocuments')
|
||||||
.mockReturnValue(throwError(() => new Error('Unable to email document')))
|
.mockReturnValue(throwError(() => new Error('Unable to email document')))
|
||||||
component.emailDocument()
|
component.emailDocuments()
|
||||||
expect(toastErrorSpy).toHaveBeenCalled()
|
expect(toastErrorSpy).toHaveBeenCalledWith(
|
||||||
|
'Error emailing document',
|
||||||
|
expect.any(Error)
|
||||||
|
)
|
||||||
|
|
||||||
jest.spyOn(documentService, 'emailDocument').mockReturnValue(of(true))
|
jest.spyOn(documentService, 'emailDocuments').mockReturnValue(of(true))
|
||||||
component.emailDocument()
|
component.emailDocuments()
|
||||||
expect(toastSuccessSpy).toHaveBeenCalled()
|
expect(toastSuccessSpy).toHaveBeenCalledWith('Email sent')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should support sending multiple documents via email, showing appropriate messages', () => {
|
||||||
|
const toastErrorSpy = jest.spyOn(toastService, 'showError')
|
||||||
|
const toastSuccessSpy = jest.spyOn(toastService, 'showInfo')
|
||||||
|
component.documentIds = [1, 2, 3]
|
||||||
|
component.emailAddress = 'hello@paperless-ngx.com'
|
||||||
|
component.emailSubject = 'Hello'
|
||||||
|
component.emailMessage = 'World'
|
||||||
|
jest
|
||||||
|
.spyOn(documentService, 'emailDocuments')
|
||||||
|
.mockReturnValue(throwError(() => new Error('Unable to email documents')))
|
||||||
|
component.emailDocuments()
|
||||||
|
expect(toastErrorSpy).toHaveBeenCalledWith(
|
||||||
|
'Error emailing documents',
|
||||||
|
expect.any(Error)
|
||||||
|
)
|
||||||
|
|
||||||
|
jest.spyOn(documentService, 'emailDocuments').mockReturnValue(of(true))
|
||||||
|
component.emailDocuments()
|
||||||
|
expect(toastSuccessSpy).toHaveBeenCalledWith('Email sent')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should close the dialog', () => {
|
it('should close the dialog', () => {
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ export class EmailDocumentDialogComponent extends LoadingComponentWithPermission
|
|||||||
private toastService = inject(ToastService)
|
private toastService = inject(ToastService)
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
title = $localize`Email Document`
|
documentIds: number[]
|
||||||
|
|
||||||
@Input()
|
|
||||||
documentId: number
|
|
||||||
|
|
||||||
private _hasArchiveVersion: boolean = true
|
private _hasArchiveVersion: boolean = true
|
||||||
|
|
||||||
@@ -46,11 +43,11 @@ export class EmailDocumentDialogComponent extends LoadingComponentWithPermission
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
public emailDocument() {
|
public emailDocuments() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.documentService
|
this.documentService
|
||||||
.emailDocument(
|
.emailDocuments(
|
||||||
this.documentId,
|
this.documentIds,
|
||||||
this.emailAddress,
|
this.emailAddress,
|
||||||
this.emailSubject,
|
this.emailSubject,
|
||||||
this.emailMessage,
|
this.emailMessage,
|
||||||
@@ -67,7 +64,11 @@ export class EmailDocumentDialogComponent extends LoadingComponentWithPermission
|
|||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.toastService.showError($localize`Error emailing document`, e)
|
const errorMessage =
|
||||||
|
this.documentIds.length > 1
|
||||||
|
? $localize`Error emailing documents`
|
||||||
|
: $localize`Error emailing document`
|
||||||
|
this.toastService.showError(errorMessage, e)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -564,6 +564,208 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keeps children with their parent when parent has document count', () => {
|
||||||
|
const parent: Tag = {
|
||||||
|
id: 10,
|
||||||
|
name: 'Parent Tag',
|
||||||
|
orderIndex: 0,
|
||||||
|
document_count: 2,
|
||||||
|
}
|
||||||
|
const child: Tag = {
|
||||||
|
id: 11,
|
||||||
|
name: 'Child Tag',
|
||||||
|
parent: parent.id,
|
||||||
|
orderIndex: 1,
|
||||||
|
document_count: 0,
|
||||||
|
}
|
||||||
|
const otherRoot: Tag = {
|
||||||
|
id: 20,
|
||||||
|
name: 'Other Tag',
|
||||||
|
orderIndex: 2,
|
||||||
|
document_count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
component.selectionModel.items = [parent, child, otherRoot]
|
||||||
|
component.selectionModel = selectionModel
|
||||||
|
component.documentCounts = [
|
||||||
|
{ id: parent.id, document_count: 2 },
|
||||||
|
{ id: otherRoot.id, document_count: 0 },
|
||||||
|
]
|
||||||
|
selectionModel.apply()
|
||||||
|
|
||||||
|
expect(component.selectionModel.items).toEqual([
|
||||||
|
nullItem,
|
||||||
|
parent,
|
||||||
|
child,
|
||||||
|
otherRoot,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps selected branches ahead of document-based ordering', () => {
|
||||||
|
const selectedRoot: Tag = {
|
||||||
|
id: 30,
|
||||||
|
name: 'Selected Root',
|
||||||
|
orderIndex: 0,
|
||||||
|
document_count: 0,
|
||||||
|
}
|
||||||
|
const otherRoot: Tag = {
|
||||||
|
id: 40,
|
||||||
|
name: 'Other Root',
|
||||||
|
orderIndex: 1,
|
||||||
|
document_count: 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
component.selectionModel.items = [selectedRoot, otherRoot]
|
||||||
|
component.selectionModel = selectionModel
|
||||||
|
selectionModel.set(selectedRoot.id, ToggleableItemState.Selected)
|
||||||
|
component.documentCounts = [
|
||||||
|
{ id: selectedRoot.id, document_count: 0 },
|
||||||
|
{ id: otherRoot.id, document_count: 2 },
|
||||||
|
]
|
||||||
|
selectionModel.apply()
|
||||||
|
|
||||||
|
expect(component.selectionModel.items).toEqual([
|
||||||
|
nullItem,
|
||||||
|
selectedRoot,
|
||||||
|
otherRoot,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resorts items immediately when document count sorting enabled', () => {
|
||||||
|
const apple: Tag = { id: 55, name: 'Apple' }
|
||||||
|
const zebra: Tag = { id: 56, name: 'Zebra' }
|
||||||
|
|
||||||
|
selectionModel.documentCountSortingEnabled = true
|
||||||
|
selectionModel.items = [apple, zebra]
|
||||||
|
expect(selectionModel.items.map((item) => item?.id ?? null)).toEqual([
|
||||||
|
null,
|
||||||
|
apple.id,
|
||||||
|
zebra.id,
|
||||||
|
])
|
||||||
|
|
||||||
|
selectionModel.documentCounts = [
|
||||||
|
{ id: zebra.id, document_count: 5 },
|
||||||
|
{ id: apple.id, document_count: 0 },
|
||||||
|
]
|
||||||
|
|
||||||
|
expect(selectionModel.items.map((item) => item?.id ?? null)).toEqual([
|
||||||
|
null,
|
||||||
|
zebra.id,
|
||||||
|
apple.id,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not resort items by default when document counts are set', () => {
|
||||||
|
const first: Tag = { id: 57, name: 'First' }
|
||||||
|
const second: Tag = { id: 58, name: 'Second' }
|
||||||
|
|
||||||
|
selectionModel.items = [first, second]
|
||||||
|
selectionModel.documentCounts = [
|
||||||
|
{ id: second.id, document_count: 10 },
|
||||||
|
{ id: first.id, document_count: 0 },
|
||||||
|
]
|
||||||
|
|
||||||
|
expect(selectionModel.items.map((item) => item?.id ?? null)).toEqual([
|
||||||
|
null,
|
||||||
|
first.id,
|
||||||
|
second.id,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('uses fallback document counts when selection data is missing', () => {
|
||||||
|
const fallbackRoot: Tag = {
|
||||||
|
id: 50,
|
||||||
|
name: 'Fallback Root',
|
||||||
|
orderIndex: 0,
|
||||||
|
document_count: 3,
|
||||||
|
}
|
||||||
|
const fallbackChild: Tag = {
|
||||||
|
id: 51,
|
||||||
|
name: 'Fallback Child',
|
||||||
|
parent: fallbackRoot.id,
|
||||||
|
orderIndex: 1,
|
||||||
|
document_count: 0,
|
||||||
|
}
|
||||||
|
const otherRoot: Tag = {
|
||||||
|
id: 60,
|
||||||
|
name: 'Other Root',
|
||||||
|
orderIndex: 2,
|
||||||
|
document_count: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
component.selectionModel = selectionModel
|
||||||
|
selectionModel.items = [fallbackRoot, fallbackChild, otherRoot]
|
||||||
|
component.documentCounts = [{ id: otherRoot.id, document_count: 0 }]
|
||||||
|
|
||||||
|
selectionModel.apply()
|
||||||
|
|
||||||
|
expect(selectionModel.items).toEqual([
|
||||||
|
nullItem,
|
||||||
|
fallbackRoot,
|
||||||
|
fallbackChild,
|
||||||
|
otherRoot,
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('handles special and non-numeric ids when promoting branches', () => {
|
||||||
|
const rootWithDocs: Tag = {
|
||||||
|
id: 70,
|
||||||
|
name: 'Root With Docs',
|
||||||
|
orderIndex: 0,
|
||||||
|
document_count: 1,
|
||||||
|
}
|
||||||
|
const miscItem: any = { id: 'misc', name: 'Misc Item' }
|
||||||
|
|
||||||
|
component.selectionModel = selectionModel
|
||||||
|
selectionModel.intersection = Intersection.Exclude
|
||||||
|
selectionModel.items = [rootWithDocs, miscItem as any]
|
||||||
|
component.documentCounts = [{ id: rootWithDocs.id, document_count: 1 }]
|
||||||
|
|
||||||
|
selectionModel.apply()
|
||||||
|
|
||||||
|
expect(selectionModel.items.map((item) => item.id)).toEqual([
|
||||||
|
NEGATIVE_NULL_FILTER_VALUE,
|
||||||
|
rootWithDocs.id,
|
||||||
|
'misc',
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('memoizes root document counts between lookups', () => {
|
||||||
|
const memoRoot: Tag = { id: 80, name: 'Memo Root' }
|
||||||
|
selectionModel.items = [memoRoot]
|
||||||
|
selectionModel.documentCounts = [{ id: memoRoot.id, document_count: 9 }]
|
||||||
|
|
||||||
|
const getRootDocCount = (selectionModel as any).createRootDocCounter()
|
||||||
|
|
||||||
|
expect(getRootDocCount(memoRoot.id)).toEqual(9)
|
||||||
|
selectionModel.documentCounts = []
|
||||||
|
expect(getRootDocCount(memoRoot.id)).toEqual(9)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('falls back to model stored document counts if selection data missing entry', () => {
|
||||||
|
const rootWithoutSelection: Tag = {
|
||||||
|
id: 90,
|
||||||
|
name: 'Fallback Root',
|
||||||
|
document_count: 4,
|
||||||
|
}
|
||||||
|
selectionModel.items = [rootWithoutSelection]
|
||||||
|
selectionModel.documentCounts = []
|
||||||
|
|
||||||
|
const getRootDocCount = (selectionModel as any).createRootDocCounter()
|
||||||
|
|
||||||
|
expect(getRootDocCount(rootWithoutSelection.id)).toEqual(4)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('defaults to zero document count when neither selection nor model provide it', () => {
|
||||||
|
const rootWithoutCounts: Tag = { id: 91, name: 'Fallback Zero Root' }
|
||||||
|
selectionModel.items = [rootWithoutCounts]
|
||||||
|
selectionModel.documentCounts = []
|
||||||
|
|
||||||
|
const getRootDocCount = (selectionModel as any).createRootDocCounter()
|
||||||
|
|
||||||
|
expect(getRootDocCount(rootWithoutCounts.id)).toEqual(0)
|
||||||
|
})
|
||||||
|
|
||||||
it('should set support create, keep open model and call createRef method', fakeAsync(() => {
|
it('should set support create, keep open model and call createRef method', fakeAsync(() => {
|
||||||
component.selectionModel.items = items
|
component.selectionModel.items = items
|
||||||
component.icon = 'tag-fill'
|
component.icon = 'tag-fill'
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ export interface ChangedItems {
|
|||||||
itemsToRemove: MatchingModel[]
|
itemsToRemove: MatchingModel[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BranchSummary = {
|
||||||
|
items: MatchingModel[]
|
||||||
|
firstIndex: number
|
||||||
|
special: boolean
|
||||||
|
selected: boolean
|
||||||
|
hasDocs: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export enum LogicalOperator {
|
export enum LogicalOperator {
|
||||||
And = 'and',
|
And = 'and',
|
||||||
Or = 'or',
|
Or = 'or',
|
||||||
@@ -53,8 +61,13 @@ export class FilterableDropdownSelectionModel {
|
|||||||
temporaryIntersection: Intersection = this._intersection
|
temporaryIntersection: Intersection = this._intersection
|
||||||
|
|
||||||
private _documentCounts: SelectionDataItem[] = []
|
private _documentCounts: SelectionDataItem[] = []
|
||||||
|
public documentCountSortingEnabled = false
|
||||||
|
|
||||||
public set documentCounts(counts: SelectionDataItem[]) {
|
public set documentCounts(counts: SelectionDataItem[]) {
|
||||||
this._documentCounts = counts
|
this._documentCounts = counts
|
||||||
|
if (this.documentCountSortingEnabled) {
|
||||||
|
this.sortItems()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _items: MatchingModel[] = []
|
private _items: MatchingModel[] = []
|
||||||
@@ -147,6 +160,10 @@ export class FilterableDropdownSelectionModel {
|
|||||||
return a.name.localeCompare(b.name)
|
return a.name.localeCompare(b.name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (this._documentCounts.length) {
|
||||||
|
this.promoteBranchesWithDocumentCounts()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private selectionStates = new Map<number, ToggleableItemState>()
|
private selectionStates = new Map<number, ToggleableItemState>()
|
||||||
@@ -380,6 +397,180 @@ export class FilterableDropdownSelectionModel {
|
|||||||
return this._documentCounts.find((c) => c.id === id)?.document_count
|
return this._documentCounts.find((c) => c.id === id)?.document_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private promoteBranchesWithDocumentCounts() {
|
||||||
|
const parentById = this.buildParentById()
|
||||||
|
const findRootId = this.createRootFinder(parentById)
|
||||||
|
const getRootDocCount = this.createRootDocCounter()
|
||||||
|
const summaries = this.buildBranchSummaries(findRootId, getRootDocCount)
|
||||||
|
const orderedBranches = this.orderBranchesByPriority(summaries)
|
||||||
|
|
||||||
|
this._items = orderedBranches.flatMap((summary) => summary.items)
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildParentById(): Map<number, number | null> {
|
||||||
|
const parentById = new Map<number, number | null>()
|
||||||
|
|
||||||
|
for (const item of this._items) {
|
||||||
|
if (typeof item?.id === 'number') {
|
||||||
|
const parentValue = (item as any)['parent']
|
||||||
|
parentById.set(
|
||||||
|
item.id,
|
||||||
|
typeof parentValue === 'number' ? parentValue : null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentById
|
||||||
|
}
|
||||||
|
|
||||||
|
private createRootFinder(
|
||||||
|
parentById: Map<number, number | null>
|
||||||
|
): (id: number) => number {
|
||||||
|
const rootMemo = new Map<number, number>()
|
||||||
|
|
||||||
|
const findRootId = (id: number): number => {
|
||||||
|
const cached = rootMemo.get(id)
|
||||||
|
if (cached !== undefined) {
|
||||||
|
return cached
|
||||||
|
}
|
||||||
|
|
||||||
|
const parentId = parentById.get(id)
|
||||||
|
if (parentId === undefined || parentId === null) {
|
||||||
|
rootMemo.set(id, id)
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootId = findRootId(parentId)
|
||||||
|
rootMemo.set(id, rootId)
|
||||||
|
return rootId
|
||||||
|
}
|
||||||
|
|
||||||
|
return findRootId
|
||||||
|
}
|
||||||
|
|
||||||
|
private createRootDocCounter(): (rootId: number) => number {
|
||||||
|
const docCountMemo = new Map<number, number>()
|
||||||
|
|
||||||
|
return (rootId: number): number => {
|
||||||
|
const cached = docCountMemo.get(rootId)
|
||||||
|
if (cached !== undefined) {
|
||||||
|
return cached
|
||||||
|
}
|
||||||
|
|
||||||
|
const explicit = this.getDocumentCount(rootId)
|
||||||
|
if (typeof explicit === 'number') {
|
||||||
|
docCountMemo.set(rootId, explicit)
|
||||||
|
return explicit
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootItem = this._items.find((i) => i.id === rootId)
|
||||||
|
const fallback =
|
||||||
|
typeof (rootItem as any)?.['document_count'] === 'number'
|
||||||
|
? (rootItem as any)['document_count']
|
||||||
|
: 0
|
||||||
|
|
||||||
|
docCountMemo.set(rootId, fallback)
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildBranchSummaries(
|
||||||
|
findRootId: (id: number) => number,
|
||||||
|
getRootDocCount: (rootId: number) => number
|
||||||
|
): Map<string, BranchSummary> {
|
||||||
|
const summaries = new Map<string, BranchSummary>()
|
||||||
|
|
||||||
|
for (const [index, item] of this._items.entries()) {
|
||||||
|
const { key, special, rootId } = this.describeBranchItem(
|
||||||
|
item,
|
||||||
|
index,
|
||||||
|
findRootId
|
||||||
|
)
|
||||||
|
|
||||||
|
let summary = summaries.get(key)
|
||||||
|
if (!summary) {
|
||||||
|
summary = {
|
||||||
|
items: [],
|
||||||
|
firstIndex: index,
|
||||||
|
special,
|
||||||
|
selected: false,
|
||||||
|
hasDocs:
|
||||||
|
special || rootId === null ? false : getRootDocCount(rootId) > 0,
|
||||||
|
}
|
||||||
|
summaries.set(key, summary)
|
||||||
|
}
|
||||||
|
|
||||||
|
summary.items.push(item)
|
||||||
|
|
||||||
|
if (this.shouldMarkSummarySelected(summary, item)) {
|
||||||
|
summary.selected = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return summaries
|
||||||
|
}
|
||||||
|
|
||||||
|
private describeBranchItem(
|
||||||
|
item: MatchingModel,
|
||||||
|
index: number,
|
||||||
|
findRootId: (id: number) => number
|
||||||
|
): { key: string; special: boolean; rootId: number | null } {
|
||||||
|
if (item?.id === null) {
|
||||||
|
return { key: 'null', special: true, rootId: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item?.id === NEGATIVE_NULL_FILTER_VALUE) {
|
||||||
|
return { key: 'neg-null', special: true, rootId: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof item?.id === 'number') {
|
||||||
|
const rootId = findRootId(item.id)
|
||||||
|
return { key: `root-${rootId}`, special: false, rootId }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { key: `misc-${index}`, special: false, rootId: null }
|
||||||
|
}
|
||||||
|
|
||||||
|
private shouldMarkSummarySelected(
|
||||||
|
summary: BranchSummary,
|
||||||
|
item: MatchingModel
|
||||||
|
): boolean {
|
||||||
|
if (summary.special) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof item?.id !== 'number') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getNonTemporary(item.id) !== ToggleableItemState.NotSelected
|
||||||
|
}
|
||||||
|
|
||||||
|
private orderBranchesByPriority(
|
||||||
|
summaries: Map<string, BranchSummary>
|
||||||
|
): BranchSummary[] {
|
||||||
|
return Array.from(summaries.values()).sort((a, b) => {
|
||||||
|
const rankDiff = this.branchRank(a) - this.branchRank(b)
|
||||||
|
if (rankDiff !== 0) {
|
||||||
|
return rankDiff
|
||||||
|
}
|
||||||
|
if (a.hasDocs !== b.hasDocs) {
|
||||||
|
return a.hasDocs ? -1 : 1
|
||||||
|
}
|
||||||
|
return a.firstIndex - b.firstIndex
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private branchRank(summary: BranchSummary): number {
|
||||||
|
if (summary.special) {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
if (summary.selected) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
init(map: Map<number, ToggleableItemState>) {
|
init(map: Map<number, ToggleableItemState>) {
|
||||||
this.temporarySelectionStates = map
|
this.temporarySelectionStates = map
|
||||||
this.apply()
|
this.apply()
|
||||||
@@ -465,8 +656,9 @@ export class FilterableDropdownComponent
|
|||||||
this.selectionModel.changed.complete()
|
this.selectionModel.changed.complete()
|
||||||
model.items = this.selectionModel.items
|
model.items = this.selectionModel.items
|
||||||
model.manyToOne = this.selectionModel.manyToOne
|
model.manyToOne = this.selectionModel.manyToOne
|
||||||
model.singleSelect = this.editing && !this.selectionModel.manyToOne
|
model.singleSelect = this._editing && !model.manyToOne
|
||||||
}
|
}
|
||||||
|
model.documentCountSortingEnabled = this._editing
|
||||||
model.changed.subscribe((updatedModel) => {
|
model.changed.subscribe((updatedModel) => {
|
||||||
this.selectionModelChange.next(updatedModel)
|
this.selectionModelChange.next(updatedModel)
|
||||||
})
|
})
|
||||||
@@ -496,8 +688,21 @@ export class FilterableDropdownComponent
|
|||||||
@Input()
|
@Input()
|
||||||
allowSelectNone: boolean = false
|
allowSelectNone: boolean = false
|
||||||
|
|
||||||
|
private _editing = false
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
editing = false
|
set editing(value: boolean) {
|
||||||
|
this._editing = value
|
||||||
|
if (this.selectionModel) {
|
||||||
|
this.selectionModel.singleSelect =
|
||||||
|
this._editing && !this.selectionModel.manyToOne
|
||||||
|
this.selectionModel.documentCountSortingEnabled = this._editing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get editing() {
|
||||||
|
return this._editing
|
||||||
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
applyOnClose = false
|
applyOnClose = false
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@if (title) {
|
@if (title) {
|
||||||
<label [for]="inputId">{{title}}</label>
|
<label class="form-label" [for]="inputId">{{title}}</label>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="input-group" [class.is-invalid]="error">
|
<div class="input-group" [class.is-invalid]="error">
|
||||||
<span class="input-group-text" [style.background-color]="value"> </span>
|
<button type="button" class="input-group-text" [style.background-color]="value" (click)="colorPicker.toggle()"> </button>
|
||||||
|
|
||||||
<ng-template #popContent>
|
<ng-template #popContent>
|
||||||
<div style="min-width: 200px;" class="pb-3">
|
<div style="min-width: 200px;" class="pb-3">
|
||||||
<color-slider [color]="value" (onChangeComplete)="colorChanged($event.color.hex)"></color-slider>
|
<color-slider [color]="value" (onChangeComplete)="colorChanged($event.color.hex)"></color-slider>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<input #inputField class="form-control" [class.is-invalid]="error" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" [autoClose]="'outside'" [ngbPopover]="popContent" placement="bottom" popoverClass="shadow">
|
<input #inputField class="form-control" [class.is-invalid]="error" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" [autoClose]="'outside'" [ngbPopover]="popContent" #colorPicker="ngbPopover" placement="bottom" popoverClass="shadow">
|
||||||
|
|
||||||
<button class="btn btn-outline-secondary" type="button" (click)="randomize()">
|
<button class="btn btn-outline-secondary" type="button" (click)="randomize()">
|
||||||
<i-bs name="dice5"></i-bs>
|
<i-bs name="dice5"></i-bs>
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ describe('ColorComponent', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should set swatch color', () => {
|
it('should set swatch color', () => {
|
||||||
const swatch: HTMLSpanElement = fixture.nativeElement.querySelector(
|
const swatch: HTMLButtonElement = fixture.nativeElement.querySelector(
|
||||||
'span.input-group-text'
|
'button.input-group-text'
|
||||||
)
|
)
|
||||||
expect(swatch.style.backgroundColor).toEqual('')
|
expect(swatch.style.backgroundColor).toEqual('')
|
||||||
component.value = '#ff0000'
|
component.value = '#ff0000'
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 align-items-center bg-light p-2">
|
<div class="mt-2 align-items-center bg-light p-2">
|
||||||
<div class="d-flex flex-wrap flex-row gap-2 w-100"
|
<div class="d-flex flex-wrap flex-row gap-2 w-100" style="min-height: 1em;"
|
||||||
cdkDropList #unselectedList="cdkDropList"
|
cdkDropList #unselectedList="cdkDropList"
|
||||||
cdkDropListOrientation="mixed"
|
cdkDropListOrientation="mixed"
|
||||||
(cdkDropListDropped)="drop($event)"
|
(cdkDropListDropped)="drop($event)"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
<div class="invalid-feedback position-absolute top-100">
|
<div class="invalid-feedback position-absolute top-100">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
<input #inputField type="hidden" class="form-control small" [(ngModel)]="value" [disabled]="true">
|
<input #inputField type="hidden" class="form-control small" [(ngModel)]="value" [disabled]="true">
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
<div class="invalid-feedback position-absolute top-100">
|
<div class="invalid-feedback position-absolute top-100">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
{{error}}
|
{{error}}
|
||||||
</div>
|
</div>
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,66 +1,69 @@
|
|||||||
<div class="mb-3 paperless-input-select" [class.disabled]="disabled">
|
<div class="mb-3 paperless-input-select" [class.disabled]="disabled">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex align-items-center position-relative hidden-button-container" [class.col-md-3]="horizontal">
|
@if (title || removable) {
|
||||||
@if (title) {
|
<div class="d-flex align-items-center position-relative hidden-button-container" [class.col-md-3]="horizontal">
|
||||||
<label class="form-label" [class.mb-md-0]="horizontal" [for]="inputId">{{title}}</label>
|
@if (title) {
|
||||||
}
|
<label class="form-label" [class.mb-md-0]="horizontal" [for]="inputId">{{title}}</label>
|
||||||
@if (removable) {
|
}
|
||||||
<button type="button" class="btn btn-sm btn-danger position-absolute left-0" (click)="removed.emit(this)">
|
@if (removable) {
|
||||||
<i-bs name="x"></i-bs> <ng-container i18n>Remove</ng-container>
|
<button type="button" class="btn btn-sm btn-danger position-absolute left-0" (click)="removed.emit(this)">
|
||||||
|
<i-bs name="x"></i-bs> <ng-container i18n>Remove</ng-container>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div [class.col-md-9]="horizontal">
|
||||||
|
<div [class.input-group]="allowCreateNew || showFilter" [class.is-invalid]="error">
|
||||||
|
<ng-select name="inputId" [(ngModel)]="value"
|
||||||
|
[disabled]="disabled"
|
||||||
|
[style.color]="textColor"
|
||||||
|
[style.background]="backgroundColor"
|
||||||
|
[class.private]="isPrivate"
|
||||||
|
[clearable]="allowNull"
|
||||||
|
[items]="items"
|
||||||
|
[addTag]="allowCreateNew && addItemRef"
|
||||||
|
addTagText="Add item"
|
||||||
|
i18n-addTagText="Used for both types, correspondents, storage paths"
|
||||||
|
[placeholder]="placeholder"
|
||||||
|
[notFoundText]="notFoundText"
|
||||||
|
[multiple]="multiple"
|
||||||
|
[bindLabel]="bindLabel"
|
||||||
|
bindValue="id"
|
||||||
|
[virtualScroll]="items?.length > 100"
|
||||||
|
(change)="onChange(value)"
|
||||||
|
(search)="onSearch($event)"
|
||||||
|
(focus)="clearLastSearchTerm()"
|
||||||
|
(clear)="clearLastSearchTerm()"
|
||||||
|
(blur)="onBlur()">
|
||||||
|
<ng-template ng-option-tmp let-item="item">
|
||||||
|
<span [title]="item[bindLabel]">{{item[bindLabel]}}</span>
|
||||||
|
</ng-template>
|
||||||
|
</ng-select>
|
||||||
|
@if (allowCreateNew && !hideAddButton) {
|
||||||
|
<button class="btn btn-outline-secondary" type="button" (click)="addItem()" [disabled]="disabled">
|
||||||
|
<i-bs width="1.2em" height="1.2em" name="plus"></i-bs>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
@if (showFilter) {
|
||||||
|
<button class="btn btn-outline-secondary" type="button" (click)="onFilterDocuments()" [disabled]="isPrivate || this.value === null" title="{{ filterButtonTitle }}">
|
||||||
|
<i-bs width="1.2em" height="1.2em" name="filter"></i-bs>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div [class.col-md-9]="horizontal">
|
<div class="invalid-feedback">
|
||||||
<div [class.input-group]="allowCreateNew || showFilter" [class.is-invalid]="error">
|
{{error}}
|
||||||
<ng-select name="inputId" [(ngModel)]="value"
|
|
||||||
[disabled]="disabled"
|
|
||||||
[style.color]="textColor"
|
|
||||||
[style.background]="backgroundColor"
|
|
||||||
[class.private]="isPrivate"
|
|
||||||
[clearable]="allowNull"
|
|
||||||
[items]="items"
|
|
||||||
[addTag]="allowCreateNew && addItemRef"
|
|
||||||
addTagText="Add item"
|
|
||||||
i18n-addTagText="Used for both types, correspondents, storage paths"
|
|
||||||
[placeholder]="placeholder"
|
|
||||||
[notFoundText]="notFoundText"
|
|
||||||
[multiple]="multiple"
|
|
||||||
[bindLabel]="bindLabel"
|
|
||||||
bindValue="id"
|
|
||||||
(change)="onChange(value)"
|
|
||||||
(search)="onSearch($event)"
|
|
||||||
(focus)="clearLastSearchTerm()"
|
|
||||||
(clear)="clearLastSearchTerm()"
|
|
||||||
(blur)="onBlur()">
|
|
||||||
<ng-template ng-option-tmp let-item="item">
|
|
||||||
<span [title]="item[bindLabel]">{{item[bindLabel]}}</span>
|
|
||||||
</ng-template>
|
|
||||||
</ng-select>
|
|
||||||
@if (allowCreateNew && !hideAddButton) {
|
|
||||||
<button class="btn btn-outline-secondary" type="button" (click)="addItem()" [disabled]="disabled">
|
|
||||||
<i-bs width="1.2em" height="1.2em" name="plus"></i-bs>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
@if (showFilter) {
|
|
||||||
<button class="btn btn-outline-secondary" type="button" (click)="onFilterDocuments()" [disabled]="isPrivate || this.value === null" title="{{ filterButtonTitle }}">
|
|
||||||
<i-bs width="1.2em" height="1.2em" name="filter"></i-bs>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
{{error}}
|
|
||||||
</div>
|
|
||||||
@if (hint) {
|
|
||||||
<small class="form-text text-muted">{{hint}}</small>
|
|
||||||
}
|
|
||||||
@if (getSuggestions().length > 0) {
|
|
||||||
<small>
|
|
||||||
<span i18n>Suggestions:</span>
|
|
||||||
@for (s of getSuggestions(); track s) {
|
|
||||||
<a (click)="value = s.id; onChange(value)" [routerLink]="[]">{{s.name}}</a>
|
|
||||||
}
|
|
||||||
</small>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
@if (hint) {
|
||||||
|
<small class="form-text text-muted">{{hint}}</small>
|
||||||
|
}
|
||||||
|
@if (getSuggestions().length > 0) {
|
||||||
|
<small>
|
||||||
|
<span i18n>Suggestions:</span>
|
||||||
|
@for (s of getSuggestions(); track s) {
|
||||||
|
<a (click)="value = s.id; onChange(value)" [routerLink]="[]">{{s.name}}</a>
|
||||||
|
}
|
||||||
|
</small>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<div class="mb-3 paperless-input-select paperless-input-tags" [class.disabled]="disabled" [class.pb-3]="getSuggestions().length > 0">
|
<div class="mb-3 paperless-input-select paperless-input-tags" [class.disabled]="disabled" [class.pb-3]="getSuggestions().length > 0">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex align-items-center" [class.col-md-3]="horizontal">
|
@if (title) {
|
||||||
<label class="form-label" [class.mb-md-0]="horizontal" for="tags">{{title}}</label>
|
<div class="d-flex align-items-center" [class.col-md-3]="horizontal">
|
||||||
</div>
|
<label class="form-label" [class.mb-md-0]="horizontal" for="tags">{{title}}</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div class="position-relative" [class.col-md-9]="horizontal">
|
<div class="position-relative" [class.col-md-9]="horizontal">
|
||||||
<div class="input-group flex-nowrap">
|
<div class="input-group flex-nowrap">
|
||||||
<ng-select #tagSelect name="tags" [items]="tags" bindLabel="name" bindValue="id" [(ngModel)]="value"
|
<ng-select #tagSelect name="tags" [items]="tags" bindLabel="name" bindValue="id" [(ngModel)]="value"
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ describe('TagsComponent', () => {
|
|||||||
|
|
||||||
modalService = TestBed.inject(NgbModal)
|
modalService = TestBed.inject(NgbModal)
|
||||||
settingsService = TestBed.inject(SettingsService)
|
settingsService = TestBed.inject(SettingsService)
|
||||||
|
settingsService.currentUser = { id: 1 }
|
||||||
fixture = TestBed.createComponent(TagsComponent)
|
fixture = TestBed.createComponent(TagsComponent)
|
||||||
fixture.debugElement.injector.get(NG_VALUE_ACCESSOR)
|
fixture.debugElement.injector.get(NG_VALUE_ACCESSOR)
|
||||||
component = fixture.componentInstance
|
component = fixture.componentInstance
|
||||||
@@ -138,7 +139,7 @@ describe('TagsComponent', () => {
|
|||||||
settingsService.currentUser = { id: 1 }
|
settingsService.currentUser = { id: 1 }
|
||||||
let activeInstances: NgbModalRef[]
|
let activeInstances: NgbModalRef[]
|
||||||
modalService.activeInstances.subscribe((v) => (activeInstances = v))
|
modalService.activeInstances.subscribe((v) => (activeInstances = v))
|
||||||
component.select.searchTerm = 'foobar'
|
component.select.filter('foobar')
|
||||||
component.createTag()
|
component.createTag()
|
||||||
expect(modalService.hasOpenModals()).toBeTruthy()
|
expect(modalService.hasOpenModals()).toBeTruthy()
|
||||||
expect(activeInstances[0].componentInstance.object.name).toEqual('foobar')
|
expect(activeInstances[0].componentInstance.object.name).toEqual('foobar')
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
|
|||||||
if (name) modal.componentInstance.object = { name: name }
|
if (name) modal.componentInstance.object = { name: name }
|
||||||
else if (this.select.searchTerm)
|
else if (this.select.searchTerm)
|
||||||
modal.componentInstance.object = { name: this.select.searchTerm }
|
modal.componentInstance.object = { name: this.select.searchTerm }
|
||||||
this.select.searchTerm = null
|
this.select.filter(null)
|
||||||
this.select.detectChanges()
|
this.select.detectChanges()
|
||||||
return firstValueFrom(
|
return firstValueFrom(
|
||||||
(modal.componentInstance as TagEditDialogComponent).succeeded.pipe(
|
(modal.componentInstance as TagEditDialogComponent).succeeded.pipe(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="position-relative" [class.col-md-9]="horizontal">
|
<div class="position-relative" [class.col-md-9]="horizontal">
|
||||||
<input #inputField type="text" class="form-control" [class.is-invalid]="error" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" [disabled]="disabled" [autocomplete]="autocomplete" [placeholder]="placeholder">
|
<input #inputField type="text" class="form-control" [class.is-invalid]="error" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" [disabled]="disabled" [autocomplete]="autocomplete" [placeholder]="placeholder">
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
<div class="invalid-feedback position-absolute top-100">
|
<div class="invalid-feedback position-absolute top-100">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
} from '@angular/forms'
|
} from '@angular/forms'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { AbstractInputComponent } from '../abstract-input'
|
import { AbstractInputComponent } from '../abstract-input'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -19,12 +18,7 @@ import { AbstractInputComponent } from '../abstract-input'
|
|||||||
selector: 'pngx-input-text',
|
selector: 'pngx-input-text',
|
||||||
templateUrl: './text.component.html',
|
templateUrl: './text.component.html',
|
||||||
styleUrls: ['./text.component.scss'],
|
styleUrls: ['./text.component.scss'],
|
||||||
imports: [
|
imports: [FormsModule, ReactiveFormsModule, NgxBootstrapIconsModule],
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
SafeHtmlPipe,
|
|
||||||
NgxBootstrapIconsModule,
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class TextComponent extends AbstractInputComponent<string> {
|
export class TextComponent extends AbstractInputComponent<string> {
|
||||||
@Input()
|
@Input()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
rows="4">
|
rows="4">
|
||||||
</textarea>
|
</textarea>
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
<div class="invalid-feedback position-absolute top-100">
|
<div class="invalid-feedback position-absolute top-100">
|
||||||
{{error}}
|
{{error}}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
} from '@angular/forms'
|
} from '@angular/forms'
|
||||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { AbstractInputComponent } from '../abstract-input'
|
import { AbstractInputComponent } from '../abstract-input'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -19,12 +18,7 @@ import { AbstractInputComponent } from '../abstract-input'
|
|||||||
selector: 'pngx-input-textarea',
|
selector: 'pngx-input-textarea',
|
||||||
templateUrl: './textarea.component.html',
|
templateUrl: './textarea.component.html',
|
||||||
styleUrls: ['./textarea.component.scss'],
|
styleUrls: ['./textarea.component.scss'],
|
||||||
imports: [
|
imports: [FormsModule, ReactiveFormsModule, NgxBootstrapIconsModule],
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
SafeHtmlPipe,
|
|
||||||
NgxBootstrapIconsModule,
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class TextAreaComponent extends AbstractInputComponent<string> {
|
export class TextAreaComponent extends AbstractInputComponent<string> {
|
||||||
@Input()
|
@Input()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (hint) {
|
@if (hint) {
|
||||||
<small class="form-text text-muted" [innerHTML]="hint | safeHtml"></small>
|
<small class="form-text text-muted" [innerHTML]="hint"></small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
|||||||
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { NgSelectModule } from '@ng-select/ng-select'
|
import { NgSelectModule } from '@ng-select/ng-select'
|
||||||
import { of } from 'rxjs'
|
import { of } from 'rxjs'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { UserService } from 'src/app/services/rest/user.service'
|
import { UserService } from 'src/app/services/rest/user.service'
|
||||||
import { PermissionsFormComponent } from '../input/permissions/permissions-form/permissions-form.component'
|
import { PermissionsFormComponent } from '../input/permissions/permissions-form/permissions-form.component'
|
||||||
import { PermissionsGroupComponent } from '../input/permissions/permissions-group/permissions-group.component'
|
import { PermissionsGroupComponent } from '../input/permissions/permissions-group/permissions-group.component'
|
||||||
@@ -41,7 +40,6 @@ describe('PermissionsDialogComponent', () => {
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
NgbModule,
|
NgbModule,
|
||||||
PermissionsDialogComponent,
|
PermissionsDialogComponent,
|
||||||
SafeHtmlPipe,
|
|
||||||
SelectComponent,
|
SelectComponent,
|
||||||
SwitchComponent,
|
SwitchComponent,
|
||||||
PermissionsFormComponent,
|
PermissionsFormComponent,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
@if (previewText) {
|
@if (previewText) {
|
||||||
<div class="bg-light p-3 overflow-auto whitespace-preserve" width="100%">{{previewText}}</div>
|
<div class="bg-light p-3 overflow-auto whitespace-preserve" width="100%">{{previewText}}</div>
|
||||||
} @else {
|
} @else {
|
||||||
<object [data]="previewURL | safeUrl" width="100%" class="bg-light" [class.p-2]="!isPdf"></object>
|
<object [data]="previewUrl | safeUrl" width="100%" class="bg-light" [class.p-2]="!isPdf"></object>
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
@if (requiresPassword) {
|
@if (requiresPassword) {
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
@if (!requiresPassword) {
|
@if (!requiresPassword) {
|
||||||
<pdf-viewer
|
<pdf-viewer
|
||||||
[src]="previewURL"
|
[src]="previewUrl"
|
||||||
[original-size]="false"
|
[original-size]="false"
|
||||||
[show-borders]="false"
|
[show-borders]="false"
|
||||||
[show-all]="true"
|
[show-all]="true"
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
return (this.isPdf && this.useNativePdfViewer) || !this.isPdf
|
return (this.isPdf && this.useNativePdfViewer) || !this.isPdf
|
||||||
}
|
}
|
||||||
|
|
||||||
get previewURL() {
|
get previewUrl() {
|
||||||
return this.documentService.getPreviewUrl(this.document.id)
|
return this.documentService.getPreviewUrl(this.document.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
init() {
|
init() {
|
||||||
if (this.document.mime_type?.includes('text')) {
|
if (this.document.mime_type?.includes('text')) {
|
||||||
this.http
|
this.http
|
||||||
.get(this.previewURL, { responseType: 'text' })
|
.get(this.previewUrl, { responseType: 'text' })
|
||||||
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
.pipe(first(), takeUntil(this.unsubscribeNotifier))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
@@ -126,10 +126,6 @@ export class PreviewPopupComponent implements OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get previewUrl() {
|
|
||||||
return this.documentService.getPreviewUrl(this.document.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseEnterPreview() {
|
mouseEnterPreview() {
|
||||||
this.mouseOnPreview = true
|
this.mouseOnPreview = true
|
||||||
if (!this.popover.isOpen()) {
|
if (!this.popover.isOpen()) {
|
||||||
|
|||||||
@@ -110,7 +110,9 @@
|
|||||||
<div class="visually-hidden" i18n>Loading...</div>
|
<div class="visually-hidden" i18n>Loading...</div>
|
||||||
} @else if (totpSettings) {
|
} @else if (totpSettings) {
|
||||||
<figure class="figure">
|
<figure class="figure">
|
||||||
<div class="bg-white d-inline-block" [innerHTML]="totpSettings.qr_svg | safeHtml"></div>
|
@if (qrSvgDataUrl) {
|
||||||
|
<img class="bg-white d-inline-block" [src]="qrSvgDataUrl" alt="Authenticator QR code">
|
||||||
|
}
|
||||||
<figcaption class="figure-caption text-end mt-2" i18n>Scan the QR code with your authenticator app and then enter the code below</figcaption>
|
<figcaption class="figure-caption text-end mt-2" i18n>Scan the QR code with your authenticator app and then enter the code below</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import {
|
|||||||
SocialAccountProvider,
|
SocialAccountProvider,
|
||||||
TotpSettings,
|
TotpSettings,
|
||||||
} from 'src/app/data/user-profile'
|
} from 'src/app/data/user-profile'
|
||||||
import { SafeHtmlPipe } from 'src/app/pipes/safehtml.pipe'
|
|
||||||
import { ProfileService } from 'src/app/services/profile.service'
|
import { ProfileService } from 'src/app/services/profile.service'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { setLocationHref } from 'src/app/utils/navigation'
|
import { setLocationHref } from 'src/app/utils/navigation'
|
||||||
@@ -37,7 +36,6 @@ import { TextComponent } from '../input/text/text.component'
|
|||||||
PasswordComponent,
|
PasswordComponent,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
SafeHtmlPipe,
|
|
||||||
NgbAccordionModule,
|
NgbAccordionModule,
|
||||||
NgbPopoverModule,
|
NgbPopoverModule,
|
||||||
NgxBootstrapIconsModule,
|
NgxBootstrapIconsModule,
|
||||||
@@ -89,6 +87,13 @@ export class ProfileEditDialogComponent
|
|||||||
public socialAccounts: SocialAccount[] = []
|
public socialAccounts: SocialAccount[] = []
|
||||||
public socialAccountProviders: SocialAccountProvider[] = []
|
public socialAccountProviders: SocialAccountProvider[] = []
|
||||||
|
|
||||||
|
get qrSvgDataUrl(): string | null {
|
||||||
|
if (!this.totpSettings?.qr_svg) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return `data:image/svg+xml;utf8,${encodeURIComponent(this.totpSettings.qr_svg)}`
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.networkActive = true
|
this.networkActive = true
|
||||||
this.profileService
|
this.profileService
|
||||||
@@ -183,6 +188,7 @@ export class ProfileEditDialogComponent
|
|||||||
this.newPassword && this.currentPassword !== this.newPassword
|
this.newPassword && this.currentPassword !== this.newPassword
|
||||||
const profile = Object.assign({}, this.form.value)
|
const profile = Object.assign({}, this.form.value)
|
||||||
delete profile.totp_code
|
delete profile.totp_code
|
||||||
|
this.error = null
|
||||||
this.networkActive = true
|
this.networkActive = true
|
||||||
this.profileService
|
this.profileService
|
||||||
.update(profile)
|
.update(profile)
|
||||||
@@ -204,6 +210,7 @@ export class ProfileEditDialogComponent
|
|||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
this.toastService.showError($localize`Error saving profile`, error)
|
this.toastService.showError($localize`Error saving profile`, error)
|
||||||
|
this.error = error?.error
|
||||||
this.networkActive = false
|
this.networkActive = false
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
@if (clickable) {
|
@if (clickable) {
|
||||||
<a [title]="linkTitle" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</a>
|
<a [title]="linkTitle" class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</a>
|
||||||
}
|
}
|
||||||
|
} @else if (loading) {
|
||||||
|
<span class="placeholder-glow">
|
||||||
|
<span class="placeholder badge private">
|
||||||
|
<span class="text-dark">Loading...</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
} @else {
|
} @else {
|
||||||
@if (!clickable) {
|
@if (!clickable) {
|
||||||
<span class="badge private" i18n>Private</span>
|
<span class="badge private" i18n>Private</span>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user