From 7cddc3b617e4af22441a95ec104dff7e8166c391 Mon Sep 17 00:00:00 2001 From: shahzad Date: Fri, 27 Sep 2019 17:56:33 +0500 Subject: [PATCH 1/4] update pings chart colors --- .../functional/charts/snapshot_histogram.tsx | 36 ++++++++----------- .../components/functional/monitor_charts.tsx | 2 -- .../plugins/uptime/public/pages/overview.tsx | 2 -- .../plugins/uptime/public/uptime_app.tsx | 3 ++ 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx index 6d16526f3ac476..8be6ee9352347b 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/snapshot_histogram.tsx @@ -16,7 +16,7 @@ import { } from '@elastic/charts'; import { EuiEmptyPrompt, EuiTitle, EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React, { Fragment } from 'react'; +import React, { Fragment, useContext } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { HistogramDataPoint } from '../../../../common/graphql/types'; import { getColorsMap } from './get_colors_map'; @@ -24,6 +24,7 @@ import { getChartDateLabel } from '../../../lib/helper'; import { withUptimeGraphQL, UptimeGraphQLQueryProps } from '../../higher_order'; import { snapshotHistogramQuery } from '../../../queries/snapshot_histogram_query'; import { ChartWrapper } from './chart_wrapper'; +import { UptimeSettingsContext } from '../../../contexts'; export interface SnapshotHistogramProps { /** @@ -34,14 +35,6 @@ export interface SnapshotHistogramProps { * The date/time for the end of the timespan. */ absoluteEndDate: number; - /** - * The color value that is used to represent up checks. - */ - successColor: string; - /** - * The color value that is used to represent down checks. - */ - dangerColor: string; /** * Height is needed, since by defauly charts takes height of 100% @@ -58,8 +51,6 @@ type Props = UptimeGraphQLQueryProps & SnapshotHis export const SnapshotHistogramComponent = ({ absoluteStartDate, absoluteEndDate, - dangerColor, - successColor, data, loading = false, height, @@ -107,6 +98,9 @@ export const SnapshotHistogramComponent = ({ const downMonitorsName = i18n.translate('xpack.uptime.snapshotHistogram.downMonitorsId', { defaultMessage: 'Down Monitors', }); + + const { colors } = useContext(UptimeSettingsContext); + const downSpecId = getSpecId(downMonitorsName); const upMonitorsId = i18n.translate('xpack.uptime.snapshotHistogram.series.upLabel', { @@ -154,10 +148,12 @@ export const SnapshotHistogramComponent = ({ })} /> [x, upCount || 0])} - id={upSpecId} - name={upMonitorsId} + customSeriesColors={getColorsMap(colors.danger, downSpecId)} + data={histogram.map(({ x, downCount }) => [x, downCount || 0])} + id={downSpecId} + name={i18n.translate('xpack.uptime.snapshotHistogram.series.downLabel', { + defaultMessage: 'Down', + })} stackAccessors={[0]} timeZone="local" xAccessor={0} @@ -166,12 +162,10 @@ export const SnapshotHistogramComponent = ({ yScaleType="linear" /> [x, downCount || 0])} - id={downSpecId} - name={i18n.translate('xpack.uptime.snapshotHistogram.series.downLabel', { - defaultMessage: 'Down', - })} + customSeriesColors={getColorsMap(colors.gray, upSpecId)} + data={histogram.map(({ x, upCount }) => [x, upCount || 0])} + id={upSpecId} + name={upMonitorsId} stackAccessors={[0]} timeZone="local" xAccessor={0} diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx index 1d18919d5c473c..5a9772a20006a0 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx @@ -64,8 +64,6 @@ export const MonitorChartsComponent = ({ diff --git a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx index 86bd98195ca886..3bd09bcba143c0 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx @@ -153,8 +153,6 @@ export const OverviewPage = ({ basePath, logOverviewPageLoad, setBreadcrumbs }: diff --git a/x-pack/legacy/plugins/uptime/public/uptime_app.tsx b/x-pack/legacy/plugins/uptime/public/uptime_app.tsx index 4255fdf99aa5cc..9df173378d16e6 100644 --- a/x-pack/legacy/plugins/uptime/public/uptime_app.tsx +++ b/x-pack/legacy/plugins/uptime/public/uptime_app.tsx @@ -26,6 +26,7 @@ import { store } from './state'; export interface UptimeAppColors { danger: string; success: string; + gray: string; range: string; mean: string; warning: string; @@ -67,6 +68,7 @@ const Application = (props: UptimeAppProps) => { colors = { danger: euiDarkVars.euiColorDanger, mean: euiDarkVars.euiColorPrimary, + gray: euiDarkVars.euiColorLightShade, range: euiDarkVars.euiFocusBackgroundColor, success: euiDarkVars.euiColorSuccess, warning: euiDarkVars.euiColorWarning, @@ -75,6 +77,7 @@ const Application = (props: UptimeAppProps) => { colors = { danger: euiLightVars.euiColorDanger, mean: euiLightVars.euiColorPrimary, + gray: euiLightVars.euiColorLightShade, range: euiLightVars.euiFocusBackgroundColor, success: euiLightVars.euiColorSuccess, warning: euiLightVars.euiColorWarning, From ccd169fd2e66ea7f2cbc408b79026d7318e7e76b Mon Sep 17 00:00:00 2001 From: shahzad Date: Fri, 27 Sep 2019 18:06:17 +0500 Subject: [PATCH 2/4] update snaps --- .../__tests__/__snapshots__/monitor_charts.test.tsx.snap | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/monitor_charts.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/monitor_charts.test.tsx.snap index 1272e939e4b43e..d915bcb72e05eb 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/monitor_charts.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/functional/__tests__/__snapshots__/monitor_charts.test.tsx.snap @@ -67,9 +67,7 @@ exports[`MonitorCharts component renders the component without errors 1`] = ` Date: Mon, 30 Sep 2019 17:23:39 +0500 Subject: [PATCH 3/4] update snaps --- .../__snapshots__/extend_index_management.test.js.snap | 1 + .../__jest__/__snapshots__/upload_license.test.js.snap | 4 ++++ .../__snapshots__/alert_call_out.test.js.snap | 1 + .../layer_errors/__snapshots__/layer_errors.test.js.snap | 1 + .../__snapshots__/annotations_table.test.js.snap | 2 ++ .../__snapshots__/rule_editor_flyout.test.js.snap | 3 +++ .../beats/overview/__snapshots__/overview.test.js.snap | 2 ++ .../components/logs/__snapshots__/logs.test.js.snap | 4 ++++ .../components/logs/__snapshots__/reason.test.js.snap | 8 ++++++++ .../space_aware_privilege_section.test.tsx.snap | 1 + .../__snapshots__/confirm_delete_modal.test.tsx.snap | 1 + .../advanced_settings_subtitle.test.tsx.snap | 1 + .../tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap | 3 +++ .../flyout/__snapshots__/checklist_step.test.tsx.snap | 1 + .../flyout/__snapshots__/warning_step.test.tsx.snap | 1 + .../overview_page_parsing_error_callout.test.tsx.snap | 2 ++ .../charts/__tests__/snapshot_histogram.test.tsx | 2 -- .../public/components/functional/monitor_charts.tsx | 4 +--- .../uptime/public/contexts/uptime_settings_context.ts | 1 + 19 files changed, 38 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap index b400e82bb3f80b..a692bf048057e3 100644 --- a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap +++ b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap @@ -242,6 +242,7 @@ exports[`ilm summary extension should return extension when index has lifecycle

diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap index 1fdc3a1bfdf178..5e14de8c4a3dd4 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap +++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap @@ -4,6 +4,7 @@ exports[`Should render errors when layer has errors 1`] = `

@@ -34,6 +35,7 @@ exports[`Logs should render with a no cluster found reason 1`] = `

@@ -60,6 +62,7 @@ exports[`Logs should render with a no index found reason 1`] = `

@@ -86,6 +89,7 @@ exports[`Logs should render with a no index pattern found reason 1`] = `

@@ -112,6 +116,7 @@ exports[`Logs should render with a no node found reason 1`] = `

@@ -138,6 +143,7 @@ exports[`Logs should render with a no type found reason 1`] = `

@@ -164,6 +170,7 @@ exports[`Logs should render with a time period reason 1`] = `

@@ -180,6 +187,7 @@ exports[`Logs should render with a time period reason for both scenarios 1`] = `

diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap index 07034aca18ec2d..7f7003250f87b8 100644 --- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap +++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap @@ -5,6 +5,7 @@ exports[` with user profile disabling "manageSpaces" color="danger" data-test-subj="userCannotManageSpacesCallout" iconType="alert" + size="m" title={

@@ -26,6 +27,7 @@ exports[`OverviewPageParsingErrorCallout renders without errors when an error wi

diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx index 6892329e42fbcf..bad6c5e2a2ba1d 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/charts/__tests__/snapshot_histogram.test.tsx @@ -12,8 +12,6 @@ describe('SnapshotHistogram component', () => { const props: SnapshotHistogramProps = { absoluteStartDate: 1548697920000, absoluteEndDate: 1548700920000, - successColor: '#FEFEFE', - dangerColor: '#FF00FF', }; it('renders the component without errors', () => { diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx index 5a9772a20006a0..51c58a871d0e7a 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_charts.tsx @@ -6,12 +6,11 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React, { Fragment, useContext } from 'react'; +import React, { Fragment } from 'react'; import { MonitorChart } from '../../../common/graphql/types'; import { UptimeGraphQLQueryProps, withUptimeGraphQL } from '../higher_order'; import { monitorChartsQuery } from '../../queries'; import { DurationChart } from './charts'; -import { UptimeSettingsContext } from '../../contexts'; import { SnapshotHistogram } from './charts/snapshot_histogram'; import { useUrlParams } from '../../hooks'; @@ -45,7 +44,6 @@ export const MonitorChartsComponent = ({ monitorChartsData: { locationDurationLines }, } = data; - const { colors } = useContext(UptimeSettingsContext); const [getUrlParams] = useUrlParams(); const { absoluteDateRangeStart, absoluteDateRangeEnd } = getUrlParams(); diff --git a/x-pack/legacy/plugins/uptime/public/contexts/uptime_settings_context.ts b/x-pack/legacy/plugins/uptime/public/contexts/uptime_settings_context.ts index 97b1555efdd1e8..0fd9be952ed401 100644 --- a/x-pack/legacy/plugins/uptime/public/contexts/uptime_settings_context.ts +++ b/x-pack/legacy/plugins/uptime/public/contexts/uptime_settings_context.ts @@ -54,6 +54,7 @@ const defaultContext: UMSettingsContextValues = { range: euiLightVars.euiFocusBackgroundColor, success: euiLightVars.euiColorSuccess, warning: euiLightVars.euiColorWarning, + gray: euiLightVars.euiColorLightShade, }, dateRangeStart: DATE_RANGE_START, dateRangeEnd: DATE_RANGE_END, From f0a199f59c0d59e39dccdd445336ffe32d248c0d Mon Sep 17 00:00:00 2001 From: shahzad Date: Tue, 1 Oct 2019 00:17:20 +0500 Subject: [PATCH 4/4] update snaps --- .../__snapshots__/extend_index_management.test.js.snap | 1 - .../__jest__/__snapshots__/upload_license.test.js.snap | 4 ---- .../__snapshots__/alert_call_out.test.js.snap | 1 - .../layer_errors/__snapshots__/layer_errors.test.js.snap | 1 - .../__snapshots__/annotations_table.test.js.snap | 2 -- .../__snapshots__/rule_editor_flyout.test.js.snap | 3 --- .../beats/overview/__snapshots__/overview.test.js.snap | 2 -- .../components/logs/__snapshots__/logs.test.js.snap | 4 ---- .../components/logs/__snapshots__/reason.test.js.snap | 8 -------- .../space_aware_privilege_section.test.tsx.snap | 1 - .../__snapshots__/confirm_delete_modal.test.tsx.snap | 1 - .../advanced_settings_subtitle.test.tsx.snap | 1 - .../tabs/checkup/__snapshots__/checkup_tab.test.tsx.snap | 3 --- .../flyout/__snapshots__/checklist_step.test.tsx.snap | 1 - .../flyout/__snapshots__/warning_step.test.tsx.snap | 1 - .../overview_page_parsing_error_callout.test.tsx.snap | 2 -- 16 files changed, 36 deletions(-) diff --git a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap index a692bf048057e3..b400e82bb3f80b 100644 --- a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap +++ b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/__snapshots__/extend_index_management.test.js.snap @@ -242,7 +242,6 @@ exports[`ilm summary extension should return extension when index has lifecycle

diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap index 5e14de8c4a3dd4..1fdc3a1bfdf178 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap +++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/layer_errors/__snapshots__/layer_errors.test.js.snap @@ -4,7 +4,6 @@ exports[`Should render errors when layer has errors 1`] = `

@@ -35,7 +34,6 @@ exports[`Logs should render with a no cluster found reason 1`] = `

@@ -62,7 +60,6 @@ exports[`Logs should render with a no index found reason 1`] = `

@@ -89,7 +86,6 @@ exports[`Logs should render with a no index pattern found reason 1`] = `

@@ -116,7 +112,6 @@ exports[`Logs should render with a no node found reason 1`] = `

@@ -143,7 +138,6 @@ exports[`Logs should render with a no type found reason 1`] = `

@@ -170,7 +164,6 @@ exports[`Logs should render with a time period reason 1`] = `

@@ -187,7 +180,6 @@ exports[`Logs should render with a time period reason for both scenarios 1`] = `

diff --git a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap index 7f7003250f87b8..07034aca18ec2d 100644 --- a/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap +++ b/x-pack/legacy/plugins/security/public/views/management/edit_role/components/privileges/kibana/space_aware_privilege_section/__snapshots__/space_aware_privilege_section.test.tsx.snap @@ -5,7 +5,6 @@ exports[` with user profile disabling "manageSpaces" color="danger" data-test-subj="userCannotManageSpacesCallout" iconType="alert" - size="m" title={

@@ -27,7 +26,6 @@ exports[`OverviewPageParsingErrorCallout renders without errors when an error wi