@@ -108,9 +108,12 @@ export function getProjects(query: RequestData) { | |||
return getFacet(query, 'projectUuids').then(r => extractProjects(r.facet, r.response)); | |||
} | |||
export function searchIssueTags( | |||
data: { organization?: string; ps?: number; q?: string } = { ps: 100 } | |||
): Promise<string[]> { | |||
export function searchIssueTags(data: { | |||
organization?: string; | |||
project?: string; | |||
ps?: number; | |||
q?: string; | |||
}): Promise<string[]> { | |||
return getJSON('/api/issues/tags', data) | |||
.then(r => r.tags) | |||
.catch(throwGlobalError); |
@@ -24,9 +24,10 @@ import { translate } from '../../../helpers/l10n'; | |||
import ListStyleFacet from '../../../components/facet/ListStyleFacet'; | |||
import { searchIssueAuthors } from '../../../api/issues'; | |||
import { highlightTerm } from '../../../helpers/search'; | |||
import { Component } from '../../../app/types'; | |||
interface Props { | |||
componentKey: string | undefined; | |||
component: Component | undefined; | |||
fetching: boolean; | |||
loadSearchResultCount: (changes: Partial<Query>) => Promise<number>; | |||
onChange: (changes: Partial<Query>) => void; | |||
@@ -46,9 +47,12 @@ export default class AuthorFacet extends React.PureComponent<Props> { | |||
}; | |||
handleSearch = (query: string, _page: number) => { | |||
const { component } = this.props; | |||
const project = | |||
component && ['TRK', 'VW', 'APP'].includes(component.qualifier) ? component.key : undefined; | |||
return searchIssueAuthors({ | |||
organization: this.props.organization, | |||
project: this.props.componentKey, | |||
project, | |||
ps: SEARCH_SIZE, // maximum | |||
q: query | |||
}).then(authors => ({ maxResults: authors.length === SEARCH_SIZE, results: authors })); |
@@ -255,7 +255,7 @@ export default class Sidebar extends React.PureComponent<Props> { | |||
{displayAuthorFacet && ( | |||
<AuthorFacet | |||
authors={query.authors} | |||
componentKey={this.props.component && this.props.component.key} | |||
component={component} | |||
fetching={this.props.loadingFacets.authors === true} | |||
loadSearchResultCount={this.props.loadSearchResultCount} | |||
onChange={this.props.onFilterChange} |
@@ -45,8 +45,12 @@ const SEARCH_SIZE = 100; | |||
export default class TagFacet extends React.PureComponent<Props> { | |||
handleSearch = (query: string) => { | |||
const { component } = this.props; | |||
const project = | |||
component && ['TRK', 'VW', 'APP'].includes(component.qualifier) ? component.key : undefined; | |||
return searchIssueTags({ | |||
organization: this.props.organization, | |||
project, | |||
ps: SEARCH_SIZE, | |||
q: query | |||
}).then(tags => ({ maxResults: tags.length === SEARCH_SIZE, results: tags })); |