Merge pull request #15521 from grafana/hugoh/bug-type-error-in-thresholds

Fixes #15505
pull/15527/head
Torkel Ödegaard 7 years ago committed by GitHub
commit 14d8a94273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx
  2. 2
      packages/grafana-ui/src/components/ThresholdsEditor/_ThresholdsEditor.scss

@ -159,8 +159,6 @@ export class ThresholdsEditor extends PureComponent<Props, State> {
}; };
renderInput = (threshold: Threshold) => { renderInput = (threshold: Threshold) => {
const value = threshold.index === 0 ? 'Base' : threshold.value;
return ( return (
<div className="thresholds-row-input-inner"> <div className="thresholds-row-input-inner">
<span className="thresholds-row-input-inner-arrow" /> <span className="thresholds-row-input-inner-arrow" />
@ -171,20 +169,27 @@ export class ThresholdsEditor extends PureComponent<Props, State> {
</div> </div>
)} )}
</div> </div>
{threshold.index === 0 && (
<div className="thresholds-row-input-inner-value">
<input type="text" value="Base" readOnly />
</div>
)}
{threshold.index > 0 && (
<>
<div className="thresholds-row-input-inner-value"> <div className="thresholds-row-input-inner-value">
<input <input
type="number" type="number"
step="0.0001" step="0.0001"
onChange={event => this.onChangeThresholdValue(event, threshold)} onChange={event => this.onChangeThresholdValue(event, threshold)}
value={value} value={threshold.value}
onBlur={this.onBlur} onBlur={this.onBlur}
readOnly={threshold.index === 0} readOnly={threshold.index === 0}
/> />
</div> </div>
{threshold.index > 0 && (
<div className="thresholds-row-input-inner-remove" onClick={() => this.onRemoveThreshold(threshold)}> <div className="thresholds-row-input-inner-remove" onClick={() => this.onRemoveThreshold(threshold)}>
<i className="fa fa-times" /> <i className="fa fa-times" />
</div> </div>
</>
)} )}
</div> </div>
); );

@ -43,7 +43,7 @@
} }
.thresholds-row-input { .thresholds-row-input {
margin-top: 49px; margin-top: 44px;
margin-left: 2px; margin-left: 2px;
} }

Loading…
Cancel
Save