Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into upgrade-redis-pip-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jnm committed Apr 15, 2019
2 parents 2ef8ecb + 4c9ee15 commit 21a7466
Show file tree
Hide file tree
Showing 23 changed files with 261 additions and 208 deletions.
23 changes: 12 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"react/wrap-multilines": 0,
"no-trailing-spaces":0,
"no-trailing-spaces": 0,
"no-irregular-whitespace": 0,
"no-mixed-spaces-and-tabs": 0,
"no-unused-expressions": 0,
Expand All @@ -47,15 +47,16 @@
"no-undef": 0,
"eqeqeq": 0,
"no-multi-spaces": 0,
"no-extend-native":0,
"no-script-url":0,
"no-extra-bind":0,
"semi-spacing":0,
"no-extra-semi":0,
"no-extra-strict":0,
"no-new-object":0,
"no-debugger":0

"no-extend-native": 0,
"no-script-url": 0,
"no-extra-bind": 0,
"semi-spacing": 0,
"no-extra-semi": 0,
"no-extra-strict": 0,
"no-new-object": 0,
"no-debugger": 0,
"no-case-declarations": 1,
"no-fallthrough": 1
},
"globals": {
"inject": false,
Expand All @@ -69,7 +70,7 @@
"expect": false,
"window": false,
"document": false,
"Parse":false
"Parse": false
},
"plugins": [
"react"
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ install:
- pip install pip-tools
- pip-sync dependencies/pip/requirements.txt
- pip install coverage codacy-coverage python-coveralls pytest-cov
- pip install pytest==3.10 # Force install this version, has to be at the end
18 changes: 11 additions & 7 deletions dependencies/pip/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# make pip_compile
#
-e git+https://github.com/dimagi/django-digest@0eb1c921329dd187c343b61acfbec4e98450136e#egg=django_digest
-e git+https://github.com/kobotoolbox/formpack.git@45a49bbcc794c6ac3756afe04a4f851c3da9219d#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@eb7d723eb2b54dbfd56a1c32d72e0008bbb29149#egg=formpack
amqp==2.4.0
anyjson==0.3.3
argparse==1.4.0 # via unittest2
asn1crypto==0.24.0 # via cryptography
atomicwrites==1.3.0 # via pytest
attrs==19.1.0 # via pytest
backports.os==0.1.1 # via path.py
bcrypt==3.1.6 # via paramiko
begins==0.9
Expand Down Expand Up @@ -59,8 +61,8 @@ drf-extensions==0.3.1
enum34==1.1.6 # via cryptography
fabric==2.4.0
formencode==1.3.1 # via pyxform
funcsigs==1.0.2 # via begins, mock
functools32==3.2.3.post2 # via jsonschema
funcsigs==1.0.2 # via begins, mock, pytest
functools32==3.2.3.post2 # via jsonschema, pyxform
future==0.17.1 # via backports.os, django-ses
futures==3.2.0 # via s3transfer
gunicorn==19.4.5
Expand All @@ -76,14 +78,16 @@ linecache2==1.0.0 # via traceback2
lxml==4.3.0
markdown==3.0.1
mock==2.0.0
more-itertools==5.0.0 # via pytest
ndg-httpsclient==0.4.2
oauthlib==1.0.3
paramiko==2.4.2 # via fabric
path.py==11.5.0
pathlib2==2.3.3 # via importlib-metadata
pathlib2==2.3.3 # via importlib-metadata, pytest
pbr==4.0.2 # via mock
pluggy==0.9.0 # via pytest
psycopg2==2.7.7 # via django-jsonbfield, django-toolbelt
py==1.4.31 # via pytest
py==1.8.0 # via pytest
pyasn1==0.1.9
pycparser==2.14 # via cffi
pygments==2.1.3
Expand All @@ -92,11 +96,11 @@ pynacl==1.3.0 # via paramiko
pyopenssl==18.0.0
pyquery==1.4.0
pytest-django==3.1.2
pytest==3.0.3 # via pytest-django
pytest==3.10.0
python-dateutil==2.7.5
python-digest==1.7
pytz==2018.9
pyxform==0.12.0
pyxform==0.13.1
redis==3.2.0
requests==2.21.0
responses==0.9.0
Expand Down
18 changes: 11 additions & 7 deletions dependencies/pip/external_services.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# make pip_compile
#
-e git+https://github.com/dimagi/django-digest@0eb1c921329dd187c343b61acfbec4e98450136e#egg=django_digest
-e git+https://github.com/kobotoolbox/formpack.git@45a49bbcc794c6ac3756afe04a4f851c3da9219d#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@eb7d723eb2b54dbfd56a1c32d72e0008bbb29149#egg=formpack
amqp==2.4.0
anyjson==0.3.3
argparse==1.4.0 # via unittest2
asn1crypto==0.24.0 # via cryptography
atomicwrites==1.3.0 # via pytest
attrs==19.1.0 # via pytest
backports.os==0.1.1 # via path.py
begins==0.9
billiard==3.5.0.5
Expand Down Expand Up @@ -57,8 +59,8 @@ docutils==0.14 # via botocore, statistics
drf-extensions==0.3.1
enum34==1.1.6 # via cryptography
formencode==1.3.1 # via pyxform
funcsigs==1.0.2 # via begins, mock
functools32==3.2.3.post2 # via jsonschema
funcsigs==1.0.2 # via begins, mock, pytest
functools32==3.2.3.post2 # via jsonschema, pyxform
future==0.17.1 # via backports.os, django-ses
futures==3.2.0 # via s3transfer
gunicorn==19.4.5
Expand All @@ -73,26 +75,28 @@ linecache2==1.0.0 # via traceback2
lxml==4.3.0
markdown==3.0.1
mock==2.0.0
more-itertools==5.0.0 # via pytest
ndg-httpsclient==0.4.2
newrelic==2.84.0.64
oauthlib==1.0.3
path.py==11.5.0
pathlib2==2.3.3 # via importlib-metadata
pathlib2==2.3.3 # via importlib-metadata, pytest
pbr==4.0.2 # via mock
pluggy==0.9.0 # via pytest
psycopg2==2.7.7 # via django-jsonbfield, django-toolbelt
py==1.4.31 # via pytest
py==1.8.0 # via pytest
pyasn1==0.1.9
pycparser==2.14 # via cffi
pygments==2.1.3
pymongo==3.7.2
pyopenssl==18.0.0
pyquery==1.4.0
pytest-django==3.1.2
pytest==3.0.3 # via pytest-django
pytest==3.10.0
python-dateutil==2.7.5
python-digest==1.7
pytz==2018.9
pyxform==0.12.0
pyxform==0.13.1
raven==5.32.0
redis==3.2.0
requests==2.21.0
Expand Down
3 changes: 2 additions & 1 deletion dependencies/pip/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/bndr/pipreqs is a handy utility, too.

# Formpack
-e git+https://github.com/kobotoolbox/formpack.git@45a49bbcc794c6ac3756afe04a4f851c3da9219d#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@eb7d723eb2b54dbfd56a1c32d72e0008bbb29149#egg=formpack

# More up-to-date version of django-digest than PyPI seems to have.
# Also, python-digest is an unlisted dependency thereof.
Expand Down Expand Up @@ -53,6 +53,7 @@ mock
oauthlib
pymongo
pytest-django
pytest==3.10.0
python-dateutil
pytz
pyxform
Expand Down
18 changes: 11 additions & 7 deletions dependencies/pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# make pip_compile
#
-e git+https://github.com/dimagi/django-digest@0eb1c921329dd187c343b61acfbec4e98450136e#egg=django_digest
-e git+https://github.com/kobotoolbox/formpack.git@45a49bbcc794c6ac3756afe04a4f851c3da9219d#egg=formpack
-e git+https://github.com/kobotoolbox/formpack.git@eb7d723eb2b54dbfd56a1c32d72e0008bbb29149#egg=formpack
amqp==2.4.0
anyjson==0.3.3
argparse==1.4.0 # via unittest2
asn1crypto==0.24.0 # via cryptography
atomicwrites==1.3.0 # via pytest
attrs==19.1.0 # via pytest
backports.os==0.1.1 # via path.py
begins==0.9
billiard==3.5.0.5
Expand Down Expand Up @@ -57,8 +59,8 @@ docutils==0.14 # via botocore, statistics
drf-extensions==0.3.1
enum34==1.1.6 # via cryptography
formencode==1.3.1 # via pyxform
funcsigs==1.0.2 # via begins, mock
functools32==3.2.3.post2 # via jsonschema
funcsigs==1.0.2 # via begins, mock, pytest
functools32==3.2.3.post2 # via jsonschema, pyxform
future==0.17.1 # via backports.os, django-ses
futures==3.2.0 # via s3transfer
gunicorn==19.4.5
Expand All @@ -73,25 +75,27 @@ linecache2==1.0.0 # via traceback2
lxml==4.3.0
markdown==3.0.1
mock==2.0.0
more-itertools==5.0.0 # via pytest
ndg-httpsclient==0.4.2
oauthlib==1.0.3
path.py==11.5.0
pathlib2==2.3.3 # via importlib-metadata
pathlib2==2.3.3 # via importlib-metadata, pytest
pbr==4.0.2 # via mock
pluggy==0.9.0 # via pytest
psycopg2==2.7.7 # via django-jsonbfield, django-toolbelt
py==1.4.31 # via pytest
py==1.8.0 # via pytest
pyasn1==0.1.9
pycparser==2.14 # via cffi
pygments==2.1.3
pymongo==3.7.2
pyopenssl==18.0.0
pyquery==1.4.0
pytest-django==3.1.2
pytest==3.0.3 # via pytest-django
pytest==3.10.0
python-dateutil==2.7.5
python-digest==1.7
pytz==2018.9
pyxform==0.12.0
pyxform==0.13.1
redis==3.2.0
requests==2.21.0
responses==0.9.0
Expand Down
38 changes: 15 additions & 23 deletions hub/actions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
from collections import OrderedDict
from django.conf import settings
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.core.exceptions import PermissionDenied
from django.contrib import messages
from django.contrib.admin import helpers
Expand Down Expand Up @@ -116,33 +116,25 @@ def delete_related_objects(modeladmin, request, queryset):

def remove_from_kobocat(modeladmin, kpi_request, queryset):
'''
This is a hack to try and make administrators' lives less miserable when
they need to delete users. It proxies the initial delete request to KoBoCAT
and returns the confirmation response, mangling the HTML form action so
that clicking "Yes, I'm sure" POSTs to KoBoCAT instead of KPI.
This is a shortcut to try and make administrators' lives less miserable
when they need to delete users. It simply takes the list of selected users
(from `queryset`) and redirects to a filtered list view in the KoBoCAT
Django admin interface. From there, an administrator can easily select all
matching users and delete them.
'''
if not kpi_request.user.is_superuser:
raise PermissionDenied
if kpi_request.method != 'POST':
raise NotImplementedError
post_data = dict(kpi_request.POST)
post_data['action'] = 'delete_selected'
kc_url = settings.KOBOCAT_URL + kpi_request.path
kc_response = requests.post(kc_url, data=post_data,
cookies=kpi_request.COOKIES)
our_response = HttpResponse()
our_response.status_code = kc_response.status_code
# I'm sorry. If something is going to break, it's probably this.
find_text = '<form action="" '
replace_text = '<form action="{kc_url}" ' \
'onsubmit="return confirm(\'{hint}\');" '
hint = 'Confusion ahead! You will now be taken to the KoBoCAT admin ' \
'interface. If you want to come back here, to the KPI admin ' \
'interface, you must do so manually.'
replace_text = replace_text.format(kc_url=kc_url, hint=hint)
awful_content = kc_response.content.replace(find_text, replace_text)
our_response.write(awful_content)
return our_response
response = HttpResponseRedirect(
kc_url + '?pk__in=' + ','.join(
map(str, queryset.values_list('pk', flat=True))
)
)
return response

remove_from_kobocat.short_description = ugettext_lazy(
"Remove these %(verbose_name_plural)s from KoBoCAT (deletion step 2)")
"View these %(verbose_name_plural)s in the KoBoCAT admin interface "
"(deletion step 2)"
)
15 changes: 15 additions & 0 deletions jsapp/js/actions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ actions.resources = Reflux.createActions({
'failed'
],
},
removeSubmissionValidationStatus: {
children: [
'completed',
'failed'
],
},
getAssetFiles: {
children: [
'completed',
Expand Down Expand Up @@ -714,6 +720,15 @@ actions.resources.updateSubmissionValidationStatus.listen(function(uid, sid, dat
});
});

actions.resources.removeSubmissionValidationStatus.listen((uid, sid) => {
dataInterface.removeSubmissionValidationStatus(uid, sid).done((result) => {
actions.resources.removeSubmissionValidationStatus.completed(result, sid);
}).fail((error)=>{
console.error(error);
actions.resources.removeSubmissionValidationStatus.failed(error);
});
});

actions.hooks.getAll.listen((assetUid, callbacks = {}) => {
dataInterface.getHooks(assetUid)
.done((...args) => {
Expand Down
8 changes: 7 additions & 1 deletion jsapp/js/components/librarySidebar.es6
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class LibrarySidebar extends Reflux.Component {
stores.session,
stores.pageState
];

autoBind(this);
}
queryCollections () {
Expand All @@ -54,12 +55,16 @@ class LibrarySidebar extends Reflux.Component {
});
}
componentDidMount () {
this.listenTo(this.searchStore, this.searchChanged);
this.searchDefault();
this.queryCollections();
}
componentWillMount() {
this.setStates();
}
searchChanged (state) {
this.setState(state);
}
setStates() {
this.setState({
headerFilters: 'library',
Expand Down Expand Up @@ -298,7 +303,7 @@ class LibrarySidebar extends Reflux.Component {
<i className='k-icon-library' />
{t('My Library')}
<bem.FormSidebar__labelCount>
{this.state.sidebarCollections.length}
{this.state.defaultQueryCount}
</bem.FormSidebar__labelCount>

</bem.FormSidebar__label>
Expand Down Expand Up @@ -468,6 +473,7 @@ class LibrarySidebar extends Reflux.Component {
};

reactMixin(LibrarySidebar.prototype, searches.common);
reactMixin(LibrarySidebar.prototype, Reflux.ListenerMixin);
reactMixin(LibrarySidebar.prototype, mixins.droppable);

LibrarySidebar.contextTypes = {
Expand Down
Loading

0 comments on commit 21a7466

Please sign in to comment.