aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/issue
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-03-14 12:47:17 +0100
committerGitHub <noreply@github.com>2018-03-14 12:47:17 +0100
commit6f189a7c95ee207e02c7c9321ed37d0c6ca4afe6 (patch)
tree494c72690c0ac9607716574a5bfa49f9c4ca315a /server/sonar-web/src/main/js/components/issue
parent47d50b8a9c17d595a07b6a7e157849ccf1ffc302 (diff)
downloadsonarqube-6f189a7c95ee207e02c7c9321ed37d0c6ca4afe6.tar.gz
sonarqube-6f189a7c95ee207e02c7c9321ed37d0c6ca4afe6.zip
rewrite workspace in react (#3140)
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue')
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueMessage.js10
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js3
2 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js
index df26092b983..515edd9b3ba 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js
@@ -19,6 +19,7 @@
*/
// @flow
import React from 'react';
+import PropTypes from 'prop-types';
import { translate } from '../../../helpers/l10n';
export default class IssueMessage extends React.PureComponent {
@@ -27,13 +28,16 @@ export default class IssueMessage extends React.PureComponent {
rule: string,
organization: string
};
-*/
+ */
+
+ static contextTypes = {
+ workspace: PropTypes.object.isRequired
+ };
handleClick = (e /*: MouseEvent */) => {
e.preventDefault();
e.stopPropagation();
- const Workspace = require('../../workspace/main').default;
- Workspace.openRule({
+ this.context.workspace.openRule({
key: this.props.rule,
organization: this.props.organization
});
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js
index eafe943c67a..785bc2a21f1 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js
@@ -27,7 +27,8 @@ it('should render with the message and a link to open the rule', () => {
rule="javascript:S1067"
message="Reduce the number of conditional operators (4) used in the expression"
organization="myorg"
- />
+ />,
+ { context: { workspace: {} } }
);
expect(element).toMatchSnapshot();
});