Skip to content

Commit

Permalink
Merge pull request #1003 from qtomlinson/qt/fix_search
Browse files Browse the repository at this point in the history
Include component type in search pattern for browse
  • Loading branch information
mpcen authored Oct 5, 2022
2 parents 6d64263 + 2b2321a commit 724a3ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
12 changes: 8 additions & 4 deletions src/components/Navigation/Pages/PageBrowse/PageBrowse.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ class PageBrowse extends SystemManagedList {

onSearch = value => {
this.setState({ searchTerm: value })
const valueToSearch = this.state.selectedProvider.value + '/' + value
this.props.dispatch(uiBrowseUpdateFilterList(this.props.token, valueToSearch))
const searchPattern = this._buildSearchPattern(this.state.selectedProvider, value)
this.props.dispatch(uiBrowseUpdateFilterList(this.props.token, searchPattern))
}

_buildSearchPattern = (provider, value) => {
return provider.type + '/' + provider.value + '/' + value
}

tableTitle() {
Expand Down Expand Up @@ -171,8 +175,8 @@ class PageBrowse extends SystemManagedList {
onProviderChange(item) {
this.setState({ selectedProvider: item })
if (this.state.searchTerm) {
const valueToSearch = item.value + '/' + this.state.searchTerm
this.props.dispatch(uiBrowseUpdateFilterList(this.props.token, valueToSearch))
const searchPattern = this._buildSearchPattern(item, this.state.searchTerm)
this.props.dispatch(uiBrowseUpdateFilterList(this.props.token, searchPattern))
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ const types = [
]

const providers = [
{ value: 'npmjs', label: 'NpmJS', image: npmImage },
{ value: 'github', label: 'GitHub', image: gitImage },
{ value: 'mavencentral', label: 'MavenCentral', image: mavenImage },
{ value: 'nuget', label: 'NuGet', image: nugetImage },
{ value: 'pypi', label: 'PyPi', image: pypiImage },
{ value: 'rubygems', label: 'RubyGems', image: gemImage },
{ value: 'cocoapods', label: 'CocoaPods', image: podImage },
{ value: 'cratesio', label: 'Crates.io', image: crateImage },
{ value: 'debian', label: 'Debian', image: debianImage },
{ value: 'packagist', label: 'Packagist', image: composerImage }
{ value: 'npmjs', label: 'NpmJS', image: npmImage, type: 'npm' },
{ value: 'github', label: 'GitHub', image: gitImage, type: 'git' },
{ value: 'mavencentral', label: 'MavenCentral', image: mavenImage, type: 'maven' },
{ value: 'nuget', label: 'NuGet', image: nugetImage, type: 'nuget' },
{ value: 'pypi', label: 'PyPi', image: pypiImage, type: 'pypi' },
{ value: 'rubygems', label: 'RubyGems', image: gemImage, type: 'gem' },
{ value: 'cocoapods', label: 'CocoaPods', image: podImage, type: 'pod' },
{ value: 'cratesio', label: 'Crates.io', image: crateImage, type: 'crate' },
{ value: 'debian', label: 'Debian', image: debianImage, type: 'deb' },
{ value: 'packagist', label: 'Packagist', image: composerImage, type: 'composer' }
]

const multiEditableFields = ['licensed.declared']
Expand Down

0 comments on commit 724a3ce

Please sign in to comment.