aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx27
1 files changed, 12 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
index 03e45767dec..be2a2129959 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
@@ -65,19 +65,16 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
}
handleFormSubmit = () => {
- if (this.state.metric) {
- const { condition, qualityGate } = this.props;
- const newCondition: Omit<Condition, 'id'> = {
- metric: this.state.metric.key,
- op: this.getSinglePossibleOperator(this.state.metric) || this.state.op,
- error: this.state.error
- };
- const submitPromise = condition
- ? updateCondition({ id: condition.id, ...newCondition })
- : createCondition({ gateId: qualityGate.id, ...newCondition });
- return submitPromise.then(this.props.onAddCondition);
- }
- return Promise.reject();
+ const { condition, qualityGate } = this.props;
+ const newCondition: Omit<Condition, 'id'> = {
+ metric: this.state.metric!.key,
+ op: this.getSinglePossibleOperator(this.state.metric!) || this.state.op,
+ error: this.state.error
+ };
+ const submitPromise = condition
+ ? updateCondition({ id: condition.id, ...newCondition })
+ : createCondition({ gateId: qualityGate.id, ...newCondition });
+ return submitPromise.then(this.props.onAddCondition);
};
handleScopeChange = (scope: 'new' | 'overall') => {
@@ -160,7 +157,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
{metric && (
<>
<div className="modal-field display-inline-block">
- <label htmlFor="condition-operator">
+ <label id="condition-operator-label">
{translate('quality_gates.conditions.operator')}
</label>
<ConditionOperator
@@ -170,7 +167,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
/>
</div>
<div className="modal-field display-inline-block spacer-left">
- <label htmlFor="condition-threshold">
+ <label id="condition-threshold-label">
{translate('quality_gates.conditions.value')}
</label>
<ThresholdInput