mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: revisit doesExceedThreshold logic (#423)
<img width="316" alt="Screenshot 2024-06-01 at 3 45 42 PM" src="https://github.com/hyperdxio/hyperdx/assets/5959690/46badb82-eb3a-419b-a50a-f0b0acc5b417"> <img width="449" alt="Screenshot 2024-06-01 at 3 45 34 PM" src="https://github.com/hyperdxio/hyperdx/assets/5959690/41633796-8916-4fe6-ab37-6892e3f25436">
This commit is contained in:
parent
5e17d3bd08
commit
da866be776
5 changed files with 14 additions and 10 deletions
6
.changeset/shaggy-pants-fold.md
Normal file
6
.changeset/shaggy-pants-fold.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@hyperdx/api': patch
|
||||
'@hyperdx/app': patch
|
||||
---
|
||||
|
||||
fix: revisit doesExceedThreshold logic
|
||||
|
|
@ -84,11 +84,9 @@ describe('checkAlerts', () => {
|
|||
|
||||
it('doesExceedThreshold', () => {
|
||||
expect(doesExceedThreshold(true, 10, 11)).toBe(true);
|
||||
expect(doesExceedThreshold(true, 10, 10)).toBe(false);
|
||||
expect(doesExceedThreshold(true, 10, 9)).toBe(false);
|
||||
expect(doesExceedThreshold(false, 10, 11)).toBe(false);
|
||||
expect(doesExceedThreshold(false, 10, 10)).toBe(false);
|
||||
expect(doesExceedThreshold(true, 10, 10)).toBe(true);
|
||||
expect(doesExceedThreshold(false, 10, 9)).toBe(true);
|
||||
expect(doesExceedThreshold(false, 10, 10)).toBe(false);
|
||||
});
|
||||
|
||||
it('expandToNestedObject', () => {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export const doesExceedThreshold = (
|
|||
threshold: number,
|
||||
value: number,
|
||||
) => {
|
||||
if (isThresholdTypeAbove && value > threshold) {
|
||||
if (isThresholdTypeAbove && value >= threshold) {
|
||||
return true;
|
||||
} else if (!isThresholdTypeAbove && value < threshold) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ function AlertForm({
|
|||
<div className="me-2 mb-2">
|
||||
<Form.Select id="type" size="sm" {...register('type')}>
|
||||
<option key="presence" value="presence">
|
||||
more than
|
||||
at least (≥)
|
||||
</option>
|
||||
<option key="absence" value="absence">
|
||||
less than
|
||||
less than ({'<'})
|
||||
</option>
|
||||
</Form.Select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default function EditChartFormAlerts({
|
|||
id="type"
|
||||
size="sm"
|
||||
style={{
|
||||
width: 140,
|
||||
width: 170,
|
||||
}}
|
||||
value={alert?.type}
|
||||
onChange={e => {
|
||||
|
|
@ -51,10 +51,10 @@ export default function EditChartFormAlerts({
|
|||
}}
|
||||
>
|
||||
<option key="presence" value="presence">
|
||||
exceeds
|
||||
is at least (≥)
|
||||
</option>
|
||||
<option key="absence" value="absence">
|
||||
falls below
|
||||
falls below ({'<'})
|
||||
</option>
|
||||
</Form.Select>
|
||||
<div style={{ marginBottom: -20 }}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue