Skip to content

Commit

Permalink
fix: Show workspace default manager when create and edit
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jul 14, 2020
1 parent 28a798b commit 4bbeb9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/pages/workspaces/components/Modals/EditBasicInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import copy from 'fast-copy'
import { observer } from 'mobx-react'
import { debounce, unset } from 'lodash'
import { get, debounce, unset } from 'lodash'

import { Input, Select } from '@pitrix/lego-ui'
import { Form, Modal, TextArea } from 'components/Base'
Expand Down Expand Up @@ -55,10 +55,20 @@ export default class EditBasicInfoModal extends React.Component {
}

getUsers() {
return this.userStore.list.data.map(user => ({
const manger = get(this.props.detail, 'spec.template.spec.manager')
const users = this.userStore.list.data.map(user => ({
label: user.username,
value: user.username,
}))

if (users.every(item => item.value !== manger)) {
users.unshift({
label: manger,
value: manger,
})
}

return users
}

handleOk = data => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ export default class BaseInfo extends React.Component {
}

getUsers() {
return this.userStore.list.data.map(user => ({
const manger = globals.user.username
const users = this.userStore.list.data.map(user => ({
label: user.username,
value: user.username,
}))

if (users.every(item => item.value !== manger)) {
users.unshift({
label: manger,
value: manger,
})
}

return users
}

get networkOptions() {
Expand Down

0 comments on commit 4bbeb9f

Please sign in to comment.