aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/issue
diff options
context:
space:
mode:
authorPascal Mugnier <pascal.mugnier@sonarsource.com>2018-03-20 11:56:00 +0100
committerSonarTech <sonartech@sonarsource.com>2018-03-22 12:37:49 +0100
commit82a1cb0b4a6ea692624b290b15080fdf7d1b475c (patch)
treef0014002f03c233da8b4628440a28784fcd136f3 /server/sonar-web/src/main/js/components/issue
parent169ffd14e1e2510b5fe6845577678b00f56ff9eb (diff)
downloadsonarqube-82a1cb0b4a6ea692624b290b15080fdf7d1b475c.tar.gz
sonarqube-82a1cb0b4a6ea692624b290b15080fdf7d1b475c.zip
SONAR-9642 Reduce steps for selecting a custom chart (#6)
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue')
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTags.js9
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetIssueTagsPopup-test.tsx.snap1
3 files changed, 8 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTags.js b/server/sonar-web/src/main/js/components/issue/components/IssueTags.js
index e40a85b71af..fb183a7f8b7 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTags.js
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTags.js
@@ -59,20 +59,21 @@ export default class IssueTags extends React.PureComponent {
render() {
const { issue } = this.props;
+ const { tags = [] } = issue;
if (this.props.canSetTags) {
return (
<BubblePopupHelper
isOpen={this.props.isOpen}
- position="bottomright"
- togglePopup={this.toggleSetTags}
popup={
<SetIssueTagsPopup
organization={issue.projectOrganization}
- selectedTags={issue.tags}
+ selectedTags={tags}
setTags={this.setTags}
/>
- }>
+ }
+ position="bottomright"
+ togglePopup={this.toggleSetTags}>
<button
className={'js-issue-edit-tags button-link issue-action issue-action-with-options'}
onClick={this.toggleSetTags}>
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
index 7aa3bebba62..90b8af5f628 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
@@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { without } from 'lodash';
+import { difference, without } from 'lodash';
import { BubblePopupPosition } from '../../../components/common/BubblePopup';
import TagsSelector from '../../../components/tags/TagsSelector';
import { searchIssueTags } from '../../../api/issues';
@@ -72,6 +72,7 @@ export default class SetIssueTagsPopup extends React.PureComponent<Props, State>
};
render() {
+ const availableTags = difference(this.state.searchResult, this.props.selectedTags);
return (
<TagsSelector
listSize={LIST_SIZE}
@@ -80,7 +81,7 @@ export default class SetIssueTagsPopup extends React.PureComponent<Props, State>
onUnselect={this.onUnselect}
position={this.props.popupPosition}
selectedTags={this.props.selectedTags}
- tags={this.state.searchResult}
+ tags={availableTags}
/>
);
}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetIssueTagsPopup-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetIssueTagsPopup-test.tsx.snap
index 36d73b1a4cf..57990df2131 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetIssueTagsPopup-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/__snapshots__/SetIssueTagsPopup-test.tsx.snap
@@ -14,7 +14,6 @@ exports[`should render tags popup correctly 1`] = `
}
tags={
Array [
- "mytag",
"test",
"second",
]