diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d941200d2..e8b3a6d1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ 1. [#3649](https://github.com/influxdata/chronograf/pull/3649): Fix erroneous icons in Date Picker widget 1. [#3697](https://github.com/influxdata/chronograf/pull/3697): Fix allowing hyphens in basepath 1. [#3698](https://github.com/influxdata/chronograf/pull/3698): Fix error in cell when tempVar returns no values +1. [#3733](https://github.com/influxdata/chronograf/pull/3733): Change arrows in table columns so that ascending sort points up and descending points down ## v1.5.0.0 [2018-05-15-RC] diff --git a/bolt/internal/internal.go b/bolt/internal/internal.go index 07dc5adcad..b9a59fc94a 100644 --- a/bolt/internal/internal.go +++ b/bolt/internal/internal.go @@ -341,6 +341,7 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { Selected: v.Selected, Type: v.Type, Value: v.Value, + Key: v.Key, } } @@ -522,6 +523,7 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { Selected: v.Selected, Type: v.Type, Value: v.Value, + Key: v.Key, } } diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index 5c7cbe97ff..19a76f7811 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -640,6 +640,7 @@ type TemplateValue struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Selected bool `protobuf:"varint,3,opt,name=selected,proto3" json:"selected,omitempty"` + Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` } func (m *TemplateValue) Reset() { *m = TemplateValue{} } @@ -668,6 +669,13 @@ func (m *TemplateValue) GetSelected() bool { return false } +func (m *TemplateValue) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + type TemplateQuery struct { Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` Db string `protobuf:"bytes,2,opt,name=db,proto3" json:"db,omitempty"` @@ -1388,111 +1396,111 @@ func init() { func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ - // 1685 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5b, 0x8f, 0xe3, 0x48, - 0x15, 0x96, 0x93, 0x38, 0x89, 0x4f, 0xd2, 0xbd, 0x2d, 0x33, 0xda, 0x35, 0x0b, 0x42, 0xc1, 0xe2, - 0xd2, 0x5c, 0x76, 0x58, 0xf5, 0x0a, 0x09, 0xad, 0x76, 0x57, 0xea, 0xcb, 0xce, 0xd0, 0x73, 0xed, - 0xa9, 0x74, 0x0f, 0x4f, 0x68, 0x55, 0xb1, 0x2b, 0x49, 0x69, 0x1d, 0xdb, 0x94, 0xcb, 0xdd, 0x6d, - 0x9e, 0xf9, 0x1d, 0x48, 0x48, 0xf0, 0x8e, 0x10, 0x8f, 0x48, 0xbc, 0xf3, 0x03, 0xf8, 0x2b, 0xbc, - 0xa2, 0x53, 0x17, 0xa7, 0xdc, 0x9d, 0x19, 0x0d, 0x12, 0xda, 0xb7, 0xfa, 0xce, 0x39, 0x39, 0x55, - 0x75, 0x2e, 0x5f, 0x1d, 0x07, 0xf6, 0x79, 0x2e, 0x99, 0xc8, 0x69, 0xf6, 0xb0, 0x14, 0x85, 0x2c, - 0xc2, 0xb1, 0xc5, 0xf1, 0x1f, 0xfa, 0x30, 0x9c, 0x17, 0xb5, 0x48, 0x58, 0xb8, 0x0f, 0xbd, 0xf3, - 0xb3, 0xc8, 0x9b, 0x79, 0x87, 0x7d, 0xd2, 0x3b, 0x3f, 0x0b, 0x43, 0x18, 0xbc, 0xa0, 0x1b, 0x16, - 0xf5, 0x66, 0xde, 0x61, 0x40, 0xd4, 0x1a, 0x65, 0x97, 0x4d, 0xc9, 0xa2, 0xbe, 0x96, 0xe1, 0x3a, - 0xfc, 0x10, 0xc6, 0x57, 0x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, 0xf1, 0x67, 0x00, 0x5b, 0x19, 0xbe, 0x2e, 0xdb, 0x6c, 0xbc, 0x60, 0x37, 0x58, - 0x32, 0x95, 0x19, 0xda, 0x77, 0x68, 0xe2, 0xcf, 0x21, 0x38, 0xa9, 0x79, 0x96, 0x9e, 0xe7, 0xcb, - 0x02, 0xa9, 0xe3, 0x35, 0x13, 0xd5, 0x36, 0x5f, 0x16, 0x62, 0xb8, 0x91, 0x45, 0xda, 0x1e, 0x32, - 0x68, 0x31, 0x54, 0x7f, 0x6a, 0x7c, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd3, 0xfb, 0xbd, - 0x7b, 0xe6, 0x10, 0x00, 0x00, + // 1691 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x8f, 0xe3, 0x48, + 0x11, 0x97, 0x13, 0x3b, 0x89, 0x2b, 0x99, 0xb9, 0x91, 0x59, 0xdd, 0x99, 0x03, 0xa1, 0x60, 0xf1, + 0x31, 0x7c, 0xdc, 0x72, 0x9a, 0x13, 0x12, 0x3a, 0xdd, 0x9d, 0x34, 0x1f, 0xb7, 0xcb, 0xec, 0xe7, + 0x6c, 0x67, 0x76, 0x78, 0x42, 0xa7, 0x4e, 0xdc, 0x49, 0x5a, 0xe7, 0xd8, 0xa6, 0xdd, 0x9e, 0x19, + 0xf3, 0xcc, 0xdf, 0x81, 0x84, 0x04, 0xef, 0x08, 0xf1, 0x88, 0xc4, 0x3b, 0x7f, 0x00, 0xff, 0x0a, + 0xaf, 0xa8, 0xfa, 0xc3, 0x69, 0xcf, 0x64, 0x57, 0x8b, 0x84, 0xee, 0xad, 0x7f, 0x55, 0x95, 0xea, + 0xea, 0xea, 0xaa, 0x5f, 0x97, 0x03, 0xfb, 0x3c, 0x97, 0x4c, 0xe4, 0x34, 0x7b, 0x58, 0x8a, 0x42, + 0x16, 0xd1, 0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d8, 0xa9, 0x33, 0x19, 0xf5, 0xdb, 0xcb, 0x7a, 0x97, 0x0f, 0xb2, 0xcb, 0xae, 0xcd, 0xae, 0x0b, + 0xbf, 0x77, 0x2b, 0x53, 0x18, 0xdb, 0x0f, 0xd1, 0x22, 0xb3, 0x0f, 0x93, 0x2b, 0x4a, 0x8e, 0x60, + 0x70, 0x5a, 0xe4, 0x4b, 0xbe, 0x8a, 0x0e, 0xc1, 0x3f, 0xae, 0xe5, 0x5a, 0x79, 0x1c, 0x1f, 0x3d, + 0x70, 0x1a, 0xbf, 0x96, 0x6b, 0x6d, 0x43, 0x94, 0x45, 0xf2, 0x19, 0xc0, 0x56, 0x86, 0xaf, 0xcb, + 0xf6, 0x36, 0x5e, 0xb0, 0x1b, 0x2c, 0x99, 0xca, 0x8c, 0xf1, 0x3b, 0x34, 0xc9, 0xe7, 0x10, 0x9e, + 0xd4, 0x3c, 0x4b, 0xcf, 0xf3, 0x65, 0x81, 0xd4, 0x71, 0xc5, 0x44, 0xb5, 0xbd, 0x2f, 0x0b, 0x31, + 0xdd, 0xc8, 0x22, 0x6d, 0x0f, 0x19, 0x34, 0x1f, 0xa8, 0xbf, 0x39, 0x3e, 0xf9, 0x6f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x5f, 0x2f, 0x55, 0x31, 0xf8, 0x10, 0x00, 0x00, } diff --git a/bolt/internal/internal.proto b/bolt/internal/internal.proto index 8fb2b33b6c..27dec2513c 100644 --- a/bolt/internal/internal.proto +++ b/bolt/internal/internal.proto @@ -100,6 +100,7 @@ message TemplateValue { string type = 1; // Type can be tagKey, tagValue, fieldKey, csv, measurement, database, constant string value = 2; // Value is the specific value used to replace a template in an InfluxQL query bool selected = 3; // Selected states that this variable has been picked to use for replacement + string key = 4; // Key is the key for a specific Value if the Template Type is map (optional) } message TemplateQuery { diff --git a/chronograf.go b/chronograf.go index 6a63a02b5a..b26c3bea0d 100644 --- a/chronograf.go +++ b/chronograf.go @@ -158,9 +158,10 @@ type Range struct { // TemplateValue is a value use to replace a template in an InfluxQL query type TemplateValue struct { - Value string `json:"value"` // Value is the specific value used to replace a template in an InfluxQL query - Type string `json:"type"` // Type can be tagKey, tagValue, fieldKey, csv, measurement, database, constant - Selected bool `json:"selected"` // Selected states that this variable has been picked to use for replacement + Value string `json:"value"` // Value is the specific value used to replace a template in an InfluxQL query + Type string `json:"type"` // Type can be tagKey, tagValue, fieldKey, csv, measurement, database, constant, influxql + Selected bool `json:"selected"` // Selected states that this variable has been picked to use for replacement + Key string `json:"key,omitempty"` // Key is the key for the Value if the Template Type is 'map' } // TemplateVar is a named variable within an InfluxQL query to be replaced with Values @@ -176,7 +177,7 @@ type TemplateID string type Template struct { TemplateVar ID TemplateID `json:"id"` // ID is the unique ID associated with this template - Type string `json:"type"` // Type can be fieldKeys, tagKeys, tagValues, CSV, constant, query, measurements, databases + Type string `json:"type"` // Type can be fieldKeys, tagKeys, tagValues, CSV, constant, measurements, databases, map, influxql Label string `json:"label"` // Label is a user-facing description of the Template Query *TemplateQuery `json:"query,omitempty"` // Query is used to generate the choices for a template } diff --git a/influx/templates.go b/influx/templates.go index fe6a24a404..86168f7727 100644 --- a/influx/templates.go +++ b/influx/templates.go @@ -72,7 +72,7 @@ func RenderTemplate(query string, t chronograf.TemplateVar, now time.Time) (stri return strings.Replace(q, t.Var, `"`+t.Values[0].Value+`"`, -1), nil case "tagValue", "timeStamp": return strings.Replace(q, t.Var, `'`+t.Values[0].Value+`'`, -1), nil - case "csv", "constant": + case "csv", "constant", "influxql": return strings.Replace(q, t.Var, t.Values[0].Value, -1), nil } diff --git a/server/swagger.json b/server/swagger.json index 8c3f36db58..ea89a0b958 100644 --- a/server/swagger.json +++ b/server/swagger.json @@ -4090,6 +4090,10 @@ "enum": ["csv", "tagKey", "tagValue", "fieldKey", "timeStamp"], "description": "The type will change the format of the output value. tagKey/fieldKey are double quoted; tagValue are single quoted; csv and timeStamp are not quoted." + }, + "key": { + "type": "string", + "description":"This will be the key for a specific value of a template variable. Used if the templateVar type is 'map'" } } }, diff --git a/server/templates.go b/server/templates.go index 8b525f6ad2..6f158ac3c3 100644 --- a/server/templates.go +++ b/server/templates.go @@ -15,19 +15,23 @@ func ValidTemplateRequest(template *chronograf.Template) error { switch template.Type { default: return fmt.Errorf("Unknown template type %s", template.Type) - case "query", "constant", "csv", "fieldKeys", "tagKeys", "tagValues", "measurements", "databases": + case "constant", "csv", "fieldKeys", "tagKeys", "tagValues", "measurements", "databases", "map", "influxql": } for _, v := range template.Values { switch v.Type { default: return fmt.Errorf("Unknown template variable type %s", v.Type) - case "csv", "fieldKey", "tagKey", "tagValue", "measurement", "database", "constant": + case "csv", "fieldKey", "tagKey", "tagValue", "measurement", "database", "constant", "influxql": + } + + if template.Type == "map" && v.Key == "" { + return fmt.Errorf("Templates of type 'map' require a 'key'") } } - if template.Type == "query" && template.Query == nil { - return fmt.Errorf("No query set for template of type 'query'") + if template.Type == "influxql" && template.Query == nil { + return fmt.Errorf("No query set for template of type 'influxql'") } return nil diff --git a/server/templates_test.go b/server/templates_test.go index 8a9bec46f6..cd775acea9 100644 --- a/server/templates_test.go +++ b/server/templates_test.go @@ -57,7 +57,37 @@ func TestValidTemplateRequest(t *testing.T) { name: "No query set", wantErr: true, template: &chronograf.Template{ - Type: "query", + Type: "influxql", + }, + }, + { + name: "Valid Map type", + template: &chronograf.Template{ + Type: "map", + TemplateVar: chronograf.TemplateVar{ + Values: []chronograf.TemplateValue{ + { + Key: "key", + Value: "value", + Type: "constant", + }, + }, + }, + }, + }, + { + name: "Map without Key", + wantErr: true, + template: &chronograf.Template{ + Type: "map", + TemplateVar: chronograf.TemplateVar{ + Values: []chronograf.TemplateValue{ + { + Value: "value", + Type: "constant", + }, + }, + }, }, }, } diff --git a/ui/src/admin/containers/chronograf/AllUsersPage.tsx b/ui/src/admin/containers/chronograf/AllUsersPage.tsx index 8f42680e5e..c2d514132d 100644 --- a/ui/src/admin/containers/chronograf/AllUsersPage.tsx +++ b/ui/src/admin/containers/chronograf/AllUsersPage.tsx @@ -48,7 +48,7 @@ interface State { @ErrorHandling export class AllUsersPage extends PureComponent { - constructor(props) { + constructor(props: Props) { super(props) this.state = { diff --git a/ui/src/alerts/apis/index.ts b/ui/src/alerts/apis/index.ts index 4222e7fe78..4d8ae08330 100644 --- a/ui/src/alerts/apis/index.ts +++ b/ui/src/alerts/apis/index.ts @@ -1,5 +1,5 @@ import {proxy} from 'src/utils/queryUrlGenerator' -import {TimeRange} from '../../types' +import {TimeRange} from 'src/types' export const getAlerts = ( source: string, diff --git a/ui/src/dashboards/actions/index.ts b/ui/src/dashboards/actions/index.ts index 658574bd6e..62419f4ebb 100644 --- a/ui/src/dashboards/actions/index.ts +++ b/ui/src/dashboards/actions/index.ts @@ -5,7 +5,9 @@ import {replace} from 'react-router-redux' import _ from 'lodash' import queryString from 'query-string' +import {proxy} from 'src/utils/queryUrlGenerator' import {isUserAuthorized, EDITOR_ROLE} from 'src/auth/Authorized' +import {parseMetaQuery} from 'src/tempVars/utils/parsing' import { getDashboards as getDashboardsAJAX, @@ -15,7 +17,6 @@ import { updateDashboardCell as updateDashboardCellAJAX, addDashboardCell as addDashboardCellAJAX, deleteDashboardCell as deleteDashboardCellAJAX, - getTempVarValuesBySourceQuery, createDashboard as createDashboardAJAX, } from 'src/dashboards/apis' import {getMe} from 'src/shared/apis/auth' @@ -48,7 +49,6 @@ import { } from 'src/shared/copy/notifications' import {makeQueryForTemplate} from 'src/dashboards/utils/tempVars' -import parsers from 'src/shared/parsing' import {getDeep} from 'src/utils/wrappers' import idNormalizer, {TYPE_ID} from 'src/normalizers/id' @@ -418,7 +418,7 @@ export const getDashboardsNamesAsync = (sourceID: string) => async ( } } -export const getDashboardAsync = (dashboardID: string) => async ( +export const getDashboardAsync = (dashboardID: number) => async ( dispatch ): Promise => { try { @@ -628,25 +628,23 @@ export const hydrateTempVarValuesAsync = ( const dashboard = getState().dashboardUI.dashboards.find( d => d.id === dashboardID ) + const templates: Template[] = dashboard.templates + const queries = templates + .filter( + template => getDeep(template, 'query.influxql', '') !== '' + ) + .map(async template => { + const query = makeQueryForTemplate(template.query) + const response = await proxy({source: source.links.proxy, query}) + const values = parseMetaQuery(query, response.data) - const tempsWithQueries = dashboard.templates.filter( - ({query}) => !!query.influxql - ) - - const asyncQueries = tempsWithQueries.map(({query}) => - getTempVarValuesBySourceQuery(source, { - query: makeQueryForTemplate(query), + return {template, values} }) - ) + const results = await Promise.all(queries) - const results = await Promise.all(asyncQueries) - - results.forEach(({data}, i) => { - const {type, query, id} = tempsWithQueries[i] - const parsed = parsers[type](data, query.tagKey || query.measurement) - const vals = parsed[type] - dispatch(editTemplateVariableValues(+dashboard.id, id, vals)) - }) + for (const {template, values} of results) { + dispatch(editTemplateVariableValues(+dashboard.id, template.id, values)) + } } catch (error) { console.error(error) dispatch(errorThrown(error)) @@ -814,7 +812,7 @@ const syncDashboardFromURLQueryParams = ( } export const getDashboardWithHydratedAndSyncedTempVarsAsync = ( - dashboardID: string, + dashboardID: number, source: Source, router: InjectedRouter, location: Location diff --git a/ui/src/dashboards/apis/index.js b/ui/src/dashboards/apis/index.js index 5719a0b05c..ff04e841a1 100644 --- a/ui/src/dashboards/apis/index.js +++ b/ui/src/dashboards/apis/index.js @@ -1,5 +1,4 @@ import AJAX from 'utils/ajax' -import {proxy} from 'utils/queryUrlGenerator' export function getDashboards() { return AJAX({ @@ -98,19 +97,3 @@ export const editTemplateVariables = async templateVariable => { throw error } } - -export const getTempVarValuesBySourceQuery = async (source, templateQuery) => { - const { - query, - db, - // rp, TODO - tempVars, - } = templateQuery - try { - // TODO: add rp as argument to proxy - return await proxy({source: source.links.proxy, query, db, tempVars}) - } catch (error) { - console.error(error) - throw error - } -} diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js index 5f7e2027b2..915927f908 100644 --- a/ui/src/dashboards/containers/DashboardPage.js +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -495,7 +495,7 @@ DashboardPage.propTypes = { sources: arrayOf(shape({})).isRequired, params: shape({ sourceID: string.isRequired, - dashboardID: string.isRequired, + dashboardID: number.isRequired, }).isRequired, location: shape({ pathname: string.isRequired, diff --git a/ui/src/kapacitor/components/AlertTabs.tsx b/ui/src/kapacitor/components/AlertTabs.tsx index 4cda960e8c..8772c549db 100644 --- a/ui/src/kapacitor/components/AlertTabs.tsx +++ b/ui/src/kapacitor/components/AlertTabs.tsx @@ -134,7 +134,7 @@ class AlertTabs extends PureComponent { this.setState({services}) } catch (error) { this.setState({services: null}) - this.props.notify(notifyCouldNotRetrieveKapacitorServices(kapacitor)) + this.props.notify(notifyCouldNotRetrieveKapacitorServices(kapacitor.name)) } } diff --git a/ui/src/kapacitor/components/CodeData.js b/ui/src/kapacitor/components/CodeData.js deleted file mode 100644 index 081c75aff7..0000000000 --- a/ui/src/kapacitor/components/CodeData.js +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' - -const CodeData = ({onClickTemplate, template}) => ( - - {template.label} - -) - -const {func, shape, string} = PropTypes - -CodeData.propTypes = { - onClickTemplate: func, - template: shape({ - label: string, - text: string, - }), -} - -export default CodeData diff --git a/ui/src/kapacitor/components/CodeData.tsx b/ui/src/kapacitor/components/CodeData.tsx new file mode 100644 index 0000000000..3010196257 --- /dev/null +++ b/ui/src/kapacitor/components/CodeData.tsx @@ -0,0 +1,20 @@ +import React, {SFC} from 'react' + +import {RuleMessage} from 'src/types/kapacitor' + +interface Props { + onClickTemplate: () => void + template: RuleMessage +} + +const CodeData: SFC = ({onClickTemplate, template}) => ( + + {template.label} + +) + +export default CodeData diff --git a/ui/src/kapacitor/components/DataSection.tsx b/ui/src/kapacitor/components/DataSection.tsx index bda68cb211..2211341fd6 100644 --- a/ui/src/kapacitor/components/DataSection.tsx +++ b/ui/src/kapacitor/components/DataSection.tsx @@ -24,7 +24,7 @@ interface Props { query: QueryConfig isDeadman: boolean isKapacitorRule: boolean - onAddEvery: () => void + onAddEvery: (every?: string) => void timeRange: TimeRange } diff --git a/ui/src/kapacitor/components/Deadman.js b/ui/src/kapacitor/components/Deadman.tsx similarity index 58% rename from ui/src/kapacitor/components/Deadman.js rename to ui/src/kapacitor/components/Deadman.tsx index b5419caf21..d5f56eaef2 100644 --- a/ui/src/kapacitor/components/Deadman.js +++ b/ui/src/kapacitor/components/Deadman.tsx @@ -1,13 +1,24 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' + import {PERIODS} from 'src/kapacitor/constants' -import Dropdown from 'shared/components/Dropdown' +import Dropdown from 'src/shared/components/Dropdown' + +import {AlertRule} from 'src/types' const periods = PERIODS.map(text => { return {text} }) -const Deadman = ({rule, onChange}) => ( +interface Item { + text: string +} + +interface Props { + rule: AlertRule + onChange: (item: Item) => void +} + +const Deadman: SFC = ({rule, onChange}) => (

Send Alert if Data is missing for

(
) -const {shape, string, func} = PropTypes - -Deadman.propTypes = { - rule: shape({ - values: shape({ - period: string, - }), - }), - onChange: func.isRequired, -} - export default Deadman diff --git a/ui/src/kapacitor/components/KapacitorRule.js b/ui/src/kapacitor/components/KapacitorRule.tsx similarity index 74% rename from ui/src/kapacitor/components/KapacitorRule.js rename to ui/src/kapacitor/components/KapacitorRule.tsx index d640427398..299d6374ef 100644 --- a/ui/src/kapacitor/components/KapacitorRule.js +++ b/ui/src/kapacitor/components/KapacitorRule.tsx @@ -1,7 +1,7 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' +import React, {Component, ChangeEvent} from 'react' import {connect} from 'react-redux' import {bindActionCreators} from 'redux' +import {InjectedRouter} from 'react-router' import PageHeader from 'src/shared/components/PageHeader' import NameSection from 'src/kapacitor/components/NameSection' @@ -9,13 +9,13 @@ import ValuesSection from 'src/kapacitor/components/ValuesSection' import RuleHeaderSave from 'src/kapacitor/components/RuleHeaderSave' import RuleHandlers from 'src/kapacitor/components/RuleHandlers' import RuleMessage from 'src/kapacitor/components/RuleMessage' -import FancyScrollbar from 'shared/components/FancyScrollbar' +import FancyScrollbar from 'src/shared/components/FancyScrollbar' import {createRule, editRule} from 'src/kapacitor/apis' -import buildInfluxQLQuery from 'utils/influxql' -import {timeRanges} from 'shared/data/timeRanges' +import buildInfluxQLQuery from 'src/utils/influxql' +import {timeRanges} from 'src/shared/data/timeRanges' import {DEFAULT_RULE_ID} from 'src/kapacitor/constants' -import {notify as notifyAction} from 'shared/actions/notifications' +import {notify as notifyAction} from 'src/shared/actions/notifications' import { notifyAlertRuleCreated, @@ -25,11 +25,52 @@ import { notifyAlertRuleRequiresQuery, notifyAlertRuleRequiresConditionValue, notifyAlertRuleDeadmanInvalid, -} from 'shared/copy/notifications' +} from 'src/shared/copy/notifications' import {ErrorHandling} from 'src/shared/decorators/errors' +import { + Source, + AlertRule, + Notification, + Kapacitor, + QueryConfig, + TimeRange, +} from 'src/types' +import {Handler} from 'src/types/kapacitor' +import { + KapacitorQueryConfigActions, + KapacitorRuleActions, +} from 'src/types/actions' + +interface Props { + source: Source + rule: AlertRule + query: QueryConfig + queryConfigs: QueryConfig[] + queryConfigActions: KapacitorQueryConfigActions + ruleActions: KapacitorRuleActions + notify: (message: Notification) => void + ruleID: string + handlersFromConfig: Handler[] + router: InjectedRouter + kapacitor: Kapacitor + configLink: string +} + +interface Item { + text: string +} + +interface TypeItem extends Item { + type: string +} + +interface State { + timeRange: TimeRange +} + @ErrorHandling -class KapacitorRule extends Component { +class KapacitorRule extends Component { constructor(props) { super(props) this.state = { @@ -37,146 +78,7 @@ class KapacitorRule extends Component { } } - handleChooseTimeRange = ({lower}) => { - const timeRange = timeRanges.find(range => range.lower === lower) - this.setState({timeRange}) - } - - handleCreate = pathname => { - const {notify, queryConfigs, rule, source, router, kapacitor} = this.props - - const newRule = Object.assign({}, rule, { - query: queryConfigs[rule.queryID], - }) - delete newRule.queryID - - createRule(kapacitor, newRule) - .then(() => { - router.push(pathname || `/sources/${source.id}/alert-rules`) - notify(notifyAlertRuleCreated(newRule.name)) - }) - .catch(e => { - notify(notifyAlertRuleCreateFailed(newRule.name, e.data.message)) - }) - } - - handleEdit = pathname => { - const {notify, queryConfigs, rule, router, source} = this.props - const updatedRule = Object.assign({}, rule, { - query: queryConfigs[rule.queryID], - }) - - editRule(updatedRule) - .then(() => { - router.push(pathname || `/sources/${source.id}/alert-rules`) - notify(notifyAlertRuleUpdated(rule.name)) - }) - .catch(e => { - notify(notifyAlertRuleUpdateFailed(rule.name, e.data.message)) - }) - } - - handleSave = () => { - const {rule} = this.props - if (rule.id === DEFAULT_RULE_ID) { - this.handleCreate() - } else { - this.handleEdit() - } - } - - handleSaveToConfig = configName => () => { - const {rule, configLink, router} = this.props - const pathname = `${configLink}#${configName}` - if (this.validationError()) { - router.push({ - pathname, - }) - return - } - if (rule.id === DEFAULT_RULE_ID) { - this.handleCreate(pathname) - } else { - this.handleEdit(pathname) - } - } - - handleAddEvery = frequency => { - const { - rule: {id: ruleID}, - ruleActions: {addEvery}, - } = this.props - addEvery(ruleID, frequency) - } - - handleRemoveEvery = () => { - const { - rule: {id: ruleID}, - ruleActions: {removeEvery}, - } = this.props - removeEvery(ruleID) - } - - validationError = () => { - const {rule, query} = this.props - if (rule.trigger === 'deadman') { - return this.deadmanValidation() - } - - if (!buildInfluxQLQuery({}, query)) { - return notifyAlertRuleRequiresQuery() - } - - if (!rule.values.value) { - return notifyAlertRuleRequiresConditionValue() - } - - return '' - } - - deadmanValidation = () => { - const {query} = this.props - if (query && (!query.database || !query.measurement)) { - return notifyAlertRuleDeadmanInvalid() - } - - return '' - } - - handleRuleTypeDropdownChange = ({type, text}) => { - const {ruleActions, rule} = this.props - ruleActions.updateRuleValues(rule.id, rule.trigger, { - ...this.props.rule.values, - [type]: text, - }) - } - - handleRuleTypeInputChange = e => { - const {ruleActions, rule} = this.props - const {lower, upper} = e.target.form - - ruleActions.updateRuleValues(rule.id, rule.trigger, { - ...this.props.rule.values, - value: lower.value, - rangeValue: upper ? upper.value : '', - }) - } - - handleDeadmanChange = ({text}) => { - const {ruleActions, rule} = this.props - ruleActions.updateRuleValues(rule.id, rule.trigger, {period: text}) - } - - optionsComponents = () => { - return ( - - ) - } - - render() { + public render() { const { rule, source, @@ -191,7 +93,7 @@ class KapacitorRule extends Component { return (
@@ -225,7 +127,7 @@ class KapacitorRule extends Component { ruleActions={ruleActions} handlersFromConfig={handlersFromConfig} onGoToConfig={this.handleSaveToConfig} - validationError={this.validationError()} + validationError={this.validationError} />
@@ -236,27 +138,147 @@ class KapacitorRule extends Component { ) } -} -const {arrayOf, func, shape, string} = PropTypes + private handleChooseTimeRange = ({lower}: TimeRange) => { + const timeRange = timeRanges.find(range => range.lower === lower) + this.setState({timeRange}) + } -KapacitorRule.propTypes = { - source: shape({}).isRequired, - rule: shape({ - values: shape({}), - }).isRequired, - query: shape({}).isRequired, - queryConfigs: shape({}).isRequired, - queryConfigActions: shape({}).isRequired, - ruleActions: shape({}).isRequired, - notify: func.isRequired, - ruleID: string.isRequired, - handlersFromConfig: arrayOf(shape({})).isRequired, - router: shape({ - push: func.isRequired, - }).isRequired, - kapacitor: shape({}).isRequired, - configLink: string.isRequired, + private handleCreate = (pathname?: string) => { + const {notify, queryConfigs, rule, source, router, kapacitor} = this.props + + const newRule = Object.assign({}, rule, { + query: queryConfigs[rule.queryID], + }) + delete newRule.queryID + + createRule(kapacitor, newRule) + .then(() => { + router.push(pathname || `/sources/${source.id}/alert-rules`) + notify(notifyAlertRuleCreated(newRule.name)) + }) + .catch(e => { + notify(notifyAlertRuleCreateFailed(newRule.name, e.data.message)) + }) + } + + private handleEdit = (pathname?: string) => { + const {notify, queryConfigs, rule, router, source} = this.props + const updatedRule = Object.assign({}, rule, { + query: queryConfigs[rule.queryID], + }) + + editRule(updatedRule) + .then(() => { + router.push(pathname || `/sources/${source.id}/alert-rules`) + notify(notifyAlertRuleUpdated(rule.name)) + }) + .catch(e => { + notify(notifyAlertRuleUpdateFailed(rule.name, e.data.message)) + }) + } + + private handleSave = () => { + const {rule} = this.props + if (rule.id === DEFAULT_RULE_ID) { + this.handleCreate() + } else { + this.handleEdit() + } + } + + private handleSaveToConfig = (configName: string) => () => { + const {rule, configLink, router} = this.props + const pathname = `${configLink}#${configName}` + + if (this.validationError) { + router.push({ + pathname, + }) + return + } + + if (rule.id === DEFAULT_RULE_ID) { + this.handleCreate(pathname) + } else { + this.handleEdit(pathname) + } + } + + private handleAddEvery = (frequency: string) => { + const { + rule: {id: ruleID}, + ruleActions: {addEvery}, + } = this.props + addEvery(ruleID, frequency) + } + + private handleRemoveEvery = () => { + const { + rule: {id: ruleID}, + ruleActions: {removeEvery}, + } = this.props + removeEvery(ruleID) + } + + private get validationError(): string { + const {rule, query} = this.props + if (rule.trigger === 'deadman') { + return this.deadmanValidation() + } + + if (!buildInfluxQLQuery({lower: ''}, query)) { + return notifyAlertRuleRequiresQuery() + } + + if (!rule.values.value) { + return notifyAlertRuleRequiresConditionValue() + } + + return '' + } + + private deadmanValidation = () => { + const {query} = this.props + if (query && (!query.database || !query.measurement)) { + return notifyAlertRuleDeadmanInvalid() + } + + return '' + } + + private handleRuleTypeDropdownChange = ({type, text}: TypeItem) => { + const {ruleActions, rule} = this.props + ruleActions.updateRuleValues(rule.id, rule.trigger, { + ...this.props.rule.values, + [type]: text, + }) + } + + private handleRuleTypeInputChange = (e: ChangeEvent) => { + const {ruleActions, rule} = this.props + const {lower, upper} = e.target.form + + ruleActions.updateRuleValues(rule.id, rule.trigger, { + ...this.props.rule.values, + value: lower.value, + rangeValue: upper ? upper.value : '', + }) + } + + private handleDeadmanChange = ({text}: Item) => { + const {ruleActions, rule} = this.props + ruleActions.updateRuleValues(rule.id, rule.trigger, {period: text}) + } + + private get optionsComponents(): JSX.Element { + return ( + + ) + } } const mapDispatchToProps = dispatch => ({ diff --git a/ui/src/kapacitor/components/LogItemHTTP.js b/ui/src/kapacitor/components/LogItemHTTP.tsx similarity index 58% rename from ui/src/kapacitor/components/LogItemHTTP.js rename to ui/src/kapacitor/components/LogItemHTTP.tsx index 89607e1518..b0e64c206f 100644 --- a/ui/src/kapacitor/components/LogItemHTTP.js +++ b/ui/src/kapacitor/components/LogItemHTTP.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemHTTP = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemHTTP: SFC = ({logItem}) => (
@@ -16,17 +21,4 @@ const LogItemHTTP = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemHTTP.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - method: string.isRequired, - username: string.isRequired, - host: string.isRequired, - duration: string.isRequired, - }), -} - export default LogItemHTTP diff --git a/ui/src/kapacitor/components/LogItemHTTPError.js b/ui/src/kapacitor/components/LogItemHTTPError.tsx similarity index 63% rename from ui/src/kapacitor/components/LogItemHTTPError.js rename to ui/src/kapacitor/components/LogItemHTTPError.tsx index ecaba7233c..4803e8d020 100644 --- a/ui/src/kapacitor/components/LogItemHTTPError.js +++ b/ui/src/kapacitor/components/LogItemHTTPError.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemHTTPError = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemHTTPError: SFC = ({logItem}) => (
@@ -16,15 +21,4 @@ const LogItemHTTPError = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemHTTPError.propTypes = { - logItem: shape({ - key: string.isRequired, - lvl: string.isRequired, - ts: string.isRequired, - msg: string.isRequired, - }), -} - export default LogItemHTTPError diff --git a/ui/src/kapacitor/components/LogItemInfluxDBDebug.js b/ui/src/kapacitor/components/LogItemInfluxDBDebug.tsx similarity index 65% rename from ui/src/kapacitor/components/LogItemInfluxDBDebug.js rename to ui/src/kapacitor/components/LogItemInfluxDBDebug.tsx index 0a2a833ed4..3ba2e37a01 100644 --- a/ui/src/kapacitor/components/LogItemInfluxDBDebug.js +++ b/ui/src/kapacitor/components/LogItemInfluxDBDebug.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemInfluxDBDebug = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemInfluxDBDebug: SFC = ({logItem}) => (
@@ -20,15 +25,4 @@ const LogItemInfluxDBDebug = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemInfluxDBDebug.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - msg: string.isRequired, - cluster: string.isRequired, - }), -} - export default LogItemInfluxDBDebug diff --git a/ui/src/kapacitor/components/LogItemKapacitorDebug.js b/ui/src/kapacitor/components/LogItemKapacitorDebug.tsx similarity index 64% rename from ui/src/kapacitor/components/LogItemKapacitorDebug.js rename to ui/src/kapacitor/components/LogItemKapacitorDebug.tsx index 5d550d4efd..9694cb71ae 100644 --- a/ui/src/kapacitor/components/LogItemKapacitorDebug.js +++ b/ui/src/kapacitor/components/LogItemKapacitorDebug.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemKapacitorDebug = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemKapacitorDebug: SFC = ({logItem}) => (
@@ -16,14 +21,4 @@ const LogItemKapacitorDebug = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemKapacitorDebug.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - msg: string.isRequired, - }), -} - export default LogItemKapacitorDebug diff --git a/ui/src/kapacitor/components/LogItemKapacitorError.js b/ui/src/kapacitor/components/LogItemKapacitorError.tsx similarity index 64% rename from ui/src/kapacitor/components/LogItemKapacitorError.js rename to ui/src/kapacitor/components/LogItemKapacitorError.tsx index d07c5b7452..cb37daa0f4 100644 --- a/ui/src/kapacitor/components/LogItemKapacitorError.js +++ b/ui/src/kapacitor/components/LogItemKapacitorError.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemKapacitorError = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemKapacitorError: SFC = ({logItem}) => (
@@ -16,14 +21,4 @@ const LogItemKapacitorError = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemKapacitorError.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - msg: string.isRequired, - }), -} - export default LogItemKapacitorError diff --git a/ui/src/kapacitor/components/LogItemKapacitorPoint.js b/ui/src/kapacitor/components/LogItemKapacitorPoint.js deleted file mode 100644 index 205d0eb572..0000000000 --- a/ui/src/kapacitor/components/LogItemKapacitorPoint.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' - -const renderKeysAndValues = (object, name) => { - if (!object) { - return -- - } - - const sortedObjKeys = Object.keys(object).sort() - - return ( -
-

{`${sortedObjKeys.length} ${name}`}

-
- {sortedObjKeys.map(objKey => ( -
- {objKey}: {object[objKey]} -
- ))} -
-
- ) -} -const LogItemKapacitorPoint = ({logItem}) => ( -
-
-
-
{logItem.ts}
-
-
-
Kapacitor Point
-
- {renderKeysAndValues(logItem.tag, 'Tags')} - {renderKeysAndValues(logItem.field, 'Fields')} -
-
-
-) - -const {shape, string} = PropTypes - -LogItemKapacitorPoint.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - tag: shape.isRequired, - field: shape.isRequired, - }), -} - -export default LogItemKapacitorPoint diff --git a/ui/src/kapacitor/components/LogItemKapacitorPoint.tsx b/ui/src/kapacitor/components/LogItemKapacitorPoint.tsx new file mode 100644 index 0000000000..4e0c054e9b --- /dev/null +++ b/ui/src/kapacitor/components/LogItemKapacitorPoint.tsx @@ -0,0 +1,55 @@ +import React, {PureComponent} from 'react' +import _ from 'lodash' + +import {ErrorHandling} from 'src/shared/decorators/errors' + +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +@ErrorHandling +class LogItemKapacitorPoint extends PureComponent { + public render() { + const {logItem} = this.props + return ( +
+
+
+
{logItem.ts}
+
+
+
Kapacitor Point
+
+ {this.renderKeysAndValues(logItem.tag, 'Tags')} + {this.renderKeysAndValues(logItem.field, 'Fields')} +
+
+
+ ) + } + + private renderKeysAndValues = (object: any, name: string) => { + if (_.isEmpty(object)) { + return -- + } + + const sortedObjKeys = Object.keys(object).sort() + + return ( +
+

{`${sortedObjKeys.length} ${name}`}

+
+ {sortedObjKeys.map(objKey => ( +
+ {objKey}: {object[objKey]} +
+ ))} +
+
+ ) + } +} + +export default LogItemKapacitorPoint diff --git a/ui/src/kapacitor/components/LogItemSession.js b/ui/src/kapacitor/components/LogItemSession.tsx similarity index 58% rename from ui/src/kapacitor/components/LogItemSession.js rename to ui/src/kapacitor/components/LogItemSession.tsx index b3f45e9fb5..cd62042734 100644 --- a/ui/src/kapacitor/components/LogItemSession.js +++ b/ui/src/kapacitor/components/LogItemSession.tsx @@ -1,7 +1,12 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' -const LogItemSession = ({logItem}) => ( +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogItemSession: SFC = ({logItem}) => (
@@ -13,14 +18,4 @@ const LogItemSession = ({logItem}) => (
) -const {shape, string} = PropTypes - -LogItemSession.propTypes = { - logItem: shape({ - lvl: string.isRequired, - ts: string.isRequired, - msg: string.isRequired, - }), -} - export default LogItemSession diff --git a/ui/src/kapacitor/components/LogsTable.js b/ui/src/kapacitor/components/LogsTable.tsx similarity index 63% rename from ui/src/kapacitor/components/LogsTable.js rename to ui/src/kapacitor/components/LogsTable.tsx index 96a1a75c59..083f432ec6 100644 --- a/ui/src/kapacitor/components/LogsTable.js +++ b/ui/src/kapacitor/components/LogsTable.tsx @@ -1,12 +1,17 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' import LogsTableRow from 'src/kapacitor/components/LogsTableRow' import FancyScrollbar from 'src/shared/components/FancyScrollbar' +import {LogItem} from 'src/types/kapacitor' + const numLogsToRender = 200 -const LogsTable = ({logs}) => ( +interface Props { + logs: LogItem[] +} + +const LogsTable: SFC = ({logs}) => (
{`${numLogsToRender} Most Recent Logs`} @@ -22,17 +27,4 @@ const LogsTable = ({logs}) => (
) -const {arrayOf, shape, string} = PropTypes - -LogsTable.propTypes = { - logs: arrayOf( - shape({ - key: string.isRequired, - ts: string.isRequired, - lvl: string.isRequired, - msg: string.isRequired, - }) - ).isRequired, -} - export default LogsTable diff --git a/ui/src/kapacitor/components/LogsTableRow.js b/ui/src/kapacitor/components/LogsTableRow.tsx similarity index 87% rename from ui/src/kapacitor/components/LogsTableRow.js rename to ui/src/kapacitor/components/LogsTableRow.tsx index 74dec4b69d..0a1dacaff9 100644 --- a/ui/src/kapacitor/components/LogsTableRow.js +++ b/ui/src/kapacitor/components/LogsTableRow.tsx @@ -1,5 +1,4 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC} from 'react' import LogItemSession from 'src/kapacitor/components/LogItemSession' import LogItemHTTP from 'src/kapacitor/components/LogItemHTTP' @@ -9,7 +8,13 @@ import LogItemKapacitorError from 'src/kapacitor/components/LogItemKapacitorErro import LogItemKapacitorDebug from 'src/kapacitor/components/LogItemKapacitorDebug' import LogItemInfluxDBDebug from 'src/kapacitor/components/LogItemInfluxDBDebug' -const LogsTableRow = ({logItem}) => { +import {LogItem} from 'src/types/kapacitor' + +interface Props { + logItem: LogItem +} + +const LogsTableRow: SFC = ({logItem}) => { if (logItem.service === 'sessions') { return } @@ -51,15 +56,4 @@ const LogsTableRow = ({logItem}) => { ) } -const {shape, string} = PropTypes - -LogsTableRow.propTypes = { - logItem: shape({ - key: string.isRequired, - ts: string.isRequired, - lvl: string.isRequired, - msg: string.isRequired, - }).isRequired, -} - export default LogsTableRow diff --git a/ui/src/kapacitor/components/NameSection.js b/ui/src/kapacitor/components/NameSection.tsx similarity index 54% rename from ui/src/kapacitor/components/NameSection.js rename to ui/src/kapacitor/components/NameSection.tsx index c4491e9a6e..c468515c93 100644 --- a/ui/src/kapacitor/components/NameSection.js +++ b/ui/src/kapacitor/components/NameSection.tsx @@ -1,11 +1,25 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' +import React, {Component, ChangeEvent, KeyboardEvent} from 'react' + import {DEFAULT_RULE_ID} from 'src/kapacitor/constants' import {ErrorHandling} from 'src/shared/decorators/errors' +import {AlertRule} from 'src/types' + +interface Props { + defaultName: string + onRuleRename: (id: string, name: string) => void + rule: AlertRule +} + +interface State { + reset: boolean +} + @ErrorHandling -class NameSection extends Component { - constructor(props) { +class NameSection extends Component { + private inputRef: HTMLInputElement + + constructor(props: Props) { super(props) this.state = { @@ -13,14 +27,22 @@ class NameSection extends Component { } } - handleInputBlur = reset => e => { + public handleInputBlur = (reset: boolean) => ( + e: ChangeEvent + ): void => { const {defaultName, onRuleRename, rule} = this.props - onRuleRename(rule.id, reset ? defaultName : e.target.value) + let ruleName: string + if (reset) { + ruleName = defaultName + } else { + ruleName = e.target.value + } + onRuleRename(rule.id, ruleName) this.setState({reset: false}) } - handleKeyDown = e => { + public handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Enter') { this.inputRef.blur() } @@ -30,15 +52,13 @@ class NameSection extends Component { } } - render() { - const {rule, defaultName} = this.props + public render() { + const {defaultName} = this.props const {reset} = this.state return (
-

- {rule.id === DEFAULT_RULE_ID ? 'Name this Alert Rule' : 'Name'} -

+

{this.header}

) } -} -const {func, string, shape} = PropTypes + private get header() { + const { + rule: {id}, + } = this.props -NameSection.propTypes = { - defaultName: string.isRequired, - onRuleRename: func.isRequired, - rule: shape({}).isRequired, + if (id === DEFAULT_RULE_ID) { + return 'Name this Alert Rule' + } + + return 'Name' + } } export default NameSection diff --git a/ui/src/kapacitor/components/Relative.js b/ui/src/kapacitor/components/Relative.tsx similarity index 73% rename from ui/src/kapacitor/components/Relative.js rename to ui/src/kapacitor/components/Relative.tsx index 6b483f01ee..c6cb23cbf1 100644 --- a/ui/src/kapacitor/components/Relative.js +++ b/ui/src/kapacitor/components/Relative.tsx @@ -1,14 +1,27 @@ -import React from 'react' -import PropTypes from 'prop-types' -import {CHANGES, RELATIVE_OPERATORS, SHIFTS} from 'src/kapacitor/constants' -import Dropdown from 'shared/components/Dropdown' +import React, {SFC, ChangeEvent} from 'react' -const mapToItems = (arr, type) => arr.map(text => ({text, type})) +import {CHANGES, RELATIVE_OPERATORS, SHIFTS} from 'src/kapacitor/constants' +import Dropdown from 'src/shared/components/Dropdown' + +import {AlertRule} from 'src/types' + +const mapToItems = (arr: string[], type: string) => + arr.map(text => ({text, type})) const changes = mapToItems(CHANGES, 'change') const shifts = mapToItems(SHIFTS, 'shift') const operators = mapToItems(RELATIVE_OPERATORS, 'operator') -const Relative = ({ +interface TypeItem { + type: string + text: string +} +interface Props { + onRuleTypeInputChange: (e: ChangeEvent) => void + onDropdownChange: (item: TypeItem) => void + rule: AlertRule +} + +const Relative: SFC = ({ onRuleTypeInputChange, onDropdownChange, rule: { @@ -46,7 +59,7 @@ const Relative = ({ style={{width: '160px', marginLeft: '6px'}} type="text" name="lower" - spellCheck="false" + spellCheck={false} value={value} onChange={onRuleTypeInputChange} required={true} @@ -56,19 +69,4 @@ const Relative = ({
) -const {shape, string, func} = PropTypes - -Relative.propTypes = { - onRuleTypeInputChange: func.isRequired, - onDropdownChange: func.isRequired, - rule: shape({ - values: shape({ - change: string, - shift: string, - operator: string, - value: string, - }), - }), -} - export default Relative diff --git a/ui/src/kapacitor/components/RuleHandlers.tsx b/ui/src/kapacitor/components/RuleHandlers.tsx index 2f73960453..fba7a456ca 100644 --- a/ui/src/kapacitor/components/RuleHandlers.tsx +++ b/ui/src/kapacitor/components/RuleHandlers.tsx @@ -26,7 +26,7 @@ interface Props { rule: AlertRule ruleActions: RuleActions handlersFromConfig: Handler[] - onGoToConfig: () => void + onGoToConfig: (configName: string) => void validationError: string } diff --git a/ui/src/kapacitor/components/RuleMessage.js b/ui/src/kapacitor/components/RuleMessage.tsx similarity index 71% rename from ui/src/kapacitor/components/RuleMessage.js rename to ui/src/kapacitor/components/RuleMessage.tsx index 1d871f00da..230e987a57 100644 --- a/ui/src/kapacitor/components/RuleMessage.js +++ b/ui/src/kapacitor/components/RuleMessage.tsx @@ -1,22 +1,24 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' +import React, {Component, ChangeEvent} from 'react' import RuleMessageText from 'src/kapacitor/components/RuleMessageText' import RuleMessageTemplates from 'src/kapacitor/components/RuleMessageTemplates' import {ErrorHandling} from 'src/shared/decorators/errors' +import {AlertRule} from 'src/types' +import {KapacitorRuleActions} from 'src/types/actions' + +interface Props { + rule: AlertRule + ruleActions: KapacitorRuleActions +} + @ErrorHandling -class RuleMessage extends Component { +class RuleMessage extends Component { constructor(props) { super(props) } - handleChangeMessage = e => { - const {ruleActions, rule} = this.props - ruleActions.updateMessage(rule.id, e.target.value) - } - - render() { + public render() { const {rule, ruleActions} = this.props return ( @@ -35,15 +37,11 @@ class RuleMessage extends Component {
) } -} -const {func, shape} = PropTypes - -RuleMessage.propTypes = { - rule: shape().isRequired, - ruleActions: shape({ - updateMessage: func.isRequired, - }).isRequired, + private handleChangeMessage = (e: ChangeEvent) => { + const {ruleActions, rule} = this.props + ruleActions.updateMessage(rule.id, e.target.value) + } } export default RuleMessage diff --git a/ui/src/kapacitor/components/RuleMessageTemplates.js b/ui/src/kapacitor/components/RuleMessageTemplates.tsx similarity index 77% rename from ui/src/kapacitor/components/RuleMessageTemplates.js rename to ui/src/kapacitor/components/RuleMessageTemplates.tsx index 5f6c1a663d..840ae73d83 100644 --- a/ui/src/kapacitor/components/RuleMessageTemplates.js +++ b/ui/src/kapacitor/components/RuleMessageTemplates.tsx @@ -1,5 +1,5 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' + import _ from 'lodash' import ReactTooltip from 'react-tooltip' @@ -8,19 +8,22 @@ import CodeData from 'src/kapacitor/components/CodeData' import {RULE_MESSAGE_TEMPLATES} from 'src/kapacitor/constants' import {ErrorHandling} from 'src/shared/decorators/errors' +import {RuleMessage} from 'src/types/kapacitor' +import {AlertRule} from 'src/types' + +interface Props { + rule: AlertRule + updateMessage: (id: string, message: string) => void +} + // needs to be React Component for CodeData click handler to work @ErrorHandling -class RuleMessageTemplates extends Component { +class RuleMessageTemplates extends Component { constructor(props) { super(props) } - handleClickTemplate = template => () => { - const {updateMessage, rule} = this.props - updateMessage(rule.id, `${rule.message} ${template.label}`) - } - - render() { + public render() { return (

Templates:

@@ -41,13 +44,11 @@ class RuleMessageTemplates extends Component {
) } -} -const {func, shape} = PropTypes - -RuleMessageTemplates.propTypes = { - rule: shape().isRequired, - updateMessage: func.isRequired, + private handleClickTemplate = (template: RuleMessage) => () => { + const {updateMessage, rule} = this.props + updateMessage(rule.id, `${rule.message} ${template.label}`) + } } export default RuleMessageTemplates diff --git a/ui/src/kapacitor/components/RuleMessageText.js b/ui/src/kapacitor/components/RuleMessageText.tsx similarity index 59% rename from ui/src/kapacitor/components/RuleMessageText.js rename to ui/src/kapacitor/components/RuleMessageText.tsx index cc3dfb9b04..f7e0a787f2 100644 --- a/ui/src/kapacitor/components/RuleMessageText.js +++ b/ui/src/kapacitor/components/RuleMessageText.tsx @@ -1,7 +1,13 @@ -import React from 'react' -import PropTypes from 'prop-types' +import React, {SFC, ChangeEvent} from 'react' -const RuleMessageText = ({rule, updateMessage}) => ( +import {AlertRule} from 'src/types' + +interface Props { + rule: AlertRule + updateMessage: (e: ChangeEvent) => void +} + +const RuleMessageText: SFC = ({rule, updateMessage}) => (