aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-05-01 17:05:38 +0200
committerGrégoire Aubert <gregaubert@users.noreply.github.com>2017-05-03 10:02:47 +0200
commit5c4b668ed14f307d22df715bcaf323cf27ee2c21 (patch)
tree92c645089844d559ce08d42c206abe7103ae30c5 /server
parent9d783bdcacbca512660880509fb092a181a54cf4 (diff)
downloadsonarqube-5c4b668ed14f307d22df715bcaf323cf27ee2c21.tar.gz
sonarqube-5c4b668ed14f307d22df715bcaf323cf27ee2c21.zip
SONAR-8982 Fix error message when issue action fails
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/components/issue/Issue.js6
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueView.js4
-rw-r--r--server/sonar-web/src/main/js/components/issue/actions.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js3
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js7
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTags.js1
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTransition.js2
7 files changed, 20 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/Issue.js b/server/sonar-web/src/main/js/components/issue/Issue.js
index cd44f80e5b7..eaa0214f92a 100644
--- a/server/sonar-web/src/main/js/components/issue/Issue.js
+++ b/server/sonar-web/src/main/js/components/issue/Issue.js
@@ -138,7 +138,11 @@ export default class BaseIssue extends React.PureComponent {
handleAssignement = (login: string) => {
const { issue } = this.props;
if (issue.assignee !== login) {
- updateIssue(this.props.onChange, setIssueAssignee({ issue: issue.key, assignee: login }));
+ updateIssue(
+ this.props.onChange,
+ this.handleFail,
+ setIssueAssignee({ issue: issue.key, assignee: login })
+ );
}
this.togglePopup('assign', false);
};
diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.js b/server/sonar-web/src/main/js/components/issue/IssueView.js
index f7690db0625..22770e294ff 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueView.js
+++ b/server/sonar-web/src/main/js/components/issue/IssueView.js
@@ -60,11 +60,11 @@ export default class IssueView extends React.PureComponent {
};
editComment = (comment: string, text: string) => {
- updateIssue(this.props.onChange, editIssueComment({ comment, text }));
+ updateIssue(this.props.onChange, this.props.onFail, editIssueComment({ comment, text }));
};
deleteComment = (comment: string) => {
- updateIssue(this.props.onChange, deleteIssueComment({ comment }));
+ updateIssue(this.props.onChange, this.props.onFail, deleteIssueComment({ comment }));
};
render() {
diff --git a/server/sonar-web/src/main/js/components/issue/actions.js b/server/sonar-web/src/main/js/components/issue/actions.js
index 46acb282549..6a8deedc1ca 100644
--- a/server/sonar-web/src/main/js/components/issue/actions.js
+++ b/server/sonar-web/src/main/js/components/issue/actions.js
@@ -18,18 +18,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @flow
-import { onFail } from '../../store/rootActions';
import { parseIssueFromResponse } from '../../helpers/issues';
import type { Issue } from './types';
export const updateIssue = (
onChange: Issue => void,
+ onFail: Error => void,
resultPromise: Promise<*>,
oldIssue?: Issue,
newIssue?: Issue
) => {
const optimisticUpdate = oldIssue != null && newIssue != null;
-
if (optimisticUpdate) {
// $FlowFixMe `newIssue` is not null, because `optimisticUpdate` is true
onChange(newIssue);
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js
index 9a7bcf803a7..b8ae17ec46f 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js
@@ -66,6 +66,7 @@ export default class IssueActionsBar extends React.PureComponent {
const newIssue = { ...issue, [property]: value };
updateIssue(
this.props.onChange,
+ this.props.onFail,
apiCall({ issue: issue.key, [property]: value }),
issue,
newIssue
@@ -117,6 +118,7 @@ export default class IssueActionsBar extends React.PureComponent {
issue={issue}
hasTransitions={hasTransitions}
onChange={this.props.onChange}
+ onFail={this.props.onFail}
togglePopup={this.props.togglePopup}
/>
</li>
@@ -142,6 +144,7 @@ export default class IssueActionsBar extends React.PureComponent {
currentPopup={this.props.currentPopup}
issueKey={issue.key}
onChange={this.props.onChange}
+ onFail={this.props.onFail}
toggleComment={this.toggleComment}
/>}
</ul>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js
index 32df39c5b61..cac1cf29a37 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.js
@@ -31,6 +31,7 @@ type Props = {|
currentPopup: string,
issueKey: string,
onChange: Issue => void,
+ onFail: Error => void,
toggleComment: (open?: boolean, placeholder?: string) => void
|};
@@ -38,7 +39,11 @@ export default class IssueCommentAction extends React.PureComponent {
props: Props;
addComment = (text: string) => {
- updateIssue(this.props.onChange, addIssueComment({ issue: this.props.issueKey, text }));
+ updateIssue(
+ this.props.onChange,
+ this.props.onFail,
+ addIssueComment({ issue: this.props.issueKey, text })
+ );
this.props.toggleComment(false);
};
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 c634406c5f6..6cc03db8a44 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
@@ -48,6 +48,7 @@ export default class IssueTags extends React.PureComponent {
const newIssue = { ...issue, tags };
updateIssue(
this.props.onChange,
+ this.props.onFail,
setIssueTags({ issue: issue.key, tags: tags.join(',') }),
issue,
newIssue
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.js b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.js
index 509d58ddb31..3e2cf50517f 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.js
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.js
@@ -31,6 +31,7 @@ type Props = {
isOpen: boolean,
issue: Issue,
onChange: Issue => void,
+ onFail: Error => void,
togglePopup: string => void
};
@@ -40,6 +41,7 @@ export default class IssueTransition extends React.PureComponent {
setTransition = (transition: string) => {
updateIssue(
this.props.onChange,
+ this.props.onFail,
setIssueTransition({ issue: this.props.issue.key, transition })
);
this.toggleSetTransition();