Skip to content

Commit

Permalink
fix: Fix check item action in EditAuthorization
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jul 7, 2020
1 parent 78f7bb7 commit 3b9ed82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/components/Modals/EditAuthorization/CheckItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ import styles from './index.scss'

export default class CheckItem extends Component {
handleCheck = () => {
const { roleTemplates, data, onChange } = this.props
const { roleTemplates, roleTemplatesMap, data, onChange } = this.props

let newTemplates = [...roleTemplates]

if (newTemplates.includes(data.name)) {
newTemplates = newTemplates.filter(item => item !== data.name)
if (
!newTemplates.some(
item =>
roleTemplatesMap[item] &&
roleTemplatesMap[item].dependencies &&
roleTemplatesMap[item].dependencies.includes(data.name)
)
) {
newTemplates = newTemplates.filter(item => item !== data.name)
}
} else {
newTemplates.push(data.name, ...data.dependencies)
}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/projects/components/Modals/RollBack/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export default class RollBackModal extends React.Component {
super(props)

this.revisionStore = props.store

this.form = React.createRef()
}

get revisions() {
Expand Down Expand Up @@ -101,7 +103,7 @@ export default class RollBackModal extends React.Component {

handleOk = () => {
const { detail, onOk } = this.props
if (this.form) {
if (this.form && this.form.current) {
const form = this.form.current
form &&
form.validate(() => {
Expand Down

0 comments on commit 3b9ed82

Please sign in to comment.