Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add UI for access control in tracker programs * Improve access description, add d2-ui-sharing, general refactor * Improve sharing of programs * Refactor: renaming, moving components * Use improved sharing dialog, refactor * Add more translations * Rearranged class functions, fix John's complaints * Update sharing dialog to 1.0.12 * Add default publicAccess to new programs and stages * New program access UI now works with unsaved event- and tracker programs
- Loading branch information
Showing
17 changed files
with
654 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
bracketSpacing: true, | ||
jsxBracketSameLine: false, | ||
printWidth: 100, | ||
singleQuote: true, | ||
tabWidth: 4, | ||
trailingComma: 'all', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/EditModel/event-program/assign-organisation-units/AssignOrganisationUnits.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/EditModel/event-program/program-access/ProgramAccess.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import Paper from 'material-ui/Paper/Paper'; | ||
import PropTypes from 'prop-types'; | ||
import Heading from 'd2-ui/lib/headings/Heading.component'; | ||
import OrganisationUnitTreeMultiSelect from '../../../forms/form-fields/orgunit-tree-multi-select'; | ||
import ProgramStagesAccess from './ProgramStagesAccess'; | ||
import { branch, renderComponent } from 'recompose'; | ||
|
||
const styles = { | ||
paper: { | ||
padding: '3rem', | ||
}, | ||
padding: { | ||
paddingTop: '3rem', | ||
} | ||
}; | ||
|
||
const ProgramNotSavedMessage = () => ( | ||
<div>Save the program in order to access sharing settings</div> | ||
); | ||
|
||
const ProgramStagesAccessHOC = branch( | ||
props => !props.model.dataValues.publicAccess, | ||
renderComponent(ProgramNotSavedMessage) | ||
)(ProgramStagesAccess); | ||
|
||
const ProgramAccess = ({ modelToEdit }, { d2 }) => { | ||
if (!modelToEdit) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Paper style={styles.paper}> | ||
<Heading>{d2.i18n.getTranslation("organisation_units")}</Heading> | ||
<OrganisationUnitTreeMultiSelect | ||
value={modelToEdit.organisationUnits} | ||
model={modelToEdit} | ||
modelDefinition={modelToEdit.modelDefinition} | ||
/> | ||
<Heading style={styles.padding}>{d2.i18n.getTranslation("roles_and_access")}</Heading> | ||
<ProgramStagesAccessHOC | ||
model={modelToEdit} | ||
/> | ||
</Paper> | ||
); | ||
} | ||
|
||
ProgramAccess.contextTypes = { | ||
d2: PropTypes.object, | ||
}; | ||
|
||
export default ProgramAccess; |
Oops, something went wrong.