Skip to content

Commit

Permalink
ui: fix record deletion function
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva authored and ntarocco committed Apr 3, 2020
1 parent c662a76 commit 431d932
Show file tree
Hide file tree
Showing 11 changed files with 681 additions and 1,313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const deleteDocButton = props => {
);
};

export class DocumentDeleteModal extends Component {
export default class DocumentDeleteModal extends Component {
async getRelationRefs() {
const hits = [];
for (const [relation, records] of Object.entries(this.props.relations)) {
Expand Down Expand Up @@ -119,7 +119,7 @@ export class DocumentDeleteModal extends Component {
deleteHeader={`Are you sure you want to delete the Document
record with ID ${document.metadata.pid}?`}
refProps={this.createRefProps(document.metadata.pid)}
onDelete={() => this.deleteDocument(document.metadata.pid)}
onDelete={() => this.props.deleteDocument(document.metadata.pid)}
trigger={deleteDocButton}
/>
);
Expand All @@ -129,4 +129,5 @@ export class DocumentDeleteModal extends Component {
DocumentDeleteModal.propTypes = {
document: PropTypes.object.isRequired,
relations: PropTypes.object.isRequired,
deleteDocument: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export { DocumentDeleteModal } from './DocumentDeleteModal';
import { connect } from 'react-redux';

import { deleteDocument } from '../../state/actions';
import DocumentDeleteModalComponent from './DocumentDeleteModal';

const mapDispatchToProps = dispatch => ({
deleteDocument: documentPid => dispatch(deleteDocument(documentPid)),
});

export const DocumentDeleteModal = connect(
null,
mapDispatchToProps
)(DocumentDeleteModalComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class EItemActionMenu extends Component {
return (
<DeleteButton
fluid
content="Delete physical copy"
content="Delete electronic item"
labelPosition="left"
{...props}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class ItemActionMenu extends Component {
trigger={this.deleteDocButton}
deleteHeader={`Are you sure you want to delete the physical copy
record with ID ${item.pid}?`}
onDelete={() => this.deleteItem(item.pid)}
onDelete={() => this.props.deleteItem(item.pid)}
refProps={this.createRefProps(item.pid)}
/>
<Divider horizontal> Circulation </Divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports[`SeriesDetails tests should load the details component 1`] = `
<div
id="series-relations"
>
<UNDEFINED />
<Memo(Connect(SeriesSiblings)) />
</div>
</AccordionContent>,
"key": "series-relations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const deleteButton = props => {
);
};

export class SeriesDeleteModal extends Component {
export default class SeriesDeleteModal extends Component {
async getRelationRefs() {
const hits = [];
for (const [relation, records] of Object.entries(this.props.relations)) {
Expand Down Expand Up @@ -63,4 +63,5 @@ export class SeriesDeleteModal extends Component {
SeriesDeleteModal.propTypes = {
series: PropTypes.object.isRequired,
relations: PropTypes.object.isRequired,
deleteSeries: PropTypes.func.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export { SeriesDeleteModal } from './SeriesDeleteModal';
import { connect } from 'react-redux';
import { deleteSeries } from '../../state/actions';

import SeriesDeleteModalComponent from './SeriesDeleteModal';

const mapDeleteDispatch = dispatch => ({
deleteSeries: seriesPid => dispatch(deleteSeries(seriesPid)),
});

export const SeriesDeleteModal = connect(
null,
mapDeleteDispatch
)(SeriesDeleteModalComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
className="field"
>
<Input
aria-describedby={null}
autoComplete="off"
data-test=""
icon={true}
Expand Down Expand Up @@ -270,7 +269,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
/>
</Icon>
<input
aria-describedby={null}
autoComplete="off"
key=".1"
name="selectedDate"
Expand Down Expand Up @@ -422,7 +420,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
className="field"
>
<Input
aria-describedby={null}
autoComplete="off"
data-test=""
icon={true}
Expand Down Expand Up @@ -453,7 +450,6 @@ exports[`MostLoanedDocumentsList tests should render show a message with no docu
/>
</Icon>
<input
aria-describedby={null}
autoComplete="off"
key=".1"
name="selectedDate"
Expand Down
Loading

0 comments on commit 431d932

Please sign in to comment.