diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-08-29 11:38:53 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-13 13:53:58 +0200 |
commit | 793e86fce66f356099792b7231c9a1d949ff875e (patch) | |
tree | 8bd08099539c3cb1ff159823ee1d1f74a5f2c979 /server/sonar-web/src/main/js/apps/quality-gates | |
parent | 736e89cc1629e1e52db00f67e4650f1b88695de9 (diff) | |
download | sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.tar.gz sonarqube-793e86fce66f356099792b7231c9a1d949ff875e.zip |
update prettier
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-gates')
8 files changed, 126 insertions, 159 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js index 81a6003f7dc..6f865126100 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js @@ -153,18 +153,12 @@ export default class Condition extends Component { if (isDiffMetric) { return ( - <span className="note"> - {translate('quality_gates.condition.leak.unconditional')} - </span> + <span className="note">{translate('quality_gates.condition.leak.unconditional')}</span> ); } if (isRating) { - return ( - <span className="note"> - {translate('quality_gates.condition.leak.never')} - </span> - ); + return <span className="note">{translate('quality_gates.condition.leak.never')}</span>; } return isLeakSelected @@ -196,11 +190,7 @@ export default class Condition extends Component { } if (metric.type === 'RATING') { - return ( - <span className="note"> - {translate('quality_gates.operator.GT.rating')} - </span> - ); + return <span className="note">{translate('quality_gates.operator.GT.rating')}</span>; } const operators = ['LT', 'GT', 'EQ', 'NE']; @@ -229,70 +219,72 @@ export default class Condition extends Component { <tr> <td className="text-middle"> {getLocalizedMetricName(metric)} - {metric.hidden && - <span className="text-danger little-spacer-left"> - {translate('deprecated')} - </span>} + {metric.hidden && ( + <span className="text-danger little-spacer-left">{translate('deprecated')}</span> + )} </td> - <td className="thin text-middle nowrap"> - {this.renderPeriod()} - </td> + <td className="thin text-middle nowrap">{this.renderPeriod()}</td> - <td className="thin text-middle nowrap"> - {this.renderOperator()} - </td> + <td className="thin text-middle nowrap">{this.renderOperator()}</td> <td className="thin text-middle nowrap"> - {edit - ? <ThresholdInput - name="warning" - value={this.state.warning} - metric={metric} - onChange={value => this.handleWarningChange(value)} - /> - : formatMeasure(condition.warning, metric.type)} + {edit ? ( + <ThresholdInput + name="warning" + value={this.state.warning} + metric={metric} + onChange={value => this.handleWarningChange(value)} + /> + ) : ( + formatMeasure(condition.warning, metric.type) + )} </td> <td className="thin text-middle nowrap"> - {edit - ? <ThresholdInput - name="error" - value={this.state.error} - metric={metric} - onChange={value => this.handleErrorChange(value)} - /> - : formatMeasure(condition.error, metric.type)} + {edit ? ( + <ThresholdInput + name="error" + value={this.state.error} + metric={metric} + onChange={value => this.handleErrorChange(value)} + /> + ) : ( + formatMeasure(condition.error, metric.type) + )} </td> - {edit && + {edit && ( <td className="thin text-middle nowrap"> - {condition.id - ? <div className="button-group"> - <button - className="update-condition" - disabled={!this.state.changed} - onClick={this.handleUpdateClick.bind(this)}> - {translate('update_verb')} - </button> - <button - className="button-red delete-condition" - onClick={this.handleDeleteClick.bind(this)}> - {translate('delete')} - </button> - </div> - : <div className="button-group"> - <button className="add-condition" onClick={this.handleSaveClick.bind(this)}> - {translate('add_verb')} - </button> - <a - className="action cancel-add-condition" - href="#" - onClick={this.handleCancelClick.bind(this)}> - {translate('cancel')} - </a> - </div>} - </td>} + {condition.id ? ( + <div className="button-group"> + <button + className="update-condition" + disabled={!this.state.changed} + onClick={this.handleUpdateClick.bind(this)}> + {translate('update_verb')} + </button> + <button + className="button-red delete-condition" + onClick={this.handleDeleteClick.bind(this)}> + {translate('delete')} + </button> + </div> + ) : ( + <div className="button-group"> + <button className="add-condition" onClick={this.handleSaveClick.bind(this)}> + {translate('add_verb')} + </button> + <a + className="action cancel-add-condition" + href="#" + onClick={this.handleCancelClick.bind(this)}> + {translate('cancel')} + </a> + </div> + )} + </td> + )} </tr> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js index b9e07816788..3d4b9ff3aed 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.js @@ -87,72 +87,54 @@ export default class Conditions extends React.PureComponent { return ( <div id="quality-gate-conditions" className="quality-gate-section"> - <h3 className="spacer-bottom"> - {translate('quality_gates.conditions')} - </h3> + <h3 className="spacer-bottom">{translate('quality_gates.conditions')}</h3> <ConditionsAlert /> - {this.state.error && - <div className="alert alert-danger"> - {this.state.error} - </div>} + {this.state.error && <div className="alert alert-danger">{this.state.error}</div>} - {uniqDuplicates.length > 0 && + {uniqDuplicates.length > 0 && ( <div className="alert alert-warning"> - <p> - {translate('quality_gates.duplicated_conditions')} - </p> + <p>{translate('quality_gates.duplicated_conditions')}</p> <ul className="list-styled spacer-top"> - {uniqDuplicates.map(d => - <li key={d.metric.key}> - {getLocalizedMetricName(d.metric)} - </li> - )} + {uniqDuplicates.map(d => ( + <li key={d.metric.key}>{getLocalizedMetricName(d.metric)}</li> + ))} </ul> - </div>} + </div> + )} - {sortedConditions.length - ? <table id="quality-gate-conditions" className="data zebra zebra-hover"> - <thead> - <tr> - <th className="nowrap"> - {translate('quality_gates.conditions.metric')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.leak')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.operator')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.warning')} - </th> - <th className="thin nowrap"> - {translate('quality_gates.conditions.error')} - </th> - {edit && <th />} - </tr> - </thead> - <tbody> - {sortedConditions.map((condition, index) => - <Condition - key={getKey(condition, index)} - qualityGate={qualityGate} - condition={condition} - metric={metrics.find(metric => metric.key === condition.metric)} - edit={edit} - onSaveCondition={onSaveCondition} - onDeleteCondition={onDeleteCondition} - onError={this.handleError.bind(this)} - onResetError={this.handleResetError.bind(this)} - /> - )} - </tbody> - </table> - : <div className="big-spacer-top"> - {translate('quality_gates.no_conditions')} - </div>} + {sortedConditions.length ? ( + <table id="quality-gate-conditions" className="data zebra zebra-hover"> + <thead> + <tr> + <th className="nowrap">{translate('quality_gates.conditions.metric')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.leak')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.operator')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.warning')}</th> + <th className="thin nowrap">{translate('quality_gates.conditions.error')}</th> + {edit && <th />} + </tr> + </thead> + <tbody> + {sortedConditions.map((condition, index) => ( + <Condition + key={getKey(condition, index)} + qualityGate={qualityGate} + condition={condition} + metric={metrics.find(metric => metric.key === condition.metric)} + edit={edit} + onSaveCondition={onSaveCondition} + onDeleteCondition={onDeleteCondition} + onError={this.handleError.bind(this)} + onResetError={this.handleResetError.bind(this)} + /> + ))} + </tbody> + </table> + ) : ( + <div className="big-spacer-top">{translate('quality_gates.no_conditions')}</div> + )} {edit && <AddConditionForm metrics={metrics} onSelect={onAddCondition} />} </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js index 334b4d2a397..30e36b2dbbd 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionsAlert.js @@ -36,11 +36,12 @@ export default class ConditionsAlert extends Component { return ( <div className="big-spacer-bottom"> {translate('quality_gates.introduction')} - {!expanded && + {!expanded && ( <a className="spacer-left" href="#" onClick={this.handleMoreClick.bind(this)}> {translate('more')} - </a>} - {expanded && + </a> + )} + {expanded && ( <div className="spacer-top"> {translate('quality_gates.health_icons')} <ul> @@ -54,7 +55,8 @@ export default class ConditionsAlert extends Component { <i className="icon-alert-error" /> {translate('alerts.notes.error')} </li> </ul> - </div>} + </div> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js index 5c826c2c302..e5418420447 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsContent.js @@ -45,9 +45,7 @@ export default class DetailsContent extends React.PureComponent { /> <div id="quality-gate-projects" className="quality-gate-section"> - <h3 className="spacer-bottom"> - {translate('quality_gates.projects')} - </h3> + <h3 className="spacer-bottom">{translate('quality_gates.projects')}</h3> {gate.isDefault ? defaultMessage : <Projects qualityGate={gate} edit={canEdit} />} </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js index 2f6091184d6..6acb20708d8 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.js @@ -48,10 +48,8 @@ export default class DetailsHeader extends React.PureComponent { <div className="layout-page-header-panel layout-page-main-header issues-main-header"> <div className="layout-page-header-panel-inner layout-page-main-header-inner"> <div className="layout-page-main-inner"> - <h2 className="pull-left"> - {qualityGate.name} - </h2> - {edit && + <h2 className="pull-left">{qualityGate.name}</h2> + {edit && ( <div className="pull-right"> <div className="button-group"> <button id="quality-gate-rename" onClick={this.handleRenameClick}> @@ -61,9 +59,11 @@ export default class DetailsHeader extends React.PureComponent { {translate('copy')} </button> <button id="quality-gate-toggle-default" onClick={this.handleSetAsDefaultClick}> - {qualityGate.isDefault - ? translate('unset_as_default') - : translate('set_as_default')} + {qualityGate.isDefault ? ( + translate('unset_as_default') + ) : ( + translate('set_as_default') + )} </button> <button id="quality-gate-delete" @@ -72,7 +72,8 @@ export default class DetailsHeader extends React.PureComponent { {translate('delete')} </button> </div> - </div>} + </div> + )} </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js index 03b2c9ef28b..2de9b9e5218 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Intro.js @@ -25,12 +25,8 @@ export default function Intro() { <div className="layout-page-main"> <div className="layout-page-main-inner"> <div className="search-navigator-intro markdown"> - <p> - {translate('quality_gates.intro.1')} - </p> - <p> - {translate('quality_gates.intro.2')} - </p> + <p>{translate('quality_gates.intro.1')}</p> + <p>{translate('quality_gates.intro.2')}</p> </div> </div> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/List.js b/server/sonar-web/src/main/js/apps/quality-gates/components/List.js index b6a4d3a8c23..8d84ec0e677 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/List.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/List.js @@ -25,7 +25,7 @@ import { getQualityGateUrl } from '../../../helpers/urls'; export default function List({ organization, qualityGates }) { return ( <div className="list-group"> - {qualityGates.map(qualityGate => + {qualityGates.map(qualityGate => ( <Link key={qualityGate.id} to={getQualityGateUrl(qualityGate.id, organization && organization.key)} @@ -35,20 +35,17 @@ export default function List({ organization, qualityGates }) { <table> <tbody> <tr> - <td className="text-top"> - {qualityGate.name} - </td> + <td className="text-top">{qualityGate.name}</td> <td className="text-top thin nowrap spacer-left"> - {qualityGate.isDefault && - <span className="badge pull-right"> - {translate('default')} - </span>} + {qualityGate.isDefault && ( + <span className="badge pull-right">{translate('default')}</span> + )} </td> </tr> </tbody> </table> </Link> - )} + ))} </div> ); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js index 6c4b912b8df..686d17f3489 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.js @@ -29,17 +29,16 @@ export default function ListHeader({ canEdit, onAdd }) { return ( <header className="page-header"> - <h1 className="page-title"> - {translate('quality_gates.page')} - </h1> - {canEdit && + <h1 className="page-title">{translate('quality_gates.page')}</h1> + {canEdit && ( <div className="page-actions"> <div className="button-group"> <button id="quality-gate-add" onClick={handleAddClick}> {translate('create')} </button> </div> - </div>} + </div> + )} </header> ); } |