Skip to content

Commit

Permalink
fix(actions/checks): made suggested changes to actions"
Browse files Browse the repository at this point in the history
  • Loading branch information
asalem1 committed Oct 24, 2019
1 parent dbf0c70 commit 34f5ce0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 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,16 +152,12 @@ export const saveCheckFromTimeMachine = () => async (
alerting: {check},
} = getActiveTimeMachine(state)

const labels = get(check, 'labels', [])
const checkWithOrg = {
...check,
query: draftQueries[0],
orgID,
labels:
(check &&
check.labels &&
Array.isArray(check.labels) &&
check.labels.map(l => l.id)) ||
[],
labels: labels.map(l => l.id),
} as PostCheck

const resp = check.id
Expand Down Expand Up @@ -258,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', [])
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

0 comments on commit 34f5ce0

Please sign in to comment.