diff --git a/ui/cypress/e2e/checks.test.ts b/ui/cypress/e2e/checks.test.ts index dcf1e90369..741a295ae6 100644 --- a/ui/cypress/e2e/checks.test.ts +++ b/ui/cypress/e2e/checks.test.ts @@ -41,18 +41,19 @@ describe('Checks', () => { }) describe('When a check does not exist', () => { - for(let i = 0; i < 100; i++){ - it('should route the user to the alerting index page', () => { - const nonexistentID = '046cd86a2030f000' + it('should route the user to the alerting index page', () => { + const nonexistentID = '046cd86a2030f000' - // visitng the check edit overlay - cy.get('@org').then(({id}: Organization) => { - cy.fixture('routes').then(({orgs, alerting, checks}) => { - cy.visit(`${orgs}/${id}${alerting}${checks}/${nonexistentID}/edit`) - cy.url().should('eq', `${Cypress.config().baseUrl}${orgs}/${id}${alerting}`) - }) + // visitng the check edit overlay + cy.get('@org').then(({id}: Organization) => { + cy.fixture('routes').then(({orgs, alerting, checks}) => { + cy.visit(`${orgs}/${id}${alerting}${checks}/${nonexistentID}/edit`) + cy.url().should( + 'eq', + `${Cypress.config().baseUrl}${orgs}/${id}${alerting}` + ) }) }) - } + }) }) }) diff --git a/ui/src/alerting/actions/checks.ts b/ui/src/alerting/actions/checks.ts index 85aaaf96a5..e8f99fc849 100644 --- a/ui/src/alerting/actions/checks.ts +++ b/ui/src/alerting/actions/checks.ts @@ -2,7 +2,6 @@ import {Dispatch} from 'react' import {push} from 'react-router-redux' - // Constants import * as copy from 'src/shared/copy/notifications' @@ -70,7 +69,8 @@ export const removeLabelFromCheck = (checkID: string, label: Label) => ({ }) export const getChecks = () => async ( - dispatch: Dispatch + dispatch: Dispatch< + Action | NotificationAction | ReturnType >, getState: GetState ) => { @@ -98,12 +98,13 @@ export const getChecks = () => async ( } export const getCheckForTimeMachine = (checkID: string) => async ( - dispatch: Dispatch, getState: GetState + dispatch: Dispatch, + getState: GetState ) => { try { dispatch(setCheckStatus(RemoteDataState.Loading)) const { - orgs: {org} + orgs: {org}, } = getState() const resp = await api.getCheck({checkID}) diff --git a/ui/src/alerting/components/endpoints/EditEndpointOverlay.tsx b/ui/src/alerting/components/endpoints/EditEndpointOverlay.tsx index eae9dbe2c5..ad114308c1 100644 --- a/ui/src/alerting/components/endpoints/EditEndpointOverlay.tsx +++ b/ui/src/alerting/components/endpoints/EditEndpointOverlay.tsx @@ -19,7 +19,7 @@ interface DispatchProps { } interface StateProps { - endpoint: NotificationEndpoint, + endpoint: NotificationEndpoint } type Props = WithRouterProps & DispatchProps & StateProps @@ -68,7 +68,7 @@ const mdtp = { const mstp = ({endpoints}: AppState, {params, router}: Props): StateProps => { const endpoint = endpoints.list.find(ep => ep.id === params.endpointID) - if(!endpoint){ + if (!endpoint) { router.push(`/orgs/${params.orgID}/alerting`) } diff --git a/ui/src/index.tsx b/ui/src/index.tsx index e5c11a5f84..f6e0ab0b2a 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -163,7 +163,6 @@ class Root extends PureComponent { -