aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/component-measures
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-03-03 17:15:37 +0100
committerGitHub <noreply@github.com>2017-03-03 17:15:37 +0100
commitba93a1a0ed121bd331d87636b733e3e31f0b2d89 (patch)
treed8577faa316ff0f357c5e8d3641152e2d48be698 /server/sonar-web/src/main/js/apps/component-measures
parent85f7fcad4280c797f580dc2ceaf5d029092cd9c1 (diff)
downloadsonarqube-ba93a1a0ed121bd331d87636b733e3e31f0b2d89.tar.gz
sonarqube-ba93a1a0ed121bd331d87636b733e3e31f0b2d89.zip
refactor source viewer (#1744)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component-measures')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js2
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js17
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js17
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js2
4 files changed, 30 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js b/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js
index d8ad4c31afc..4cd674b7c1f 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/bubbleChart/BubbleChart.js
@@ -118,7 +118,7 @@ export default class BubbleChart extends React.Component {
handleBubbleClick (component) {
if (['FIL', 'UTS'].includes(component.qualifier)) {
- Workspace.openComponent({ uuid: component.id });
+ Workspace.openComponent({ key: component.key });
} else {
window.location = getComponentUrl(component.refKey || component.key);
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
index 149582321dc..bbfc0ae32bf 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js
@@ -19,10 +19,11 @@
*/
import React from 'react';
import classNames from 'classnames';
+import moment from 'moment';
import ComponentsList from './ComponentsList';
import ListHeader from './ListHeader';
import Spinner from '../../components/Spinner';
-import SourceViewer from '../../../../components/source-viewer/SourceViewer';
+import SourceViewer from '../../../../components/SourceViewer/StandaloneSourceViewer';
import ListFooter from '../../../../components/controls/ListFooter';
export default class ListView extends React.Component {
@@ -104,6 +105,16 @@ export default class ListView extends React.Component {
}
const selectedIndex = components.indexOf(selected);
const sourceViewerPeriod = metric.key.indexOf('new_') === 0 && !!leakPeriod ? leakPeriod : null;
+ const sourceViewerPeriodDate = sourceViewerPeriod != null ? moment(sourceViewerPeriod.date).toDate() : null;
+
+ const filterLine = sourceViewerPeriodDate != null ? line => {
+ if (line.scmDate) {
+ const scmDate = moment(line.scmDate).toDate();
+ return scmDate >= sourceViewerPeriodDate;
+ } else {
+ return false;
+ }
+ } : undefined;
return (
<div ref="container" className="measure-details-plain-list">
@@ -140,8 +151,8 @@ export default class ListView extends React.Component {
{!!selected && (
<div className="measure-details-viewer">
<SourceViewer
- component={selected}
- period={sourceViewerPeriod}/>
+ component={selected.key}
+ filterLine={filterLine}/>
</div>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
index 554a2904227..fb0bb744bd0 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js
@@ -18,10 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
+import moment from 'moment';
import ComponentsList from './ComponentsList';
import ListHeader from './ListHeader';
import Spinner from '../../components/Spinner';
-import SourceViewer from '../../../../components/source-viewer/SourceViewer';
+import SourceViewer from '../../../../components/SourceViewer/StandaloneSourceViewer';
import ListFooter from '../../../../components/controls/ListFooter';
export default class TreeView extends React.Component {
@@ -97,6 +98,16 @@ export default class TreeView extends React.Component {
const selectedIndex = components.indexOf(selected);
const sourceViewerPeriod = metric.key.indexOf('new_') === 0 && !!leakPeriod ? leakPeriod : null;
+ const sourceViewerPeriodDate = sourceViewerPeriod != null ? moment(sourceViewerPeriod.date).toDate() : null;
+
+ const filterLine = sourceViewerPeriodDate != null ? line => {
+ if (line.scmDate) {
+ const scmDate = moment(line.scmDate).toDate();
+ return scmDate >= sourceViewerPeriodDate;
+ } else {
+ return false;
+ }
+ } : undefined;
return (
<div ref="container" className="measure-details-plain-list">
@@ -133,8 +144,8 @@ export default class TreeView extends React.Component {
{!!selected && (
<div className="measure-details-viewer">
<SourceViewer
- component={selected}
- period={sourceViewerPeriod}/>
+ component={selected.key}
+ filterLine={filterLine}/>
</div>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js
index 2255ef5c4c8..b599af3cd2b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/details/treemap/MeasureTreemap.js
@@ -134,7 +134,7 @@ export default class MeasureTreemap extends React.Component {
const isFile = node.qualifier === 'FIL' || node.qualifier === 'UTS';
if (isFile) {
- Workspace.openComponent({ uuid: node.id });
+ Workspace.openComponent({ key: node.key });
return;
}