aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2021-11-04 16:58:20 +0100
committersonartech <sonartech@sonarsource.com>2021-11-05 20:03:28 +0000
commitbde46f38a61a418cbe88adf46c8c5b2de4fea8a2 (patch)
treef812cea47988d7ff60229802c6d69b857caf925a /server/sonar-web/src/main/js/apps
parentbc65f5705bf0b064d997cd3a2210a39b0506a48f (diff)
downloadsonarqube-bde46f38a61a418cbe88adf46c8c5b2de4fea8a2.tar.gz
sonarqube-bde46f38a61a418cbe88adf46c8c5b2de4fea8a2.zip
SONAR-15397 Fix Issue tags aren't filtered by branch
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx4
2 files changed, 18 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
index 51cfb8fea75..67666f9bc77 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
@@ -21,6 +21,7 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { getGlobalSettingValue, Store } from '../../../store/rootReducer';
import { BranchLike } from '../../../types/branch-like';
+import { isBranch, isPullRequest } from '../../../helpers/branch-like';
import { ComponentQualifier, isApplication, isPortfolioLike } from '../../../types/component';
import {
Facet,
@@ -105,7 +106,19 @@ export class Sidebar extends React.PureComponent<Props> {
}
render() {
- const { component, createdAfterIncludesTime, facets, openFacets, query } = this.props;
+ const {
+ component,
+ createdAfterIncludesTime,
+ facets,
+ openFacets,
+ query,
+ branchLike
+ } = this.props;
+
+ const branch =
+ (isBranch(branchLike) && branchLike.name) ||
+ (isPullRequest(branchLike) && branchLike.branch) ||
+ undefined;
const displayProjectsFacet =
!component || !['TRK', 'BRC', 'DIR', 'DEV_PRJ'].includes(component.qualifier);
@@ -216,6 +229,7 @@ export class Sidebar extends React.PureComponent<Props> {
/>
<TagFacet
component={component}
+ branch={branch}
fetching={this.props.loadingFacets.tags === true}
loadSearchResultCount={this.props.loadSearchResultCount}
onChange={this.props.onFilterChange}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
index dd3cb484862..6c8f4af269c 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
@@ -30,6 +30,7 @@ import { Query } from '../utils';
interface Props {
component: T.Component | undefined;
+ branch?: string;
fetching: boolean;
loadSearchResultCount: (property: string, changes: Partial<Query>) => Promise<Facet>;
onChange: (changes: Partial<Query>) => void;
@@ -44,11 +45,12 @@ const SEARCH_SIZE = 100;
export default class TagFacet extends React.PureComponent<Props> {
handleSearch = (query: string) => {
- const { component } = this.props;
+ const { component, branch } = this.props;
const project =
component && ['TRK', 'VW', 'APP'].includes(component.qualifier) ? component.key : undefined;
return searchIssueTags({
project,
+ branch,
ps: SEARCH_SIZE,
q: query
}).then(tags => ({ maxResults: tags.length === SEARCH_SIZE, results: tags }));