Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 { ChartEmptyState } from '../chart_empty_state';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';

describe('ChartEmptyState', () => {
it('renders string values', () => {
expect(
shallowWithIntl(<ChartEmptyState body="This is the body" title="This is the title" />)
).toMatchSnapshot();
});

it('renders JSX values', () => {
expect(
shallowWithIntl(
<ChartEmptyState
body={
<FormattedMessage
id="test.body"
defaultMessage="This is the default with a {val} included"
values={{ val: <strong>down</strong> }}
/>
}
title={<FormattedMessage id="test.title" defaultMessage="The title" />}
/>
)
).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 { EuiEmptyPrompt, EuiTitle } from '@elastic/eui';
import React, { FC } from 'react';

interface ChartEmptyStateProps {
title: string | JSX.Element;
body: string | JSX.Element;
}

export const ChartEmptyState: FC<ChartEmptyStateProps> = ({ title, body }) => (
<EuiEmptyPrompt
title={
<EuiTitle>
<h5>{title}</h5>
</EuiTitle>
}
body={<p>{body}</p>}
/>
);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { getChartDateLabel } from '../../../lib/helper';
import { LocationDurationLine } from '../../../../common/graphql/types';
import { DurationLineSeriesList } from './duration_line_series_list';
import { DurationChartEmptyState } from './duration_chart_empty_state';
import { ChartWrapper } from './chart_wrapper';
import { useUrlParams } from '../../../hooks';
import { getTickFormat } from './get_tick_format';
import { ChartEmptyState } from './chart_empty_state';

interface DurationChartProps {
/**
Expand Down Expand Up @@ -102,7 +102,18 @@ export const DurationChart = ({
<DurationLineSeriesList lines={locationDurationLines} meanColor={meanColor} />
</Chart>
) : (
<DurationChartEmptyState />
<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>
</EuiPanel>
Expand Down

This file was deleted.

Loading