Skip to content

Commit

Permalink
fix(zero_value_checks): checks can now have a value set to 0 (#17933)
Browse files Browse the repository at this point in the history
  • Loading branch information
asalem1 authored May 4, 2020
1 parent 35ed573 commit 2eb70ee
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Bug Fixes

1. [17906](https://github.com/influxdata/influxdb/pull/17906): Ensure UpdateUser cleans up the index when updating names
1. [17933](https://github.com/influxdata/influxdb/pull/17933): Ensure Checks can be set for zero values

### UI Improvements

Expand Down
4 changes: 2 additions & 2 deletions notification/check/threshold.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (b ThresholdConfigBase) GetLevel() notification.CheckLevel {
// Lesser threshold type.
type Lesser struct {
ThresholdConfigBase
Value float64 `json:"value,omitempty"`
Value float64 `json:"value"`
}

// Type of the threshold config.
Expand All @@ -404,7 +404,7 @@ func (td Lesser) MarshalJSON() ([]byte, error) {
// Greater threshold type.
type Greater struct {
ThresholdConfigBase
Value float64 `json:"value,omitempty"`
Value float64 `json:"value"`
}

// Type of the threshold config.
Expand Down
22 changes: 22 additions & 0 deletions ui/cypress/e2e/checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ describe('Checks', () => {
cy.getByTestID('save-cell--button').should('be.disabled')
cy.getByTestID('checkeo--header alerting-tab').click()
cy.getByTestID('add-threshold-condition-WARN').click()
cy.getByTestID('input-field')
.clear()
.type('0')
cy.getByTestID('save-cell--button').click()
cy.getByTestID('check-card').should('have.length', 1)
cy.getByTestID('notification-error').should('not.exist')
Expand All @@ -104,6 +107,25 @@ describe('Checks', () => {
})
})

it('should allow created checks edited checks to persist changes (especially if the value is 0)', () => {
const checkName = 'Check it out!'
// Selects the check to edit
cy.getByTestID('check-card--name').should('have.length', 1)
cy.getByTestID('check-card--name').click()
// ensures that the check WARN value is set to 0
cy.getByTestID('input-field')
.should('have.value', '0')
.clear()
.type('7')
// renames the check
cy.getByTestID('page-title')
.contains('Name this Check')
.type(checkName)
cy.getByTestID('save-cell--button').click()
// checks that the values persisted
cy.getByTestID('check-card--name').contains(checkName)
})

it('can edit the check card', () => {
// toggle on / off
cy.get('.cf-resource-card__disabled').should('not.exist')
Expand Down
17 changes: 14 additions & 3 deletions ui/src/alerting/components/builder/AlertBuilder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,24 @@
}

&.alert-builder--meta-card {
flex: 1 0 280px !important;
flex: 1 0 140px !important;
}
&.alert-builder--message-card {
flex: 3 0 320px !important;
flex: 3 0 140px !important;
}
&.alert-builder--conditions-card {
flex: 2 0 320px !important;
flex: 2 0 200px !important;
}
@media screen and (min-width: $cf-grid--breakpoint-md) {
&.alert-builder--meta-card {
flex: 1 0 280px !important;
}
&.alert-builder--message-card {
flex: 3 0 320px !important;
}
&.alert-builder--conditions-card {
flex: 2 0 320px !important;
}
}
}

Expand Down

0 comments on commit 2eb70ee

Please sign in to comment.