-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Refactor folder structure (#63442)
* update structure * update connected structure * update connected structure * update code structure * update types * update imports * update folder * update trans * fixed snapshot * updated code * refacto monitor list container * update types Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
7b57caf
commit 7c7fbc7
Showing
253 changed files
with
560 additions
and
719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...snapshots__/duration_charts.test.tsx.snap → ...snapshots__/duration_charts.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
122 changes: 122 additions & 0 deletions
122
x-pack/legacy/plugins/uptime/public/components/common/charts/duration_chart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import moment from 'moment'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { Axis, Chart, Position, timeFormatter, Settings, SeriesIdentifier } from '@elastic/charts'; | ||
import { getChartDateLabel } from '../../../lib/helper'; | ||
import { LocationDurationLine } from '../../../../common/types'; | ||
import { DurationLineSeriesList } from './duration_line_series_list'; | ||
import { ChartWrapper } from './chart_wrapper'; | ||
import { useUrlParams } from '../../../hooks'; | ||
import { getTickFormat } from './get_tick_format'; | ||
import { ChartEmptyState } from './chart_empty_state'; | ||
import { DurationAnomaliesBar } from './duration_line_bar_list'; | ||
import { AnomalyRecords } from '../../../state/actions'; | ||
|
||
interface DurationChartProps { | ||
/** | ||
* Timeseries data that is used to express an average line series | ||
* on the duration chart. One entry per location | ||
*/ | ||
locationDurationLines: LocationDurationLine[]; | ||
|
||
/** | ||
* To represent the loading spinner on chart | ||
*/ | ||
loading: boolean; | ||
|
||
anomalies: AnomalyRecords | null; | ||
} | ||
|
||
/** | ||
* This chart is intended to visualize monitor duration performance over time to | ||
* the users in a helpful way. Its x-axis is based on a timeseries, the y-axis is in | ||
* milliseconds. | ||
* @param props The props required for this component to render properly | ||
*/ | ||
export const DurationChartComponent = ({ | ||
locationDurationLines, | ||
anomalies, | ||
loading, | ||
}: DurationChartProps) => { | ||
const hasLines = locationDurationLines.length > 0; | ||
const [getUrlParams, updateUrlParams] = useUrlParams(); | ||
const { absoluteDateRangeStart: min, absoluteDateRangeEnd: max } = getUrlParams(); | ||
|
||
const [hiddenLegends, setHiddenLegends] = useState<string[]>([]); | ||
|
||
const onBrushEnd = (minX: number, maxX: number) => { | ||
updateUrlParams({ | ||
dateRangeStart: moment(minX).toISOString(), | ||
dateRangeEnd: moment(maxX).toISOString(), | ||
}); | ||
}; | ||
|
||
const legendToggleVisibility = (legendItem: SeriesIdentifier | null) => { | ||
if (legendItem) { | ||
setHiddenLegends(prevState => { | ||
if (prevState.includes(legendItem.specId)) { | ||
return [...prevState.filter(item => item !== legendItem.specId)]; | ||
} else { | ||
return [...prevState, legendItem.specId]; | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
return ( | ||
<ChartWrapper height="400px" loading={loading}> | ||
{hasLines ? ( | ||
<Chart> | ||
<Settings | ||
xDomain={{ min, max }} | ||
showLegend | ||
showLegendExtra | ||
legendPosition={Position.Bottom} | ||
onBrushEnd={onBrushEnd} | ||
onLegendItemClick={legendToggleVisibility} | ||
/> | ||
<Axis | ||
id="bottom" | ||
position={Position.Bottom} | ||
showOverlappingTicks={true} | ||
tickFormat={timeFormatter(getChartDateLabel(min, max))} | ||
title={i18n.translate('xpack.uptime.monitorCharts.durationChart.bottomAxis.title', { | ||
defaultMessage: 'Timestamp', | ||
})} | ||
/> | ||
<Axis | ||
domain={{ min: 0 }} | ||
id="left" | ||
position={Position.Left} | ||
tickFormat={d => getTickFormat(d)} | ||
title={i18n.translate('xpack.uptime.monitorCharts.durationChart.leftAxis.title', { | ||
defaultMessage: 'Duration ms', | ||
})} | ||
/> | ||
<DurationLineSeriesList lines={locationDurationLines} /> | ||
<DurationAnomaliesBar anomalies={anomalies} hiddenLegends={hiddenLegends} /> | ||
</Chart> | ||
) : ( | ||
<ChartEmptyState | ||
body={ | ||
<FormattedMessage | ||
id="xpack.uptime.durationChart.emptyPrompt.description" | ||
defaultMessage="This monitor has never been {emphasizedText} during the selected time range." | ||
values={{ emphasizedText: <strong>up</strong> }} | ||
/> | ||
} | ||
title={i18n.translate('xpack.uptime.durationChart.emptyPrompt.title', { | ||
defaultMessage: 'No duration data available', | ||
})} | ||
/> | ||
)} | ||
</ChartWrapper> | ||
); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 0 additions & 82 deletions
82
x-pack/legacy/plugins/uptime/public/components/connected/charts/ping_histogram.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.