aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/issue/IssueView.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue/IssueView.js')
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueView.js48
1 files changed, 28 insertions, 20 deletions
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 52ee7e95280..3d959f26573 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueView.js
+++ b/server/sonar-web/src/main/js/components/issue/IssueView.js
@@ -20,43 +20,51 @@
// @flow
import React from 'react';
import classNames from 'classnames';
-import Checkbox from '../../components/controls/Checkbox';
import IssueTitleBar from './components/IssueTitleBar';
import IssueActionsBar from './components/IssueActionsBar';
import IssueCommentLine from './components/IssueCommentLine';
+import { updateIssue } from './actions';
import { deleteIssueComment, editIssueComment } from '../../api/issues';
import type { Issue } from './types';
-type Props = {
+type Props = {|
checked?: boolean,
currentPopup: string,
issue: Issue,
onAssign: (string) => void,
- onCheck?: () => void,
+ onChange: (Issue) => void,
+ onCheck?: (string) => void,
onClick: (string) => void,
onFail: (Error) => void,
- onFilterClick?: () => void,
- onIssueChange: (Promise<*>, oldIssue?: Issue, newIssue?: Issue) => void,
+ onFilter?: (property: string, issue: Issue) => void,
selected: boolean,
togglePopup: (string) => void
-};
+|};
export default class IssueView extends React.PureComponent {
props: Props;
- handleClick = (evt: MouseEvent) => {
- evt.preventDefault();
+ handleCheck = (event: Event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ if (this.props.onCheck) {
+ this.props.onCheck(this.props.issue.key);
+ }
+ };
+
+ handleClick = (event: Event & { target: HTMLElement }) => {
+ event.preventDefault();
if (this.props.onClick) {
this.props.onClick(this.props.issue.key);
}
};
editComment = (comment: string, text: string) => {
- this.props.onIssueChange(editIssueComment({ comment, text }));
+ updateIssue(this.props.onChange, editIssueComment({ comment, text }));
};
deleteComment = (comment: string) => {
- this.props.onIssueChange(deleteIssueComment({ comment }));
+ updateIssue(this.props.onChange, deleteIssueComment({ comment }));
};
render() {
@@ -74,13 +82,13 @@ export default class IssueView extends React.PureComponent {
className={issueClass}
data-issue={issue.key}
onClick={this.handleClick}
- tabIndex={0}
- role="listitem">
+ role="listitem"
+ tabIndex={0}>
<IssueTitleBar
issue={issue}
currentPopup={this.props.currentPopup}
onFail={this.props.onFail}
- onFilterClick={this.props.onFilterClick}
+ onFilter={this.props.onFilter}
togglePopup={this.props.togglePopup}
/>
<IssueActionsBar
@@ -89,7 +97,7 @@ export default class IssueView extends React.PureComponent {
onAssign={this.props.onAssign}
onFail={this.props.onFail}
togglePopup={this.props.togglePopup}
- onIssueChange={this.props.onIssueChange}
+ onChange={this.props.onChange}
/>
{issue.comments &&
issue.comments.length > 0 &&
@@ -108,13 +116,13 @@ export default class IssueView extends React.PureComponent {
<i className="issue-navigate-to-right icon-chevron-right" />
</a>
{hasCheckbox &&
- <div className="js-toggle issue-checkbox-container">
- <Checkbox
- className="issue-checkbox"
- onCheck={this.props.onCheck}
- checked={this.props.checked}
+ <a className="js-toggle issue-checkbox-container" href="#" onClick={this.handleCheck}>
+ <i
+ className={classNames('issue-checkbox', 'icon-checkbox', {
+ 'icon-checkbox-checked': this.props.checked
+ })}
/>
- </div>}
+ </a>}
</div>
);
}