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

[DNM] Ona Changes #49

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
74d2937
Add PyJWT requirement
DavisRayM Sep 30, 2022
0652ef5
Add OnaData authentication functionality to the jsapp
DavisRayM Sep 30, 2022
659681e
Redirect users to OnaData home instead of Kobo
DavisRayM Sep 30, 2022
087763f
Add support for OnaData form creation
DavisRayM Sep 30, 2022
200dd6b
Remove 'Return to list' and 'close' icons from landing page when crea…
WinnyTroy Oct 29, 2019
a6020e6
Prevent deployment of non-survey asset types
DavisRayM Sep 30, 2022
711e278
Add `can_publicize_collection` to extra_details
DavisRayM Sep 30, 2022
cf0b875
Add mngt cmd to grant/revoke perm to publicize collection
ivermac Jun 16, 2020
a151ee1
Rename management command file
ivermac Jun 16, 2020
137e5a7
Make raven environment filter configurable
WinnyTroy Jun 23, 2020
faaca2e
Update how assets are updated on the backend
DavisRayM Sep 30, 2022
7528715
Double alerts notifier delay
DavisRayM Sep 30, 2022
36c921c
Add helper text above library listing
DavisRayM Sep 30, 2022
4898f68
OnaData functionality
DavisRayM Sep 30, 2022
07084a8
Update help text label
KipSigei Jan 31, 2022
042a6c5
Add a way to disable library toggle
DavisRayM Sep 30, 2022
f542086
Use python3 instead of python
DavisRayM Jun 4, 2022
9d4a967
Fix an issue with translations
DavisRayM Sep 30, 2022
0c0ce73
Disable celery autoscaling
DavisRayM Sep 30, 2022
7e9e2b1
Import settings correctly
DavisRayM Sep 30, 2022
2b2387e
Revert home view change
DavisRayM Sep 30, 2022
f31fabb
Update ObjectPermissionBackend
DavisRayM Oct 11, 2022
da89580
Add perm_parse and get_anonymous_user functions
DavisRayM Oct 11, 2022
7fd2fd3
Disable `is_mfa_active` field on the KoboCAT Userprofile shadow model
DavisRayM Oct 11, 2022
7fde0b7
Ensure Kobocat Deployment backend works
DavisRayM Oct 11, 2022
150de22
Ensure nested_dict is actually a dictionary
DavisRayM Oct 14, 2022
055aa6b
Update how we check if cookie exists
DavisRayM Oct 25, 2022
3410af7
Ensure asset is deployed on update
DavisRayM Oct 27, 2022
e96106d
[TEMP] Add JWT Header authentication support
DavisRayM Nov 17, 2022
2049257
Use correct header name
DavisRayM Nov 21, 2022
05dc735
Ensure user is authenticated correctly when deploying asset
DavisRayM Nov 23, 2022
44ba389
Disable set_asset_uid functionality
DavisRayM Nov 25, 2022
c17f461
Add config to hide add to library option on UI
KipSigei Nov 9, 2022
301b48a
Ensure title is correctly formatted
DavisRayM Dec 9, 2022
87102b2
Ensure correct authentication credentials are used
Dec 20, 2022
a4ec3f9
Remove assign and revoke kc permissions
Dec 20, 2022
37107aa
Ensure Import and Export task uses correct auth
Dec 20, 2022
a9447f0
Add `grant-default-model-level-perms` route
Dec 21, 2022
9ffae88
POST to project if project arg is present
Dec 23, 2022
130d691
Ensure Import Task uses correct auth credentials
Dec 23, 2022
522daf1
Revert "POST to project if project arg is present"
Dec 23, 2022
ebd1684
Ensure form payload is retrieved
Dec 23, 2022
6b5caba
Bypass _deployment_data editing to allow edit on formbuilder
Dec 23, 2022
0ae18fa
bug(deserialization): ensure `self.data` is always a dictionary
DavisRayM Apr 25, 2023
cf05f15
cleanup(database): remove unneeded checks
DavisRayM Apr 25, 2023
04362c1
bug(editableForm): Ensure `asset` is passed in as an argument
DavisRayM Apr 25, 2023
9d07081
Fix webform preview auth issue
KipSigei Aug 11, 2023
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
3 changes: 3 additions & 0 deletions dependencies/pip/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@ django-trench==0.2.3

# Python 3.8 support
backports.zoneinfo; python_version < '3.9'

# OnaData support
PyJWT
4 changes: 3 additions & 1 deletion dependencies/pip/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ pycparser==2.21
pygments==2.11.2
# via -r dependencies/pip/requirements.in
pyjwt==2.3.0
# via twilio
# via
# -r dependencies/pip/requirements.in
# twilio
pymongo==3.12.3
# via -r dependencies/pip/requirements.in
pyopenssl==22.0.0
Expand Down
84 changes: 59 additions & 25 deletions jsapp/js/actions.es6
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import dataShareActions from './actions/dataShareActions';
import {
notify,
replaceSupportEmail,
checkIfCookieExists,
redirectForOnaDataAuth,
} from 'utils';

// Configure Reflux
Expand Down Expand Up @@ -201,36 +203,68 @@ actions.resources.listTags.completed.listen(function(results){
});

actions.resources.updateAsset.listen(function(uid, values, params={}) {
dataInterface.patchAsset(uid, values)
.done((asset) => {
actions.resources.updateAsset.completed(asset);
if (typeof params.onComplete === 'function') {
params.onComplete(asset, uid, values);
if (checkIfCookieExists("__kpi_formbuilder")) {
redirectForOnaDataAuth()
} else {
return new Promise((resolve, reject) => {
dataInterface.patchAsset(uid, values)
.done((asset) => {
actions.resources.updateAsset.completed(asset);
resolve(asset);
})
.fail((resp) => {
if (resp.status === 500) {
reject(resp);
} else {
alertify.error(resp.responseJSON[0]);
reject(resp);
}
});
}).then((asset) => {
if (asset.asset_type === "survey") {
dataInterface.deployAsset(asset, asset.has_deployment)
.done((data) => {
if (asset.has_deployment) {
notify(t('Successfully updated published form.'));
} else {
notify(t('Successfully published form.'));
}
})
.fail((resp) => {
if (resp.status === 500) {
alertify.error(t('Internal Server Error: Kindly ensure the form has atleast one question'));
} else {
alertify.error(resp.responseText);
}
});
} else {
notify(t('Successfully updated asset.'));
}
notify(t('successfully updated'));

return asset
})
.fail(function(resp){
actions.resources.updateAsset.failed(resp);
if (params.onFailed) {
params.onFailed(resp);
}
});
}
});

actions.resources.deployAsset.listen(function(asset, redeployment, params={}){
dataInterface.deployAsset(asset, redeployment)
.done((data) => {
actions.resources.deployAsset.completed(data.asset);
if (typeof params.onDone === 'function') {
params.onDone(data, redeployment);
}
})
.fail((data) => {
actions.resources.deployAsset.failed(data, redeployment);
if (typeof params.onFail === 'function') {
params.onFail(data, redeployment);
}
});
var asset_type = asset.asset_type;
if (asset_type === "survey") {
dataInterface.deployAsset(asset, redeployment)
.done((data) => {
actions.resources.deployAsset.completed(data.asset);
if (typeof params.onDone === 'function') {
params.onDone(data, redeployment);
}
})
.fail((data) => {
actions.resources.deployAsset.failed(data, redeployment);
if (typeof params.onFail === 'function') {
params.onFail(data, redeployment);
}
});
} else {
notify(t('Asset of type ${asset_type} deployment is disabled'));
}
});

actions.resources.deployAsset.failed.listen(function(data, redeployment){
Expand Down
1 change: 1 addition & 0 deletions jsapp/js/bemComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ bem.LibNav__search = makeBem(bem.LibNav, 'search');
bem.LibNav__expanded = makeBem(bem.LibNav, 'expanded');
bem.LibNav__count = makeBem(bem.LibNav, 'count');
bem.LibNav__expandedToggle = makeBem(bem.LibNav, 'expandedToggle');
bem.LibNav__helperContainer = makeBem(bem.LibNav, 'helperContainer');

bem.TemplatesList = makeBem(null, 'templates-list');
bem.TemplatesList__header = makeBem(bem.TemplatesList, 'header');
Expand Down
3 changes: 2 additions & 1 deletion jsapp/js/components/account/accountSettingsRoute.es6
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
addRequiredToLabel,
stringToColor,
} from 'utils';
import { TITLE } from '../../ona/config';
import {ROUTES} from 'js/router/routerConstants';
import envStore from 'js/envStore';
import './accountSettings.scss';
Expand Down Expand Up @@ -207,7 +208,7 @@ export default class AccountSettings extends React.Component {
const metaFields = this.getDisplayMetaFields();

return (
<DocumentTitle title={`${accountName} | KoboToolbox`}>
<DocumentTitle title={`${accountName} | ${ TITLE }`}>
<bem.AccountSettings>
<bem.AccountSettings__actions>
<bem.KoboButton
Expand Down
3 changes: 2 additions & 1 deletion jsapp/js/components/modalForms/projectSettings.es6
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
isAValidUrl,
validFileTypes,
} from 'utils';
import { TITLE } from '../../ona/config';
import {
NAME_MAX_LENGTH,
PROJECT_SETTINGS_CONTEXTS,
Expand Down Expand Up @@ -963,7 +964,7 @@ class ProjectSettings extends React.Component {
<Checkbox
checked={this.state.fields['share-metadata']}
onChange={this.onAnyFieldChange.bind(this, 'share-metadata')}
label={t('Help KoboToolbox improve this product by sharing the sector and country where this project will be deployed.') + ' ' + t('All the information is submitted anonymously, and will not include the project name or description listed above.')}
label={`Help ${ TITLE } improve this product by sharing the sector and country where this project will be deployed.') + ' ' + t('All the information is submitted anonymously, and will not include the project name or description listed above.`}
/>
</bem.FormModal__item>

Expand Down
3 changes: 2 additions & 1 deletion jsapp/js/components/reports/reports.es6
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {txtid} from '../../../xlform/src/model.utils';
import alertify from 'alertifyjs';
import {launchPrinting} from 'utils';
import {REPORT_STYLES} from './reportsConstants';
import { TITLE } from '../../ona/config';
import CustomReportForm from './customReportForm';
import QuestionGraphSettings from './questionGraphSettings';
import ReportContents from './reportContents';
Expand Down Expand Up @@ -525,7 +526,7 @@ export default class Reports extends React.Component {
const hasGroupBy = this.state.groupBy.length !== 0;

return (
<DocumentTitle title={`${docTitle} | KoboToolbox`}>
<DocumentTitle title={`${docTitle} | ${ TITLE }`}>
<bem.FormView m={formViewModifiers}>
<bem.ReportView>
{this.renderReportButtons()}
Expand Down
3 changes: 2 additions & 1 deletion jsapp/js/components/searchcollectionlist.es6
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import DocumentTitle from 'react-document-title';
import Dropzone from 'react-dropzone';
import {validFileTypes} from 'utils';
import {redirectToLogin} from 'js/router/routerUtils';
import { TITLE } from '../ona/config';
import {
ASSET_TYPES,
COMMON_QUERIES,
Expand Down Expand Up @@ -211,7 +212,7 @@ class SearchCollectionList extends Reflux.Component {
docTitle = t('Library');
}
return (
<DocumentTitle title={`${docTitle} | KoboToolbox`}>
<DocumentTitle title={`${docTitle} | ${ TITLE }`}>
<Dropzone
onDrop={this.dropFiles}
disableClick
Expand Down
10 changes: 10 additions & 0 deletions jsapp/js/editorMixins/assetNavigator.es6
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ class AssetNavigator extends Reflux.Component {
</bem.LibNav__header>

<bem.LibNav__content>
<bem.LibNav__helperContainer>
<div className="header">
<span className="icon-container"><i className='k-icon-information' /></span>
<span><b>Quick tip</b></span>
</div>
<hr/>
<div className="body">
{t('You can drag and drop the items below to the form editor on the left')}
</div>
</bem.LibNav__helperContainer>
<AssetNavigatorListView searchContext={this.state.searchContext} />
</bem.LibNav__content>

Expand Down
Loading