Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Add callout for synthetics UI #79563

Merged
merged 10 commits into from
Oct 7, 2020
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 { EuiButton, EuiCallOut, EuiSpacer } from '@elastic/eui';
import React, { useState } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

const SYNTHETICS_CALLOUT_LS_KEY = 'xpack.uptime.syntheticsCallout.display';
const shouldShowSyntheticsCallout = () => {
let value = localStorage.getItem(SYNTHETICS_CALLOUT_LS_KEY);
if (value === null) {
localStorage.setItem(SYNTHETICS_CALLOUT_LS_KEY, 'true');
value = 'true';
}
return value === 'true';
};
const hideSyntheticsCallout = () => localStorage.setItem(SYNTHETICS_CALLOUT_LS_KEY, 'false');

export const SyntheticsCallout = () => {
const [shouldShow, setShouldShow] = useState<boolean>(shouldShowSyntheticsCallout());
if (!shouldShow) {
return null;
}
return (
<>
<EuiCallOut
title={i18n.translate('xpack.uptime.overview.pageHeader.syntheticsCallout.title', {
defaultMessage: 'Elastic Synthetics',
})}
iconType="beaker"
>
<p>
<FormattedMessage
id="xpack.uptime.overview.pageHeader.syntheticsCallout.content"
defaultMessage="Elastic Uptime now supports synthetic browser monitors! Learn how to use them {here}."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drewpost thoughts on this copy? and the URL below?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I make a small design suggestion for the callout layout? I would like to suggest that we make the link to the synthetics elastic.co page the primary link and allow for users to dismiss the callout as a secondary option. I don't think the small inline link is going to be clicked, thereby making the dismiss option the most common action. Perhaps something like this? I'm sure that we can beef up the copy as well of this announcement 😊

Screenshot 2020-10-06 at 09 08 55

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewvc "Uptime is now previewing support for scripted multi-step availability checks. This means you can interact with elements of a webpage and check the availability of an entire journey (such as making a purchase or signing into a system) instead of just a simple single page up/down check. Please click below to read more and, if you'd like to be one of the first to use these capabilities, you can download our preview synthetics agent and view your synthetic checks in Uptime"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drewpost URL updated in 6e93592.

values={{ here: <a href="https://elastic.co/synthetics">here</a> }}
/>
</p>
<EuiButton
onClick={() => {
if (shouldShow) {
hideSyntheticsCallout();
setShouldShow(false);
}
}}
>
<FormattedMessage
id="xpack.uptime.overview.pageHeader.syntheticsCallout.dismissButtonText"
defaultMessage="Dismiss"
/>
</EuiButton>
</EuiCallOut>
<EuiSpacer size="s" />
</>
);
};
4 changes: 3 additions & 1 deletion x-pack/plugins/uptime/public/pages/page_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiSpacer, EuiButtonEmpty } from '@elastic/eui';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { UptimeDatePicker } from '../components/common/uptime_date_picker';
import { SETTINGS_ROUTE } from '../../common/constants';
import { ToggleAlertFlyoutButton } from '../components/overview/alerts/alerts_containers';
import { useKibana } from '../../../../../src/plugins/kibana_react/public';
import { ReactRouterEuiButtonEmpty } from '../components/common/react_router_helpers';
import { SyntheticsCallout } from '../components/overview/synthetics_callout';

interface PageHeaderProps {
headingText: string | JSX.Element;
Expand Down Expand Up @@ -83,6 +84,7 @@ export const PageHeader = React.memo(

return (
<>
<SyntheticsCallout />
<EuiFlexGroup
alignItems="center"
justifyContent="spaceBetween"
Expand Down