Skip to content

Commit

Permalink
fix: Trim space of search word
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Aug 7, 2020
1 parent e4591fb commit a6b686a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/Base/Search/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/

import { isEmpty } from 'lodash'
import { isEmpty, trim } from 'lodash'
import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class Search extends React.Component {
if (e.keyCode === 13) {
const { value } = this.state
if (!isEmpty(value)) {
this.props.onSearch(this.state.value)
this.props.onSearch(trim(this.state.value))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Tables/Base/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import PropTypes from 'prop-types'
import classnames from 'classnames'
import isEqual from 'react-fast-compare'
import { toJS } from 'mobx'
import { get, find, isUndefined, isEmpty } from 'lodash'
import { get, find, isUndefined, isEmpty, trim } from 'lodash'
import {
Icon,
Table,
Expand Down Expand Up @@ -224,7 +224,7 @@ export default class WorkloadTable extends React.Component {
tags.forEach(n => {
// transfer keyword to name
n.filter = n.filter === 'keyword' ? 'name' : n.filter
filters[n.filter] = n.value
filters[n.filter] = trim(n.value)
})

if (!isEqual(filters, this.props.filters)) {
Expand Down

0 comments on commit a6b686a

Please sign in to comment.