-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCLOMRS-311: Implement delete/retire mapping functionality
- Loading branch information
Showing
18 changed files
with
433 additions
and
37 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
60 changes: 60 additions & 0 deletions
60
src/components/dictionaryConcepts/components/RemoveMappings.jsx
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,60 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import RemoveMappingsModal from './RemoveMappingsModal'; | ||
|
||
class RemoveMappings extends Component { | ||
state = { | ||
modal: false, | ||
}; | ||
|
||
handleToggle = () => { | ||
const { modal } = this.state; | ||
this.setState({ | ||
modal: !modal, | ||
}); | ||
}; | ||
|
||
render() { | ||
const { modal } = this.state; | ||
const { url, retired, handleDeleteMapping, showDeleteMappingModal } = this.props; | ||
return ( | ||
<React.Fragment> | ||
{ !retired ? ( | ||
<button | ||
type="button" | ||
className="btn btn-sm mb-1 actionButtons" | ||
onClick={() => { | ||
this.handleToggle(); | ||
showDeleteMappingModal(url); | ||
} | ||
} | ||
> | ||
Remove | ||
<RemoveMappingsModal | ||
modal={modal} | ||
handleToggle={this.handleToggle} | ||
handleDeleteMapping={handleDeleteMapping} | ||
url={url} | ||
/> | ||
</button>) : ( | ||
<button | ||
type="button" | ||
className="btn btn-sm mb-1 actionButtons disabled" | ||
> | ||
Retired | ||
</button> | ||
) | ||
} | ||
</React.Fragment> | ||
); | ||
} | ||
} | ||
|
||
RemoveMappings.propTypes = { | ||
handleDeleteMapping: PropTypes.func.isRequired, | ||
showDeleteMappingModal: PropTypes.func.isRequired, | ||
url: PropTypes.string.isRequired, | ||
retired: PropTypes.bool.isRequired, | ||
}; | ||
|
||
export default RemoveMappings; |
37 changes: 37 additions & 0 deletions
37
src/components/dictionaryConcepts/components/RemoveMappingsModal.jsx
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,37 @@ | ||
import React from 'react'; | ||
import { | ||
Button, Modal, ModalHeader, ModalFooter, | ||
} from 'reactstrap'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const removeMapping = (props) => { | ||
const { | ||
handleDeleteMapping, | ||
modal, | ||
handleToggle, | ||
url, | ||
} = props; | ||
return ( | ||
<div> | ||
<Modal isOpen={modal} toggle={handleToggle}> | ||
<ModalHeader toggle={handleToggle}> | ||
Are you sure you want to Remove this Mapping? | ||
</ModalHeader> | ||
<ModalFooter> | ||
<Button id="retireMapping" color="danger" onClick={() => { handleDeleteMapping(url); handleToggle(); }}>Remove Mapping</Button> | ||
{' '} | ||
<Button color="secondary" onClick={handleToggle}>Cancel</Button> | ||
</ModalFooter> | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
removeMapping.propTypes = { | ||
handleDeleteMapping: PropTypes.func.isRequired, | ||
modal: PropTypes.bool.isRequired, | ||
handleToggle: PropTypes.func.isRequired, | ||
url: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default removeMapping; |
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
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
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
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
Oops, something went wrong.