aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-profiles
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-12-12 10:58:10 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-12-15 14:25:12 +0100
commitf26d933e1ecbd9ca104a6e1e0eb251462056aca8 (patch)
treead92814bbafd3fcf985fa14a173cb7f825821285 /server/sonar-web/src/main/js/apps/quality-profiles
parent090c2183e379ad52500727038e3bab72d74e0dfa (diff)
downloadsonarqube-f26d933e1ecbd9ca104a6e1e0eb251462056aca8.tar.gz
sonarqube-f26d933e1ecbd9ca104a6e1e0eb251462056aca8.zip
update react to 16.2.0, use react fragments
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx149
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap1
3 files changed, 75 insertions, 76 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
index 175ba7f003e..a98f0e91b5f 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
@@ -73,95 +73,96 @@ export default class ComparisonResults extends React.PureComponent<Props> {
if (this.props.inLeft.length === 0) {
return null;
}
- const header = (
- <tr key="left-header">
- <td>
- <h6>
- {translateWithParameters(
- 'quality_profiles.x_rules_only_in',
- this.props.inLeft.length
- )}{' '}
- {this.props.left.name}
- </h6>
- </td>
- <td>&nbsp;</td>
- </tr>
+ return (
+ <React.Fragment>
+ <tr>
+ <td>
+ <h6>
+ {translateWithParameters(
+ 'quality_profiles.x_rules_only_in',
+ this.props.inLeft.length
+ )}{' '}
+ {this.props.left.name}
+ </h6>
+ </td>
+ <td>&nbsp;</td>
+ </tr>
+ {this.props.inLeft.map(rule => (
+ <tr key={`left-${rule.key}`} className="js-comparison-in-left">
+ <td>{this.renderRule(rule, rule.severity)}</td>
+ <td>&nbsp;</td>
+ </tr>
+ ))}
+ </React.Fragment>
);
- const rows = this.props.inLeft.map(rule => (
- <tr key={`left-${rule.key}`} className="js-comparison-in-left">
- <td>{this.renderRule(rule, rule.severity)}</td>
- <td>&nbsp;</td>
- </tr>
- ));
- return [header, ...rows];
}
renderRight() {
if (this.props.inRight.length === 0) {
return null;
}
- const header = (
- <tr key="right-header">
- <td>&nbsp;</td>
- <td>
- <h6>
- {translateWithParameters(
- 'quality_profiles.x_rules_only_in',
- this.props.inRight.length
- )}{' '}
- {this.props.right.name}
- </h6>
- </td>
- </tr>
+ return (
+ <React.Fragment>
+ <tr>
+ <td>&nbsp;</td>
+ <td>
+ <h6>
+ {translateWithParameters(
+ 'quality_profiles.x_rules_only_in',
+ this.props.inRight.length
+ )}{' '}
+ {this.props.right.name}
+ </h6>
+ </td>
+ </tr>
+ {this.props.inRight.map(rule => (
+ <tr key={`right-${rule.key}`} className="js-comparison-in-right">
+ <td>&nbsp;</td>
+ <td>{this.renderRule(rule, rule.severity)}</td>
+ </tr>
+ ))}
+ </React.Fragment>
);
- const rows = this.props.inRight.map(rule => (
- <tr key={`right-${rule.key}`} className="js-comparison-in-right">
- <td>&nbsp;</td>
- <td>{this.renderRule(rule, rule.severity)}</td>
- </tr>
- ));
- return [header, ...rows];
}
renderModified() {
if (this.props.modified.length === 0) {
return null;
}
- const header = (
- <tr key="modified-header">
- <td colSpan={2} className="text-center">
- <h6>
- {translateWithParameters(
- 'quality_profiles.x_rules_have_different_configuration',
- this.props.modified.length
- )}
- </h6>
- </td>
- </tr>
- );
- const secondHeader = (
- <tr key="modified-second-header">
- <td>
- <h6>{this.props.left.name}</h6>
- </td>
- <td>
- <h6>{this.props.right.name}</h6>
- </td>
- </tr>
+ return (
+ <React.Fragment>
+ <tr>
+ <td colSpan={2} className="text-center">
+ <h6>
+ {translateWithParameters(
+ 'quality_profiles.x_rules_have_different_configuration',
+ this.props.modified.length
+ )}
+ </h6>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h6>{this.props.left.name}</h6>
+ </td>
+ <td>
+ <h6>{this.props.right.name}</h6>
+ </td>
+ </tr>
+ {this.props.modified.map(rule => (
+ <tr key={`modified-${rule.key}`} className="js-comparison-modified">
+ <td>
+ {this.renderRule(rule, rule.left.severity)}
+ {this.renderParameters(rule.left.params)}
+ </td>
+ <td>
+ {this.renderRule(rule, rule.right.severity)}
+ {this.renderParameters(rule.right.params)}
+ </td>
+ </tr>
+ ))}
+ </React.Fragment>
);
- const rows = this.props.modified.map(rule => (
- <tr key={`modified-${rule.key}`} className="js-comparison-modified">
- <td>
- {this.renderRule(rule, rule.left.severity)}
- {this.renderParameters(rule.left.params)}
- </td>
- <td>
- {this.renderRule(rule, rule.right.severity)}
- {this.renderParameters(rule.right.params)}
- </td>
- </tr>
- ));
- return [header, secondHeader, ...rows];
}
render() {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
index facde0a4a34..4fec4cb33e9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx
@@ -164,7 +164,6 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
</thead>
<tbody>
<ProfileRulesRowTotal
- key="all"
count={this.state.activatedTotal}
organization={organization}
qprofile={profile.key}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap
index 6d92fb9ab26..c366398e56e 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap
@@ -28,7 +28,6 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] =
<tbody>
<ProfileRulesRowTotal
count={68}
- key="all"
organization="foo"
qprofile="foo"
total={243}