From 20ed9553b9a1012f341c1f5d4a594221ae437600 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 10 Oct 2017 15:58:32 +0200 Subject: [PATCH] SONAR-9750 Impossible to bulk add a new tag on issues from the UI --- .../apps/issues/components/BulkChangeModal.js | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) 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 13de0c50c22..8662db7ae8d 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 @@ -20,7 +20,7 @@ // @flow import React from 'react'; import Modal from 'react-modal'; -import Select from 'react-select'; +import Select, { Creatable } from 'react-select'; import { pickBy, sortBy } from 'lodash'; import SearchSelect from '../../../components/controls/SearchSelect'; import Checkbox from '../../../components/controls/Checkbox'; @@ -368,22 +368,28 @@ export default class BulkChangeModal extends React.PureComponent { return this.renderField('severity', 'issue.set_severity', affected, input); }; - renderTagsField = (field /*: string */, label /*: string */) => { + renderTagsField = (field /*: string */, label /*: string */, allowCreate /*: boolean */) => { const affected /*: number */ = this.state.issues.filter(hasAction('set_tags')).length; if (this.state.tags == null || affected === 0) { return null; } - const options = this.state.tags.map(tag => ({ label: tag, value: tag })); + const Component = allowCreate ? Creatable : Select; + + const options = [...this.state.tags, ...(this.state[field] || [])].map(tag => ({ + label: tag, + value: tag + })); const input = ( -