aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/code
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-03-10 14:18:52 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-03-10 14:27:17 +0100
commit3e81655d523661ee43318d2a9f285b7b710528f2 (patch)
treea2bfbe5bda13dce47760b6c02aa4f28618fb19a8 /server/sonar-web/src/main/js/apps/code
parent0271ca6a4dbdd7aa8a43ea656a73d84833c1fdc7 (diff)
downloadsonarqube-3e81655d523661ee43318d2a9f285b7b710528f2.tar.gz
sonarqube-3e81655d523661ee43318d2a9f285b7b710528f2.zip
SONAR-7402 highlight new code in source viewer
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code')
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/SourceViewer.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/SourceViewer.js b/server/sonar-web/src/main/js/apps/code/components/SourceViewer.js
index ddedbf2617d..0f0431a9e3d 100644
--- a/server/sonar-web/src/main/js/apps/code/components/SourceViewer.js
+++ b/server/sonar-web/src/main/js/apps/code/components/SourceViewer.js
@@ -20,7 +20,7 @@
import React, { Component } from 'react';
import BaseSourceViewer from '../../../components/source-viewer/main';
-
+import { getPeriodDate, getPeriodLabel } from '../../../helpers/periods';
export default class SourceViewer extends Component {
componentDidMount () {
@@ -39,7 +39,7 @@ export default class SourceViewer extends Component {
this.renderSourceViewer();
}
- componentWillUnmount() {
+ componentWillUnmount () {
this.destroySourceViewer();
}
@@ -47,12 +47,24 @@ export default class SourceViewer extends Component {
this.sourceViewer = new BaseSourceViewer();
this.sourceViewer.render().$el.appendTo(this.refs.container);
this.sourceViewer.open(this.props.component.id);
+ this.sourceViewer.on('loaded', this.handleLoad.bind(this));
}
destroySourceViewer () {
this.sourceViewer.destroy();
}
+ handleLoad () {
+ const { period } = this.props;
+
+ if (period) {
+ const periodDate = getPeriodDate(period);
+ const periodLabel = getPeriodLabel(period);
+ console.log(periodDate, periodLabel);
+ this.sourceViewer.filterLinesByDate(periodDate, periodLabel);
+ }
+ }
+
render () {
return <div ref="container" className="code-source-viewer"></div>;
}