aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/project-admin/quality-profiles
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-03-17 09:10:48 +0100
committerGitHub <noreply@github.com>2017-03-17 09:10:48 +0100
commitde4365079bad2df3bdee2133576dc913ffbf1ab2 (patch)
treea522ccb952f0d37f454e8188e13b3dec3f731912 /server/sonar-web/src/main/js/apps/project-admin/quality-profiles
parent6a03df65cc0c91a26150ea172a2c480e07326ea1 (diff)
downloadsonarqube-de4365079bad2df3bdee2133576dc913ffbf1ab2.tar.gz
sonarqube-de4365079bad2df3bdee2133576dc913ffbf1ab2.zip
format code using prettier (#1774)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/project-admin/quality-profiles')
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Header.js18
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js54
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/quality-profiles/QualityProfiles.js36
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js39
4 files changed, 74 insertions, 73 deletions
diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Header.js b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Header.js
index b837b802b14..2e7f7dca3ed 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Header.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Header.js
@@ -21,16 +21,16 @@ import React from 'react';
import { translate } from '../../../helpers/l10n';
export default class Header extends React.Component {
- render () {
+ render() {
return (
- <header className="page-header">
- <h1 className="page-title">
- {translate('project_quality_profiles.page')}
- </h1>
- <div className="page-description">
- {translate('project_quality_profiles.page.description')}
- </div>
- </header>
+ <header className="page-header">
+ <h1 className="page-title">
+ {translate('project_quality_profiles.page')}
+ </h1>
+ <div className="page-description">
+ {translate('project_quality_profiles.page.description')}
+ </div>
+ </header>
);
}
}
diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js
index 2bf47d13220..aaeab20a652 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/ProfileRow.js
@@ -33,38 +33,38 @@ export default class ProfileRow extends React.Component {
loading: false
};
- shouldComponentUpdate (nextProps, nextState) {
+ shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
- componentWillUpdate (nextProps) {
+ componentWillUpdate(nextProps) {
if (nextProps.profile !== this.props.profile) {
this.setState({ loading: false });
}
}
- handleChange (option) {
+ handleChange(option) {
if (this.props.profile.key !== option.value) {
this.setState({ loading: true });
this.props.onChangeProfile(this.props.profile.key, option.value);
}
}
- renderProfileName (profileOption) {
+ renderProfileName(profileOption) {
if (profileOption.isDefault) {
return (
- <span>
- <strong>{translate('default')}</strong>
- {': '}
- {profileOption.label}
- </span>
+ <span>
+ <strong>{translate('default')}</strong>
+ {': '}
+ {profileOption.label}
+ </span>
);
}
return profileOption.label;
}
- renderProfileSelect () {
+ renderProfileSelect() {
const { profile, possibleProfiles } = this.props;
const options = possibleProfiles.map(profile => ({
@@ -74,28 +74,30 @@ export default class ProfileRow extends React.Component {
}));
return (
- <Select
- options={options}
- valueRenderer={this.renderProfileName}
- optionRenderer={this.renderProfileName}
- value={profile.key}
- clearable={false}
- style={{ width: 300 }}
- disabled={this.state.loading}
- onChange={this.handleChange.bind(this)}/>
+ <Select
+ options={options}
+ valueRenderer={this.renderProfileName}
+ optionRenderer={this.renderProfileName}
+ value={profile.key}
+ clearable={false}
+ style={{ width: 300 }}
+ disabled={this.state.loading}
+ onChange={this.handleChange.bind(this)}
+ />
);
}
- render () {
+ render() {
const { profile } = this.props;
return (
- <tr data-key={profile.language}>
- <td className="thin nowrap">{profile.languageName}</td>
- <td className="thin nowrap">{this.renderProfileSelect()}</td>
- <td>{this.state.loading && <i className="spinner"/>}
- </td>
- </tr>
+ <tr data-key={profile.language}>
+ <td className="thin nowrap">{profile.languageName}</td>
+ <td className="thin nowrap">{this.renderProfileSelect()}</td>
+ <td>
+ {this.state.loading && <i className="spinner" />}
+ </td>
+ </tr>
);
}
}
diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/QualityProfiles.js b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/QualityProfiles.js
index eee707639ac..88d4c79c5c7 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/QualityProfiles.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/QualityProfiles.js
@@ -36,34 +36,33 @@ class QualityProfiles extends React.Component {
profiles: React.PropTypes.array
};
- componentDidMount () {
+ componentDidMount() {
this.props.fetchProjectProfiles(this.props.component.key);
}
- shouldComponentUpdate (nextProps, nextState) {
+ shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
- handleChangeProfile (oldKey, newKey) {
+ handleChangeProfile(oldKey, newKey) {
this.props.setProjectProfile(this.props.component.key, oldKey, newKey);
}
- render () {
+ render() {
const { allProfiles, profiles } = this.props;
return (
- <div className="page page-limited">
- <Header/>
+ <div className="page page-limited">
+ <Header />
- {profiles.length > 0 ? (
- <Table
- allProfiles={allProfiles}
- profiles={profiles}
- onChangeProfile={this.handleChangeProfile.bind(this)}/>
- ) : (
- <i className="spinner"/>
- )}
- </div>
+ {profiles.length > 0
+ ? <Table
+ allProfiles={allProfiles}
+ profiles={profiles}
+ onChangeProfile={this.handleChangeProfile.bind(this)}
+ />
+ : <i className="spinner" />}
+ </div>
);
}
}
@@ -74,7 +73,6 @@ const mapStateToProps = (state, ownProps) => ({
profiles: getProjectAdminProjectProfiles(state, ownProps.location.query.id)
});
-export default connect(
- mapStateToProps,
- { fetchProjectProfiles, setProjectProfile }
-)(QualityProfiles);
+export default connect(mapStateToProps, { fetchProjectProfiles, setProjectProfile })(
+ QualityProfiles
+);
diff --git a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js
index 426cca3fd6f..4b3d6bdc3aa 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/quality-profiles/Table.js
@@ -31,41 +31,42 @@ export default class Table extends React.Component {
onChangeProfile: React.PropTypes.func.isRequired
};
- shouldComponentUpdate (nextProps, nextState) {
+ shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
- renderHeader () {
+ renderHeader() {
// keep one empty cell for the spinner
return (
- <thead>
- <tr>
- <th className="thin nowrap">{translate('language')}</th>
- <th className="thin nowrap">{translate('quality_profile')}</th>
- <th>&nbsp;</th>
- </tr>
- </thead>
+ <thead>
+ <tr>
+ <th className="thin nowrap">{translate('language')}</th>
+ <th className="thin nowrap">{translate('quality_profile')}</th>
+ <th>&nbsp;</th>
+ </tr>
+ </thead>
);
}
- render () {
+ render() {
const profilesByLanguage = groupBy(this.props.allProfiles, 'language');
const orderedProfiles = orderBy(this.props.profiles, 'languageName');
// set key to language to avoid destroying of component
const profileRows = orderedProfiles.map(profile => (
- <ProfileRow
- key={profile.language}
- profile={profile}
- possibleProfiles={profilesByLanguage[profile.language]}
- onChangeProfile={this.props.onChangeProfile}/>
+ <ProfileRow
+ key={profile.language}
+ profile={profile}
+ possibleProfiles={profilesByLanguage[profile.language]}
+ onChangeProfile={this.props.onChangeProfile}
+ />
));
return (
- <table className="data zebra">
- {this.renderHeader()}
- <tbody>{profileRows}</tbody>
- </table>
+ <table className="data zebra">
+ {this.renderHeader()}
+ <tbody>{profileRows}</tbody>
+ </table>
);
}
}