From 7ee27f0fcb72f454fd8b3c16cca0a3fd766e0a0c Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 9 Sep 2019 09:45:42 -0700 Subject: [PATCH 1/8] refactor(ui): add default values for deadman condition --- ui/src/alerting/constants/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/src/alerting/constants/index.ts b/ui/src/alerting/constants/index.ts index fd466c0b0cf..448cddf7516 100644 --- a/ui/src/alerting/constants/index.ts +++ b/ui/src/alerting/constants/index.ts @@ -72,6 +72,8 @@ export const DEFAULT_DEADMAN_CHECK: Partial = { reportZero: DEFAULT_CHECK_REPORT_ZERO, level: DEFAULT_DEADMAN_LEVEL, statusMessageTemplate: DEFAULT_STATUS_MESSAGE, + timeSince: '90s', + staleTime: '10m', } export const CHECK_QUERY_FIXTURE: DashboardQuery = { From 56b5f07a8fa8b2118a40b4234e1f298ca6601723 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 9 Sep 2019 09:46:00 -0700 Subject: [PATCH 2/8] refactor(ui): limit values to 2 decimal places when dragging thereshold handles --- ui/src/shared/components/ThresholdMarkers.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ui/src/shared/components/ThresholdMarkers.tsx b/ui/src/shared/components/ThresholdMarkers.tsx index d79d119ee92..61dc021f1c3 100644 --- a/ui/src/shared/components/ThresholdMarkers.tsx +++ b/ui/src/shared/components/ThresholdMarkers.tsx @@ -1,6 +1,7 @@ // Libraries import React, {useRef, FunctionComponent} from 'react' import {Scale} from '@influxdata/giraffe' +import {round} from 'lodash' // Components import RangeThresholdMarkers from 'src/shared/components/RangeThresholdMarkers' @@ -13,6 +14,9 @@ import {clamp} from 'src/shared/utils/vis' // Types import {Threshold} from 'src/types' +// Constants +const DRAGGABLE_THRESHOLD_PRECISION = 2 + interface Props { thresholds: Threshold[] onSetThresholds: (newThresholds: Threshold[]) => void @@ -52,7 +56,21 @@ const ThresholdMarkers: FunctionComponent = ({ i === index ? nextThreshold : t ) - onSetThresholds(nextThresholds) + const roundedThresholds = nextThresholds.map(nt => { + if (nt.type === 'greater' || nt.type === 'lesser') { + return {...nt, value: round(nt.value, DRAGGABLE_THRESHOLD_PRECISION)} + } + + if (nt.type === 'range') { + return { + ...nt, + min: round(nt.min, DRAGGABLE_THRESHOLD_PRECISION), + max: round(nt.max, DRAGGABLE_THRESHOLD_PRECISION), + } + } + }) + + onSetThresholds(roundedThresholds) } return ( From 0df7da0b06469c87dfd3f08d1b0aa17df5b5b3a6 Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 9 Sep 2019 10:35:54 -0700 Subject: [PATCH 3/8] refactor(ui): prevent system buckets from being deleted or renamed --- ui/src/buckets/components/BucketCard.tsx | 24 +++++++++++++++++------- ui/src/buckets/constants/index.ts | 7 +++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ui/src/buckets/components/BucketCard.tsx b/ui/src/buckets/components/BucketCard.tsx index 3921ce89f3b..29103b77ef9 100644 --- a/ui/src/buckets/components/BucketCard.tsx +++ b/ui/src/buckets/components/BucketCard.tsx @@ -15,6 +15,9 @@ import BucketContextMenu from 'src/buckets/components/BucketContextMenu' import BucketAddDataButton from 'src/buckets/components/BucketAddDataButton' import {FeatureFlag} from 'src/shared/utils/featureFlag' +// Constants +import {isSystemBucket} from 'src/buckets/constants/index' + // Types import {Bucket} from 'src/types' import {DataLoaderType} from 'src/types/dataLoaders' @@ -40,7 +43,12 @@ class BucketRow extends PureComponent { + !isSystemBucket(bucket) && ( + + ) } name={ { onAddLineProtocol={this.handleAddLineProtocol} onAddScraper={this.handleAddScraper} /> -