mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb4b3a5e5e | ||
|
|
7e52757357 | ||
|
|
90b2b8b9bc | ||
|
|
1e1970d6bf | ||
|
|
6993eca51e | ||
|
|
b0c9ef955c | ||
|
|
75b5e38df9 | ||
|
|
06d3660817 | ||
|
|
fada1fac12 | ||
|
|
3153d75048 | ||
|
|
03715d7208 | ||
|
|
95639bcac0 | ||
|
|
7c2304b74f | ||
|
|
d041debbe9 | ||
|
|
e3c0892f71 | ||
|
|
c2602fcd86 | ||
|
|
c54e70f777 | ||
|
|
183ced3106 | ||
|
|
2f65e04748 | ||
|
|
a39a1b227c | ||
|
|
938689d594 | ||
|
|
5471f416e1 | ||
|
|
4dde05662f | ||
|
|
9da7639123 | ||
|
|
46da0ba75a | ||
|
|
f533d16aca | ||
|
|
0e2fb14856 | ||
|
|
df965e7dab | ||
|
|
52e6453e5a | ||
|
|
ef3163dfcc | ||
|
|
1c99a6bf29 | ||
|
|
d32f30941c | ||
|
|
72615db30a | ||
|
|
d7701ffd56 | ||
|
|
f35b828ef9 | ||
|
|
c4d0e41a5f | ||
|
|
8904a84488 | ||
|
|
e3acbceae4 | ||
|
|
a34f977968 | ||
|
|
82c067855a | ||
|
|
15add8144d | ||
|
|
530b6b8619 | ||
|
|
b957af7402 | ||
|
|
8617782dfa | ||
|
|
378aff443c | ||
|
|
5fe04bfb67 | ||
|
|
cd3e5ec7e2 | ||
|
|
b9529540cd | ||
|
|
a1932a2a42 | ||
|
|
4d3d12ff97 | ||
|
|
081d2d919f | ||
|
|
8dc88d96d1 | ||
|
|
c767eafa97 | ||
|
|
9836304f0b | ||
|
|
28cae50f02 | ||
|
|
febd5cf16a | ||
|
|
89d946cde4 | ||
|
|
b7d36b0bf4 | ||
|
|
5f38b7a80e | ||
|
|
590cafcd5d | ||
|
|
d2e9340471 | ||
|
|
acd353f154 | ||
|
|
74df995e7d | ||
|
|
540f5ec5d4 | ||
|
|
ecbfb856e6 | ||
|
|
c7d6d3e490 | ||
|
|
620dadbf5e | ||
|
|
f22985a9ad | ||
|
|
d1cb4e3516 | ||
|
|
cd9aae2d88 | ||
|
|
5f8a7cf482 | ||
|
|
287d08fbe5 | ||
|
|
9a4fd217f3 | ||
|
|
cc5b8f311a | ||
|
|
ebc5071835 | ||
|
|
a8c9e08aa2 | ||
|
|
9524bb7b65 | ||
|
|
7a1fe9f42d | ||
|
|
73469e2d37 | ||
|
|
8de8a5aa67 | ||
|
|
03bd5d6ae6 | ||
|
|
18831b501e | ||
|
|
9fab402b4a | ||
|
|
342d2871e3 | ||
|
|
7e5ff7dea5 | ||
|
|
3474d6ef45 | ||
|
|
7829f10089 | ||
|
|
eb832428cd | ||
|
|
9097bc17f6 | ||
|
|
713176878c | ||
|
|
cb1b30c25d | ||
|
|
0675109501 | ||
|
|
b71bcdecf1 | ||
|
|
e51cdd3ba5 | ||
|
|
7e2bde2cce | ||
|
|
fabf89355f | ||
|
|
49912490dc | ||
|
|
c977c6f649 | ||
|
|
5e4fcf78d1 | ||
|
|
fd8f265b3d | ||
|
|
19d0d1dd17 | ||
|
|
679d2d8549 | ||
|
|
f892edd08c | ||
|
|
cd6f572d40 | ||
|
|
1caa26ee5c | ||
|
|
16b8d496ea | ||
|
|
7d1e6ddbdb | ||
|
|
14aee38339 | ||
|
|
a5b46cfd11 | ||
|
|
72c54bb77d | ||
|
|
133e84c185 | ||
|
|
daabd51426 | ||
|
|
926250b1df | ||
|
|
3721b8b31d | ||
|
|
780a76ed10 | ||
|
|
7ab3417446 | ||
|
|
f0601b6cfb | ||
|
|
a158f12b1b | ||
|
|
207f737da4 | ||
|
|
66bedb80a7 | ||
|
|
1306e1b98e | ||
|
|
933fb07d04 | ||
|
|
c48a51f727 | ||
|
|
5c13a21df8 | ||
|
|
36695df2a5 | ||
|
|
b379bb53db | ||
|
|
8da1088c59 | ||
|
|
8ea6a96a0a | ||
|
|
8358b2227b | ||
|
|
e1b10f883e | ||
|
|
51eea5c444 | ||
|
|
93cc236fea | ||
|
|
8ee8cb73fe | ||
|
|
d623c9802b | ||
|
|
52a056160d | ||
|
|
eeacb60455 | ||
|
|
7d356b5e19 | ||
|
|
321c0925c9 | ||
|
|
6ca0dff202 | ||
|
|
f3a0476c00 | ||
|
|
ecf63b0ccc | ||
|
|
0bf3f94458 | ||
|
|
185570c6a4 | ||
|
|
259ba4939c | ||
|
|
f794709270 | ||
|
|
1abb202030 | ||
|
|
070c72759a | ||
|
|
ac7c3d93fe | ||
|
|
165326abca | ||
|
|
20ac1563ee | ||
|
|
8a8b5e8b09 | ||
|
|
4015192f16 | ||
|
|
3dd68d3e65 | ||
|
|
9d44b3f3e2 | ||
|
|
1083b52a36 | ||
|
|
9f22d02b5d | ||
|
|
c7b48bce2f | ||
|
|
82042473a9 | ||
|
|
6fbbb83cd2 | ||
|
|
df16bc55de | ||
|
|
c90bbbcd30 | ||
|
|
cdf4da3d8d | ||
|
|
d2b40f64df | ||
|
|
030a9e4a29 | ||
|
|
7f12264542 | ||
|
|
83189de8ca | ||
|
|
f5181faf77 | ||
|
|
3a4e889957 | ||
|
|
e039e1716a | ||
|
|
9e8bdc5381 | ||
|
|
0d74e6ec25 | ||
|
|
136fdebf96 | ||
|
|
8892734fa9 | ||
|
|
493af44998 | ||
|
|
04436a739d | ||
|
|
0aa3d0b9d6 | ||
|
|
bad1407412 | ||
|
|
70769674d6 | ||
|
|
bfd83d09b6 | ||
|
|
02baa650fe | ||
|
|
94c598dd6b | ||
|
|
377a7b3abc | ||
|
|
0e8d3e5683 | ||
|
|
64ed512467 | ||
|
|
4364c7d008 | ||
|
|
99ab728ff9 | ||
|
|
98b8a76bca | ||
|
|
f4439cb285 | ||
|
|
f6dcb7aade | ||
|
|
3690697c56 | ||
|
|
94c0ee6437 | ||
|
|
47fc873e1d | ||
|
|
bdaad563ac | ||
|
|
4c86108dcb | ||
|
|
85c057de8c | ||
|
|
acbc4e0222 | ||
|
|
db43260918 | ||
|
|
52a51148cd | ||
|
|
7377724b6b | ||
|
|
2beb52cea8 | ||
|
|
55ed7065ff | ||
|
|
ed7aa22642 | ||
|
|
ac856dd38f | ||
|
|
c5b3b597e8 | ||
|
|
68dcfd14fe | ||
|
|
8f5a091b22 | ||
|
|
57a24eb8ba | ||
|
|
3c00120c32 | ||
|
|
22bfe054bb | ||
|
|
24be123ee5 | ||
|
|
705f12e754 | ||
|
|
942d1f022c | ||
|
|
9e01b2db1a | ||
|
|
bfa0748518 | ||
|
|
c7fa0e3e84 | ||
|
|
681927309e | ||
|
|
e16e698b5c | ||
|
|
d076911d93 | ||
|
|
3e6a5fdf5e | ||
|
|
75f02d9c32 | ||
|
|
04c5b399aa | ||
|
|
407ad71e28 | ||
|
|
a65fe52a2d | ||
|
|
2dbc2a30be | ||
|
|
80b70100bb | ||
|
|
dfbd1a6d18 | ||
|
|
17fdad790a | ||
|
|
6bb55652ec | ||
|
|
f4264cf7a9 | ||
|
|
6e7cd35eda | ||
|
|
bea184b2ea | ||
|
|
80b45a4c58 | ||
|
|
688760a402 | ||
|
|
124b61f286 | ||
|
|
2f9fb01ff1 | ||
|
|
90e1da878d | ||
|
|
87a283cb29 | ||
|
|
49666d2abb | ||
|
|
150a470e58 | ||
|
|
910239b53f | ||
|
|
9e97f5119d | ||
|
|
c9b297d976 | ||
|
|
74717ea829 | ||
|
|
acd6c500e5 | ||
|
|
a8d9e271fe | ||
|
|
a28cd22db7 | ||
|
|
601c04504e | ||
|
|
174debbeea | ||
|
|
33a3e2f8a3 | ||
|
|
698b65b94a | ||
|
|
193baae902 | ||
|
|
89af889874 | ||
|
|
c66af0e134 | ||
|
|
4a016735cb | ||
|
|
d894858793 | ||
|
|
70d767208d | ||
|
|
77dc56591d | ||
|
|
c8397afbfc | ||
|
|
d7af7a3a66 | ||
|
|
4599e34518 | ||
|
|
b335c5df07 | ||
|
|
689d538152 | ||
|
|
9372148915 | ||
|
|
e5bfcf0d53 | ||
|
|
3c6427cbfd | ||
|
|
b530f5c1a4 | ||
|
|
81ca7b868b | ||
|
|
a7cd22f94c | ||
|
|
6a5e8360f0 | ||
|
|
53c0fbeba0 | ||
|
|
cd74045a9f | ||
|
|
e9923f28e3 | ||
|
|
d6652f19b7 | ||
|
|
68a2b16739 | ||
|
|
39cd6c4e91 | ||
|
|
6d842a5e2f | ||
|
|
58cc90526e | ||
|
|
d6f3707d59 | ||
|
|
942349f9de | ||
|
|
25e9d02517 | ||
|
|
0b7110f2bd | ||
|
|
a9ee0fe874 | ||
|
|
f6e9ab0084 | ||
|
|
cda393614c | ||
|
|
91fea6e50d | ||
|
|
131260b5bc | ||
|
|
b3a1ba762c | ||
|
|
fd7836e99c | ||
|
|
1032b472f3 | ||
|
|
2ba6153617 | ||
|
|
69b034fa39 | ||
|
|
c039243a12 | ||
|
|
fcc8f19fe4 | ||
|
|
c6fbe2d099 | ||
|
|
2e8549032e | ||
|
|
240f0dad93 | ||
|
|
1d774f0d51 | ||
|
|
43bcffcbc9 | ||
|
|
e6875719f5 | ||
|
|
7273fa3e3c | ||
|
|
48b383be9a | ||
|
|
3c8b04109f | ||
|
|
5bb1753894 | ||
|
|
223f547a14 | ||
|
|
a2a13d61b0 | ||
|
|
d0c3af88f0 | ||
|
|
bb1cca3072 | ||
|
|
0bccf9c6a5 | ||
|
|
0f58d63375 | ||
|
|
6c54f2e339 | ||
|
|
15f32403d3 | ||
|
|
a6eea8c0e8 | ||
|
|
8f06265ee2 | ||
|
|
48568706fb | ||
|
|
7174dbbc0d | ||
|
|
d88662d69c | ||
|
|
9a0788a329 | ||
|
|
37bc16e1e5 | ||
|
|
13b0d5fe37 | ||
|
|
93285026b9 | ||
|
|
604b3dbe84 | ||
|
|
ae081a430c | ||
|
|
8652966a47 | ||
|
|
165dfa3c16 | ||
|
|
586c85848c | ||
|
|
1295418d3d | ||
|
|
c1a89b98fd | ||
|
|
7f9fc2e957 | ||
|
|
27c3716f3d | ||
|
|
eb0df61e7f | ||
|
|
bb4a013939 | ||
|
|
23c81e0b6c | ||
|
|
bc5bf3c25e | ||
|
|
b8734a8630 | ||
|
|
83bc49af81 | ||
|
|
a4e7a37509 | ||
|
|
464e0309bf | ||
|
|
cc4a494185 | ||
|
|
6903f630f0 | ||
|
|
3f5e4f3f14 | ||
|
|
b058dcee4d | ||
|
|
a8850a4f9c | ||
|
|
08412ca264 | ||
|
|
4f022b8af6 | ||
|
|
c28f6de378 | ||
|
|
035257dae9 | ||
|
|
17a8fd5c7f | ||
|
|
6f3f6cc5a8 | ||
|
|
20c67216fe | ||
|
|
a53b2fa68f | ||
|
|
02b101ad88 | ||
|
|
358927a114 | ||
|
|
01e88410cd | ||
|
|
046d854ec9 | ||
|
|
f5d2a208f8 | ||
|
|
38db577f31 | ||
|
|
71b0eb9b7c | ||
|
|
fa28e3fba8 | ||
|
|
79cc436257 | ||
|
|
67fa4344c6 | ||
|
|
7b2d37fb41 | ||
|
|
dffbafd30f | ||
|
|
dd57704ed1 | ||
|
|
d3aa34e7b8 | ||
|
|
c5f30d8b7f | ||
|
|
3a4163cfc3 | ||
|
|
2120be5ae1 | ||
|
|
c916b15473 | ||
|
|
0ef02911a8 | ||
|
|
246b23eaf7 | ||
|
|
b4e66b7584 | ||
|
|
9ceb4dbf55 | ||
|
|
49dd8dcb00 | ||
|
|
efeb55f57a | ||
|
|
85da7079fb | ||
|
|
bb733d7692 | ||
|
|
dd8242b82f | ||
|
|
709fa87f4a | ||
|
|
35f3f6c9db | ||
|
|
f918deef0f | ||
|
|
deb4eed14e | ||
|
|
828ca63713 | ||
|
|
133be01324 | ||
|
|
75694ac644 | ||
|
|
9a18cc3dda | ||
|
|
a72b297268 | ||
|
|
651378d163 | ||
|
|
ab884547f4 | ||
|
|
8ac7afe95f | ||
|
|
c72a05d11a | ||
|
|
01f52748f3 | ||
|
|
60f569afe6 | ||
|
|
d8fff9a41a | ||
|
|
f546ff2383 | ||
|
|
e38168789d | ||
|
|
ce646dc937 | ||
|
|
ae1f084fb1 | ||
|
|
cf6f67e789 | ||
|
|
3ccce83480 | ||
|
|
0d65eec4f2 | ||
|
|
b26b148779 | ||
|
|
57a657445e | ||
|
|
b5a97bcd11 | ||
|
|
a4359731b1 | ||
|
|
c05ff7b9a8 | ||
|
|
d7b0641295 | ||
|
|
105a1ed0c1 | ||
|
|
1a02de4b5b | ||
|
|
59ee94667d | ||
|
|
14afc74adb | ||
|
|
ab1067e0b1 | ||
|
|
9bd503a71b | ||
|
|
a81050e9b8 | ||
|
|
22d000b913 | ||
|
|
1081ea7c88 | ||
|
|
28891103f6 | ||
|
|
a86e9d34e8 | ||
|
|
57413fd66a | ||
|
|
1b9ec7b9a1 | ||
|
|
2268f9d8bd | ||
|
|
24b6b9b024 | ||
|
|
07f1028d03 | ||
|
|
c640c5c376 | ||
|
|
0999864cef | ||
|
|
1122e49ca9 | ||
|
|
f72277a398 | ||
|
|
f467e31d17 | ||
|
|
8ff76652d4 | ||
|
|
20c4d90217 | ||
|
|
10caa20b09 | ||
|
|
720374efd8 | ||
|
|
3be07b147b | ||
|
|
c2a9c36829 | ||
|
|
95b88095c4 | ||
|
|
18740f4c22 | ||
|
|
5b9fa791a8 | ||
|
|
b1ab04a764 | ||
|
|
55c3f574f4 | ||
|
|
1984f72d5e | ||
|
|
878e53f418 | ||
|
|
887fdc7e6d | ||
|
|
bfdb37526e | ||
|
|
dc0a1ad049 | ||
|
|
24ac6b2bd2 |
No files matched your search
@@ -14,4 +14,4 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
|
||||
uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1
|
||||
@@ -53,9 +53,14 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Release to complete, without the v (e.g. 10.58). Empty = the newest release.'
|
||||
description: 'Release to complete, without the v (e.g. 10.58). Empty = check the newest releases and complete each one that is missing something.'
|
||||
required: false
|
||||
type: string
|
||||
scan:
|
||||
description: 'With no version: how many of the newest releases to check.'
|
||||
required: false
|
||||
type: string
|
||||
default: '10'
|
||||
|
||||
# Read-only by default; the job that writes is granted it below.
|
||||
permissions:
|
||||
@@ -74,6 +79,10 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
recover:
|
||||
# One release at a time: with no version, scan below starts a run of this
|
||||
# workflow for every release that is missing something, and each of those
|
||||
# recovers its own release.
|
||||
if: ${{ inputs.version != '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
@@ -95,6 +104,41 @@ jobs:
|
||||
[ -n "$V" ] || V="$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq .tagName)"
|
||||
python3 releases/retry-failed-release.py "$V"
|
||||
|
||||
# With no version: which releases are missing something. Each of them gets a
|
||||
# run of its own (`-f version=...`), which does everything below for it -
|
||||
# retries the failed jobs of its full release, builds what can be built,
|
||||
# renames the variant snaps and finishes its Snap Store release - so one
|
||||
# run of this workflow, with no input, adds everything that is missing.
|
||||
scan:
|
||||
if: ${{ inputs.version == '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
timeout-minutes: 15
|
||||
name: which releases are missing something
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Start a run for each incomplete release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
SCAN: ${{ inputs.scan }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
case "${SCAN:-10}" in ''|*[!0-9]*) echo "::error::scan must be a number of releases, not '$SCAN'."; exit 1 ;; esac
|
||||
bash releases/release-missing-scan.sh "${GITHUB_REPOSITORY:-wekan/wekan}" "${SCAN:-10}" > incomplete.txt
|
||||
{
|
||||
echo "### Releases missing something"
|
||||
echo ""
|
||||
if [ -s incomplete.txt ]; then sed 's/^/- /' incomplete.txt; else echo "None - the ${SCAN:-10} newest releases are complete."; fi
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
while read -r version count; do
|
||||
echo "v$version is missing $count asset(s): starting Release all missing for it."
|
||||
gh workflow run release-all-missing.yml --repo "${GITHUB_REPOSITORY:-wekan/wekan}" --ref "${GITHUB_REF_NAME:-main}" -f version="$version"
|
||||
done < incomplete.txt
|
||||
|
||||
plan:
|
||||
needs: recover
|
||||
# The planner runs whatever recover's rerun ended with. A rerun that still
|
||||
@@ -102,7 +146,7 @@ jobs:
|
||||
# so in every rerun of it (v12.68's OpenBSD start) - used to skip the
|
||||
# planner and every build after it, so not even the assets that COULD be
|
||||
# filled were. recover stays red and names the jobs; the rest goes on.
|
||||
if: ${{ !cancelled() }}
|
||||
if: ${{ !cancelled() && inputs.version != '' }}
|
||||
timeout-minutes: 15
|
||||
name: what the release is missing
|
||||
runs-on: ubuntu-latest
|
||||
@@ -114,6 +158,8 @@ jobs:
|
||||
mac: ${{ steps.plan.outputs.mac }}
|
||||
flatpak: ${{ steps.plan.outputs.flatpak }}
|
||||
windows: ${{ steps.plan.outputs.windows }}
|
||||
variant: ${{ steps.plan.outputs.variant }}
|
||||
snap: ${{ steps.plan.outputs.snap }}
|
||||
manual: ${{ steps.plan.outputs.manual }}
|
||||
total: ${{ steps.plan.outputs.total }}
|
||||
steps:
|
||||
@@ -168,7 +214,7 @@ jobs:
|
||||
total="$(wc -l < missing.txt | tr -d ' ')"
|
||||
echo "total=$total" >> "$GITHUB_OUTPUT"
|
||||
|
||||
for kind in extra appimage mac flatpak windows bun; do
|
||||
for kind in extra appimage mac flatpak windows bun variant snap; do
|
||||
sels="$(awk -v k="$kind" '$1 == k { print $2 }' missing.txt)"
|
||||
json="$(printf '%s\n' $sels | sed '/^$/d' | jq -R . | jq -sc .)"
|
||||
[ -n "$json" ] || json='[]'
|
||||
@@ -197,18 +243,25 @@ jobs:
|
||||
echo ""
|
||||
echo "Not buildable here (run release-all.yml): \`$manual\`"
|
||||
fi
|
||||
if grep -q '^snap ' missing.txt; then
|
||||
echo ""
|
||||
echo "wekan snaps are rebuilt by retrying the release's snap-native or snap-launchpad job (recover, above)."
|
||||
fi
|
||||
fi
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Missing $total. Needs release-all.yml: ${manual:-none}"
|
||||
|
||||
# Not a failure HERE: a red plan skipped every build below (they need
|
||||
# plan to succeed), so a release missing its amd64 zip did not get even
|
||||
# the AppImages that could be made. The done job, at the end, is red
|
||||
# for it instead.
|
||||
- name: Say plainly what this run will not do
|
||||
if: ${{ steps.plan.outputs.manual != '' }}
|
||||
env:
|
||||
STEP_PLAN_VERSION: ${{ steps.plan.outputs.version }}
|
||||
STEP_PLAN_MANUAL: ${{ steps.plan.outputs.manual }}
|
||||
run: |
|
||||
echo "::error::v${STEP_PLAN_VERSION} still lacks ${STEP_PLAN_MANUAL} after recovery. Inspect the matching full-release run; older unnamed runs need their failed jobs retried manually."
|
||||
exit 1
|
||||
echo "::warning::v${STEP_PLAN_VERSION} still lacks ${STEP_PLAN_MANUAL} after recovery, which this workflow cannot build; the rest is built anyway. Inspect the matching full-release run; older unnamed runs need their failed jobs retried manually."
|
||||
|
||||
# The six architectures nobody else builds for, repacked from the PUBLISHED
|
||||
# amd64 bundle - which is what makes this possible without a Meteor build.
|
||||
@@ -517,6 +570,74 @@ jobs:
|
||||
esac
|
||||
echo "$mark charts" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
# wekan-ondra and wekan-gantt-gpl snaps the release lacks: the release's own
|
||||
# wekan snap of that architecture under the variant's name and title
|
||||
# (releases/snap-rename.sh) - what snap-variants builds from source, with
|
||||
# nothing else changed. Releases before v13.21 have none attached.
|
||||
variants:
|
||||
permissions:
|
||||
contents: write
|
||||
name: variant snap ${{ matrix.variant }}
|
||||
needs: plan
|
||||
if: ${{ !cancelled() && needs.plan.result == 'success' && needs.plan.outputs.variant != '[]' }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
variant: ${{ fromJSON(needs.plan.outputs.variant) }}
|
||||
env:
|
||||
VERSION: ${{ needs.plan.outputs.version }}
|
||||
VARIANT: ${{ matrix.variant }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Rename the release's wekan snap
|
||||
id: rename
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
name="${VARIANT%%:*}"
|
||||
arch="${VARIANT#*:}"
|
||||
case "$name" in
|
||||
wekan-ondra) title='Wekan Ondra' ;;
|
||||
wekan-gantt-gpl) title='Wekan Gantt GPL' ;;
|
||||
*) echo "::error::'$name' is not a variant snap."; exit 1 ;;
|
||||
esac
|
||||
case "$arch" in *[!a-z0-9]*|'') echo "::error::'$arch' is not an architecture."; exit 1 ;; esac
|
||||
sudo apt-get install -y squashfs-tools >/dev/null
|
||||
mkdir -p source out
|
||||
if ! gh release download "v$VERSION" --repo "$GITHUB_REPOSITORY" --dir source --pattern "wekan_${VERSION}_${arch}.snap"; then
|
||||
echo "::error::v$VERSION has no wekan_${VERSION}_${arch}.snap to make $name from. Retry the release's snap job first (recover does), then run this again."
|
||||
exit 1
|
||||
fi
|
||||
bash releases/snap-rename.sh "source/wekan_${VERSION}_${arch}.snap" "$name" "$title" out
|
||||
- name: Attach it to the release
|
||||
if: ${{ always() && steps.rename.outcome == 'success' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash releases/github-release-upload.sh "$GITHUB_REPOSITORY" "v$VERSION" out/*.snap
|
||||
|
||||
# Every snap of the release, in every channel of its snap name: the same
|
||||
# "Push Snap to Store" that release-all.yml ends with. A revision the store
|
||||
# already has is released by number; nothing is uploaded twice.
|
||||
snap-store:
|
||||
needs: [plan, variants]
|
||||
if: ${{ !cancelled() && needs.plan.result == 'success' }}
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/snap-store.yml
|
||||
with:
|
||||
tag: v${{ needs.plan.outputs.version }}
|
||||
snaps: wekan wekan-ondra wekan-gantt-gpl
|
||||
channels: stable,candidate,beta,edge
|
||||
secrets:
|
||||
SNAP_AUTH: ${{ secrets.SNAP_AUTH }}
|
||||
|
||||
# The end of the run attaches nothing: every job above attached its own files
|
||||
# as it finished them. This only reports what the release still lacks, and it
|
||||
# runs on always() - not !cancelled() - so a cancelled run still says what
|
||||
@@ -525,7 +646,7 @@ jobs:
|
||||
done:
|
||||
timeout-minutes: 15
|
||||
name: what is still missing
|
||||
needs: [plan, extra-arches, appimage, mac, flatpak, windows-exe, charts, bun]
|
||||
needs: [plan, extra-arches, appimage, mac, flatpak, windows-exe, charts, bun, variants, snap-store]
|
||||
if: ${{ always() && needs.plan.result == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -566,3 +687,10 @@ jobs:
|
||||
echo "::warning::v$V is still missing:${still}"
|
||||
echo "Still missing:\`${still# }\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
# What only release-all.yml can build, still missing: red here,
|
||||
# once everything that could be built has been.
|
||||
case " $still" in
|
||||
*" meteor/"*|*" repack/"*|*" sandstorm/"*)
|
||||
echo "::error::v$V still lacks what only release-all.yml builds:${still}. Inspect the matching full-release run."
|
||||
exit 1 ;;
|
||||
esac
|
||||
@@ -76,7 +76,9 @@ run-name: Release v${{ inputs.new_version }}
|
||||
# native runner. core24 allows stable and candidate (core26 does not).
|
||||
# snap-variants publishes the SAME snap under the two older names
|
||||
# people still have installed, wekan-ondra and wekan-gantt-gpl, on
|
||||
# amd64 + arm64 - so one release publishes all THREE snaps. It needs
|
||||
# amd64 + arm64, and each snap-launchpad leg makes them from its own
|
||||
# wekan snap for ppc64el, s390x, riscv64 and armhf - so one release
|
||||
# publishes all THREE snaps on every architecture. It needs
|
||||
# SNAP_AUTH to carry the ACL for all three names.
|
||||
# `snap set wekan database=ferretdb` switches the running backend to
|
||||
# FerretDB v1 (snapcraft-core26.yaml is the core26 variant)
|
||||
@@ -5448,6 +5450,47 @@ jobs:
|
||||
echo "No ${MATRIX_ARCH} snap to attach - the build produced none."
|
||||
fi
|
||||
|
||||
# wekan-ondra and wekan-gantt-gpl on this architecture too. They ARE
|
||||
# wekan under another snap name, so they are made from the snap this leg
|
||||
# just built - releases/snap-rename.sh changes `name:` and `title:` in
|
||||
# meta/snap.yaml and nothing else - instead of three Launchpad builds of
|
||||
# one program. snap-variants builds them natively for amd64 and arm64 only,
|
||||
# so until this step ppc64el, s390x, riscv64 and armhf users of the two
|
||||
# older names were left on whatever the store last had. Each goes to every
|
||||
# channel, like wekan, and onto the GitHub Release, so "Push Snap to
|
||||
# Store" (snap-store below) finishes any the store keeps processing.
|
||||
- name: Publish wekan-ondra and wekan-gantt-gpl ${{ matrix.arch }} from this snap (all channels)
|
||||
if: ${{ always() && steps.bundle.outputs.available == 'true' && steps.launchpad.outputs.built == 'true' }}
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_AUTH }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MATRIX_ARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
src="wekan_${VERSION}_${MATRIX_ARCH}.snap"
|
||||
if [ ! -s "$src" ] || [ "$(head -c4 "$src")" != "hsqs" ]; then
|
||||
echo "::error::No usable $src to make the ${MATRIX_ARCH} variant snaps from - see the build step above."
|
||||
exit 1
|
||||
fi
|
||||
sudo apt-get install -y squashfs-tools >/dev/null
|
||||
# Their own directory: the wekan steps above glob *_<arch>.snap here.
|
||||
mkdir -p variant-snaps
|
||||
failed=""
|
||||
for pair in 'wekan-ondra:Wekan Ondra' 'wekan-gantt-gpl:Wekan Gantt GPL'; do
|
||||
name="${pair%%:*}"
|
||||
title="${pair#*:}"
|
||||
out="$(bash releases/snap-rename.sh "$src" "$name" "$title" variant-snaps)"
|
||||
echo "OK: $out"
|
||||
# Attached first: the GitHub Release is what snap-store releases
|
||||
# from, so a store refusal here is still finished there.
|
||||
bash releases/github-release-upload.sh "${GITHUB_REPOSITORY:-wekan/wekan}" "v${VERSION}" "$out" || failed="$failed attach:$name"
|
||||
SNAP_UPLOAD_LABEL="$out" bash releases/snap-upload-retry.sh "$out" stable,candidate,beta,edge || failed="$failed store:$name"
|
||||
done
|
||||
if [ -n "$failed" ]; then
|
||||
echo "::error::${MATRIX_ARCH} variant snaps not fully published:$failed. snap-store below retries the store from the GitHub Release; Release All Missing re-makes one that was not attached."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Always, as the last step: the run summary then answers "what worked and what
|
||||
# did not" for the whole release at a glance, instead of eighteen job logs. A
|
||||
# step that failed has already printed an ::error:: saying why; this names the
|
||||
@@ -5530,6 +5573,10 @@ jobs:
|
||||
needs: [prepare, release, snap-auth-check]
|
||||
continue-on-error: true
|
||||
timeout-minutes: 90
|
||||
# contents: write attaches the built snap to the GitHub Release; the
|
||||
# workflow's default is read.
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -5655,6 +5702,7 @@ jobs:
|
||||
echo "snap=$BUILT_SNAP" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Verify the built snap is ${{ matrix.snapname }}
|
||||
id: verify
|
||||
if: steps.guard.outputs.snap == 'true'
|
||||
env:
|
||||
STEP_BUILD_SNAP: ${{ steps.build.outputs.snap }}
|
||||
@@ -5684,6 +5732,21 @@ jobs:
|
||||
SNAP_UPLOAD_LABEL="${STEP_BUILD_SNAP}" \
|
||||
bash "$GITHUB_WORKSPACE/wekan/releases/snap-upload-retry.sh" "${STEP_BUILD_SNAP}" stable,candidate,beta,edge
|
||||
|
||||
# always(): a built variant snap goes onto the GitHub Release even when the
|
||||
# Snap Store push above failed. "Push Snap to Store"
|
||||
# (.github/workflows/snap-store.yml) releases the snaps OF A GITHUB
|
||||
# RELEASE to the store - and until v13.21 this job only uploaded to the
|
||||
# store, so v13.20 had no wekan-ondra_*.snap or wekan-gantt-gpl_*.snap and
|
||||
# that workflow failed with "no assets match the file pattern".
|
||||
- name: Attach the ${{ matrix.snapname }} ${{ matrix.arch }} snap to the GitHub Release
|
||||
if: ${{ always() && steps.verify.outcome == 'success' && steps.build.outputs.snap != '' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
STEP_BUILD_SNAP: ${{ steps.build.outputs.snap }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bash "$GITHUB_WORKSPACE/wekan/releases/github-release-upload.sh" "${GITHUB_REPOSITORY:-wekan/wekan}" "v${VERSION}" "${STEP_BUILD_SNAP}"
|
||||
|
||||
# Always, as the last step: the run summary then answers "what worked and what
|
||||
# did not" for the whole release at a glance, instead of eighteen job logs. A
|
||||
# step that failed has already printed an ::error:: saying why; this names the
|
||||
@@ -5710,6 +5773,28 @@ jobs:
|
||||
|
||||
# Refresh the selected changelog notes after builds. Binary provenance remains
|
||||
# in build artifacts and is never appended to release notes.
|
||||
# ─── Finish the Snap Store release of all three snaps ───────────────────────
|
||||
# snap-native, snap-launchpad and snap-variants upload each snap with
|
||||
# --release to every channel, but the store can keep a revision in
|
||||
# "processing" for hours and then not release it: on v13.20 every snap job
|
||||
# was green and the store kept the old version of wekan, wekan-ondra and
|
||||
# wekan-gantt-gpl. This job takes the snaps those jobs attached to THIS
|
||||
# release and releases each to stable, candidate, beta and edge - a revision
|
||||
# the store already has by number, a missing one by uploading it - and is red
|
||||
# when one did not get there. It also runs by hand as "Push Snap to Store".
|
||||
snap-store:
|
||||
needs: [prepare, snap-native, snap-launchpad, snap-variants]
|
||||
if: ${{ !cancelled() && needs.prepare.result == 'success' }}
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/snap-store.yml
|
||||
with:
|
||||
tag: v${{ needs.prepare.outputs.version }}
|
||||
snaps: wekan wekan-ondra wekan-gantt-gpl
|
||||
channels: stable,candidate,beta,edge
|
||||
secrets:
|
||||
SNAP_AUTH: ${{ secrets.SNAP_AUTH }}
|
||||
|
||||
release-notes:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -15,8 +15,11 @@ name: Push Snap to Store
|
||||
# processing, and FAILS - red, not green - when a snap still did not reach a
|
||||
# channel.
|
||||
#
|
||||
# It runs after every "Release All Platforms" run, and by hand from the
|
||||
# Actions tab for any release, snap names and channels.
|
||||
# "Release All Platforms" calls it as its last snap job, for the tag it just
|
||||
# released (its snap-store job), and it runs by hand from the Actions tab for
|
||||
# any release, snap names and channels. It used to run on workflow_run after
|
||||
# every Release All run and take "the latest release" - which, for a run that
|
||||
# finished before its release was published, was the previous one (v13.20).
|
||||
#
|
||||
# Secrets: SNAP_AUTH, as for release-all.yml - an exported login carrying
|
||||
# package_access, package_push, package_release and package_update for all
|
||||
@@ -37,9 +40,22 @@ on:
|
||||
description: 'Channels to release to'
|
||||
required: false
|
||||
default: 'stable,candidate,beta,edge'
|
||||
workflow_run:
|
||||
workflows: ['Release All Platforms']
|
||||
types: [completed]
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
snaps:
|
||||
type: string
|
||||
required: false
|
||||
default: 'wekan wekan-ondra wekan-gantt-gpl'
|
||||
channels:
|
||||
type: string
|
||||
required: false
|
||||
default: 'stable,candidate,beta,edge'
|
||||
secrets:
|
||||
SNAP_AUTH:
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -64,9 +80,9 @@ jobs:
|
||||
id: plan
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
INPUT_TAG: ${{ github.event.inputs.tag }}
|
||||
INPUT_SNAPS: ${{ github.event.inputs.snaps }}
|
||||
INPUT_CHANNELS: ${{ github.event.inputs.channels }}
|
||||
INPUT_TAG: ${{ inputs.tag }}
|
||||
INPUT_SNAPS: ${{ inputs.snaps }}
|
||||
INPUT_CHANNELS: ${{ inputs.channels }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag="${INPUT_TAG:-}"
|
||||
@@ -101,6 +117,7 @@ jobs:
|
||||
sparse-checkout: releases
|
||||
persist-credentials: false
|
||||
- name: Install snapcraft and check SNAP_AUTH
|
||||
id: snapcraft
|
||||
env:
|
||||
SNAP_AUTH: ${{ secrets.SNAP_AUTH }}
|
||||
run: |
|
||||
@@ -126,12 +143,42 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p snaps
|
||||
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir snaps --pattern "${SNAP}_*.snap"
|
||||
ls -l snaps
|
||||
if ! ls snaps/"${SNAP}"_*.snap >/dev/null 2>&1; then
|
||||
echo "::error::Release $TAG has no ${SNAP}_*.snap to push."
|
||||
exit 1
|
||||
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir snaps --pattern "${SNAP}_*.snap" || true
|
||||
case "$SNAP" in
|
||||
wekan-ondra) title='Wekan Ondra' ;;
|
||||
wekan-gantt-gpl) title='Wekan Gantt GPL' ;;
|
||||
*) title='' ;;
|
||||
esac
|
||||
if [ -z "$title" ]; then
|
||||
if ! ls snaps/"${SNAP}"_*.snap >/dev/null 2>&1; then
|
||||
echo "::error::Release $TAG has no ${SNAP}_*.snap to push: its snap job did not attach one (snap-native and snap-launchpad attach wekan). Re-run that job of the release, or Release All Missing, then this workflow."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# A variant IS wekan with another name and title, so one the release
|
||||
# lacks is made from the release's wekan snap of that architecture
|
||||
# (releases/snap-rename.sh), as Release All Missing does. Per
|
||||
# ARCHITECTURE, not only when the release has none at all: a release
|
||||
# with the amd64 and arm64 variants snap-variants builds, but not the
|
||||
# ppc64el, s390x, riscv64 or armhf ones, used to push those two and
|
||||
# leave every other architecture of the variant behind.
|
||||
mkdir -p wekan-snaps
|
||||
if ! gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir wekan-snaps --pattern "wekan_*.snap"; then
|
||||
if ! ls snaps/"${SNAP}"_*.snap >/dev/null 2>&1; then
|
||||
echo "::error::Release $TAG has neither ${SNAP}_*.snap nor a wekan_*.snap to make it from. Re-run the release's snap jobs, or Release All Missing, then this workflow."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
for f in wekan-snaps/wekan_*.snap; do
|
||||
[ -e "$f" ] || continue
|
||||
rest="$(basename "$f")"; rest="${rest#wekan_}"
|
||||
[ -e "snaps/${SNAP}_${rest}" ] && continue
|
||||
command -v unsquashfs >/dev/null 2>&1 || sudo apt-get install -y squashfs-tools >/dev/null
|
||||
bash releases/snap-rename.sh "$f" "$SNAP" "$title" snaps
|
||||
echo "::notice::$TAG had no ${SNAP}_${rest}; made it from the release's wekan snap."
|
||||
done
|
||||
fi
|
||||
ls -l snaps
|
||||
- name: Push ${{ matrix.snap }} to the Snap Store, releasing to ${{ needs.plan.outputs.channels }}
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_AUTH }}
|
||||
@@ -148,3 +195,42 @@ jobs:
|
||||
echo "::error::Not released:$failed. The ::error:: lines above say why."
|
||||
exit 1
|
||||
fi
|
||||
# The newest revision the store has of each architecture, released to
|
||||
# every channel too - one that reached the store some other way, or a
|
||||
# reviewer approved later, whatever this release's files are. always():
|
||||
# also when a file above was not taken.
|
||||
- name: Release the newest ${{ matrix.snap }} revisions the store has to ${{ needs.plan.outputs.channels }}
|
||||
if: ${{ always() && steps.snapcraft.outcome == 'success' }}
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_AUTH }}
|
||||
CHANNELS: ${{ needs.plan.outputs.channels }}
|
||||
SNAP: ${{ matrix.snap }}
|
||||
run: bash releases/snap-store-release-newest.sh "$SNAP" "$CHANNELS"
|
||||
# "What's new in WeKan v<version>" - the release's In short paragraph
|
||||
# from CHANGELOG-big.md - on the snap's Snap Store page. The store has no
|
||||
# API for a revision's own changelog (the dashboard's "Add changelog" is a
|
||||
# web form only), so it goes on the listing: releases/snap-listing.mjs
|
||||
# writes the text and releases/snap-listing-update.sh sends it with
|
||||
# `snapcraft upload-metadata`, the store's title, summary, license and
|
||||
# icon kept as they are. Only for the NEWEST release: run for an older
|
||||
# tag, this workflow would put that older What's new back on the page.
|
||||
# continue-on-error: the snaps are released by now; a page that kept the
|
||||
# previous text is an ::error:: to read, not a release to redo.
|
||||
- name: Show what is new in ${{ needs.plan.outputs.tag }} on the ${{ matrix.snap }} Snap Store page
|
||||
if: ${{ always() && steps.snapcraft.outcome == 'success' }}
|
||||
continue-on-error: true
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_AUTH }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ needs.plan.outputs.tag }}
|
||||
SNAP: ${{ matrix.snap }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
newest="$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq .tagName)"
|
||||
if [ "$TAG" != "$newest" ]; then
|
||||
echo "$TAG is not the newest release ($newest): the $SNAP page keeps the newest one's What's new."
|
||||
exit 0
|
||||
fi
|
||||
command -v mksquashfs >/dev/null 2>&1 || sudo apt-get install -y squashfs-tools >/dev/null
|
||||
gh api -H 'Accept: application/vnd.github.raw' "repos/$GITHUB_REPOSITORY/contents/CHANGELOG-big.md?ref=$TAG" > changelog-big.md
|
||||
bash releases/snap-listing-update.sh "$SNAP" "${TAG#v}" changelog-big.md
|
||||
@@ -126,3 +126,9 @@ mongo-tools-patches/
|
||||
|
||||
# Generated on the Windows single-EXE runner (releases/append-windows-payload.mjs --manifest)
|
||||
wekan-real-files.h
|
||||
|
||||
# The Meteor 3 hosting menu's settings (docs/Platforms/FOSS/Container/Docker/Meteor3/build.sh): this machine's server name and directory.
|
||||
docs/Platforms/FOSS/Container/Docker/Meteor3/settings.ini
|
||||
|
||||
# Python bytecode of the release scripts (releases/sec/ and others).
|
||||
__pycache__/
|
||||
@@ -270,8 +270,27 @@ replaced with the language named by that tag.**
|
||||
### Shared translation source for WeKan prototypes under `.tools/`
|
||||
|
||||
The WeKan catalogs in `imports/i18n/data/` are the source of truth for
|
||||
translations in every WeKan prototype under `.tools/`, including WeLite,
|
||||
Weddy, Wami, and any future WeKan prototype with its own catalog.
|
||||
translations in every WeKan prototype under `.tools/`, including Omi, Wami,
|
||||
Weddy, WeLite, and any future WeKan prototype with its own catalog. A prototype
|
||||
does not keep translations of its own that WeKan's catalogs do not have.
|
||||
|
||||
Version control translations come from ONE place too:
|
||||
`.tools/w/gitea-patches/dist/translations/gitea-locale/locale_<lang>.json`,
|
||||
upstream Gitea's locale files with gitea-patches' own translations merged in.
|
||||
Only gitea-patches has the complete Finnish, so a prototype never takes its
|
||||
Gitea strings from upstream Gitea directly. Refresh them with gitea-patches'
|
||||
`./build.sh translations` (menu: "Download the newest Gitea translations from
|
||||
upstream") and commit them there.
|
||||
|
||||
So a prototype that needs translations - Omi, Wami, Weddy, WeLite,
|
||||
github-to-gitea and the rest of the WeKan and version control prototypes under
|
||||
`.tools/w/` - COPIES them directly: WeKan's strings from WeKan's catalogs, and
|
||||
Gitea's own things (repositories, issues, pull requests, releases,
|
||||
organizations) from gitea-patches' `gitea-locale`, into its own catalog format.
|
||||
It uses no other translation source. Gitea's strings are NOT added to WeKan's
|
||||
catalogs (decided 2026-11-22: they would grow every WeKan locale file by about
|
||||
45 %). A string that neither has is added to WeKan's catalog, as in step 2
|
||||
below, and is used from there in WeKan and in the `.tools` repositories.
|
||||
|
||||
1. Before adding a translation key in a prototype, search WeKan's English
|
||||
catalog for a key with the same meaning and usage. Reuse that key and its
|
||||
@@ -748,6 +767,21 @@ directly after the merge.
|
||||
WeKan ® release` of `CHANGELOG-big.md`, linking the commit (its `Fixes #NNNN`
|
||||
closes the issue). A done item never stays in `TODO.md`.
|
||||
`tests/todoFile.test.cjs` checks the file.
|
||||
- **Every time `TODO.md` is updated, check EVERY item in it for being done
|
||||
already** - not only the one that prompted the update. Releases are frequent,
|
||||
so an item is often finished, and even released, while it still sits there.
|
||||
Check from the source, not from the wording: the code, `git log`, the issue's
|
||||
state, the Snap Store or the GitHub Release. Then:
|
||||
- **done and NOT released yet** (its commit is not an ancestor of the newest
|
||||
release's `Prepare v… release` commit: `git merge-base --is-ancestor
|
||||
<commit> <prepare-commit>`) - move it: remove it from `TODO.md` and write
|
||||
its entry in `# Upcoming WeKan ® release`, linking the commit;
|
||||
- **done and ALREADY released** - just remove it from `TODO.md`. Its release
|
||||
is a record, and an entry is never added to a released section afterwards;
|
||||
- **partly done** - shorten it to what is left, and say what was released.
|
||||
A security advisory is the same: once its fix is released and its GHSA
|
||||
published, it is done, and nothing about it stays in WeKan's `TODO.md` - not
|
||||
the advisory and not the wait for its CVE number.
|
||||
- FerretDB Upcoming structure — `### New Features 🎉`, `### Fixed 🐛`, `### Other Changes
|
||||
🤖`; entries end `... by @xet7. Thanks to xet7.`
|
||||
- Word-wrap both CHANGELOGs at 80 chars, but never break a long link across lines (a
|
||||
@@ -976,6 +1010,26 @@ have cost a released section its accuracy:
|
||||
the change in Audit-Stars.md. Match by the report's subject and reporter, not by
|
||||
a nearby advisory - a GHSA about something else is no upgrade. Until the GHSA
|
||||
exists, the row stays at 3 and its Process cell says the GHSA is awaited.
|
||||
- **Every new security issue updates the Hall of Fame, and every Hall of Fame
|
||||
update fills in the GHSA and CVE details that are missing.** Compare the
|
||||
published advisories (`releases/sec/download-github-security.sh` saves them,
|
||||
or `https://api.github.com/repos/wekan/wekan/security-advisories?state=published`
|
||||
read to its LAST page - there are more than 100, so one `per_page=100`
|
||||
request misses the oldest, which then look unpublished) with
|
||||
`hall-of-fame/index.html`:
|
||||
- a **published GHSA with no row** gets one - the row, its own page,
|
||||
`Audit-Icons.md`, `Audit-Stars.md`, the page's exact URLs in wekan.fi's
|
||||
`releases/risk-baseline.json`, and a catalog key or a recorded reason in
|
||||
`tests/hallOfFameProblemsCoverage.test.cjs` - even when the fix shipped long
|
||||
before the advisory, as OidcRaceBleed's did (GHSA-6944-p22h-3qpx, 2026-11-23);
|
||||
- a row whose advisory has a **CVE assigned** gets it in its CVE cell, on the
|
||||
index AND on its own page, in place of "CVE requested";
|
||||
- a row linking an advisory that is **not public** (the API answers 404) is
|
||||
named to the maintainer: it is a draft or was closed, and readers get a
|
||||
404 from it.
|
||||
A CVE that is requested but not assigned yet is NOT a TODO item: requesting
|
||||
it is part of publishing the advisory, and the CVE cell says "CVE requested"
|
||||
until the next Hall of Fame update finds the number.
|
||||
- **On the Hall of Fame index page, the Process and Vulnerabilities cells are
|
||||
collapsed.** Those two columns carry the prose — how the report arrived, and the
|
||||
whole story of the vulnerability — so the page would be one wall of text and the
|
||||
|
||||
+1611
-2845
File diff suppressed because it is too large.
Load diff
+39
-36
@@ -5,53 +5,56 @@ each one changed and the project status are in
|
||||
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
|
||||
make changes there.
|
||||
|
||||
# v13.21 2026-11-20 WeKan ® release
|
||||
# v13.30 2026-11-23 WeKan ® release
|
||||
|
||||
Twelve new **Board View reports** - Created vs. Resolved, Net
|
||||
Flow, Time in List and more - and **grouped menus**: the Board View menu, the
|
||||
Import and Export lists and the list, card and swimlane menus have headings.
|
||||
WeKan imports **mail**, **calendars**, **chats** and **notes**, and large files
|
||||
are **streamed to disk** within the free space or an Admin Panel limit. Menu
|
||||
entries that did nothing now work. Cards get the **Kanban and Scrum flow
|
||||
fields** Blocked, Class of service, MoSCoW and WSJF, lists their **policies**,
|
||||
the board menu a **standup timer** and a **retrospective board**, every export
|
||||
is **written a page at a time**, and **InviteBleed** is closed for the old
|
||||
invitation codes too.
|
||||
The **wekan-ondra** and **wekan-gantt-gpl** snaps are published on
|
||||
every architecture the wekan snap has, on all four channels, and each **Snap
|
||||
Store page** shows what is new in the newest release. **Time tracking**
|
||||
works again on imported cards whose spent time was stored empty, and the
|
||||
**Admin Panel recovery list** no longer fills up with old cancelled
|
||||
notifications.
|
||||
|
||||
[All changes in v13.21](CHANGELOG-big.md#v1321-2026-11-20-wekan--release)
|
||||
[All changes in v13.30](CHANGELOG-big.md#v1330-2026-11-23-wekan--release)
|
||||
|
||||
# v13.20 2026-11-19 WeKan ® release
|
||||
# v13.29 2026-11-23 WeKan ® release
|
||||
|
||||
The **REST API** card lists of a list and of a swimlane now carry
|
||||
what a syncing client needs - when a card changed, its labels, members and
|
||||
custom field values - so syncing a board needs no request per card. **build.sh**
|
||||
and **build.bat** can run a single **Playwright** spec.
|
||||
**EVERYTHING** tests now run one stage and one worker at a time by
|
||||
default, so a full test run no longer runs the machine out of RAM; the
|
||||
two-worker mode stays available when asked for.
|
||||
|
||||
[All changes in v13.20](CHANGELOG-big.md#v1320-2026-11-19-wekan--release)
|
||||
[All changes in v13.29](CHANGELOG-big.md#v1329-2026-11-23-wekan--release)
|
||||
|
||||
# v13.19 2026-11-19 WeKan ® release
|
||||
# v13.28 2026-11-23 WeKan ® release
|
||||
|
||||
**Release builds** no longer fail when the **Snap Store** is slow
|
||||
to process an upload, or when a **Termux** or **BSD** package mirror has a bad
|
||||
minute.
|
||||
A board can be a **Shop** with invoices and order email, the
|
||||
**Admin Panel** can be
|
||||
limited to chosen addresses, all **webhooks** can be turned off at once, the
|
||||
**Cloud Panel** exists only in a
|
||||
Cloud Admin container with the `CLOUD` variable (**CloudPanelBleed**), a forged
|
||||
bounce report can no longer stop email (**BounceBleed**), and every setting that
|
||||
turns something off is **refused on the server**. The **audit log**, **sign-in
|
||||
address retention** and a **personal-data inventory** begin the missing law and
|
||||
standard features, and every **feature page** of the docs has one shape.
|
||||
|
||||
[All changes in v13.19](CHANGELOG-big.md#v1319-2026-11-19-wekan--release)
|
||||
[All changes in v13.28](CHANGELOG-big.md#v1328-2026-11-23-wekan--release)
|
||||
|
||||
# v13.18 2026-11-19 WeKan ® release
|
||||
# v13.27 2026-11-22 WeKan ® release
|
||||
|
||||
**Admin Panel / Problems** says what its numbers count - "New
|
||||
problems: 1" and "Checks with findings: 8 / 31", in every language - and a
|
||||
report row's address, location and user always belong to the same occurrence.
|
||||
**CodeQL** alert #611 is fixed: the **autolink rules** find the
|
||||
links already in a card's text in linear time, so a description built of
|
||||
thousands of brackets no longer takes seconds to render.
|
||||
|
||||
[All changes in v13.18](CHANGELOG-big.md#v1318-2026-11-19-wekan--release)
|
||||
[All changes in v13.27](CHANGELOG-big.md#v1327-2026-11-22-wekan--release)
|
||||
|
||||
# v13.17 2026-11-19 WeKan ® release
|
||||
# v13.26 2026-11-22 WeKan ® release
|
||||
|
||||
The **Admin Panel** answers one question per tab: Settings gains
|
||||
**Appearance**, **Features**, **Feature profiles**, Security, Activities and
|
||||
notifications, and Delete, Problems keeps only what is going wrong, and every
|
||||
old
|
||||
address redirects. The docs now have a page for every menu entry, and cards of
|
||||
an archived swimlane no longer appear in the first swimlane.
|
||||
New **Workload and capacity**, **Budget and billing** and **Cloud
|
||||
Panel** pages: hours against working time, each board's cost and margin with
|
||||
**expenses**, **fees**, **quotes** and **invoices** in **PDF**, **Excel** and
|
||||
**e-invoice**, and many customer domains merged into one WeKan. WordPress,
|
||||
Ghost, Blogger and static sites import and export under **Website**, and a
|
||||
public board can show itself as a **website**. The **Venda** and **Klingon**
|
||||
translations hold only their own language, the move and copy pickers show names
|
||||
without numbers (#6135), and unused code is removed.
|
||||
|
||||
[All changes in v13.17](CHANGELOG-big.md#v1317-2026-11-19-wekan--release)
|
||||
[All changes in v13.26](CHANGELOG-big.md#v1326-2026-11-22-wekan--release)
|
||||
@@ -270,8 +270,27 @@ replaced with the language named by that tag.**
|
||||
### Shared translation source for WeKan prototypes under `.tools/`
|
||||
|
||||
The WeKan catalogs in `imports/i18n/data/` are the source of truth for
|
||||
translations in every WeKan prototype under `.tools/`, including WeLite,
|
||||
Weddy, Wami, and any future WeKan prototype with its own catalog.
|
||||
translations in every WeKan prototype under `.tools/`, including Omi, Wami,
|
||||
Weddy, WeLite, and any future WeKan prototype with its own catalog. A prototype
|
||||
does not keep translations of its own that WeKan's catalogs do not have.
|
||||
|
||||
Version control translations come from ONE place too:
|
||||
`.tools/w/gitea-patches/dist/translations/gitea-locale/locale_<lang>.json`,
|
||||
upstream Gitea's locale files with gitea-patches' own translations merged in.
|
||||
Only gitea-patches has the complete Finnish, so a prototype never takes its
|
||||
Gitea strings from upstream Gitea directly. Refresh them with gitea-patches'
|
||||
`./build.sh translations` (menu: "Download the newest Gitea translations from
|
||||
upstream") and commit them there.
|
||||
|
||||
So a prototype that needs translations - Omi, Wami, Weddy, WeLite,
|
||||
github-to-gitea and the rest of the WeKan and version control prototypes under
|
||||
`.tools/w/` - COPIES them directly: WeKan's strings from WeKan's catalogs, and
|
||||
Gitea's own things (repositories, issues, pull requests, releases,
|
||||
organizations) from gitea-patches' `gitea-locale`, into its own catalog format.
|
||||
It uses no other translation source. Gitea's strings are NOT added to WeKan's
|
||||
catalogs (decided 2026-11-22: they would grow every WeKan locale file by about
|
||||
45 %). A string that neither has is added to WeKan's catalog, as in step 2
|
||||
below, and is used from there in WeKan and in the `.tools` repositories.
|
||||
|
||||
1. Before adding a translation key in a prototype, search WeKan's English
|
||||
catalog for a key with the same meaning and usage. Reuse that key and its
|
||||
@@ -748,6 +767,21 @@ directly after the merge.
|
||||
WeKan ® release` of `CHANGELOG-big.md`, linking the commit (its `Fixes #NNNN`
|
||||
closes the issue). A done item never stays in `TODO.md`.
|
||||
`tests/todoFile.test.cjs` checks the file.
|
||||
- **Every time `TODO.md` is updated, check EVERY item in it for being done
|
||||
already** - not only the one that prompted the update. Releases are frequent,
|
||||
so an item is often finished, and even released, while it still sits there.
|
||||
Check from the source, not from the wording: the code, `git log`, the issue's
|
||||
state, the Snap Store or the GitHub Release. Then:
|
||||
- **done and NOT released yet** (its commit is not an ancestor of the newest
|
||||
release's `Prepare v… release` commit: `git merge-base --is-ancestor
|
||||
<commit> <prepare-commit>`) - move it: remove it from `TODO.md` and write
|
||||
its entry in `# Upcoming WeKan ® release`, linking the commit;
|
||||
- **done and ALREADY released** - just remove it from `TODO.md`. Its release
|
||||
is a record, and an entry is never added to a released section afterwards;
|
||||
- **partly done** - shorten it to what is left, and say what was released.
|
||||
A security advisory is the same: once its fix is released and its GHSA
|
||||
published, it is done, and nothing about it stays in WeKan's `TODO.md` - not
|
||||
the advisory and not the wait for its CVE number.
|
||||
- FerretDB Upcoming structure — `### New Features 🎉`, `### Fixed 🐛`, `### Other Changes
|
||||
🤖`; entries end `... by @xet7. Thanks to xet7.`
|
||||
- Word-wrap both CHANGELOGs at 80 chars, but never break a long link across lines (a
|
||||
@@ -976,6 +1010,26 @@ have cost a released section its accuracy:
|
||||
the change in Audit-Stars.md. Match by the report's subject and reporter, not by
|
||||
a nearby advisory - a GHSA about something else is no upgrade. Until the GHSA
|
||||
exists, the row stays at 3 and its Process cell says the GHSA is awaited.
|
||||
- **Every new security issue updates the Hall of Fame, and every Hall of Fame
|
||||
update fills in the GHSA and CVE details that are missing.** Compare the
|
||||
published advisories (`releases/sec/download-github-security.sh` saves them,
|
||||
or `https://api.github.com/repos/wekan/wekan/security-advisories?state=published`
|
||||
read to its LAST page - there are more than 100, so one `per_page=100`
|
||||
request misses the oldest, which then look unpublished) with
|
||||
`hall-of-fame/index.html`:
|
||||
- a **published GHSA with no row** gets one - the row, its own page,
|
||||
`Audit-Icons.md`, `Audit-Stars.md`, the page's exact URLs in wekan.fi's
|
||||
`releases/risk-baseline.json`, and a catalog key or a recorded reason in
|
||||
`tests/hallOfFameProblemsCoverage.test.cjs` - even when the fix shipped long
|
||||
before the advisory, as OidcRaceBleed's did (GHSA-6944-p22h-3qpx, 2026-11-23);
|
||||
- a row whose advisory has a **CVE assigned** gets it in its CVE cell, on the
|
||||
index AND on its own page, in place of "CVE requested";
|
||||
- a row linking an advisory that is **not public** (the API answers 404) is
|
||||
named to the maintainer: it is a draft or was closed, and readers get a
|
||||
404 from it.
|
||||
A CVE that is requested but not assigned yet is NOT a TODO item: requesting
|
||||
it is part of publishing the advisory, and the CVE cell says "CVE requested"
|
||||
until the next Hall of Fame update finds the number.
|
||||
- **On the Hall of Fame index page, the Process and Vulnerabilities cells are
|
||||
collapsed.** Those two columns carry the prose — how the report arrived, and the
|
||||
whole story of the vulnerability — so the page would be one wall of text and the
|
||||
|
||||
+4
-1
@@ -38,7 +38,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
ARG VERSION=13.21
|
||||
ARG VERSION=13.30
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
|
||||
@@ -185,6 +185,7 @@ ENV \
|
||||
MATOMO_DO_NOT_TRACK=true \
|
||||
MATOMO_WITH_USERNAME=false \
|
||||
METRICS_ALLOWED_IP_ADDRESSES="" \
|
||||
ADMIN_PANEL_ALLOWED_IP_ADDRESSES="" \
|
||||
BROWSER_POLICY_ENABLED=true \
|
||||
TRUSTED_URL="" \
|
||||
WEBHOOKS_ATTRIBUTES="" \
|
||||
@@ -317,8 +318,10 @@ ENV \
|
||||
WEKAN_DISK_MONITOR="" \
|
||||
WEKAN_DISK_WATCH_PATHS="" \
|
||||
WEKAN_RAM_MONITOR="" \
|
||||
CLOUD="" \
|
||||
WEKAN_IMPORT_RUN_STALE_MS="" \
|
||||
EVENTLOG_RETENTION_DAYS="" \
|
||||
LOGIN_ADDRESS_RETENTION_DAYS="" \
|
||||
CORS="" \
|
||||
CORS_ALLOW_HEADERS="" \
|
||||
CORS_EXPOSE_HEADERS="" \
|
||||
|
||||
@@ -38,22 +38,44 @@ that by providing one-click installation on various platforms.
|
||||
build.bat.
|
||||
- [Features](https://github.com/wekan/wekan/tree/main/docs/Features):
|
||||
- Real-time user interface
|
||||
- [Help button](docs/Features/General/Help-Button.md): a ? at every feature place - board views, sidebar, Board and Member Settings,
|
||||
card sections, Admin Panel panes - shows What is it? and How it works? in your own language
|
||||
- All Boards page, Drag drop reorder with one or Multi-Selection:
|
||||
- Board icons at Remaining, (Sub)Workspaces, Archive
|
||||
- Shared Templates: Boards, Lists, Cards
|
||||
- Add Board / Import ([all import and export formats](docs/Features/Board-Sidebar/Board-Settings/Import-Export/External-Tools.md)):
|
||||
- WeKan JSON/.zip, CSV/TSV, Excel, Markdown, Obsidian Kanban, Leo, OPML, Org mode, todo.txt
|
||||
- Trello, Jira, Asana, Zenkit, Focalboard, Todoist, Microsoft Planner, MeisterTask, Linear, TickTick, ClickUp, Nullboard, Kanri, Pivotal Tracker, Redmine, Tasks.org, monday.com,
|
||||
Super Productivity, Taiga, Vikunja, Wrike (Excel and workflow), Quire, Teamwork.com, Businessmap, Notion, Plane
|
||||
- Kanboard, Nextcloud Deck, OpenProject, Taskwarrior, Planka, KanbanFlow, Basecamp, Microsoft To Do, Google Tasks
|
||||
- Mail (.eml/mbox), Calendars (iCalendar), Google Takeout, Google Keep, Evernote,
|
||||
Chats: Slack, Mattermost, Telegram, WhatsApp, Discord - each into the view it fits
|
||||
the tools are under the same headings as on the import page, a company's or a platform's products under its name
|
||||
- WeKan JSON and .zip
|
||||
- 37signals: Fizzy, Basecamp
|
||||
- Atlassian: Trello (JSON, and a .zip of many boards with their files), Jira
|
||||
- Google: Takeout (Tasks, Keep, Mail, Calendar, Chat), Tasks, Keep
|
||||
- Microsoft: Excel, GitHub, Planner, Azure DevOps Boards, Lists, Project (XML), Outlook (.msg), To Do, OneNote, Teams
|
||||
- Sandstorm grain backups: WeKan, Prioritize, Yet Another TODO list, μTodo, SandChat, EtherCalc,
|
||||
Radicale calendar and address book, Davros, Hacker CMS, Gogs, WordPress
|
||||
- Kanban and project tools: Kanboard, Nextcloud Deck, OpenProject, Asana, Zenkit, Focalboard, MeisterTask, Obsidian Kanban,
|
||||
ClickUp, Nullboard, Kanri, monday.com, Taiga, Wrike, Teamwork.com, Businessmap, Quire, Notion, Plane
|
||||
- Issue trackers and version control: GitLab, Gitea, Forgejo, Linear, Pivotal Tracker, Redmine
|
||||
- Task and to-do apps: todo.txt, Taskwarrior, Todoist, TickTick, Tasks.org, Super Productivity, Vikunja
|
||||
- Spreadsheets and tables: CSV / TSV
|
||||
- Text and outlines: Markdown, Leo, OPML, Org mode
|
||||
- Mail, calendars, chats and notes, each into the view it fits: Mail (mbox, .eml), iCalendar, Slack, Mattermost,
|
||||
Telegram, WhatsApp, Discord, Rocket.Chat, Evernote
|
||||
- [Website](docs/Features/Board-Sidebar/Board-Settings/Import-Export/Website/Website.md): WordPress (.xml, and Squarespace, Wix and others that write it),
|
||||
WordPress REST API, Ghost, Blogger, Hugo / Jekyll / Eleventy / Astro (.zip of Markdown), HTML website and Medium (.zip), Substack
|
||||
- Fetched from the service's API with your credentials: Planka, KanbanFlow, Basecamp, Microsoft To Do, OneNote and Teams,
|
||||
Google Tasks and Keep
|
||||
- Large files are streamed to disk, within its free space or the Admin Panel limit
|
||||
- GitHub, GitLab, Gitea, Forgejo
|
||||
- Import many boards at once: several export files, or a .zip of them, each its own board;
|
||||
One board per project splits an export of a whole app into a board per project
|
||||
- Change Color: Board theme and background image, Swimlane, List, Card
|
||||
- Overrides: 1 Admin Panel, 2 Board Settings, 3 Member Settings
|
||||
- Professional services (PSA), from the user menu:
|
||||
- [Workload and capacity](docs/Features/Workload/Workload.md): each person's hours against their working time across boards,
|
||||
absences, public holidays, allocations, placeholders for roles, billable utilization against a target, skills and who could do the work
|
||||
- [Budget and billing](docs/Features/Billing/Billing.md): rates and cost rates, budget against cost and forecast, margin and unbilled work,
|
||||
time by day and its approval, expenses, fixed fees and monthly retainers, quotes, invoices of a period
|
||||
with VAT, payments and credit notes, as PDF, SVG, Excel, CSV and Peppol e-invoice, with the payment QR codes and
|
||||
bank barcodes of many countries, in each currency's own decimals
|
||||
- Drag drop reorder with one or Multi-Selection:
|
||||
- Board icons to Workspaces at All Boards page
|
||||
- Swimlane, List, Minicard
|
||||
@@ -63,34 +85,43 @@ that by providing one-click installation on various platforms.
|
||||
- Show My Dependencies, Show Board Dependencies, Import/Export JSON/SVG
|
||||
- Dependencies are for SAFe PI Plannings, drawing colored lines between cards, like Kendis or Scaled Agile Framework. Import Export as JSON and SVG.
|
||||
- My Cards, Due Cards, My Attachments, Search All Boards, Date Settings,
|
||||
Change color - override theme, Nofications Settings (Tray, Email, etc),
|
||||
Change color - override theme, Notifications Settings (Tray, Email, etc),
|
||||
Font change and Font size change, Change Avatar,
|
||||
Change Language (250+ languages)
|
||||
Change Language (234 locale catalogs)
|
||||
- Change Settings: Show desktop drag handles, Submit editors with Enter,
|
||||
Open many cards at once, Play a sound when a checklist item is completed,
|
||||
Show cards count if list contains more than ... cards,
|
||||
Show rescue dialoque before closing for unsaved card descriptions
|
||||
Show rescue dialogue before closing for unsaved card descriptions
|
||||
- Board Views:
|
||||
- Swimlanes, Lists
|
||||
- Minicard: At list there is card, that has not been not opened yet
|
||||
- Card: Opened card popup of minicard
|
||||
- Attachments viewer for PDF and Office documents
|
||||
- Attachments viewer for PDF and Office documents, and a slideshow that reads only what is on the screen -
|
||||
also of text, CSV, code, ZIP and tar listings, calendars, Outlook .msg and OpenDocument
|
||||
- [Search inside attachments](docs/Features/Cards/Attachments/Attachment-Search-And-Integrity.md) with Filter,
|
||||
Search and Search All Boards; every attachment's SHA-256 is checked when it is read, with a warning in
|
||||
Admin Panel / Problems when a file changed behind WeKan's back
|
||||
- The [card details width](docs/Features/Cards/Card-Details-Width.md) is remembered per user, and an admin
|
||||
sets the default as a percentage of the browser window
|
||||
- Kanban and Scrum flow fields: Blocked, Class of service, MoSCoW priority, WSJF score
|
||||
- List policies, Definition of Ready, commitment point, WIP limit per person,
|
||||
lists split into Doing and Done
|
||||
- Drag drop reorder one or Multi-Selection: Swimlanes, Lists, Minicards, Checklists, Checklist Items
|
||||
- Collapse/Uncollapse: Menus, Swimlanes, Lists, Cards
|
||||
- Table, Calendar, Multi Board Calendar, Time, Timeline
|
||||
- Statistics, Group by Assignee
|
||||
- Gantt, Frappe Gantt, DHTMLX Gantt
|
||||
- Scrum: Product Backlog, Sprints, Sprint Report, Velocity, Roadmap, Dashboard, Bigboard
|
||||
- Burndown, Burnup, Cumulative Flow, Control, Cycle Time, Flow Efficiency,
|
||||
Lead Time, Throughtput Histogram, WIP Run, Pulse, Aging WIP,
|
||||
Blocker Analysis, Monte Carlo Forecasts, Process Behavior (XmR),
|
||||
Work Item Size vs Cycle Time, Map
|
||||
- Reports: Created vs. Resolved, Net Flow, Time in List, Average Age,
|
||||
Throughput Run Chart, Due Date Performance, Release Burndown, Epic Progress,
|
||||
Workload, Distribution, Dependency Map, Activity Heatmap - each with PDF and Excel export
|
||||
- The Board View menu, under its headings; each view shown, hidden and ordered per board:
|
||||
- Board: Swimlanes, Lists, Table, Group by Assignee, Bigboard, Map, Column sets
|
||||
- Calendar and time: Calendar, Calendar Mode, Multi Board Calendar, Time, Timeline,
|
||||
Gantt, Frappe Gantt, DHTMLX Gantt, Roadmap
|
||||
- Scrum: Product Backlog, Sprints, Sprint Report, Velocity, Burndown, Burnup, Release Burndown, Epic Progress
|
||||
- Kanban flow: Cumulative Flow, Control, Cycle Time, Flow Efficiency, Lead Time, Throughput Histogram,
|
||||
WIP Run, Aging WIP, Blocker Analysis, Monte Carlo Forecasts, Process Behavior (XmR),
|
||||
Work Item Size vs. Cycle Time, Created vs. Resolved, Net Flow, Time in List, Average Age,
|
||||
Throughput Run Chart, Due Date Performance
|
||||
- Overview: Statistics, Dashboard, Pulse, Workload, Distribution, Dependency Map, Activity Heatmap
|
||||
- Communication and code: Email, Chat, Version Control,
|
||||
[Website](docs/Features/Board-Sidebar/Board-Settings/Import-Export/Website/Website.md): the board as a website, which a public board can show at its own address instead of the kanban,
|
||||
[Shop](docs/Features/Board-Header/Board-Views/Shop.md): the products on the cards as a web shop - cart, checkout, orders as cards, Budget and billing's payment methods - which a public board can show instead of the kanban
|
||||
- The charts and reports each have PDF and Excel export
|
||||
- Right Sidebar / Board Settings:
|
||||
- Rules: like IFTTT like Trello Butler
|
||||
- Lists view for Rules
|
||||
@@ -98,37 +129,57 @@ that by providing one-click installation on various platforms.
|
||||
- Blocks: like Scratch or Jira AutoBlocks, shows same IFTTT Rules
|
||||
- Import / Export IFTTT Rules; import n8n, Node-RED and Trello Butler; import / export Wrike workflows
|
||||
- Export board :
|
||||
- Select what to include: Card details, Board, Activities, Labels, People (Creator, Owner, Members, Assignees), Board Info (Board, List, Swimlane), Dates (Created, Received, Start, Due, End), Description, Custom Fields, Checklists, Subtasks, Comments, Attachments, Votin, Plannin Poker, Stickers, Location (link to map based on coordinates), Dependencies, Sort, Scrum Settings
|
||||
- Export to ([all formats](docs/Features/Board-Sidebar/Board-Settings/Import-Export/External-Tools.md)): PDF, Excel, HTML, Calendar feed (iCal), Dependencies JSON/SVG,
|
||||
CSV , ; TSV, JSON with/without attachmeents, .zip (Attachments),
|
||||
Kanboard, Markdown, Leo, OPML, Org mode, todo.txt, Taskwarrior, Focalboard, Todoist,
|
||||
Microsoft Planner, MeisterTask, Obsidian Kanban, Linear, TickTick, ClickUp, Nullboard, Kanri, Pivotal Tracker, Redmine, Tasks.org, monday.com,
|
||||
Super Productivity, Taiga, Vikunja, Wrike (Excel and workflow), Quire, Teamwork.com, Businessmap, Notion,
|
||||
Trello, Jira, NextCloud Deck, OpenProject, GitHub, GitLab,
|
||||
Gitea, Forgejo, Asana, Zenkit, Trello .zip with attachments, mbox, Evernote, Mattermost
|
||||
- Select what to include: Card details, Board, Activities, Labels, People (Creator, Owner, Members, Assignees), Board Info (Board, List, Swimlane), Dates (Created, Received, Start, Due, End), Description, Custom Fields, Checklists, Subtasks, Comments, Attachments, Voting, Planning Poker, Stickers, Location (link to map based on coordinates), Dependencies, Sort, Scrum Settings
|
||||
- Export to ([all formats](docs/Features/Board-Sidebar/Board-Settings/Import-Export/External-Tools.md)):
|
||||
under the same headings as Import
|
||||
- WeKan: JSON with or without attachments, .zip with attachments; PDF, Excel, HTML, Calendar feed (iCal),
|
||||
Dependencies JSON/SVG, CSV , ; TSV
|
||||
- 37signals: Fizzy
|
||||
- Atlassian: Trello (JSON, .zip with attachments, or straight into Trello through its API), Jira
|
||||
- Microsoft: Planner, Azure DevOps Boards, Lists, Project (XML), Outlook (.eml), Teams, OneNote, GitHub
|
||||
- Sandstorm grain backups that Sandstorm restores: Prioritize, Yet Another TODO list, μTodo, SandChat, EtherCalc,
|
||||
Radicale calendar and address book, Davros, Hacker CMS
|
||||
- Kanban and project tools: Kanboard, Focalboard, MeisterTask, Obsidian Kanban, ClickUp, Nullboard, Kanri, monday.com,
|
||||
Wrike (Excel and workflow), Teamwork.com, Businessmap, Quire, Notion, Nextcloud Deck, OpenProject, Asana, Zenkit, Taiga
|
||||
- Issue trackers and version control: Linear, Pivotal Tracker, Redmine, GitLab, Gitea, Forgejo
|
||||
- Task and to-do apps: todo.txt, Taskwarrior, Todoist, TickTick, Tasks.org, Super Productivity, Vikunja
|
||||
- Text and outlines: Markdown, Leo, OPML, Org mode
|
||||
- Mail, chats and notes: mbox, Evernote, Mattermost, Rocket.Chat
|
||||
- Website: WordPress (.xml and REST API .json), Ghost, Blogger, Hugo / Jekyll / Eleventy / Astro (.zip of Markdown),
|
||||
HTML website (.zip, the published site ready for any web server)
|
||||
- Every export is written a page of cards at a time, so a large board exports without running out of memory
|
||||
- Export all boards at once (All Boards sidebar, or Multi-Selection): Excel as one workbook
|
||||
with a sheet per board, every other format as a .zip with a file per board
|
||||
- Scrum Settings: Definition of Ready and Done, Daily standup timer, Retrospective board
|
||||
- Change color theme, Change Background Image, Date settings
|
||||
- Settings:
|
||||
- Board View: Show/Hide and drag drop reorder what is shown atat Public Board and Private Board
|
||||
- Board View: Show/Hide and drag drop reorder what is shown at Public Board and Private Board
|
||||
- Swimlane: Scrum settings, Lock resize swimlane height, WIP Limit Groups
|
||||
- Board View: Show/Hide and drag drop reorder what is shown at Minicard and Card
|
||||
- Admin Panel
|
||||
- Settings
|
||||
- Version
|
||||
- Features: which features this WeKan offers, Card fields, Feature profiles
|
||||
- Features: which features this WeKan offers, Card fields, Feature profiles,
|
||||
[Turn off all webhooks](docs/Features/Admin-Panel/Settings/Turn-Off-All-Webhooks.md) at once: every webhook screen hidden,
|
||||
nothing sent and no webhook added or changed on the server, the saved ones kept
|
||||
- Appearance: What is shown/hidden, Whitelabeling
|
||||
- Announcement
|
||||
- Accessibility
|
||||
- Translation: Add custom translation strings
|
||||
- PWA
|
||||
- Global Webhooks
|
||||
- Privacy and security: [Allowed addresses](docs/Features/Admin-Panel/Admin-Panel-Allowed-Addresses.md), the IPv4 and IPv6
|
||||
addresses and ranges the Admin Panel and the admin REST API can be used from
|
||||
- People
|
||||
- Email, Notifications, Domains, Organizations, Teams, People
|
||||
- Locked Users, Roles, Shared Templates
|
||||
- Login, SAML, LDAP, OAuth2 login providers, Passwordless login
|
||||
- Cloud, only in a container started with the environment variable `CLOUD=<its domain>`: the
|
||||
[Cloud Panel](docs/Features/Admin-Panel/Cloud-Panel.md). Its site administrators are the Cloud Admins - the first
|
||||
registered user is one - and keep the customer domains, each with its own WeKan and MongoDB or sharing this WeKan,
|
||||
merge many WeKans into one, with CloudFlare DNS, Caddy routes, invoices, support tickets and chat on a support board per
|
||||
domain, and the addresses a Cloud Admin may sign in from. A customer signs in there with the password of their own
|
||||
WeKan, checked against its database, and sees their invoices, tickets and chat. No REST API at that address
|
||||
- Attachments
|
||||
- Scheduled Backups, Continuous realtime backups, Move Attachments, Default Save Storage, Limits
|
||||
- Storage: MongoDB GridFS, Filesystem, S3/MinIO, Azure Blob, Google Cloud
|
||||
@@ -143,6 +194,7 @@ that by providing one-click installation on various platforms.
|
||||
- Security: shows any attempted attacks based on names from https://wekan.fi/hall-of-fame/ like built-in SIEM with country flag and city based of location of IP address based on location headers like CloudFlare etc
|
||||
- Impersonation
|
||||
- Performance, Speed, Tests, CPU usage, Instrumentation, Broken Cards, Files, Rules, Boards, Recovery, Offices, API, Database problems, Filesystem integrity
|
||||
- [Webhooks](docs/Features/Admin-Panel/Problems/Webhooks.md): every webhook, its board or Global, the user who added it and what it sends, tokens hidden
|
||||
- [Platforms](https://wekan.fi/install/):
|
||||
- Windows/Mac/Linux bundle .zip
|
||||
- Linux [Snap](https://snapcraft.io/wekan): Automatic updates
|
||||
@@ -170,7 +222,7 @@ docker-compose.yml at https://github.com/wekan/wekan/blob/main/docker-compose.ym
|
||||
|
||||
## Standards
|
||||
|
||||
- [WeKan and Standard for Public Code](https://wekan.fi/standard-for-public-code/) assessment was made at 2023-11. At 2026 WeKan becameß full FLOSS with [FerretDB v1 Fork](https://github.com/wekan/FerretDB), also see 2026 talk WeKan 10 years at https://wekan.fi/docs for more details.
|
||||
- [WeKan and Standard for Public Code](https://wekan.fi/standard-for-public-code/) assessment was made at 2023-11. At 2026 WeKan became full FLOSS with [FerretDB v1 Fork](https://github.com/wekan/FerretDB), also see 2026 talk WeKan 10 years at https://wekan.fi/docs for more details.
|
||||
Currently Wekan meets 9 out of 16 criteria out of the box.
|
||||
Some others could be met with small changes.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
|
||||
appVersion: "v13.21.0"
|
||||
appVersion: "v13.30.0"
|
||||
files:
|
||||
userUploads:
|
||||
- README.md
|
||||
|
||||
@@ -15,49 +15,145 @@ the changelog only says what changed.
|
||||
|
||||
`tests/todoFile.test.cjs` checks this shape.
|
||||
|
||||
**Where things are** (2026-11-23). Each repository's own TODO.md has the
|
||||
details; WeKan's are below.
|
||||
|
||||
| Repository | In progress, or not verified yet | Needs a person |
|
||||
| --- | --- | --- |
|
||||
| WeKan | The help button's Playwright spec; the test build that runs out of memory; wrong-language words in some locales; laws and standards WP-4 onwards; accessibility; the docs folders | Push |
|
||||
| [gitea-patches](https://github.com/wekan/gitea-patches/blob/main/TODO.md) | 90 new upstream Gitea strings not yet in Finnish | Run "Migrate all Gitea to backups" with `--dry-run` first |
|
||||
| [omi](https://github.com/wekan/omi/blob/main/TODO.md) | Delete and import not yet run on a real Gitea folder or against the real GitHub; the import has no reactions, review comments, LFS, Actions or fork branches | Push; stop and back up Gitea before the first real write |
|
||||
| [welite](https://github.com/wekan/welite/blob/main/TODO.md) | WeKan data folders: no zip archives, GridFS or object-storage downloads, avatars or cross-target builds yet; retro-browser acceptance | - |
|
||||
| [weddy](https://github.com/wekan/weddy/blob/main/TODO.md) | 20 of WeKan's 174 templates in Go; attachments' Office preview and WebP thumbnails; more of WeKan's specs; Firefox and WebKit; netbsd/arm64 | Its "For the maintainer (on GitHub)" items |
|
||||
| [caddy-ferretdb-plugin](https://github.com/wekan/caddy-ferretdb-plugin/blob/main/TODO.md) | The Windows SQLite URI fix, checked on Linux only | Close the otel Dependabot alert |
|
||||
| [caddy-wekan-plugin](https://github.com/wekan/caddy-wekan-plugin/blob/main/TODO.md) | Weddy behind WeKan's newest settings; the Windows fixes, checked on Linux only | Close the otel Dependabot alert |
|
||||
| [node-patches](https://github.com/wekan/node-patches/blob/main/TODO.md) | The clone retry, until the next Release All | - |
|
||||
| [wekango](https://github.com/wekan/wekango/blob/main/TODO.md) | The Windows and macOS fixes, checked on Linux only | Confirm the mongo-tools notice review |
|
||||
| [weror](https://github.com/wekan/weror/blob/main/TODO.md) | - | Decide on the demo account that takes any password; close the rack Dependabot pull request |
|
||||
| [wekan.fi](https://github.com/wekan/wekan.fi/blob/main/TODO.md) | - | Rerun the Pages deploy |
|
||||
| [wekan-meteor3-html4](https://github.com/wekan/wekan-meteor3-html4/blob/main/TODO.md) | Left out for now | - |
|
||||
| wena | aros-i386 without AHI audio | Rerun Release all for haiku-amd64 |
|
||||
| wepica | Left out: too old | - |
|
||||
|
||||
## In progress
|
||||
|
||||
Work being done now. Each item moves to the `# Upcoming WeKan ® release`
|
||||
section of `CHANGELOG-big.md`, and to the docs, when it is committed.
|
||||
|
||||
- The help button (?): its Playwright spec `feature-help.e2e.js` has not been
|
||||
run yet. The button, its texts and their translations into every language
|
||||
are released (v13.28).
|
||||
- The Meteor test build (`meteor test --full-app`) ran out of memory before
|
||||
any test started after the help texts grew every locale file; the release
|
||||
build (`meteor build`) still works. To find out why and fix it, then run
|
||||
the Shop, webhooks and Admin Panel addresses server tests, and their
|
||||
Playwright specs in Firefox and WebKit.
|
||||
- Wrong-language and wrong-meaning words seen by the help-text translators,
|
||||
to correct now that the help texts are translated: Latvian (`lv`) has
|
||||
Lithuanian words; Estonian (`et-EE`) calls a board "juhatus" (a company's
|
||||
management board) in "Board Settings" and "Board View"; Aromanian (`rup`)
|
||||
and Sicilian (`scn`) have Italian menu names; Northern Sami (`se`) has two
|
||||
Finnish values; Shona (`sn`) has half-English menu names; Brazilian
|
||||
Portuguese (`pt-BR`) calls an assignee "Administrador"; Somali (`so`) calls
|
||||
card recurrence an automatic reset; Pashto and Sindhi (`ps`, `sd`) have odd
|
||||
"Check Version" and "WIP Limit Groups" terms; Serbian (`sr`) uses списи,
|
||||
предмет and Управа for board, card and Admin Panel; Macedonian (`mk`) has
|
||||
Bulgarian values (Хора, Наблюдавай, Имейл, Описание, Разпределена от,
|
||||
Поискан от); Luxembourgish (`lb`) is partly German; Punjabi and Odia (`pa`,
|
||||
`or_IN`) call a swimlane "swimming"; Maltese (`mt`) has "Bord Ara" for
|
||||
Board View.
|
||||
- The docs folders keep their main page as `README.md` instead of a page named
|
||||
after the folder, and `docs/Features/README.md` holds the website's feature
|
||||
overview. Every topic in one folder at the `docs/Features/` level: the
|
||||
`General/` level goes, its folders move up into the same-named folders, and
|
||||
the folders of `# Moved` stubs are removed, with every link updated.
|
||||
- Everything about accessibility in one folder, `docs/Features/Accessibility/`
|
||||
(from `General/Accessibility/` and the Admin Panel's Accessibility page).
|
||||
- Accessibility: every missing WCAG 2.2 AA feature added, and the accessibility
|
||||
tests extended to every page, popup and Admin Panel pane - axe with the WCAG
|
||||
2.2 rules, keyboard-only use, visible focus, 200 % zoom and 320 px reflow,
|
||||
target size, reduced motion and every theme's contrast - run through build.sh.
|
||||
- Laws and standards - GDPR, NIS2, ISO 27001, HIPAA and the others - checked
|
||||
against what WeKan already has (`docs/Compliance/`). Done: the complete admin
|
||||
audit log (WP-1), retention of sign-in addresses (WP-2) and the
|
||||
personal-data inventory (WP-3). Next: complete erasure (WP-4, the 40
|
||||
collections the inventory lists), a personal-data export (WP-5), legal pages
|
||||
with accepted versions (WP-6), then WP-7 to WP-14.
|
||||
- Found while documenting, to fix: the per-address login delay is never
|
||||
applied; Broken Cards counts unknown card types in its list but not in the
|
||||
Summary or its repair; the database, integrity and mail streams have no name
|
||||
in the Summary; the Recovery pane's text says it does not retry or cancel;
|
||||
the attachment retention form allows a larger per-run number than the
|
||||
retention applies.
|
||||
|
||||
## For the maintainer: needs a person, not code
|
||||
|
||||
- Push `main` here and in the `.tools/w/` repositories with local commits:
|
||||
omi and wekan.fi.
|
||||
- Dependabot pull requests and alerts to close by hand: the
|
||||
go.opentelemetry.io/otel/sdk/log update in caddy-ferretdb-plugin and
|
||||
caddy-wekan-plugin (Dependabot cannot resolve their local `replace`, and the
|
||||
version is already on main), weror's rack-3.1.21 branch (main has rack
|
||||
3.2.9), nekan alert 207 and caddy-gitea-plugin alerts 1, 2, 4, 18, 24, 25
|
||||
and 37.
|
||||
- wena: rerun Release all for haiku-amd64 (the Haiku VM never answered SSH);
|
||||
aros-i386 needs SDL's AHI audio driver off for i386, whose AROS toolchain has
|
||||
no AHI headers - not cloned or built here, as there is no Docker.
|
||||
- wekan.fi: rerun "Deploy static content to Pages", which failed with a 500
|
||||
from GitHub's Pages API after its checks passed.
|
||||
- weror: decide whether the demo account `user@demo.test` may sign in with any
|
||||
password, as its tests ask; restored as tested, and a risk if weror is
|
||||
public.
|
||||
- wekango: confirm the review of the new mongo-tools license notices (only
|
||||
permissive attributions changed).
|
||||
|
||||
## Repositories left out, and why
|
||||
|
||||
- wepica: too old; its failing Dependabot runs are not fixed (decided
|
||||
2026-11-22).
|
||||
- wekan-meteor3-html4: left out for now (decided 2026-11-22). Its failing
|
||||
Dependency Review needs the dependency graph turned on in its settings; its
|
||||
own TODO.md says so.
|
||||
- sandstorm-io/sandstorm under `.tools/sandstorm`: somebody else's project,
|
||||
cloned for reference only.
|
||||
|
||||
## Need the running app to reproduce/verify
|
||||
|
||||
- The WebKit stage cannot run in the Flatpak sandbox: MiniBrowser needs its own
|
||||
sandbox, and turning that off is not allowed there. Run it on a host.
|
||||
|
||||
## Import and Export of everything each tool has
|
||||
## Need accounts on the tools, or a running copy of one
|
||||
|
||||
Asked on 2026-11-20: check and fix that everything each tool with a WeKan
|
||||
import or export can hold comes across, whether a whole export is read or
|
||||
written at once or only a part of it (a board, a project, some lists, a date
|
||||
range), and check each tool's newest features - what its current version
|
||||
exports and imports - so their data has a place in WeKan too. For every tool,
|
||||
compare its newest export file, documentation and changelog with the parser
|
||||
and the formatter here, record what is lost in the import loss report
|
||||
(`unsupported`), and add what has a place in WeKan.
|
||||
The import/export review asked on 2026-11-20 (everything each tool with a
|
||||
WeKan import or export can hold comes across, whole or in part) went through
|
||||
every parser and formatter against the export format its header documents.
|
||||
What it found is fixed and released; the round trips are held
|
||||
by `tests/playwright/specs/export-import-round-trip.e2e.js` (41 formats, the
|
||||
description, checklist, comment, dependency, label and due date) and
|
||||
`tests/exportRoundTripFields.test.cjs` (32 formats in plain Node: start and
|
||||
creation dates, spent time, the done tick, recurrence, people, custom fields,
|
||||
color, Blocked), and a WeKan board's every field by
|
||||
`tests/wekanCardFields.test.cjs`. What is left needs what this checkout does
|
||||
not have:
|
||||
|
||||
Done so far: `tests/playwright/specs/export-import-round-trip.e2e.js` exports
|
||||
a board in each of the 41 formats WeKan both writes and reads and imports the
|
||||
file back; every one brings the card back, and its KEEPS table holds each
|
||||
format to what its file keeps of the description, the checklist and the
|
||||
comment, so a format that loses more fails. The Trello export imports back
|
||||
with checklists, comments, members, custom fields and archived cards and
|
||||
lists, and a Trello .zip export carries the attachment files; the GitHub,
|
||||
Gitea and Forgejo exports carry the comments. What is left below is per tool: the
|
||||
tool's newest features against its parser and formatter.
|
||||
|
||||
- WeKan's own JSON and .zip: every field of the current schema, attachments
|
||||
and their versions, custom fields, rules, templates, Scrum data, and a part
|
||||
of a board as well as all of it.
|
||||
- Kanban and project tools: Kanboard, Nextcloud Deck, OpenProject, Asana,
|
||||
Zenkit, Planner, monday.com, Wrike, Teamwork, Businessmap, ClickUp, Notion,
|
||||
Plane, Taiga, Focalboard, Nullboard, Kanri, Obsidian Kanban, MeisterTask,
|
||||
Quire, Planka, KanbanFlow, Basecamp - sub-items, dependencies, time
|
||||
tracking, custom fields, comments, attachments and their newer views.
|
||||
- Issue trackers: Jira, GitHub, GitLab, Gitea, Forgejo, Redmine, Linear,
|
||||
Pivotal - epics, sprints, versions and milestones, links between issues,
|
||||
work logs, reactions, and fields added in their newest releases.
|
||||
- Task tools: Todoist, TickTick, Tasks.org, Super Productivity, todo.txt,
|
||||
Taskwarrior, Vikunja, Microsoft To Do, Google Tasks, Google Keep -
|
||||
recurrence, reminders, priorities, sub-tasks and sections.
|
||||
- Spreadsheets, text and outlines: CSV / TSV, Excel, Markdown, Leo, OPML,
|
||||
Org mode - every column, and every Org property and timestamp.
|
||||
- Mail, calendars and chats: mail, mbox, iCalendar, Google Takeout, Slack,
|
||||
Mattermost, Telegram, WhatsApp, Discord, Evernote .enex - threads, replies,
|
||||
reactions, recurring events and the attached files that are now only
|
||||
counted.
|
||||
- Each tool's newest release, checked with a real export file of it: Planner,
|
||||
Wrike, Teamwork, Businessmap, MeisterTask, Quire and Jira - the
|
||||
proprietary ones, whose current export is only seen with an account
|
||||
(Planner's newer Status, Task title and Assignments columns are read, as
|
||||
Microsoft's help page names them; a real file would confirm their exact
|
||||
spelling). The parsers follow
|
||||
the formats the tools document and report what they do not read, so a new
|
||||
field shows up in the import's loss report; checking for one needs an
|
||||
account on each tool. (Checked against their current source on 2026-11-20:
|
||||
Plane's IssueExportSerializer, Kanri's kanban-types.d.ts, Obsidian Kanban's
|
||||
markers, Nullboard's board object, and Gitea's (and Forgejo's) Issue
|
||||
struct, whose created_at, closed_at and time_estimate are read now;
|
||||
GitHub's REST issue, whose issue type is read now; GitLab's Issues API v4,
|
||||
whose health status and incident severity are read now. Redmine and
|
||||
monday.com import every column they do not name as a custom field, so a
|
||||
column a new release adds comes across without a change. Focalboard's archive
|
||||
format is frozen: Mattermost stopped merging changes to Focalboard and
|
||||
Boards in September 2023.
|
||||
Pivotal Tracker was shut down in 2025, so there is no newer release.
|
||||
Linear's open-source importer, @linear/import, declares the columns the
|
||||
parser reads.)
|
||||
@@ -2029,11 +2029,18 @@ if arguments >= 3 and sys.argv[1] == 'exportboardpdf':
|
||||
# { excelBase64 } (Plane's as { xlsxBase64 }), an export .zip as { zipBase64 },
|
||||
# a CSV/TSV file as rows, a text format as its text, and the rest as JSON.
|
||||
EXCEL_IMPORT_SOURCES = {'excel', 'planner', 'monday', 'wrike', 'teamwork', 'businessmap'}
|
||||
ZIP_IMPORT_SOURCES = {'vikunja', 'notion', 'plane', 'slack', 'googletakeout'}
|
||||
ZIP_IMPORT_SOURCES = {'vikunja', 'notion', 'plane', 'slack', 'googletakeout', 'telegram', 'discord', 'rocketchat', 'fizzy',
|
||||
'outlook', 'teams', 'onenote',
|
||||
'sandstormwekan', 'sandstormprioritize', 'sandstormyatl', 'sandstormmutodo', 'sandstormsandchat', 'sandstormethercalc',
|
||||
'sandstormradicalecalendar', 'sandstormradicalecontacts', 'sandstormdavros', 'sandstormhackercms', 'sandstormgogs',
|
||||
'markdownsite', 'htmlsite', 'substack', 'sandstormwordpress'}
|
||||
# An Outlook .msg and the Teams export's .tar are sent as { binaryBase64 }.
|
||||
BINARY_IMPORT_EXTENSIONS = {'outlook': ('.msg',), 'teams': ('.tar',)}
|
||||
TEXT_IMPORT_SOURCES = {'markdown', 'todotxt', 'taskwarrior', 'focalboard', 'todoist', 'meistertask', 'obsidian',
|
||||
'linear', 'ticktick', 'clickup', 'nullboard', 'pivotal', 'redmine', 'superproductivity',
|
||||
'quire', 'orgmode', 'leo', 'opml', 'vikunja', 'notion', 'plane',
|
||||
'mail', 'ical', 'mattermost', 'whatsapp', 'evernote', 'slack', 'googletakeout'}
|
||||
'mail', 'ical', 'mattermost', 'whatsapp', 'evernote', 'slack', 'googletakeout', 'rocketchat', 'fizzy',
|
||||
'azuredevops', 'mslists', 'msproject'}
|
||||
|
||||
def import_document(source, filepath):
|
||||
import base64, csv, io, os
|
||||
@@ -2045,6 +2052,9 @@ def import_document(source, filepath):
|
||||
if source in ZIP_IMPORT_SOURCES and ext == '.zip':
|
||||
with open(filepath, 'rb') as f:
|
||||
return {'zipBase64': base64.b64encode(f.read()).decode('ascii')}
|
||||
if ext in BINARY_IMPORT_EXTENSIONS.get(source, ()):
|
||||
with open(filepath, 'rb') as f:
|
||||
return {'binaryBase64': base64.b64encode(f.read()).decode('ascii')}
|
||||
with open(filepath, encoding='utf-8-sig') as f:
|
||||
text = f.read()
|
||||
if source == 'csv':
|
||||
|
||||
@@ -41,7 +41,7 @@ if /I "%~1"=="--list" goto cli_list_exit
|
||||
if /I "%~1"=="list" goto cli_list_exit
|
||||
REM The same non-interactive EVERYTHING as `./build.sh --run-everything [mode]`.
|
||||
if /I "%~1"=="--run-everything" (
|
||||
if "%~2"=="" (set "WEKAN_EVERYTHING_MODE=two-worker") else (set "WEKAN_EVERYTHING_MODE=%~2")
|
||||
if "%~2"=="" (set "WEKAN_EVERYTHING_MODE=sequential") else (set "WEKAN_EVERYTHING_MODE=%~2")
|
||||
goto test_everything
|
||||
)
|
||||
call :cli_run %*
|
||||
@@ -177,11 +177,11 @@ REM ===========================================================================
|
||||
:menu_tests
|
||||
echo.
|
||||
echo -- Tests -- ^(0 = Back^)
|
||||
echo 1^) EVERYTHING two-worker: one stage at a time, two Playwright workers
|
||||
echo per browser; every database and all FerretDB tests remain sequential.
|
||||
echo 1^) EVERYTHING one by one: one stage and one Playwright worker at a time
|
||||
echo for minimum RAM usage; database and FerretDB stages stay sequential.
|
||||
echo Logs in .tools\log\^<datetime^>\
|
||||
echo 2^) EVERYTHING one by one: one stage and one Playwright worker at a time
|
||||
echo for minimum RAM usage; database and FerretDB stages stay sequential
|
||||
echo 2^) EVERYTHING two-worker: one stage at a time, two Playwright workers
|
||||
echo per browser; every database and all FerretDB tests remain sequential
|
||||
echo 3^) EVERYTHING at once: WeKan test jobs concurrently; database and
|
||||
echo FerretDB stages remain sequential
|
||||
echo 4^) Mocha ^(server-side^)
|
||||
@@ -207,8 +207,8 @@ echo 19^) Playwright single spec: one spec on the browsers you choose; builds a
|
||||
echo starts the test server when none is running on :3000
|
||||
set "choice="
|
||||
set /p "choice=Choose: "
|
||||
if "%choice%"=="1" goto test_everything_two
|
||||
if "%choice%"=="2" goto test_everything_one
|
||||
if "%choice%"=="1" goto test_everything_one
|
||||
if "%choice%"=="2" goto test_everything_two
|
||||
if "%choice%"=="3" goto test_everything_all
|
||||
if "%choice%"=="4" goto test_mocha
|
||||
if "%choice%"=="5" goto test_import
|
||||
|
||||
@@ -775,6 +775,7 @@ function run_playwright_docker(){
|
||||
-e WEKAN_TEST_SERVER_MODE="${WEKAN_TEST_SERVER_MODE:-bundle}" \
|
||||
-e WEKAN_TEST_SMTP_PORT="${WEKAN_TEST_SMTP_PORT:-}" \
|
||||
-e WEKAN_TEST_REVERSE_PORTS="$reverse_ports" \
|
||||
-e WEKAN_TEST_CLOUD="${WEKAN_TEST_CLOUD:-}" \
|
||||
-e PLAYWRIGHT_HTML_OPEN=never \
|
||||
-e WEKAN_FILES_PATH="$filesroot" \
|
||||
-e PLAYWRIGHT_JSON_OUTPUT_NAME="${PLAYWRIGHT_JSON_OUTPUT_NAME:-}" \
|
||||
@@ -1334,7 +1335,7 @@ mongo_answers() {
|
||||
}
|
||||
|
||||
function run_all_tests(){
|
||||
local REQUESTED_MODE="${1:-two-worker}"
|
||||
local REQUESTED_MODE="${1:-sequential}"
|
||||
local RUN_MODE="$REQUESTED_MODE" PLAYWRIGHT_WORKERS=1
|
||||
case "$REQUESTED_MODE" in
|
||||
two-worker) RUN_MODE=sequential; PLAYWRIGHT_WORKERS=2 ;;
|
||||
@@ -2007,7 +2008,7 @@ function floating_promises_checks(){
|
||||
# releases/db-conformance.sh, which needs it a stage earlier). .tools/ is ignored
|
||||
# by git and by Meteor, so a companion repo cannot reach a commit or a rebuild.
|
||||
function run_everything(){
|
||||
local EVERYTHING_MODE="${1:-two-worker}"
|
||||
local EVERYTHING_MODE="${1:-sequential}"
|
||||
acquire_everything_lock || return 1
|
||||
trap 'trap - EXIT INT TERM; cleanup_everything_processes own; release_everything_lock' EXIT
|
||||
trap 'trap - EXIT INT TERM; cleanup_everything_processes own; release_everything_lock; exit 130' INT TERM
|
||||
@@ -3132,7 +3133,7 @@ cli_run() {
|
||||
# on Windows): the same "EVERYTHING (sequential)" the Tests menu offers, without
|
||||
# the menu.
|
||||
case "${1:-}" in
|
||||
--run-everything) run_everything "${2:-two-worker}"; exit $? ;;
|
||||
--run-everything) run_everything "${2:-sequential}"; exit $? ;;
|
||||
--playwright-spec)
|
||||
[ -n "${2:-}" ] || { echo "Usage: ./build.sh --playwright-spec <spec> [chromium|firefox|webkit|all] [title filter]" >&2; exit 2; }
|
||||
run_playwright_spec "$2" "${3:-chromium}" "${4:-}" build; exit $? ;;
|
||||
@@ -3167,8 +3168,8 @@ while [ -z "$opt" ]; do
|
||||
"Kill all dev servers|Kill all dev servers (free ports 3000/3001/3100/3101/4000/4001/8080)" ;;
|
||||
"Tests")
|
||||
choose "Tests" \
|
||||
"EVERYTHING two-worker|Run EVERYTHING with stages one by one and two Playwright workers per browser; database and FerretDB stages stay sequential; logs in log/<datetime>/" \
|
||||
"EVERYTHING one by one|Run EVERYTHING one stage and one Playwright worker at a time for minimum RAM usage; database and FerretDB stages stay sequential; logs in log/<datetime>/" \
|
||||
"EVERYTHING two-worker|Run EVERYTHING with stages one by one and two Playwright workers per browser; database and FerretDB stages stay sequential; logs in log/<datetime>/" \
|
||||
"EVERYTHING at once|Run EVERYTHING with the WeKan test jobs concurrently; database backends and FerretDB stages stay sequential; logs in log/<datetime>/" \
|
||||
"EVERYTHING source one by one|Run EVERYTHING against Dev server nobuild on localhost:3000, one test at a time, all browsers" \
|
||||
"Mocha (server-side)|Test Mocha unit + security + API-logic tests (server-side only, no browser)" \
|
||||
|
||||
@@ -142,6 +142,10 @@ template(name="boardBody")
|
||||
+emailView
|
||||
else if isViewChat
|
||||
+chatView
|
||||
else if isViewWebsite
|
||||
+websiteView
|
||||
else if isViewShop
|
||||
+shopView
|
||||
else if isViewVersionControl
|
||||
+versionControlView
|
||||
else if isViewColumnSets
|
||||
|
||||
@@ -1022,6 +1022,12 @@ Template.boardBody.helpers({
|
||||
isViewChat() {
|
||||
return Utils.boardView() === 'board-view-chat';
|
||||
},
|
||||
isViewWebsite() {
|
||||
return Utils.boardView() === 'board-view-website';
|
||||
},
|
||||
isViewShop() {
|
||||
return Utils.boardView() === 'board-view-shop';
|
||||
},
|
||||
isViewColumnSets() {
|
||||
return Utils.boardView() === 'board-view-column-sets';
|
||||
},
|
||||
@@ -1306,8 +1312,12 @@ Template.calendarView.helpers({
|
||||
locale: TAPi18n.getLanguage(),
|
||||
rtl: TAPi18n.isRTL(),
|
||||
}),
|
||||
editable: true,
|
||||
selectable: true,
|
||||
// Dragging a card and clicking a day to add one are writes: only for
|
||||
// who may write on the board. The server refuses the rest and records
|
||||
// the refusal as an attempt (server/models/cards.js createCardWithDueDate),
|
||||
// which it is only when the calendar did not offer it.
|
||||
editable: Utils.canModifyBoard(),
|
||||
selectable: Utils.canModifyBoard(),
|
||||
/* TODO: lists as resources: https://fullcalendar.io/docs/vertical-resource-view */
|
||||
navLinks: true,
|
||||
businessHours: {
|
||||
|
||||
@@ -992,7 +992,8 @@ body.board-view.mobile-mode #header #header-main-bar .board-header-sidebar-toggl
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: #6b778c;
|
||||
/* 4.5:1 for small text; #6b778c on white is 4.48:1. */
|
||||
color: #505f79;
|
||||
cursor: default;
|
||||
}
|
||||
.pop-over-list .board-view-group-heading:not(:first-child) {
|
||||
|
||||
@@ -364,3 +364,5 @@ template(name="boardViewMenu")
|
||||
if $eq boardView 'board-view-stats'
|
||||
i.fa.fa-pie-chart
|
||||
span.board-header-btn-label= boardViewName
|
||||
//- The open view's ? (featureHelp.jade), after the menu that names it.
|
||||
+featureHelp(id=boardViewHelp)
|
||||
@@ -10,6 +10,7 @@ import Swimlanes from '/models/swimlanes';
|
||||
import TableVisibilityModeSettings from '/models/tableVisibilityModeSettings';
|
||||
import visibilityDesc from '/imports/i18n/lib/visibilityDesc';
|
||||
const { boardViewMenuEntries } = require('/models/lib/boardViewSettings');
|
||||
const { boardViewHelpId } = require('/models/lib/featureHelp');
|
||||
import { allowBoardView } from '/client/lib/instanceFeatures';
|
||||
import { Filter } from '/client/lib/filter';
|
||||
// Which way a button that opens a sidebar view goes on a click - one answer,
|
||||
@@ -513,6 +514,14 @@ Template.boardChangeViewPopup.events({
|
||||
Utils.setBoardView('board-view-chat');
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-open-website-view'() {
|
||||
Utils.setBoardView('board-view-website');
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-open-shop-view'() {
|
||||
Utils.setBoardView('board-view-shop');
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-open-version-control-view'() {
|
||||
Utils.setBoardView('board-view-version-control');
|
||||
Popup.back();
|
||||
@@ -981,6 +990,10 @@ Template.boardViewMenu.helpers({
|
||||
boardView() {
|
||||
return Utils.boardView();
|
||||
},
|
||||
// The ? of the view that is on (docs/Features/General/Help-Button.md).
|
||||
boardViewHelp() {
|
||||
return boardViewHelpId(Utils.boardView());
|
||||
},
|
||||
// The tooltip: the name of the view that is ON. The button is icon only, so
|
||||
// this is the only place the name appears. docs/Features/Header-Bar/Header.md
|
||||
boardViewName() {
|
||||
@@ -1023,6 +1036,8 @@ Template.boardViewMenu.helpers({
|
||||
'board-view-map': 'board-view-map',
|
||||
'board-view-email': 'board-view-email',
|
||||
'board-view-chat': 'board-view-chat',
|
||||
'board-view-website': 'board-view-website',
|
||||
'board-view-shop': 'board-view-shop',
|
||||
'board-view-version-control': 'board-view-version-control',
|
||||
'board-view-column-sets': 'board-view-column-sets',
|
||||
'board-view-created-resolved': 'board-view-created-resolved',
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Pure helpers for building the option labels shown in board / list /
|
||||
* swimlane selectors (e.g. the move-card and copy-card popups).
|
||||
*
|
||||
* Regression #6135 ("numbering boards, list, swim caused some issues"):
|
||||
* a previous change prepended a sequential number to every option label
|
||||
* (e.g. "3. My Board"). That broke two things:
|
||||
*
|
||||
* 1. Boards whose name itself starts with a digit became hard to read.
|
||||
* 2. First-letter keyboard navigation in the native <select> dropdown
|
||||
* stopped working, because every option started with a number instead
|
||||
* of the board name.
|
||||
*
|
||||
* The fix: numbering is OPTIONAL and OFF by default. By default the label is
|
||||
* exactly the entity name, so its first character is the name's first
|
||||
* character and first-letter navigation works again. When numbering is
|
||||
* explicitly enabled, the number is appended as a trailing visual suffix so
|
||||
* the label still STARTS with the name.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Build the label for a selectable board/list/swimlane option.
|
||||
*
|
||||
* @param {string} name The entity (board/list/swimlane) name/title.
|
||||
* @param {number} index Zero-based position in the list.
|
||||
* @param {Object} [opts]
|
||||
* @param {boolean} [opts.numbered=false] When true, append the 1-based
|
||||
* number as a trailing suffix. When false (default), return the bare
|
||||
* name so first-letter keyboard navigation keeps working.
|
||||
* @returns {string} The option label.
|
||||
*/
|
||||
export function boardOptionLabel(name, index, { numbered = false } = {}) {
|
||||
const label = name == null ? '' : String(name);
|
||||
if (!numbered) {
|
||||
return label;
|
||||
}
|
||||
const position = Number(index);
|
||||
const number = Number.isFinite(position) ? position + 1 : index;
|
||||
return `${label} (${number})`;
|
||||
}
|
||||
|
||||
export default boardOptionLabel;
|
||||
@@ -611,7 +611,7 @@ template(name="workspaceActionsPopup")
|
||||
//- and Multi-Selection still open the sidebar, straight into their own view.
|
||||
//-
|
||||
//- Each names itself beside its icon where the bar has room, and the one rule
|
||||
//- in header.css drops every label below 1100px, leaving the tooltips.
|
||||
//- in header.css drops every label at 1000px and narrower, leaving the tooltips.
|
||||
//- docs/Features/All-Boards/All-Boards.md
|
||||
template(name="allBoardsHeaderButtons")
|
||||
a.board-header-btn.js-open-boards-sort(title="{{_ 'sort-boards'}}" class="{{#unless isBoardsSort 'custom'}}emphasis{{/unless}}")
|
||||
|
||||
@@ -81,6 +81,13 @@ template(name="epicProgressView")
|
||||
|
||||
template(name="workloadView")
|
||||
+boardChartView(chartKey="workload" titleKey="board-view-workload")
|
||||
//- This board's open cards per person; the hours against each person's
|
||||
capacity, across all their boards, are on the Workload and capacity page.
|
||||
if allowFeature 'workload'
|
||||
p.workload-cross-board-link
|
||||
a(href="{{pathFor 'workload'}}")
|
||||
i.fa.fa-tachometer
|
||||
| {{_ 'workload-title'}}
|
||||
|
||||
template(name="distributionView")
|
||||
+boardChartView(chartKey="distribution" titleKey="board-view-distribution")
|
||||
|
||||
@@ -249,11 +249,35 @@ const EXPORT_FORMAT_GROUPS = [
|
||||
{ key: 'mbox', icon: 'fa-envelope-o', label: 'Mail (mbox)', path: 'export/mbox', ext: 'mbox', scopes: BOARD_ONLY },
|
||||
{ key: 'enex', icon: 'fa-sticky-note', label: 'Evernote (.enex)', path: 'export/enex', ext: 'enex', scopes: BOARD_ONLY },
|
||||
{ key: 'mattermost', icon: 'fa-comments', label: 'Mattermost', path: 'export/mattermost', ext: 'jsonl', scopes: BOARD_ONLY },
|
||||
{ key: 'rocketchat', icon: 'fa-comments', label: 'Rocket.Chat', path: 'export/rocketchat', ext: 'zip', scopes: BOARD_ONLY },
|
||||
// Websites (docs/Features/Board-Sidebar/Board-Settings/Import-Export/Website.md).
|
||||
{ key: 'wordpress', icon: 'fa-wordpress', label: 'WordPress (.xml)', path: 'export/wordpress', ext: 'xml', scopes: BOARD_ONLY },
|
||||
{ key: 'wordpressjson', icon: 'fa-wordpress', label: 'WordPress REST API (.json)', path: 'export/wordpressjson', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'ghost', icon: 'fa-file-text-o', label: 'Ghost', path: 'export/ghost', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'blogger', icon: 'fa-rss', label: 'Blogger (.xml)', path: 'export/blogger', ext: 'xml', scopes: BOARD_ONLY },
|
||||
{ key: 'markdownsite', icon: 'fa-file-code-o', label: 'Hugo, Jekyll, Eleventy, Astro (.zip)', path: 'export/markdownsite', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'htmlsite', icon: 'fa-globe', label: 'HTML website (.zip)', path: 'export/htmlsite', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'todotxt', icon: 'fa-list-ul', label: 'todo.txt', path: 'export/todotxt', ext: 'txt', scopes: BOARD_ONLY },
|
||||
{ key: 'taskwarrior', icon: 'fa-terminal', label: 'Taskwarrior', path: 'export/taskwarrior', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'focalboard', icon: 'fa-th-large', label: 'Focalboard', path: 'export/focalboard', ext: 'jsonl', scopes: BOARD_ONLY },
|
||||
{ key: 'todoist', icon: 'fa-check-square-o', label: 'Todoist', path: 'export/todoist', ext: 'csv', scopes: BOARD_ONLY },
|
||||
{ key: 'planner', icon: 'fa-th-list', label: 'Microsoft Planner', path: 'export/planner', ext: 'xlsx', scopes: BOARD_ONLY },
|
||||
{ key: 'azuredevops', icon: 'fa-th-list', label: 'Azure DevOps Boards', path: 'export/azuredevops', ext: 'csv', scopes: BOARD_ONLY },
|
||||
{ key: 'mslists', icon: 'fa-list', label: 'Microsoft Lists', path: 'export/mslists', ext: 'csv', scopes: BOARD_ONLY },
|
||||
{ key: 'msproject', icon: 'fa-tasks', label: 'Microsoft Project (XML)', path: 'export/msproject', ext: 'xml', scopes: BOARD_ONLY },
|
||||
{ key: 'outlook', icon: 'fa-envelope-o', label: 'Microsoft Outlook (.eml)', path: 'export/outlook', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'teams', icon: 'fa-comments', label: 'Microsoft Teams', path: 'export/teams', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'onenote', icon: 'fa-book', label: 'Microsoft OneNote', path: 'export/onenote', ext: 'zip', scopes: BOARD_ONLY },
|
||||
// Sandstorm grain backups (.zip) Sandstorm restores (models/lib/sandstorm/grainApps.js).
|
||||
{ key: 'sandstormprioritize', icon: 'fa-archive', label: 'Sandstorm Prioritize', path: 'export/sandstormprioritize', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormyatl', icon: 'fa-archive', label: 'Sandstorm Yet Another TODO list', path: 'export/sandstormyatl', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormmutodo', icon: 'fa-archive', label: 'Sandstorm μTodo', path: 'export/sandstormmutodo', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormsandchat', icon: 'fa-archive', label: 'Sandstorm SandChat', path: 'export/sandstormsandchat', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormethercalc', icon: 'fa-archive', label: 'Sandstorm EtherCalc', path: 'export/sandstormethercalc', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormradicalecalendar', icon: 'fa-archive', label: 'Sandstorm Radicale calendar', path: 'export/sandstormradicalecalendar', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormradicalecontacts', icon: 'fa-archive', label: 'Sandstorm Radicale address book', path: 'export/sandstormradicalecontacts', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormdavros', icon: 'fa-archive', label: 'Sandstorm Davros', path: 'export/sandstormdavros', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'sandstormhackercms', icon: 'fa-archive', label: 'Sandstorm Hacker CMS', path: 'export/sandstormhackercms', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'meistertask', icon: 'fa-tasks', label: 'MeisterTask', path: 'export/meistertask', ext: 'csv', scopes: BOARD_ONLY },
|
||||
{ key: 'obsidian', icon: 'fa-diamond', label: 'Obsidian Kanban', path: 'export/obsidian', ext: 'md', scopes: BOARD_ONLY },
|
||||
{ key: 'linear', icon: 'fa-bars', label: 'Linear', path: 'export/linear', ext: 'csv', scopes: BOARD_ONLY },
|
||||
@@ -267,6 +291,7 @@ const EXPORT_FORMAT_GROUPS = [
|
||||
{ key: 'monday', icon: 'fa-table', label: 'monday.com', path: 'export/monday', ext: 'xlsx', scopes: BOARD_ONLY },
|
||||
{ key: 'superproductivity', icon: 'fa-check-circle-o', label: 'Super Productivity', path: 'export/superproductivity', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'vikunja', icon: 'fa-file-archive-o', label: 'Vikunja', path: 'export/vikunja', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'fizzy', icon: 'fa-file-archive-o', label: 'Fizzy', path: 'export/fizzy', ext: 'zip', scopes: BOARD_ONLY },
|
||||
{ key: 'wrike', icon: 'fa-table', label: 'Wrike', path: 'export/wrike', ext: 'xlsx', scopes: BOARD_ONLY },
|
||||
{ key: 'wrikeworkflow', icon: 'fa-sitemap', label: 'Wrike workflow', path: 'export/wrikeworkflow', ext: 'json', scopes: BOARD_ONLY },
|
||||
{ key: 'teamwork', icon: 'fa-table', label: 'Teamwork.com', path: 'export/teamwork', ext: 'xlsx', scopes: BOARD_ONLY },
|
||||
@@ -324,14 +349,15 @@ function resolvedFormatGroups() {
|
||||
}))
|
||||
.filter(group => group.entries.length)
|
||||
// The other tools' formats under headings by kind (models/lib/toolGroups.js),
|
||||
// the same groups as the Import page; WeKan's own JSON keeps "JSON".
|
||||
// the same groups as the Import page; WeKan's own JSON keeps "JSON", and
|
||||
// a company with several products is headed by the company's name.
|
||||
.flatMap(group => {
|
||||
if (group.key !== 'json') return [group];
|
||||
const { groupTools } = require('/models/lib/toolGroups');
|
||||
const parts = [];
|
||||
for (const entry of groupTools(group.entries)) {
|
||||
if (entry.groupStart) {
|
||||
parts.push({ key: `json-${entry.group}`, heading: entry.groupLabelKey ? TAPi18n.__(entry.groupLabelKey) : group.heading, entries: [] });
|
||||
parts.push({ key: `json-${entry.group}`, heading: entry.groupLabelKey ? TAPi18n.__(entry.groupLabelKey) : entry.groupLabel || group.heading, entries: [] });
|
||||
}
|
||||
parts[parts.length - 1].entries.push(entry);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
/* Board View / Shop: a readable shop page, whatever the board's colours. */
|
||||
.shop-view {
|
||||
max-width: 72em;
|
||||
margin-inline: auto;
|
||||
padding: 1em;
|
||||
background: #fff;
|
||||
color: #222;
|
||||
line-height: 1.5;
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.shop-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.6em 1em;
|
||||
border-block-end: 1px solid #ddd;
|
||||
margin-block-end: 1em;
|
||||
}
|
||||
.shop-title {
|
||||
flex: 1 1 auto;
|
||||
margin: 0.3em 0;
|
||||
}
|
||||
.shop-title a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.shop-cart-button,
|
||||
.shop-settings-link {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.shop-cart-button.is-current {
|
||||
font-weight: bold;
|
||||
}
|
||||
.shop-cart-count {
|
||||
display: inline-block;
|
||||
min-width: 1.4em;
|
||||
margin-inline-start: 0.3em;
|
||||
padding: 0 0.3em;
|
||||
border-radius: 0.7em;
|
||||
background: #2e7d32;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.shop-notice {
|
||||
padding: 0.5em 0.8em;
|
||||
border-radius: 4px;
|
||||
background: #fff3cd;
|
||||
color: #5c4400;
|
||||
}
|
||||
.shop-error {
|
||||
background: #fde2e1;
|
||||
color: #7a1712;
|
||||
}
|
||||
.shop-categories {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4em;
|
||||
margin-block: 0.6em 1em;
|
||||
}
|
||||
.shop-categories a {
|
||||
padding: 0.2em 0.7em;
|
||||
border-radius: 1em;
|
||||
border: 1px solid #ccc;
|
||||
text-decoration: none;
|
||||
}
|
||||
.shop-categories a.is-current {
|
||||
font-weight: bold;
|
||||
outline: 2px solid #222;
|
||||
}
|
||||
.shop-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 13em), 1fr));
|
||||
gap: 1em;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.shop-tile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3em;
|
||||
padding: 0.6em;
|
||||
border: 1px solid #e3e3e3;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.shop-tile-link {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3em;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.shop-tile-image {
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 3;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.shop-tile-noimage {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 2.5em;
|
||||
color: #bbb;
|
||||
}
|
||||
.shop-tile-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
.shop-tile-short {
|
||||
color: #555;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.shop-price {
|
||||
font-weight: bold;
|
||||
color: #2e7d32;
|
||||
}
|
||||
.shop-sold-out {
|
||||
color: #b71c1c;
|
||||
font-weight: bold;
|
||||
}
|
||||
.shop-product-page {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1.5em;
|
||||
}
|
||||
.shop-product-image {
|
||||
flex: 1 1 18em;
|
||||
max-width: min(100%, 32em);
|
||||
border-radius: 6px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.shop-product-details {
|
||||
flex: 1 1 18em;
|
||||
min-width: 0;
|
||||
}
|
||||
.shop-add,
|
||||
.shop-checkout,
|
||||
.shop-settings {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3em;
|
||||
max-width: 32em;
|
||||
}
|
||||
.shop-add input[type="number"] {
|
||||
max-width: 6em;
|
||||
}
|
||||
.shop-cart-table-wrap,
|
||||
.shop-cart {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.shop-cart-table {
|
||||
border-collapse: collapse;
|
||||
min-width: 100%;
|
||||
}
|
||||
.shop-cart-table th,
|
||||
.shop-cart-table td {
|
||||
padding: 0.3em 0.5em;
|
||||
border-block-end: 1px solid #eee;
|
||||
text-align: start;
|
||||
}
|
||||
.shop-cart-table input[type="number"] {
|
||||
width: 4.5em;
|
||||
}
|
||||
.shop-amount {
|
||||
text-align: end;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.shop-totals {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
justify-content: start;
|
||||
gap: 0.2em 1.5em;
|
||||
}
|
||||
.shop-totals dd {
|
||||
margin: 0;
|
||||
text-align: end;
|
||||
}
|
||||
.shop-total {
|
||||
font-weight: bold;
|
||||
}
|
||||
.shop-methods {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.shop-check,
|
||||
.shop-method,
|
||||
.shop-terms {
|
||||
display: block;
|
||||
}
|
||||
.shop-qr svg {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.shop-barcode {
|
||||
max-width: 32em;
|
||||
}
|
||||
.shop-settings fieldset {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
max-height: 14em;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.shop-settings-method {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.5em;
|
||||
}
|
||||
.shop-saved {
|
||||
color: #2e7d32;
|
||||
}
|
||||
/* The shop's forms use labelled native checkboxes and radio buttons, not the
|
||||
hidden material inputs of the rest of WeKan. */
|
||||
.shop-view input[type="checkbox"],
|
||||
.shop-view input[type="radio"],
|
||||
.shop-settings input[type="checkbox"] {
|
||||
display: inline-block;
|
||||
visibility: visible;
|
||||
position: static;
|
||||
inset-inline-start: auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-inline-end: 6px;
|
||||
appearance: auto;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
//- Board View / Shop (models/lib/shop.js, docs/Features/Board-Header/Board-Views/Shop.md):
|
||||
the products on the board's cards as a web shop - a card with a price in a
|
||||
list on sale is a product, its labels the categories. The cart is kept in
|
||||
this browser; the checkout sends card ids and quantities, and the server
|
||||
prices the order from the cards and writes it as a card in the Orders list.
|
||||
A public board can open in it (Board Settings / Shop or Board View), so a
|
||||
visitor shops at the board's address instead of seeing the kanban. Every
|
||||
text of a card is drawn as text, or through the Markdown viewer.
|
||||
template(name="shopView")
|
||||
.shop-view
|
||||
header.shop-header
|
||||
h1.shop-title
|
||||
a.js-shop-home(href="?") {{shopTitle}}
|
||||
if isBoardAdmin
|
||||
a.shop-settings-link.js-open-shop-settings(href="#" title="{{_ 'board-view-shop'}}" aria-label="{{_ 'board-view-shop'}}")
|
||||
i.fa.fa-cog
|
||||
a.shop-cart-button.js-shop-cart(href="#" class="{{#if $eq mode 'cart'}}is-current{{/if}}")
|
||||
i.fa.fa-shopping-cart
|
||||
| {{_ 'shop-cart'}}
|
||||
span.shop-cart-count {{cartCount}}
|
||||
unless settings.enabled
|
||||
p.shop-notice.shop-closed {{_ 'shop-closed'}}
|
||||
if showShop
|
||||
if $eq mode 'done'
|
||||
+shopOrderDone(order=order)
|
||||
else if $eq mode 'checkout'
|
||||
+shopCheckout
|
||||
else if $eq mode 'cart'
|
||||
+shopCart
|
||||
else if productPage
|
||||
with productPage
|
||||
article.shop-product-page
|
||||
if coverUrl
|
||||
img.shop-product-image(src=coverUrl alt=title)
|
||||
.shop-product-details
|
||||
h2.shop-product-title {{title}}
|
||||
p.shop-price {{money priceMinor}}
|
||||
if sku
|
||||
p.shop-sku {{_ 'shop-product-code'}}: {{sku}}
|
||||
if soldOut
|
||||
p.shop-sold-out {{_ 'shop-sold-out'}}
|
||||
else
|
||||
if hasStock
|
||||
p.shop-stock {{_ 'shop-in-stock' count=stock}}
|
||||
form.shop-add.js-shop-add(data-id=_id)
|
||||
label(for="shop-quantity") {{_ 'shop-quantity'}}
|
||||
input#shop-quantity(type="number" name="quantity" min="1" max="{{maxQuantity}}" step="1" value="1")
|
||||
button.primary(type="submit") {{_ 'shop-add-to-cart'}}
|
||||
if description
|
||||
.shop-product-description
|
||||
+viewer
|
||||
= description
|
||||
a.js-shop-home(href="?") {{_ 'shop-continue'}}
|
||||
else
|
||||
if shopIntro
|
||||
.shop-intro
|
||||
+viewer
|
||||
= shopIntro
|
||||
if categories.length
|
||||
nav.shop-categories(aria-label="{{_ 'labels'}}")
|
||||
a.js-shop-category(href="#" data-id="" class="{{#unless category}}is-current{{/unless}}") {{_ 'shop-all-categories'}}
|
||||
each cat in categories
|
||||
a.js-shop-category(href="#" data-id=cat._id class="card-label-{{cat.color}} {{#if $eq cat._id category}}is-current{{/if}}") {{cat.name}}
|
||||
if products.length
|
||||
ul.shop-grid
|
||||
each product in products
|
||||
li.shop-tile(data-id=product._id)
|
||||
a.shop-tile-link.js-shop-product(href="?product={{product._id}}" data-id=product._id)
|
||||
if product.coverUrl
|
||||
img.shop-tile-image(src=product.coverUrl alt=product.title loading="lazy")
|
||||
else
|
||||
span.shop-tile-image.shop-tile-noimage
|
||||
i.fa.fa-shopping-bag
|
||||
span.shop-tile-title {{product.title}}
|
||||
span.shop-price {{money product.priceMinor}}
|
||||
if product.short
|
||||
span.shop-tile-short {{product.short}}
|
||||
if product.soldOut
|
||||
span.shop-sold-out {{_ 'shop-sold-out'}}
|
||||
else
|
||||
button.js-shop-add-one(type="button" data-id=product._id) {{_ 'shop-add-to-cart'}}
|
||||
else
|
||||
p.quiet.shop-empty {{_ 'shop-empty'}}
|
||||
|
||||
template(name="shopCart")
|
||||
section.shop-cart
|
||||
h2 {{_ 'shop-cart'}}
|
||||
if priced.lines.length
|
||||
table.shop-cart-table
|
||||
thead
|
||||
tr
|
||||
th {{_ 'title'}}
|
||||
th {{_ 'shop-quantity'}}
|
||||
th {{_ 'billing-amount'}}
|
||||
th
|
||||
tbody
|
||||
each line in priced.lines
|
||||
tr(data-id=line.cardId)
|
||||
td
|
||||
a.js-shop-product(href="?product={{line.cardId}}" data-id=line.cardId) {{line.title}}
|
||||
td
|
||||
input.js-shop-quantity(type="number" min="1" max="999" step="1" value=line.quantity data-id=line.cardId aria-label="{{_ 'shop-quantity'}}")
|
||||
| × {{money line.unitMinor}}
|
||||
td.shop-amount {{money line.lineMinor}}
|
||||
td
|
||||
a.js-shop-remove(href="#" data-id=line.cardId title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
+shopTotals(totals=priced)
|
||||
if checkoutRefusal
|
||||
p.shop-notice {{refusalText}}
|
||||
else
|
||||
button.primary.js-shop-checkout(type="button") {{_ 'shop-checkout'}}
|
||||
else
|
||||
if priced.error
|
||||
p.shop-notice {{priceErrorText}}
|
||||
p.quiet {{_ 'shop-cart-empty'}}
|
||||
a.js-shop-home(href="?") {{_ 'shop-continue'}}
|
||||
|
||||
template(name="shopTotals")
|
||||
dl.shop-totals
|
||||
if totals.vatMinor
|
||||
dt {{_ 'billing-net'}}
|
||||
dd {{money totals.netMinor}}
|
||||
dt {{_ 'billing-vat'}} {{totals.vatPercent}} %
|
||||
dd {{money totals.vatMinor}}
|
||||
dt.shop-total {{_ 'billing-total'}}
|
||||
dd.shop-total {{money totals.totalMinor}}
|
||||
|
||||
template(name="shopCheckout")
|
||||
form.shop-checkout.js-shop-place-order
|
||||
h2 {{_ 'shop-checkout'}}
|
||||
+shopTotals(totals=priced)
|
||||
label(for="shop-name") {{_ 'fullname'}}
|
||||
input#shop-name(type="text" name="name" required maxlength="100" autocomplete="name")
|
||||
label(for="shop-email") {{_ 'email'}}
|
||||
input#shop-email(type="email" name="email" required maxlength="254" autocomplete="email")
|
||||
label(for="shop-phone") {{_ 'billing-phone'}}
|
||||
input#shop-phone(type="tel" name="phone" maxlength="40" autocomplete="tel")
|
||||
label(for="shop-address") {{_ 'billing-address'}}
|
||||
textarea#shop-address(name="address" rows="3" maxlength="500" autocomplete="street-address")
|
||||
label(for="shop-note") {{_ 'shop-note'}}
|
||||
textarea#shop-note(name="note" rows="3" maxlength="1000")
|
||||
fieldset.shop-methods
|
||||
legend {{_ 'billing-method'}}
|
||||
each method in paymentMethods
|
||||
label.shop-method
|
||||
input(type="radio" name="paymentMethodId" value=method.id required checked="{{#if $eq @index 0}}checked{{/if}}")
|
||||
| {{method.label}}
|
||||
if settings.termsUrl
|
||||
label.shop-terms
|
||||
input(type="checkbox" name="termsAccepted" required)
|
||||
| {{_ 'shop-accept-terms'}}
|
||||
| (
|
||||
a(href=settings.termsUrl target="_blank" rel="noopener noreferrer") {{settings.termsUrl}}
|
||||
| )
|
||||
p.quiet.shop-privacy {{_ 'shop-privacy-note'}}
|
||||
if error
|
||||
p.shop-notice.shop-error {{error}}
|
||||
button.primary(type="submit" disabled="{{#if sending}}disabled{{/if}}") {{_ 'shop-place-order'}}
|
||||
a.js-shop-cart(href="#") {{_ 'back'}}
|
||||
|
||||
template(name="shopOrderDone")
|
||||
section.shop-done
|
||||
h2 {{_ 'shop-order-placed' number=order.number}}
|
||||
+shopTotals(totals=order)
|
||||
with order.payment
|
||||
section.shop-payment
|
||||
h3 {{methodLabel}}
|
||||
if error
|
||||
p.shop-notice {{error}}
|
||||
else
|
||||
if qr
|
||||
p.quiet {{_ 'billing-pay-by-scanning'}}
|
||||
.shop-qr {{{qrCode}}}
|
||||
if barcode
|
||||
.shop-barcode {{{barcodeCode}}}
|
||||
each line in lines
|
||||
p.shop-payment-line {{line}}
|
||||
if safeLink
|
||||
p
|
||||
a(href=safeLink target="_blank" rel="noopener noreferrer") {{safeLink}}
|
||||
if order.reference
|
||||
p {{_ 'billing-payment-reference'}}: {{formattedReference}}
|
||||
if order.invoiceNumber
|
||||
p.shop-invoice-number {{_ 'billing-invoice'}}: {{order.invoiceNumber}}
|
||||
a.js-shop-home(href="?") {{_ 'shop-continue'}}
|
||||
|
||||
//- Board Settings / Shop (docs/Features/Board-Sidebar/Board-Settings/Shop.md).
|
||||
Saved as a whole by the shopSetSettings method (server/shop.js), which
|
||||
checks every value again: who saves, the fields, the lists, the Orders
|
||||
list's board and the payment methods.
|
||||
template(name="boardShopSettingsPopup")
|
||||
form.shop-settings.js-shop-settings
|
||||
label.shop-check
|
||||
input(type="checkbox" name="enabled" checked=draft.enabled)
|
||||
| {{_ 'shop-open'}}
|
||||
label(for="shop-set-title") {{_ 'title'}}
|
||||
input#shop-set-title(type="text" name="title" maxlength="200" value=draft.title placeholder=boardTitle)
|
||||
label(for="shop-set-intro") {{_ 'shop-intro'}}
|
||||
textarea#shop-set-intro(name="intro" rows="3" maxlength="5000") {{draft.intro}}
|
||||
label(for="shop-set-price") {{_ 'shop-price-field'}}
|
||||
select#shop-set-price(name="priceFieldId")
|
||||
option(value="") {{_ 'shop-not-chosen'}}
|
||||
each field in fieldsFor 'priceFieldId'
|
||||
option(value=field._id selected="{{#if $eq field._id draft.priceFieldId}}selected{{/if}}") {{field.name}}
|
||||
label(for="shop-set-sku") {{_ 'shop-sku-field'}}
|
||||
select#shop-set-sku(name="skuFieldId")
|
||||
option(value="") {{_ 'shop-not-chosen'}}
|
||||
each field in fieldsFor 'skuFieldId'
|
||||
option(value=field._id selected="{{#if $eq field._id draft.skuFieldId}}selected{{/if}}") {{field.name}}
|
||||
label(for="shop-set-stock") {{_ 'shop-stock-field'}}
|
||||
select#shop-set-stock(name="stockFieldId")
|
||||
option(value="") {{_ 'shop-not-chosen'}}
|
||||
each field in fieldsFor 'stockFieldId'
|
||||
option(value=field._id selected="{{#if $eq field._id draft.stockFieldId}}selected{{/if}}") {{field.name}}
|
||||
label.shop-check
|
||||
input(type="checkbox" name="decrementStock" checked=draft.decrementStock)
|
||||
| {{_ 'shop-decrement-stock'}}
|
||||
label(for="shop-set-currency") {{_ 'billing-currency'}}
|
||||
input#shop-set-currency(type="text" name="currency" maxlength="3" pattern="[A-Za-z]{3}" value=draft.currency)
|
||||
label(for="shop-set-vat") {{_ 'billing-vat'}} %
|
||||
input#shop-set-vat(type="number" name="vatPercent" min="0" max="100" step="0.01" value=draft.vatPercent)
|
||||
label.shop-check
|
||||
input(type="checkbox" name="pricesIncludeVat" checked=draft.pricesIncludeVat)
|
||||
| {{_ 'shop-prices-include-vat'}}
|
||||
label(for="shop-set-reference") {{_ 'billing-payment-reference'}}
|
||||
select#shop-set-reference(name="referenceType")
|
||||
each ref in referenceTypes
|
||||
option(value=ref.value selected="{{#if $eq ref.value draft.referenceType}}selected{{/if}}") {{ref.label}}
|
||||
fieldset
|
||||
legend {{_ 'shop-sale-lists'}}
|
||||
each list in boardLists
|
||||
label.shop-check
|
||||
input(type="checkbox" name="saleListIds" value=list._id checked=list.checked)
|
||||
| {{list.title}}
|
||||
fieldset
|
||||
legend {{_ 'shop-category-labels'}}
|
||||
each label in boardLabels
|
||||
label.shop-check
|
||||
input(type="checkbox" name="categoryLabelIds" value=label._id checked=label.checked)
|
||||
span.card-label(class="card-label-{{label.color}}") {{label.name}}
|
||||
label(for="shop-set-orders") {{_ 'shop-orders-list'}}
|
||||
select#shop-set-orders(name="orders")
|
||||
option(value="") {{_ 'shop-not-chosen'}}
|
||||
each target in orderTargets
|
||||
optgroup(label=target.title)
|
||||
each list in target.lists
|
||||
option(value="{{target._id}}/{{list._id}}" selected="{{#if isOrdersList target._id list._id}}selected{{/if}}") {{list.title}}
|
||||
p.quiet {{_ 'shop-orders-private'}}
|
||||
label.shop-check
|
||||
input(type="checkbox" name="guestCheckout" checked=draft.guestCheckout)
|
||||
| {{_ 'shop-guest-checkout'}}
|
||||
label.shop-check
|
||||
input(type="checkbox" name="confirmationEmail" checked=draft.confirmationEmail)
|
||||
| {{_ 'shop-confirmation-email'}}
|
||||
label(for="shop-set-terms") {{_ 'shop-terms-url'}}
|
||||
input#shop-set-terms(type="url" name="termsUrl" maxlength="2000" value=draft.termsUrl placeholder="https://")
|
||||
label.shop-check
|
||||
input(type="checkbox" name="showOnPublic" checked=showsOnPublic)
|
||||
| {{_ 'shop-show-on-public'}}
|
||||
p.quiet {{_ 'shop-show-on-public-note' view=publicViewName}}
|
||||
fieldset.shop-settings-methods
|
||||
legend {{_ 'billing-payment-methods'}}
|
||||
each method in draftMethods
|
||||
.shop-settings-method(data-id=method.id)
|
||||
label.shop-check
|
||||
input.js-shop-method-enabled(type="checkbox" data-id=method.id checked=method.enabled)
|
||||
| {{method.label}}
|
||||
if method.summary
|
||||
| · {{method.summary}}
|
||||
a.js-shop-method-remove(href="#" data-id=method.id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
label(for="shop-method-type") {{_ 'billing-method'}}
|
||||
select#shop-method-type.js-shop-method-type
|
||||
each type in methodTypes
|
||||
option(value=type.value selected="{{#if $eq type.value methodType}}selected{{/if}}") {{type.label}}
|
||||
each fieldName in methodFields
|
||||
label(for="shop-method-{{fieldName.name}}") {{fieldName.label}}
|
||||
if $eq fieldName.name 'details'
|
||||
textarea.js-shop-method-field(id="shop-method-{{fieldName.name}}" data-name=fieldName.name rows="2" maxlength="2000")
|
||||
else
|
||||
input.js-shop-method-field(id="shop-method-{{fieldName.name}}" type="text" data-name=fieldName.name maxlength="2000" placeholder=fieldName.placeholder)
|
||||
button.js-shop-method-add(type="button") {{_ 'billing-add-method'}}
|
||||
if error
|
||||
p.shop-notice.shop-error {{error}}
|
||||
if saved
|
||||
p.shop-saved {{_ 'feature-saved'}}
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
@@ -0,0 +1,473 @@
|
||||
// Board View / Shop (shopView.jade, models/lib/shop.js). The board's own
|
||||
// subscription brings its lists, cards, custom fields and attachments - for a
|
||||
// visitor of a public board too - so the shop is drawn from them as they
|
||||
// change. Which product is open is in the address (?product=), so a product
|
||||
// can be linked to. The cart is this browser's (localStorage); the server
|
||||
// never trusts it for anything but card ids and quantities.
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Random } from 'meteor/random';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { Utils } from '/client/lib/utils';
|
||||
import { METHOD_KEYS, FIELD_KEYS, PLACEHOLDERS, qrSvg, barcodeSvg } from '/client/lib/paymentCodeSvg';
|
||||
|
||||
const shop = require('/models/lib/shop');
|
||||
const { formatMoney } = require('/models/lib/billing');
|
||||
const { PAYMENT_METHODS, formatReference, formatIban } = require('/models/lib/paymentCodes');
|
||||
const { BOARD_VIEWS } = require('/models/lib/boardViewSettings');
|
||||
|
||||
const t = (key, options) => TAPi18n.__(key, options);
|
||||
const language = () => {
|
||||
try { return TAPi18n.getLanguage ? TAPi18n.getLanguage() : undefined; } catch (e) { return undefined; }
|
||||
};
|
||||
const errorText = error => (error ? (error.reason || error.error || error.message || String(error)) : '');
|
||||
|
||||
// ---------------------------------------------------------------- state
|
||||
|
||||
// What the shop shows: the products ('shop'), the cart, the checkout, or the
|
||||
// order just placed. The open product is the address's ?product=.
|
||||
const mode = new ReactiveVar('shop');
|
||||
const category = new ReactiveVar('');
|
||||
const placedOrder = new ReactiveVar(null);
|
||||
const cartLines = new ReactiveVar([]);
|
||||
let cartBoardId = null;
|
||||
|
||||
function storage() {
|
||||
try { return window.localStorage; } catch (e) { return null; }
|
||||
}
|
||||
|
||||
// The cart of the board on screen, read from this browser once per board.
|
||||
function cart() {
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
if (boardId !== cartBoardId) {
|
||||
cartBoardId = boardId;
|
||||
let lines = [];
|
||||
try {
|
||||
const raw = storage() && storage().getItem(shop.cartStorageKey(boardId));
|
||||
lines = raw ? shop.normalizeCart(JSON.parse(raw)).items : [];
|
||||
} catch (e) { lines = []; }
|
||||
cartLines.set(lines);
|
||||
}
|
||||
return cartLines.get();
|
||||
}
|
||||
|
||||
function saveCart(lines) {
|
||||
const clean = shop.normalizeCart(lines.filter(l => l.quantity > 0)).items;
|
||||
cartLines.set(clean);
|
||||
try { storage() && storage().setItem(shop.cartStorageKey(Utils.getCurrentBoardId()), JSON.stringify(clean)); } catch (e) { /* a private window keeps it on screen only */ }
|
||||
}
|
||||
|
||||
function addToCart(cardId, quantity) {
|
||||
const lines = cart().slice();
|
||||
const line = lines.find(l => l.cardId === cardId);
|
||||
if (line) line.quantity = Math.min(shop.LIMITS.quantity, line.quantity + quantity);
|
||||
else lines.push({ cardId, quantity });
|
||||
saveCart(lines);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- the board's shop
|
||||
|
||||
function board() {
|
||||
return Utils.getCurrentBoard();
|
||||
}
|
||||
|
||||
function settings() {
|
||||
return shop.shopSettingsOf(board());
|
||||
}
|
||||
|
||||
function coverUrlOf(product) {
|
||||
let image = product.coverId ? ReactiveCache.getAttachment(product.coverId) : null;
|
||||
if (!image || !image.isImage) {
|
||||
image = (ReactiveCache.getAttachments({ 'meta.cardId': product._id }) || []).find(a => a && a.isImage);
|
||||
}
|
||||
return image && typeof image.link === 'function' ? image.link() : '';
|
||||
}
|
||||
|
||||
function products() {
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
if (!boardId) return [];
|
||||
return shop.productsOf({
|
||||
lists: ReactiveCache.getLists({ boardId }) || [],
|
||||
cards: ReactiveCache.getCards({ boardId, archived: false }) || [],
|
||||
}, settings());
|
||||
}
|
||||
|
||||
function money(minor) {
|
||||
return formatMoney(minor, settings().currency, language());
|
||||
}
|
||||
|
||||
// The cart priced from the products on screen - what the buyer sees before
|
||||
// ordering. The server prices it again from the cards.
|
||||
function priced() {
|
||||
const items = cart();
|
||||
if (!items.length) return { lines: [] };
|
||||
const all = products();
|
||||
const known = new Set(all.map(p => p._id));
|
||||
const priceable = items.filter(i => known.has(i.cardId));
|
||||
if (!priceable.length) return { lines: [] };
|
||||
const result = shop.priceCart(priceable, all, settings());
|
||||
return result.error ? { lines: [], error: result.error } : result;
|
||||
}
|
||||
|
||||
function isBoardAdmin() {
|
||||
const user = ReactiveCache.getCurrentUser();
|
||||
return !!(user && typeof user.isBoardAdmin === 'function' && user.isBoardAdmin());
|
||||
}
|
||||
|
||||
function refusal() {
|
||||
const b = board();
|
||||
return shop.checkoutRefusal({ settings: settings(), featureOn: true, canRead: !!b, userId: Meteor.userId() });
|
||||
}
|
||||
|
||||
const ERROR_KEYS = {
|
||||
'shop-closed': 'shop-closed',
|
||||
'shop-guest-not-allowed': 'shop-login-to-order',
|
||||
'shop-price-changed': 'shop-price-changed',
|
||||
'shop-sold-out': 'shop-sold-out',
|
||||
'shop-not-enough-stock': 'shop-sold-out',
|
||||
'shop-no-orders-list': 'shop-closed',
|
||||
'shop-no-payment-method': 'shop-closed',
|
||||
};
|
||||
|
||||
function refusalTextOf(code) {
|
||||
return ERROR_KEYS[code] ? t(ERROR_KEYS[code]) : code;
|
||||
}
|
||||
|
||||
function goHome() {
|
||||
mode.set('shop');
|
||||
FlowRouter.setQueryParams({ product: null });
|
||||
}
|
||||
|
||||
const shared = { money, settings };
|
||||
|
||||
// ---------------------------------------------------------------- the shop
|
||||
|
||||
Template.shopView.helpers({
|
||||
...shared,
|
||||
mode: () => mode.get(),
|
||||
order: () => placedOrder.get(),
|
||||
isBoardAdmin,
|
||||
shopTitle() {
|
||||
const b = board();
|
||||
return settings().title || (b ? b.title : '');
|
||||
},
|
||||
shopIntro: () => settings().intro,
|
||||
// A closed shop shows its products to the board's admins only, so they can
|
||||
// see what it will look like before opening it.
|
||||
showShop: () => settings().enabled || isBoardAdmin(),
|
||||
cartCount: () => cart().reduce((n, l) => n + l.quantity, 0),
|
||||
category: () => category.get(),
|
||||
categories() {
|
||||
const b = board();
|
||||
return shop.categoriesOf(products(), b ? b.labels : [], settings());
|
||||
},
|
||||
products() {
|
||||
return shop.productsInCategory(products(), category.get())
|
||||
.map(p => ({ ...p, coverUrl: coverUrlOf(p), short: shop.shortDescription(p.description) }));
|
||||
},
|
||||
productPage() {
|
||||
const id = FlowRouter.getQueryParam('product');
|
||||
const product = id && products().find(p => p._id === id);
|
||||
if (!product) return null;
|
||||
return {
|
||||
...product,
|
||||
coverUrl: coverUrlOf(product),
|
||||
hasStock: product.stock !== null,
|
||||
maxQuantity: product.stock === null ? shop.LIMITS.quantity : Math.min(product.stock, shop.LIMITS.quantity),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Template.shopView.events({
|
||||
'click .js-shop-home'(evt) {
|
||||
evt.preventDefault();
|
||||
goHome();
|
||||
},
|
||||
'click .js-shop-product'(evt) {
|
||||
evt.preventDefault();
|
||||
mode.set('shop');
|
||||
FlowRouter.setQueryParams({ product: evt.currentTarget.getAttribute('data-id') });
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
'click .js-shop-category'(evt) {
|
||||
evt.preventDefault();
|
||||
category.set(evt.currentTarget.getAttribute('data-id') || '');
|
||||
},
|
||||
'click .js-shop-cart'(evt) {
|
||||
evt.preventDefault();
|
||||
mode.set('cart');
|
||||
},
|
||||
'click .js-shop-add-one'(evt) {
|
||||
evt.preventDefault();
|
||||
addToCart(evt.currentTarget.getAttribute('data-id'), 1);
|
||||
},
|
||||
'submit .js-shop-add'(evt) {
|
||||
evt.preventDefault();
|
||||
const quantity = parseInt(evt.currentTarget.elements.quantity.value, 10);
|
||||
if (!Number.isInteger(quantity) || quantity < 1) return;
|
||||
addToCart(evt.currentTarget.getAttribute('data-id'), Math.min(quantity, shop.LIMITS.quantity));
|
||||
mode.set('cart');
|
||||
},
|
||||
'click .js-open-shop-settings'(evt) {
|
||||
evt.preventDefault();
|
||||
Popup.open('boardShopSettings', { titleKey: 'board-view-shop', dataContext: board() })(evt);
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- the cart
|
||||
|
||||
Template.shopCart.helpers({
|
||||
...shared,
|
||||
priced,
|
||||
checkoutRefusal: refusal,
|
||||
refusalText: () => refusalTextOf(refusal()),
|
||||
priceErrorText: () => refusalTextOf(priced().error),
|
||||
});
|
||||
|
||||
Template.shopCart.events({
|
||||
'change .js-shop-quantity'(evt) {
|
||||
const cardId = evt.currentTarget.getAttribute('data-id');
|
||||
const quantity = parseInt(evt.currentTarget.value, 10);
|
||||
saveCart(cart().map(l => (l.cardId === cardId ? { cardId, quantity: Number.isInteger(quantity) ? Math.max(0, Math.min(quantity, shop.LIMITS.quantity)) : l.quantity } : l)));
|
||||
},
|
||||
'click .js-shop-remove'(evt) {
|
||||
evt.preventDefault();
|
||||
const cardId = evt.currentTarget.getAttribute('data-id');
|
||||
saveCart(cart().filter(l => l.cardId !== cardId));
|
||||
},
|
||||
'click .js-shop-checkout'(evt) {
|
||||
evt.preventDefault();
|
||||
if (!refusal()) mode.set('checkout');
|
||||
},
|
||||
});
|
||||
|
||||
Template.shopTotals.helpers(shared);
|
||||
|
||||
// ---------------------------------------------------------------- checkout
|
||||
|
||||
function methodLabel(entry) {
|
||||
const m = entry.method || {};
|
||||
return m.label || t(METHOD_KEYS[m.type] || m.type);
|
||||
}
|
||||
|
||||
Template.shopCheckout.onCreated(function () {
|
||||
this.error = new ReactiveVar('');
|
||||
this.sending = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.shopCheckout.helpers({
|
||||
...shared,
|
||||
priced,
|
||||
error: () => Template.instance().error.get(),
|
||||
sending: () => Template.instance().sending.get(),
|
||||
paymentMethods: () => shop.enabledPaymentMethods(settings()).map(m => ({ id: m.id, label: methodLabel(m) })),
|
||||
});
|
||||
|
||||
Template.shopCheckout.events({
|
||||
'click .js-shop-cart'(evt) {
|
||||
evt.preventDefault();
|
||||
mode.set('cart');
|
||||
},
|
||||
async 'submit .js-shop-place-order'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const value = name => (form.elements[name] ? String(form.elements[name].value || '') : '');
|
||||
const method = form.querySelector('input[name="paymentMethodId"]:checked');
|
||||
const totals = priced();
|
||||
tpl.error.set('');
|
||||
tpl.sending.set(true);
|
||||
try {
|
||||
const order = await Meteor.callAsync('shopPlaceOrder', Utils.getCurrentBoardId(), {
|
||||
// Card ids and quantities only: the server prices the order itself.
|
||||
cart: cart().map(l => ({ cardId: l.cardId, quantity: l.quantity })),
|
||||
contact: {
|
||||
name: value('name'), email: value('email'), phone: value('phone'), address: value('address'), note: value('note'),
|
||||
termsAccepted: !!(form.elements.termsAccepted && form.elements.termsAccepted.checked),
|
||||
},
|
||||
paymentMethodId: method ? method.value : '',
|
||||
expectedTotalMinor: totals.totalMinor,
|
||||
// The confirmation e-mail is written in the buyer's language.
|
||||
language: language() || 'en',
|
||||
});
|
||||
saveCart([]);
|
||||
placedOrder.set(order);
|
||||
mode.set('done');
|
||||
window.scrollTo(0, 0);
|
||||
} catch (error) {
|
||||
tpl.error.set(refusalTextOf(error && error.error) !== (error && error.error) ? refusalTextOf(error.error) : errorText(error));
|
||||
} finally {
|
||||
tpl.sending.set(false);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- the order placed
|
||||
|
||||
Template.shopOrderDone.helpers({
|
||||
...shared,
|
||||
methodLabel() {
|
||||
return methodLabel(this);
|
||||
},
|
||||
qrCode() {
|
||||
return this.qr ? qrSvg(this.qr, this.swissCross) : '';
|
||||
},
|
||||
barcodeCode() {
|
||||
return this.barcode ? barcodeSvg(this.barcode) : '';
|
||||
},
|
||||
// A payment link of the method: https, or a payment app's own scheme -
|
||||
// never anything a browser would run.
|
||||
safeLink() {
|
||||
const link = typeof this.link === 'string' ? this.link : '';
|
||||
return /^(https:\/\/|upi:\/\/|bitcoin:|ethereum:|litecoin:)/i.test(link) ? link : '';
|
||||
},
|
||||
formattedReference() {
|
||||
const order = Template.currentData().order;
|
||||
return order ? formatReference(order.reference) : '';
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Board Settings / Shop
|
||||
|
||||
function fieldsOfBoard() {
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
return boardId ? (ReactiveCache.getCustomFields({ boardIds: { $in: [boardId] } }) || []) : [];
|
||||
}
|
||||
|
||||
Template.boardShopSettingsPopup.onCreated(function () {
|
||||
const b = board();
|
||||
const current = settings();
|
||||
// A board that never saved its shop gets the fields and the Orders list its
|
||||
// names suggest: a custom field called Price, a list called Orders.
|
||||
const suggested = shop.suggestedMapping({
|
||||
customFields: fieldsOfBoard(),
|
||||
lists: b ? (ReactiveCache.getLists({ boardId: b._id, archived: false }) || []) : [],
|
||||
});
|
||||
const stored = b && b.shopSettings;
|
||||
// A copied board's shop keeps its look but not the source's fields and
|
||||
// Orders list (models/lib/shop.js copiedShopSettings): suggest those too.
|
||||
const fill = {};
|
||||
for (const key of ['priceFieldId', 'skuFieldId', 'stockFieldId']) if (!current[key] && suggested[key]) fill[key] = suggested[key];
|
||||
if (!current.ordersListId && suggested.ordersListId) Object.assign(fill, { ordersListId: suggested.ordersListId, ordersBoardId: b._id });
|
||||
this.draft = new ReactiveVar(stored ? { ...current, ...fill } : { ...current, ...suggested, ordersBoardId: suggested.ordersListId ? b._id : '' });
|
||||
this.methods = new ReactiveVar(current.paymentMethods.slice());
|
||||
this.methodType = new ReactiveVar('sepa');
|
||||
this.targets = new ReactiveVar([]);
|
||||
this.error = new ReactiveVar('');
|
||||
this.saved = new ReactiveVar(false);
|
||||
Meteor.callAsync('shopOrderTargets').then(targets => this.targets.set(targets || [])).catch(error => this.error.set(errorText(error)));
|
||||
});
|
||||
|
||||
Template.boardShopSettingsPopup.helpers({
|
||||
draft: () => Template.instance().draft.get(),
|
||||
boardTitle: () => (board() ? board().title : ''),
|
||||
fieldsFor(key) {
|
||||
const types = shop.FIELD_TYPES[key] || [];
|
||||
return fieldsOfBoard().filter(f => types.includes(f.type)).map(f => ({ _id: f._id, name: f.name }));
|
||||
},
|
||||
referenceTypes: () => shop.REFERENCE_TYPES.map(value => ({ value, label: t(`billing-reference-${value}`) })),
|
||||
boardLists() {
|
||||
const b = board();
|
||||
const ticked = new Set(Template.instance().draft.get().saleListIds);
|
||||
return (b ? ReactiveCache.getLists({ boardId: b._id, archived: false }, { sort: { sort: 1 } }) || [] : [])
|
||||
.map(l => ({ _id: l._id, title: l.title, checked: ticked.has(l._id) }));
|
||||
},
|
||||
boardLabels() {
|
||||
const b = board();
|
||||
const ticked = new Set(Template.instance().draft.get().categoryLabelIds);
|
||||
return ((b && b.labels) || []).map(l => ({ _id: l._id, name: l.name || l.color, color: l.color, checked: ticked.has(l._id) }));
|
||||
},
|
||||
orderTargets: () => Template.instance().targets.get(),
|
||||
isOrdersList(boardId, listId) {
|
||||
const d = Template.instance().draft.get();
|
||||
return d.ordersListId === listId && (d.ordersBoardId || Utils.getCurrentBoardId()) === boardId;
|
||||
},
|
||||
showsOnPublic: () => shop.showsShopOnPublic(board()),
|
||||
// The view a visitor of this public board sees now, by its menu label.
|
||||
publicViewName() {
|
||||
const view = require('/models/lib/boardViewSettings').defaultBoardView(board(), 'public');
|
||||
const entry = BOARD_VIEWS.find(v => v.view === view);
|
||||
return entry ? t(entry.labelKey) : view;
|
||||
},
|
||||
draftMethods() {
|
||||
return Template.instance().methods.get().map(m => ({
|
||||
id: m.id, enabled: m.enabled !== false, label: methodLabel(m),
|
||||
summary: m.method.iban ? formatIban(m.method.iban)
|
||||
: (m.method.payee || m.method.key || m.method.vpa || m.method.address || m.method.user || m.method.url || m.method.details || ''),
|
||||
}));
|
||||
},
|
||||
methodTypes: () => Object.keys(PAYMENT_METHODS).map(value => ({ value, label: t(METHOD_KEYS[value] || value) })),
|
||||
methodType: () => Template.instance().methodType.get(),
|
||||
methodFields() {
|
||||
const spec = PAYMENT_METHODS[Template.instance().methodType.get()];
|
||||
return (spec ? spec.fields : []).map(name => ({ name, label: t(FIELD_KEYS[name] || name), placeholder: PLACEHOLDERS[name] || '' }));
|
||||
},
|
||||
error: () => Template.instance().error.get(),
|
||||
saved: () => Template.instance().saved.get(),
|
||||
});
|
||||
|
||||
Template.boardShopSettingsPopup.events({
|
||||
'change .js-shop-method-type'(evt, tpl) {
|
||||
tpl.methodType.set(evt.currentTarget.value);
|
||||
},
|
||||
'click .js-shop-method-add'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const type = tpl.methodType.get();
|
||||
const method = { type };
|
||||
for (const name of PAYMENT_METHODS[type].fields) {
|
||||
const input = tpl.find(`.js-shop-method-field[data-name="${name}"]`);
|
||||
method[name] = input ? input.value : '';
|
||||
}
|
||||
tpl.methods.set([...tpl.methods.get(), { id: Random.id(12).replace(/[^A-Za-z0-9]/g, ''), enabled: true, method }]);
|
||||
tpl.findAll('.js-shop-method-field').forEach(input => { input.value = ''; });
|
||||
},
|
||||
'change .js-shop-method-enabled'(evt, tpl) {
|
||||
const id = evt.currentTarget.getAttribute('data-id');
|
||||
tpl.methods.set(tpl.methods.get().map(m => (m.id === id ? { ...m, enabled: evt.currentTarget.checked } : m)));
|
||||
},
|
||||
'click .js-shop-method-remove'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const id = evt.currentTarget.getAttribute('data-id');
|
||||
tpl.methods.set(tpl.methods.get().filter(m => m.id !== id));
|
||||
},
|
||||
async 'submit .js-shop-settings'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const el = form.elements;
|
||||
const ticked = name => [...form.querySelectorAll(`input[name="${name}"]:checked`)].map(i => i.value);
|
||||
const [ordersBoardId, ordersListId] = String(el.orders.value || '').split('/');
|
||||
const input = {
|
||||
enabled: el.enabled.checked,
|
||||
title: el.title.value,
|
||||
intro: el.intro.value,
|
||||
currency: el.currency.value,
|
||||
priceFieldId: el.priceFieldId.value,
|
||||
skuFieldId: el.skuFieldId.value,
|
||||
stockFieldId: el.stockFieldId.value,
|
||||
decrementStock: el.decrementStock.checked,
|
||||
confirmationEmail: el.confirmationEmail.checked,
|
||||
vatPercent: el.vatPercent.value === '' ? 0 : Number(el.vatPercent.value),
|
||||
pricesIncludeVat: el.pricesIncludeVat.checked,
|
||||
referenceType: el.referenceType.value,
|
||||
saleListIds: ticked('saleListIds'),
|
||||
categoryLabelIds: ticked('categoryLabelIds'),
|
||||
ordersBoardId: ordersBoardId || '',
|
||||
ordersListId: ordersListId || '',
|
||||
guestCheckout: el.guestCheckout.checked,
|
||||
termsUrl: el.termsUrl.value,
|
||||
paymentMethods: tpl.methods.get(),
|
||||
};
|
||||
tpl.error.set('');
|
||||
tpl.saved.set(false);
|
||||
try {
|
||||
const stored = await Meteor.callAsync('shopSetSettings', Utils.getCurrentBoardId(), input, el.showOnPublic.checked);
|
||||
tpl.draft.set(stored);
|
||||
tpl.methods.set(stored.paymentMethods.slice());
|
||||
tpl.saved.set(true);
|
||||
} catch (error) {
|
||||
tpl.error.set(errorText(error));
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -5,7 +5,7 @@ import CardComments from '/models/cardComments';
|
||||
import { Utils } from '/client/lib/utils';
|
||||
import { liveAttachments } from '/models/lib/attachmentSoftDelete';
|
||||
import { IMPORT_SOURCES } from '/models/lib/importSources';
|
||||
import { attachmentKind } from '/models/lib/attachmentKind';
|
||||
import { attachmentKind, attachmentCanPreview } from '/models/lib/attachmentKind';
|
||||
import { openAttachmentSlideshow } from '/client/components/cards/attachments';
|
||||
|
||||
const vcs = require('/models/lib/versionControlView');
|
||||
@@ -257,9 +257,8 @@ Template.versionControlView.helpers({
|
||||
_id: file._id,
|
||||
attachment: file,
|
||||
isImage: !!kind.isImage,
|
||||
// What the attachment viewer opens (cards/attachments.js attachmentCanBeOpened).
|
||||
canPreview: !!(kind.isImage || kind.isPDF || kind.isText || kind.isJSON
|
||||
|| kind.isOffice || kind.isZIP || kind.isVideo || kind.isAudio),
|
||||
// What the attachment viewer opens (models/lib/attachmentKind.js attachmentCanPreview).
|
||||
canPreview: attachmentCanPreview(file),
|
||||
name: file.name,
|
||||
link: typeof file.link === 'function' ? file.link() : '',
|
||||
size: humanSize(file.size),
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Board View / Website: a readable page, whatever the board's colours. */
|
||||
.website-view {
|
||||
max-width: 48em;
|
||||
margin-inline: auto;
|
||||
padding: 1em;
|
||||
background: #fff;
|
||||
color: #222;
|
||||
line-height: 1.6;
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.website-header {
|
||||
border-block-end: 1px solid #ddd;
|
||||
margin-block-end: 1em;
|
||||
}
|
||||
.website-header h1 a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.website-nav {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4em 1em;
|
||||
padding-block-end: 0.6em;
|
||||
}
|
||||
.website-nav a.is-current {
|
||||
font-weight: bold;
|
||||
}
|
||||
.website-subnav {
|
||||
display: inline-flex;
|
||||
gap: 0.6em;
|
||||
margin-inline-start: 0.6em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.website-date {
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.website-images img {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-block: 0.6em;
|
||||
}
|
||||
.website-summary {
|
||||
margin-block-end: 1.2em;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//- Board View / Website (models/lib/websiteView.js): the board as a website -
|
||||
the cards of its Published list, Pages as the menu, the other cards as
|
||||
posts, newest first - built from the board's own cards and attachments.
|
||||
A public board can open in it (Board Settings / Board View), so a visitor
|
||||
sees the site at the board's address instead of the kanban.
|
||||
template(name="websiteView")
|
||||
.website-view
|
||||
header.website-header
|
||||
h1
|
||||
a.js-website-home(href="?") {{boardTitle}}
|
||||
nav.website-nav(aria-label="{{_ 'board-view-website'}}")
|
||||
each page in site.pages
|
||||
span.website-nav-item
|
||||
a.js-website-page(href="?page={{page._id}}" data-id=page._id class="{{#if $eq page._id currentId}}is-current{{/if}}") {{page.title}}
|
||||
if page.children.length
|
||||
span.website-subnav
|
||||
each sub in page.children
|
||||
a.js-website-page(href="?page={{sub._id}}" data-id=sub._id class="{{#if $eq sub._id currentId}}is-current{{/if}}") {{sub.title}}
|
||||
main.website-main
|
||||
if shown.cardId
|
||||
with shownCard
|
||||
article.website-article
|
||||
h2 {{title}}
|
||||
if postDate
|
||||
p.website-date {{postDate}}
|
||||
if description
|
||||
+viewer
|
||||
= description
|
||||
if images.length
|
||||
.website-images
|
||||
each image in images
|
||||
img(src=image.url alt=image.name loading="lazy")
|
||||
if files.length
|
||||
ul.website-files
|
||||
each file in files
|
||||
li
|
||||
a(href=file.url target="_blank" rel="noopener noreferrer") {{file.name}}
|
||||
else if shown.posts
|
||||
each post in site.posts
|
||||
article.website-summary
|
||||
h2
|
||||
a.js-website-page(href="?page={{post._id}}" data-id=post._id) {{post.title}}
|
||||
if post.date
|
||||
p.website-date {{post.date}}
|
||||
else
|
||||
p.quiet {{_ 'website-view-empty'}}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Board View / Website (websiteView.jade, models/lib/websiteView.js). The
|
||||
// board's own subscription brings its lists, swimlanes, cards and
|
||||
// attachments - for a visitor of a public board too - so the site is drawn
|
||||
// from them as they change. Which page is open is in the address (?page=),
|
||||
// so a page of the site can be linked to.
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { Utils } from '/client/lib/utils';
|
||||
|
||||
const { websiteOf, pageFor } = require('/models/lib/websiteView');
|
||||
|
||||
function site() {
|
||||
const boardId = Utils.getCurrentBoardId();
|
||||
if (!boardId) return websiteOf({});
|
||||
return websiteOf({
|
||||
lists: ReactiveCache.getLists({ boardId, archived: false }) || [],
|
||||
swimlanes: ReactiveCache.getSwimlanes({ boardId, archived: false }) || [],
|
||||
cards: ReactiveCache.getCards({ boardId, archived: false }) || [],
|
||||
});
|
||||
}
|
||||
|
||||
function currentId() {
|
||||
return FlowRouter.getQueryParam('page') || '';
|
||||
}
|
||||
|
||||
Template.websiteView.helpers({
|
||||
boardTitle() {
|
||||
const board = Utils.getCurrentBoard();
|
||||
return board ? board.title : '';
|
||||
},
|
||||
site,
|
||||
currentId,
|
||||
shown() {
|
||||
return pageFor(site(), currentId());
|
||||
},
|
||||
shownCard() {
|
||||
const page = pageFor(site(), currentId());
|
||||
return page.cardId ? ReactiveCache.getCard(page.cardId) : null;
|
||||
},
|
||||
postDate() {
|
||||
const when = this.receivedAt || this.startAt || this.createdAt;
|
||||
return when ? new Date(when).toISOString().slice(0, 10) : '';
|
||||
},
|
||||
images() {
|
||||
return (ReactiveCache.getAttachments({ 'meta.cardId': this._id }) || [])
|
||||
.filter(a => a.isImage).map(a => ({ name: a.name, url: typeof a.link === 'function' ? a.link() : '' })).filter(a => a.url);
|
||||
},
|
||||
files() {
|
||||
return (ReactiveCache.getAttachments({ 'meta.cardId': this._id }) || [])
|
||||
.filter(a => !a.isImage).map(a => ({ name: a.name, url: typeof a.link === 'function' ? a.link() : '' })).filter(a => a.url);
|
||||
},
|
||||
});
|
||||
|
||||
Template.websiteView.events({
|
||||
'click .js-website-page'(evt) {
|
||||
evt.preventDefault();
|
||||
FlowRouter.setQueryParams({ page: evt.currentTarget.getAttribute('data-id') });
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
'click .js-website-home'(evt) {
|
||||
evt.preventDefault();
|
||||
FlowRouter.setQueryParams({ page: null });
|
||||
},
|
||||
});
|
||||
@@ -399,31 +399,140 @@ button.attachment-thumbnail-container.attachment-thumbnail-compact:active {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#txt-viewer {
|
||||
background-color: white;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#office-viewer {
|
||||
background-color: #e5e7eb;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Text, Markdown, CSV, code, iCalendar, Outlook .msg, tar and OpenDocument
|
||||
(client/lib/attachmentRichViewer.js), read windowed (attachmentWindow.js):
|
||||
the .attachment-window scrolls, its viewport stays in view and holds only
|
||||
the visible rows, and the spacer gives the scrollbar the file's length. */
|
||||
#rich-viewer,
|
||||
#zip-viewer {
|
||||
background: white;
|
||||
color: #222;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
padding: 1em;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
text-align: start;
|
||||
overflow-wrap: anywhere;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.attachment-window {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.attachment-window-viewport {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
padding: 0 1em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.attachment-window-row {
|
||||
height: 1.5em;
|
||||
line-height: 1.5em;
|
||||
white-space: pre;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-family: monospace;
|
||||
}
|
||||
.attachment-window-list {
|
||||
margin: 0;
|
||||
padding-inline-start: 1.2em;
|
||||
will-change: transform;
|
||||
}
|
||||
#rich-viewer li,
|
||||
#zip-viewer li {
|
||||
padding: 0.3em;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.attachment-csv-row {
|
||||
display: flex;
|
||||
font-family: inherit;
|
||||
}
|
||||
.attachment-csv-cell {
|
||||
flex: 0 0 14em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
border-inline-end: 1px solid #c1c7d0;
|
||||
border-block-end: 1px solid #ebecf0;
|
||||
padding: 0 0.5em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.attachment-csv-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: #f4f5f7;
|
||||
font-weight: bold;
|
||||
z-index: 1;
|
||||
}
|
||||
.attachment-preview-code .attachment-window-viewport {
|
||||
background: #f6f8fa;
|
||||
}
|
||||
.attachment-preview-odf .attachment-window-list {
|
||||
padding-inline-start: 0;
|
||||
}
|
||||
.attachment-preview-odf p,
|
||||
.attachment-preview-odf h3 {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
margin: 0 0 0.5em;
|
||||
}
|
||||
.attachment-preview-page {
|
||||
border-block-start: 1px solid #c1c7d0;
|
||||
padding-block-start: 0.5em;
|
||||
}
|
||||
.attachment-preview-field .attachment-preview-label {
|
||||
display: inline-block;
|
||||
min-width: 8em;
|
||||
font-weight: bold;
|
||||
font-family: inherit;
|
||||
}
|
||||
.attachment-preview-records .attachment-window-row {
|
||||
font-family: inherit;
|
||||
}
|
||||
.attachment-preview-heading {
|
||||
font-weight: bold;
|
||||
}
|
||||
.attachment-preview-records .attachment-preview-page {
|
||||
font-weight: bold;
|
||||
border-block-start: 1px solid #c1c7d0;
|
||||
}
|
||||
.attachment-preview-markdown {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
padding: 1em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.attachment-preview-fields {
|
||||
display: grid;
|
||||
grid-template-columns: max-content 1fr;
|
||||
gap: 0.25em 1em;
|
||||
margin: 1em;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.attachment-preview-fields dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
.attachment-preview-fields dd {
|
||||
margin: 0;
|
||||
}
|
||||
.attachment-preview-mail-body {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
border-block-start: 1px solid #c1c7d0;
|
||||
}
|
||||
.pdf-preview-error {
|
||||
margin-top: 180px;
|
||||
@@ -465,7 +574,7 @@ button.attachment-thumbnail-container.attachment-thumbnail-compact:active {
|
||||
); /* Full height - height of top and bottom bars */
|
||||
}
|
||||
#zip-viewer,
|
||||
#txt-viewer,
|
||||
#rich-viewer,
|
||||
#office-viewer {
|
||||
width: 100%;
|
||||
height: calc(
|
||||
|
||||
@@ -77,11 +77,17 @@ template(name="attachmentViewer")
|
||||
audio#audio-viewer.hidden(controls="true")
|
||||
object#pdf-viewer.hidden(type="application/pdf")
|
||||
span.pdf-preview-error {{_ 'preview-pdf-not-supported' }}
|
||||
object#txt-viewer.hidden(type="text/plain")
|
||||
#zip-viewer.hidden(aria-live="polite")
|
||||
#office-viewer.hidden
|
||||
#rich-viewer.hidden(aria-live="polite")
|
||||
button.fa.fa-caret-right#next-attachment(type="button" aria-label="{{_ 'next'}}")
|
||||
|
||||
//- An attached Markdown file in the slideshow (client/lib/attachmentRichViewer.js):
|
||||
the same +viewer as a card description, with all of its settings.
|
||||
template(name="attachmentMarkdownPreview")
|
||||
+viewer
|
||||
= text
|
||||
|
||||
template(name="attachmentGallery")
|
||||
|
||||
.attachment-gallery
|
||||
|
||||
@@ -3,7 +3,7 @@ import { trapTabKey } from '/client/lib/accessibility';
|
||||
import { formatDateForDisplay } from '/client/lib/dateDisplay';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import '/client/components/cards/attachments.jade';
|
||||
import { attachmentKind } from '/models/lib/attachmentKind';
|
||||
import { attachmentKind, attachmentRichKind, attachmentCodeLanguage, attachmentCanPreview } from '/models/lib/attachmentKind';
|
||||
import { generateUniversalAttachmentUrl } from '/models/lib/universalUrlGenerator';
|
||||
import { canThumbnail, thumbnailUrl } from '/models/lib/attachmentThumbnail';
|
||||
import { liveAttachments } from '/models/lib/attachmentSoftDelete';
|
||||
@@ -24,6 +24,7 @@ import { EscapeActions } from '/client/lib/escapeActions';
|
||||
import { openNewDrawing } from '/client/lib/newDrawing';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
|
||||
const { filesize } = require('filesize');
|
||||
import prettyMilliseconds from 'pretty-ms';
|
||||
@@ -41,9 +42,15 @@ let touchStartCoords = null;
|
||||
let touchEndCoords = null;
|
||||
|
||||
let zipPreviewAbortController = null;
|
||||
let zipPreview = null;
|
||||
let officePreview = null;
|
||||
let officePreviewAbortController = null;
|
||||
let officePreviewGeneration = 0;
|
||||
// Markdown, CSV, code, iCalendar, Outlook .msg, tar and OpenDocument
|
||||
// (client/lib/attachmentRichViewer.js, loaded the first time one is opened).
|
||||
let richPreview = null;
|
||||
let richPreviewAbortController = null;
|
||||
let richPreviewGeneration = 0;
|
||||
|
||||
Template.attachmentGallery.events({
|
||||
'click .open-preview'(event) {
|
||||
@@ -127,17 +134,25 @@ function attachmentCanBeOpened(attachment) {
|
||||
// shared helper - which derives them from the mime type or the file name -
|
||||
// rather than the raw document. Otherwise an image that renders as a
|
||||
// thumbnail still refuses to open in the viewer.
|
||||
const kind = attachmentKind(attachment);
|
||||
return (
|
||||
kind.isImage ||
|
||||
kind.isPDF ||
|
||||
kind.isText ||
|
||||
kind.isJSON ||
|
||||
kind.isOffice ||
|
||||
kind.isZIP ||
|
||||
kind.isVideo ||
|
||||
kind.isAudio
|
||||
);
|
||||
return attachmentCanPreview(attachment);
|
||||
}
|
||||
|
||||
// The rich viewer's Markdown: WeKan's own +viewer, so an attached .md follows
|
||||
// every setting a card description does (code shown as text, hidden links,
|
||||
// link schemes, sanitizing).
|
||||
function renderAttachmentMarkdown(holder, text) {
|
||||
const view = Blaze.renderWithData(Template.attachmentMarkdownPreview, { text }, holder);
|
||||
return { destroy() { Blaze.remove(view); } };
|
||||
}
|
||||
|
||||
function richPreviewLabels() {
|
||||
return {
|
||||
title: TAPi18n.__('title'), start: TAPi18n.__('card-start'), end: TAPi18n.__('card-end'),
|
||||
due: TAPi18n.__('card-due'), description: TAPi18n.__('description'),
|
||||
from: TAPi18n.__('email-view-from'), to: TAPi18n.__('email-view-to'), cc: TAPi18n.__('email-view-cc'),
|
||||
subject: TAPi18n.__('email-view-subject'), date: TAPi18n.__('email-view-date'),
|
||||
attachments: TAPi18n.__('attachments'), empty: TAPi18n.__('no-results'),
|
||||
};
|
||||
}
|
||||
|
||||
function getAttachmentUrl(attachment) {
|
||||
@@ -156,10 +171,37 @@ function openAttachmentViewer(attachmentId) {
|
||||
Instructions for adding a new viewer:
|
||||
- add a new case to the switch statement below
|
||||
- implement cleanup in the closeAttachmentViewer() function, if necessary
|
||||
- mark attachment type as openable by adding a new condition to the attachmentCanBeOpened function
|
||||
- mark attachment type as openable in attachmentCanPreview (models/lib/attachmentKind.js),
|
||||
which the card, the version control view, the history table and Admin Panel / Files share
|
||||
- a file that needs a library of its own goes in client/lib/attachmentRichViewer.js,
|
||||
loaded only when such a file is opened
|
||||
*/
|
||||
const kind = attachmentKind(attachment);
|
||||
// Any other text (a .txt, a .log) is read windowed as well, only what is on
|
||||
// the screen (client/lib/attachmentWindow.js).
|
||||
const rich = attachmentRichKind(attachment) || ((kind.isText || kind.isJSON) ? 'text' : null);
|
||||
switch(true){
|
||||
case (!!rich && !kind.isImage && !kind.isVideo && !kind.isAudio && !kind.isPDF): {
|
||||
const generation = ++richPreviewGeneration;
|
||||
const container = document.getElementById('rich-viewer');
|
||||
richPreviewAbortController = new AbortController();
|
||||
const { signal } = richPreviewAbortController;
|
||||
container.classList.remove('hidden');
|
||||
container.textContent = TAPi18n.__('loading');
|
||||
import('/client/lib/attachmentRichViewer').then(({ openRichAttachment }) => openRichAttachment({
|
||||
container, rich, signal, extension: kind.extension, language: attachmentCodeLanguage(attachment),
|
||||
size: attachment.size, url: getAttachmentUrl(attachment), labels: richPreviewLabels(),
|
||||
renderMarkdown: renderAttachmentMarkdown,
|
||||
})).then(preview => {
|
||||
if (generation !== richPreviewGeneration) { preview.destroy(); return; }
|
||||
richPreview = preview;
|
||||
}).catch(error => {
|
||||
if (generation !== richPreviewGeneration || signal.aborted) return;
|
||||
container.textContent = TAPi18n.__('error');
|
||||
console.error('Could not preview attachment:', error);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case (kind.isImage):
|
||||
$("#image-viewer").attr("src", getAttachmentUrl(attachment));
|
||||
// #337: the picture is named by its file for a screen reader.
|
||||
@@ -188,11 +230,6 @@ function openAttachmentViewer(attachmentId) {
|
||||
|
||||
$("#audio-viewer").removeClass("hidden");
|
||||
break;
|
||||
case (kind.isText):
|
||||
case (kind.isJSON):
|
||||
$("#txt-viewer").attr("data", getAttachmentUrl(attachment));
|
||||
$("#txt-viewer").removeClass("hidden");
|
||||
break;
|
||||
case (kind.isZIP): {
|
||||
const container = document.getElementById('zip-viewer');
|
||||
zipPreviewAbortController = new AbortController();
|
||||
@@ -201,6 +238,10 @@ function openAttachmentViewer(attachmentId) {
|
||||
container.textContent = TAPi18n.__('loading');
|
||||
openZipAttachment({ container, signal, size: attachment.size,
|
||||
url: getAttachmentUrl(attachment), emptyMessage: TAPi18n.__('no-results') })
|
||||
.then(preview => {
|
||||
if (signal.aborted) { preview.destroy(); return; }
|
||||
zipPreview = preview;
|
||||
})
|
||||
.catch(error => {
|
||||
if (signal.aborted) return;
|
||||
container.textContent = TAPi18n.__('error');
|
||||
@@ -258,8 +299,20 @@ export function openAttachmentSlideshow(attachmentId, attachmentIds = []) {
|
||||
}
|
||||
|
||||
function closeAttachmentViewer(restoreFocus = true) {
|
||||
richPreviewGeneration++;
|
||||
richPreviewAbortController?.abort();
|
||||
richPreviewAbortController = null;
|
||||
if (richPreview) {
|
||||
richPreview.destroy();
|
||||
richPreview = null;
|
||||
}
|
||||
const richViewer = document.getElementById('rich-viewer');
|
||||
richViewer?.replaceChildren();
|
||||
richViewer?.classList.add('hidden');
|
||||
zipPreviewAbortController?.abort();
|
||||
zipPreviewAbortController = null;
|
||||
zipPreview?.destroy();
|
||||
zipPreview = null;
|
||||
const zipViewer = document.getElementById('zip-viewer');
|
||||
zipViewer?.replaceChildren();
|
||||
zipViewer?.classList.add('hidden');
|
||||
@@ -285,8 +338,6 @@ function closeAttachmentViewer(restoreFocus = true) {
|
||||
$("#pdf-viewer").attr("data", "");
|
||||
$("#pdf-viewer").addClass("hidden");
|
||||
|
||||
$("#txt-viewer").attr("data", "");
|
||||
$("#txt-viewer").addClass("hidden");
|
||||
|
||||
$("#video-viewer").get(0)?.pause(); // Stop playback
|
||||
if ($("#video-viewer").get(0)) $("#video-viewer").get(0).currentTime = 0;
|
||||
|
||||
@@ -135,7 +135,9 @@ body.desktop-mode .card-details:not(.card-details-popup):not([style*="left"]):no
|
||||
top: 8px;
|
||||
inset-inline-start: auto;
|
||||
inset-inline-end: 8px;
|
||||
width: min(520px, 90vw);
|
||||
/* #6939: the dragged width, else the Admin Panel's percentage, else 520px
|
||||
(client/lib/cardDetailsWidthMemory.js sets the property). */
|
||||
width: var(--wekan-card-details-width, min(520px, 90vw));
|
||||
bottom: 8px;
|
||||
}
|
||||
|
||||
@@ -564,8 +566,12 @@ body.card-window-dragging {
|
||||
@media screen and (min-width: 801px) {
|
||||
.card-details {
|
||||
top: 97px;
|
||||
inset-inline-start: calc(50% - (520px / 2)); /* #6465: narrower card (was 600px) */
|
||||
width: 520px;
|
||||
/* #6465: narrower card (was 600px). #6939: the remembered width, which the
|
||||
card opened as a popup (Board Table view, search results, Roadmap bar)
|
||||
takes too, centred and within the viewport. */
|
||||
inset-inline-start: max(8px, calc(50% - (var(--wekan-card-details-width, 520px) / 2)));
|
||||
width: var(--wekan-card-details-width, 520px);
|
||||
max-width: calc(100vw - 16px);
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
resize: both;
|
||||
|
||||
@@ -639,7 +639,7 @@ template(name="cardFieldSectionTime")
|
||||
h3.card-details-item-title
|
||||
| {{_ 'spent-time-hours'}}
|
||||
+cardSpentTimeMenu
|
||||
if getSpentTime
|
||||
if hasSpentOrEstimatedTime
|
||||
+cardSpentTime
|
||||
|
||||
//- #6688: the two timers each have a Board Settings / Card toggle,
|
||||
@@ -1101,6 +1101,10 @@ template(name="cardSectionHeader")
|
||||
else
|
||||
span.grid-icon
|
||||
i.fa.fa-th-large
|
||||
//- The section's ? (featureHelp.jade), at the far end of the heading and
|
||||
before the hamburger, which then follows it instead of being pushed
|
||||
to the end itself (cardDetails.css).
|
||||
+featureHelp(id=sectionHelp)
|
||||
//- A section whose settings live somewhere gets a hamburger at the far end
|
||||
of its heading, like the card's own and the minicard's. `menuClass` is the
|
||||
handler that opens them; the click must not reach the heading, or opening
|
||||
@@ -1233,6 +1237,15 @@ template(name="cardDetailsActionsPopup")
|
||||
a.js-description-action-items
|
||||
i.fa.fa-tasks
|
||||
| {{_ 'action-items-create'}}
|
||||
//- #6939: every card opens at the width it was last dragged to; this goes
|
||||
back to the default (Admin Panel / Settings / Appearance, else 520px).
|
||||
Only shown when there is a dragged width to forget.
|
||||
if hasCardDetailsWidth
|
||||
ul.pop-over-list
|
||||
li
|
||||
a.js-reset-card-details-width
|
||||
i.fa.fa-arrows-h
|
||||
| {{_ 'card-details-reset-width'}}
|
||||
hr
|
||||
ul.pop-over-list
|
||||
li.menu-group-heading {{_ 'menu-group-share'}}
|
||||
|
||||
@@ -22,11 +22,13 @@ import {
|
||||
import { canArchiveCard } from '/client/lib/archivePermission';
|
||||
import { isTextSelectionInsideCard } from '/client/lib/cardCloseGuard';
|
||||
import { placeCardDetailsX, MARGIN } from '/client/lib/cardDetailsPlacement';
|
||||
import { rememberCardDetailsWidth, hasCardDetailsWidth, resetCardDetailsWidth } from '/client/lib/cardDetailsWidthMemory';
|
||||
import { dueFromTitle } from '/client/components/forms/titleDueHint';
|
||||
import { riskOf } from '/client/lib/cardRiskOf';
|
||||
import Rules from '/models/rules';
|
||||
import { suggestedMembersFor } from '/client/lib/suggestedMembers';
|
||||
import '/client/components/cards/similarCards';
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
|
||||
// Which dependency the icon picker should apply its choice to. The icon popup's
|
||||
// own data context is the dependency row (not the source card), so we capture
|
||||
@@ -51,6 +53,7 @@ import { CARD_RECURRENCE_INTERVALS } from '/models/lib/cardRecurrenceSchedule';
|
||||
import { isHexColor, isAllowedCardColor, toHex, contrastText, customColorsInUse } from '/models/lib/contrastColor';
|
||||
import { uniqBy } from '/imports/lib/collectionHelpers';
|
||||
import { memberTargetBoardId } from '/models/lib/linkedCardMembers';
|
||||
import { cardSectionHelpId } from '/models/lib/featureHelp';
|
||||
import { isSubmitKey } from '/models/lib/editorSubmitKey';
|
||||
import { Filter } from '/client/lib/filter';
|
||||
import { BoardSwimlaneListCardDialog } from '/client/lib/dialogWithBoardSwimlaneListCard';
|
||||
@@ -528,6 +531,8 @@ Template.cardDetails.onRendered(function () {
|
||||
if ($cardDetails.length) {
|
||||
Tracker.afterFlush(() => {
|
||||
const element = $cardDetails.get(0);
|
||||
// #6939: a drag of the resize handle is remembered for the next card.
|
||||
rememberCardDetailsWidth(element);
|
||||
try {
|
||||
anchorCardDetailsX(element);
|
||||
} finally {
|
||||
@@ -556,7 +561,8 @@ Template.cardDetails.onRendered(function () {
|
||||
url: '',
|
||||
};
|
||||
|
||||
const integrations = ReactiveCache.getIntegrations({
|
||||
// None while all webhooks are turned off (the server sends nothing anyway).
|
||||
const integrations = webhooksOff() ? [] : ReactiveCache.getIntegrations({
|
||||
boardId: { $in: [card.boardId, Integrations.Const.GLOBAL_WEBHOOK_ID] },
|
||||
enabled: true,
|
||||
activities: { $in: ['CardDetailsRendered', 'all'] },
|
||||
@@ -1154,6 +1160,14 @@ Template.registerHelper('attachmentCount', function attachmentCount() {
|
||||
Template.registerHelper('sectionCaret', section =>
|
||||
caretClassFor(isCardSectionOpen(section)));
|
||||
|
||||
// The section's ? (docs/Features/General/Help-Button.md): which help it shows
|
||||
// is models/lib/featureHelp.js CARD_SECTION_HELP.
|
||||
Template.cardSectionHeader.helpers({
|
||||
sectionHelp() {
|
||||
return cardSectionHelpId(this.section);
|
||||
},
|
||||
});
|
||||
|
||||
Template.cardSectionHeader.events({
|
||||
// A hamburger at the end of a heading opens that section's settings. Neither
|
||||
// may reach the heading itself: a click there folds the section, so opening
|
||||
@@ -1918,6 +1932,10 @@ Template.inlinedCardDescription.events({
|
||||
});
|
||||
|
||||
Template.cardDetailsActionsPopup.helpers({
|
||||
// #6939: "Reset width" is offered when there is a dragged width to forget.
|
||||
hasCardDetailsWidth() {
|
||||
return hasCardDetailsWidth();
|
||||
},
|
||||
// The moving and copying items: for who may change the card, and - as they
|
||||
// always were - for a member who is not read-only.
|
||||
cardMenuWrites() {
|
||||
@@ -1969,6 +1987,11 @@ Template.cardSpentTimeMenu.events({
|
||||
});
|
||||
|
||||
Template.cardDetailsActionsPopup.events({
|
||||
'click .js-reset-card-details-width'(event) {
|
||||
event.preventDefault();
|
||||
resetCardDetailsWidth();
|
||||
Popup.back();
|
||||
},
|
||||
// docs/Features/Cards/Action-Items.md: the description's action items.
|
||||
'click .js-description-action-items': Popup.open('actionItems', { titleKey: 'action-items' }),
|
||||
// History.md §7a: adding History to a menu is a menu item and this handler,
|
||||
@@ -3365,7 +3388,9 @@ EscapeActions.register(
|
||||
: null,
|
||||
getCardDetailsElement(getCurrentCardFromContext()?._id),
|
||||
);
|
||||
if (Session.get('cardDetailsIsDragging') || selectingInsideCard) {
|
||||
// #6939: a resize of the window by its corner handle ends outside the card
|
||||
// whenever it made it wider (client/lib/cardDetailsWidthMemory.js).
|
||||
if (Session.get('cardDetailsIsDragging') || Session.get('cardDetailsIsResizing') || selectingInsideCard) {
|
||||
// Reset dragging status as the mouse landed outside the cardDetails template area and this will prevent a mousedown event from firing
|
||||
Session.set('cardDetailsIsDragging', false);
|
||||
Session.set('cardDetailsIsMouseDown', false);
|
||||
|
||||
@@ -4,6 +4,14 @@ template(name="editCardSpentTimePopup")
|
||||
.fields
|
||||
label(for="time") {{_ 'time'}}
|
||||
input.js-time-field#time(type="number" step="0.01" name="time" value="{{card.getSpentTime}}" placeholder=timeFormat autofocus)
|
||||
//- Workload (docs/Features/Workload/Workload.md): what the card is
|
||||
estimated to take; what is left is this less the time spent.
|
||||
label(for="estimated-hours") {{_ 'workload-estimated-hours'}}
|
||||
input.js-estimated-hours-field#estimated-hours(type="number" min="0" max="10000" step="0.25" name="estimatedHours" value="{{card.getEstimatedHours}}")
|
||||
//- Budget and billing: whether this card's time goes on invoices.
|
||||
label(for="billable") {{_ 'billing-billable'}}
|
||||
a.js-toggle-billable
|
||||
.materialCheckBox#billable(class="{{#if billable}}is-checked{{/if}}" name="billable")
|
||||
label(for="overtime") {{_ 'overtime'}}
|
||||
a.js-toggle-overtime
|
||||
.materialCheckBox#overtime(class="{{#if getIsOvertime}}is-checked{{/if}}" name="overtime")
|
||||
@@ -13,11 +21,62 @@ template(name="editCardSpentTimePopup")
|
||||
button.primary.wide.left.js-submit-time(type="submit") {{_ 'save'}}
|
||||
button.js-delete-time.negate.wide.right {{_ 'delete'}}
|
||||
|
||||
+cardTimeEntries(cardId=card._id)
|
||||
|
||||
//- The card's time by day (server/timeEntries.js): log time on a day, and see
|
||||
who logged what. Changing the total above is recorded as an entry too.
|
||||
template(name="cardTimeEntries")
|
||||
.card-time-entries
|
||||
h4 {{_ 'time-entries'}}
|
||||
form.js-time-entry-add
|
||||
label(for="time-entry-date") {{_ 'date'}}
|
||||
input#time-entry-date(type="date" name="date" value=today required)
|
||||
label(for="time-entry-hours") {{_ 'hours'}}
|
||||
input#time-entry-hours(type="number" name="hours" min="0.01" max="1000" step="0.25" required)
|
||||
label(for="time-entry-note") {{_ 'workload-note'}}
|
||||
input#time-entry-note(type="text" name="note" maxlength="500")
|
||||
button.primary(type="submit") {{_ 'time-entry-log'}}
|
||||
if entryError
|
||||
.warning {{entryError}}
|
||||
if entries.length
|
||||
ul.time-entry-list
|
||||
each entry in entries
|
||||
li(class="{{#if entry.invoiced}}is-invoiced{{/if}}")
|
||||
span.time-entry-date
|
||||
if entry.date
|
||||
| {{entry.date}}
|
||||
else
|
||||
| {{_ 'time-entry-undated'}}
|
||||
span.time-entry-hours {{entry.hours}} {{_ 'workload-hours-short'}}
|
||||
if entry.name
|
||||
span.time-entry-who {{entry.name}}
|
||||
if entry.note
|
||||
span.time-entry-note {{entry.note}}
|
||||
if $eq entry.approval 'approved'
|
||||
span.time-entry-approved(title="{{_ 'time-entry-approved'}}" aria-label="{{_ 'time-entry-approved'}}")
|
||||
i.fa.fa-check
|
||||
if $eq entry.approval 'rejected'
|
||||
span.time-entry-rejected(title="{{_ 'time-entry-rejected'}}")
|
||||
i.fa.fa-undo
|
||||
| {{_ 'time-entry-rejected'}}
|
||||
if entry.approvalNote
|
||||
| : {{entry.approvalNote}}
|
||||
if entry.invoiced
|
||||
span.time-entry-invoiced(title="{{_ 'time-entry-invoiced'}}")
|
||||
i.fa.fa-file-text-o
|
||||
else unless $eq entry.approval 'approved'
|
||||
if entry.mine
|
||||
a.js-time-entry-remove(data-id=entry._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
|
||||
template(name="cardSpentTime")
|
||||
if canModifyCard
|
||||
a.js-edit-time.card-time(title="{{_ 'time'}}" class="{{#if getIsOvertime}}card-label-red{{else}}card-label-green{{/if}}")
|
||||
i.fa.fa-clock-o
|
||||
| {{showTime}}
|
||||
if showEstimate
|
||||
span.card-time-estimate(title="{{_ 'workload-estimated-hours'}}")
|
||||
| / {{showEstimate}}
|
||||
else
|
||||
a.card-time(title="{{_ 'time'}}" class="{{#if getIsOvertime}}card-label-red{{else}}card-label-green{{/if}}")
|
||||
i.fa.fa-clock-o
|
||||
|
||||
@@ -13,6 +13,7 @@ Template.editCardSpentTimePopup.onCreated(function () {
|
||||
this.error = new ReactiveVar('');
|
||||
this.card = Cards.findOne(getCardId());
|
||||
this.overtime = new ReactiveVar(this.card?.getIsOvertime() || false);
|
||||
this.billable = new ReactiveVar(!this.card || typeof this.card.isBillable !== 'function' || this.card.isBillable());
|
||||
});
|
||||
|
||||
Template.editCardSpentTimePopup.helpers({
|
||||
@@ -25,6 +26,9 @@ Template.editCardSpentTimePopup.helpers({
|
||||
getIsOvertime() {
|
||||
return Template.instance().overtime.get();
|
||||
},
|
||||
billable() {
|
||||
return Template.instance().billable.get();
|
||||
},
|
||||
});
|
||||
|
||||
Template.editCardSpentTimePopup.events({
|
||||
@@ -36,9 +40,25 @@ Template.editCardSpentTimePopup.events({
|
||||
|
||||
const spentTime = parseFloat(evt.target.time.value);
|
||||
const isOvertime = tpl.overtime.get();
|
||||
const estimateText = evt.target.estimatedHours ? String(evt.target.estimatedHours.value).trim() : '';
|
||||
const estimatedHours = estimateText === '' ? null : parseFloat(estimateText);
|
||||
if (estimatedHours !== null && !(estimatedHours >= 0 && estimatedHours <= 10000)) {
|
||||
tpl.error.set('workload-invalid-estimate');
|
||||
evt.target.estimatedHours.focus();
|
||||
return;
|
||||
}
|
||||
if (spentTime >= 0) {
|
||||
card.setSpentTime(spentTime);
|
||||
card.setIsOvertime(isOvertime);
|
||||
const currentEstimate = typeof card.getEstimatedHours === 'function' ? card.getEstimatedHours() : null;
|
||||
if (typeof card.setBillable === 'function' && tpl.billable
|
||||
&& tpl.billable.get() !== (typeof card.isBillable === 'function' ? card.isBillable() : true)) {
|
||||
card.setBillable(tpl.billable.get());
|
||||
}
|
||||
if (typeof card.setEstimatedHours === 'function'
|
||||
&& estimatedHours !== (typeof currentEstimate === 'number' ? currentEstimate : null)) {
|
||||
card.setEstimatedHours(estimatedHours);
|
||||
}
|
||||
backIfOwnPopup(evt, 'editCardSpentTimePopup');
|
||||
} else {
|
||||
tpl.error.set('invalid-time');
|
||||
@@ -57,6 +77,10 @@ Template.editCardSpentTimePopup.events({
|
||||
evt.preventDefault();
|
||||
tpl.overtime.set(!tpl.overtime.get());
|
||||
},
|
||||
'click a.js-toggle-billable'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.billable.set(!tpl.billable.get());
|
||||
},
|
||||
});
|
||||
|
||||
Template.cardSpentTime.helpers({
|
||||
@@ -77,6 +101,12 @@ Template.cardSpentTime.helpers({
|
||||
const card = Cards.findOne(this._id) || this;
|
||||
return card.getSpentTime ? formatSpentTime(card.getSpentTime()) : '';
|
||||
},
|
||||
// Workload: the estimate beside the time spent, "1h 30m / 4h".
|
||||
showEstimate() {
|
||||
const card = Cards.findOne(this._id) || this;
|
||||
const hours = card.getEstimatedHours ? card.getEstimatedHours() : null;
|
||||
return typeof hours === 'number' && hours > 0 ? formatSpentTime(hours) : '';
|
||||
},
|
||||
getIsOvertime() {
|
||||
const card = Cards.findOne(this._id) || this;
|
||||
return card.getIsOvertime ? card.getIsOvertime() : false;
|
||||
@@ -86,3 +116,46 @@ Template.cardSpentTime.helpers({
|
||||
Template.cardSpentTime.events({
|
||||
'click .js-edit-time': Popup.open('editCardSpentTime'),
|
||||
});
|
||||
|
||||
// The card's time by day (server/timeEntries.js).
|
||||
Template.cardTimeEntries.onCreated(function () {
|
||||
this.entries = new ReactiveVar([]);
|
||||
this.error = new ReactiveVar('');
|
||||
this.load = () => {
|
||||
const { cardId } = Template.currentData() || {};
|
||||
if (!cardId) return Promise.resolve();
|
||||
return Meteor.callAsync('timeEntriesOfCard', cardId)
|
||||
.then(result => { this.entries.set(result.entries); this.error.set(''); })
|
||||
.catch(error => this.error.set((error && (error.reason || error.message)) || String(error)));
|
||||
};
|
||||
this.autorun(() => {
|
||||
const card = Cards.findOne((Template.currentData() || {}).cardId);
|
||||
// Reload when the card's total changes (a timer, the field above).
|
||||
if (card) card.spentTime; // eslint-disable-line no-unused-expressions
|
||||
this.load();
|
||||
});
|
||||
});
|
||||
|
||||
Template.cardTimeEntries.helpers({
|
||||
entries: () => Template.instance().entries.get(),
|
||||
entryError: () => Template.instance().error.get(),
|
||||
today: () => new Date().toISOString().slice(0, 10),
|
||||
});
|
||||
|
||||
Template.cardTimeEntries.events({
|
||||
'submit .js-time-entry-add'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const entry = { date: form.elements.date.value, hours: parseFloat(form.elements.hours.value) };
|
||||
if (form.elements.note.value.trim()) entry.note = form.elements.note.value.trim();
|
||||
Meteor.callAsync('timeEntryAdd', Template.currentData().cardId, entry)
|
||||
.then(() => { form.elements.hours.value = ''; form.elements.note.value = ''; return tpl.load(); })
|
||||
.catch(error => tpl.error.set((error && (error.reason || error.message)) || String(error)));
|
||||
},
|
||||
'click .js-time-entry-remove'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
Meteor.callAsync('timeEntryRemove', evt.currentTarget.getAttribute('data-id'))
|
||||
.then(() => tpl.load())
|
||||
.catch(error => tpl.error.set((error && (error.reason || error.message)) || String(error)));
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,118 @@
|
||||
/* Cloud Panel (docs/Features/Admin-Panel/Cloud-Panel.md). The layout is the
|
||||
Admin Panel's (.setting-content, the left menu, the table page); only the
|
||||
panel's own forms, the plan, the Caddyfile and the chat are styled here. */
|
||||
.cloud-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 40em;
|
||||
gap: 0.3em;
|
||||
}
|
||||
.cloud-form .billing-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
}
|
||||
.cloud-database {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3em;
|
||||
}
|
||||
.cloud-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5em;
|
||||
margin-block: 0.8em;
|
||||
}
|
||||
.cloud-caddyfile {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
background: #f5f5f5;
|
||||
padding: 0.8em;
|
||||
}
|
||||
.cloud-plan .cloud-plan-create {
|
||||
color: #2e7d32;
|
||||
}
|
||||
.cloud-plan .cloud-plan-update {
|
||||
color: #8a6d00;
|
||||
}
|
||||
.cloud-chat-messages {
|
||||
list-style: none;
|
||||
padding-inline-start: 0;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.cloud-chat-messages li {
|
||||
margin-block-end: 0.6em;
|
||||
}
|
||||
.cloud-chat-messages li.is-mine {
|
||||
text-align: end;
|
||||
}
|
||||
.cloud-chat-who {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cloud-chat-text {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.cloud-invoice-void td {
|
||||
text-decoration: line-through;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
/* Labelled native checkboxes: the app-wide material form rule
|
||||
(client/components/forms/forms.css) hides native checkboxes three ways -
|
||||
display, visibility, an offset - which left these with a label and no box
|
||||
to tick or see ticked. All three are undone, as in cardFlow.css. */
|
||||
.cloud-panel input[type="checkbox"] {
|
||||
display: inline-block;
|
||||
visibility: visible;
|
||||
position: static;
|
||||
inset-inline-start: auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
margin-inline-end: 4px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
/* Support tickets: the support board's Open / In progress / Done lists, side
|
||||
by side as Board View / Lists draws a board, wrapping on a narrow screen. */
|
||||
.cloud-ticket-columns {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.8em;
|
||||
align-items: flex-start;
|
||||
margin-block: 0.8em;
|
||||
}
|
||||
.cloud-ticket-column {
|
||||
flex: 1 1 14em;
|
||||
min-width: 0;
|
||||
max-width: 24em;
|
||||
background: #e8e8e8;
|
||||
border-radius: 4px;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.cloud-ticket-column-title {
|
||||
font-size: 1em;
|
||||
margin: 0 0 0.5em;
|
||||
}
|
||||
.cloud-ticket {
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
padding: 0.5em;
|
||||
margin-block-end: 0.5em;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.cloud-ticket-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cloud-ticket-description {
|
||||
white-space: pre-wrap;
|
||||
margin-block: 0.3em;
|
||||
}
|
||||
.cloud-info th {
|
||||
text-align: start;
|
||||
padding-inline-end: 1em;
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
//- Cloud Panel (docs/Features/Admin-Panel/Cloud-Panel.md): only where the server
|
||||
has the CLOUD environment variable, at that address. Admin Panel / Cloud is the
|
||||
Cloud Admins' Domains, Invoices, Tickets, Chat, Cloudflare, Caddy and Allowed
|
||||
addresses; /cloud is a customer's own domain, Invoices, Tickets and Chat. The
|
||||
server decides who sees what (server/cloudPanel.js); this page draws what it
|
||||
is given.
|
||||
|
||||
template(name="cloudPanel")
|
||||
.setting-content.cloud-panel
|
||||
if loading
|
||||
+spinner
|
||||
else if notAllowed
|
||||
p.quiet {{_ 'cloud-admin-not-allowed'}}
|
||||
else
|
||||
.content-body
|
||||
+leftMenu(menuItems)
|
||||
.main-body
|
||||
+paneTitle(paneTitleData)
|
||||
if actionError
|
||||
.warning {{actionError}}
|
||||
if $eq pane 'cloudflare'
|
||||
+cloudPanelCloudflare(config=config reload=reload)
|
||||
else if $eq pane 'caddy'
|
||||
+cloudPanelCaddy(config=config reload=reload)
|
||||
else if $eq pane 'allowed-addresses'
|
||||
+cloudPanelAllowedAddresses(config=config reload=reload)
|
||||
else if $eq pane 'domains'
|
||||
+cloudPanelDomains
|
||||
else if $eq pane 'info'
|
||||
+cloudPanelInfo(domains=info.domains)
|
||||
else if $eq pane 'invoices'
|
||||
+cloudPanelInvoices(domains=info.domains isCloudAdmin=info.isCloudAdmin)
|
||||
else if $eq pane 'tickets'
|
||||
+cloudPanelTickets(domains=info.domains isCloudAdmin=info.isCloudAdmin)
|
||||
else if $eq pane 'chat'
|
||||
+cloudPanelChat(domains=info.domains isCloudAdmin=info.isCloudAdmin)
|
||||
|
||||
template(name="cloudPanelCloudflare")
|
||||
form.js-cloud-cloudflare.cloud-form
|
||||
p.quiet {{_ 'cloudflare-api-key-desc'}}
|
||||
label(for="cloud-cf-token") {{_ 'cloudflare-api-key'}}
|
||||
input#cloud-cf-token(type="password" name="apiToken" autocomplete="off")
|
||||
if config.cloudflare.hasToken
|
||||
p.quiet {{_ 'cloudflare-api-key-set'}}
|
||||
else
|
||||
p.quiet {{_ 'cloudflare-api-key-not-set'}}
|
||||
label(for="cloud-cf-zone") {{_ 'cloud-panel-cloudflare-zone'}}
|
||||
input#cloud-cf-zone(type="text" name="zoneId" maxlength="32" value=config.cloudflare.zoneId)
|
||||
label(for="cloud-cf-target") {{_ 'cloud-panel-cloudflare-target'}}
|
||||
input#cloud-cf-target(type="text" name="target" maxlength="253" value=config.cloudflare.target placeholder="203.0.113.10")
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="proxied" checked=config.cloudflare.proxied)
|
||||
| {{_ 'cloud-panel-cloudflare-proxied'}}
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
.cloud-actions
|
||||
button.js-cloud-dns-plan(type="button") {{_ 'cloud-panel-dns-check'}}
|
||||
if plan
|
||||
button.primary.js-cloud-dns-apply(type="button") {{_ 'cloud-panel-dns-apply'}}
|
||||
if plan
|
||||
ul.cloud-plan
|
||||
each record in plan.create
|
||||
li.cloud-plan-create + {{record.type}} {{record.name}} → {{record.content}}
|
||||
each record in plan.update
|
||||
li.cloud-plan-update ~ {{record.type}} {{record.name}} → {{record.content}}
|
||||
each record in plan.conflicts
|
||||
li.warning {{_ 'cloud-panel-dns-conflict' name=record.name type=record.type}}
|
||||
each name in plan.unchanged
|
||||
li.quiet {{name}}
|
||||
|
||||
template(name="cloudPanelCaddy")
|
||||
form.js-cloud-caddy.cloud-form
|
||||
p.quiet {{_ 'cloud-panel-caddy-intro'}}
|
||||
label(for="cloud-caddy-admin") {{_ 'cloud-panel-caddy-admin'}}
|
||||
input#cloud-caddy-admin(type="text" name="adminUrl" maxlength="200" value=config.caddy.adminUrl placeholder="http://caddy:2019")
|
||||
label(for="cloud-caddy-upstream") {{_ 'cloud-panel-caddy-upstream'}}
|
||||
input#cloud-caddy-upstream(type="text" name="sharedUpstream" maxlength="260" value=config.caddy.sharedUpstream placeholder="wekan:8080")
|
||||
label(for="cloud-caddy-email") {{_ 'email'}}
|
||||
input#cloud-caddy-email(type="text" name="email" maxlength="200" value=config.caddy.email)
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
.cloud-actions
|
||||
button.js-cloud-caddyfile(type="button") {{_ 'cloud-panel-caddy-show'}}
|
||||
button.primary.js-cloud-caddy-push(type="button") {{_ 'cloud-panel-caddy-push'}}
|
||||
if pushed
|
||||
span.quiet {{_ 'cloud-panel-caddy-pushed'}}
|
||||
if caddyfile
|
||||
pre.cloud-caddyfile {{caddyfile}}
|
||||
|
||||
template(name="cloudPanelDomains")
|
||||
+tablePage(tablePageData)
|
||||
if editing
|
||||
+cloudPanelDomainForm(domain=editing close=close)
|
||||
if report
|
||||
.cloud-report
|
||||
h3 {{_ 'cloud-panel-import-report'}}
|
||||
p {{_ 'cloud-panel-import-users' created=report.users.created matched=report.users.matched}}
|
||||
ul
|
||||
each item in reportCollections
|
||||
li {{item.name}}: {{item.copied}} (+{{item.skipped}})
|
||||
if report.files
|
||||
p.warning {{_ 'cloud-panel-import-files' count=report.files}}
|
||||
if reportIsDryRun
|
||||
button.primary.js-cloud-import-now(type="button" data-id=reportDomainId) {{_ 'cloud-panel-import-now'}}
|
||||
|
||||
template(name="cloudPanelDomainNew")
|
||||
a.js-cloud-domain-new(title="{{_ 'cloud-panel-domain-new'}}")
|
||||
i.fa.fa-plus
|
||||
| {{_ 'domain'}}
|
||||
|
||||
template(name="cloudPanelDomainRow")
|
||||
tr(class="cloud-domain-{{domain.mode}}")
|
||||
td {{domain.domain}}
|
||||
td {{domain.customerName}}
|
||||
td {{domain.customerEmail}}
|
||||
td {{domain.startDate}}
|
||||
td {{domain.endDate}}
|
||||
td
|
||||
if $eq domain.mode 'shared'
|
||||
| {{_ 'cloud-panel-mode-shared'}}
|
||||
else
|
||||
| {{_ 'cloud-panel-mode-own'}}
|
||||
td {{databaseLabel domain.database}}
|
||||
td
|
||||
button.js-cloud-domain-edit(type="button" data-id=domain._id) {{_ 'edit'}}
|
||||
if domain.database
|
||||
button.js-cloud-domain-test(type="button" data-id=domain._id) {{_ 'cloud-panel-test'}}
|
||||
if $eq domain.mode 'own'
|
||||
button.js-cloud-domain-import(type="button" data-id=domain._id) {{_ 'cloud-panel-import'}}
|
||||
if tested
|
||||
span.quiet {{tested}}
|
||||
|
||||
template(name="cloudPanelDomainForm")
|
||||
form.js-cloud-domain.cloud-form
|
||||
label(for="cloud-domain-domain") {{_ 'domain'}}
|
||||
input#cloud-domain-domain(type="text" name="domain" maxlength="253" value=domain.domain placeholder="customer1.example.com" required)
|
||||
label(for="cloud-domain-customer") {{_ 'cloud-customer-name'}}
|
||||
input#cloud-domain-customer(type="text" name="customerName" maxlength="200" value=domain.customerName)
|
||||
label(for="cloud-domain-email") {{_ 'cloud-customer-email'}}
|
||||
input#cloud-domain-email(type="email" name="customerEmail" maxlength="254" value=domain.customerEmail)
|
||||
label(for="cloud-domain-billing") {{_ 'cloud-billing-email'}}
|
||||
input#cloud-domain-billing(type="email" name="billingEmail" maxlength="254" value=domain.billingEmail)
|
||||
label(for="cloud-domain-start") {{_ 'cloud-start-date'}}
|
||||
input#cloud-domain-start(type="date" name="startDate" value=domain.startDate)
|
||||
label(for="cloud-domain-end") {{_ 'cloud-end-date'}}
|
||||
input#cloud-domain-end(type="date" name="endDate" value=domain.endDate)
|
||||
label(for="cloud-domain-mode") {{_ 'cloud-panel-mode'}}
|
||||
select#cloud-domain-mode(name="mode")
|
||||
option(value="own" selected="{{#if $eq domain.mode 'own'}}selected{{/if}}") {{_ 'cloud-panel-mode-own'}}
|
||||
option(value="shared" selected="{{#if $eq domain.mode 'shared'}}selected{{/if}}") {{_ 'cloud-panel-mode-shared'}}
|
||||
label(for="cloud-domain-upstream") {{_ 'cloud-panel-upstream'}}
|
||||
input#cloud-domain-upstream(type="text" name="upstream" maxlength="260" value=domain.upstream placeholder="wekan-customer1:8080")
|
||||
fieldset.cloud-database
|
||||
legend {{_ 'cloud-panel-database'}}
|
||||
label(for="cloud-db-uri") {{_ 'cloud-panel-database-uri'}}
|
||||
input#cloud-db-uri(type="text" name="uri" maxlength="2000" value=domain.database.uri placeholder="mongodb://…")
|
||||
label(for="cloud-db-host") {{_ 'cloud-panel-database-host'}}
|
||||
input#cloud-db-host(type="text" name="host" maxlength="253" value=domain.database.host placeholder="mongodb")
|
||||
label(for="cloud-db-port") {{_ 'cloud-panel-database-port'}}
|
||||
input#cloud-db-port(type="number" name="port" min="1" max="65535" value=domain.database.port placeholder="27017")
|
||||
label(for="cloud-db-name") {{_ 'cloud-panel-database-name'}}
|
||||
input#cloud-db-name(type="text" name="database" maxlength="64" value=domain.database.database placeholder="wekan")
|
||||
label(for="cloud-db-user") {{_ 'username'}}
|
||||
input#cloud-db-user(type="text" name="username" maxlength="200" value=domain.database.username autocomplete="off")
|
||||
label(for="cloud-db-password") {{_ 'password'}}
|
||||
input#cloud-db-password(type="password" name="password" maxlength="500" autocomplete="new-password" placeholder="{{#if domain.database.hasPassword}}••••••••{{/if}}")
|
||||
label(for="cloud-db-authsource") {{_ 'cloud-panel-database-auth-source'}}
|
||||
input#cloud-db-authsource(type="text" name="authSource" maxlength="64" value=domain.database.authSource placeholder="admin")
|
||||
label(for="cloud-db-replicaset") {{_ 'cloud-panel-database-replica-set'}}
|
||||
input#cloud-db-replicaset(type="text" name="replicaSet" maxlength="64" value=domain.database.replicaSet placeholder="rs0")
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="tls" checked=domain.database.tls)
|
||||
| TLS
|
||||
label(for="cloud-domain-customers") {{_ 'cloud-panel-customers'}}
|
||||
input#cloud-domain-customers(type="text" name="customerUsernames" maxlength="2000" value=customers placeholder="customer1, customer2")
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="cloudflare" checked=cloudflareOn)
|
||||
| {{_ 'cloud-panel-domain-cloudflare'}}
|
||||
label(for="cloud-domain-notes") {{_ 'workload-note'}}
|
||||
textarea#cloud-domain-notes(name="notes" maxlength="2000" rows="2") {{domain.notes}}
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
button.js-cloud-domain-close(type="button") {{_ 'close'}}
|
||||
if domain._id
|
||||
button.js-cloud-domain-remove(type="button" data-id=domain._id) {{_ 'delete'}}
|
||||
|
||||
template(name="cloudPanelInvoices")
|
||||
.cloud-invoices
|
||||
if isCloudAdmin
|
||||
form.js-cloud-invoice.cloud-form
|
||||
label(for="cloud-invoice-domain") {{_ 'domain'}}
|
||||
select#cloud-invoice-domain(name="domainId" required)
|
||||
each domain in allDomains
|
||||
option(value=domain._id) {{domain.domain}}
|
||||
label(for="cloud-invoice-number") {{_ 'billing-number'}}
|
||||
input#cloud-invoice-number(type="text" name="number" maxlength="50" required)
|
||||
label(for="cloud-invoice-issue") {{_ 'billing-issue-date'}}
|
||||
input#cloud-invoice-issue(type="date" name="issueDate" required)
|
||||
label(for="cloud-invoice-due") {{_ 'billing-due-date'}}
|
||||
input#cloud-invoice-due(type="date" name="dueDate")
|
||||
label(for="cloud-invoice-amount") {{_ 'billing-total'}}
|
||||
input#cloud-invoice-amount(type="number" name="amount" min="0" step="0.01" required)
|
||||
label(for="cloud-invoice-currency") {{_ 'billing-currency'}}
|
||||
input#cloud-invoice-currency(type="text" name="currency" maxlength="3" value="EUR" required)
|
||||
label(for="cloud-invoice-status") {{_ 'billing-status'}}
|
||||
select#cloud-invoice-status(name="status")
|
||||
option(value="open") {{_ 'cloud-panel-invoice-open'}}
|
||||
option(value="paid") {{_ 'billing-status-paid'}}
|
||||
option(value="void") {{_ 'billing-status-void'}}
|
||||
label(for="cloud-invoice-paid") {{_ 'cloud-panel-paid-on'}}
|
||||
input#cloud-invoice-paid(type="date" name="paidDate")
|
||||
label(for="cloud-invoice-description") {{_ 'description'}}
|
||||
input#cloud-invoice-description(type="text" name="description" maxlength="1000")
|
||||
label(for="cloud-invoice-link") {{_ 'cloud-panel-invoice-link'}}
|
||||
input#cloud-invoice-link(type="url" name="link" maxlength="500" placeholder="https://")
|
||||
button.primary(type="submit") {{_ 'cloud-panel-add-invoice'}}
|
||||
if invoices.length
|
||||
.billing-table-wrapper
|
||||
table.cloud-invoice-table
|
||||
thead
|
||||
tr
|
||||
th {{_ 'domain'}}
|
||||
th {{_ 'billing-number'}}
|
||||
th {{_ 'billing-issue-date'}}
|
||||
th {{_ 'billing-due-date'}}
|
||||
th {{_ 'billing-total'}}
|
||||
th {{_ 'billing-status'}}
|
||||
th {{_ 'cloud-panel-paid-on'}}
|
||||
th
|
||||
tbody
|
||||
each invoice in invoices
|
||||
tr(class="cloud-invoice-{{invoice.status}}")
|
||||
td {{invoice.domain}}
|
||||
td
|
||||
if invoice.link
|
||||
a(href=invoice.link target="_blank" rel="noopener noreferrer") {{invoice.number}}
|
||||
else
|
||||
| {{invoice.number}}
|
||||
if invoice.description
|
||||
.quiet {{invoice.description}}
|
||||
td {{invoice.issueDate}}
|
||||
td {{invoice.dueDate}}
|
||||
td {{money invoice.amountMinor invoice.currency}}
|
||||
td {{statusLabel invoice.status}}
|
||||
td {{invoice.paidDate}}
|
||||
td
|
||||
if isCloudAdmin
|
||||
a.js-cloud-invoice-remove(data-id=invoice._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
else
|
||||
p {{_ 'billing-no-invoices'}}
|
||||
|
||||
template(name="cloudPanelChat")
|
||||
.cloud-chat
|
||||
label(for="cloud-chat-domain") {{_ 'domain'}}
|
||||
select#cloud-chat-domain.js-cloud-chat-domain
|
||||
each domain in chatDomains
|
||||
option(value=domain._id selected="{{#if $eq domain._id domainId}}selected{{/if}}") {{domain.domain}}
|
||||
if domainId
|
||||
ul.cloud-chat-messages
|
||||
each message in messages
|
||||
li(class="{{#if message.mine}}is-mine{{/if}}")
|
||||
span.cloud-chat-who {{message.authorName}}
|
||||
if message.room
|
||||
span.quiet · {{message.room}}
|
||||
span.quiet · {{when message.at}}
|
||||
.cloud-chat-text {{message.text}}
|
||||
unless messages.length
|
||||
li.quiet {{_ 'cloud-panel-chat-empty'}}
|
||||
form.js-cloud-chat-send
|
||||
textarea(name="text" maxlength="20000" rows="2" aria-label="{{_ 'cloud-panel-chat-message'}}" required)
|
||||
button.primary(type="submit") {{_ 'cloud-panel-chat-send'}}
|
||||
if boardPath
|
||||
p
|
||||
a.js-cloud-support-board(href=boardPath) {{_ 'cloud-support-board-open'}}
|
||||
if isCloudAdmin
|
||||
form.js-cloud-chat-import.cloud-form
|
||||
label(for="cloud-chat-source") {{_ 'cloud-panel-chat-import'}}
|
||||
select#cloud-chat-source(name="source")
|
||||
option(value="rocketchat") Rocket.Chat (.zip)
|
||||
option(value="sandchat") Sandstorm SandChat (.zip)
|
||||
input(type="file" name="file" accept=".zip" aria-label="{{_ 'cloud-panel-chat-import'}}" required)
|
||||
button(type="submit") {{_ 'import'}}
|
||||
if imported
|
||||
span.quiet {{_ 'cloud-panel-chat-imported' count=imported}}
|
||||
|
||||
//- Admin Panel / Cloud / Allowed addresses (models/lib/cloudAddresses.js): the
|
||||
server refuses a list without the Cloud Admin's own address, and the page
|
||||
says so before it is sent.
|
||||
template(name="cloudPanelAllowedAddresses")
|
||||
form.js-cloud-addresses.cloud-form
|
||||
p.quiet {{_ 'cloud-allowed-addresses-desc'}}
|
||||
label(for="cloud-addresses") {{_ 'cloud-allowed-addresses'}}
|
||||
textarea#cloud-addresses.js-cloud-addresses-text(name="addresses" rows="6" maxlength="12000" placeholder="203.0.113.0/24, 2001:db8::/32") {{addressesText}}
|
||||
p.quiet.js-cloud-your-address {{_ 'cloud-allowed-addresses-yours' address=config.yourAddress}}
|
||||
if lockout
|
||||
.warning.js-cloud-addresses-lockout {{_ 'cloud-allowed-addresses-lockout' address=config.yourAddress}}
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
if saved
|
||||
span.quiet {{_ 'cloud-saved'}}
|
||||
|
||||
//- A customer's own domain: what the hosting is.
|
||||
template(name="cloudPanelInfo")
|
||||
each domain in domains
|
||||
table.cloud-info
|
||||
tbody
|
||||
tr
|
||||
th {{_ 'domain'}}
|
||||
td {{domain.domain}}
|
||||
tr
|
||||
th {{_ 'cloud-customer-name'}}
|
||||
td {{domain.customerName}}
|
||||
tr
|
||||
th {{_ 'cloud-start-date'}}
|
||||
td {{domain.startDate}}
|
||||
tr
|
||||
th {{_ 'cloud-end-date'}}
|
||||
td {{domain.endDate}}
|
||||
tr
|
||||
th {{_ 'cloud-panel-mode'}}
|
||||
td
|
||||
if $eq domain.mode 'shared'
|
||||
| {{_ 'cloud-panel-mode-shared'}}
|
||||
else
|
||||
| {{_ 'cloud-panel-mode-own'}}
|
||||
|
||||
//- Support tickets: the cards of the domain's support board, in its Open, In
|
||||
progress and Done lists, drawn the way Board View / Lists draws a board.
|
||||
template(name="cloudPanelTickets")
|
||||
.cloud-tickets
|
||||
label(for="cloud-tickets-domain") {{_ 'domain'}}
|
||||
select#cloud-tickets-domain.js-cloud-tickets-domain
|
||||
each domain in ticketDomains
|
||||
option(value=domain._id selected="{{#if $eq domain._id domainId}}selected{{/if}}") {{domain.domain}}
|
||||
if board
|
||||
.cloud-ticket-columns
|
||||
each column in board.columns
|
||||
.cloud-ticket-column(class="cloud-ticket-{{column.key}}" data-state=column.key)
|
||||
h3.cloud-ticket-column-title {{columnTitle column.key}}
|
||||
each card in column.cards
|
||||
.cloud-ticket
|
||||
.cloud-ticket-title {{card.title}}
|
||||
if card.description
|
||||
.cloud-ticket-description {{card.description}}
|
||||
.quiet {{card.author}} · {{when card.createdAt}}
|
||||
if isCloudAdmin
|
||||
select.js-cloud-ticket-move(data-id=card._id aria-label="{{_ 'tickets'}}")
|
||||
each state in states
|
||||
option(value=state selected="{{#if $eq state column.key}}selected{{/if}}") {{columnTitle state}}
|
||||
form.js-cloud-ticket-add.cloud-form
|
||||
label(for="cloud-ticket-title") {{_ 'title'}}
|
||||
input#cloud-ticket-title(type="text" name="title" maxlength="500" required)
|
||||
label(for="cloud-ticket-description") {{_ 'description'}}
|
||||
textarea#cloud-ticket-description(name="description" maxlength="20000" rows="3")
|
||||
button.primary(type="submit") {{_ 'cloud-ticket-add'}}
|
||||
p
|
||||
a.js-cloud-support-board(href=boardPath) {{_ 'cloud-support-board-open'}}
|
||||
@@ -0,0 +1,580 @@
|
||||
// Cloud Panel page (docs/Features/Admin-Panel/Cloud-Panel.md). Everything is
|
||||
// read and written through the cloudPanel* methods of server/cloudPanel.js,
|
||||
// which also decide who may see what; nothing is subscribed.
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Session } from 'meteor/session';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { leftMenuData, paneTitle } from '/models/lib/leftMenu';
|
||||
import { buildHeader, pageInfo, TABLE_PAGE_ROWS_PER_PAGE } from '/models/lib/tablePage';
|
||||
const { formatMoney } = require('/models/lib/billing');
|
||||
const { TICKET_STATES, SUPPORT_LISTS } = require('/models/lib/cloudPanel');
|
||||
const { normalizeAllowedAddresses, addressAllowed } = require('/models/lib/cloudAddresses');
|
||||
|
||||
function errorText(error) {
|
||||
return error ? (error.reason || error.message || String(error)) : '';
|
||||
}
|
||||
|
||||
function language() {
|
||||
try { return TAPi18n.getLanguage ? TAPi18n.getLanguage() : undefined; } catch (e) { return undefined; }
|
||||
}
|
||||
|
||||
function field(form, name) {
|
||||
const el = form.elements[name];
|
||||
return el ? String(el.value).trim() : '';
|
||||
}
|
||||
|
||||
function list(value) {
|
||||
return String(value || '').split(/[\s,;]+/).map(s => s.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
// Every pane reports through this one place, shown above the pane. It is a
|
||||
// module value, not a function handed down in a data context: Spacebars calls
|
||||
// a function it finds in a data context when it passes it on, so `done=done`
|
||||
// called done() with nothing and the domain form never rendered.
|
||||
const panelError = new ReactiveVar('');
|
||||
function report(promise) {
|
||||
return promise.then(result => { panelError.set(''); return result; })
|
||||
.catch(error => { panelError.set(errorText(error)); });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- the page
|
||||
|
||||
// Admin Panel / Cloud, for a Cloud Admin; /cloud shows a customer their own.
|
||||
const ADMIN_MENU = [
|
||||
{ id: 'domains', icon: 'fa-globe', labelKey: 'domains' },
|
||||
{ id: 'invoices', icon: 'fa-file-text-o', labelKey: 'billing-invoices' },
|
||||
{ id: 'tickets', icon: 'fa-ticket', labelKey: 'tickets' },
|
||||
{ id: 'chat', icon: 'fa-comments', labelKey: 'board-view-chat' },
|
||||
{ id: 'cloudflare', icon: 'fa-cloud', label: 'Cloudflare' },
|
||||
{ id: 'caddy', icon: 'fa-server', label: 'Caddy' },
|
||||
{ id: 'allowed-addresses', icon: 'fa-shield', labelKey: 'cloud-allowed-addresses' },
|
||||
];
|
||||
const CUSTOMER_MENU = [
|
||||
{ id: 'info', icon: 'fa-info-circle', labelKey: 'info' },
|
||||
...ADMIN_MENU.filter(item => ['invoices', 'tickets', 'chat'].includes(item.id)),
|
||||
];
|
||||
|
||||
function menu(info) {
|
||||
return info.isCloudAdmin ? ADMIN_MENU : CUSTOMER_MENU;
|
||||
}
|
||||
|
||||
// The pane to show: on Admin Panel / Cloud the one its address names, on
|
||||
// /cloud the one last clicked; one the menu does not have opens the first.
|
||||
function currentPane(tpl) {
|
||||
const items = menu(tpl.info.get());
|
||||
const wanted = FlowRouter.getRouteName() === 'cloud-admin' ? Session.get('cloudOpenPane') : tpl.pane.get();
|
||||
return items.some(item => item.id === wanted) ? wanted : items[0].id;
|
||||
}
|
||||
|
||||
// Every domain, for a Cloud Admin's pickers: the table's pages, one by one.
|
||||
function allDomains() {
|
||||
return Meteor.callAsync('cloudPanelDomainsCount', '')
|
||||
.then(total => Promise.all(Array.from({ length: Math.ceil(total / TABLE_PAGE_ROWS_PER_PAGE) }, (_, i) =>
|
||||
Meteor.callAsync('cloudPanelDomainsPage', { page: i + 1 }))))
|
||||
.then(pages => pages.flat());
|
||||
}
|
||||
|
||||
function boardPathOf(board) {
|
||||
return board && board.boardId ? `/b/${board.boardId}/${board.boardSlug || 'board'}` : '';
|
||||
}
|
||||
|
||||
Template.cloudPanel.onCreated(function () {
|
||||
this.loading = new ReactiveVar(true);
|
||||
this.info = new ReactiveVar({ enabled: false, onCloudHost: false, isCloudAdmin: false, domains: [] });
|
||||
this.config = new ReactiveVar(null);
|
||||
this.pane = new ReactiveVar('');
|
||||
panelError.set('');
|
||||
this.loadConfig = () => Meteor.callAsync('cloudPanelConfig').then(config => this.config.set(config));
|
||||
Meteor.callAsync('cloudPanelWhoAmI')
|
||||
.then(info => {
|
||||
this.info.set(info);
|
||||
return info.isCloudAdmin ? this.loadConfig() : null;
|
||||
})
|
||||
.catch(error => panelError.set(errorText(error)))
|
||||
.finally(() => this.loading.set(false));
|
||||
});
|
||||
|
||||
Template.cloudPanel.helpers({
|
||||
loading: () => Template.instance().loading.get(),
|
||||
info: () => Template.instance().info.get(),
|
||||
config: () => Template.instance().config.get(),
|
||||
pane: () => currentPane(Template.instance()),
|
||||
actionError: () => panelError.get(),
|
||||
// No CLOUD on this server, not at its address, or neither a Cloud Admin
|
||||
// nor a customer here.
|
||||
notAllowed() {
|
||||
const info = Template.instance().info.get();
|
||||
return !info.enabled || !info.onCloudHost || !(info.isCloudAdmin || info.domains.length > 0);
|
||||
},
|
||||
menuItems() {
|
||||
const tpl = Template.instance();
|
||||
return leftMenuData(menu(tpl.info.get()), currentPane(tpl), 'js-cloud-menu');
|
||||
},
|
||||
paneTitleData() {
|
||||
const tpl = Template.instance();
|
||||
return paneTitle(menu(tpl.info.get()), currentPane(tpl));
|
||||
},
|
||||
reload() {
|
||||
const tpl = Template.instance();
|
||||
return () => tpl.loadConfig();
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanel.events({
|
||||
'click a.js-cloud-menu'(event, tpl) {
|
||||
event.preventDefault();
|
||||
panelError.set('');
|
||||
const id = event.currentTarget.getAttribute('data-id');
|
||||
if (FlowRouter.getRouteName() === 'cloud-admin') FlowRouter.go(`/admin/cloud/${id}`);
|
||||
else tpl.pane.set(id);
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Cloudflare
|
||||
|
||||
Template.cloudPanelCloudflare.onCreated(function () {
|
||||
this.plan = new ReactiveVar(null);
|
||||
});
|
||||
|
||||
Template.cloudPanelCloudflare.helpers({
|
||||
plan: () => Template.instance().plan.get(),
|
||||
});
|
||||
|
||||
Template.cloudPanelCloudflare.events({
|
||||
'submit .js-cloud-cloudflare'(event) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const { reload } = Template.currentData();
|
||||
report(Meteor.callAsync('cloudPanelSetCloudflare', {
|
||||
apiToken: field(form, 'apiToken'), zoneId: field(form, 'zoneId'), target: field(form, 'target'),
|
||||
proxied: form.elements.proxied.checked === true,
|
||||
}).then(() => { form.elements.apiToken.value = ''; return reload(); }));
|
||||
},
|
||||
'click .js-cloud-dns-plan'(event, tpl) {
|
||||
event.preventDefault();
|
||||
report(Meteor.callAsync('cloudPanelDnsPlan').then(plan => tpl.plan.set(plan)));
|
||||
},
|
||||
'click .js-cloud-dns-apply'(event, tpl) {
|
||||
event.preventDefault();
|
||||
report(Meteor.callAsync('cloudPanelDnsApply').then(() => Meteor.callAsync('cloudPanelDnsPlan')).then(plan => tpl.plan.set(plan)));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Caddy
|
||||
|
||||
Template.cloudPanelCaddy.onCreated(function () {
|
||||
this.caddyfile = new ReactiveVar('');
|
||||
this.pushed = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.cloudPanelCaddy.helpers({
|
||||
caddyfile: () => Template.instance().caddyfile.get(),
|
||||
pushed: () => Template.instance().pushed.get(),
|
||||
});
|
||||
|
||||
Template.cloudPanelCaddy.events({
|
||||
'submit .js-cloud-caddy'(event) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const { reload } = Template.currentData();
|
||||
report(Meteor.callAsync('cloudPanelSetCaddy', {
|
||||
adminUrl: field(form, 'adminUrl'), sharedUpstream: field(form, 'sharedUpstream'), email: field(form, 'email'),
|
||||
}).then(() => reload()));
|
||||
},
|
||||
'click .js-cloud-caddyfile'(event, tpl) {
|
||||
event.preventDefault();
|
||||
report(Meteor.callAsync('cloudPanelCaddyfile').then(text => tpl.caddyfile.set(text)));
|
||||
},
|
||||
'click .js-cloud-caddy-push'(event, tpl) {
|
||||
event.preventDefault();
|
||||
tpl.pushed.set(false);
|
||||
report(Meteor.callAsync('cloudPanelPushCaddy').then(() => tpl.pushed.set(true)));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Domains
|
||||
|
||||
// Weddy's Domains columns (caddy-wekan-plugin), and what WeKan adds: where
|
||||
// the domain's data is.
|
||||
const DOMAIN_COLUMNS = [
|
||||
{ labelKey: 'domain', headerTemplate: 'cloudPanelDomainNew' },
|
||||
{ labelKey: 'cloud-customer-name' },
|
||||
{ labelKey: 'cloud-customer-email' },
|
||||
{ labelKey: 'cloud-start-date' },
|
||||
{ labelKey: 'cloud-end-date' },
|
||||
{ labelKey: 'cloud-panel-mode' },
|
||||
{ labelKey: 'cloud-panel-database' },
|
||||
{ label: '' },
|
||||
];
|
||||
|
||||
// The domain being edited, shared with the header's "New domain" link: a
|
||||
// table page's header template takes its own clicks (as People's "New" rows
|
||||
// do), so the link and the pane meet here.
|
||||
const editingDomain = new ReactiveVar(null);
|
||||
|
||||
Template.cloudPanelDomainNew.events({
|
||||
'click .js-cloud-domain-new'(event) {
|
||||
event.preventDefault();
|
||||
editingDomain.set({ mode: 'own', database: {}, customerUsernames: [], cloudflare: true });
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanelDomains.onCreated(function () {
|
||||
editingDomain.set(null);
|
||||
this.editing = editingDomain;
|
||||
this.searchTerm = new ReactiveVar('');
|
||||
this.page = new ReactiveVar(1);
|
||||
this.total = new ReactiveVar(0);
|
||||
this.rows = new ReactiveVar([]);
|
||||
this.report = new ReactiveVar(null);
|
||||
this.loadPage = () => Meteor.callAsync('cloudPanelDomainsPage', { search: this.searchTerm.get(), page: this.page.get() })
|
||||
.then(rows => this.rows.set(rows));
|
||||
// The total only when the pane opens or the search changes, never per page.
|
||||
this.loadAll = () => Meteor.callAsync('cloudPanelDomainsCount', this.searchTerm.get())
|
||||
.then(total => { this.total.set(total); return this.loadPage(); });
|
||||
this.loadAll();
|
||||
});
|
||||
|
||||
Template.cloudPanelDomains.helpers({
|
||||
tablePageData() {
|
||||
const tpl = Template.instance();
|
||||
const info = pageInfo(tpl.total.get(), tpl.page.get(), TABLE_PAGE_ROWS_PER_PAGE);
|
||||
const rows = tpl.rows.get();
|
||||
return {
|
||||
emptyKey: 'no-items-message',
|
||||
searchTerm: tpl.searchTerm.get(),
|
||||
header: buildHeader(DOMAIN_COLUMNS),
|
||||
rowTemplate: 'cloudPanelDomainRow',
|
||||
docs: rows.map(domain => ({ domain })),
|
||||
rowCount: rows.length,
|
||||
page: info.page,
|
||||
totalPages: info.totalPages,
|
||||
hasPrev: info.hasPrev,
|
||||
hasNext: info.hasNext,
|
||||
total: info.total,
|
||||
totalLabelKey: 'domains',
|
||||
};
|
||||
},
|
||||
editing: () => Template.instance().editing.get(),
|
||||
report: () => Template.instance().report.get(),
|
||||
reportCollections() {
|
||||
const report = Template.instance().report.get();
|
||||
return Object.entries((report && report.collections) || {}).map(([name, c]) => ({ name, ...c }));
|
||||
},
|
||||
reportIsDryRun: () => !!(Template.instance().report.get() || {}).dryRun,
|
||||
reportDomainId: () => (Template.instance().report.get() || {}).domainId,
|
||||
close() {
|
||||
const tpl = Template.instance();
|
||||
return saved => { tpl.editing.set(null); if (saved) tpl.loadAll(); };
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanelDomains.events({
|
||||
'keydown .js-table-page-search'(event, tpl) {
|
||||
if (event.keyCode !== 13 || event.shiftKey) return;
|
||||
event.preventDefault();
|
||||
tpl.searchTerm.set(event.currentTarget.value || '');
|
||||
tpl.page.set(1);
|
||||
tpl.loadAll();
|
||||
},
|
||||
'click .js-table-page-prev'(event, tpl) {
|
||||
event.preventDefault();
|
||||
if (tpl.page.get() > 1) { tpl.page.set(tpl.page.get() - 1); tpl.loadPage(); }
|
||||
},
|
||||
'click .js-table-page-next'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const { totalPages } = pageInfo(tpl.total.get(), tpl.page.get(), TABLE_PAGE_ROWS_PER_PAGE);
|
||||
if (tpl.page.get() < totalPages) { tpl.page.set(tpl.page.get() + 1); tpl.loadPage(); }
|
||||
},
|
||||
'click .js-cloud-domain-edit'(event, tpl) {
|
||||
event.preventDefault();
|
||||
report(Meteor.callAsync('cloudPanelDomain', event.currentTarget.getAttribute('data-id'))
|
||||
.then(domain => tpl.editing.set({ ...domain, database: domain.database || {} })));
|
||||
},
|
||||
'click .js-cloud-domain-import'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const domainId = event.currentTarget.getAttribute('data-id');
|
||||
// A dry run first: what would be copied, and nothing written.
|
||||
report(Meteor.callAsync('cloudPanelImportDomain', domainId, { dryRun: true })
|
||||
.then(report => tpl.report.set({ ...report, dryRun: true, domainId })));
|
||||
},
|
||||
'click .js-cloud-import-now'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const domainId = event.currentTarget.getAttribute('data-id');
|
||||
report(Meteor.callAsync('cloudPanelImportDomain', domainId, { dryRun: false })
|
||||
.then(report => { tpl.report.set({ ...report, dryRun: false, domainId }); return tpl.loadAll(); }));
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanelDomainRow.onCreated(function () {
|
||||
this.tested = new ReactiveVar('');
|
||||
});
|
||||
|
||||
Template.cloudPanelDomainRow.helpers({
|
||||
tested: () => Template.instance().tested.get(),
|
||||
databaseLabel(db) {
|
||||
if (!db) return '—';
|
||||
if (db.uri) return db.uri;
|
||||
return `${db.username ? `${db.username}@` : ''}${db.host}:${db.port}/${db.database}`;
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanelDomainRow.events({
|
||||
'click .js-cloud-domain-test'(event, tpl) {
|
||||
event.preventDefault();
|
||||
tpl.tested.set('…');
|
||||
Meteor.callAsync('cloudPanelTestDatabase', event.currentTarget.getAttribute('data-id'))
|
||||
.then(r => tpl.tested.set(TAPi18n.__('cloud-panel-test-ok', { users: r.users, boards: r.boards, cards: r.cards })))
|
||||
.catch(error => tpl.tested.set(errorText(error)));
|
||||
},
|
||||
});
|
||||
|
||||
Template.cloudPanelDomainForm.helpers({
|
||||
customers: () => (Template.currentData().domain.customerUsernames || []).join(', '),
|
||||
cloudflareOn: () => Template.currentData().domain.cloudflare !== false,
|
||||
});
|
||||
|
||||
Template.cloudPanelDomainForm.events({
|
||||
'submit .js-cloud-domain'(event) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const { domain, close } = Template.currentData();
|
||||
const database = {};
|
||||
if (field(form, 'uri')) database.uri = field(form, 'uri');
|
||||
else if (field(form, 'host')) {
|
||||
database.host = field(form, 'host');
|
||||
if (field(form, 'port')) database.port = parseInt(field(form, 'port'), 10);
|
||||
database.database = field(form, 'database');
|
||||
for (const name of ['username', 'authSource', 'replicaSet']) if (field(form, name)) database[name] = field(form, name);
|
||||
if (form.elements.password.value) database.password = form.elements.password.value;
|
||||
if (form.elements.tls.checked) database.tls = true;
|
||||
}
|
||||
const value = {
|
||||
domain: field(form, 'domain'), customerName: field(form, 'customerName'), mode: field(form, 'mode'),
|
||||
customerEmail: field(form, 'customerEmail'), billingEmail: field(form, 'billingEmail'),
|
||||
startDate: field(form, 'startDate'), endDate: field(form, 'endDate'),
|
||||
upstream: field(form, 'upstream'), customerUsernames: list(field(form, 'customerUsernames')),
|
||||
notes: field(form, 'notes'), cloudflare: form.elements.cloudflare.checked === true,
|
||||
};
|
||||
if (Object.keys(database).length) value.database = database;
|
||||
report(Meteor.callAsync('cloudPanelSaveDomain', domain._id || null, value).then(() => close(true)));
|
||||
},
|
||||
'click .js-cloud-domain-close'(event) {
|
||||
event.preventDefault();
|
||||
Template.currentData().close(false);
|
||||
},
|
||||
'click .js-cloud-domain-remove'(event) {
|
||||
event.preventDefault();
|
||||
const { close } = Template.currentData();
|
||||
report(Meteor.callAsync('cloudPanelRemoveDomain', event.currentTarget.getAttribute('data-id')).then(() => close(true)));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Invoices
|
||||
|
||||
const INVOICE_STATE_KEYS = { open: 'cloud-panel-invoice-open', paid: 'billing-status-paid', void: 'billing-status-void' };
|
||||
|
||||
Template.cloudPanelInvoices.onCreated(function () {
|
||||
this.invoices = new ReactiveVar([]);
|
||||
this.allDomains = new ReactiveVar([]);
|
||||
this.load = () => Meteor.callAsync('cloudPanelInvoices').then(invoices => this.invoices.set(invoices));
|
||||
this.load();
|
||||
if (Template.currentData().isCloudAdmin) allDomains().then(domains => this.allDomains.set(domains));
|
||||
});
|
||||
|
||||
Template.cloudPanelInvoices.helpers({
|
||||
invoices: () => Template.instance().invoices.get(),
|
||||
allDomains: () => Template.instance().allDomains.get(),
|
||||
money: (minor, currency) => formatMoney(minor, currency, language()),
|
||||
statusLabel: status => TAPi18n.__(INVOICE_STATE_KEYS[status] || status),
|
||||
});
|
||||
|
||||
Template.cloudPanelInvoices.events({
|
||||
'submit .js-cloud-invoice'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const value = { number: field(form, 'number'), issueDate: field(form, 'issueDate'), amount: parseFloat(field(form, 'amount')),
|
||||
currency: field(form, 'currency'), status: field(form, 'status') };
|
||||
for (const name of ['dueDate', 'paidDate', 'description', 'link']) if (field(form, name)) value[name] = field(form, name);
|
||||
report(Meteor.callAsync('cloudPanelSaveInvoice', field(form, 'domainId'), null, value).then(() => { form.reset(); return tpl.load(); }));
|
||||
},
|
||||
'click .js-cloud-invoice-remove'(event, tpl) {
|
||||
event.preventDefault();
|
||||
report(Meteor.callAsync('cloudPanelRemoveInvoice', event.currentTarget.getAttribute('data-id')).then(() => tpl.load()));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Chat
|
||||
|
||||
Template.cloudPanelChat.onCreated(function () {
|
||||
this.domains = new ReactiveVar(Template.currentData().domains || []);
|
||||
this.domainId = new ReactiveVar((this.domains.get()[0] || {})._id || '');
|
||||
this.messages = new ReactiveVar([]);
|
||||
this.imported = new ReactiveVar(0);
|
||||
this.boardPath = new ReactiveVar('');
|
||||
this.load = () => {
|
||||
const id = this.domainId.get();
|
||||
if (!id) return Promise.resolve();
|
||||
return Meteor.callAsync('cloudPanelChat', id).then(messages => this.messages.set(messages));
|
||||
};
|
||||
// The support board itself, to open in Board View / Chat.
|
||||
this.autorun(() => {
|
||||
const id = this.domainId.get();
|
||||
if (!id) return;
|
||||
Meteor.callAsync('cloudPanelTickets', id).then(board => this.boardPath.set(boardPathOf(board))).catch(() => this.boardPath.set(''));
|
||||
});
|
||||
if (Template.currentData().isCloudAdmin) {
|
||||
allDomains().then(domains => {
|
||||
this.domains.set(domains);
|
||||
if (!this.domainId.get() && domains[0]) this.domainId.set(domains[0]._id);
|
||||
return this.load();
|
||||
});
|
||||
} else {
|
||||
this.load();
|
||||
}
|
||||
// The chat is read again every 15 seconds while the pane is open.
|
||||
this.poll = Meteor.setInterval(() => this.load(), 15000);
|
||||
});
|
||||
|
||||
Template.cloudPanelChat.onDestroyed(function () {
|
||||
Meteor.clearInterval(this.poll);
|
||||
});
|
||||
|
||||
Template.cloudPanelChat.helpers({
|
||||
chatDomains: () => Template.instance().domains.get(),
|
||||
domainId: () => Template.instance().domainId.get(),
|
||||
messages: () => Template.instance().messages.get(),
|
||||
imported: () => Template.instance().imported.get(),
|
||||
boardPath: () => Template.instance().boardPath.get(),
|
||||
when: at => (at ? new Date(at).toLocaleString(language()) : ''),
|
||||
});
|
||||
|
||||
Template.cloudPanelChat.events({
|
||||
'change .js-cloud-chat-domain'(event, tpl) {
|
||||
tpl.domainId.set(event.currentTarget.value);
|
||||
tpl.load();
|
||||
},
|
||||
'submit .js-cloud-chat-send'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
report(Meteor.callAsync('cloudPanelSendChat', tpl.domainId.get(), { text: form.elements.text.value })
|
||||
.then(() => { form.reset(); return tpl.load(); }));
|
||||
},
|
||||
'submit .js-cloud-chat-import'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const file = form.elements.file.files[0];
|
||||
if (!file) return;
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const zipBase64 = String(reader.result).split(',')[1] || '';
|
||||
report(Meteor.callAsync('cloudPanelImportChat', tpl.domainId.get(), field(form, 'source'), { zipBase64 })
|
||||
.then(result => { tpl.imported.set(result.imported); form.reset(); return tpl.load(); }));
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Tickets
|
||||
|
||||
Template.cloudPanelTickets.onCreated(function () {
|
||||
this.domains = new ReactiveVar(Template.currentData().domains || []);
|
||||
this.domainId = new ReactiveVar((this.domains.get()[0] || {})._id || '');
|
||||
this.board = new ReactiveVar(null);
|
||||
this.load = () => {
|
||||
const id = this.domainId.get();
|
||||
if (!id) return Promise.resolve();
|
||||
return report(Meteor.callAsync('cloudPanelTickets', id).then(board => this.board.set(board)));
|
||||
};
|
||||
if (Template.currentData().isCloudAdmin) {
|
||||
allDomains().then(domains => {
|
||||
this.domains.set(domains);
|
||||
if (!this.domainId.get() && domains[0]) this.domainId.set(domains[0]._id);
|
||||
return this.load();
|
||||
});
|
||||
} else {
|
||||
this.load();
|
||||
}
|
||||
this.poll = Meteor.setInterval(() => this.load(), 30000);
|
||||
});
|
||||
|
||||
Template.cloudPanelTickets.onDestroyed(function () {
|
||||
Meteor.clearInterval(this.poll);
|
||||
});
|
||||
|
||||
const COLUMN_KEYS = Object.fromEntries(SUPPORT_LISTS.map(list => [list.key, list.titleKey]));
|
||||
|
||||
Template.cloudPanelTickets.helpers({
|
||||
ticketDomains: () => Template.instance().domains.get(),
|
||||
domainId: () => Template.instance().domainId.get(),
|
||||
board: () => Template.instance().board.get(),
|
||||
states: () => TICKET_STATES,
|
||||
columnTitle: key => TAPi18n.__(COLUMN_KEYS[key] || key),
|
||||
boardPath: () => boardPathOf(Template.instance().board.get()),
|
||||
when: at => (at ? new Date(at).toLocaleString(language()) : ''),
|
||||
});
|
||||
|
||||
Template.cloudPanelTickets.events({
|
||||
'change .js-cloud-tickets-domain'(event, tpl) {
|
||||
tpl.domainId.set(event.currentTarget.value);
|
||||
tpl.board.set(null);
|
||||
tpl.load();
|
||||
},
|
||||
'submit .js-cloud-ticket-add'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
report(Meteor.callAsync('cloudPanelAddTicket', tpl.domainId.get(), { title: field(form, 'title'), description: field(form, 'description') })
|
||||
.then(() => { form.reset(); return tpl.load(); }));
|
||||
},
|
||||
'change .js-cloud-ticket-move'(event, tpl) {
|
||||
report(Meteor.callAsync('cloudPanelMoveTicket', tpl.domainId.get(), event.currentTarget.getAttribute('data-id'), event.currentTarget.value)
|
||||
.then(() => tpl.load()));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- Allowed addresses
|
||||
|
||||
Template.cloudPanelAllowedAddresses.onCreated(function () {
|
||||
this.text = new ReactiveVar(null);
|
||||
this.saved = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
// Would this list lock the Cloud Admin out? The same rule the server applies
|
||||
// when it refuses to save it.
|
||||
function locksOut(text, yourAddress) {
|
||||
let list;
|
||||
try { list = normalizeAllowedAddresses(text); } catch (e) { return false; }
|
||||
return list.length > 0 && !addressAllowed(yourAddress, list);
|
||||
}
|
||||
|
||||
Template.cloudPanelAllowedAddresses.helpers({
|
||||
addressesText() {
|
||||
const config = Template.currentData().config;
|
||||
return ((config && config.allowedAddresses) || []).join('\n');
|
||||
},
|
||||
lockout() {
|
||||
const tpl = Template.instance();
|
||||
const config = Template.currentData().config || {};
|
||||
const text = tpl.text.get();
|
||||
return text !== null && locksOut(text, config.yourAddress);
|
||||
},
|
||||
saved: () => Template.instance().saved.get(),
|
||||
});
|
||||
|
||||
Template.cloudPanelAllowedAddresses.events({
|
||||
'input .js-cloud-addresses-text'(event, tpl) {
|
||||
tpl.saved.set(false);
|
||||
tpl.text.set(event.currentTarget.value);
|
||||
},
|
||||
'submit .js-cloud-addresses'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const form = event.currentTarget;
|
||||
const { reload } = Template.currentData();
|
||||
tpl.saved.set(false);
|
||||
report(Meteor.callAsync('cloudPanelSetAllowedAddresses', form.elements.addresses.value)
|
||||
.then(() => { tpl.saved.set(true); tpl.text.set(null); return reload(); }));
|
||||
},
|
||||
});
|
||||
@@ -9,7 +9,7 @@ import { Meteor } from 'meteor/meteor';
|
||||
// caught that; the build did, first time.
|
||||
import { formatDateTime } from '/imports/lib/dateUtils';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { attachmentKind } from '/models/lib/attachmentKind';
|
||||
import { attachmentCanPreview } from '/models/lib/attachmentKind';
|
||||
import { historyRowOffersRestore } from '/models/lib/attachmentSoftDelete';
|
||||
import { openAttachmentSlideshow } from '/client/components/cards/attachments';
|
||||
|
||||
@@ -157,13 +157,11 @@ function attachmentForRow(row) {
|
||||
if (!row || row.entityType !== 'attachment') return null;
|
||||
const attachment = ReactiveCache.getAttachment(row.entityId);
|
||||
if (!attachment) return null;
|
||||
const kind = attachmentKind(attachment);
|
||||
return {
|
||||
_id: attachment._id,
|
||||
name: attachment.name,
|
||||
link: typeof attachment.link === 'function' ? attachment.link() : '',
|
||||
canPreview: !!(kind.isImage || kind.isPDF || kind.isText || kind.isJSON
|
||||
|| kind.isOffice || kind.isVideo || kind.isAudio),
|
||||
canPreview: attachmentCanPreview(attachment),
|
||||
isDeleted: historyRowOffersRestore(row, attachment),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ export async function startCsvMapping(importTpl, { rows, excelBase64, uploadId,
|
||||
}
|
||||
const mapping = {
|
||||
columns: { ...((preview.mapping && preview.mapping.columns) || {}) },
|
||||
customFieldColumns: [],
|
||||
// The guess ticks every column it has no field for, so nothing is left
|
||||
// behind unless the user unticks it.
|
||||
customFieldColumns: [...((preview.mapping && preview.mapping.customFieldColumns) || [])],
|
||||
listName: TAPi18n.__('scrum-category-todo'),
|
||||
};
|
||||
importTpl.csvMappingState.set({
|
||||
|
||||
Vendored
+3
-1
@@ -288,7 +288,9 @@ a.show-mapping {
|
||||
font-size: 0.85em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: #6b778c;
|
||||
/* #505f79, not #6b778c: small bold text needs 4.5:1, and #6b778c on
|
||||
white is 4.48:1 - axe (45-axe-accessibility.e2e.js) failed it. */
|
||||
color: #505f79;
|
||||
}
|
||||
.import-source-list .import-source-group:first-child {
|
||||
margin-top: 0;
|
||||
|
||||
@@ -684,7 +684,8 @@ Template.import.helpers({
|
||||
const product = productNameOrDefault(setting && setting.productName);
|
||||
const current = Session.get('importSource');
|
||||
// Grouped by kind under headings (models/lib/toolGroups.js), the same
|
||||
// groups the Export menu uses; WeKan's own is headed by the product name.
|
||||
// groups the Export menu uses; WeKan's own is headed by the product name,
|
||||
// and a company with several products by the company's name.
|
||||
const { groupTools } = require('/models/lib/toolGroups');
|
||||
return groupTools(IMPORT_SOURCES.map(source => ({
|
||||
key: source.key,
|
||||
@@ -694,7 +695,9 @@ Template.import.helpers({
|
||||
selected: source.key === current,
|
||||
}))).map(source => ({
|
||||
...source,
|
||||
groupHeading: source.groupStart ? (source.groupLabelKey ? TAPi18n.__(source.groupLabelKey) : product) : '',
|
||||
groupHeading: source.groupStart
|
||||
? (source.groupLabelKey ? TAPi18n.__(source.groupLabelKey) : source.groupLabel || product)
|
||||
: '',
|
||||
}));
|
||||
},
|
||||
hasImportSource() {
|
||||
@@ -788,6 +791,11 @@ Template.importTextarea.helpers({
|
||||
});
|
||||
}
|
||||
|
||||
// Sandstorm's apps share one instruction, naming the app (models/lib/importSources.js).
|
||||
const spec = importSourceSpec(importSource);
|
||||
if (spec && spec.instruction === 'sandstorm') {
|
||||
return TAPi18n.__('import-board-instruction-sandstorm', { app: spec.name.replace(/^Sandstorm /, '') });
|
||||
}
|
||||
return TAPi18n.__(`import-board-instruction-${importSource}`);
|
||||
},
|
||||
importPlaceHolder() {
|
||||
|
||||
@@ -745,8 +745,7 @@ form.inlined-form .list-composer {
|
||||
display: flex;
|
||||
/* #5439: always show a scrollbar on the list body across desktop and mobile
|
||||
browsers (overlay scrollbars on macOS/iOS/Android/Firefox otherwise auto-
|
||||
hide it). Keep these declarations in sync with models/lib/scrollbarCss.js
|
||||
(alwaysVisibleScrollbarCss), which is unit tested. */
|
||||
hide it). tests/scrollbarCss.test.cjs reads these rules. */
|
||||
overflow-y: scroll;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.08);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { dueFromTitle, resetDueFromTitle } from '/client/components/forms/titleD
|
||||
import '/client/components/cards/similarCards';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { displayDefaultTitle } from '/imports/lib/defaultTitle';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { getSpinnerName, getSpinnerTemplate } from '/client/lib/spinner';
|
||||
import getSlug from 'limax';
|
||||
@@ -1319,26 +1320,7 @@ Template.linkCardPopup.helpers({
|
||||
},
|
||||
|
||||
isTitleDefault(title) {
|
||||
// https://github.com/wekan/wekan/issues/4763
|
||||
// https://github.com/wekan/wekan/issues/4742
|
||||
// Translation text for "default" does not work, it returns an object.
|
||||
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||
// This can happen, if swimlane does not have name.
|
||||
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||
// would be very slow.
|
||||
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||
return 'Default';
|
||||
} else {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
}
|
||||
} else if (title === 'Default') {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
return displayDefaultTitle(title, key => TAPi18n.__(key));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -642,15 +642,15 @@ template(name="listDestinationPicker")
|
||||
label {{_ 'boards'}}:
|
||||
select.js-select-boards
|
||||
each boards
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionBoardId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionBoardId _id}}selected{{/if}}") {{title}}
|
||||
label {{_ 'swimlanes'}}:
|
||||
select.js-select-swimlanes
|
||||
each swimlanes
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{isTitleDefault title}}
|
||||
label {{_ 'lists'}}:
|
||||
select.js-select-lists
|
||||
each lists
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionListId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionListId _id}}selected{{/if}}") {{title}}
|
||||
div
|
||||
input(type="radio" name="list-position" value="left" checked id="list-position-left" style="display: inline")
|
||||
label(for="list-position-left") {{_ 'left-of-list'}}
|
||||
@@ -679,13 +679,13 @@ template(name="addListPopup")
|
||||
label {{_ 'add-after-list'}}
|
||||
select.list-position-input.full-line
|
||||
each swimlaneLists
|
||||
option(value="{{_id}}" selected="{{$eq _id currentListIdValue}}") {{increment @index}} {{title}}
|
||||
option(value="{{_id}}" selected="{{$eq _id currentListIdValue}}") {{title}}
|
||||
else
|
||||
if currentBoard.lists.length
|
||||
label {{_ 'add-after-list'}}
|
||||
select.list-position-input.full-line
|
||||
each currentBoard.lists
|
||||
option(value="{{_id}}" selected="{{$eq _id currentListIdValue}}") {{increment @index}} {{title}}
|
||||
option(value="{{_id}}" selected="{{$eq _id currentListIdValue}}") {{title}}
|
||||
.edit-controls.clearfix
|
||||
button.primary.confirm.js-submit-add-list(type="submit") {{_ 'save'}}
|
||||
unless currentBoard.isTemplatesBoard
|
||||
|
||||
@@ -226,7 +226,9 @@ Template.listHeader.helpers({
|
||||
showCardsCountForList(count) {
|
||||
const currentUser = ReactiveCache.getCurrentUser();
|
||||
const limit = currentUser ? currentUser.getLimitToShowCardsCount() : false;
|
||||
return limit >= 0 && count >= limit;
|
||||
// "Show cards count if list contains more than N": more than, as it says
|
||||
// (it showed at N as well).
|
||||
return limit >= 0 && count > limit;
|
||||
},
|
||||
|
||||
cardsCountForListIsOne(count) {
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/* Budget and billing page (docs/Features/Billing/Billing.md). */
|
||||
.billing-page {
|
||||
padding: 1rem;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.billing-intro {
|
||||
max-width: 70ch;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.billing-boards,
|
||||
.billing-invoice-table,
|
||||
.billing-print-lines {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 0.5rem 0 1rem;
|
||||
}
|
||||
.billing-boards th,
|
||||
.billing-boards td,
|
||||
.billing-invoice-table th,
|
||||
.billing-invoice-table td,
|
||||
.billing-print-lines th,
|
||||
.billing-print-lines td {
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
padding: 0.35rem 0.5rem;
|
||||
text-align: start;
|
||||
vertical-align: top;
|
||||
}
|
||||
.billing-boards a {
|
||||
cursor: pointer;
|
||||
}
|
||||
.billing-board-row.is-selected {
|
||||
background: rgba(0, 121, 191, 0.08);
|
||||
}
|
||||
.billing-board-row.is-over,
|
||||
.billing-over {
|
||||
color: #c62828;
|
||||
}
|
||||
.billing-bar {
|
||||
height: 0.5rem;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 0.2rem;
|
||||
max-width: 12rem;
|
||||
}
|
||||
.billing-bar-fill {
|
||||
height: 100%;
|
||||
background: #3cb500;
|
||||
}
|
||||
.billing-board-row.is-over .billing-bar-fill {
|
||||
background: #e53935;
|
||||
}
|
||||
.billing-summary dl,
|
||||
.billing-print-meta dl {
|
||||
display: grid;
|
||||
grid-template-columns: max-content 1fr;
|
||||
gap: 0.2rem 1rem;
|
||||
}
|
||||
.billing-summary dt,
|
||||
.billing-print-meta dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
.billing-summary dd,
|
||||
.billing-print-meta dd {
|
||||
margin: 0;
|
||||
}
|
||||
.billing-sections {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
|
||||
gap: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.billing-section {
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
border-radius: 4px;
|
||||
padding: 0.75rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.billing-sections .billing-section {
|
||||
margin-top: 0;
|
||||
}
|
||||
.billing-section h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
.billing-section label {
|
||||
display: block;
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
.billing-list {
|
||||
padding-inline-start: 1.2rem;
|
||||
}
|
||||
.billing-list a {
|
||||
margin-inline-start: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.billing-invoice-table-wrapper,
|
||||
.billing-invoices {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.billing-invoice-actions button {
|
||||
margin: 0 0.25rem 0.25rem 0;
|
||||
}
|
||||
.billing-status-void td {
|
||||
opacity: 0.55;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.billing-status-paid td:nth-child(6) {
|
||||
color: #2e7d32;
|
||||
font-weight: bold;
|
||||
}
|
||||
.billing-print {
|
||||
margin-top: 1rem;
|
||||
padding: 1rem;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
.billing-print-customer {
|
||||
white-space: pre-wrap;
|
||||
font-family: inherit;
|
||||
}
|
||||
.billing-print-lines tfoot th {
|
||||
border-top: 2px solid #000;
|
||||
}
|
||||
/* Printing: only the invoice. */
|
||||
@media print {
|
||||
body * {
|
||||
visibility: hidden;
|
||||
}
|
||||
.billing-print,
|
||||
.billing-print * {
|
||||
visibility: visible;
|
||||
}
|
||||
.billing-print {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border: none;
|
||||
}
|
||||
.billing-print button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.billing-page { padding: 0.5rem; }
|
||||
}
|
||||
|
||||
/* Expenses, fees, time to approve and quotes (docs/Features/Billing/Billing.md). */
|
||||
.billing-hint {
|
||||
color: #555;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.billing-list li.is-invoiced {
|
||||
color: #555;
|
||||
}
|
||||
.billing-draft-lines li.billing-line-fee,
|
||||
.billing-draft-lines li.billing-line-expense,
|
||||
.billing-draft-lines li.billing-line-product {
|
||||
font-style: italic;
|
||||
}
|
||||
.billing-quote-accepted td:first-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
.billing-quote-declined {
|
||||
color: #777;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.time-entry-approved {
|
||||
color: #2e7d32;
|
||||
margin-inline-start: 0.3em;
|
||||
}
|
||||
.time-entry-rejected {
|
||||
color: #b71c1c;
|
||||
margin-inline-start: 0.3em;
|
||||
}
|
||||
|
||||
/* Labelled native checkboxes: the app-wide material form rule
|
||||
(client/components/forms/forms.css) hides native checkboxes three ways -
|
||||
display, visibility, an offset - which left these with a label and no box
|
||||
to tick or see ticked. All three are undone, as in cardFlow.css. */
|
||||
.billing-page input[type="checkbox"] {
|
||||
display: inline-block;
|
||||
visibility: visible;
|
||||
position: static;
|
||||
inset-inline-start: auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
margin-inline-end: 4px;
|
||||
flex: none;
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
//- Budget and billing (docs/Features/Billing/Billing.md): the boards the user
|
||||
is an admin of, each with its budget, what its work has cost and will cost,
|
||||
the hourly rates, who invoices and how it is paid, and the invoices of the
|
||||
time spent. The numbers come from the server (server/billing.js,
|
||||
models/lib/billing.js); this page draws them.
|
||||
|
||||
template(name="billing")
|
||||
if currentUser
|
||||
.billing-page
|
||||
h1.feature-help-title
|
||||
| {{_ 'billing-title'}}
|
||||
+featureHelp(id='billing')
|
||||
p.billing-intro {{_ 'billing-intro'}}
|
||||
if loading
|
||||
+spinner
|
||||
else if error
|
||||
.warning {{error}}
|
||||
else
|
||||
if isAdmin
|
||||
label.billing-all-boards
|
||||
input.js-billing-all-boards(type="checkbox" checked=allBoards)
|
||||
| {{_ 'workload-all-boards'}}
|
||||
if boards.length
|
||||
.billing-table-wrapper
|
||||
table.billing-boards
|
||||
thead
|
||||
tr
|
||||
th {{_ 'board'}}
|
||||
th {{_ 'billing-budget'}}
|
||||
th {{_ 'billing-spent'}}
|
||||
th {{_ 'billing-forecast'}}
|
||||
th {{_ 'billing-invoiced'}}
|
||||
tbody
|
||||
each board in boards
|
||||
tr.billing-board-row(class="{{#if board.finance.overBudget}}is-over{{/if}} {{#if $eq board._id selectedBoardId}}is-selected{{/if}}")
|
||||
td
|
||||
a.js-billing-board(data-id=board._id) {{board.title}}
|
||||
if board.overdueInvoices
|
||||
span.billing-over
|
||||
| · {{_ 'billing-overdue-count' count=board.overdueInvoices}}
|
||||
td {{budgetLabel board}}
|
||||
td
|
||||
.billing-bar
|
||||
.billing-bar-fill(style="width: {{barWidth board.finance.usedPercent}}%")
|
||||
span {{money board.finance.spentMinor board.finance.currency}}
|
||||
if board.finance.usedPercent
|
||||
| · {{board.finance.usedPercent}} %
|
||||
td
|
||||
span {{money board.finance.forecastMinor board.finance.currency}}
|
||||
if board.finance.forecastPercent
|
||||
| · {{board.finance.forecastPercent}} %
|
||||
if board.finance.overBudget
|
||||
span.billing-over
|
||||
i.fa.fa-exclamation-triangle
|
||||
| {{_ 'billing-over-budget'}}
|
||||
td {{money board.finance.invoicedMinor board.finance.currency}}
|
||||
else
|
||||
p {{_ 'billing-no-boards'}}
|
||||
|
||||
if detail
|
||||
+billingBoard(detail=detail reload=reload period=period setPeriod=setPeriod)
|
||||
|
||||
template(name="billingBoard")
|
||||
.billing-board
|
||||
h2 {{detail.board.title}}
|
||||
.billing-summary
|
||||
dl
|
||||
dt {{_ 'billing-spent'}}
|
||||
dd {{money detail.finance.spentMinor detail.finance.currency}} ({{hours detail.finance.spentHours}})
|
||||
dt {{_ 'billing-remaining'}}
|
||||
dd {{money detail.finance.remainingMinor detail.finance.currency}} ({{hours detail.finance.remainingHours}})
|
||||
dt {{_ 'billing-forecast'}}
|
||||
dd(class="{{#if detail.finance.overBudget}}billing-over{{/if}}") {{money detail.finance.forecastMinor detail.finance.currency}} ({{hours detail.finance.forecastHours}})
|
||||
if hasBudget
|
||||
dt {{_ 'billing-left'}}
|
||||
dd
|
||||
if detail.finance.leftMinor
|
||||
| {{money detail.finance.leftMinor detail.finance.currency}}
|
||||
if detail.finance.leftHours
|
||||
| {{hours detail.finance.leftHours}}
|
||||
dt {{_ 'billing-invoiced'}}
|
||||
dd {{money detail.finance.invoicedMinor detail.finance.currency}}
|
||||
dt {{_ 'billing-paid'}}
|
||||
dd {{money detail.finance.paidMinor detail.finance.currency}}
|
||||
dt {{_ 'billing-unbilled'}}
|
||||
dd.billing-unbilled {{money detail.finance.unbilledMinor detail.finance.currency}}
|
||||
if detail.finance.expenseMinor
|
||||
dt {{_ 'billing-expenses'}}
|
||||
dd {{money detail.finance.expenseMinor detail.finance.currency}}
|
||||
if detail.finance.hasCostRates
|
||||
dt {{_ 'billing-cost'}}
|
||||
dd {{money detail.finance.costMinor detail.finance.currency}}
|
||||
dt {{_ 'billing-margin'}}
|
||||
dd.billing-margin(class="{{#if isNegative detail.finance.marginMinor}}billing-over{{/if}}")
|
||||
| {{money detail.finance.marginMinor detail.finance.currency}}
|
||||
if detail.finance.marginPercent
|
||||
| · {{detail.finance.marginPercent}} %
|
||||
if detail.finance.unratedHours
|
||||
p.warning {{_ 'billing-unrated' hours=detail.finance.unratedHours}}
|
||||
if detail.finance.hasCostRates
|
||||
if detail.finance.uncostedHours
|
||||
p.warning {{_ 'billing-uncosted' hours=detail.finance.uncostedHours}}
|
||||
|
||||
.billing-sections
|
||||
section.billing-section
|
||||
h3 {{_ 'billing-budget'}}
|
||||
form.js-billing-budget
|
||||
label(for="billing-budget-amount") {{_ 'billing-amount'}}
|
||||
input#billing-budget-amount(type="number" name="amount" min="0" step="0.01" value=budgetAmount)
|
||||
label(for="billing-budget-currency") {{_ 'billing-currency'}}
|
||||
input#billing-budget-currency(type="text" name="currency" maxlength="3" value=budgetCurrency placeholder="EUR")
|
||||
label(for="billing-budget-hours") {{_ 'billing-budget-hours'}}
|
||||
input#billing-budget-hours(type="number" name="hours" min="0" step="0.5" value=detail.budget.hours)
|
||||
label(for="billing-budget-start") {{_ 'start'}}
|
||||
input#billing-budget-start(type="date" name="start" value=detail.budget.start)
|
||||
label(for="billing-budget-end") {{_ 'card-end'}}
|
||||
input#billing-budget-end(type="date" name="end" value=detail.budget.end)
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
if detail.budget
|
||||
button.js-billing-remove-budget(type="button") {{_ 'delete'}}
|
||||
|
||||
section.billing-section
|
||||
h3 {{_ 'billing-rates'}}
|
||||
if detail.rates.length
|
||||
ul.billing-list
|
||||
each rate in detail.rates
|
||||
li
|
||||
if rate.userId
|
||||
| {{rate.name}}
|
||||
else
|
||||
| {{_ 'billing-default-rate'}}
|
||||
| · {{money rate.hourlyRateMinor rate.currency}} / {{_ 'workload-hours-short'}}
|
||||
if isNumber rate.costRateMinor
|
||||
| · {{_ 'billing-cost-rate'}} {{money rate.costRateMinor rate.currency}}
|
||||
a.js-billing-remove-rate(data-id=rate._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
form.js-billing-rate
|
||||
label(for="billing-rate-person") {{_ 'person'}}
|
||||
select#billing-rate-person(name="userId")
|
||||
option(value="") {{_ 'billing-default-rate'}}
|
||||
each member in detail.members
|
||||
option(value=member.userId) {{member.name}}
|
||||
label(for="billing-rate-amount") {{_ 'billing-hourly-rate'}}
|
||||
input#billing-rate-amount(type="number" name="hourlyRate" min="0" step="0.01" required)
|
||||
label(for="billing-rate-currency") {{_ 'billing-currency'}}
|
||||
input#billing-rate-currency(type="text" name="currency" maxlength="3" value=budgetCurrency placeholder="EUR" required)
|
||||
label(for="billing-rate-cost") {{_ 'billing-cost-rate'}}
|
||||
input#billing-rate-cost(type="number" name="costRate" min="0" step="0.01")
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
|
||||
section.billing-section
|
||||
h3 {{_ 'billing-issuer'}}
|
||||
form.js-billing-profile
|
||||
label(for="billing-issuer-name") {{_ 'billing-issuer-name'}}
|
||||
input#billing-issuer-name(type="text" name="issuerName" maxlength="200" value=detail.profile.issuerName)
|
||||
label(for="billing-issuer-address") {{_ 'billing-address'}}
|
||||
textarea#billing-issuer-address(name="issuerAddress" maxlength="500" rows="3") {{detail.profile.issuerAddress}}
|
||||
label(for="billing-issuer-country") {{_ 'billing-country'}}
|
||||
input#billing-issuer-country(type="text" name="issuerCountry" maxlength="2" value=detail.profile.issuerCountry placeholder="FI")
|
||||
label(for="billing-business-id") {{_ 'billing-business-id'}}
|
||||
input#billing-business-id(type="text" name="businessId" maxlength="50" value=detail.profile.businessId)
|
||||
label(for="billing-vat-id") {{_ 'billing-vat-id'}}
|
||||
input#billing-vat-id(type="text" name="vatId" maxlength="50" value=detail.profile.vatId)
|
||||
label(for="billing-email") {{_ 'email'}}
|
||||
input#billing-email(type="text" name="email" maxlength="200" value=detail.profile.email)
|
||||
label(for="billing-phone") {{_ 'billing-phone'}}
|
||||
input#billing-phone(type="text" name="phone" maxlength="50" value=detail.profile.phone)
|
||||
label(for="billing-website") {{_ 'billing-website'}}
|
||||
input#billing-website(type="text" name="website" maxlength="200" value=detail.profile.website)
|
||||
label(for="billing-vat-percent") {{_ 'billing-vat'}} %
|
||||
input#billing-vat-percent(type="number" name="vatPercent" min="0" max="100" step="0.1" value=detail.profile.vatPercent)
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="reverseCharge" checked=detail.profile.reverseCharge)
|
||||
| {{_ 'billing-reverse-charge'}}
|
||||
label(for="billing-terms") {{_ 'billing-payment-terms'}}
|
||||
input#billing-terms(type="number" name="paymentTermsDays" min="0" max="365" step="1" value=detail.profile.paymentTermsDays)
|
||||
label(for="billing-penalty") {{_ 'billing-penalty-interest'}} %
|
||||
input#billing-penalty(type="number" name="penaltyInterestPercent" min="0" max="100" step="0.1" value=detail.profile.penaltyInterestPercent)
|
||||
label(for="billing-reference-type") {{_ 'billing-payment-reference'}}
|
||||
select#billing-reference-type(name="referenceType")
|
||||
each type in referenceTypes
|
||||
option(value=type.value selected="{{#if $eq type.value detail.profile.referenceType}}selected{{/if}}") {{type.label}}
|
||||
label(for="billing-footer") {{_ 'billing-footer'}}
|
||||
textarea#billing-footer(name="footer" maxlength="1000" rows="2") {{detail.profile.footer}}
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="billTime" checked=billsTime)
|
||||
| {{_ 'billing-bill-time'}}
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="approveTime" checked=detail.profile.approveTime)
|
||||
| {{_ 'billing-approve-time'}}
|
||||
label(for="billing-default-customer") {{_ 'billing-default-customer'}}
|
||||
textarea#billing-default-customer(name="customer" maxlength="500" rows="3") {{detail.profile.customer}}
|
||||
label(for="billing-default-country") {{_ 'billing-country'}}
|
||||
input#billing-default-country(type="text" name="customerCountry" maxlength="2" value=detail.profile.customerCountry placeholder="FI")
|
||||
label(for="billing-default-vatid") {{_ 'billing-vat-id'}}
|
||||
input#billing-default-vatid(type="text" name="customerVatId" maxlength="50" value=detail.profile.customerVatId)
|
||||
label(for="billing-quote-days") {{_ 'billing-quote-valid-days'}}
|
||||
input#billing-quote-days(type="number" name="quoteValidDays" min="1" max="365" step="1" value=quoteValidDays)
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
|
||||
section.billing-section
|
||||
h3 {{_ 'billing-payment-methods'}}
|
||||
if detail.profile.paymentMethods.length
|
||||
ul.billing-list
|
||||
each method in paymentMethods
|
||||
li
|
||||
| {{method.title}}
|
||||
if method.summary
|
||||
| · {{method.summary}}
|
||||
a.js-billing-remove-method(data-index=method.index title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
form.js-billing-method
|
||||
label(for="billing-method-type") {{_ 'billing-method'}}
|
||||
select#billing-method-type.js-billing-method-type(name="type")
|
||||
each type in methodTypes
|
||||
option(value=type.value selected="{{#if $eq type.value methodType}}selected{{/if}}") {{type.label}}
|
||||
each fieldName in methodFields
|
||||
label(for="billing-method-{{fieldName.name}}") {{fieldName.label}}
|
||||
if $eq fieldName.name 'details'
|
||||
textarea(id="billing-method-{{fieldName.name}}" name=fieldName.name rows="2" maxlength="2000")
|
||||
else
|
||||
input(id="billing-method-{{fieldName.name}}" type="text" name=fieldName.name maxlength="2000" placeholder=fieldName.placeholder)
|
||||
button.primary(type="submit") {{_ 'billing-add-method'}}
|
||||
|
||||
section.billing-section.billing-expenses
|
||||
h3 {{_ 'billing-expenses'}}
|
||||
if detail.expenses.length
|
||||
ul.billing-list
|
||||
each expense in detail.expenses
|
||||
li(class="{{#if expense.invoiced}}is-invoiced{{/if}}")
|
||||
| {{expense.date}} · {{expenseCategory expense.category}}
|
||||
if expense.description
|
||||
| · {{expense.description}}
|
||||
| · {{money expense.amountMinor expense.currency}}
|
||||
if expense.markupPercent
|
||||
| (+{{expense.markupPercent}} % = {{money expense.chargeMinor expense.currency}})
|
||||
unless expense.billable
|
||||
| · {{_ 'billing-not-billable'}}
|
||||
if expense.cardTitle
|
||||
| · {{expense.cardTitle}}
|
||||
if expense.name
|
||||
| · {{expense.name}}
|
||||
if expense.invoiced
|
||||
i.fa.fa-file-text-o(title="{{_ 'time-entry-invoiced'}}")
|
||||
else
|
||||
a.js-billing-remove-expense(data-id=expense._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
else
|
||||
p {{_ 'billing-no-expenses'}}
|
||||
form.js-billing-expense
|
||||
label(for="billing-expense-date") {{_ 'date'}}
|
||||
input#billing-expense-date(type="date" name="date" value=today required)
|
||||
label(for="billing-expense-amount") {{_ 'billing-amount'}}
|
||||
input#billing-expense-amount(type="number" name="amount" min="0.01" step="0.01" required)
|
||||
label(for="billing-expense-currency") {{_ 'billing-currency'}}
|
||||
input#billing-expense-currency(type="text" name="currency" maxlength="3" value=budgetCurrency placeholder="EUR" required)
|
||||
label(for="billing-expense-category") {{_ 'billing-expense-category'}}
|
||||
select#billing-expense-category(name="category")
|
||||
each category in expenseCategories
|
||||
option(value=category.value) {{category.label}}
|
||||
label(for="billing-expense-description") {{_ 'description'}}
|
||||
input#billing-expense-description(type="text" name="description" maxlength="200")
|
||||
label(for="billing-expense-markup") {{_ 'billing-markup'}} %
|
||||
input#billing-expense-markup(type="number" name="markupPercent" min="0" max="100" step="0.1")
|
||||
label(for="billing-expense-card") {{_ 'card'}}
|
||||
select#billing-expense-card(name="cardId")
|
||||
option(value="") —
|
||||
each card in detail.cards
|
||||
option(value=card._id) {{card.title}}
|
||||
label(for="billing-expense-person") {{_ 'person'}}
|
||||
select#billing-expense-person(name="userId")
|
||||
option(value="") —
|
||||
each member in detail.members
|
||||
option(value=member.userId) {{member.name}}
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="billable" checked)
|
||||
| {{_ 'billing-billable'}}
|
||||
button.primary(type="submit") {{_ 'billing-add-expense'}}
|
||||
|
||||
section.billing-section.billing-fees
|
||||
h3 {{_ 'billing-fees'}}
|
||||
p.billing-hint {{_ 'billing-fees-intro'}}
|
||||
if detail.fees.length
|
||||
ul.billing-list
|
||||
each fee in detail.fees
|
||||
li
|
||||
| {{fee.title}} · {{money fee.amountMinor fee.currency}} · {{fee.date}}
|
||||
if $eq fee.recurring 'monthly'
|
||||
| · {{_ 'billing-recurring-monthly'}}
|
||||
if fee.end
|
||||
| – {{fee.end}}
|
||||
| · {{_ 'billing-fee-billed' billed=fee.billedCount due=fee.dueCount}}
|
||||
a.js-billing-remove-fee(data-id=fee._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
else
|
||||
p {{_ 'billing-no-fees'}}
|
||||
form.js-billing-fee
|
||||
label(for="billing-fee-title") {{_ 'title'}}
|
||||
input#billing-fee-title(type="text" name="title" maxlength="200" required)
|
||||
label(for="billing-fee-amount") {{_ 'billing-amount'}}
|
||||
input#billing-fee-amount(type="number" name="amount" min="0.01" step="0.01" required)
|
||||
label(for="billing-fee-currency") {{_ 'billing-currency'}}
|
||||
input#billing-fee-currency(type="text" name="currency" maxlength="3" value=budgetCurrency placeholder="EUR" required)
|
||||
label(for="billing-fee-date") {{_ 'date'}}
|
||||
input#billing-fee-date(type="date" name="date" value=today required)
|
||||
label(for="billing-fee-recurring") {{_ 'billing-recurring'}}
|
||||
select#billing-fee-recurring(name="recurring")
|
||||
option(value="none") {{_ 'billing-recurring-none'}}
|
||||
option(value="monthly") {{_ 'billing-recurring-monthly'}}
|
||||
label(for="billing-fee-end") {{_ 'card-end'}}
|
||||
input#billing-fee-end(type="date" name="end")
|
||||
button.primary(type="submit") {{_ 'billing-add-fee'}}
|
||||
|
||||
if detail.profile.approveTime
|
||||
section.billing-section.billing-approval
|
||||
h3 {{_ 'billing-time-to-approve'}}
|
||||
if detail.pendingTime.length
|
||||
form.js-billing-approval
|
||||
ul.billing-list
|
||||
each entry in detail.pendingTime
|
||||
li
|
||||
label.billing-checkbox
|
||||
input(type="checkbox" name="entry" value=entry._id checked)
|
||||
| {{entry.date}} · {{entry.title}} · {{entry.name}} · {{entry.hours}} {{_ 'workload-hours-short'}}
|
||||
if entry.note
|
||||
| · {{entry.note}}
|
||||
label(for="billing-approval-note") {{_ 'workload-note'}}
|
||||
input#billing-approval-note(type="text" name="note" maxlength="200")
|
||||
button.primary.js-billing-decide(type="button" data-decision="approved") {{_ 'billing-approve'}}
|
||||
button.js-billing-decide(type="button" data-decision="rejected") {{_ 'billing-reject'}}
|
||||
else
|
||||
p {{_ 'billing-nothing-to-approve'}}
|
||||
|
||||
section.billing-section
|
||||
h3 {{_ 'billing-new-invoice'}}
|
||||
form.js-billing-period
|
||||
label(for="billing-period-start") {{_ 'billing-period'}}
|
||||
.billing-period
|
||||
input#billing-period-start(type="date" name="periodStart" value=period.periodStart)
|
||||
| –
|
||||
input#billing-period-end(type="date" name="periodEnd" value=period.periodEnd aria-label="{{_ 'card-end'}}")
|
||||
label.billing-checkbox
|
||||
input.js-billing-undated(type="checkbox" name="includeUndated" checked=period.includeUndated)
|
||||
| {{_ 'billing-include-undated'}}
|
||||
if detail.draft
|
||||
if detail.draft.lines.length
|
||||
p {{_ 'billing-draft-summary' hours=detail.draft.totalHours amount=draftTotal}}
|
||||
ul.billing-draft-lines
|
||||
each line in detail.draft.lines
|
||||
li(class="billing-line-{{lineKind line}}")
|
||||
if line.kind
|
||||
| {{lineKindLabel line}}: {{line.title}} · {{line.firstDate}} · {{money line.amountMinor detail.draft.currency}}
|
||||
else
|
||||
| {{line.title}} · {{line.name}} · {{line.hours}} {{_ 'workload-hours-short'}} · {{money line.amountMinor detail.draft.currency}}
|
||||
else
|
||||
p {{_ 'billing-nothing-to-invoice'}}
|
||||
if detail.draft.undatedHours
|
||||
p {{_ 'billing-undated-included' hours=detail.draft.undatedHours}}
|
||||
if detail.draft.unratedHours
|
||||
p.warning {{_ 'billing-unrated' hours=detail.draft.unratedHours}}
|
||||
if detail.draft.unapprovedHours
|
||||
p.warning {{_ 'billing-unapproved' hours=detail.draft.unapprovedHours}}
|
||||
else
|
||||
p {{_ 'billing-set-rate-first'}}
|
||||
form.js-billing-invoice
|
||||
label(for="billing-invoice-customer") {{_ 'billing-customer'}}
|
||||
textarea#billing-invoice-customer(name="customer" maxlength="500" rows="3" placeholder=detail.profile.customer)
|
||||
label(for="billing-invoice-country") {{_ 'billing-country'}}
|
||||
input#billing-invoice-country(type="text" name="customerCountry" maxlength="2" placeholder="FI")
|
||||
label(for="billing-invoice-vatid") {{_ 'billing-vat-id'}}
|
||||
input#billing-invoice-vatid(type="text" name="customerVatId" maxlength="50")
|
||||
label(for="billing-invoice-reference") {{_ 'billing-reference'}}
|
||||
input#billing-invoice-reference(type="text" name="reference" maxlength="100")
|
||||
label(for="billing-invoice-issue") {{_ 'billing-issue-date'}}
|
||||
input#billing-invoice-issue(type="date" name="issueDate" value=today)
|
||||
label(for="billing-invoice-due") {{_ 'billing-due-date'}}
|
||||
input#billing-invoice-due(type="date" name="dueDate")
|
||||
label(for="billing-invoice-vat") {{_ 'billing-vat'}} %
|
||||
input#billing-invoice-vat(type="number" name="vatPercent" min="0" max="100" step="0.1" placeholder=detail.profile.vatPercent)
|
||||
label(for="billing-invoice-notes") {{_ 'workload-note'}}
|
||||
textarea#billing-invoice-notes(name="notes" maxlength="2000" rows="2")
|
||||
button.primary(type="submit" disabled=cannotInvoice) {{_ 'billing-create-invoice'}}
|
||||
|
||||
section.billing-section.billing-invoices
|
||||
h3 {{_ 'billing-invoices'}}
|
||||
if detail.invoices.length
|
||||
.billing-table-wrapper
|
||||
table.billing-invoice-table
|
||||
thead
|
||||
tr
|
||||
th {{_ 'billing-number'}}
|
||||
th {{_ 'billing-issue-date'}}
|
||||
th {{_ 'billing-due-date'}}
|
||||
th {{_ 'billing-customer'}}
|
||||
th {{_ 'hours'}}
|
||||
th {{_ 'billing-total'}}
|
||||
th {{_ 'billing-amount-due'}}
|
||||
th {{_ 'billing-status'}}
|
||||
th
|
||||
tbody
|
||||
each invoice in detail.invoices
|
||||
tr(class="billing-status-{{invoice.status}} billing-state-{{invoice.state}}")
|
||||
td {{invoice.number}}
|
||||
td {{invoice.issueDate}}
|
||||
td {{invoice.dueDate}}
|
||||
td {{invoice.customer}}
|
||||
td {{invoice.totalHours}}
|
||||
td {{signedMoney invoice invoice.totalMinor}}
|
||||
td
|
||||
if invoice.dueMinor
|
||||
| {{money invoice.dueMinor invoice.currency}}
|
||||
if invoice.interestMinor
|
||||
span.billing-over
|
||||
| + {{money invoice.interestMinor invoice.currency}}
|
||||
td
|
||||
| {{statusLabel invoice.state}}
|
||||
if invoice.daysOverdue
|
||||
span.billing-over
|
||||
| ({{_ 'billing-days-overdue' days=invoice.daysOverdue}})
|
||||
td.billing-invoice-actions
|
||||
each next in nextStatuses invoice
|
||||
button.js-billing-status(type="button" data-id=invoice._id data-status=next.value) {{next.label}}
|
||||
if canCredit invoice
|
||||
button.js-billing-credit(type="button" data-id=invoice._id) {{_ 'billing-credit'}}
|
||||
button.js-billing-open(type="button" data-id=invoice._id)
|
||||
i.fa.fa-eye
|
||||
| {{_ 'billing-open'}}
|
||||
each format in fileFormats
|
||||
button.js-billing-file(type="button" data-id=invoice._id data-format=format.value)
|
||||
i.fa(class=format.icon)
|
||||
| {{format.label}}
|
||||
else
|
||||
p {{_ 'billing-no-invoices'}}
|
||||
|
||||
section.billing-section.billing-quotes
|
||||
h3 {{_ 'billing-quotes'}}
|
||||
p.billing-hint {{_ 'billing-quotes-intro'}}
|
||||
form.js-billing-quote
|
||||
label(for="billing-quote-customer") {{_ 'billing-customer'}}
|
||||
textarea#billing-quote-customer(name="customer" maxlength="500" rows="2" placeholder=detail.profile.customer)
|
||||
label(for="billing-quote-issue") {{_ 'billing-issue-date'}}
|
||||
input#billing-quote-issue(type="date" name="issueDate" value=today)
|
||||
label(for="billing-quote-valid") {{_ 'billing-valid-until'}}
|
||||
input#billing-quote-valid(type="date" name="validUntil")
|
||||
label(for="billing-quote-notes") {{_ 'workload-note'}}
|
||||
textarea#billing-quote-notes(name="notes" maxlength="2000" rows="2")
|
||||
button.primary(type="submit") {{_ 'billing-create-quote'}}
|
||||
if detail.quotes.length
|
||||
.billing-table-wrapper
|
||||
table.billing-quote-table
|
||||
thead
|
||||
tr
|
||||
th {{_ 'billing-number'}}
|
||||
th {{_ 'billing-issue-date'}}
|
||||
th {{_ 'billing-valid-until'}}
|
||||
th {{_ 'billing-customer'}}
|
||||
th {{_ 'hours'}}
|
||||
th {{_ 'billing-total'}}
|
||||
th {{_ 'billing-status'}}
|
||||
th
|
||||
tbody
|
||||
each quote in detail.quotes
|
||||
tr(class="billing-quote-{{quote.status}}")
|
||||
td {{quote.number}}
|
||||
td {{quote.issueDate}}
|
||||
td
|
||||
| {{quote.validUntil}}
|
||||
if quote.expired
|
||||
span.billing-over
|
||||
| ({{_ 'billing-quote-expired'}})
|
||||
td {{quote.customer}}
|
||||
td {{quote.totalHours}}
|
||||
td {{money quote.totalMinor quote.currency}}
|
||||
td {{quoteStatusLabel quote.status}}
|
||||
td.billing-invoice-actions
|
||||
each next in nextQuoteStatuses quote
|
||||
button.js-billing-quote-status(type="button" data-id=quote._id data-status=next.value) {{next.label}}
|
||||
button.js-billing-quote-open(type="button" data-id=quote._id)
|
||||
i.fa.fa-eye
|
||||
| {{_ 'billing-open'}}
|
||||
each format in quoteFormats
|
||||
button.js-billing-quote-file(type="button" data-id=quote._id data-format=format.value)
|
||||
i.fa(class=format.icon)
|
||||
| {{format.label}}
|
||||
label.billing-checkbox
|
||||
input.js-billing-accept-budget(type="checkbox" checked)
|
||||
| {{_ 'billing-accept-sets-budget'}}
|
||||
else
|
||||
p {{_ 'billing-no-quotes'}}
|
||||
|
||||
if printed
|
||||
+billingInvoicePrint(invoice=printed reload=reloadFn setPrinted=setPrinted)
|
||||
|
||||
if actionError
|
||||
.warning {{actionError}}
|
||||
|
||||
template(name="billingInvoicePrint")
|
||||
.billing-print
|
||||
.billing-print-header
|
||||
h2
|
||||
if $eq invoice.kind 'credit'
|
||||
| {{_ 'billing-credit-note'}} {{invoice.number}}
|
||||
else if $eq invoice.kind 'quote'
|
||||
| {{_ 'billing-quote'}} {{invoice.number}}
|
||||
else
|
||||
| {{_ 'billing-invoice'}} {{invoice.number}}
|
||||
.billing-print-issuer
|
||||
strong {{invoice.profile.issuerName}}
|
||||
pre {{invoice.profile.issuerAddress}}
|
||||
if invoice.profile.businessId
|
||||
div {{_ 'billing-business-id'}}: {{invoice.profile.businessId}}
|
||||
if invoice.profile.vatId
|
||||
div {{_ 'billing-vat-id'}}: {{invoice.profile.vatId}}
|
||||
.billing-print-meta
|
||||
if invoice.customer
|
||||
pre.billing-print-customer {{invoice.customer}}
|
||||
dl
|
||||
dt {{_ 'billing-issue-date'}}
|
||||
dd {{invoice.issueDate}}
|
||||
if invoice.dueDate
|
||||
if $eq invoice.kind 'quote'
|
||||
dt {{_ 'billing-valid-until'}}
|
||||
else
|
||||
dt {{_ 'billing-due-date'}}
|
||||
dd {{invoice.dueDate}}
|
||||
if invoice.creditOfNumber
|
||||
dt {{_ 'billing-credit-of'}}
|
||||
dd {{invoice.creditOfNumber}}
|
||||
if invoice.paymentReference
|
||||
dt {{_ 'billing-payment-reference'}}
|
||||
dd {{formattedReference}}
|
||||
if invoice.reference
|
||||
dt {{_ 'billing-reference'}}
|
||||
dd {{invoice.reference}}
|
||||
if invoice.periodStart
|
||||
dt {{_ 'billing-period'}}
|
||||
dd {{invoice.periodStart}} – {{invoice.periodEnd}}
|
||||
dt {{_ 'billing-status'}}
|
||||
dd {{statusLabel invoice.state invoice.kind}}
|
||||
.billing-table-wrapper
|
||||
table.billing-print-lines
|
||||
thead
|
||||
tr
|
||||
th {{_ 'card'}}
|
||||
th {{_ 'person'}}
|
||||
th {{_ 'hours'}}
|
||||
th {{_ 'billing-hourly-rate'}}
|
||||
th {{_ 'billing-amount'}}
|
||||
tbody
|
||||
each line in invoice.lines
|
||||
tr
|
||||
td
|
||||
| {{line.title}}
|
||||
if line.firstDate
|
||||
.billing-line-dates {{line.firstDate}} – {{line.lastDate}}
|
||||
td {{line.name}}
|
||||
if line.kind
|
||||
td
|
||||
td
|
||||
else
|
||||
td {{line.hours}}
|
||||
td {{money line.rateMinor invoice.currency}}
|
||||
td {{signedMoney invoice line.amountMinor}}
|
||||
tfoot
|
||||
tr
|
||||
th(colspan="4") {{_ 'billing-net'}}
|
||||
th {{signedMoney invoice invoice.netMinor}}
|
||||
tr
|
||||
th(colspan="4") {{_ 'billing-vat'}} {{invoice.vatPercent}} %
|
||||
th {{signedMoney invoice invoice.vatMinor}}
|
||||
tr
|
||||
th(colspan="4") {{_ 'billing-total'}}
|
||||
th {{signedMoney invoice invoice.totalMinor}}
|
||||
if invoice.paidMinor
|
||||
tr
|
||||
th(colspan="4") {{_ 'billing-paid'}}
|
||||
th {{money invoice.paidMinor invoice.currency}}
|
||||
tr
|
||||
th(colspan="4") {{_ 'billing-amount-due'}}
|
||||
th {{money invoice.dueMinor invoice.currency}}
|
||||
if invoice.reverseCharge
|
||||
p {{_ 'billing-reverse-charge'}}
|
||||
if invoice.notes
|
||||
p.billing-print-notes {{invoice.notes}}
|
||||
|
||||
if isInvoice invoice
|
||||
if invoice.instructions.length
|
||||
h3 {{_ 'billing-payment-methods'}}
|
||||
.billing-pay
|
||||
each item in invoice.instructions
|
||||
.billing-pay-method
|
||||
strong {{methodTitle item}}
|
||||
each l in item.lines
|
||||
div {{l}}
|
||||
if item.link
|
||||
div
|
||||
a(href=item.link target="_blank" rel="noopener noreferrer") {{item.link}}
|
||||
if item.error
|
||||
div.warning {{item.error}}
|
||||
if item.qr
|
||||
.billing-qr
|
||||
| {{{qrSvg item}}}
|
||||
small {{_ 'billing-pay-by-scanning'}}
|
||||
if item.barcode
|
||||
.billing-barcode
|
||||
| {{{barcodeSvg item.barcode}}}
|
||||
small {{item.barcode}}
|
||||
|
||||
unless $eq invoice.status 'draft'
|
||||
.billing-payments.no-print
|
||||
h3 {{_ 'billing-payments'}}
|
||||
if invoice.payments.length
|
||||
ul.billing-list
|
||||
each payment in invoice.payments
|
||||
li
|
||||
| {{payment.date}} · {{money payment.amountMinor invoice.currency}}
|
||||
if payment.method
|
||||
| · {{payment.method}}
|
||||
a.js-billing-remove-payment(data-id=payment.id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
if invoice.dueMinor
|
||||
form.js-billing-payment
|
||||
input(type="date" name="date" value=today aria-label="{{_ 'date'}}" required)
|
||||
input(type="number" name="amount" min="0.01" step="0.01" value=dueAmount aria-label="{{_ 'billing-amount'}}" required)
|
||||
input(type="text" name="method" maxlength="50" placeholder="{{_ 'billing-method'}}" aria-label="{{_ 'billing-method'}}")
|
||||
button.primary(type="submit") {{_ 'billing-add-payment'}}
|
||||
|
||||
if invoice.profile.footer
|
||||
p.billing-print-footer {{invoice.profile.footer}}
|
||||
.no-print
|
||||
button.js-billing-print-now(type="button")
|
||||
i.fa.fa-print
|
||||
| {{_ 'billing-print'}}
|
||||
button.js-billing-print-close(type="button") {{_ 'close'}}
|
||||
@@ -0,0 +1,500 @@
|
||||
// Budget and billing page (docs/Features/Billing/Billing.md). It asks the
|
||||
// server for the numbers (billingBoards / billingBoard, server/billing.js) and
|
||||
// writes through the other billing* methods.
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
// The payment methods' labels and placeholders, and their QR codes and
|
||||
// barcode as SVG, are shared with Board View / Shop (client/lib/paymentCodeSvg.js).
|
||||
import { METHOD_KEYS, FIELD_KEYS, PLACEHOLDERS, qrSvg, barcodeSvg } from '/client/lib/paymentCodeSvg';
|
||||
const { formatMoney, EXPENSE_CATEGORIES, LINE_KIND_LABEL_KEYS } = require('/models/lib/billing');
|
||||
const { minorToText } = require('/models/lib/currencies');
|
||||
const { PAYMENT_METHODS, formatReference, formatIban } = require('/models/lib/paymentCodes');
|
||||
|
||||
function t(key, options) {
|
||||
return TAPi18n.__(key, options);
|
||||
}
|
||||
|
||||
function errorText(error) {
|
||||
return error ? (error.reason || error.message || String(error)) : '';
|
||||
}
|
||||
|
||||
function language() {
|
||||
try { return TAPi18n.getLanguage ? TAPi18n.getLanguage() : undefined; } catch (e) { return undefined; }
|
||||
}
|
||||
|
||||
function money(minor, currency) {
|
||||
return formatMoney(minor, currency, language());
|
||||
}
|
||||
|
||||
const STATE_KEYS = {
|
||||
draft: 'billing-status-draft', sent: 'billing-status-sent', paid: 'billing-status-paid', void: 'billing-status-void',
|
||||
credited: 'billing-status-credited', partial: 'billing-status-partial', overdue: 'billing-status-overdue',
|
||||
};
|
||||
const NEXT = { draft: ['sent', 'void'], sent: ['paid', 'draft', 'void'], paid: [], void: [], credited: [] };
|
||||
const ACTION_KEYS = { sent: 'billing-mark-sent', paid: 'billing-mark-paid', void: 'billing-void', draft: 'billing-back-to-draft' };
|
||||
// A quote's statuses, and what each may become (models/lib/billing.js).
|
||||
const QUOTE_STATE_KEYS = { draft: 'billing-status-draft', sent: 'billing-status-sent', accepted: 'billing-quote-accepted', declined: 'billing-quote-declined' };
|
||||
const QUOTE_NEXT = { draft: ['sent', 'declined'], sent: ['accepted', 'declined', 'draft'], accepted: [], declined: [] };
|
||||
const QUOTE_ACTION_KEYS = { sent: 'billing-mark-sent', accepted: 'accept', declined: 'decline', draft: 'billing-back-to-draft' };
|
||||
function download(name, mime, { text, base64 }) {
|
||||
let blob;
|
||||
if (base64) {
|
||||
const bin = atob(base64);
|
||||
const bytes = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; i += 1) bytes[i] = bin.charCodeAt(i);
|
||||
blob = new Blob([bytes], { type: mime });
|
||||
} else {
|
||||
blob = new Blob([text], { type: mime });
|
||||
}
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- the page
|
||||
|
||||
Template.billing.onCreated(function () {
|
||||
this.loading = new ReactiveVar(true);
|
||||
this.error = new ReactiveVar('');
|
||||
this.boards = new ReactiveVar([]);
|
||||
this.isAdmin = new ReactiveVar(false);
|
||||
this.allBoards = new ReactiveVar(false);
|
||||
this.selected = new ReactiveVar(null);
|
||||
this.detail = new ReactiveVar(null);
|
||||
this.period = new ReactiveVar({ periodStart: '', periodEnd: '', includeUndated: false });
|
||||
// The spinner of this load takes the board pane down with it, so a save
|
||||
// refreshes through reload below, never through this.
|
||||
this.loadBoards = () => {
|
||||
this.loading.set(true);
|
||||
return Meteor.callAsync('billingBoards', { allBoards: this.allBoards.get() })
|
||||
.then(result => {
|
||||
this.boards.set(result.boards);
|
||||
this.isAdmin.set(result.isAdmin === true);
|
||||
this.error.set('');
|
||||
})
|
||||
.catch(error => this.error.set(errorText(error)))
|
||||
.finally(() => this.loading.set(false));
|
||||
};
|
||||
this.loadDetail = () => {
|
||||
const boardId = this.selected.get();
|
||||
if (!boardId) { this.detail.set(null); return Promise.resolve(); }
|
||||
const p = this.period.get();
|
||||
const period = {};
|
||||
if (p.periodStart) period.periodStart = p.periodStart;
|
||||
if (p.periodEnd) period.periodEnd = p.periodEnd;
|
||||
if (p.includeUndated) period.includeUndated = true;
|
||||
return Meteor.callAsync('billingBoard', boardId, period).then(detail => this.detail.set(detail))
|
||||
.catch(error => this.error.set(errorText(error)));
|
||||
};
|
||||
// After a save only the open board is read again, and its row in the list
|
||||
// takes the numbers from that answer: reading every board after each save
|
||||
// ran into billingBoards' rate limit (server/billing.js) within a minute of
|
||||
// filling in a few forms.
|
||||
this.reload = () => this.loadDetail().then(() => {
|
||||
const detail = this.detail.get();
|
||||
if (!detail) return;
|
||||
this.boards.set(this.boards.get().map(b => (b._id === detail.board._id
|
||||
? { ...b, budget: detail.budget, finance: detail.finance } : b)));
|
||||
});
|
||||
this.loadBoards();
|
||||
});
|
||||
|
||||
Template.billing.helpers({
|
||||
loading: () => Template.instance().loading.get(),
|
||||
error: () => Template.instance().error.get(),
|
||||
boards: () => Template.instance().boards.get(),
|
||||
isAdmin: () => Template.instance().isAdmin.get(),
|
||||
allBoards: () => Template.instance().allBoards.get(),
|
||||
selectedBoardId: () => Template.instance().selected.get(),
|
||||
detail: () => Template.instance().detail.get(),
|
||||
period: () => Template.instance().period.get(),
|
||||
reload() {
|
||||
const tpl = Template.instance();
|
||||
return () => tpl.reload();
|
||||
},
|
||||
setPeriod() {
|
||||
const tpl = Template.instance();
|
||||
return period => { tpl.period.set(period); tpl.loadDetail(); };
|
||||
},
|
||||
money,
|
||||
budgetLabel(board) {
|
||||
const b = board.budget;
|
||||
if (!b) return '—';
|
||||
const parts = [];
|
||||
if (typeof b.amountMinor === 'number') parts.push(money(b.amountMinor, b.currency));
|
||||
if (typeof b.hours === 'number') parts.push(`${b.hours} ${t('workload-hours-short')}`);
|
||||
return parts.join(' · ');
|
||||
},
|
||||
barWidth(percent) {
|
||||
return Math.max(0, Math.min(100, Number(percent) || 0));
|
||||
},
|
||||
});
|
||||
|
||||
Template.billing.events({
|
||||
'click .js-billing-board'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.selected.set(evt.currentTarget.getAttribute('data-id'));
|
||||
tpl.loadDetail();
|
||||
},
|
||||
'change .js-billing-all-boards'(evt, tpl) {
|
||||
tpl.allBoards.set(evt.currentTarget.checked === true);
|
||||
tpl.loadBoards();
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- one board
|
||||
|
||||
Template.billingBoard.onCreated(function () {
|
||||
this.printed = new ReactiveVar(null);
|
||||
this.actionError = new ReactiveVar('');
|
||||
this.methodType = new ReactiveVar('sepa');
|
||||
this.done = promise => promise.then(result => {
|
||||
this.actionError.set('');
|
||||
// The instance's own data context: inside a promise there is no current
|
||||
// template, and the current-data lookup is null there - which left the
|
||||
// page unrefreshed after every save.
|
||||
const { reload } = this.data || {};
|
||||
if (typeof reload === 'function') reload();
|
||||
return result;
|
||||
}).catch(error => this.actionError.set(errorText(error)));
|
||||
});
|
||||
|
||||
function detail() {
|
||||
return Template.currentData().detail;
|
||||
}
|
||||
|
||||
function methodTitle(type) {
|
||||
return t(METHOD_KEYS[type] || type);
|
||||
}
|
||||
|
||||
function signedMoney(invoice, minor) {
|
||||
return money(invoice.kind === 'credit' ? -minor : minor, invoice.currency);
|
||||
}
|
||||
|
||||
function stateLabel(state, kind) {
|
||||
if (kind === 'quote') return t(QUOTE_STATE_KEYS[state] || state);
|
||||
return t(STATE_KEYS[state] || state);
|
||||
}
|
||||
|
||||
Template.billingBoard.helpers({
|
||||
money,
|
||||
signedMoney,
|
||||
hours: value => `${Math.round((Number(value) || 0) * 100) / 100} ${t('workload-hours-short')}`,
|
||||
hasBudget: () => !!detail().budget,
|
||||
budgetAmount() {
|
||||
const b = detail().budget;
|
||||
return b && typeof b.amountMinor === 'number' ? minorToText(b.amountMinor, b.currency) : '';
|
||||
},
|
||||
budgetCurrency() {
|
||||
const d = detail();
|
||||
return (d.budget && d.budget.currency) || d.finance.currency || '';
|
||||
},
|
||||
draftTotal() {
|
||||
const d = detail();
|
||||
return d.draft ? money(d.draft.netMinor, d.draft.currency) : '';
|
||||
},
|
||||
cannotInvoice() {
|
||||
const d = detail();
|
||||
return !(d.draft && d.draft.lines.length);
|
||||
},
|
||||
today: () => new Date().toISOString().slice(0, 10),
|
||||
referenceTypes: () => [
|
||||
{ value: 'rf', label: t('billing-reference-rf') }, { value: 'fi', label: t('billing-reference-fi') },
|
||||
{ value: 'be', label: t('billing-reference-be') }, { value: 'no', label: t('billing-reference-no') },
|
||||
{ value: 'se', label: t('billing-reference-se') }, { value: 'none', label: t('billing-reference-none') },
|
||||
],
|
||||
methodTypes: () => Object.keys(PAYMENT_METHODS).map(value => ({ value, label: methodTitle(value) })),
|
||||
methodType: () => Template.instance().methodType.get(),
|
||||
methodFields() {
|
||||
const spec = PAYMENT_METHODS[Template.instance().methodType.get()];
|
||||
return (spec ? spec.fields : []).map(name => ({ name, label: t(FIELD_KEYS[name] || name), placeholder: PLACEHOLDERS[name] || '' }));
|
||||
},
|
||||
paymentMethods() {
|
||||
return (detail().profile.paymentMethods || []).map((m, index) => ({
|
||||
index, title: m.label || methodTitle(m.type),
|
||||
summary: m.iban ? formatIban(m.iban) : (m.payee || m.key || m.vpa || m.address || m.user || m.url || m.details || ''),
|
||||
}));
|
||||
},
|
||||
statusLabel: state => t(STATE_KEYS[state] || state),
|
||||
nextStatuses: invoice => (invoice.kind === 'credit' ? [] : (NEXT[invoice.status] || [])).map(value => ({ value, label: t(ACTION_KEYS[value]) })),
|
||||
canCredit: invoice => invoice.kind !== 'credit' && ['sent', 'paid'].includes(invoice.status),
|
||||
fileFormats: () => [
|
||||
{ value: 'pdf', label: 'PDF', icon: 'fa-file-pdf-o' }, { value: 'svg', label: 'SVG', icon: 'fa-file-image-o' },
|
||||
{ value: 'xlsx', label: 'Excel', icon: 'fa-file-excel-o' },
|
||||
{ value: 'csv', label: 'CSV', icon: 'fa-file-text-o' }, { value: 'ubl', label: t('billing-e-invoice'), icon: 'fa-file-code-o' },
|
||||
],
|
||||
printed: () => Template.instance().printed.get(),
|
||||
// The parent's reload, handed on by a helper: written `reload=reload`,
|
||||
// Spacebars would call the function it finds in this data context instead
|
||||
// of passing it on.
|
||||
reloadFn: () => Template.currentData().reload,
|
||||
setPrinted() {
|
||||
const tpl = Template.instance();
|
||||
return invoice => tpl.printed.set(invoice);
|
||||
},
|
||||
actionError: () => Template.instance().actionError.get(),
|
||||
isNegative: value => typeof value === 'number' && value < 0,
|
||||
isNumber: value => typeof value === 'number',
|
||||
billsTime: () => detail().profile.billTime !== false,
|
||||
quoteValidDays: () => detail().profile.quoteValidDays || 30,
|
||||
expenseCategories: () => EXPENSE_CATEGORIES.map(value => ({ value, label: t(`billing-expense-${value}`) })),
|
||||
expenseCategory: value => t(`billing-expense-${value}`),
|
||||
lineKind: line => line.kind || 'time',
|
||||
lineKindLabel: line => t(LINE_KIND_LABEL_KEYS[line.kind] || 'billing-line-fee'),
|
||||
quoteStatusLabel: status => stateLabel(status, 'quote'),
|
||||
nextQuoteStatuses: quote => (QUOTE_NEXT[quote.status] || []).map(value => ({ value, label: t(QUOTE_ACTION_KEYS[value]) })),
|
||||
quoteFormats: () => [
|
||||
{ value: 'pdf', label: 'PDF', icon: 'fa-file-pdf-o' }, { value: 'svg', label: 'SVG', icon: 'fa-file-image-o' },
|
||||
{ value: 'xlsx', label: 'Excel', icon: 'fa-file-excel-o' }, { value: 'csv', label: 'CSV', icon: 'fa-file-text-o' },
|
||||
],
|
||||
});
|
||||
|
||||
function field(form, name) {
|
||||
const el = form.elements[name];
|
||||
return el ? String(el.value).trim() : '';
|
||||
}
|
||||
|
||||
function numberOrUndefined(value) {
|
||||
return value === '' ? undefined : parseFloat(value);
|
||||
}
|
||||
|
||||
function saveProfile(tpl, changes) {
|
||||
const current = detail().profile || {};
|
||||
return tpl.done(Meteor.callAsync('billingSetProfile', detail().board._id, { ...current, ...changes }));
|
||||
}
|
||||
|
||||
function openQuote(tpl, id) {
|
||||
return Meteor.callAsync('billingQuote', id)
|
||||
.then(quote => tpl.printed.set(quote))
|
||||
.catch(error => tpl.actionError.set(errorText(error)));
|
||||
}
|
||||
|
||||
function openInvoice(tpl, id) {
|
||||
return Meteor.callAsync('billingInvoice', id)
|
||||
.then(invoice => tpl.printed.set(invoice))
|
||||
.catch(error => tpl.actionError.set(errorText(error)));
|
||||
}
|
||||
|
||||
Template.billingBoard.events({
|
||||
'submit .js-billing-budget'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const budget = {
|
||||
amount: numberOrUndefined(field(form, 'amount')),
|
||||
currency: field(form, 'currency') || undefined,
|
||||
hours: numberOrUndefined(field(form, 'hours')),
|
||||
start: field(form, 'start') || undefined,
|
||||
end: field(form, 'end') || undefined,
|
||||
};
|
||||
for (const key of Object.keys(budget)) if (budget[key] === undefined) delete budget[key];
|
||||
tpl.done(Meteor.callAsync('billingSetBudget', detail().board._id, budget));
|
||||
},
|
||||
'click .js-billing-remove-budget'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('billingSetBudget', detail().board._id, null));
|
||||
},
|
||||
'submit .js-billing-rate'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const rate = { hourlyRate: parseFloat(field(form, 'hourlyRate')), currency: field(form, 'currency') };
|
||||
if (field(form, 'userId')) rate.userId = field(form, 'userId');
|
||||
if (field(form, 'costRate')) rate.costRate = parseFloat(field(form, 'costRate'));
|
||||
tpl.done(Meteor.callAsync('billingSetRate', detail().board._id, rate).then(() => form.reset()));
|
||||
},
|
||||
'click .js-billing-remove-rate'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('billingRemoveRate', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
'submit .js-billing-profile'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const changes = {};
|
||||
for (const name of ['issuerName', 'issuerAddress', 'issuerCountry', 'businessId', 'vatId', 'email', 'phone', 'website', 'referenceType', 'footer',
|
||||
'customer', 'customerCountry', 'customerVatId']) {
|
||||
changes[name] = field(form, name);
|
||||
}
|
||||
changes.vatPercent = numberOrUndefined(field(form, 'vatPercent')) || 0;
|
||||
changes.paymentTermsDays = parseInt(field(form, 'paymentTermsDays'), 10);
|
||||
if (!Number.isInteger(changes.paymentTermsDays)) changes.paymentTermsDays = 14;
|
||||
changes.penaltyInterestPercent = numberOrUndefined(field(form, 'penaltyInterestPercent')) || 0;
|
||||
changes.reverseCharge = form.elements.reverseCharge.checked === true;
|
||||
changes.billTime = form.elements.billTime.checked === true;
|
||||
changes.approveTime = form.elements.approveTime.checked === true;
|
||||
changes.quoteValidDays = parseInt(field(form, 'quoteValidDays'), 10);
|
||||
if (!Number.isInteger(changes.quoteValidDays)) changes.quoteValidDays = 30;
|
||||
saveProfile(tpl, changes);
|
||||
},
|
||||
'submit .js-billing-expense'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const expense = { date: field(form, 'date'), amount: parseFloat(field(form, 'amount')), currency: field(form, 'currency'),
|
||||
category: field(form, 'category'), description: field(form, 'description'), billable: form.elements.billable.checked === true };
|
||||
if (field(form, 'markupPercent')) expense.markupPercent = parseFloat(field(form, 'markupPercent'));
|
||||
for (const name of ['cardId', 'userId']) if (field(form, name)) expense[name] = field(form, name);
|
||||
tpl.done(Meteor.callAsync('billingAddExpense', detail().board._id, expense).then(() => form.reset()));
|
||||
},
|
||||
'click .js-billing-remove-expense'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('billingRemoveExpense', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
'submit .js-billing-fee'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const fee = { title: field(form, 'title'), amount: parseFloat(field(form, 'amount')), currency: field(form, 'currency'),
|
||||
date: field(form, 'date'), recurring: field(form, 'recurring') };
|
||||
if (fee.recurring === 'monthly' && field(form, 'end')) fee.end = field(form, 'end');
|
||||
tpl.done(Meteor.callAsync('billingAddFee', detail().board._id, fee).then(() => form.reset()));
|
||||
},
|
||||
'click .js-billing-remove-fee'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('billingRemoveFee', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
'click .js-billing-decide'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget.closest('form');
|
||||
const entryIds = [...form.querySelectorAll('input[name=entry]:checked')].map(el => el.value);
|
||||
if (!entryIds.length) return;
|
||||
const approval = { entryIds, decision: evt.currentTarget.getAttribute('data-decision') };
|
||||
if (field(form, 'note')) approval.note = field(form, 'note');
|
||||
tpl.done(Meteor.callAsync('billingApproveTime', detail().board._id, approval));
|
||||
},
|
||||
'submit .js-billing-quote'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const request = {};
|
||||
for (const name of ['customer', 'issueDate', 'validUntil', 'notes']) if (field(form, name)) request[name] = field(form, name);
|
||||
tpl.done(Meteor.callAsync('billingCreateQuote', detail().board._id, request).then(id => { form.reset(); return openQuote(tpl, id); }));
|
||||
},
|
||||
'click .js-billing-quote-status'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const el = evt.currentTarget;
|
||||
const status = el.getAttribute('data-status');
|
||||
const box = tpl.find('.js-billing-accept-budget');
|
||||
const options = status === 'accepted' && box && box.checked ? { setBudget: true } : undefined;
|
||||
tpl.done(Meteor.callAsync('billingSetQuoteStatus', el.getAttribute('data-id'), status, options));
|
||||
},
|
||||
'click .js-billing-quote-open'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
openQuote(tpl, evt.currentTarget.getAttribute('data-id'));
|
||||
},
|
||||
'click .js-billing-quote-file'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const el = evt.currentTarget;
|
||||
Meteor.callAsync('billingQuoteFile', el.getAttribute('data-id'), el.getAttribute('data-format'))
|
||||
.then(file => download(file.name, file.mime, file))
|
||||
.catch(error => tpl.actionError.set(errorText(error)));
|
||||
},
|
||||
'change .js-billing-method-type'(evt, tpl) {
|
||||
tpl.methodType.set(evt.currentTarget.value);
|
||||
},
|
||||
'submit .js-billing-method'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const type = field(form, 'type');
|
||||
const method = { type };
|
||||
for (const name of PAYMENT_METHODS[type].fields) method[name] = field(form, name);
|
||||
const methods = [...(detail().profile.paymentMethods || []), method];
|
||||
saveProfile(tpl, { paymentMethods: methods }).then(() => form.reset());
|
||||
},
|
||||
'click .js-billing-remove-method'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const index = parseInt(evt.currentTarget.getAttribute('data-index'), 10);
|
||||
saveProfile(tpl, { paymentMethods: (detail().profile.paymentMethods || []).filter((m, i) => i !== index) });
|
||||
},
|
||||
'change .js-billing-period'(evt) {
|
||||
const form = evt.currentTarget;
|
||||
const { setPeriod } = Template.currentData();
|
||||
setPeriod({ periodStart: field(form, 'periodStart'), periodEnd: field(form, 'periodEnd'), includeUndated: form.elements.includeUndated.checked === true });
|
||||
},
|
||||
'submit .js-billing-invoice'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const request = {};
|
||||
for (const name of ['customer', 'customerCountry', 'customerVatId', 'reference', 'notes', 'issueDate', 'dueDate']) {
|
||||
if (field(form, name)) request[name] = field(form, name);
|
||||
}
|
||||
if (field(form, 'vatPercent')) request.vatPercent = parseFloat(field(form, 'vatPercent'));
|
||||
const p = Template.currentData().period || {};
|
||||
if (p.periodStart) request.periodStart = p.periodStart;
|
||||
if (p.periodEnd) request.periodEnd = p.periodEnd;
|
||||
if (p.includeUndated) request.includeUndated = true;
|
||||
tpl.done(Meteor.callAsync('billingCreateInvoice', detail().board._id, request).then(id => { form.reset(); return openInvoice(tpl, id); }));
|
||||
},
|
||||
'click .js-billing-status'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const el = evt.currentTarget;
|
||||
tpl.done(Meteor.callAsync('billingSetInvoiceStatus', el.getAttribute('data-id'), el.getAttribute('data-status')));
|
||||
},
|
||||
'click .js-billing-credit'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('billingCreditInvoice', evt.currentTarget.getAttribute('data-id'), {}).then(id => openInvoice(tpl, id)));
|
||||
},
|
||||
'click .js-billing-open'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
openInvoice(tpl, evt.currentTarget.getAttribute('data-id'));
|
||||
},
|
||||
'click .js-billing-file'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const el = evt.currentTarget;
|
||||
Meteor.callAsync('billingInvoiceFile', el.getAttribute('data-id'), el.getAttribute('data-format'))
|
||||
.then(file => download(file.name, file.mime, file))
|
||||
.catch(error => tpl.actionError.set(errorText(error)));
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- the invoice
|
||||
|
||||
Template.billingInvoicePrint.helpers({
|
||||
money,
|
||||
signedMoney,
|
||||
statusLabel: (state, kind) => stateLabel(state, typeof kind === 'string' ? kind : ''),
|
||||
isInvoice: invoice => (invoice.kind || 'invoice') === 'invoice',
|
||||
methodTitle: item => item.label || methodTitle(item.type),
|
||||
formattedReference() {
|
||||
return formatReference(Template.currentData().invoice.paymentReference);
|
||||
},
|
||||
qrSvg: item => qrSvg(item.qr, item.swissCross),
|
||||
barcodeSvg,
|
||||
today: () => new Date().toISOString().slice(0, 10),
|
||||
dueAmount() {
|
||||
const inv = Template.currentData().invoice;
|
||||
return minorToText(inv.dueMinor, inv.currency);
|
||||
},
|
||||
});
|
||||
|
||||
// The board template keeps the open invoice; it hands down setPrinted.
|
||||
function reloadInvoice() {
|
||||
const data = Template.currentData();
|
||||
if (typeof data.reload === 'function') data.reload();
|
||||
return Meteor.callAsync('billingInvoice', data.invoice._id).then(invoice => data.setPrinted(invoice));
|
||||
}
|
||||
|
||||
Template.billingInvoicePrint.events({
|
||||
'submit .js-billing-payment'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const payment = { date: form.elements.date.value, amount: parseFloat(form.elements.amount.value) };
|
||||
if (form.elements.method.value.trim()) payment.method = form.elements.method.value.trim();
|
||||
Meteor.callAsync('billingAddPayment', Template.currentData().invoice._id, payment).then(() => reloadInvoice())
|
||||
.catch(error => { form.querySelector('[name=amount]').setCustomValidity(errorText(error)); form.reportValidity(); });
|
||||
},
|
||||
'click .js-billing-remove-payment'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
Meteor.callAsync('billingRemovePayment', Template.currentData().invoice._id, evt.currentTarget.getAttribute('data-id')).then(() => reloadInvoice());
|
||||
},
|
||||
'click .js-billing-print-now'(evt) {
|
||||
evt.preventDefault();
|
||||
window.print();
|
||||
},
|
||||
'click .js-billing-print-close'(evt) {
|
||||
evt.preventDefault();
|
||||
Template.currentData().setPrinted(null);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,130 @@
|
||||
/* The ? of a feature place and its popup (featureHelp.jade,
|
||||
docs/Features/General/Help-Button.md).
|
||||
|
||||
Every rule here uses the LOGICAL side - inline-end, inline-start - so the ?
|
||||
that is at the right of a heading in English is at its left in Arabic or
|
||||
Hebrew, from the same rule and with nothing written twice. */
|
||||
|
||||
.feature-help-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
/* WCAG 2.2 target size: at least 24 by 24 CSS pixels. */
|
||||
min-width: 28px;
|
||||
min-height: 28px;
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
font-size: calc(18px * var(--wekan-ui-font-scale, 1));
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0.75;
|
||||
box-shadow: none;
|
||||
}
|
||||
.feature-help-btn:hover {
|
||||
opacity: 1;
|
||||
background: rgba(127, 127, 127, 0.18);
|
||||
}
|
||||
/* Keyboard focus is always visible. */
|
||||
.feature-help-btn:focus-visible {
|
||||
opacity: 1;
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.feature-help-btn i.fa {
|
||||
margin: 0;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
/* A heading with a ? at its end: a flex row, the ? pushed to the inline end. */
|
||||
.feature-help-title:has(> .feature-help-btn),
|
||||
.admin-pane-title:has(> .feature-help-btn),
|
||||
.sidebar-view-title:has(> .feature-help-btn) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.feature-help-title > .feature-help-btn,
|
||||
.admin-pane-title > .feature-help-btn,
|
||||
.sidebar-view-title > .feature-help-btn {
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
/* A card section's heading: the ? takes the far end, and the section's
|
||||
hamburger, which had it, follows the ? instead of splitting the space. */
|
||||
.card-details h3.card-details-item-title > .feature-help-btn {
|
||||
margin-inline-start: auto;
|
||||
font-size: calc(16px * var(--wekan-ui-font-scale, 1));
|
||||
}
|
||||
.card-details h3.card-details-item-title > .feature-help-btn ~ .card-details-section-menu {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
/* The Board View menu in the header bar: beside the view's button. */
|
||||
.board-header-btn + .feature-help-btn {
|
||||
margin-inline-start: 2px;
|
||||
}
|
||||
|
||||
/* A popup's title bar places its maximize and close buttons absolutely at its
|
||||
inline end (popup.css). The ? goes just before them - never over them -
|
||||
and the title gives up the room it takes. */
|
||||
.pop-over .header .feature-help-btn {
|
||||
position: absolute;
|
||||
top: calc(6px * var(--wekan-ui-font-scale, 1));
|
||||
inset-inline-end: 44px;
|
||||
}
|
||||
.pop-over .header:has(.popup-maximize-btn) .feature-help-btn {
|
||||
inset-inline-end: 76px;
|
||||
}
|
||||
.pop-over .header:has(.feature-help-btn) .header-title {
|
||||
margin-inline-end: 80px;
|
||||
}
|
||||
.pop-over .header:has(.feature-help-btn):has(.popup-maximize-btn) .header-title {
|
||||
margin-inline-end: 112px;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
/* The phone's popup header is the theme's colour with a larger close button. */
|
||||
.pop-over .header .feature-help-btn {
|
||||
top: calc(10px * var(--wekan-ui-font-scale, 1));
|
||||
inset-inline-end: 54px;
|
||||
color: #fff;
|
||||
}
|
||||
.pop-over .header:has(.popup-maximize-btn) .feature-help-btn {
|
||||
inset-inline-end: 86px;
|
||||
}
|
||||
.pop-over .header:has(.feature-help-btn) .header-title {
|
||||
margin-inline-end: 90px;
|
||||
}
|
||||
.pop-over .header:has(.feature-help-btn):has(.popup-maximize-btn) .header-title {
|
||||
margin-inline-end: 122px;
|
||||
}
|
||||
}
|
||||
|
||||
/* The popup itself is 720px wide on a desktop - popup.css, with the other
|
||||
wide popups, mirrored in client/lib/popupOffset.js WIDE_POPUP_WIDTHS; below
|
||||
801px every popup is a full-screen sheet. */
|
||||
.feature-help-content {
|
||||
padding-block-end: 8px;
|
||||
line-height: 1.5;
|
||||
text-align: start;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.feature-help-content .feature-help-heading {
|
||||
margin: 18px 0 6px;
|
||||
font-size: calc(22px * var(--wekan-ui-font-scale, 1));
|
||||
font-weight: bold;
|
||||
color: inherit;
|
||||
}
|
||||
.feature-help-content .feature-help-heading:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.feature-help-content .feature-help-text {
|
||||
margin: 0;
|
||||
font-size: calc(16px * var(--wekan-ui-font-scale, 1));
|
||||
color: inherit;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//- The ? of a feature place (docs/Features/General/Help-Button.md).
|
||||
//-
|
||||
//- `+featureHelp(id='workload')` with an id of models/lib/featureHelp.js. An id
|
||||
//- that is not there draws nothing, so a place whose help is chosen at run time
|
||||
//- (the open view, popup, pane or card section) passes whatever it has and gets
|
||||
//- a ? only when there is a help for it.
|
||||
//-
|
||||
//- A real button in the header's own row, after its title and before its other
|
||||
//- controls end the row; featureHelp.css puts it at the inline END, which is
|
||||
//- the right in a left-to-right page and the left in Arabic, from the same rule.
|
||||
template(name="featureHelp")
|
||||
if hasHelp
|
||||
button.feature-help-btn.js-open-feature-help(
|
||||
type="button"
|
||||
data-feature-help=id
|
||||
title="{{_ 'how-it-works'}}"
|
||||
aria-label="{{_ 'how-it-works'}}"
|
||||
aria-haspopup="dialog")
|
||||
i.fa.fa-question-circle(aria-hidden="true")
|
||||
|
||||
//- The texts as TEXT: double braces, never triple, so nothing in a translation
|
||||
//- can become markup. Title "How it works" comes from Popup's titleKey.
|
||||
template(name="featureHelpPopup")
|
||||
.feature-help-content(dir="auto" data-feature-help=id)
|
||||
h2.feature-help-heading {{_ 'what-it-is'}}
|
||||
p.feature-help-text {{_ whatKey}}
|
||||
h2.feature-help-heading {{_ 'how-it-works'}}
|
||||
p.feature-help-text {{_ howKey}}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
|
||||
// The ? of a feature place and its popup (docs/Features/General/Help-Button.md).
|
||||
// Which help a place shows is data: models/lib/featureHelp.js.
|
||||
const {
|
||||
featureHelp,
|
||||
hasFeature,
|
||||
boardViewHelpId,
|
||||
sidebarViewHelpId,
|
||||
popupHelpId,
|
||||
cardSectionHelpId,
|
||||
paneHelpId,
|
||||
} = require('/models/lib/featureHelp');
|
||||
|
||||
Template.featureHelp.helpers({
|
||||
hasHelp() {
|
||||
return hasFeature(this.id);
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureHelp.events({
|
||||
'click .js-open-feature-help'(event) {
|
||||
// The ? sits inside headings that do something on a click of their own -
|
||||
// a card section folds - and the click is for the ? alone.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const help = featureHelp(event.currentTarget.dataset.featureHelp);
|
||||
if (!help) return;
|
||||
// Titled "How it works" by the popup convention, featureHelpPopup-title.
|
||||
Popup.open('featureHelp', {
|
||||
dataContext: help,
|
||||
// A ? inside a popup opens its help as a sub-popup; Escape goes BACK to
|
||||
// that popup, where the button that opened the help gets the focus.
|
||||
returnFocusSelector: `.js-pop-over .js-open-feature-help[data-feature-help="${help.id}"]`,
|
||||
}).call(this, event);
|
||||
},
|
||||
});
|
||||
|
||||
// The places that show the help of whatever is open in them.
|
||||
Template.registerHelper('boardViewHelpId', view => boardViewHelpId(view));
|
||||
Template.registerHelper('sidebarViewHelpId', view => sidebarViewHelpId(view));
|
||||
Template.registerHelper('popupHelpId', popupName => popupHelpId(popupName));
|
||||
Template.registerHelper('cardSectionHelpId', section => cardSectionHelpId(section));
|
||||
Template.registerHelper('paneHelpId', paneId => paneHelpId(FlowRouter.getRouteName(), paneId));
|
||||
@@ -177,9 +177,11 @@ Template.header.helpers({
|
||||
return boardCreationAllowed();
|
||||
},
|
||||
|
||||
// The Admin Panel is four routes; its tabs show on all of them.
|
||||
// The Admin Panel is four routes; its tabs show on all of them - and on
|
||||
// Admin Panel / Cloud, which exists only where the server has CLOUD.
|
||||
isAdminPanel() {
|
||||
return ADMIN_PANEL_ROUTES.includes(FlowRouter.getRouteName());
|
||||
const route = FlowRouter.getRouteName();
|
||||
return ADMIN_PANEL_ROUTES.includes(route) || route === 'cloud-admin';
|
||||
},
|
||||
|
||||
// Whether to draw the hamburger at all. A page with no sidebar and nothing to
|
||||
|
||||
@@ -362,6 +362,9 @@
|
||||
@media screen and (min-width: 801px) {
|
||||
.pop-over[data-popup='changeColorPopup'],
|
||||
.pop-over[data-popup='boardChangeColorPopup'],
|
||||
/* The ? of a feature (featureHelp.css): two headings and their texts, read
|
||||
like a page rather than a menu. */
|
||||
.pop-over[data-popup='featureHelpPopup'],
|
||||
/* Stickers, for the same reason as the colours: the picker is a GRID, and
|
||||
width buys columns. At the default 380px it was eight icons per row and a
|
||||
hundred and fifty stickers made a column taller than the screen, so
|
||||
@@ -1409,12 +1412,15 @@ body.mobile-mode .pop-over .content-wrapper {
|
||||
@media screen and (min-width: 801px) {
|
||||
.pop-over.pop-over--menu-columns {
|
||||
position: fixed;
|
||||
width: min(960px, calc(100vw - 24px)) !important;
|
||||
/* 1200px: four 240px columns on a 1280px screen. At 960px the Board View
|
||||
menu, grouped under headings, needed a fourth column's worth of height
|
||||
and ran below a 720px-high window (popup-menu-columns.e2e.js). */
|
||||
width: min(1200px, calc(100vw - 24px)) !important;
|
||||
max-width: calc(100vw - 24px) !important;
|
||||
/* Logical, so RTL mirrors it; the value is symmetric, so both centre.
|
||||
inset-inline-end: auto is `right` in LTR and `left` in RTL, so it also
|
||||
overrides the inline left the popup placement code sets. */
|
||||
inset-inline-start: max(12px, calc((100vw - 960px) / 2)) !important;
|
||||
inset-inline-start: max(12px, calc((100vw - 1200px) / 2)) !important;
|
||||
inset-inline-end: auto !important;
|
||||
top: 12px !important;
|
||||
margin-top: 0;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { CSSEvents } from '/client/lib/cssEvents';
|
||||
import { isMobileViewportNow } from '/client/lib/responsiveUtils';
|
||||
import { trapTabKey } from '/client/lib/accessibility';
|
||||
import { keptInside } from '/client/lib/popupBounds';
|
||||
import { popupHelpId } from '/models/lib/featureHelp';
|
||||
|
||||
// Anchor the opposite edge while dragging the bottom inline-end corner.
|
||||
function resizeDatePopup(element, width, height) {
|
||||
@@ -74,6 +75,11 @@ Popup.template.helpers({
|
||||
popupMaximizable() {
|
||||
return MAXIMIZABLE_POPUPS.has(this.popupName);
|
||||
},
|
||||
// The ? of this popup's feature, in its title bar
|
||||
// (docs/Features/General/Help-Button.md): models/lib/featureHelp.js POPUP_HELP.
|
||||
popupHelp() {
|
||||
return popupHelpId(this.popupName);
|
||||
},
|
||||
popupMaximized() {
|
||||
return Template.instance().popupMaximized.get();
|
||||
},
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
span.popup-drag-handle.js-popup-drag-handle(title="{{_ 'drag-to-move'}}")
|
||||
i.fa.fa-arrows(aria-hidden="true")
|
||||
span.header-title= title
|
||||
//- The popup's ? (featureHelp.jade): after the title, before the maximize
|
||||
and close buttons, never on top of them.
|
||||
+featureHelp(id=popupHelp)
|
||||
if popupMaximizable
|
||||
if popupMaximized
|
||||
a.popup-maximize-btn.js-popup-minimize(href="#" role="button" title="{{_ 'minimize-window'}}" aria-label="{{_ 'minimize-window'}}")
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/* Workload page (docs/Features/Workload/Workload.md). */
|
||||
.workload-page {
|
||||
padding: 1rem;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.workload-intro {
|
||||
max-width: 70ch;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.workload-controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem 0.8rem;
|
||||
align-items: center;
|
||||
}
|
||||
.workload-controls input,
|
||||
.workload-controls select {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
.workload-legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.3rem 1rem;
|
||||
align-items: center;
|
||||
margin: 0.5rem 0 1rem;
|
||||
}
|
||||
.workload-swatch {
|
||||
display: inline-block;
|
||||
width: 1rem;
|
||||
height: 0.6rem;
|
||||
border-radius: 2px;
|
||||
margin-inline-end: 0.3rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/* The three states, the colours also used by the bars below. Over 100 % is
|
||||
red; under half full is grey-blue; in between green. */
|
||||
.workload-swatch.is-ok,
|
||||
.workload-cell.is-ok .workload-bar-fill { background: #3cb500; }
|
||||
.workload-swatch.is-under,
|
||||
.workload-cell.is-under .workload-bar-fill { background: #8ea6c0; }
|
||||
.workload-swatch.is-over,
|
||||
.workload-cell.is-over .workload-bar-fill { background: #e53935; }
|
||||
|
||||
.workload-table-wrapper {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.workload-table {
|
||||
border-collapse: collapse;
|
||||
min-width: 100%;
|
||||
}
|
||||
.workload-table th,
|
||||
.workload-table td {
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
padding: 0.35rem 0.45rem;
|
||||
vertical-align: top;
|
||||
text-align: start;
|
||||
}
|
||||
.workload-week-header span {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.workload-week-date {
|
||||
font-weight: normal;
|
||||
font-size: 0.85em;
|
||||
opacity: 0.75;
|
||||
}
|
||||
.workload-person {
|
||||
min-width: 10rem;
|
||||
}
|
||||
.workload-person-name {
|
||||
display: block;
|
||||
}
|
||||
.workload-person-capacity {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
font-size: 0.8em;
|
||||
opacity: 0.75;
|
||||
}
|
||||
.workload-cell {
|
||||
min-width: 7rem;
|
||||
}
|
||||
.workload-cell a {
|
||||
display: block;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.workload-cell.is-over {
|
||||
background: rgba(229, 57, 53, 0.1);
|
||||
}
|
||||
.workload-bar {
|
||||
height: 0.5rem;
|
||||
background: rgba(0, 0, 0, 0.08);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
.workload-bar-fill {
|
||||
height: 100%;
|
||||
}
|
||||
.workload-cell-value,
|
||||
.workload-cell-percent,
|
||||
.workload-cell-allocation,
|
||||
.workload-cell-absent,
|
||||
.workload-cell-holiday {
|
||||
display: block;
|
||||
font-size: 0.85em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.workload-cell.is-over .workload-cell-percent {
|
||||
color: #c62828;
|
||||
font-weight: bold;
|
||||
}
|
||||
.workload-cell.is-placeholder {
|
||||
background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.03) 6px, transparent 6px, transparent 12px);
|
||||
}
|
||||
.workload-unassigned th,
|
||||
.workload-placeholder th {
|
||||
font-style: italic;
|
||||
}
|
||||
.workload-overdue { color: #c62828; }
|
||||
.workload-card-list {
|
||||
margin: 0;
|
||||
padding-inline-start: 1.2rem;
|
||||
}
|
||||
.workload-card-hours {
|
||||
margin-inline-start: 0.5rem;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.workload-planning {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.workload-section {
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
border-radius: 4px;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
.workload-section h2 {
|
||||
margin-top: 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.workload-section label {
|
||||
display: block;
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
.workload-days {
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
.workload-days label {
|
||||
display: inline-block;
|
||||
margin-inline-end: 0.6rem;
|
||||
}
|
||||
.workload-list {
|
||||
padding-inline-start: 1.2rem;
|
||||
}
|
||||
.workload-list a {
|
||||
margin-inline-start: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.workload-saved {
|
||||
margin-inline-start: 0.5rem;
|
||||
color: #2e7d32;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.workload-page { padding: 0.5rem; }
|
||||
.workload-person { min-width: 7rem; }
|
||||
.workload-cell { min-width: 5.5rem; }
|
||||
}
|
||||
|
||||
/* Utilization and skills (docs/Features/Workload/Workload.md). */
|
||||
.workload-person-utilization,
|
||||
.workload-placeholder-skill,
|
||||
.workload-candidates {
|
||||
display: block;
|
||||
font-size: 0.8em;
|
||||
color: #555;
|
||||
}
|
||||
.workload-person-utilization.is-below {
|
||||
color: #b71c1c;
|
||||
}
|
||||
|
||||
/* Labelled native checkboxes: the app-wide material form rule
|
||||
(client/components/forms/forms.css) hides native checkboxes three ways -
|
||||
display, visibility, an offset - which left these with a label and no box
|
||||
to tick or see ticked. All three are undone, as in cardFlow.css. */
|
||||
.workload-page input[type="checkbox"] {
|
||||
display: inline-block;
|
||||
visibility: visible;
|
||||
position: static;
|
||||
inset-inline-start: auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-height: 0;
|
||||
margin: 0;
|
||||
margin-inline-end: 4px;
|
||||
flex: none;
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
//- Workload (docs/Features/Workload/Workload.md): week by week, how much work
|
||||
the people of the viewer's boards have against the hours they have, with
|
||||
their absences, the public holidays, allocations to boards and the roles a
|
||||
board will need before anybody is named. The numbers come from the server
|
||||
(server/workload.js, models/lib/workload.js); this page only draws them.
|
||||
|
||||
template(name="workloadControls")
|
||||
//- The controls of this page, a view of the shared page sidebar
|
||||
(models/lib/pageSidebar.js), like the Due Cards controls.
|
||||
.workload-controls
|
||||
label(for="workload-from") {{_ 'workload-from'}}
|
||||
input.js-workload-from#workload-from(type="date" value=fromDay)
|
||||
label(for="workload-weeks") {{_ 'workload-weeks'}}
|
||||
select.js-workload-weeks#workload-weeks
|
||||
each weekChoice in weekChoices
|
||||
option(value=weekChoice selected="{{#if $eq weekChoice weeks}}selected{{/if}}") {{weekChoice}}
|
||||
label(for="workload-unit") {{_ 'workload-show'}}
|
||||
select.js-workload-unit#workload-unit
|
||||
option(value="hours" selected="{{#if $eq unit 'hours'}}selected{{/if}}") {{_ 'hours'}}
|
||||
option(value="points" selected="{{#if $eq unit 'points'}}selected{{/if}}") {{_ 'workload-story-points'}}
|
||||
if reportIsAdmin
|
||||
label.workload-all-boards
|
||||
input.js-workload-all-boards(type="checkbox" checked=allBoards)
|
||||
| {{_ 'workload-all-boards'}}
|
||||
|
||||
template(name="workload")
|
||||
if currentUser
|
||||
.workload-page
|
||||
h1.feature-help-title
|
||||
| {{_ 'workload-title'}}
|
||||
+featureHelp(id='workload')
|
||||
p.workload-intro {{_ 'workload-intro'}}
|
||||
if loading
|
||||
+spinner
|
||||
else if error
|
||||
.warning {{error}}
|
||||
else
|
||||
if truncated
|
||||
p.warning {{_ 'workload-truncated'}}
|
||||
.workload-legend
|
||||
span.workload-swatch.is-ok
|
||||
| {{_ 'workload-legend-ok'}}
|
||||
span.workload-swatch.is-under
|
||||
| {{_ 'workload-legend-under'}}
|
||||
span.workload-swatch.is-over
|
||||
| {{_ 'workload-legend-over'}}
|
||||
.workload-table-wrapper
|
||||
table.workload-table
|
||||
thead
|
||||
tr
|
||||
th {{_ 'person'}}
|
||||
each week in weekHeaders
|
||||
th.workload-week-header
|
||||
span.workload-week-number {{_ 'workload-week-short' number=week.number}}
|
||||
span.workload-week-date {{week.label}}
|
||||
th {{_ 'workload-unscheduled'}}
|
||||
tbody
|
||||
each person in people
|
||||
tr.workload-row
|
||||
th.workload-person(scope="row")
|
||||
span.workload-person-name {{person.name}}
|
||||
span.workload-person-capacity {{capacityLabel person}}
|
||||
span.workload-person-utilization(class="{{#if person.belowTarget}}is-below{{/if}}" title="{{_ 'workload-utilization-title'}}")
|
||||
| {{_ 'workload-utilization' percent=(utilizationPercent person) hours=person.billableHours}}
|
||||
if isNumber person.capacity.utilizationTarget
|
||||
| / {{person.capacity.utilizationTarget}} %
|
||||
each cell in cells person
|
||||
td.workload-cell(class="{{cell.state}}")
|
||||
a.js-workload-cell(data-user=person.userId data-week=cell.index title=cell.title)
|
||||
.workload-bar
|
||||
.workload-bar-fill(style="width: {{cell.barWidth}}%")
|
||||
span.workload-cell-value {{cell.value}}
|
||||
if cell.percentLabel
|
||||
span.workload-cell-percent {{cell.percentLabel}}
|
||||
if cell.allocationPercent
|
||||
span.workload-cell-allocation(title="{{_ 'workload-allocated'}}")
|
||||
i.fa.fa-thumb-tack
|
||||
| {{cell.allocationPercent}} %
|
||||
if cell.absentDays
|
||||
span.workload-cell-absent(title="{{_ 'workload-absent-days'}}")
|
||||
i.fa.fa-plane
|
||||
| {{cell.absentDays}}
|
||||
if cell.holidayDays
|
||||
span.workload-cell-holiday(title="{{_ 'workload-holiday-days'}}")
|
||||
i.fa.fa-flag
|
||||
| {{cell.holidayDays}}
|
||||
td.workload-unscheduled-cell
|
||||
if person.unscheduledHours
|
||||
span {{hoursLabel person.unscheduledHours}}
|
||||
if person.unestimatedCards
|
||||
span.workload-unestimated(title="{{_ 'workload-unestimated'}}")
|
||||
i.fa.fa-question-circle
|
||||
| {{person.unestimatedCards}}
|
||||
if person.overdueCards
|
||||
span.workload-overdue(title="{{_ 'filter-overdue'}}")
|
||||
i.fa.fa-exclamation-triangle
|
||||
| {{person.overdueCards}}
|
||||
if isOpen person.userId
|
||||
tr.workload-details-row
|
||||
td(colspan=columnCount)
|
||||
+workloadCellCards(cards=openCards)
|
||||
if hasUnassigned
|
||||
tr.workload-row.workload-unassigned
|
||||
th(scope="row") {{_ 'workload-unassigned'}}
|
||||
each cell in unassignedCells
|
||||
td.workload-cell
|
||||
span.workload-cell-value {{cell.value}}
|
||||
td.workload-unscheduled-cell
|
||||
if unassignedUnscheduled
|
||||
span {{unassignedUnscheduled}}
|
||||
each holder in placeholders
|
||||
tr.workload-row.workload-placeholder
|
||||
th(scope="row")
|
||||
span.workload-person-name
|
||||
i.fa.fa-user-o
|
||||
| {{holder.roleName}} × {{holder.headcount}}
|
||||
span.workload-person-capacity {{holder.boardTitle}}
|
||||
if holder.skill
|
||||
span.workload-placeholder-skill
|
||||
i.fa.fa-graduation-cap
|
||||
| {{holder.skill}} ≥ {{holder.skillLevel}}
|
||||
if holder.candidates.length
|
||||
span.workload-candidates {{_ 'workload-candidates'}}: {{candidatesLabel holder}}
|
||||
else
|
||||
span.workload-candidates {{_ 'workload-no-candidates'}}
|
||||
each week in holder.weeks
|
||||
td.workload-cell.is-placeholder
|
||||
if week.allocationPercent
|
||||
span.workload-cell-value {{hoursLabel week.demandHours}}
|
||||
span.workload-cell-percent {{week.allocationPercent}} %
|
||||
td
|
||||
|
||||
+workloadPlanning(report=report)
|
||||
|
||||
template(name="workloadCellCards")
|
||||
if cards.length
|
||||
ul.workload-card-list
|
||||
each card in cards
|
||||
li
|
||||
a(href=card.url) {{card.title}}
|
||||
span.workload-card-hours {{card.label}}
|
||||
if card.overdue
|
||||
span.workload-overdue
|
||||
i.fa.fa-exclamation-triangle
|
||||
else
|
||||
p {{_ 'workload-no-cards'}}
|
||||
|
||||
template(name="workloadPlanning")
|
||||
.workload-planning
|
||||
section.workload-section
|
||||
h2 {{_ 'workload-my-capacity'}}
|
||||
form.js-workload-capacity
|
||||
label(for="workload-hours") {{_ 'workload-hours-per-week'}}
|
||||
input#workload-hours(type="number" name="hoursPerWeek" min="0" max="168" step="0.5" value=capacity.hoursPerWeek)
|
||||
label(for="workload-percent") {{_ 'workload-work-percent'}}
|
||||
input#workload-percent(type="number" name="workPercent" min="0" max="100" step="1" value=capacity.workPercent)
|
||||
fieldset.workload-days
|
||||
legend {{_ 'workload-working-days'}}
|
||||
each day in weekdays
|
||||
label
|
||||
input(type="checkbox" name="workingDays" value=day.value checked=day.checked)
|
||||
| {{day.label}}
|
||||
label(for="workload-skills") {{_ 'workload-skills'}}
|
||||
input#workload-skills(type="text" name="skills" maxlength="2000" value=skillsText placeholder="{{_ 'workload-skills-example'}}")
|
||||
label(for="workload-target") {{_ 'workload-utilization-target'}} %
|
||||
input#workload-target(type="number" name="utilizationTarget" min="0" max="100" step="1" value=capacity.utilizationTarget)
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
if capacitySaved
|
||||
span.workload-saved {{_ 'feature-saved'}}
|
||||
|
||||
section.workload-section
|
||||
h2 {{_ 'workload-my-absences'}}
|
||||
if myAbsences.length
|
||||
ul.workload-list
|
||||
each absence in myAbsences
|
||||
li
|
||||
| {{absence.start}} – {{absence.end}} · {{absenceTypeLabel absence.type}}
|
||||
if absence.note
|
||||
| · {{absence.note}}
|
||||
a.js-workload-remove-absence(data-id=absence._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
form.js-workload-absence
|
||||
label(for="workload-absence-start") {{_ 'start'}}
|
||||
input#workload-absence-start(type="date" name="start" required)
|
||||
label(for="workload-absence-end") {{_ 'card-end'}}
|
||||
input#workload-absence-end(type="date" name="end" required)
|
||||
label(for="workload-absence-type") {{_ 'workload-absence-type'}}
|
||||
select#workload-absence-type(name="type")
|
||||
each type in absenceTypes
|
||||
option(value=type.value) {{type.label}}
|
||||
label(for="workload-absence-note") {{_ 'workload-note'}}
|
||||
input#workload-absence-note(type="text" name="note" maxlength="200")
|
||||
button.primary(type="submit") {{_ 'workload-add-absence'}}
|
||||
|
||||
if managedBoards.length
|
||||
section.workload-section
|
||||
h2 {{_ 'workload-allocations'}}
|
||||
p {{_ 'workload-allocations-intro'}}
|
||||
if allocations.length
|
||||
ul.workload-list
|
||||
each allocation in allocations
|
||||
li
|
||||
| {{allocation.boardTitle}} · {{allocationWho allocation}} · {{allocation.percent}} % · {{allocation.start}} – {{allocation.end}}
|
||||
if allocation.mayRemove
|
||||
a.js-workload-remove-allocation(data-id=allocation._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
form.js-workload-allocation
|
||||
label(for="workload-allocation-board") {{_ 'board'}}
|
||||
select#workload-allocation-board.js-workload-allocation-board(name="boardId")
|
||||
each board in managedBoards
|
||||
option(value=board._id) {{board.title}}
|
||||
label(for="workload-allocation-person") {{_ 'person'}}
|
||||
select#workload-allocation-person(name="userId")
|
||||
option(value="") {{_ 'workload-role-placeholder'}}
|
||||
each member in allocationMembers
|
||||
option(value=member.userId) {{member.name}}
|
||||
label(for="workload-allocation-role") {{_ 'workload-role'}}
|
||||
input#workload-allocation-role(type="text" name="roleName" maxlength="100" placeholder="{{_ 'workload-role-example'}}")
|
||||
label(for="workload-allocation-headcount") {{_ 'workload-headcount'}}
|
||||
input#workload-allocation-headcount(type="number" name="headcount" min="1" max="100" value="1")
|
||||
label(for="workload-allocation-skill") {{_ 'workload-skill'}}
|
||||
input#workload-allocation-skill(type="text" name="skill" maxlength="50")
|
||||
label(for="workload-allocation-level") {{_ 'workload-skill-level'}}
|
||||
input#workload-allocation-level(type="number" name="skillLevel" min="1" max="5" value="1")
|
||||
label(for="workload-allocation-percent") {{_ 'workload-allocation-percent'}}
|
||||
input#workload-allocation-percent(type="number" name="percent" min="1" max="100" value="50" required)
|
||||
label(for="workload-allocation-start") {{_ 'start'}}
|
||||
input#workload-allocation-start(type="date" name="start" required)
|
||||
label(for="workload-allocation-end") {{_ 'card-end'}}
|
||||
input#workload-allocation-end(type="date" name="end" required)
|
||||
button.primary(type="submit") {{_ 'workload-add-allocation'}}
|
||||
|
||||
section.workload-section
|
||||
h2 {{_ 'workload-holidays'}}
|
||||
if holidays.length
|
||||
ul.workload-list
|
||||
each holiday in holidays
|
||||
li
|
||||
| {{holiday.date}}
|
||||
if holiday.name
|
||||
| · {{holiday.name}}
|
||||
if isAdmin
|
||||
a.js-workload-remove-holiday(data-id=holiday._id title="{{_ 'delete'}}" aria-label="{{_ 'delete'}}")
|
||||
i.fa.fa-trash
|
||||
else
|
||||
p {{_ 'workload-no-holidays'}}
|
||||
if isAdmin
|
||||
form.js-workload-holiday
|
||||
label(for="workload-holiday-date") {{_ 'date'}}
|
||||
input#workload-holiday-date(type="date" name="date" required)
|
||||
label(for="workload-holiday-name") {{_ 'workload-holiday-name'}}
|
||||
input#workload-holiday-name(type="text" name="name" maxlength="100")
|
||||
button.primary(type="submit") {{_ 'workload-add-holiday'}}
|
||||
|
||||
if planningError
|
||||
.warning {{planningError}}
|
||||
@@ -0,0 +1,336 @@
|
||||
// Workload page (docs/Features/Workload/Workload.md). It asks the server for a
|
||||
// report (Meteor method workloadReport, server/workload.js) and draws it; the
|
||||
// planning forms below the table write through the other workload* methods.
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { ReactiveDict } from 'meteor/reactive-dict';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
const { workloadCell, hoursLabel, isoWeekNumber } = require('/models/lib/workloadView');
|
||||
const { weekStart, dayKey, ABSENCE_TYPES, parseSkills, skillsText } = require('/models/lib/workload');
|
||||
|
||||
// The page state, shared by the sidebar controls and the page itself.
|
||||
const state = new ReactiveDict('workload');
|
||||
state.setDefault({
|
||||
from: weekStart(dayKey(new Date())),
|
||||
weeks: 8,
|
||||
unit: 'hours',
|
||||
allBoards: false,
|
||||
reloadAt: 0,
|
||||
});
|
||||
|
||||
const WEEK_CHOICES = [4, 8, 12, 26];
|
||||
|
||||
function t(key, options) {
|
||||
return TAPi18n.__(key, options);
|
||||
}
|
||||
|
||||
function errorText(error) {
|
||||
if (!error) return '';
|
||||
return (error.reason || error.message || String(error));
|
||||
}
|
||||
|
||||
function reload() {
|
||||
state.set('reloadAt', Date.now());
|
||||
}
|
||||
|
||||
Template.workloadControls.helpers({
|
||||
fromDay: () => state.get('from'),
|
||||
weeks: () => state.get('weeks'),
|
||||
weekChoices: () => WEEK_CHOICES,
|
||||
unit: () => state.get('unit'),
|
||||
allBoards: () => state.get('allBoards'),
|
||||
reportIsAdmin: () => state.get('isAdmin') === true,
|
||||
});
|
||||
|
||||
Template.workloadControls.events({
|
||||
'change .js-workload-from'(evt) {
|
||||
const value = evt.currentTarget.value;
|
||||
if (/^\d{4}-\d\d-\d\d$/.test(value)) state.set('from', weekStart(value));
|
||||
},
|
||||
'change .js-workload-weeks'(evt) {
|
||||
const value = parseInt(evt.currentTarget.value, 10);
|
||||
if (WEEK_CHOICES.includes(value)) state.set('weeks', value);
|
||||
},
|
||||
'change .js-workload-unit'(evt) {
|
||||
state.set('unit', evt.currentTarget.value === 'points' ? 'points' : 'hours');
|
||||
},
|
||||
'change .js-workload-all-boards'(evt) {
|
||||
state.set('allBoards', evt.currentTarget.checked === true);
|
||||
},
|
||||
});
|
||||
|
||||
Template.workload.onCreated(function () {
|
||||
this.report = new ReactiveVar(null);
|
||||
this.loading = new ReactiveVar(true);
|
||||
this.error = new ReactiveVar('');
|
||||
this.open = new ReactiveVar(null); // { userId, week }
|
||||
this.autorun(() => {
|
||||
const params = {
|
||||
from: state.get('from'),
|
||||
weeks: state.get('weeks'),
|
||||
allBoards: state.get('allBoards') === true,
|
||||
};
|
||||
state.get('reloadAt');
|
||||
this.loading.set(true);
|
||||
Meteor.callAsync('workloadReport', params).then(report => {
|
||||
this.report.set(report);
|
||||
state.set('isAdmin', report && report.isAdmin === true);
|
||||
this.error.set('');
|
||||
}).catch(error => {
|
||||
this.error.set(errorText(error));
|
||||
}).finally(() => this.loading.set(false));
|
||||
});
|
||||
});
|
||||
|
||||
function report() {
|
||||
return Template.instance().report.get();
|
||||
}
|
||||
|
||||
function boardOf(boardId) {
|
||||
const r = report();
|
||||
return (r && r.boards || []).find(b => b._id === boardId);
|
||||
}
|
||||
|
||||
function cardUrl(card) {
|
||||
const board = boardOf(card.boardId);
|
||||
return FlowRouter.path('card', { boardId: card.boardId, slug: (board && board.slug) || 'board', cardId: card.cardId });
|
||||
}
|
||||
|
||||
Template.workload.helpers({
|
||||
// The spinner only until the first report: a refresh after a save keeps the
|
||||
// page, because the spinner replaces the planning form under it - which
|
||||
// lost its "saved" note and anything still typed there.
|
||||
loading() {
|
||||
const tpl = Template.instance();
|
||||
return tpl.loading.get() && !tpl.report.get();
|
||||
},
|
||||
error: () => Template.instance().error.get(),
|
||||
report: () => report(),
|
||||
truncated: () => !!(report() && report().truncated),
|
||||
people: () => (report() ? report().people : []),
|
||||
placeholders() {
|
||||
const r = report();
|
||||
if (!r) return [];
|
||||
return r.placeholders.map(p => ({ ...p, boardTitle: (boardOf(p.boardId) || {}).title || '' }));
|
||||
},
|
||||
weekHeaders() {
|
||||
const r = report();
|
||||
if (!r) return [];
|
||||
return r.weeks.map(day => ({ number: isoWeekNumber(day), label: day.slice(5).split('-').reverse().join('.') }));
|
||||
},
|
||||
columnCount() {
|
||||
const r = report();
|
||||
return r ? r.weeks.length + 2 : 2;
|
||||
},
|
||||
isNumber: value => typeof value === 'number',
|
||||
utilizationPercent: person => (typeof person.billablePercent === 'number' ? person.billablePercent : 0),
|
||||
candidatesLabel(holder) {
|
||||
const r = report();
|
||||
const names = new Map((r ? r.people : []).map(p => [p.userId, p.name || p.username || p.userId]));
|
||||
return holder.candidates.map(c => `${names.get(c.userId) || c.userId} (${c.level}, ${hoursLabel(c.freeHours, t('workload-hours-short'))})`).join(', ');
|
||||
},
|
||||
capacityLabel(person) {
|
||||
const c = person.capacity;
|
||||
return t('workload-capacity-label', { hours: c.hoursPerWeek, percent: c.workPercent });
|
||||
},
|
||||
hoursLabel(hours) {
|
||||
return hoursLabel(hours, t('workload-hours-short'));
|
||||
},
|
||||
cells(person) {
|
||||
const unit = state.get('unit');
|
||||
const words = { hours: t('workload-hours-short'), points: t('workload-points-short') };
|
||||
return person.weeks.map((week, index) => {
|
||||
const cell = workloadCell(week, unit, words);
|
||||
const parts = [cell.value];
|
||||
if (cell.percentLabel) parts.push(cell.percentLabel);
|
||||
if (week.overloaded) parts.push(t('workload-overloaded'));
|
||||
return { ...cell, index, title: parts.join(' · ') };
|
||||
});
|
||||
},
|
||||
isOpen(userId) {
|
||||
const open = Template.instance().open.get();
|
||||
return !!(open && open.userId === userId);
|
||||
},
|
||||
openCards() {
|
||||
const open = Template.instance().open.get();
|
||||
const person = open && (report() ? report().people : []).find(p => p.userId === open.userId);
|
||||
const week = person && person.weeks[open.week];
|
||||
if (!week) return [];
|
||||
const unit = state.get('unit');
|
||||
return week.cards.map(card => ({
|
||||
...card,
|
||||
url: cardUrl(card),
|
||||
label: unit === 'points' ? `${card.points} ${t('workload-points-short')}` : hoursLabel(card.hours, t('workload-hours-short')),
|
||||
}));
|
||||
},
|
||||
hasUnassigned() {
|
||||
const r = report();
|
||||
return !!(r && (r.unassigned.unscheduledHours || r.unassigned.weeks.some(w => w.loadHours || w.loadPoints)));
|
||||
},
|
||||
unassignedCells() {
|
||||
const r = report();
|
||||
const unit = state.get('unit');
|
||||
if (!r) return [];
|
||||
return r.unassigned.weeks.map(w => ({
|
||||
value: unit === 'points' ? `${w.loadPoints} ${t('workload-points-short')}` : hoursLabel(w.loadHours, t('workload-hours-short')),
|
||||
}));
|
||||
},
|
||||
unassignedUnscheduled() {
|
||||
const r = report();
|
||||
return r && r.unassigned.unscheduledHours ? hoursLabel(r.unassigned.unscheduledHours, t('workload-hours-short')) : '';
|
||||
},
|
||||
});
|
||||
|
||||
Template.workload.events({
|
||||
'click .js-workload-cell'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const userId = evt.currentTarget.getAttribute('data-user');
|
||||
const week = parseInt(evt.currentTarget.getAttribute('data-week'), 10);
|
||||
const open = tpl.open.get();
|
||||
tpl.open.set(open && open.userId === userId && open.week === week ? null : { userId, week });
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- planning
|
||||
|
||||
Template.workloadPlanning.onCreated(function () {
|
||||
this.mine = new ReactiveVar(null);
|
||||
this.saved = new ReactiveVar(false);
|
||||
this.error = new ReactiveVar('');
|
||||
this.allocationBoard = new ReactiveVar(null);
|
||||
this.loadMine = () => Meteor.callAsync('workloadMine').then(mine => this.mine.set(mine))
|
||||
.catch(error => this.error.set(errorText(error)));
|
||||
this.loadMine();
|
||||
this.done = promise => promise.then(() => {
|
||||
this.error.set('');
|
||||
this.loadMine();
|
||||
reload();
|
||||
}).catch(error => this.error.set(errorText(error)));
|
||||
});
|
||||
|
||||
function mine() {
|
||||
return Template.instance().mine.get();
|
||||
}
|
||||
|
||||
Template.workloadPlanning.helpers({
|
||||
capacity: () => (mine() ? mine().capacity : { hoursPerWeek: 37.5, workPercent: 100, workingDays: [1, 2, 3, 4, 5] }),
|
||||
skillsText: () => skillsText(mine() ? mine().capacity.skills : []),
|
||||
capacitySaved: () => Template.instance().saved.get(),
|
||||
weekdays() {
|
||||
const days = mine() ? mine().capacity.workingDays : [1, 2, 3, 4, 5];
|
||||
// 2024-01-01 was a Monday: the names come from the browser, in its language.
|
||||
const lang = TAPi18n.getLanguage ? TAPi18n.getLanguage() : undefined;
|
||||
return [1, 2, 3, 4, 5, 6, 7].map(value => {
|
||||
let label = String(value);
|
||||
try { label = new Date(Date.UTC(2024, 0, value)).toLocaleDateString(lang, { weekday: 'short', timeZone: 'UTC' }); } catch (e) { /* keep the number */ }
|
||||
return { value, label, checked: days.includes(value) };
|
||||
});
|
||||
},
|
||||
myAbsences: () => (mine() ? mine().absences : []),
|
||||
absenceTypes: () => ABSENCE_TYPES.map(value => ({ value, label: t(`workload-absence-${value}`) })),
|
||||
absenceTypeLabel: type => t(`workload-absence-${type}`),
|
||||
holidays: () => (mine() ? mine().holidays : []),
|
||||
isAdmin: () => !!(mine() && mine().isAdmin),
|
||||
managedBoards() {
|
||||
const r = Template.currentData().report;
|
||||
return r ? r.boards.filter(b => b.mayManage) : [];
|
||||
},
|
||||
allocations() {
|
||||
const r = Template.currentData().report;
|
||||
return r ? r.allocations : [];
|
||||
},
|
||||
allocationMembers() {
|
||||
const r = Template.currentData().report;
|
||||
if (!r) return [];
|
||||
const boards = r.boards.filter(b => b.mayManage);
|
||||
const chosen = Template.instance().allocationBoard.get();
|
||||
const board = boards.find(b => b._id === chosen) || boards[0];
|
||||
if (!board) return [];
|
||||
const names = new Map(r.people.map(p => [p.userId, p.name || p.username || p.userId]));
|
||||
return board.members.map(userId => ({ userId, name: names.get(userId) || userId }));
|
||||
},
|
||||
allocationWho(allocation) {
|
||||
if (allocation.userId) {
|
||||
const r = Template.currentData().report;
|
||||
const person = r && r.people.find(p => p.userId === allocation.userId);
|
||||
return person ? (person.name || person.username) : allocation.userId;
|
||||
}
|
||||
return `${allocation.roleName} × ${allocation.headcount}`;
|
||||
},
|
||||
planningError: () => Template.instance().error.get(),
|
||||
});
|
||||
|
||||
function formValue(form, name) {
|
||||
const field = form.elements[name];
|
||||
return field ? String(field.value).trim() : '';
|
||||
}
|
||||
|
||||
Template.workloadPlanning.events({
|
||||
'submit .js-workload-capacity'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const workingDays = [...form.querySelectorAll('input[name="workingDays"]:checked')].map(i => parseInt(i.value, 10));
|
||||
tpl.saved.set(false);
|
||||
const capacity = {
|
||||
hoursPerWeek: parseFloat(formValue(form, 'hoursPerWeek')),
|
||||
workPercent: parseFloat(formValue(form, 'workPercent')),
|
||||
workingDays,
|
||||
skills: parseSkills(formValue(form, 'skills')),
|
||||
};
|
||||
if (formValue(form, 'utilizationTarget')) capacity.utilizationTarget = parseFloat(formValue(form, 'utilizationTarget'));
|
||||
tpl.done(Meteor.callAsync('workloadSetCapacity', capacity).then(() => tpl.saved.set(true)));
|
||||
},
|
||||
'submit .js-workload-absence'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
tpl.done(Meteor.callAsync('workloadAddAbsence', {
|
||||
start: formValue(form, 'start'),
|
||||
end: formValue(form, 'end') || formValue(form, 'start'),
|
||||
type: formValue(form, 'type'),
|
||||
note: formValue(form, 'note'),
|
||||
}).then(() => form.reset()));
|
||||
},
|
||||
'click .js-workload-remove-absence'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('workloadRemoveAbsence', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
'change .js-workload-allocation-board'(evt, tpl) {
|
||||
tpl.allocationBoard.set(evt.currentTarget.value);
|
||||
},
|
||||
'submit .js-workload-allocation'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
const userId = formValue(form, 'userId');
|
||||
const allocation = {
|
||||
start: formValue(form, 'start'),
|
||||
end: formValue(form, 'end'),
|
||||
percent: parseFloat(formValue(form, 'percent')),
|
||||
};
|
||||
if (userId) allocation.userId = userId;
|
||||
else {
|
||||
allocation.roleName = formValue(form, 'roleName');
|
||||
allocation.headcount = parseInt(formValue(form, 'headcount'), 10) || 1;
|
||||
}
|
||||
if (formValue(form, 'skill')) {
|
||||
allocation.skill = formValue(form, 'skill');
|
||||
allocation.skillLevel = parseInt(formValue(form, 'skillLevel'), 10) || 1;
|
||||
}
|
||||
tpl.done(Meteor.callAsync('workloadAddAllocation', formValue(form, 'boardId'), allocation));
|
||||
},
|
||||
'click .js-workload-remove-allocation'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('workloadRemoveAllocation', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
'submit .js-workload-holiday'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const form = evt.currentTarget;
|
||||
tpl.done(Meteor.callAsync('workloadAddHoliday', { date: formValue(form, 'date'), name: formValue(form, 'name') })
|
||||
.then(() => form.reset()));
|
||||
},
|
||||
'click .js-workload-remove-holiday'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
tpl.done(Meteor.callAsync('workloadRemoveHoliday', evt.currentTarget.getAttribute('data-id')));
|
||||
},
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import { Utils } from '/client/lib/utils';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { saveRuleTriggerAction } from '/client/components/rules/rulesSaveHelper';
|
||||
import { RULE_ACTING_USER_SENTINEL } from '/models/lib/ruleActingUser';
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
|
||||
let cardColors;
|
||||
Meteor.startup(() => {
|
||||
@@ -21,7 +22,9 @@ Template.cardActions.onCreated(function () {
|
||||
|
||||
Template.cardActions.helpers({
|
||||
// This board's bots (Board Settings / Bots), for "Dispatch to bot".
|
||||
// None while all webhooks are turned off (client/lib/webhooksSwitch.js).
|
||||
boardBots() {
|
||||
if (webhooksOff()) return [];
|
||||
return ReactiveCache.getIntegrations({ boardId: Session.get('currentBoard'), bot: true }) || [];
|
||||
},
|
||||
cardColorButton() {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
template(name="rulesList")
|
||||
.rules(class=currentBoard.colorClass)
|
||||
h2
|
||||
h2.feature-help-title
|
||||
i.fa.fa-magic
|
||||
| {{_ 'r-board-rules' }}
|
||||
+featureHelp(id='rules')
|
||||
|
||||
//- #2217: a board admin shows this board's Rules to its members, read-only,
|
||||
when Admin Panel / Settings / Visibility allows it.
|
||||
|
||||
@@ -2,6 +2,7 @@ import { currentRulesAccess } from '/client/lib/rulesAccess';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { Utils } from '/client/lib/utils';
|
||||
import { triggerValueHasVars } from '/models/lib/ruleTriggerVars';
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
|
||||
Template.rulesMain.onCreated(function () {
|
||||
this.rulesCurrentTab = new ReactiveVar('rulesList');
|
||||
@@ -72,7 +73,10 @@ Template.rulesMain.helpers({
|
||||
return Session.get('rulesViewMode') === 'workflow';
|
||||
},
|
||||
// Board Settings / Bots: the alternative workflow view for bots.
|
||||
isBotsView() { return Session.get('rulesViewMode') === 'bots'; },
|
||||
// Not while all webhooks are turned off: a bot is a webhook.
|
||||
isBotsView() {
|
||||
return Session.get('rulesViewMode') === 'bots' && !webhooksOff();
|
||||
},
|
||||
});
|
||||
|
||||
function sanitizeObject(obj) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/* Admin Panel / Settings / Privacy and security / Allowed addresses. */
|
||||
.admin-panel-addresses textarea {
|
||||
width: 100%;
|
||||
max-width: 40em;
|
||||
font-family: monospace;
|
||||
}
|
||||
.admin-panel-addresses .warning,
|
||||
.admin-panel-address-refused {
|
||||
color: #b00020;
|
||||
}
|
||||
.admin-panel-address-refused {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
padding: 0 0.6em;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//- Admin Panel / Settings / Privacy and security / Allowed addresses
|
||||
(models/lib/adminPanelAddresses.js, server/adminPanelAddresses.js): from
|
||||
any other address the Admin Panel and the admin REST API refuse, and a site
|
||||
administrator there is a member like any other. The server refuses a list
|
||||
without the saver's own address, and the page says so before it is sent.
|
||||
template(name="adminPanelAllowedAddresses")
|
||||
form.js-admin-panel-addresses.admin-panel-addresses
|
||||
h2.admin-pane-group-title {{_ 'cloud-allowed-addresses'}}
|
||||
p.description {{_ 'admin-panel-allowed-addresses-desc'}}
|
||||
if fromEnvironment
|
||||
p.warning.js-admin-panel-addresses-env {{_ 'admin-panel-allowed-addresses-env'}}
|
||||
textarea.wekan-form-control.js-admin-panel-addresses-text(name="addresses" rows="5" maxlength="12000" placeholder="203.0.113.0/24 2001:db8::/32" aria-label="{{_ 'cloud-allowed-addresses'}}")= addressesText
|
||||
p.quiet.js-admin-panel-your-address {{_ 'cloud-allowed-addresses-yours' address=yourAddress}}
|
||||
if lockout
|
||||
p.warning.js-admin-panel-addresses-lockout {{_ 'cloud-allowed-addresses-lockout' address=yourAddress}}
|
||||
button.primary(type="submit") {{_ 'save'}}
|
||||
span.js-admin-panel-addresses-status= status
|
||||
|
||||
//- Shown in the Admin Panel's tabs to a site administrator at an address the
|
||||
list does not have: the panes are empty there, and this says why.
|
||||
template(name="adminPanelAddressRefused")
|
||||
if refused
|
||||
span.admin-panel-address-refused.js-admin-panel-address-refused
|
||||
i.fa.fa-shield
|
||||
| {{_ 'admin-panel-address-refused' address=yourAddress}}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Admin Panel / Settings / Privacy and security / Allowed addresses
|
||||
// (models/lib/adminPanelAddresses.js). The list is read and saved through
|
||||
// site-admin methods, never published: it describes the admins' network.
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
|
||||
const { normalizeAllowedAddresses, addressAllowed } = require('/models/lib/adminPanelAddresses');
|
||||
|
||||
// Would this list lock the saver out? The rule the server applies when it
|
||||
// refuses to save it.
|
||||
function locksOut(text, yourAddress) {
|
||||
let list;
|
||||
try { list = normalizeAllowedAddresses(text); } catch (e) { return false; }
|
||||
return list.length > 0 && !addressAllowed(yourAddress, list);
|
||||
}
|
||||
|
||||
Template.adminPanelAllowedAddresses.onCreated(function () {
|
||||
this.config = new ReactiveVar({ addresses: [], source: 'settings', yourAddress: '' });
|
||||
this.text = new ReactiveVar(null);
|
||||
this.status = new ReactiveVar('');
|
||||
Meteor.call('getAdminPanelAllowedAddresses', (error, config) => {
|
||||
if (!error && config) this.config.set(config);
|
||||
});
|
||||
});
|
||||
|
||||
Template.adminPanelAllowedAddresses.helpers({
|
||||
addressesText() { return (Template.instance().config.get().addresses || []).join('\n'); },
|
||||
yourAddress() { return Template.instance().config.get().yourAddress || ''; },
|
||||
fromEnvironment() { return Template.instance().config.get().source !== 'settings'; },
|
||||
lockout() {
|
||||
const tpl = Template.instance();
|
||||
const text = tpl.text.get();
|
||||
return text !== null && locksOut(text, tpl.config.get().yourAddress);
|
||||
},
|
||||
status() { return Template.instance().status.get(); },
|
||||
});
|
||||
|
||||
Template.adminPanelAllowedAddresses.events({
|
||||
'input .js-admin-panel-addresses-text'(event, tpl) {
|
||||
tpl.status.set('');
|
||||
tpl.text.set(event.currentTarget.value);
|
||||
},
|
||||
'submit .js-admin-panel-addresses'(event, tpl) {
|
||||
event.preventDefault();
|
||||
const value = String(event.currentTarget.elements.addresses.value || '');
|
||||
Meteor.call('saveAdminPanelAllowedAddresses', value, (error, result) => {
|
||||
if (error) {
|
||||
tpl.status.set(error.error === 'admin-panel-address-lockout'
|
||||
? TAPi18n.__('cloud-allowed-addresses-lockout', { address: tpl.config.get().yourAddress })
|
||||
: (error.reason || error.message));
|
||||
return;
|
||||
}
|
||||
tpl.config.set({ ...tpl.config.get(), addresses: result.addresses });
|
||||
tpl.text.set(null);
|
||||
tpl.status.set(TAPi18n.__('feature-saved'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Template.adminPanelAddressRefused.onCreated(function () {
|
||||
this.state = new ReactiveVar({ refused: false });
|
||||
Meteor.call('adminPanelAddressStatus', (error, state) => {
|
||||
if (!error && state) this.state.set(state);
|
||||
});
|
||||
});
|
||||
|
||||
Template.adminPanelAddressRefused.helpers({
|
||||
refused() { return Template.instance().state.get().refused === true; },
|
||||
yourAddress() { return Template.instance().state.get().yourAddress || ''; },
|
||||
});
|
||||
@@ -54,6 +54,8 @@ template(name="adminProblems")
|
||||
+officeReport
|
||||
else if isPane 'report-password-length'
|
||||
+passwordLengthReport
|
||||
else if isPane 'report-webhooks'
|
||||
+webhooksReport
|
||||
else if tablePageData
|
||||
+tablePage(tablePageData)
|
||||
|
||||
@@ -145,6 +147,8 @@ template(name="featuresPerformance")
|
||||
//- Admin Panel / Settings / Security (moved from Problems on 2026-11-19).
|
||||
template(name="featuresSecurity")
|
||||
ul.setting-detail
|
||||
li
|
||||
+adminPanelAllowedAddresses
|
||||
li
|
||||
a.flex.js-toggle-render-links-as-plain-text
|
||||
.materialCheckBox(class="{{#if renderLinksAsPlainText}}is-checked{{/if}}")
|
||||
|
||||
@@ -326,6 +326,9 @@ const PROBLEMS_MENU = [
|
||||
{ id: 'report-broken', icon: 'fa-chain-broken', labelKey: 'broken-cards' },
|
||||
{ id: 'report-files', icon: 'fa-paperclip', labelKey: 'filesReportTitle' },
|
||||
{ id: 'report-rules', icon: 'fa-magic', labelKey: 'rulesReportTitle' },
|
||||
// Every webhook, its board or Global, who added it and what it sends
|
||||
// (webhooksReport.js). Tokens are never shown.
|
||||
{ id: 'report-webhooks', icon: 'fa-globe', labelKey: 'webhooks-report-title' },
|
||||
{ id: 'report-boards', icon: 'fa-columns', labelKey: 'boardsReportTitle' },
|
||||
{ id: 'report-cards', icon: 'fa-id-card-o', labelKey: 'cardsReportTitle' },
|
||||
{ id: 'report-recovery', icon: 'fa-medkit', labelKey: 'recoveryReportTitle' },
|
||||
@@ -534,6 +537,8 @@ const SELF_LOADING_PANES = [
|
||||
'report-database', 'report-integrity', 'report-office', 'report-api', 'report-mail',
|
||||
// passwordLengthReport.js loads its own rows and settings through methods.
|
||||
'report-password-length',
|
||||
// webhooksReport.js loads its rows through the webhooksReportPage method.
|
||||
'report-webhooks',
|
||||
];
|
||||
|
||||
function openReportPane(tmpl, targetID) {
|
||||
|
||||
@@ -90,14 +90,21 @@ template(name="leftMenuResize")
|
||||
//- nothing left to unfold it.
|
||||
//-
|
||||
//- Data context: { titleKey } or { label } from paneTitle().
|
||||
//- The ? of the open pane is at the inline end of the title (featureHelp.css),
|
||||
//- chosen from the page and the pane: models/lib/featureHelp.js paneHelpId.
|
||||
template(name="paneTitle")
|
||||
if isLeftMenuCollapsed
|
||||
h1.admin-pane-title.admin-pane-title-folded
|
||||
+leftMenuCollapse(paneTitleKey=titleKey paneLabel=label)
|
||||
+featureHelp(id=paneHelp)
|
||||
else if titleKey
|
||||
h1.admin-pane-title {{_ titleKey}}
|
||||
h1.admin-pane-title
|
||||
| {{_ titleKey}}
|
||||
+featureHelp(id=paneHelp)
|
||||
else if label
|
||||
h1.admin-pane-title {{label}}
|
||||
h1.admin-pane-title
|
||||
| {{label}}
|
||||
+featureHelp(id=paneHelp)
|
||||
|
||||
//- The caret that folds the menu away.
|
||||
//-
|
||||
|
||||
@@ -3,6 +3,9 @@ import { Template } from 'meteor/templating';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { Utils } from '/client/lib/utils';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
|
||||
const { paneHelpId } = require('/models/lib/featureHelp');
|
||||
|
||||
// Collapsing the left menu, for both pages that have one.
|
||||
//
|
||||
@@ -28,6 +31,15 @@ import { Utils } from '/client/lib/utils';
|
||||
|
||||
Template.registerHelper('isLeftMenuCollapsed', () => Utils.getLeftMenuCollapseState());
|
||||
|
||||
// The ? of the open pane (docs/Features/General/Help-Button.md): its help
|
||||
// depends on the page and on the open menu entry, which paneTitle() passes as
|
||||
// `paneId`.
|
||||
Template.paneTitle.helpers({
|
||||
paneHelp() {
|
||||
return paneHelpId(FlowRouter.getRouteName(), this && this.paneId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.leftMenuCollapse.helpers({
|
||||
// What the control DOES, for the tooltip and for a screen reader - the same
|
||||
// two words a list's caret uses.
|
||||
|
||||
@@ -48,9 +48,10 @@ template(name="notificationSettingsPopup")
|
||||
a.flex.js-due-reminder-off(role="checkbox" aria-checked="{{#if dueRemindersOff}}true{{else}}false{{/if}}")
|
||||
.materialCheckBox(class="{{#if dueRemindersOff}}is-checked{{/if}}")
|
||||
span {{_ 'due-reminder-off'}}
|
||||
a.flex.js-due-reminder-webhook(role="checkbox" aria-checked="{{#if dueReminderWebhook}}true{{else}}false{{/if}}")
|
||||
.materialCheckBox(class="{{#if dueReminderWebhook}}is-checked{{/if}}")
|
||||
span {{_ 'due-reminder-webhook'}}
|
||||
unless webhooksOff
|
||||
a.flex.js-due-reminder-webhook(role="checkbox" aria-checked="{{#if dueReminderWebhook}}true{{else}}false{{/if}}")
|
||||
.materialCheckBox(class="{{#if dueReminderWebhook}}is-checked{{/if}}")
|
||||
span {{_ 'due-reminder-webhook'}}
|
||||
if dueReminderMessage
|
||||
p.quiet.js-due-reminder-message {{dueReminderMessage}}
|
||||
button.primary.js-due-reminder-save(type="submit") {{_ 'save'}}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { parseDueReminderInput } from '/models/lib/dueNotificationConfig';
|
||||
import { GROUP_KEYS, cleanMutedGroups } from '/models/lib/notificationActivityGroups';
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
|
||||
// The 3-tier Notification Settings popup (see notificationSettingsPopup.jade
|
||||
// and models/lib/notificationSettings.js). `this.data().scope` is one of
|
||||
@@ -95,8 +96,10 @@ Template.notificationSettingsPopup.helpers({
|
||||
deliveryTargetId() {
|
||||
return Template.instance().data.scope === 'board' ? Utils.getCurrentBoardId() : null;
|
||||
},
|
||||
// The webhook channel is hidden while all webhooks are turned off.
|
||||
deliveryChannels() {
|
||||
return ['email', 'tray', 'webhook'].map(channel => ({ channel }));
|
||||
const off = webhooksOff();
|
||||
return ['email', 'tray', 'webhook'].filter(channel => !off || channel !== 'webhook').map(channel => ({ channel }));
|
||||
},
|
||||
// #572: every kind of card activity, ticked unless this member muted it.
|
||||
isMemberScope() {
|
||||
|
||||
@@ -549,6 +549,9 @@ function peopleMenu(user) {
|
||||
// with, so it belongs beside the e-mail settings rather than at the end of
|
||||
// the menu, after the roles and template checkbox lists.
|
||||
{ id: 'domains-setting', icon: 'fa-at', labelKey: 'domains' },
|
||||
// No Cloud entry: the Cloud Panel's domain is the server's CLOUD
|
||||
// environment variable, never a setting here, and the panel itself is
|
||||
// Admin Panel / Cloud (docs/Features/Admin-Panel/Cloud-Panel.md).
|
||||
{ id: 'org-setting', icon: 'fa-globe', labelKey: 'organizations' },
|
||||
{ id: 'team-setting', icon: 'fa-users', labelKey: 'teams' },
|
||||
{ id: 'people-setting', icon: 'fa-user', labelKey: 'people' },
|
||||
|
||||
@@ -49,7 +49,12 @@ template(name="setting")
|
||||
else if isLayoutSetting
|
||||
+pwaSettings
|
||||
else if isWebhookSetting
|
||||
+webhookSettings
|
||||
//- Its menu entry is hidden while all webhooks are turned off; an
|
||||
old link to it says why instead of showing the forms.
|
||||
if webhooksOff
|
||||
p.quiet.js-webhooks-off-notice {{_ 'webhooks-disabled'}}
|
||||
else
|
||||
+webhookSettings
|
||||
else if isSharedLabelsSetting
|
||||
+sharedLabelsSettings
|
||||
|
||||
@@ -402,6 +407,14 @@ template(name='tableVisibilityModeSettings')
|
||||
.materialCheckBox#activity-pub-enabled(class="{{#if currentSetting.activityPubEnabled}}is-checked{{/if}}")
|
||||
span {{_ 'activity-pub-enabled'}}
|
||||
.feature-desc {{_ 'activity-pub-desc'}}
|
||||
//- Turn off all webhooks (models/lib/webhooksSwitch.js): hides every
|
||||
webhook screen, and the server sends no webhook and refuses to add
|
||||
or change one. Saved as soon as it is switched; nothing is deleted.
|
||||
li.tableVisibilityMode-form
|
||||
a.flex.js-toggle-webhooks-off
|
||||
.materialCheckBox#webhooks-off(class="{{#if webhooksOff}}is-checked{{/if}}")
|
||||
span {{_ 'webhooks-off'}}
|
||||
.feature-desc {{_ 'webhooks-off-desc'}}
|
||||
|
||||
li.admin-pane-group-separator
|
||||
hr
|
||||
@@ -556,6 +569,19 @@ template(name='tableVisibilityModeSettings')
|
||||
button.js-visibility-date-save.primary {{_ 'save'}}
|
||||
li.admin-pane-group-separator
|
||||
hr
|
||||
//- #6939: the width every card details window opens at, in percent of the
|
||||
browser window, until a user drags their own (models/lib/cardDetailsWidth.js).
|
||||
li
|
||||
h2.admin-pane-group-title {{_ 'card-details-default-width'}}
|
||||
li.tableVisibilityMode-form
|
||||
.feature-desc {{_ 'card-details-default-width-desc'}}
|
||||
.form-group
|
||||
input.wekan-form-control#card-details-default-width-percent(type="number" min="30" max="95" step="1" placeholder="520px" value="{{currentSetting.cardDetailsDefaultWidthPercent}}" aria-label="{{_ 'card-details-default-width'}}")
|
||||
li
|
||||
button.js-visibility-card-width-save.primary {{_ 'save'}}
|
||||
span.js-visibility-card-width-status(role="status" aria-live="polite")
|
||||
li.admin-pane-group-separator
|
||||
hr
|
||||
li
|
||||
h2.admin-pane-group-title {{_ 'settings-group-url'}}
|
||||
li
|
||||
|
||||
@@ -17,6 +17,8 @@ import { adminPath } from '/models/lib/adminUrls';
|
||||
import TableVisibilityModeSettings from '/models/tableVisibilityModeSettings';
|
||||
import { format } from '/imports/lib/dateUtils';
|
||||
import { errorMessage } from '/client/lib/errorMessage';
|
||||
// Registers {{webhooksOff}}: Features / Turn off all webhooks, Global Webhooks.
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
const { ALL_MAIL_SERVICES, mailServiceStorageKey } = require('/models/lib/mailServices');
|
||||
const instanceFeatures = require('/models/lib/instanceFeatures');
|
||||
const { cardFieldRows } = require('/models/lib/cardFieldVisibility');
|
||||
@@ -251,6 +253,11 @@ function settingsMenu(user) {
|
||||
// #2761, #4698: shared label catalogs.
|
||||
{ id: 'shared-labels-setting', icon: 'fa-tags', labelKey: 'shared-labels', emoji: true },
|
||||
];
|
||||
// Global Webhooks is not offered while all webhooks are turned off
|
||||
// (Features / Turn off all webhooks, models/lib/webhooksSwitch.js).
|
||||
if (webhooksOff()) {
|
||||
items.splice(items.findIndex(item => item.id === 'webhook-setting'), 1);
|
||||
}
|
||||
// Multitenancy option D (docs/Design/Multitenancy/Multitenancy.md, D.7/D.9): an
|
||||
// Organization's own admin has ONE pane here - Visibility, for its "Change color"
|
||||
// section, which is that Organization's site theme. Every other pane, and every
|
||||
@@ -743,6 +750,15 @@ Template.tableVisibilityModeSettings.events({
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
// Turn off all webhooks (models/lib/webhooksSwitch.js), saved at once.
|
||||
async 'click .js-toggle-webhooks-off'(event, instance) {
|
||||
event.preventDefault();
|
||||
try {
|
||||
await Meteor.callAsync('saveWebhooksDisabled', !instance.$('#webhooks-off').hasClass('is-checked'));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
// #4198
|
||||
async 'click .js-toggle-activity-pub'(event, instance) {
|
||||
event.preventDefault();
|
||||
@@ -832,6 +848,23 @@ Template.tableVisibilityModeSettings.events({
|
||||
}
|
||||
},
|
||||
|
||||
// #6939: empty = 520px; otherwise a whole percentage, 30 to 95.
|
||||
'click button.js-visibility-card-width-save'(event, instance) {
|
||||
const { clampDefaultPercent } = require('/models/lib/cardDetailsWidth');
|
||||
const raw = String(instance.$('#card-details-default-width-percent').val() || '').trim();
|
||||
const percent = clampDefaultPercent(raw);
|
||||
const status = instance.$('.js-visibility-card-width-status');
|
||||
if (raw && percent === null) {
|
||||
status.text(TAPi18n.__('card-details-default-width-desc'));
|
||||
return;
|
||||
}
|
||||
const id = ReactiveCache.getCurrentSetting()._id;
|
||||
if (percent === null) Settings.update(id, { $unset: { cardDetailsDefaultWidthPercent: '' } });
|
||||
else Settings.update(id, { $set: { cardDetailsDefaultWidthPercent: percent } });
|
||||
instance.$('#card-details-default-width-percent').val(percent === null ? '' : percent);
|
||||
status.text(TAPi18n.__('card-details-default-width-saved'));
|
||||
},
|
||||
|
||||
'click button.js-visibility-date-save'(event, instance) {
|
||||
saveVisibilitySettings({
|
||||
hideDateFormat: instance.$('#global-date-format-enabled').hasClass('is-checked'),
|
||||
|
||||
@@ -19,3 +19,13 @@ template(name="adminPanelTabs")
|
||||
a.board-header-btn.problems(class="{{isProblemsActive}} {{problemsClass}}" href="{{pathFor 'problems'}}" title="{{_ 'problems'}}")
|
||||
i.fa.fa-exclamation-triangle
|
||||
span.board-header-btn-label {{_ 'problems'}}
|
||||
//- Admin Panel / Cloud: only where the server has the CLOUD environment
|
||||
variable, at that address, for its Cloud Admins - the server says so
|
||||
(cloudPanelWhoAmI); nothing in the browser can turn it on.
|
||||
if isCloudAdmin
|
||||
a.board-header-btn.cloud(class=isCloudActive href="{{pathFor 'cloud-admin-home'}}" title="{{_ 'cloud'}}")
|
||||
i.fa.fa-cloud
|
||||
span.board-header-btn-label {{_ 'cloud'}}
|
||||
//- Admin Panel / Settings / Privacy and security / Allowed addresses: a
|
||||
site administrator at another address sees why the panes are empty.
|
||||
+adminPanelAddressRefused
|
||||
@@ -11,8 +11,21 @@ function refreshProblems() {
|
||||
});
|
||||
}
|
||||
|
||||
// Is the signed-in user a Cloud Admin here? Asked once per page load: false
|
||||
// on every WeKan without the CLOUD environment variable, which is nearly all.
|
||||
const cloudAdminVar = new ReactiveVar(false);
|
||||
let cloudAsked = false;
|
||||
function askCloud() {
|
||||
if (cloudAsked) return;
|
||||
cloudAsked = true;
|
||||
Meteor.callAsync('cloudPanelWhoAmI')
|
||||
.then(info => cloudAdminVar.set(!!(info && info.enabled && info.onCloudHost && info.isCloudAdmin)))
|
||||
.catch(() => cloudAdminVar.set(false));
|
||||
}
|
||||
|
||||
Template.adminPanelTabs.onCreated(function () {
|
||||
refreshProblems();
|
||||
askCloud();
|
||||
problemsTimer = Meteor.setInterval(refreshProblems, 30000);
|
||||
});
|
||||
Template.adminPanelTabs.onDestroyed(function () {
|
||||
@@ -33,6 +46,12 @@ Template.adminPanelTabs.helpers({
|
||||
isPeopleActive() {
|
||||
return FlowRouter.getRouteName() === 'people' ? 'active' : '';
|
||||
},
|
||||
isCloudAdmin() {
|
||||
return cloudAdminVar.get();
|
||||
},
|
||||
isCloudActive() {
|
||||
return FlowRouter.getRouteName() === 'cloud-admin' ? 'active' : '';
|
||||
},
|
||||
isAttachmentsActive() {
|
||||
return FlowRouter.getRouteName() === 'attachments' ? 'active' : '';
|
||||
},
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//- Admin Panel / Problems / Webhooks (docs/Features/Admin-Panel/Problems/Webhooks.md):
|
||||
//- every board webhook and every global webhook, who added it and what it
|
||||
//- sends, through the shared table page (docs/Features/General/Table.md). The
|
||||
//- rows come from the site-admin method webhooksReportPage
|
||||
//- (server/webhooksSwitch.js); a token is never sent here, only whether one is
|
||||
//- set. Every value is text interpolation, so a title or URL is never markup.
|
||||
template(name="webhooksReport")
|
||||
if reportOff
|
||||
p.quiet.js-webhooks-report-off {{_ 'webhooks-disabled'}}
|
||||
+tablePage(tablePageData)
|
||||
|
||||
template(name="webhooksReportRow")
|
||||
tr.js-webhooks-report-row(data-integration-id="{{_id}}")
|
||||
td
|
||||
if isGlobal
|
||||
| {{_ 'webhooks-report-global'}}
|
||||
else if boardMissing
|
||||
| {{boardId}}
|
||||
else
|
||||
a.js-webhooks-report-board(href="{{boardPath}}") {{boardTitle}}
|
||||
td
|
||||
if ownerUsername
|
||||
| {{ownerUsername}}
|
||||
if ownerFullname
|
||||
br
|
||||
span.quiet {{ownerFullname}}
|
||||
else
|
||||
| {{ownerId}}
|
||||
td {{title}}
|
||||
td {{url}}
|
||||
td
|
||||
| {{_ typeKey}}
|
||||
if mattermostDirectMessages
|
||||
br
|
||||
span.quiet Mattermost
|
||||
td
|
||||
if enabled
|
||||
| {{_ 'webhooks-report-on'}}
|
||||
else
|
||||
| {{_ 'webhooks-report-off'}}
|
||||
td
|
||||
if allActivities
|
||||
| {{_ 'webhook-activities-all'}}
|
||||
else
|
||||
| {{activitiesText}}
|
||||
td
|
||||
if tokenSet
|
||||
| {{_ 'webhooks-report-token-set'}}
|
||||
td.table-page-nowrap {{createdText}}
|
||||
@@ -0,0 +1,111 @@
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
import { formatDateForDisplay } from '/client/lib/dateDisplay';
|
||||
import { buildFilters, buildHeader, pageInfo } from '/models/lib/tablePage';
|
||||
import { webhooksOff } from '/client/lib/webhooksSwitch';
|
||||
|
||||
// Admin Panel / Problems / Webhooks: every integration, its board or Global,
|
||||
// who added it and what it sends (models/lib/webhooksSwitch.js
|
||||
// webhookReportRow, server/webhooksSwitch.js webhooksReportPage).
|
||||
const { DEFAULT_REPORT_FILTER } = require('/models/lib/webhooksSwitch');
|
||||
|
||||
const PER_PAGE = 25;
|
||||
|
||||
// The header of webhooksReportRow, in the same order as its cells.
|
||||
const COLUMNS = [
|
||||
{ labelKey: 'board' },
|
||||
{ labelKey: 'owner' },
|
||||
{ labelKey: 'webhook-title' },
|
||||
{ labelKey: 'settings-group-url' },
|
||||
{ labelKey: 'type' },
|
||||
{ labelKey: 'status' },
|
||||
{ labelKey: 'activities' },
|
||||
{ labelKey: 'webhooks-report-token' },
|
||||
{ labelKey: 'createdAt' },
|
||||
];
|
||||
|
||||
const FILTER_OPTIONS = [
|
||||
{ value: 'all', labelKey: 'webhooks-report-title' },
|
||||
{ value: 'on', labelKey: 'webhooks-report-on' },
|
||||
{ value: 'off', labelKey: 'webhooks-report-off' },
|
||||
];
|
||||
|
||||
Template.webhooksReport.onCreated(function () {
|
||||
this.rows = new ReactiveVar([]);
|
||||
this.total = new ReactiveVar(0);
|
||||
this.page = new ReactiveVar(1);
|
||||
this.search = new ReactiveVar('');
|
||||
this.filter = new ReactiveVar(DEFAULT_REPORT_FILTER);
|
||||
this.load = () => {
|
||||
Meteor.call('webhooksReportPage', {
|
||||
filter: this.filter.get(),
|
||||
search: this.search.get() || '',
|
||||
limit: PER_PAGE,
|
||||
skip: (this.page.get() - 1) * PER_PAGE,
|
||||
}, (error, result) => {
|
||||
if (error) return;
|
||||
this.rows.set((result && result.rows) || []);
|
||||
this.total.set((result && result.total) || 0);
|
||||
});
|
||||
};
|
||||
this.load();
|
||||
});
|
||||
|
||||
Template.webhooksReport.helpers({
|
||||
// The report still lists them while they are turned off: they are kept.
|
||||
reportOff() { return webhooksOff(); },
|
||||
tablePageData() {
|
||||
const t = Template.instance();
|
||||
const info = pageInfo(t.total.get(), t.page.get(), PER_PAGE);
|
||||
const docs = (t.rows.get() || []).map(row => ({
|
||||
...row,
|
||||
boardPath: row.boardId ? FlowRouter.path('board', { id: row.boardId, slug: row.boardSlug || 'board' }) : '',
|
||||
activitiesText: (row.activities || []).join(', '),
|
||||
createdText: row.createdAt ? formatDateForDisplay(row.createdAt) : '',
|
||||
}));
|
||||
return {
|
||||
descKey: 'webhooks-report-desc',
|
||||
emptyKey: 'webhooks-report-no-results',
|
||||
searchTerm: t.search.get(),
|
||||
filters: buildFilters([{
|
||||
id: 'webhooks-report-status', labelKey: 'status', current: t.filter.get(), options: FILTER_OPTIONS,
|
||||
}]),
|
||||
header: buildHeader(COLUMNS),
|
||||
rowTemplate: 'webhooksReportRow',
|
||||
docs,
|
||||
rowCount: docs.length,
|
||||
total: t.total.get(),
|
||||
page: info.page,
|
||||
totalPages: info.totalPages,
|
||||
hasPrev: info.hasPrev,
|
||||
hasNext: info.hasNext,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Template.webhooksReport.events({
|
||||
'change .js-table-page-filter'(event, tmpl) {
|
||||
tmpl.filter.set(event.currentTarget.value || DEFAULT_REPORT_FILTER);
|
||||
tmpl.page.set(1);
|
||||
tmpl.load();
|
||||
},
|
||||
'click .js-table-page-prev'(event, tmpl) {
|
||||
event.preventDefault();
|
||||
if (tmpl.page.get() > 1) { tmpl.page.set(tmpl.page.get() - 1); tmpl.load(); }
|
||||
},
|
||||
'click .js-table-page-next'(event, tmpl) {
|
||||
event.preventDefault();
|
||||
const info = pageInfo(tmpl.total.get(), tmpl.page.get(), PER_PAGE);
|
||||
if (info.hasNext) { tmpl.page.set(tmpl.page.get() + 1); tmpl.load(); }
|
||||
},
|
||||
'keydown .js-table-page-search'(event, tmpl) {
|
||||
if (event.keyCode === 13 && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
tmpl.search.set(event.currentTarget.value || '');
|
||||
tmpl.page.set(1);
|
||||
tmpl.load();
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -29,9 +29,11 @@ template(name="sidebar")
|
||||
//
|
||||
i.fa.fa-navicon
|
||||
unless isDefaultView
|
||||
h2
|
||||
h2.sidebar-view-title
|
||||
a.fa.fa-arrow-left.js-back-home(aria-label="{{_ 'go-back'}}")
|
||||
= getViewTitle
|
||||
//- The open view's ? (featureHelp.jade), at the end of its heading.
|
||||
+featureHelp(id=sidebarHelp)
|
||||
if isOpen
|
||||
+Template.dynamic(template=getViewTemplate)
|
||||
|
||||
@@ -706,11 +708,13 @@ template(name="boardMenuPopup")
|
||||
| {{_ 'r-workflow-view'}}
|
||||
//- Bots: the alternative workflow view - external runners this board
|
||||
hands cards to (client/components/rules/rulesBots.*). Board admins
|
||||
only, as every entry of this group.
|
||||
li
|
||||
a.js-open-rules-bots-view(title="{{_ 'bots'}}")
|
||||
i.fa.fa-android
|
||||
| {{_ 'bots'}}
|
||||
only, as every entry of this group. A bot is a webhook, so it is
|
||||
hidden while all webhooks are turned off.
|
||||
unless webhooksOff
|
||||
li
|
||||
a.js-open-rules-bots-view(title="{{_ 'bots'}}")
|
||||
i.fa.fa-android
|
||||
| {{_ 'bots'}}
|
||||
li
|
||||
a.js-open-rules-blocks-view(title="{{_ 'r-blocks-view'}}")
|
||||
i.fa.fa-puzzle-piece
|
||||
@@ -726,13 +730,16 @@ template(name="boardMenuPopup")
|
||||
//- Rules and its views are one group; the board's look starts below it.
|
||||
hr
|
||||
//- Scrum settings: how this board plans its work, above the group that
|
||||
decides how the board looks, with a rule of its own between them.
|
||||
ul.pop-over-list
|
||||
li
|
||||
a.js-open-board-scrum-settings
|
||||
i.fa.fa-repeat
|
||||
| {{_ 'scrum-settings'}}
|
||||
hr
|
||||
decides how the board looks, with a rule of its own between them. They
|
||||
open in the Sprints view, so only while Admin Panel / Settings / Features
|
||||
offers the Scrum views (the server refuses that view otherwise).
|
||||
if allowFeature 'views-scrum'
|
||||
ul.pop-over-list
|
||||
li
|
||||
a.js-open-board-scrum-settings
|
||||
i.fa.fa-repeat
|
||||
| {{_ 'scrum-settings'}}
|
||||
hr
|
||||
ul.pop-over-list
|
||||
//- "Custom Fields" was here. The board's list of them is in the card's own
|
||||
menu now - Card menu / Custom Fields, whose Settings cog opens it - which
|
||||
@@ -810,6 +817,15 @@ template(name="boardMenuPopup")
|
||||
a.js-open-board-list-settings(title="{{_ 'list'}}")
|
||||
i.fa.fa-trello
|
||||
| {{_ 'list'}}
|
||||
//- Board Settings / Shop: the board's cards as a web shop - which custom
|
||||
fields are the price, product code and stock, the lists on sale, the
|
||||
Orders list and the payment methods (client/components/boards/shopView.*,
|
||||
docs/Features/Board-Sidebar/Board-Settings/Shop.md).
|
||||
if allowFeature 'views-shop'
|
||||
li
|
||||
a.js-open-board-shop-settings(title="{{_ 'board-view-shop'}}")
|
||||
i.fa.fa-shopping-cart
|
||||
| {{_ 'board-view-shop'}}
|
||||
//- "Scrum settings" was here. It is above Change color now, in a group
|
||||
of its own.
|
||||
//- "WIP Limit Groups" was here. It is a row of Board Settings /
|
||||
@@ -838,10 +854,13 @@ template(name="boardMenuPopup")
|
||||
a.js-open-notification-settings
|
||||
i.fa.fa-bell
|
||||
| {{_ 'notifications'}}
|
||||
li
|
||||
a.js-outgoing-webhooks
|
||||
i.fa.fa-globe
|
||||
| {{_ 'outgoing-webhooks'}}
|
||||
//- Hidden while Admin Panel / Settings / Features / Turn off all webhooks
|
||||
is on (client/lib/webhooksSwitch.js).
|
||||
unless webhooksOff
|
||||
li
|
||||
a.js-outgoing-webhooks
|
||||
i.fa.fa-globe
|
||||
| {{_ 'outgoing-webhooks'}}
|
||||
//- "Subtasks Settings" was here. What subtasks do on this board is behind
|
||||
the hamburger at the end of the Subtasks heading on an opened card,
|
||||
which is where somebody looking at subtasks already is.
|
||||
|
||||
@@ -5,8 +5,10 @@ import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { ReactiveDict } from 'meteor/reactive-dict';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { isSelectedSubtaskBoard, isSelectedSubtaskList } from '/models/lib/subtaskSettings';
|
||||
import { liveAttachments } from '/models/lib/attachmentSoftDelete';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { sidebarViewHelpId } from '/models/lib/featureHelp';
|
||||
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
||||
const { allBoardsPath, SECTION_ARCHIVE } = require('/models/lib/allBoardsUrls');
|
||||
const {
|
||||
@@ -27,6 +29,8 @@ const cardSettingsCustomFields = require('/models/lib/cardSettingsCustomFields')
|
||||
const cardSettingsSplit = require('/models/lib/cardSettingsSplit');
|
||||
import { invalidateScrumNames } from '/client/components/boards/scrum/scrumFields';
|
||||
import { InfiniteScrolling } from '/client/lib/infiniteScrolling';
|
||||
// Registers {{webhooksOff}}: the board menu's Outgoing Webhooks and Bots.
|
||||
import '/client/lib/webhooksSwitch';
|
||||
import '/client/components/boards/exportScope';
|
||||
import AccessibilitySettings from '/models/accessibilitySettings';
|
||||
import Boards from '/models/boards';
|
||||
@@ -346,6 +350,10 @@ Template.sidebar.helpers({
|
||||
getViewTitle() {
|
||||
return Sidebar && Sidebar.getViewTitle();
|
||||
},
|
||||
// The open view's ? (docs/Features/General/Help-Button.md).
|
||||
sidebarHelp() {
|
||||
return Sidebar && sidebarViewHelpId(Sidebar.getView());
|
||||
},
|
||||
showTongueTitle() {
|
||||
return Sidebar && Sidebar.showTongueTitle();
|
||||
},
|
||||
@@ -705,6 +713,8 @@ Template.boardMenuPopup.events({
|
||||
'click .js-open-board-swimlane-settings': Popup.open('boardSwimlaneSettings', { titleKey: 'swimlane' }),
|
||||
'click .js-open-board-date-settings': Popup.open('boardDateSettings', { titleKey: 'date' }),
|
||||
'click .js-open-board-list-settings': Popup.open('boardListSettings', { titleKey: 'list' }),
|
||||
// Board Settings / Shop (client/components/boards/shopView.js).
|
||||
'click .js-open-board-shop-settings': Popup.open('boardShopSettings', { titleKey: 'board-view-shop' }),
|
||||
// #2489: WIP Limit Groups is reached from Board Settings / Swimlane now -
|
||||
// its click handler sits with the Swimlane popup's events below.
|
||||
// Board Settings / Card: Card Settings with no card. Overriding
|
||||
@@ -1906,7 +1916,7 @@ Template.boardSubtaskSettingsBody.helpers({
|
||||
},
|
||||
isBoardSelected() {
|
||||
const tpl = Template.instance();
|
||||
return tpl.currentBoard.subtasksDefaultBoardId === Template.currentData()._id;
|
||||
return isSelectedSubtaskBoard(tpl.currentBoard, Template.currentData()._id);
|
||||
},
|
||||
isNullBoardSelected() {
|
||||
const tpl = Template.instance();
|
||||
@@ -1981,7 +1991,7 @@ Template.boardSubtaskSettingsBody.helpers({
|
||||
// #3876 / #4947: the selected landing list must be compared against
|
||||
// subtasksDefaultListId (the stored list id), NOT subtasksDefaultBoardId.
|
||||
const tpl = Template.instance();
|
||||
return tpl.currentBoard.subtasksDefaultListId === Template.currentData()._id;
|
||||
return isSelectedSubtaskList(tpl.currentBoard, Template.currentData()._id);
|
||||
},
|
||||
presentParentTask() {
|
||||
// Get the current board reactively using board ID from Session
|
||||
|
||||
@@ -119,7 +119,7 @@ template(name="restoreArchivedCardToListPopup")
|
||||
if availableLists.length
|
||||
select.js-select-restore-target-list(autofocus)
|
||||
each availableLists
|
||||
option(value="{{_id}}" selected="{{#if isSelectedList _id}}selected{{/if}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}" selected="{{#if isSelectedList _id}}selected{{/if}}") {{title}}
|
||||
|
||||
.edit-controls.clearfix
|
||||
button.primary.confirm.js-restore-card-to-list {{_ 'restore'}}
|
||||
@@ -134,7 +134,7 @@ template(name="restoreArchivedListToSwimlanePopup")
|
||||
p {{_ 'no-results'}}, {{_ 'wip-limit-group-select-swimlane'}}:
|
||||
select.js-select-restore-target-swimlane(autofocus)
|
||||
each availableSwimlanes
|
||||
option(value="{{_id}}" selected="{{#if isSelectedSwimlane _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
|
||||
option(value="{{_id}}" selected="{{#if isSelectedSwimlane _id}}selected{{/if}}") {{isTitleDefault title}}
|
||||
|
||||
.edit-controls.clearfix
|
||||
button.primary.confirm.js-restore-list-to-swimlane {{_ 'restore'}}
|
||||
@@ -386,22 +386,22 @@ template(name="selectionDestinationPicker")
|
||||
label {{_ 'boards'}}:
|
||||
select.js-select-boards
|
||||
each boards
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionBoardId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionBoardId _id}}selected{{/if}}") {{title}}
|
||||
|
||||
label {{_ 'swimlanes'}}:
|
||||
select.js-select-swimlanes
|
||||
each swimlanes
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{add @index 1}}. {{isTitleDefault title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionSwimlaneId _id}}selected{{/if}}") {{isTitleDefault title}}
|
||||
|
||||
label {{_ 'lists'}}:
|
||||
select.js-select-lists
|
||||
each lists
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionListId _id}}selected{{/if}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}" selected="{{#if isDialogOptionListId _id}}selected{{/if}}") {{title}}
|
||||
|
||||
label {{_ 'cards'}}:
|
||||
select.js-select-cards
|
||||
each cards
|
||||
option(value="{{_id}}") {{add @index 1}}. {{title}}
|
||||
option(value="{{_id}}") {{title}}
|
||||
|
||||
div
|
||||
input(type="radio" name="position" value="above" checked id="position-above-{{idSuffix}}" style="display: inline")
|
||||
|
||||
@@ -5,6 +5,7 @@ import { SavedCardFilters } from '/client/lib/savedCardFilters';
|
||||
import { captureFilterPreset, applyFilterPreset } from '/client/lib/filterPresetState';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { displayDefaultTitle } from '/imports/lib/defaultTitle';
|
||||
import { Filter } from '/client/lib/filter';
|
||||
import { EscapeActions } from '/client/lib/escapeActions';
|
||||
import { MultiSelection } from '/client/lib/multiSelection';
|
||||
@@ -617,23 +618,7 @@ Template.selectionDestinationPicker.helpers({
|
||||
return Template.instance().dialog.selectedListId.get() === listId;
|
||||
},
|
||||
isTitleDefault(title) {
|
||||
if (
|
||||
title.startsWith("key 'default") &&
|
||||
title.endsWith('returned an object instead of string.')
|
||||
) {
|
||||
const translated = `${TAPi18n.__('defaultdefault')}`;
|
||||
if (
|
||||
translated.startsWith("key 'default") &&
|
||||
translated.endsWith('returned an object instead of string.')
|
||||
) {
|
||||
return 'Default';
|
||||
}
|
||||
return translated;
|
||||
}
|
||||
if (title === 'Default') {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
}
|
||||
return title;
|
||||
return displayDefaultTitle(title, key => TAPi18n.__(key));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@ import { revealOnBoard } from '/client/lib/revealOnBoard';
|
||||
|
||||
Template.searchSidebar.onCreated(function () {
|
||||
this.term = new ReactiveVar('');
|
||||
// The server's matches for the term, attachment text included
|
||||
// (server/publications/boardTextMatches.js): the search below ORs them in.
|
||||
this.autorun(() => {
|
||||
const boardId = Session.get('currentBoard');
|
||||
const term = this.term.get().trim();
|
||||
if (boardId && term) this.subscribe('boardTextMatches', boardId, term);
|
||||
});
|
||||
// #2171: which card found is shown on the board (0 = none yet).
|
||||
this.step = new ReactiveVar(0);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { titleSortIndexes } from '/models/lib/multilineTitles';
|
||||
import { titlesFromComposer } from '/client/components/forms/multilineTitleChoice';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { displayDefaultTitle } from '/imports/lib/defaultTitle';
|
||||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { SWIMLANE_COLORS } from '/models/metadata/colors';
|
||||
import { isHexColor, toHex } from '/models/lib/contrastColor';
|
||||
@@ -51,51 +52,13 @@ Template.swimlaneFixedHeader.helpers({
|
||||
return Utils.getSwimlaneCollapseState(swimlane);
|
||||
},
|
||||
isTitleDefault(title) {
|
||||
// https://github.com/wekan/wekan/issues/4763
|
||||
// https://github.com/wekan/wekan/issues/4742
|
||||
// Translation text for "default" does not work, it returns an object.
|
||||
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||
// This can happen, if swimlane does not have name.
|
||||
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||
// would be very slow.
|
||||
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||
return 'Default';
|
||||
} else {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
}
|
||||
} else if (title === 'Default') {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
return displayDefaultTitle(title, key => TAPi18n.__(key));
|
||||
},
|
||||
});
|
||||
|
||||
Template.editSwimlaneTitleForm.helpers({
|
||||
isTitleDefault(title) {
|
||||
// https://github.com/wekan/wekan/issues/4763
|
||||
// https://github.com/wekan/wekan/issues/4742
|
||||
// Translation text for "default" does not work, it returns an object.
|
||||
// When that happens, try use translation "defaultdefault" that has same content of default, or return text "Default".
|
||||
// This can happen, if swimlane does not have name.
|
||||
// Yes, this is fixing the symptom (Swimlane title does not have title)
|
||||
// instead of fixing the problem (Add Swimlane title when creating swimlane)
|
||||
// because there could be thousands of swimlanes, adding name Default to all of them
|
||||
// would be very slow.
|
||||
if (title.startsWith("key 'default") && title.endsWith('returned an object instead of string.')) {
|
||||
if (`${TAPi18n.__('defaultdefault')}`.startsWith("key 'default") && `${TAPi18n.__('defaultdefault')}`.endsWith('returned an object instead of string.')) {
|
||||
return 'Default';
|
||||
} else {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
}
|
||||
} else if (title === 'Default') {
|
||||
return `${TAPi18n.__('defaultdefault')}`;
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
return displayDefaultTitle(title, key => TAPi18n.__(key));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -32,6 +32,16 @@ template(name="memberMenuPopup")
|
||||
a.js-due-cards(href="{{pathFor 'due-cards'}}")
|
||||
i.fa.fa-calendar
|
||||
| {{_ 'dueCards-title'}}
|
||||
if allowFeature 'workload'
|
||||
li
|
||||
a.js-workload(href="{{pathFor 'workload'}}")
|
||||
i.fa.fa-tachometer
|
||||
| {{_ 'workload-title'}}
|
||||
if allowFeature 'billing'
|
||||
li
|
||||
a.js-billing(href="{{pathFor 'billing'}}")
|
||||
i.fa.fa-money
|
||||
| {{_ 'billing-title'}}
|
||||
li
|
||||
a.js-my-attachments(href="{{pathFor 'my-attachments'}}")
|
||||
i.fa.fa-paperclip
|
||||
|
||||
@@ -89,6 +89,12 @@ Template.memberMenuPopup.events({
|
||||
'click .js-due-cards'() {
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-workload'() {
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-billing'() {
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-my-attachments'() {
|
||||
Popup.back();
|
||||
},
|
||||
|
||||
@@ -177,10 +177,6 @@ Blaze.registerHelper('canCheckChecklistItem', function canCheckChecklistItem() {
|
||||
|
||||
Blaze.registerHelper('canModifyBoard', () => Utils.canModifyBoard());
|
||||
|
||||
Blaze.registerHelper('add', (a, b) => a + b);
|
||||
|
||||
Blaze.registerHelper('increment', (n) => (n || 0) + 1);
|
||||
|
||||
// Operator helpers (replacement for raix:handlebar-helpers)
|
||||
Blaze.registerHelper('$eq', (a, b) => a === b);
|
||||
Blaze.registerHelper('$neq', (a, b) => a !== b);
|
||||
|
||||
@@ -23,6 +23,8 @@ import '/client/components/boards/bigboardView.jade';
|
||||
import '/client/components/boards/mapView.jade';
|
||||
import '/client/components/boards/emailView.jade';
|
||||
import '/client/components/boards/chatView.jade';
|
||||
import '/client/components/boards/websiteView.jade';
|
||||
import '/client/components/boards/shopView.jade';
|
||||
import '/client/components/boards/versionControlView.jade';
|
||||
import '/client/components/boards/columnSetsView.jade';
|
||||
import '/client/components/boards/calendarModeView.jade';
|
||||
@@ -51,6 +53,8 @@ import '/client/components/boards/bigboardView.js';
|
||||
import '/client/components/boards/mapView.js';
|
||||
import '/client/components/boards/emailView.js';
|
||||
import '/client/components/boards/chatView.js';
|
||||
import '/client/components/boards/websiteView.js';
|
||||
import '/client/components/boards/shopView.js';
|
||||
import '/client/components/boards/versionControlView.js';
|
||||
import '/client/components/boards/columnSetsView.js';
|
||||
import '/client/components/boards/calendarModeView.js';
|
||||
@@ -72,6 +76,8 @@ import '/client/components/boards/bigboardView.css';
|
||||
import '/client/components/boards/mapView.css';
|
||||
import '/client/components/boards/emailView.css';
|
||||
import '/client/components/boards/chatView.css';
|
||||
import '/client/components/boards/websiteView.css';
|
||||
import '/client/components/boards/shopView.css';
|
||||
import '/client/components/boards/versionControlView.css';
|
||||
import '/client/components/boards/columnSetsView.css';
|
||||
import '/client/components/boards/calendarModeView.css';
|
||||
|
||||
@@ -19,6 +19,8 @@ import '/client/components/main/starredItems.jade';
|
||||
// / Problems / Offices. A .jade file is not picked up by being on disk.
|
||||
import '/client/components/main/mapProvider.jade';
|
||||
import '/client/components/main/popup.tpl.jade';
|
||||
// The ? of every feature place (docs/Features/General/Help-Button.md).
|
||||
import '/client/components/main/featureHelp.jade';
|
||||
import '/client/components/main/spinner.jade';
|
||||
import '/client/components/main/spinner_bounce.jade';
|
||||
import '/client/components/main/spinner_cube.jade';
|
||||
@@ -34,9 +36,19 @@ import '/client/components/main/shareTarget.jade';
|
||||
// #2026 / #1377: the all-boards activity feed.
|
||||
import '/client/components/main/activityFeed.jade';
|
||||
import '/client/components/main/activityFeed.css';
|
||||
// Workload and capacity (docs/Features/Workload/Workload.md).
|
||||
import '/client/components/main/workload.jade';
|
||||
import '/client/components/main/workload.css';
|
||||
// Budget and billing (docs/Features/Billing/Billing.md).
|
||||
import '/client/components/main/billing.jade';
|
||||
import '/client/components/main/billing.css';
|
||||
// Cloud Panel (docs/Features/Admin-Panel/Cloud-Panel.md).
|
||||
import '/client/components/cloud/cloudPanel.jade';
|
||||
import '/client/components/cloud/cloudPanel.css';
|
||||
|
||||
import '/client/lib/keyboard';
|
||||
import '/client/lib/popup';
|
||||
import '/client/components/main/featureHelp.js';
|
||||
import '/client/lib/pageSidebar';
|
||||
import '/client/components/main/pageSidebar.js';
|
||||
import '/client/components/main/accessibility.js';
|
||||
@@ -62,6 +74,9 @@ import '/client/components/main/spinner.js';
|
||||
import '/client/components/main/support.js';
|
||||
import '/client/components/main/shareTarget.js';
|
||||
import '/client/components/main/activityFeed.js';
|
||||
import '/client/components/main/workload.js';
|
||||
import '/client/components/main/billing.js';
|
||||
import '/client/components/cloud/cloudPanel.js';
|
||||
|
||||
import '/client/components/main/mapProvider.css';
|
||||
import '/client/components/main/accessibility.css';
|
||||
|
||||
@@ -52,6 +52,13 @@ import '/client/components/settings/problemsSummary.jade';
|
||||
import '/client/components/settings/problemsSummary.js';
|
||||
import '/client/components/settings/passwordLengthReport.jade';
|
||||
import '/client/components/settings/passwordLengthReport.js';
|
||||
// Admin Panel / Problems / Webhooks: every webhook and who added it.
|
||||
import '/client/components/settings/webhooksReport.jade';
|
||||
import '/client/components/settings/webhooksReport.js';
|
||||
// Admin Panel / Settings / Privacy and security / Allowed addresses.
|
||||
import '/client/components/settings/adminPanelAddresses.jade';
|
||||
import '/client/components/settings/adminPanelAddresses.js';
|
||||
import '/client/components/settings/adminPanelAddresses.css';
|
||||
import '/client/components/settings/translationBody.js';
|
||||
|
||||
// adminProblems.css was missing here, so NONE of the Admin Panel report styling
|
||||
|
||||
@@ -66,7 +66,6 @@ import '/client/lib/localStorageValidator';
|
||||
import '/client/lib/modal';
|
||||
import '/client/lib/multiSelection';
|
||||
import '/client/lib/pasteImage';
|
||||
import '/client/lib/secureDOMPurify';
|
||||
import '/client/lib/spinner';
|
||||
import '/client/lib/textComplete';
|
||||
import '/client/lib/unsavedEdits';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Keep server diagnostics in the console; show existing localized UI messages.
|
||||
// The last-admin case must precede the general authorization failure.
|
||||
export function accountOperationErrorKey(error) {
|
||||
if (error?.error === 'not-authorized' && error.reason === 'Cannot delete the last administrator') return 'last-admin-desc';
|
||||
if (error?.error === 'not-authorized' && (error.reason === 'Cannot delete the last administrator'
|
||||
|| error.reason === 'Cannot anonymize the last administrator')) return 'last-admin-desc';
|
||||
if (error?.error === 'not-authorized') return 'error-notAllowed';
|
||||
if (error?.error === 'user-not-found') return 'error-user-doesNotExist';
|
||||
return 'server-error';
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// The slideshow's reader of a converted preview (server/lib/
|
||||
// attachmentPreviewStore.js): an attachment whose content is scattered
|
||||
// through it - an Outlook .msg, an OpenDocument - is converted once on the
|
||||
// server into rows, and read here a screenful at a time through HTTP Range
|
||||
// requests: the index entries of the visible rows, then those rows.
|
||||
//
|
||||
// <link>/preview-meta { kind, count, truncated }
|
||||
// <link>/preview-index (count + 1) little-endian uint64 offsets
|
||||
// <link>/preview-rows one JSON object a line
|
||||
//
|
||||
// (Two path segments: Meteor-Files takes every longer path under /cdn/storage.)
|
||||
|
||||
export const MAX_CACHED_ROWS = 5000;
|
||||
|
||||
async function ranged(fetchImpl, url, start, end, signal) {
|
||||
const response = await fetchImpl(url, { credentials: 'same-origin', signal, headers: { Range: `bytes=${start}-${end - 1}` } });
|
||||
if (!response.ok) throw new Error(`Attachment preview fetch failed: ${response.status}`);
|
||||
let bytes = new Uint8Array(await response.arrayBuffer());
|
||||
// A whole answer to a range request: take the range from it.
|
||||
if (response.status === 200) bytes = bytes.subarray(start, end);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
export class PreviewRecords {
|
||||
constructor(url, { signal, fetchImpl } = {}) {
|
||||
this.base = String(url).split(/[?#]/)[0].replace(/\/$/, '');
|
||||
this.signal = signal;
|
||||
this.fetch = fetchImpl || ((...a) => fetch(...a));
|
||||
this.cache = new Map();
|
||||
this.requests = 0;
|
||||
}
|
||||
|
||||
async open() {
|
||||
this.requests += 1;
|
||||
const response = await this.fetch(`${this.base}/preview-meta`, { credentials: 'same-origin', signal: this.signal });
|
||||
if (!response.ok) throw new Error(`Attachment preview failed: ${response.status}`);
|
||||
this.meta = await response.json();
|
||||
this.count = Number(this.meta.count) || 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Rows [first, first + count), from the cache or in two requests.
|
||||
async rowsAt(first, count) {
|
||||
const end = Math.min(this.count, first + count);
|
||||
if (end <= first) return [];
|
||||
const missing = [];
|
||||
for (let i = first; i < end; i += 1) if (!this.cache.has(i)) missing.push(i);
|
||||
if (missing.length) {
|
||||
const a = missing[0];
|
||||
const b = missing[missing.length - 1] + 1;
|
||||
this.requests += 2;
|
||||
const index = await ranged(this.fetch, `${this.base}/preview-index`, a * 8, (b + 1) * 8, this.signal);
|
||||
const view = new DataView(index.buffer, index.byteOffset, index.byteLength);
|
||||
const offsets = [];
|
||||
for (let i = 0; i + 8 <= index.length; i += 8) offsets.push(Number(view.getBigUint64(i, true)));
|
||||
if (offsets.length < b - a + 1) throw new Error('The attachment preview is damaged: its index is short');
|
||||
const body = await ranged(this.fetch, `${this.base}/preview-rows`, offsets[0], offsets[offsets.length - 1], this.signal);
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
for (let i = a; i < b; i += 1) {
|
||||
const line = decoder.decode(body.subarray(offsets[i - a] - offsets[0], offsets[i - a + 1] - offsets[0])).trim();
|
||||
let row;
|
||||
try { row = JSON.parse(line); } catch (e) { row = { k: 'text', v: line }; }
|
||||
this.cache.set(i, row);
|
||||
}
|
||||
while (this.cache.size > MAX_CACHED_ROWS) this.cache.delete(this.cache.keys().next().value);
|
||||
}
|
||||
const rows = [];
|
||||
for (let i = first; i < end; i += 1) rows.push(this.cache.get(i));
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,465 @@
|
||||
// The attachment slideshow's viewers for files a browser does not show by
|
||||
// itself: plain text, Markdown, CSV and TSV, source code and JSON, iCalendar,
|
||||
// Outlook .msg, tar archives and OpenDocument text, spreadsheets and
|
||||
// presentations.
|
||||
//
|
||||
// Nothing is read whole that does not have to be (attachmentWindow.js):
|
||||
//
|
||||
// text, code, CSV, JSON, Markdown HTTP Range requests for what is on the
|
||||
// screen; the scrollbar is the whole file, so dragging it to the middle
|
||||
// shows the middle. A file of one chunk (256 KB) is read in that one
|
||||
// request and indexed exactly; Markdown and JSON of that size are
|
||||
// formatted (a larger one is shown as its text, as formatting needs the
|
||||
// whole document).
|
||||
// tar and tar.gz, iCalendar read in order, as far as they are scrolled:
|
||||
// infinite scroll downwards. Compressed data cannot be read from its
|
||||
// middle.
|
||||
// Outlook .msg, OpenDocument their content is scattered through the file
|
||||
// (a Compound File's sectors, a ZIP's compressed content.xml), so the
|
||||
// server converts each once, a piece at a time, into rows with an index
|
||||
// (server/lib/attachmentPreviewStore.js); the scrollbar is exactly those
|
||||
// rows, and only the visible ones are fetched (attachmentRecords.js).
|
||||
//
|
||||
// Only the visible rows are in the page. Everything a file contains reaches it
|
||||
// as text (textContent) - except highlight.js's output, escaped text in
|
||||
// <span class="hljs-..."> sanitized down to exactly that, and Markdown, which
|
||||
// the caller renders through WeKan's own markdown helper with every setting
|
||||
// the card description has.
|
||||
|
||||
import { RangeReader, ByteRows, WindowView, GrowingView, IndexedView, splitRows, CHUNK_BYTES, MAX_ROW_BYTES }
|
||||
from './attachmentWindow.js';
|
||||
import { PreviewRecords } from './attachmentRecords.js';
|
||||
|
||||
export const MAX_COLUMNS = 1024;
|
||||
export const MAX_COMPONENT_BYTES = 1024 * 1024;
|
||||
export const ROWS_PER_READ = 200;
|
||||
const FEED_BYTES = 4096;
|
||||
|
||||
export function decodeText(bytes) {
|
||||
return new TextDecoder('utf-8').decode(bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes));
|
||||
}
|
||||
|
||||
// A NUL in the first 8000 bytes is how git decides a file is binary; such a
|
||||
// file is not shown as text.
|
||||
export function looksBinary(bytes) {
|
||||
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
||||
return view.subarray(0, 8000).includes(0);
|
||||
}
|
||||
|
||||
function element(doc, tag, text, className) {
|
||||
const node = doc.createElement(tag);
|
||||
if (text !== undefined) node.textContent = text;
|
||||
if (className) node.className = className;
|
||||
return node;
|
||||
}
|
||||
|
||||
// Rows of text already in memory, cut at MAX_ROW_BYTES characters as ByteRows
|
||||
// cuts a file.
|
||||
function rowsOfText(text) {
|
||||
const rows = [];
|
||||
for (const line of text.split('\n')) {
|
||||
if (line.length <= MAX_ROW_BYTES) rows.push({ start: rows.length, end: rows.length + 1, text: line });
|
||||
else {
|
||||
for (let at = 0; at < line.length; at += MAX_ROW_BYTES) {
|
||||
rows.push({ start: rows.length, end: rows.length + 1, text: line.slice(at, at + MAX_ROW_BYTES) });
|
||||
}
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
// --- text, code, CSV, JSON, Markdown ----------------------------------------------
|
||||
|
||||
async function highlighter(language) {
|
||||
if (!language || language === 'plaintext') return null;
|
||||
const [{ default: hljs }, { default: DOMPurify }] = await Promise.all([
|
||||
import('highlight.js/lib/common'), import('dompurify')]);
|
||||
if (!hljs.getLanguage(language)) return null;
|
||||
// highlight.js escapes the source; this keeps that guarantee even if it ever
|
||||
// did not: only <span class="hljs-..."> survives. Each row is coloured on
|
||||
// its own, as only the rows on the screen are read.
|
||||
return text => DOMPurify.sanitize(hljs.highlight(text, { language, ignoreIllegals: true }).value,
|
||||
{ ALLOWED_TAGS: ['span'], ALLOWED_ATTR: ['class'], ALLOWED_URI_REGEXP: /^$/ });
|
||||
}
|
||||
|
||||
function textRenderer(doc, highlight) {
|
||||
return (rows, viewport) => {
|
||||
const items = rows.map(row => {
|
||||
const el = element(doc, 'div', undefined, 'attachment-window-row');
|
||||
if (highlight) {
|
||||
el.innerHTML = highlight(row.text);
|
||||
for (const span of Array.from(el.querySelectorAll('span'))) {
|
||||
span.className = String(span.className).split(/\s+/).filter(c => /^hljs-[\w-]+$/.test(c)).join(' ');
|
||||
}
|
||||
} else el.textContent = row.text;
|
||||
return el;
|
||||
});
|
||||
viewport.replaceChildren(...items);
|
||||
};
|
||||
}
|
||||
|
||||
function cellsRow(doc, cells, className) {
|
||||
const el = element(doc, 'div', undefined, `attachment-window-row attachment-csv-row ${className || ''}`.trim());
|
||||
for (const text of cells) {
|
||||
const cell = element(doc, 'span', text, 'attachment-csv-cell');
|
||||
cell.title = text;
|
||||
el.appendChild(cell);
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
function csvRenderer(doc, Papa, delimiter, header) {
|
||||
// Each row is parsed on its own, as only the rows on the screen are read; a
|
||||
// quoted value with a newline in it shows as two rows.
|
||||
const parse = text => {
|
||||
const data = Papa.parse(text, { delimiter }).data[0];
|
||||
return (Array.isArray(data) ? data : [text]).slice(0, MAX_COLUMNS).map(c => String(c ?? ''));
|
||||
};
|
||||
const columns = header ? parse(header.text) : [];
|
||||
return (rows, viewport) => {
|
||||
const items = [];
|
||||
if (header) items.push(cellsRow(doc, columns, 'attachment-csv-header'));
|
||||
// The header row is drawn once, pinned; not again as data.
|
||||
for (const r of rows) if (!header || r.start !== header.start) items.push(cellsRow(doc, parse(r.text)));
|
||||
viewport.replaceChildren(...items);
|
||||
};
|
||||
}
|
||||
|
||||
async function openTextWindow({ container, reader, rich, language, extension, renderMarkdown, viewportHeight }) {
|
||||
const doc = container.ownerDocument;
|
||||
const size = reader.size;
|
||||
const first = await reader.bytes(0, Math.min(size, CHUNK_BYTES));
|
||||
if (looksBinary(first)) throw new Error('Binary file');
|
||||
const whole = size <= CHUNK_BYTES;
|
||||
container.replaceChildren();
|
||||
if (whole && rich === 'markdown') {
|
||||
const holder = element(doc, 'div', undefined, 'attachment-preview-markdown');
|
||||
container.appendChild(holder);
|
||||
return renderMarkdown(holder, decodeText(first));
|
||||
}
|
||||
let all = null;
|
||||
if (whole) {
|
||||
let text = null;
|
||||
if (language === 'json') {
|
||||
try { text = JSON.stringify(JSON.parse(decodeText(first)), null, 2); } catch (e) { /* shown as it is */ }
|
||||
}
|
||||
all = text === null ? await splitRows(first) : rowsOfText(text);
|
||||
}
|
||||
const rows = new ByteRows(reader, size);
|
||||
let renderRows;
|
||||
let className = 'attachment-preview-text';
|
||||
if (rich === 'csv') {
|
||||
const { default: Papa } = await import('papaparse');
|
||||
const header = all ? all[0] : await rows.rowAt(0);
|
||||
renderRows = csvRenderer(doc, Papa, extension === 'tsv' ? '\t' : ',', header);
|
||||
className = 'attachment-preview-csv';
|
||||
} else {
|
||||
const highlight = rich === 'code' ? await highlighter(language) : null;
|
||||
renderRows = textRenderer(doc, highlight);
|
||||
if (rich === 'code') className = 'viewer attachment-preview-code';
|
||||
}
|
||||
const view = new WindowView(container, { rows, all, size, renderRows, className, viewportHeight });
|
||||
await view.start();
|
||||
return { view, destroy() { view.destroy(); } };
|
||||
}
|
||||
|
||||
// --- tar --------------------------------------------------------------------
|
||||
|
||||
function field(bytes, start, length) {
|
||||
const slice = bytes.subarray(start, start + length);
|
||||
const end = slice.indexOf(0);
|
||||
return decodeText(end < 0 ? slice : slice.subarray(0, end));
|
||||
}
|
||||
|
||||
function octal(bytes, start, length) {
|
||||
const text = field(bytes, start, length).trim();
|
||||
return /^[0-7]+$/.test(text) ? parseInt(text, 8) : 0;
|
||||
}
|
||||
|
||||
// A tar header's checksum: the sum of its bytes with the checksum field
|
||||
// itself counted as spaces, as tar(5) defines it.
|
||||
function tarChecksumOk(header) {
|
||||
let sum = 0;
|
||||
for (let i = 0; i < 512; i += 1) sum += i >= 148 && i < 156 ? 32 : header[i];
|
||||
return sum === octal(header, 148, 8);
|
||||
}
|
||||
|
||||
// The names of a tar archive, fed in pieces as it streams in: ustar, GNU long
|
||||
// names and pax paths. Member data is counted past, never kept.
|
||||
export class TarNames {
|
||||
constructor() {
|
||||
this.buffer = new Uint8Array(0);
|
||||
this.skip = 0;
|
||||
this.collect = null;
|
||||
this.longName = null;
|
||||
this.headers = 0;
|
||||
this.ended = false;
|
||||
}
|
||||
|
||||
push(bytes) {
|
||||
const names = [];
|
||||
let data = bytes;
|
||||
while (data.length && !this.ended) {
|
||||
if (this.skip > 0) {
|
||||
const n = Math.min(this.skip, data.length);
|
||||
this.skip -= n;
|
||||
data = data.subarray(n);
|
||||
continue;
|
||||
}
|
||||
if (this.collect) {
|
||||
const n = Math.min(this.collect.left, data.length);
|
||||
this.collect.parts.push(data.slice(0, n));
|
||||
this.collect.left -= n;
|
||||
data = data.subarray(n);
|
||||
if (this.collect.left === 0) {
|
||||
const joined = new Uint8Array(this.collect.parts.reduce((t, p) => t + p.length, 0));
|
||||
let at = 0;
|
||||
for (const p of this.collect.parts) { joined.set(p, at); at += p.length; }
|
||||
const body = decodeText(joined);
|
||||
if (this.collect.type === 'L') this.longName = body.replace(/\0[\s\S]*$/, '');
|
||||
else {
|
||||
const path = /(?:^|\n)\d+ path=([^\n]*)\n/.exec(body);
|
||||
if (path) this.longName = path[1];
|
||||
}
|
||||
this.skip = this.collect.padding;
|
||||
this.collect = null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const take = Math.min(512 - this.buffer.length, data.length);
|
||||
const header = new Uint8Array(this.buffer.length + take);
|
||||
header.set(this.buffer);
|
||||
header.set(data.subarray(0, take), this.buffer.length);
|
||||
data = data.subarray(take);
|
||||
if (header.length < 512) { this.buffer = header; continue; }
|
||||
this.buffer = new Uint8Array(0);
|
||||
if (header.every(b => b === 0)) { this.ended = true; break; }
|
||||
if (!tarChecksumOk(header)) {
|
||||
if (!this.headers) throw new Error('Not a tar archive');
|
||||
this.ended = true; // the rest of one that was cut off or damaged
|
||||
break;
|
||||
}
|
||||
this.headers += 1;
|
||||
const size = octal(header, 124, 12);
|
||||
const padded = Math.ceil(size / 512) * 512;
|
||||
const type = String.fromCharCode(header[156] || 48);
|
||||
if ((type === 'L' || type === 'x') && size > 0 && size <= 65536) {
|
||||
this.collect = { type, left: size, parts: [], padding: padded - size };
|
||||
continue;
|
||||
}
|
||||
if (type === 'L' || type === 'x' || type === 'g' || type === 'K') { this.skip = padded; continue; }
|
||||
const prefix = field(header, 0x159, 155);
|
||||
names.push(this.longName || (prefix ? `${prefix}/${field(header, 0, 100)}` : field(header, 0, 100)));
|
||||
this.longName = null;
|
||||
this.skip = padded;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
async function* tarNameStream(reader) {
|
||||
const tar = new TarNames();
|
||||
let gunzip = null;
|
||||
let pending = [];
|
||||
for await (const chunk of reader.stream()) {
|
||||
if (gunzip === null) {
|
||||
if (chunk.length > 2 && chunk[0] === 0x1f && chunk[1] === 0x8b) {
|
||||
const { Gunzip } = await import('fflate');
|
||||
gunzip = new Gunzip();
|
||||
gunzip.ondata = data => { if (!tar.ended) pending.push(...tar.push(data)); };
|
||||
} else gunzip = false;
|
||||
}
|
||||
// Small pieces, so a gzip bomb inflates a little at a time and stops as
|
||||
// soon as the view has enough names.
|
||||
for (let at = 0; at < chunk.length; at += FEED_BYTES) {
|
||||
const piece = chunk.subarray(at, at + FEED_BYTES);
|
||||
if (gunzip) gunzip.push(piece, false);
|
||||
else pending.push(...tar.push(piece));
|
||||
if (pending.length) { yield* pending; pending = []; }
|
||||
if (tar.ended) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- iCalendar ----------------------------------------------------------------
|
||||
|
||||
// The VEVENTs and VTODOs of a calendar, fed as text as it streams in; each is
|
||||
// read by WeKan's own parseICalendar on its own.
|
||||
export class IcsComponents {
|
||||
constructor(parseICalendar) {
|
||||
this.parse = parseICalendar;
|
||||
this.rest = '';
|
||||
this.line = null;
|
||||
this.lines = null;
|
||||
this.depth = 0;
|
||||
this.bytes = 0;
|
||||
this.started = false;
|
||||
}
|
||||
|
||||
logical(line, out) {
|
||||
if (!this.started) {
|
||||
if (!line.trim()) return;
|
||||
if (!/^BEGIN:VCALENDAR$/i.test(line.trim())) throw new Error('Not an iCalendar file: no BEGIN:VCALENDAR');
|
||||
this.started = true;
|
||||
return;
|
||||
}
|
||||
const upper = line.toUpperCase();
|
||||
if (!this.lines) {
|
||||
if (upper === 'BEGIN:VEVENT' || upper === 'BEGIN:VTODO') { this.lines = [line]; this.depth = 1; this.bytes = line.length; }
|
||||
return;
|
||||
}
|
||||
this.lines.push(line);
|
||||
this.bytes += line.length;
|
||||
if (upper.startsWith('BEGIN:')) this.depth += 1;
|
||||
else if (upper.startsWith('END:')) this.depth -= 1;
|
||||
if (this.depth === 0) {
|
||||
const text = `BEGIN:VCALENDAR\r\n${this.lines.join('\r\n')}\r\nEND:VCALENDAR\r\n`;
|
||||
this.lines = null;
|
||||
try { out.push(...this.parse(text).tasks); } catch (e) { /* one broken item: the others still show */ }
|
||||
} else if (this.bytes > MAX_COMPONENT_BYTES) {
|
||||
this.lines = null; // an item this large is not shown
|
||||
}
|
||||
}
|
||||
|
||||
push(text, final = false) {
|
||||
const out = [];
|
||||
const parts = (this.rest + text).split(/\r?\n/);
|
||||
this.rest = final ? '' : parts.pop();
|
||||
for (const raw of parts) {
|
||||
if (/^[ \t]/.test(raw) && this.line !== null) { this.line += raw.slice(1); continue; }
|
||||
if (this.line !== null) this.logical(this.line, out);
|
||||
this.line = raw;
|
||||
}
|
||||
if (final && this.line !== null) { this.logical(this.line, out); this.line = null; }
|
||||
if (final && !this.started) throw new Error('Not an iCalendar file: no BEGIN:VCALENDAR');
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
async function* calendarStream(reader) {
|
||||
const { parseICalendar } = await import('../../models/lib/icalendarFormat.js');
|
||||
const ics = new IcsComponents(parseICalendar);
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
for await (const chunk of reader.stream()) {
|
||||
for (let at = 0; at < chunk.length; at += FEED_BYTES * 16) {
|
||||
const tasks = ics.push(decoder.decode(chunk.subarray(at, at + FEED_BYTES * 16), { stream: true }));
|
||||
if (tasks.length) yield* tasks;
|
||||
}
|
||||
}
|
||||
yield* ics.push(decoder.decode(), true);
|
||||
}
|
||||
|
||||
// --- converted previews: Outlook .msg, OpenDocument -----------------------------
|
||||
|
||||
function recordRenderer(doc, labels) {
|
||||
const field = { subject: labels.subject, from: labels.from, to: labels.to, cc: labels.cc, date: labels.date };
|
||||
return (rows, viewport) => {
|
||||
viewport.replaceChildren(...rows.map(row => {
|
||||
if (!row) return element(doc, 'div', '', 'attachment-window-row');
|
||||
if (row.k === 'row') return cellsRow(doc, (row.c || []).map(String));
|
||||
if (row.k === 'field' || row.k === 'file') {
|
||||
const el = element(doc, 'div', undefined, 'attachment-window-row attachment-preview-field');
|
||||
el.appendChild(element(doc, 'span', row.k === 'file' ? labels.attachments : (field[row.l] || row.l), 'attachment-preview-label'));
|
||||
el.appendChild(element(doc, 'span', row.k === 'field' && row.l === 'date' ? localDate(row.v) : String(row.v ?? '')));
|
||||
return el;
|
||||
}
|
||||
const cls = { h: 'attachment-preview-heading', page: 'attachment-preview-page', more: 'attachment-preview-more' }[row.k] || '';
|
||||
return element(doc, 'div', String(row.v ?? ''), `attachment-window-row ${cls}`.trim());
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
async function openRecords({ container, url, signal, fetchImpl, labels, viewportHeight }) {
|
||||
const records = await new PreviewRecords(url, { signal, fetchImpl }).open();
|
||||
if (signal && signal.aborted) return { destroy() {} };
|
||||
container.replaceChildren();
|
||||
if (!records.count) {
|
||||
container.textContent = labels.empty;
|
||||
return { records, destroy() { container.replaceChildren(); } };
|
||||
}
|
||||
// A preview the server's disk guard ended (attachmentPreviewStore.js
|
||||
// MAX_PREVIEW_BYTES) ends with a row that says so, without words.
|
||||
const extra = records.meta.truncated ? 1 : 0;
|
||||
const view = new IndexedView(container, {
|
||||
count: records.count + extra, viewportHeight, className: 'attachment-preview-records',
|
||||
rowsAt: async (first, n) => {
|
||||
const rows = await records.rowsAt(first, Math.min(n, records.count - first));
|
||||
if (extra && first + n > records.count) rows.push({ k: 'more', v: '\u22ef' });
|
||||
return rows;
|
||||
},
|
||||
renderRows: recordRenderer(container.ownerDocument, labels),
|
||||
});
|
||||
await view.start();
|
||||
return { view, records, destroy() { view.destroy(); container.replaceChildren(); } };
|
||||
}
|
||||
|
||||
// --- opening ------------------------------------------------------------------
|
||||
|
||||
function batches(iterator) {
|
||||
return async () => {
|
||||
const rows = [];
|
||||
while (rows.length < ROWS_PER_READ) {
|
||||
const { value, done } = await iterator.next();
|
||||
if (done) break;
|
||||
rows.push(value);
|
||||
}
|
||||
return rows.length ? rows : null;
|
||||
};
|
||||
}
|
||||
|
||||
function localDate(value) {
|
||||
if (!value) return '';
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.getTime()) ? String(value) : date.toLocaleString();
|
||||
}
|
||||
|
||||
async function openGrowing({ container, next, renderRow, header, className, listTag, viewportHeight, emptyText }) {
|
||||
const view = new GrowingView(container, { next, renderRow, className, listTag, viewportHeight });
|
||||
if (header) view.viewport.insertBefore(header, view.list);
|
||||
await view.start();
|
||||
if (!view.rows.length && view.done) {
|
||||
view.destroy();
|
||||
container.textContent = emptyText;
|
||||
return { destroy() { container.replaceChildren(); } };
|
||||
}
|
||||
return { view, destroy() { view.destroy(); } };
|
||||
}
|
||||
|
||||
// Open one file into `container`. Resolves to { destroy() }, which the
|
||||
// slideshow calls when it moves on or closes. A file whose first read arrives
|
||||
// after the slideshow moved on (signal aborted) is not rendered.
|
||||
export async function openRichAttachment({ container, rich, extension, language, signal, size, url,
|
||||
labels = {}, renderMarkdown, fetchImpl, viewportHeight }) {
|
||||
const reader = new RangeReader(url, size, { signal, fetchImpl });
|
||||
await reader.probeSize();
|
||||
if (signal && signal.aborted) return { destroy() {} };
|
||||
const doc = container.ownerDocument;
|
||||
switch (rich) {
|
||||
case 'text': case 'markdown': case 'csv': case 'code':
|
||||
return openTextWindow({ container, reader, rich, language, extension, renderMarkdown, viewportHeight });
|
||||
case 'tar':
|
||||
container.replaceChildren();
|
||||
return openGrowing({ container, listTag: 'ul', viewportHeight, emptyText: labels.empty,
|
||||
next: batches(tarNameStream(reader)), renderRow: name => element(doc, 'li', name) });
|
||||
case 'calendar': {
|
||||
container.replaceChildren();
|
||||
const head = cellsRow(doc, [labels.title, labels.start, labels.end, labels.due, labels.description], 'attachment-csv-header');
|
||||
return openGrowing({ container, viewportHeight, emptyText: labels.empty, header: head, className: 'attachment-preview-csv',
|
||||
next: batches(calendarStream(reader)),
|
||||
// parseICalendar puts a VEVENT in the list "Events" and gives it its
|
||||
// DTEND as date_due; a VTODO's date_due is its DUE and date_end its
|
||||
// completion.
|
||||
renderRow: task => {
|
||||
const isEvent = task.column_name === 'Events';
|
||||
return cellsRow(doc, [task.title, localDate(task.date_started),
|
||||
isEvent ? localDate(task.date_due) : localDate(task.date_end),
|
||||
isEvent ? '' : localDate(task.date_due), task.description || '']);
|
||||
} });
|
||||
}
|
||||
case 'opendocument':
|
||||
case 'outlook':
|
||||
return openRecords({ container, url, signal, fetchImpl, labels, viewportHeight });
|
||||
default:
|
||||
throw new TypeError(`No viewer for ${rich}`);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 1360 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user