aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2019-03-25 14:10:40 +0100
committersonartech <sonartech@sonarsource.com>2019-03-29 09:44:59 +0100
commit1355d080cfa97eadfde70e6945e30f49a38ac28e (patch)
tree2e5b41f5898b00249f51bfd5b5267580c2e1b2ae /server/sonar-web/src/main/js/components
parenta289d7ab1248e465064129dc0e4b8d858fee2b79 (diff)
downloadsonarqube-1355d080cfa97eadfde70e6945e30f49a38ac28e.tar.gz
sonarqube-1355d080cfa97eadfde70e6945e30f49a38ac28e.zip
Update prettier to last version
* Prettier format all modules
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx27
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx97
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx27
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap491
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts9
-rw-r--r--server/sonar-web/src/main/js/components/charts/LineChart.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/common/MultiSelect.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/controls/Tooltip.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx26
-rw-r--r--server/sonar-web/src/main/js/components/facet/ListStyleFacetFooter.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueView.tsx25
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx57
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap137
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/nav/NavBar.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/Workspace.tsx4
18 files changed, 824 insertions, 154 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
index f35ea78319e..90c2b80ff22 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
@@ -128,13 +128,12 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
{duplication.file.projectName}
</Link>
</div>
- {duplication.file.subProject &&
- duplication.file.subProjectName && (
- <div className="component-name-parent">
- <QualifierIcon className="little-spacer-right" qualifier="BRC" />
- {duplication.file.subProjectName}
- </div>
- )}
+ {duplication.file.subProject && duplication.file.subProjectName && (
+ <div className="component-name-parent">
+ <QualifierIcon className="little-spacer-right" qualifier="BRC" />
+ {duplication.file.subProjectName}
+ </div>
+ )}
</>
)}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
index 7955f4df686..34da94c78b8 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
@@ -141,14 +141,13 @@ export default class Line extends React.PureComponent<Props> {
/>
))}
- {this.props.displayIssues &&
- !this.props.displayAllIssues && (
- <LineIssuesIndicator
- issues={this.props.issues}
- line={line}
- onClick={this.handleIssuesIndicatorClick}
- />
- )}
+ {this.props.displayIssues && !this.props.displayAllIssues && (
+ <LineIssuesIndicator
+ issues={this.props.issues}
+ line={line}
+ onClick={this.handleIssuesIndicatorClick}
+ />
+ )}
<LineCode
branchLike={this.props.branchLike}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
index f60496935b4..af7a7b7200a 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
@@ -225,20 +225,19 @@ export default class LineCode extends React.PureComponent<Props, State> {
<div className="source-line-code-inner">
<pre ref={node => (this.codeNode = node)}>{renderedTokens}</pre>
</div>
- {showIssues &&
- issues.length > 0 && (
- <LineIssuesList
- branchLike={this.props.branchLike}
- displayIssueLocationsCount={this.props.displayIssueLocationsCount}
- displayIssueLocationsLink={this.props.displayIssueLocationsLink}
- issuePopup={this.props.issuePopup}
- issues={issues}
- onIssueChange={this.props.onIssueChange}
- onIssueClick={onIssueSelect}
- onIssuePopupToggle={this.props.onIssuePopupToggle}
- selectedIssue={selectedIssue}
- />
- )}
+ {showIssues && issues.length > 0 && (
+ <LineIssuesList
+ branchLike={this.props.branchLike}
+ displayIssueLocationsCount={this.props.displayIssueLocationsCount}
+ displayIssueLocationsLink={this.props.displayIssueLocationsLink}
+ issuePopup={this.props.issuePopup}
+ issues={issues}
+ onIssueChange={this.props.onIssueChange}
+ onIssueClick={onIssueSelect}
+ onIssuePopupToggle={this.props.onIssuePopupToggle}
+ selectedIssue={selectedIssue}
+ />
+ )}
</td>
);
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
index 9f6834cfa65..c7486388662 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
@@ -189,61 +189,54 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
{this.renderBigMeasure(measures.violations)}
{this.renderBigMeasure(measures.sqale_index)}
</div>
- {measures.violations &&
- !!measures.violations.value && (
- <>
- {typesFacet && (
- <div className="measures">
- <div className="measures-list">
- {sortBy(typesFacet, f => ISSUE_TYPES.indexOf(f.val)).map(f => (
- <div className="measure measure-one-line" key={f.val}>
- <span className="measure-name">
- <IssueTypeIcon className="little-spacer-right" query={f.val} />
- {translate('issue.type', f.val)}
- </span>
- <span className="measure-value">
- {formatMeasure(f.count, 'SHORT_INT')}
- </span>
- </div>
- ))}
- </div>
+ {measures.violations && !!measures.violations.value && (
+ <>
+ {typesFacet && (
+ <div className="measures">
+ <div className="measures-list">
+ {sortBy(typesFacet, f => ISSUE_TYPES.indexOf(f.val)).map(f => (
+ <div className="measure measure-one-line" key={f.val}>
+ <span className="measure-name">
+ <IssueTypeIcon className="little-spacer-right" query={f.val} />
+ {translate('issue.type', f.val)}
+ </span>
+ <span className="measure-value">{formatMeasure(f.count, 'SHORT_INT')}</span>
+ </div>
+ ))}
</div>
- )}
- {severitiesFacet && (
- <div className="measures">
- <div className="measures-list">
- {sortBy(severitiesFacet, f => SEVERITIES.indexOf(f.val)).map(f => (
- <div className="measure measure-one-line" key={f.val}>
- <span className="measure-name">
- <SeverityHelper severity={f.val} />
- </span>
- <span className="measure-value">
- {formatMeasure(f.count, 'SHORT_INT')}
- </span>
- </div>
- ))}
- </div>
+ </div>
+ )}
+ {severitiesFacet && (
+ <div className="measures">
+ <div className="measures-list">
+ {sortBy(severitiesFacet, f => SEVERITIES.indexOf(f.val)).map(f => (
+ <div className="measure measure-one-line" key={f.val}>
+ <span className="measure-name">
+ <SeverityHelper severity={f.val} />
+ </span>
+ <span className="measure-value">{formatMeasure(f.count, 'SHORT_INT')}</span>
+ </div>
+ ))}
</div>
- )}
- {tagsFacet && (
- <div className="measures">
- <div className="measures-list">
- {tagsFacet.map(f => (
- <div className="measure measure-one-line" key={f.val}>
- <span className="measure-name">
- <TagsIcon className="little-spacer-right" />
- {f.val}
- </span>
- <span className="measure-value">
- {formatMeasure(f.count, 'SHORT_INT')}
- </span>
- </div>
- ))}
- </div>
+ </div>
+ )}
+ {tagsFacet && (
+ <div className="measures">
+ <div className="measures-list">
+ {tagsFacet.map(f => (
+ <div className="measure measure-one-line" key={f.val}>
+ <span className="measure-name">
+ <TagsIcon className="little-spacer-right" />
+ {f.val}
+ </span>
+ <span className="measure-value">{formatMeasure(f.count, 'SHORT_INT')}</span>
+ </div>
+ ))}
</div>
- )}
- </>
- )}
+ </div>
+ )}
+ </>
+ )}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
index d3e5ff08330..0abc29938c7 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
@@ -91,7 +91,8 @@ jest.mock('../../../../api/measures', () => ({
{ metric: 'security_remediation_effort', value: '0' },
{ metric: 'statements', value: '3' },
{ metric: 'skipped_tests', value: '0' },
- { metric: 'test_failures', value: '0' }
+ { metric: 'test_failures', value: '0' },
+ { metric: 'violations', value: '1' }
])
}));
@@ -129,6 +130,7 @@ jest.mock('../../../../api/metrics', () => ({
{ key: 'statements', type: 'INT', domain: 'Size' },
{ key: 'skipped_tests', type: 'INT', domain: 'Tests' },
{ key: 'test_failures', type: 'INT', domain: 'Tests' },
+ { key: 'violations', type: 'INT', domain: 'Issues' },
// next two must be filtered out
{ key: 'data', type: 'DATA' },
{ key: 'hidden', hidden: true }
@@ -155,13 +157,7 @@ const branchLike: T.ShortLivingBranch = {
};
it('should render source file', async () => {
- const wrapper = shallow(
- <MeasuresOverlay
- branchLike={branchLike}
- onClose={jest.fn()}
- sourceViewerFile={sourceViewerFile}
- />
- );
+ const wrapper = shallowRender();
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
@@ -170,13 +166,18 @@ it('should render source file', async () => {
});
it('should render test file', async () => {
- const wrapper = shallow(
+ const wrapper = shallowRender({ sourceViewerFile: { ...sourceViewerFile, q: 'UTS' } });
+ await waitAndUpdate(wrapper);
+ expect(wrapper).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<MeasuresOverlay['props']> = {}) {
+ return shallow(
<MeasuresOverlay
branchLike={branchLike}
onClose={jest.fn()}
- sourceViewerFile={{ ...sourceViewerFile, q: 'UTS' }}
+ sourceViewerFile={sourceViewerFile}
+ {...props}
/>
);
- await waitAndUpdate(wrapper);
- expect(wrapper).toMatchSnapshot();
-});
+}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap
index 94cea5cdf1b..2472c038a73 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap
@@ -166,6 +166,25 @@ exports[`should render source file 1`] = `
>
<div
className="measure measure-big"
+ data-metric="violations"
+ >
+ <span
+ className="measure-value"
+ >
+ <Measure
+ metricKey="violations"
+ metricType="INT"
+ value="1"
+ />
+ </span>
+ <span
+ className="measure-name"
+ >
+ violations
+ </span>
+ </div>
+ <div
+ className="measure measure-big"
data-metric="sqale_index"
>
<span
@@ -184,6 +203,226 @@ exports[`should render source file 1`] = `
</span>
</div>
</div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="BUG"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="BUG"
+ />
+ issue.type.BUG
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="VULNERABILITY"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="VULNERABILITY"
+ />
+ issue.type.VULNERABILITY
+ </span>
+ <span
+ className="measure-value"
+ >
+ 0
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="CODE_SMELL"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="CODE_SMELL"
+ />
+ issue.type.CODE_SMELL
+ </span>
+ <span
+ className="measure-value"
+ >
+ 2
+ </span>
+ </div>
+ </div>
+ </div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="BLOCKER"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="BLOCKER"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 5
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="CRITICAL"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="CRITICAL"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 4
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="MAJOR"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="MAJOR"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="MINOR"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="MINOR"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 3
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="INFO"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="INFO"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 2
+ </span>
+ </div>
+ </div>
+ </div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="bad-practice"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ bad-practice
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="cert"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ cert
+ </span>
+ <span
+ className="measure-value"
+ >
+ 3
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="design"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ design
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ </div>
+ </div>
</div>
</div>
<div
@@ -524,6 +763,25 @@ exports[`should render source file 2`] = `
>
<div
className="measure measure-big"
+ data-metric="violations"
+ >
+ <span
+ className="measure-value"
+ >
+ <Measure
+ metricKey="violations"
+ metricType="INT"
+ value="1"
+ />
+ </span>
+ <span
+ className="measure-name"
+ >
+ violations
+ </span>
+ </div>
+ <div
+ className="measure measure-big"
data-metric="sqale_index"
>
<span
@@ -542,6 +800,226 @@ exports[`should render source file 2`] = `
</span>
</div>
</div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="BUG"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="BUG"
+ />
+ issue.type.BUG
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="VULNERABILITY"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="VULNERABILITY"
+ />
+ issue.type.VULNERABILITY
+ </span>
+ <span
+ className="measure-value"
+ >
+ 0
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="CODE_SMELL"
+ >
+ <span
+ className="measure-name"
+ >
+ <IssueTypeIcon
+ className="little-spacer-right"
+ query="CODE_SMELL"
+ />
+ issue.type.CODE_SMELL
+ </span>
+ <span
+ className="measure-value"
+ >
+ 2
+ </span>
+ </div>
+ </div>
+ </div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="BLOCKER"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="BLOCKER"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 5
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="CRITICAL"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="CRITICAL"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 4
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="MAJOR"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="MAJOR"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="MINOR"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="MINOR"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 3
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="INFO"
+ >
+ <span
+ className="measure-name"
+ >
+ <SeverityHelper
+ severity="INFO"
+ />
+ </span>
+ <span
+ className="measure-value"
+ >
+ 2
+ </span>
+ </div>
+ </div>
+ </div>
+ <div
+ className="measures"
+ >
+ <div
+ className="measures-list"
+ >
+ <div
+ className="measure measure-one-line"
+ key="bad-practice"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ bad-practice
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="cert"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ cert
+ </span>
+ <span
+ className="measure-value"
+ >
+ 3
+ </span>
+ </div>
+ <div
+ className="measure measure-one-line"
+ key="design"
+ >
+ <span
+ className="measure-name"
+ >
+ <TagsIcon
+ className="little-spacer-right"
+ />
+ design
+ </span>
+ <span
+ className="measure-value"
+ >
+ 1
+ </span>
+ </div>
+ </div>
+ </div>
</div>
</div>
<div
@@ -1156,6 +1634,19 @@ exports[`should render source file 2`] = `
}
/>
<MeasuresOverlayMeasure
+ key="violations"
+ measure={
+ Object {
+ "metric": Object {
+ "domain": "Issues",
+ "key": "violations",
+ "type": "INT",
+ },
+ "value": "1",
+ }
+ }
+ />
+ <MeasuresOverlayMeasure
key="wont_fix_issues"
measure={
Object {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
index 6bd78badd50..6e0ad25582f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
@@ -48,11 +48,10 @@ export function splitByTokens(code: string, rootClassName = ''): Token[] {
export function highlightSymbol(tokens: Token[], symbol: string): Token[] {
const symbolRegExp = new RegExp(`\\b${symbol}\\b`);
- return tokens.map(
- token =>
- symbolRegExp.test(token.className)
- ? { ...token, className: `${token.className} highlighted` }
- : token
+ return tokens.map(token =>
+ symbolRegExp.test(token.className)
+ ? { ...token, className: `${token.className} highlighted` }
+ : token
);
}
diff --git a/server/sonar-web/src/main/js/components/charts/LineChart.tsx b/server/sonar-web/src/main/js/components/charts/LineChart.tsx
index 39aaf3d2f82..a937fa7e7fd 100644
--- a/server/sonar-web/src/main/js/components/charts/LineChart.tsx
+++ b/server/sonar-web/src/main/js/components/charts/LineChart.tsx
@@ -74,11 +74,13 @@ export default class LineChart extends React.PureComponent<Props> {
return null;
}
- const points = this.props.data.filter(point => point.y != null).map((point, index) => {
- const x = xScale(point.x);
- const y = yScale(point.y || 0);
- return <circle className="line-chart-point" cx={x} cy={y} key={index} r="3" />;
- });
+ const points = this.props.data
+ .filter(point => point.y != null)
+ .map((point, index) => {
+ const x = xScale(point.x);
+ const y = yScale(point.y || 0);
+ return <circle className="line-chart-point" cx={x} cy={y} key={index} r="3" />;
+ });
return <g>{points}</g>;
}
diff --git a/server/sonar-web/src/main/js/components/common/MultiSelect.tsx b/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
index e2870be58d0..ab0d53888b6 100644
--- a/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
+++ b/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
@@ -314,11 +314,9 @@ export default class MultiSelect extends React.PureComponent<Props, State> {
renderLabel={renderLabel}
/>
)}
- {!showNewElement &&
- selectedElements.length < 1 &&
- unselectedElements.length < 1 && (
- <li className="spacer-left">{translateWithParameters('no_results_for_x', query)}</li>
- )}
+ {!showNewElement && selectedElements.length < 1 && unselectedElements.length < 1 && (
+ <li className="spacer-left">{translateWithParameters('no_results_for_x', query)}</li>
+ )}
</ul>
{footerNode}
</div>
diff --git a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
index d1f85357ac5..7917b491ff8 100644
--- a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
@@ -66,7 +66,7 @@ export default function Tooltip(props: Props) {
}
export class TooltipInner extends React.Component<Props, State> {
- throttledPositionTooltip: (() => void);
+ throttledPositionTooltip: () => void;
mouseEnterTimeout?: number;
mouseLeaveTimeout?: number;
tooltipNode?: HTMLElement | null;
diff --git a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
index 0845c888738..a10f486cbe9 100644
--- a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
+++ b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
@@ -299,12 +299,11 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
showMore={this.showFullList}
total={sortedItems.length}
/>
- {mightHaveMoreResults &&
- this.state.showFullList && (
- <Alert className="spacer-top" variant="warning">
- {translate('facet_might_have_more_results')}
- </Alert>
- )}
+ {mightHaveMoreResults && this.state.showFullList && (
+ <Alert className="spacer-top" variant="warning">
+ {translate('facet_might_have_more_results')}
+ </Alert>
+ )}
</>
);
}
@@ -407,14 +406,13 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
/>
<DeferredSpinner loading={this.props.fetching} />
- {this.props.open &&
- !disabled && (
- <>
- {this.renderSearch()}
- {showList ? this.renderList() : this.renderSearchResults()}
- <MultipleSelectionHint options={Object.keys(stats).length} values={values.length} />
- </>
- )}
+ {this.props.open && !disabled && (
+ <>
+ {this.renderSearch()}
+ {showList ? this.renderList() : this.renderSearchResults()}
+ <MultipleSelectionHint options={Object.keys(stats).length} values={values.length} />
+ </>
+ )}
</FacetBox>
);
}
diff --git a/server/sonar-web/src/main/js/components/facet/ListStyleFacetFooter.tsx b/server/sonar-web/src/main/js/components/facet/ListStyleFacetFooter.tsx
index ccafff05264..f469684eeac 100644
--- a/server/sonar-web/src/main/js/components/facet/ListStyleFacetFooter.tsx
+++ b/server/sonar-web/src/main/js/components/facet/ListStyleFacetFooter.tsx
@@ -59,12 +59,11 @@ export default class ListStyleFacetFooter extends React.PureComponent<Props> {
</a>
)}
- {this.props.showLess &&
- allShown && (
- <a className="spacer-left text-muted" href="#" onClick={this.handleShowLessClick}>
- {translate('show_less')}
- </a>
- )}
+ {this.props.showLess && allShown && (
+ <a className="spacer-left text-muted" href="#" onClick={this.handleShowLessClick}>
+ {translate('show_less')}
+ </a>
+ )}
</footer>
);
}
diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.tsx b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
index 06d2eb4173d..f5cb65b0241 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueView.tsx
+++ b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
@@ -97,19 +97,18 @@ export default class IssueView extends React.PureComponent<Props> {
onChange={this.props.onChange}
togglePopup={this.props.togglePopup}
/>
- {issue.comments &&
- issue.comments.length > 0 && (
- <div className="issue-comments">
- {issue.comments.map(comment => (
- <IssueCommentLine
- comment={comment}
- key={comment.key}
- onDelete={this.deleteComment}
- onEdit={this.editComment}
- />
- ))}
- </div>
- )}
+ {issue.comments && issue.comments.length > 0 && (
+ <div className="issue-comments">
+ {issue.comments.map(comment => (
+ <IssueCommentLine
+ comment={comment}
+ key={comment.key}
+ onDelete={this.deleteComment}
+ onEdit={this.editComment}
+ />
+ ))}
+ </div>
+ )}
{hasCheckbox && (
<>
<Checkbox
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx
new file mode 100644
index 00000000000..59795351516
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx
@@ -0,0 +1,57 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { shallow } from 'enzyme';
+import IssueView from '../IssueView';
+import { mockIssue } from '../../../helpers/testMocks';
+
+it('should render correctly', () => {
+ const wrapper = shallowRender();
+ expect(wrapper).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<IssueView['props']> = {}) {
+ return shallow(
+ <IssueView
+ issue={mockIssue(false, {
+ comments: [
+ {
+ key: '1',
+ htmlText: 'My comment',
+ markdown: 'My comment',
+ updatable: false,
+ createdAt: '2017-07-05T09:33:29+0200',
+ author: 'admin',
+ authorLogin: 'admin',
+ authorName: 'Admin',
+ authorAvatar: 'admin-avatar',
+ authorActive: true
+ }
+ ]
+ })}
+ onAssign={jest.fn()}
+ onChange={jest.fn()}
+ onClick={jest.fn()}
+ selected={true}
+ togglePopup={jest.fn()}
+ {...props}
+ />
+ );
+}
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap
new file mode 100644
index 00000000000..b76291398cd
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/__snapshots__/IssueView-test.tsx.snap
@@ -0,0 +1,137 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<div
+ className="issue selected"
+ data-issue="AVsae-CQS-9G3txfbFN2"
+ onClick={[Function]}
+ role="listitem"
+ tabIndex={0}
+>
+ <IssueTitleBar
+ issue={
+ Object {
+ "actions": Array [],
+ "comments": Array [
+ Object {
+ "author": "admin",
+ "authorActive": true,
+ "authorAvatar": "admin-avatar",
+ "authorLogin": "admin",
+ "authorName": "Admin",
+ "createdAt": "2017-07-05T09:33:29+0200",
+ "htmlText": "My comment",
+ "key": "1",
+ "markdown": "My comment",
+ "updatable": false,
+ },
+ ],
+ "component": "main.js",
+ "componentLongName": "main.js",
+ "componentQualifier": "FIL",
+ "componentUuid": "foo1234",
+ "creationDate": "2017-03-01T09:36:01+0100",
+ "flows": Array [],
+ "fromHotspot": false,
+ "key": "AVsae-CQS-9G3txfbFN2",
+ "line": 25,
+ "message": "Reduce the number of conditional operators (4) used in the expression",
+ "organization": "myorg",
+ "project": "myproject",
+ "projectKey": "foo",
+ "projectName": "Foo",
+ "projectOrganization": "org",
+ "rule": "javascript:S1067",
+ "ruleName": "foo",
+ "secondaryLocations": Array [],
+ "severity": "MAJOR",
+ "status": "OPEN",
+ "textRange": Object {
+ "endLine": 26,
+ "endOffset": 15,
+ "startLine": 25,
+ "startOffset": 0,
+ },
+ "transitions": Array [],
+ "type": "BUG",
+ }
+ }
+ togglePopup={[MockFunction]}
+ />
+ <IssueActionsBar
+ issue={
+ Object {
+ "actions": Array [],
+ "comments": Array [
+ Object {
+ "author": "admin",
+ "authorActive": true,
+ "authorAvatar": "admin-avatar",
+ "authorLogin": "admin",
+ "authorName": "Admin",
+ "createdAt": "2017-07-05T09:33:29+0200",
+ "htmlText": "My comment",
+ "key": "1",
+ "markdown": "My comment",
+ "updatable": false,
+ },
+ ],
+ "component": "main.js",
+ "componentLongName": "main.js",
+ "componentQualifier": "FIL",
+ "componentUuid": "foo1234",
+ "creationDate": "2017-03-01T09:36:01+0100",
+ "flows": Array [],
+ "fromHotspot": false,
+ "key": "AVsae-CQS-9G3txfbFN2",
+ "line": 25,
+ "message": "Reduce the number of conditional operators (4) used in the expression",
+ "organization": "myorg",
+ "project": "myproject",
+ "projectKey": "foo",
+ "projectName": "Foo",
+ "projectOrganization": "org",
+ "rule": "javascript:S1067",
+ "ruleName": "foo",
+ "secondaryLocations": Array [],
+ "severity": "MAJOR",
+ "status": "OPEN",
+ "textRange": Object {
+ "endLine": 26,
+ "endOffset": 15,
+ "startLine": 25,
+ "startOffset": 0,
+ },
+ "transitions": Array [],
+ "type": "BUG",
+ }
+ }
+ onAssign={[MockFunction]}
+ onChange={[MockFunction]}
+ togglePopup={[MockFunction]}
+ />
+ <div
+ className="issue-comments"
+ >
+ <IssueCommentLine
+ comment={
+ Object {
+ "author": "admin",
+ "authorActive": true,
+ "authorAvatar": "admin-avatar",
+ "authorLogin": "admin",
+ "authorName": "Admin",
+ "createdAt": "2017-07-05T09:33:29+0200",
+ "htmlText": "My comment",
+ "key": "1",
+ "markdown": "My comment",
+ "updatable": false,
+ }
+ }
+ key="1"
+ onDelete={[Function]}
+ onEdit={[Function]}
+ />
+ </div>
+</div>
+`;
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
index c8da6cf250b..cdacdb47572 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
@@ -138,14 +138,13 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> {
/>
</li>
)}
- {!isSecurityHotspot &&
- issue.effort && (
- <li className="issue-meta">
- <span className="issue-meta-label">
- {translateWithParameters('issue.x_effort', issue.effort)}
- </span>
- </li>
- )}
+ {!isSecurityHotspot && issue.effort && (
+ <li className="issue-meta">
+ <span className="issue-meta-label">
+ {translateWithParameters('issue.x_effort', issue.effort)}
+ </span>
+ </li>
+ )}
{canComment && (
<IssueCommentAction
commentAutoTriggered={this.state.commentAutoTriggered}
diff --git a/server/sonar-web/src/main/js/components/nav/NavBar.tsx b/server/sonar-web/src/main/js/components/nav/NavBar.tsx
index 35a4239c53e..af7cc7e7d0a 100644
--- a/server/sonar-web/src/main/js/components/nav/NavBar.tsx
+++ b/server/sonar-web/src/main/js/components/nav/NavBar.tsx
@@ -36,7 +36,7 @@ interface State {
}
export default class NavBar extends React.PureComponent<Props, State> {
- throttledFollowHorizontalScroll: (() => void);
+ throttledFollowHorizontalScroll: () => void;
constructor(props: Props) {
super(props);
diff --git a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
index 4647079df4b..38c419c105c 100644
--- a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
@@ -133,8 +133,8 @@ export default class Workspace extends React.PureComponent<{}, State> {
if (this.mounted) {
const { key, name, qualifier } = details;
this.setState((state: State) => ({
- components: state.components.map(
- component => (component.key === key ? { ...component, name, qualifier } : component)
+ components: state.components.map(component =>
+ component.key === key ? { ...component, name, qualifier } : component
)
}));
}