Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui/checks): checks render once they've been created #15556

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
1. [15510](https://github.com/influxdata/influxdb/pull/15510): UI/Telegraf sort functionality fixed
1. [15549](https://github.com/influxdata/influxdb/pull/15549): UI/Task edit functionality fixed
1. [15559](https://github.com/influxdata/influxdb/pull/15559): Exiting a configuration of a dashboard cell now properly renders the cell content
1. [15556](https://github.com/influxdata/influxdb/pull/15556): Creating a check now displays on the checklist

## v2.0.0-alpha.18 [2019-09-26]

Expand Down
36 changes: 36 additions & 0 deletions ui/cypress/e2e/checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,40 @@ describe('Checks', () => {
})
})
})

describe('Check should be viewable once created', () => {
beforeEach(() => {
// creates a check before each iteration
// TODO: refactor into a request
Copy link
Contributor Author

@asalem1 asalem1 Oct 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason why this refactor into a request was punted is because this bug was blocking #15518 I felt it was important to get this merged and move forward with the current work we have since this seems like a pretty low-priority refactor

cy.getByTestID('create-check').click()
cy.getByTestID('create-threshold-check').click()
cy.getByTestID(`selector-list ${measurement}`).click()
cy.getByTestID('save-cell--button').should('be.disabled')
cy.getByTestID(`selector-list ${field}`).click()
cy.getByTestID('save-cell--button').should('be.disabled')
cy.getByTestID('checkeo--header alerting-tab').click()
cy.getByTestID('add-threshold-condition-WARN').click()
cy.getByTestID('save-cell--button').click()
cy.getByTestID('check-card').should('have.length', 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ for testing!

})

it('should allow created checks to be selected and routed to the edit page', () => {
cy.getByTestID('check-card--name').should('have.length', 1)
cy.getByTestID('check-card--name').click()
cy.get('@org').then(({id}: Organization) => {
cy.fixture('routes').then(({orgs, alerting, checks}) => {
cy.url().then(url => {
Cypress.minimatch(
url,
`
${
Cypress.config().baseUrl
}${orgs}/${id}${alerting}${checks}/*/edit
`
)
})
})
})
})
})
})
7 changes: 5 additions & 2 deletions ui/src/alerting/actions/checks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Libraries
import {Dispatch} from 'react'
import {push} from 'react-router-redux'
import {get} from 'lodash'

// Constants
import * as copy from 'src/shared/copy/notifications'
Expand Down Expand Up @@ -151,11 +152,12 @@ export const saveCheckFromTimeMachine = () => async (
alerting: {check},
} = getActiveTimeMachine(state)

const labels = get(check, 'labels', []) as Label[]
asalem1 marked this conversation as resolved.
Show resolved Hide resolved
const checkWithOrg = {
...check,
query: draftQueries[0],
orgID,
labels: check.labels.map(l => l.id),
labels: labels.map(l => l.id),
} as PostCheck

const resp = check.id
Expand Down Expand Up @@ -253,10 +255,11 @@ export const cloneCheck = (check: Check) => async (
const allCheckNames = list.map(c => c.name)

const clonedName = incrementCloneName(allCheckNames, check.name)
const labels = get(check, 'labels', []) as Label[]
asalem1 marked this conversation as resolved.
Show resolved Hide resolved
const data = {
...check,
name: clonedName,
labels: check.labels.map(l => l.id),
labels: labels.map(l => l.id),
} as PostCheck
const resp = await api.postCheck({data})

Expand Down