Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Basic Case Management/Dynamic Data Attachments #3057

Merged
merged 400 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from 235 commits
Commits
Show all changes
400 commits
Select commit Hold shift + click to select a range
db263ab
Merge branch '2487-form-media' into 2767-basic-case-management
noliveleger Mar 16, 2021
4466fb5
Merge branch '2487-form-media' into 2767-basic-case-management
noliveleger Mar 19, 2021
9522347
Merge remote-tracking branch 'origin/2487-form-media' into 2767-basic…
duvld Mar 29, 2021
70e9d54
PR Changes: moved dda actions to seprate file
duvld Mar 29, 2021
031c653
PR Changes: simplified action responses
duvld Mar 29, 2021
68e75b4
PR Changes: simplified parent array response
duvld Mar 29, 2021
52c6dfa
PR Changes: use new trucnate util functions remove old comments
duvld Mar 29, 2021
937b688
PR Changes: made util function for getting uid from url
duvld Mar 29, 2021
c705eb4
PR Changes: replace hard coded routes with constants
duvld Mar 29, 2021
f9b40c0
PR Changes: remove unused class
duvld Mar 29, 2021
5c9fd61
PR Changes: replace hard coded routes with constans
duvld Mar 29, 2021
7da3dfe
remove unused route
duvld Mar 29, 2021
b427945
PR Changes: better class name for sidebar label
duvld Mar 29, 2021
9c40b2e
PR Changes: use abs import route
duvld Mar 29, 2021
5b57f37
PR Changes: remove non-neutral boolean names
duvld Mar 29, 2021
358f989
PR Changes: call actions after listener is hooked
duvld Mar 29, 2021
feb85b6
PR Changes: update isSharing with response instead of internally
duvld Mar 29, 2021
e53c6cf
PR Changes: mark error responses for translation
duvld Mar 29, 2021
d6e706c
PR Changes: add comment to ambiguous function
duvld Mar 29, 2021
3688ad4
PR Changes: use modal helpers renderLoading
duvld Mar 29, 2021
9fe3c20
PR Changes: simplify switch logic
duvld Mar 29, 2021
973d2e5
PR Changes: refactor rendering import select
duvld Mar 29, 2021
436bcd3
PR Changes: remove useless guard
duvld Mar 29, 2021
217dc11
PR Changes: remove unused css class
duvld Mar 29, 2021
f7aa3c0
PR Changes: use non breaking space in jsx
duvld Mar 29, 2021
de59b0b
PR Changes: use consitent booleans
duvld Mar 29, 2021
60efe29
PR Changes: improve CSS
duvld Mar 30, 2021
a41a66c
Merge branch '2767-basic-case-management' into 2767-column-filtering
duvld Mar 30, 2021
42264c5
missed action response simplification
duvld Mar 30, 2021
42e3808
remove duplicate `multiCheckbox`
duvld Mar 30, 2021
a2672a8
remove non-neutral booleans
duvld Mar 30, 2021
82a8b26
WIP - Validate whether user is allow to perform write actions with pa…
noliveleger Mar 31, 2021
d716cbf
Add abstract methods to BaseDeploymentBack class
noliveleger Apr 1, 2021
c60e31b
Remove useless "method" paramater in "DeploymentBackend.set_validatio…
noliveleger Apr 1, 2021
81dfa59
WIP - consistency for user vs requesting_user vs requesting_user_id
noliveleger Apr 1, 2021
bbc4d65
WIP - Validate whether user is allow to perform write actions with pa…
noliveleger Mar 31, 2021
ff4dc0e
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 6, 2021
cf5a1ab
Move validation of write access to backend base class, update some do…
noliveleger Apr 7, 2021
b1043e6
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 7, 2021
ca0ed46
PR changes
duvld Apr 7, 2021
2a8f080
PR Changes
duvld Apr 12, 2021
7dd0f69
PR Changes: export generateAutoname for utils
duvld Apr 12, 2021
4cea022
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger Apr 13, 2021
9f2a7ad
Remove args/returns keywords from new docstrings
noliveleger Apr 13, 2021
c5ee67a
Reorder classes alphabetically in permissions.py
noliveleger Apr 13, 2021
2e2baf9
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger Apr 13, 2021
aa86dfd
Use new exceptions: AbstractMethodError, AbstractPropertyError
noliveleger Apr 13, 2021
b6d1fa4
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger Apr 13, 2021
021b676
Code clean-up and reformat
noliveleger Apr 13, 2021
2f2387b
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger Apr 13, 2021
045b975
Merge branch '2767-basic-case-management' into 3115-allowed-write-act…
noliveleger Apr 13, 2021
219e243
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 13, 2021
a0c3ffe
Fixed bad merge
noliveleger Apr 14, 2021
e927b80
WIP tiny fix
noliveleger Apr 14, 2021
15c5d10
WIP - validation write access with partial perms
noliveleger Apr 14, 2021
435788e
WIP - add validation check for partial permissions
noliveleger Apr 14, 2021
db55f67
refactoring: centralize bulk action validation for submission_ids
noliveleger Apr 14, 2021
de6f676
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger Apr 20, 2021
8ab18b8
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger Apr 20, 2021
f4bec05
Merge branch '2767-basic-case-management' into 3115-allowed-write-act…
noliveleger Apr 20, 2021
7c628f8
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 20, 2021
b4e6b80
Add tests for row level write permissions, refactor mock backend to s…
noliveleger Apr 22, 2021
79e6e0c
Fixed: users with any partial permissions is granted access to all su…
noliveleger Apr 22, 2021
82c94c7
Add `validation_status.uid` and `confirm` to DataBulkActionsValidator
noliveleger Apr 22, 2021
9522bd7
Coerce instance ids to int when validating them on row level write ac…
noliveleger Apr 22, 2021
b52a8da
Add tests for bulk validate statuses with partial permissions
noliveleger Apr 22, 2021
cb63114
Allow DELETE/PATCH actions on all submissions at once or with a query
noliveleger Apr 27, 2021
56cdd8c
Fixed tests for v1
noliveleger Apr 27, 2021
8b22517
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 27, 2021
52d7ac3
Add test ts for bulk delete submissions
noliveleger Apr 27, 2021
168eaa5
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 28, 2021
5a19abf
Standarize variable names for submission ID and user, make
noliveleger Apr 28, 2021
29d9e5f
Clean up unused imports
noliveleger Apr 28, 2021
d078239
Rename Hook.instance_id to Hook.submission_id
noliveleger Apr 28, 2021
6bce326
Use MockMongo to use mock submissions in unit tests
noliveleger Apr 29, 2021
2af3488
Make the tests pass with MockMongo and dynamic subset of submissioms
noliveleger Apr 30, 2021
7c6fcd2
Forgotten `submission_pk` and remove wrong `FIXME`s
noliveleger Apr 30, 2021
58930a1
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Apr 30, 2021
e225c6c
Fixed: Hook app unit tests fail with XML submissions
noliveleger Apr 30, 2021
b2ec450
Fixed: api v1 submissions unit tests fail: Wrong variable call
noliveleger Apr 30, 2021
b205e00
Fixed: Some tests are failing because "_id" is auto assigned
noliveleger Apr 30, 2021
a3464cd
Remove FIXME comment because of kpi#3148
noliveleger Apr 30, 2021
a39a96b
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 30, 2021
c321ea9
Fixed typo
noliveleger Apr 30, 2021
b1a6087
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger Apr 30, 2021
4ec222b
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger Apr 30, 2021
2d5622b
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger Apr 30, 2021
7e71c4b
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Apr 30, 2021
5e5e8bb
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Apr 30, 2021
c9eed76
Move deepmerge pip dependency to production
noliveleger May 3, 2021
9404a26
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger May 4, 2021
ae9d02d
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 4, 2021
ea27de1
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 4, 2021
aab2688
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 4, 2021
89f6900
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 4, 2021
c84d0f5
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 4, 2021
06172dc
Replace deprecated "renderLoading" function with LoadingSpinner compo…
noliveleger May 4, 2021
c744e32
Replace deprecated "renderLoading" function with LoadingSpinner compo…
noliveleger May 4, 2021
44ef72c
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 4, 2021
f9a58d6
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 4, 2021
4b03813
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 4, 2021
3bda82d
don't use string label in QUESTION_TYPES constants
duvld May 4, 2021
6b4b848
Merge branch '2487-form-media' into 2767-basic-case-management
duvld May 4, 2021
64d7814
Merge branch '2767-basic-case-management' into 2767-column-filtering
duvld May 4, 2021
adf48ca
Merge branch '2767-basic-case-management' of github.com:kobotoolbox/k…
noliveleger May 7, 2021
3592a56
Allow users with `change_form` permissions to (un)link parent projects
noliveleger May 7, 2021
fde1395
Change test to allow editors to (un)link projects
noliveleger May 10, 2021
df22d63
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 10, 2021
fc7b222
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 10, 2021
aac03a9
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 10, 2021
c4ca74c
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 10, 2021
6563d8d
Other replacements for 'submission_pk' and 'pk'
noliveleger May 12, 2021
3518d3b
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 12, 2021
e3e5ca4
Fixed: Wrong submission detail url in mockbackend
noliveleger May 13, 2021
e1bc004
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger May 14, 2021
0dbf4e6
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 14, 2021
cec384e
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 14, 2021
73188df
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 14, 2021
acf17c7
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 14, 2021
3327aa6
Missing import
noliveleger May 14, 2021
65d4ca3
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger May 14, 2021
9d1be9d
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 14, 2021
f7ae1f4
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 14, 2021
106a536
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 14, 2021
ee68584
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 14, 2021
d79f2ea
Fixed bad previous merge
noliveleger May 14, 2021
f6c9638
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 14, 2021
44d4588
Fixed bad merge
noliveleger May 14, 2021
8901d19
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 14, 2021
e1f1d57
Restore variable name
noliveleger May 14, 2021
29085a0
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 14, 2021
38991b6
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger May 17, 2021
7a2a3fb
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 17, 2021
0f123d1
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 17, 2021
84c0061
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 17, 2021
e10a2e9
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 17, 2021
19bcb8b
Merge branch '2487-form-media-alphabetized-methods' into 2767-basic-c…
noliveleger May 25, 2021
f4f7690
Merge branch '2767-basic-case-management' into 2767-column-filtering
noliveleger May 25, 2021
796b88e
Merge branch '2767-column-filtering' into 3115-allowed-write-actions-…
noliveleger May 27, 2021
e15f7da
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger May 27, 2021
b5889ce
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger May 27, 2021
1f66c3b
PR changes: use boolean instead of truthy value
duvld May 27, 2021
151d857
PR changes: use button instead of `a` or `i`
duvld May 27, 2021
fe3ce99
PR changes: new gray scheme
duvld May 27, 2021
bffe294
PR changes: link to backend generating autoname
duvld May 28, 2021
59e8489
Merge pull request #3117 from kobotoolbox/2767-column-filtering
magicznyleszek May 31, 2021
d14a672
Merge branch 'beta' into 2767-basic-case-management
noliveleger Jun 4, 2021
ec05469
Merge branch 'beta' into 2767-basic-case-management
noliveleger Jun 8, 2021
5b8e1f6
Stop shadowing "hash" python built-in function with object properties
noliveleger Jun 8, 2021
f7f5a28
Use new KC metadata file type "paired_data" instead of a regex to det…
noliveleger Jun 8, 2021
d182e42
Use abc.ABC metaclass instead of pseudo implementation of abstraction…
noliveleger Jun 9, 2021
3facf0a
Fixed: Cannot run manage.py migrate because of meta classes conflicts
noliveleger Jun 9, 2021
aede0b2
Move `AssetSnapshot` class away from `kpi/models/asset.py` to its own…
noliveleger Jun 10, 2021
8d65260
Merge branch 'beta' into 2767-basic-case-management
noliveleger Jun 10, 2021
454bf8a
Merge branch '2767-basic-case-management' into 3134-use-abc-with-djan…
noliveleger Jun 10, 2021
2f46291
Merge branch '3134-use-abc-with-django-models' into refactor-model-utils
noliveleger Jun 10, 2021
9a08a22
Merge branch 'refactor-model-utils' into 3115-allowed-write-actions-w…
noliveleger Jun 10, 2021
5a6ecdc
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jun 10, 2021
6c11945
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jun 10, 2021
78e0e05
Add "Mixin" suffix to Asset mixins
noliveleger Jun 10, 2021
7b1561a
Split apart file `kpi/models/object_permission.py` between model, mix…
noliveleger Jun 10, 2021
c432312
Get rid of "ObjectPermissionHelper" class, moved static methods to ut…
noliveleger Jun 10, 2021
c4ecec1
Merge branch 'beta' into 2767-basic-case-management
magicznyleszek Jun 17, 2021
bdc2673
Merge branch '2767-basic-case-management' into 3134-use-abc-with-djan…
noliveleger Jun 17, 2021
0091d8e
Merge branch '3134-use-abc-with-django-models' into refactor-model-utils
noliveleger Jun 17, 2021
0337eb3
Merge branch 'beta' into 2767-basic-case-management
noliveleger Jun 21, 2021
67bda2a
Merge branch '2767-basic-case-management' into 3134-use-abc-with-djan…
noliveleger Jun 21, 2021
8128358
Merge branch '3134-use-abc-with-django-models' into refactor-model-utils
noliveleger Jun 21, 2021
2d9c6c1
Merge branch 'refactor-model-utils' into 3115-allowed-write-actions-w…
noliveleger Jun 21, 2021
1bcd83a
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jun 21, 2021
dbb7b47
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jun 21, 2021
422311b
Add missing formpack import
noliveleger Jun 21, 2021
e3425ed
Merge branch 'refactor-model-utils' into 3115-allowed-write-actions-w…
noliveleger Jun 21, 2021
6d372ce
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jun 21, 2021
82b85e1
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jun 21, 2021
fc4cc91
Merge branch 'beta' into 2767-basic-case-management
duvld Jun 28, 2021
c3bcf98
Merge branch 'beta' into 2767-basic-case-management
noliveleger Jul 5, 2021
991757a
Merge branch '2767-basic-case-management' into 3134-use-abc-with-djan…
noliveleger Jul 5, 2021
7806c16
Merge branch '3134-use-abc-with-django-models' into refactor-model-utils
noliveleger Jul 5, 2021
5bf1055
Fixed: migrations conflicts
noliveleger Jul 5, 2021
7e7123d
Merge branch '2767-basic-case-management' into 3134-use-abc-with-djan…
noliveleger Jul 6, 2021
5fc9edb
Merge branch '3134-use-abc-with-django-models' into refactor-model-utils
noliveleger Jul 6, 2021
c165675
Merge branch 'refactor-model-utils' into 3115-allowed-write-actions-w…
noliveleger Jul 6, 2021
ef6edf5
Fix wrong import path
noliveleger Jul 6, 2021
d14a586
Merge branch 'refactor-model-utils' into 3115-allowed-write-actions-w…
noliveleger Jul 6, 2021
a2fd02c
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jul 6, 2021
2341b73
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jul 6, 2021
fa4a014
Fixed bad previous merge
noliveleger Jul 6, 2021
7bcc3e8
Fixed unit failing tests after merge
noliveleger Jul 6, 2021
6f4dfc1
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jul 6, 2021
4116d5f
Fixed failing unit tests: Wrong detail submission endpoint url
noliveleger Jul 6, 2021
3aeb2b2
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jul 6, 2021
b652dc3
Rename parent to source in dynamic data linking
jnm Jul 7, 2021
3dac21c
Fix mistake in prior renaming
jnm Jul 7, 2021
879f03e
Remove swap file. Oops.
jnm Jul 7, 2021
fb49886
Apply changes from first day of reviewing #3057
jnm Jul 8, 2021
33c8f0d
Refactored assertions
noliveleger Jul 8, 2021
fa5a4c3
Fixed: hashing remote content crashes when remote server does not ret…
noliveleger Jul 8, 2021
1107ae6
Removed #noqa for PEP-8 E501 (line too long) when line is smaller tha…
noliveleger Jul 12, 2021
a66c43f
Applied requested changes in PR#3057
noliveleger Jul 12, 2021
4046d2f
Get rid of PairedData object hash calculation. Use related AssetFile …
noliveleger Jul 13, 2021
7fb92fe
Simplify hashing utility algorithm: Get rid of `fast` option. Use
noliveleger Jul 13, 2021
903c1f9
Clarify asset file / paired data code
jnm Jul 13, 2021
4c681b5
Fix missing `file_type` on `PairedData`
jnm Jul 8, 2021
e41a8db
Standardize translation of AnonymousUser to User
jnm Jul 8, 2021
7a3976b
Standardize formpack access
jnm Jul 14, 2021
36ef28e
Add new is_user_anonymous() utility function and…
jnm Jul 14, 2021
f260c20
Consistently use "writable" spelling
jnm Jul 14, 2021
b3b0f19
Improve WritableJSONField validation error
jnm Jul 14, 2021
ef47ee6
Add minor improvements from review of #3057
jnm Jul 14, 2021
70f8030
Fixed: xml-external endpoint does not respect source fields list
noliveleger Jul 14, 2021
e87159d
Change tests to match new WritableJSONField error
jnm Jul 14, 2021
8fb73e4
Merge branch '2767-basic-case-management' into 2767-simplier-hash-tmp
noliveleger Jul 15, 2021
0c66fc9
Void cache on preview, do not cache xml-external XML when source has …
noliveleger Jul 15, 2021
5f336e8
Restore setters for filename, mimetype in AssetFile class
noliveleger Jul 15, 2021
2a93d13
Rename root node using XML tree
jnm Jul 15, 2021
e2006fc
Improve API terminology
jnm Jul 15, 2021
bf5a831
Remove `deployment__status` since `AssetFile`s…
jnm Jul 15, 2021
086e07d
Add support for all hashing mechanisms of hashlib library
noliveleger Jul 15, 2021
d9be384
Use abc.ABC metaclass instead of pseudo implementation of abstraction…
noliveleger Jun 9, 2021
efe2c3c
Fixed: Cannot run manage.py migrate because of meta classes conflicts
noliveleger Jun 9, 2021
93919e7
Make XML declaration detection more universal
jnm Jul 15, 2021
8c0adb4
ES6 related PR changes
duvld Jul 15, 2021
6a2f238
Merge branch '2767-basic-case-management' of https://github.com/kobot…
duvld Jul 15, 2021
622363a
Merge pull request #3268 from kobotoolbox/3134-use-abc-with-django-mo…
jnm Jul 15, 2021
29c8c26
Merge branch '2767-basic-case-management' of https://github.com/kobot…
duvld Jul 15, 2021
711ef46
fix empty alertify message for filename errors
duvld Jul 15, 2021
57086c8
Revert locale
jnm Jul 15, 2021
1b25938
Add aspirational comment
jnm Jul 15, 2021
55f8a84
Merge branch '2767-basic-case-management' into 2767-simpler-hashing
noliveleger Jul 15, 2021
6cef1e1
Merge branch '2767-simpler-hashing' of github.com:kobotoolbox/kpi int…
noliveleger Jul 15, 2021
f02f20f
Merge pull request #3345 from kobotoolbox/2767-simpler-hashing
noliveleger Jul 15, 2021
19791f4
Merge branch '2767-basic-case-management' into 2767-void-cache-on-pre…
noliveleger Jul 15, 2021
47ae961
some CSS PR changes
duvld Jul 15, 2021
de9ae8b
Merge branch '2767-basic-case-management' of https://github.com/kobot…
duvld Jul 15, 2021
fab8906
Merge branch '2767-void-cache-on-preview' into refactor-model-utils
noliveleger Jul 15, 2021
5ea066d
Merge branch '2767-basic-case-management' into refactor-model-utils
noliveleger Jul 15, 2021
ee4fa73
Merge pull request #3346 from kobotoolbox/2767-void-cache-on-preview
jnm Jul 15, 2021
435aa2f
Merge pull request #3271 from kobotoolbox/refactor-model-utils
jnm Jul 15, 2021
4c8f23a
Merge branch 'beta' into 2767-basic-case-management
duvld Jul 19, 2021
7622e09
add (not yet published) support url
duvld Jul 19, 2021
86beb8d
Merge branch '2767-basic-case-management' into 3115-allowed-write-act…
noliveleger Jul 20, 2021
fc51432
Revise comment
jnm Jul 20, 2021
af0968e
Add docstring
jnm Jul 20, 2021
06ef9b7
Merge branch '3115-allowed-write-actions-with-partial-perm' of github…
noliveleger Jul 21, 2021
fc4e460
Merge branch '3115-allowed-write-actions-with-partial-perm' into 3115…
noliveleger Jul 21, 2021
b09eaff
Merge branch '3115-refactoring' into 3115-mockbackend-with-mongo-support
noliveleger Jul 21, 2021
d9727c3
Merge pull request #3123 from kobotoolbox/3115-allowed-write-actions-…
jnm Jul 26, 2021
b853fff
Merge pull request #3124 from kobotoolbox/3115-refactoring
jnm Jul 26, 2021
bf20376
Merge pull request #3173 from kobotoolbox/3115-mockbackend-with-mongo…
jnm Jul 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jsapp/js/actions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import libraryActions from './actions/library';
import submissionsActions from './actions/submissions';
import formMediaActions from './actions/mediaActions';
import exportsActions from './actions/exportsActions';
import dataShareActions from './actions/datashare';
duvld marked this conversation as resolved.
Show resolved Hide resolved
import {
notify,
replaceSupportEmail,
Expand All @@ -34,6 +35,7 @@ export const actions = {
submissions: submissionsActions,
media: formMediaActions,
exports: exportsActions,
dataShare: dataShareActions,
};

actions.navigation = Reflux.createActions([
Expand Down
110 changes: 110 additions & 0 deletions jsapp/js/actions/datashare.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* Dynamic data attachment related actions
*/

import Reflux from 'reflux';
import alertify from 'alertifyjs';
import {dataInterface} from 'js/dataInterface';
import {MAX_DISPLAYED_STRING_LENGTH} from '../constants';
duvld marked this conversation as resolved.
Show resolved Hide resolved
import {
getAssetUIDFromUrl,
truncateFile,
truncateString,
} from '../utils';
duvld marked this conversation as resolved.
Show resolved Hide resolved

const dataShareActions = Reflux.createActions({
attachToSource: {children: ['completed', 'failed']},
detachSource: {children: ['completed', 'failed']},
patchSource: {children: ['completed', 'failed']},
getAttachedSources: {children: ['completed', 'failed']},
getSharingEnabledAssets: {children: ['completed', 'failed']},
toggleDataSharing: {children: ['completed', 'failed']},
updateColumnFilters: {children: ['completed', 'failed']},
});

dataShareActions.attachToSource.listen((assetUid, data) => {
dataInterface.attachToSource(assetUid, data)
.done(dataShareActions.attachToSource.completed)
.fail(dataShareActions.attachToSource.failed);
});
dataShareActions.attachToSource.failed.listen((response) => {
alertify.error(response?.responseJSON || t('Failed to attach to source'));
});

dataShareActions.detachSource.listen((attachmentUrl) => {
dataInterface.detachSource(attachmentUrl)
.done(dataShareActions.detachSource.completed)
.fail(dataShareActions.detachSource.failed);
});
dataShareActions.detachSource.failed.listen((response) => {
alertify.error(response?.responseJSON || t('Failed to detach from source'));
});

dataShareActions.patchSource.listen((attachmentUrl, data) => {
dataInterface.patchSource(attachmentUrl, data)
.done(dataShareActions.patchSource.completed)
.fail(dataShareActions.patchSource.failed)
});
dataShareActions.patchSource.failed.listen((response) => {
alertify(response?.responseJSON || t('Failed to patch source'));
});

dataShareActions.getAttachedSources.listen((assetUid) => {
dataInterface.getAttachedSources(assetUid)
.done((response) => {
let allSources = [];
response.results.forEach((source) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment why do we need to overwrite the backend responses, i.e. why backend doesn't fromat it that way in the first place

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: is it a problem pagination-wise, that we no longer return all response properties? We lose next, prev, count, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, I've left a comment to investigate this later but this would only pop up if there are more than 100 connected projects which I feel like may be an edge case

let sourceUid = getAssetUIDFromUrl(source.source);
allSources.push({
sourceName: truncateString(
source.source__name,
MAX_DISPLAYED_STRING_LENGTH.connect_projects,
),
// Source's asset url
sourceUrl: source.source,
sourceUid: sourceUid,
// Fields that the connecting project has selected to import
linkedFields: source.fields,
filename: truncateFile(
source.filename,
MAX_DISPLAYED_STRING_LENGTH.connect_projects,
),
// Source project attachment endpoint
attachmentUrl: source.url,
});
});
dataShareActions.getAttachedSources.completed(allSources);
})
.fail(dataShareActions.getAttachedSources.failed);
});

dataShareActions.getSharingEnabledAssets.listen(() => {
dataInterface.getSharingEnabledAssets()
.done(dataShareActions.getSharingEnabledAssets.completed)
.fail(dataShareActions.getSharingEnabledAssets.failed);
});
dataShareActions.getSharingEnabledAssets.failed.listen(() => {
alertify.error(t('Failed to retrieve sharing enabled assets'));
});

// The next two actions have the same endpoint but must be handled very
// differently so we leave them as seperate actions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I use actions.dataShare.toggleDataSharing and the asset changes because of that, wouldn't actions.dataShare.updateColumnFilters.completed.listen() be interested in the response as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this function needs different parameters to ensure it is clearly different from the other one and wouldn't be misused. So let's make them uid, isShared and the function would build the data object by itself:

const data = JSON.stringify({
  data_sharing: {
    enabled: isShared
    fields: [],
  }
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I use actions.dataShare.toggleDataSharing and the asset changes because of that, wouldn't actions.dataShare.updateColumnFilters.completed.listen() be interested in the response as well?

So regardless if the swithch has just been turned on or off, we want an empty paried-data array, and the columns are reset to empty (matching backend functionality) after this request goes through with the listener in the modal, so the column filters are also updated.

I have the updateColumnFilters listener specifically listen for changes to the checkboxes, and toggleDataSharing handles cases where we want to set clear the columns

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this function needs different parameters to ensure it is clearly different from the other one and wouldn't be misused. So let's make them uid, isShared and the function would build the data object by itself:

const data = JSON.stringify({
  data_sharing: {
    enabled: isShared
    fields: [],
  }
});

Will make a comment for this and add it to the improvements issue :D

dataShareActions.toggleDataSharing.listen((uid, data) => {
dataInterface.patchDataSharing(uid, data)
.done(dataShareActions.toggleDataSharing.completed)
.fail(dataShareActions.toggleDataSharing.failed);
});
dataShareActions.toggleDataSharing.failed.listen((response) => {
alertify.error(response?.responseJSON?.detail || t('Failed to toggle sharing'))
});

dataShareActions.updateColumnFilters.listen((uid, data) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to above, let's make the parameters uid, isShared, fields and build data object here:

const data = JSON.stringify({
  data_sharing: {
    enabled: isShared
    fields: fields,
  }
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made a comment like above

dataInterface.patchDataSharing(uid, data)
.done(dataShareActions.updateColumnFilters.completed)
.fail(dataShareActions.updateColumnFilters.failed);
});
dataShareActions.updateColumnFilters.failed.listen((response) => {
alertify.error(response?.responseJSON || t('Failed to update column filters'));
});

export default dataShareActions;
1 change: 1 addition & 0 deletions jsapp/js/app.es6
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export var routes = (
<IndexRoute component={FormSubScreens} />
<Route path={ROUTES.FORM_MEDIA} component={FormSubScreens} />
<Route path={ROUTES.FORM_SHARING} component={FormSubScreens} />
<Route path={ROUTES.FORM_RECORDS} component={FormSubScreens} />
<Route path={ROUTES.FORM_REST} component={FormSubScreens} />
<Route path={ROUTES.FORM_REST_HOOK} component={FormSubScreens} />
<Route path={ROUTES.FORM_KOBOCAT} component={FormSubScreens} />
Expand Down
39 changes: 27 additions & 12 deletions jsapp/js/components/formSubScreens.es6
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import mixins from '../mixins';
import DocumentTitle from 'react-document-title';
import SharingForm from './permissions/sharingForm';
import ProjectSettings from './modalForms/projectSettings';
import ConnectProjects from './modalForms/connectProjects';
import FormMedia from './modalForms/formMedia';
import DataTable from 'js/components/submissions/table';
import ProjectExportsCreator from 'js/components/projectDownloads/projectExportsCreator';
Expand All @@ -18,6 +19,7 @@ import {PROJECT_SETTINGS_CONTEXTS} from '../constants';
import FormMap from './map';
import RESTServices from './RESTServices';
import ui from '../ui';
import {ROUTES} from '../constants.es6';
duvld marked this conversation as resolved.
Show resolved Hide resolved

export class FormSubScreens extends React.Component {
constructor(props){
Expand Down Expand Up @@ -58,31 +60,37 @@ export class FormSubScreens extends React.Component {
report__base = deployment__identifier.replace('/forms/', '/reports/');
}
switch(this.props.location.pathname) {
case `/forms/${this.state.uid}/data/table`:
case ROUTES.FORM_TABLE.replace(':uid', this.state.uid):
return <DataTable asset={this.state} />;
case `/forms/${this.state.uid}/data/gallery`:
case ROUTES.FORM_GALLERY.replace(':uid', this.state.uid):
iframeUrl = deployment__identifier+'/photos';
break;
case `/forms/${this.state.uid}/data/map`:
case ROUTES.FORM_MAP.replace(':uid', this.state.uid):
return <FormMap asset={this.state} />;
case `/forms/${this.state.uid}/data/map/${this.props.params.viewby}`:
case ROUTES.FORM_MAP_BY
.replace(':uid', this.state.uid)
.replace(':viewby', this.props.params.viewby):
return <FormMap asset={this.state} viewby={this.props.params.viewby}/>;
case `/forms/${this.state.uid}/data/downloads`:
case ROUTES.FORM_DOWNLOADS.replace(':uid', this.state.uid):
return this.renderProjectDownloads();
case `/forms/${this.state.uid}/settings`:
case ROUTES.FORM_SETTINGS.replace(':uid', this.state.uid):
return this.renderSettingsEditor();
case `/forms/${this.state.uid}/settings/media`:
case ROUTES.FORM_MEDIA.replace(':uid', this.state.uid):
return this.renderUpload();
case `/forms/${this.state.uid}/settings/sharing`:
case ROUTES.FORM_SHARING.replace(':uid', this.state.uid):
return this.renderSharing();
case `/forms/${this.state.uid}/settings/rest`:
case ROUTES.FORM_RECORDS.replace(':uid', this.state.uid):
return this.renderRecords();
case ROUTES.FORM_REST.replace(':uid', this.state.uid):
return <RESTServices asset={this.state} />;
case `/forms/${this.state.uid}/settings/rest/${this.props.params.hookUid}`:
case ROUTES.FORM_REST_HOOK
.replace(':uid', this.state.uid)
.replace(':hook', this.props.params.hookUid):
return <RESTServices asset={this.state} hookUid={this.props.params.hookUid}/>;
case `/forms/${this.state.uid}/settings/kobocat`:
case ROUTES.FORM_KOBOCAT.replace(':uid', this.state.uid):
iframeUrl = deployment__identifier+'/form_settings';
break;
case `/forms/${this.state.uid}/reset`:
case ROUTES.FORM_RESET.replace(':uid', this.state.uid):
return this.renderReset();
}
}
Expand Down Expand Up @@ -138,6 +146,13 @@ export class FormSubScreens extends React.Component {
</bem.FormView>
);
}
renderRecords() {
return (
<bem.FormView className='connect-projects'>
<ConnectProjects asset={this.state}/>
</bem.FormView>
);
}
renderReset() {
return (<ui.LoadingSpinner/>);
}
Expand Down
18 changes: 12 additions & 6 deletions jsapp/js/components/formViewTabs.es6
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ class FormViewTabs extends Reflux.Component {
if (
this.state.asset &&
this.state.asset.has_deployment &&
this.isActiveRoute(`/forms/${this.state.assetid}/data`)
this.isActiveRoute(ROUTES.FORM_DATA.replace(':uid', this.state.assetid))
) {
sideTabs = getFormDataTabs(this.state.assetid, stores.session.isLoggedIn);
}

if (
this.state.asset &&
this.isActiveRoute(`/forms/${this.state.assetid}/settings`)
this.isActiveRoute(ROUTES.FORM_SETTINGS.replace(':uid', this.state.assetid))
) {
sideTabs = [];

sideTabs.push({
label: t('General'),
icon: 'k-icon k-icon-settings',
path: `/forms/${this.state.assetid}/settings`,
path: ROUTES.FORM_SETTINGS.replace(':uid', this.state.assetid),
});

if (
Expand All @@ -183,14 +183,20 @@ class FormViewTabs extends Reflux.Component {
sideTabs.push({
label: t('Media'),
icon: 'k-icon k-icon-photo-gallery',
path: `/forms/${this.state.assetid}/settings/media`,
path: ROUTES.FORM_MEDIA.replace(':uid', this.state.assetid),
});
}

sideTabs.push({
label: t('Sharing'),
icon: 'k-icon k-icon-user-share',
path: `/forms/${this.state.assetid}/settings/sharing`,
path: ROUTES.FORM_SHARING.replace(':uid', this.state.assetid),
});

sideTabs.push({
label: t('Connect Projects'),
icon: 'k-icon k-icon-attach',
path: ROUTES.FORM_RECORDS.replace(':uid', this.state.assetid),
});

if (
Expand All @@ -211,7 +217,7 @@ class FormViewTabs extends Reflux.Component {
sideTabs.push({
label: t('REST Services'),
icon: 'k-icon k-icon-data-sync',
path: `/forms/${this.state.assetid}/settings/rest`,
path: ROUTES.FORM_REST.replace(':uid', this.state.assetid),
});
}
}
Expand Down
12 changes: 12 additions & 0 deletions jsapp/js/components/modal.es6
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import LibraryNewItemForm from './modalForms/libraryNewItemForm';
import LibraryUploadForm from './modalForms/libraryUploadForm';
import EncryptForm from './modalForms/encryptForm.es6';
import BulkEditSubmissionsForm from './modalForms/bulkEditSubmissionsForm.es6';
import DataAttachmentColumnsForm from './modalForms/dataAttachmentColumnsForm.es6';
import ProjectSettings from './modalForms/projectSettings';
import RESTServicesForm from './RESTServices/RESTServicesForm';
import SharingForm from './permissions/sharingForm';
Expand Down Expand Up @@ -178,6 +179,10 @@ class Modal extends React.Component {
});
break;

case MODAL_TYPES.DATA_ATTACHMENT_COLUMNS:
// title is set by DataAttachmentColumnsForm
break;

default:
console.error(`Unknown modal type: "${type}"!`);
}
Expand Down Expand Up @@ -381,6 +386,13 @@ class Modal extends React.Component {
{...this.props.params}
/>
}
{ this.props.params.type === MODAL_TYPES.DATA_ATTACHMENT_COLUMNS &&
<DataAttachmentColumnsForm
onSetModalTitle={this.setModalTitle}
onModalClose={this.onModalClose}
{...this.props.params}
/>
}
</ui.Modal.Body>
</ui.Modal>
);
Expand Down
Loading