From 69490493bc79d654e9c2d6aa3e5ff1821bccef1b Mon Sep 17 00:00:00 2001 From: Grégoire Aubert Date: Wed, 19 Jul 2017 17:11:03 +0200 Subject: SONAR-9566, SONAR-9571 Update bulk operation to display only tags and assignee related to the selected organization --- server/sonar-web/src/main/js/api/issues.js | 2 +- .../src/main/js/apps/issues/components/App.js | 1 + .../main/js/apps/issues/components/BulkChangeModal.js | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/sonar-web/src/main/js/api/issues.js b/server/sonar-web/src/main/js/api/issues.js index 30cb211e96e..598fdce00de 100644 --- a/server/sonar-web/src/main/js/api/issues.js +++ b/server/sonar-web/src/main/js/api/issues.js @@ -89,7 +89,7 @@ export function getIssuesCount(query: {}): Promise<*> { } export const searchIssueTags = ( - data: { ps?: number, q?: string } = { ps: 500 } + data: { organization?: string, ps?: number, q?: string } = { ps: 500 } ): Promise> => getJSON('/api/issues/tags', data).then(r => r.tags); export function getIssueChangelog(issue: string): Promise<*> { diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.js b/server/sonar-web/src/main/js/apps/issues/components/App.js index 4e7d31c1ead..43dfe6ecba7 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/App.js +++ b/server/sonar-web/src/main/js/apps/issues/components/App.js @@ -669,6 +669,7 @@ export default class App extends React.PureComponent { onClose={this.closeBulkChange} onDone={this.handleBulkChangeDone} onRequestFail={this.props.onRequestFail} + organization={this.props.organization} />} ); diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js index 8fe75c2019c..4340f1670bf 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js +++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.js @@ -41,7 +41,8 @@ type Props = {| fetchIssues: ({}) => Promise<*>, onClose: () => void, onDone: () => void, - onRequestFail: Error => void + onRequestFail: Error => void, + organization?: { key: string } |}; type State = {| @@ -58,6 +59,7 @@ type State = {| assignee?: string, comment?: string, notifications?: boolean, + organization?: string, removeTags?: Array, severity?: string, transition?: string, @@ -74,12 +76,20 @@ export default class BulkChangeModal extends React.PureComponent { constructor(props: Props) { super(props); - this.state = { issues: [], loading: true, submitting: false }; + let organization = props.component && props.component.organization; + if (props.organization && !organization) { + organization = props.organization.key; + } + this.state = { issues: [], loading: true, submitting: false, organization }; } componentDidMount() { this.mounted = true; - Promise.all([this.loadIssues(), searchIssueTags()]).then(([issues, tags]) => { + + Promise.all([ + this.loadIssues(), + searchIssueTags({ organization: this.state.organization, ps: 500 }) + ]).then(([issues, tags]) => { if (this.mounted) { this.setState({ issues: issues.issues, @@ -107,7 +117,7 @@ export default class BulkChangeModal extends React.PureComponent { handleAssigneeSearch = (query: string) => { if (query.length > 1) { - return searchAssignees(query, this.props.component); + return searchAssignees(query, this.state.organization); } else { const { currentUser } = this.props; const { issues } = this.state; -- cgit v1.2.3