diff --git a/frontend/app/api_client.js b/frontend/app/api_client.js index 02e575033..28aa2913b 100644 --- a/frontend/app/api_client.js +++ b/frontend/app/api_client.js @@ -16,13 +16,14 @@ const siteIdRequiredPaths = [ '/integration/sources', '/issue_types', '/sample_rate', - '/flows', + '/saved_search', '/rehydrations', '/sourcemaps', '/errors', '/funnels', '/assist', - '/heatmaps' + '/heatmaps', + '/custom_metrics', ]; const noStoringFetchPathStarts = [ diff --git a/frontend/app/components/Alerts/AlertForm.js b/frontend/app/components/Alerts/AlertForm.js index deb0fa405..692191c96 100644 --- a/frontend/app/components/Alerts/AlertForm.js +++ b/frontend/app/components/Alerts/AlertForm.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useEffect } from 'react' import { Button, Dropdown, Form, Input, SegmentSelection, Checkbox, Message, Link, Icon } from 'UI'; import { alertMetrics as metrics } from 'App/constants'; import { alertConditions as conditions } from 'App/constants'; @@ -8,6 +8,7 @@ import stl from './alertForm.css'; import DropdownChips from './DropdownChips'; import { validateEmail } from 'App/validate'; import cn from 'classnames'; +import { fetchTriggerOptions } from 'Duck/alerts'; const thresholdOptions = [ { text: '15 minutes', value: 15 }, @@ -46,11 +47,15 @@ const Section = ({ index, title, description, content }) => ( const integrationsRoute = client(CLIENT_TABS.INTEGRATIONS); const AlertForm = props => { - const { instance, slackChannels, webhooks, loading, onDelete, deleting } = props; + const { instance, slackChannels, webhooks, loading, onDelete, deleting, triggerOptions } = props; const write = ({ target: { value, name } }) => props.edit({ [ name ]: value }) const writeOption = (e, { name, value }) => props.edit({ [ name ]: value }); const onChangeOption = (e, { checked, name }) => props.edit({ [ name ]: checked }) + useEffect(() => { + props.fetchTriggerOptions(); + }, []) + const writeQueryOption = (e, { name, value }) => { const { query } = instance; props.edit({ query: { ...query, [name] : value } }); @@ -61,10 +66,12 @@ const AlertForm = props => { props.edit({ query: { ...query, [name] : value } }); } - const metric = (instance && instance.query.left) ? metrics.find(i => i.value === instance.query.left) : null; + const metric = (instance && instance.query.left) ? triggerOptions.find(i => i.value === instance.query.left) : null; const unit = metric ? metric.unit : ''; const isThreshold = instance.detectionMethod === 'threshold'; + console.log('triggerOptions', triggerOptions) + return (