Skip to content

Commit

Permalink
Use global EditFormulaModal with CaseCard.
Browse files Browse the repository at this point in the history
  • Loading branch information
tealefristoe committed Oct 24, 2024
1 parent 71e783b commit fa3f074
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions v3/src/components/case-card/case-card.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import createReactClass from "create-react-class"
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOMFactories from "react-dom-factories"
import { getSharedCaseMetadataFromDataset } from "../../models/shared/shared-data-utils"
import { uiState } from "../../models/ui-state"
import { preventCollectionReorg } from "../../utilities/plugin-utils"
import { createReactFactory, DG } from "../../v2/dg-compat.v2"
import { SC } from "../../v2/sc-compat"
import { getSharedCaseMetadataFromDataset } from "../../models/shared/shared-data-utils"
import { EditAttributePropertiesModal } from "../case-tile-common/attribute-menu/edit-attribute-properties-modal"
import { EditFormulaModal } from "../case-tile-common/attribute-menu/edit-formula-modal"

import "./attribute-name-cell.v2"
import "./attribute-value-cell.v2"
Expand Down Expand Up @@ -249,17 +249,6 @@ iDataContext.doSelectCases({
this.setState({ editAttributePropModalIsOpen: false, currentAttributeId: null })
},

editFormulaModal(attributeId, isOpen) {
if (attributeId) {
this.setState({editFormulaModalIsOpen: isOpen, currentAttributeId: attributeId})
}
},

closeEditFormulaModal() {
this.setState({ editFormulaModalIsOpen: false, currentAttributeId: null })
this.incrementStateCount()
},

/**
* ------------------Below here are rendering functions---------------
*/
Expand Down Expand Up @@ -534,7 +523,7 @@ iDataContext.doSelectCases({
}.bind(this),

editFormula = function () {
this.editFormulaModal(iAttr.get('id'), true)
uiState.setEditFormulaAttributeId(iAttr.get('id'))

Check warning on line 526 in v3/src/components/case-card/case-card.v2.js

View check run for this annotation

Codecov / codecov/patch

v3/src/components/case-card/case-card.v2.js#L526

Added line #L526 was not covered by tests
}.bind(this),

hideAttribute = function () {
Expand Down Expand Up @@ -934,11 +923,6 @@ return tResult
attributeId: this.state.currentAttributeId,
isOpen: this.state.editAttributePropModalIsOpen,
onClose: this.closeEditAttributePropModal
}),
this.state.editFormulaModalIsOpen && React.createElement(EditFormulaModal, {
attributeId: this.state.currentAttributeId,
isOpen: this.state.editFormulaModalIsOpen,
onClose: this.closeEditFormulaModal
}))
}
}
Expand Down

0 comments on commit fa3f074

Please sign in to comment.