-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] License prompt for service map (#52668)
Display a link to platinum license upgrade on the service map. Also add `useKibanaUrl` and `useLicense` hooks. Make the `LicenseContext` (which is used in a couple class components and on page load) use the license observable from the NP plugin. Add missing export of `useObservable` to kibana_react.
- Loading branch information
Showing
10 changed files
with
144 additions
and
87 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
66 changes: 66 additions & 0 deletions
66
x-pack/legacy/plugins/apm/public/components/app/ServiceMap/PlatinumLicensePrompt.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,66 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { | ||
EuiEmptyPrompt, | ||
EuiButton, | ||
EuiPanel, | ||
EuiFlexGroup, | ||
EuiFlexItem | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { useKibanaUrl } from '../../../hooks/useKibanaUrl'; | ||
|
||
export function PlatinumLicensePrompt() { | ||
// Set the height to give it some top margin | ||
const style = { height: '60vh' }; | ||
|
||
const licensePageUrl = useKibanaUrl( | ||
'/app/kibana', | ||
'/management/elasticsearch/license_management/home' | ||
); | ||
|
||
return ( | ||
<EuiFlexGroup | ||
alignItems="center" | ||
justifyContent="spaceAround" | ||
style={style} | ||
> | ||
<EuiFlexItem grow={false}> | ||
<EuiPanel grow={false} hasShadow={true}> | ||
<EuiEmptyPrompt | ||
actions={[ | ||
<EuiButton fill={true} href={licensePageUrl}> | ||
{i18n.translate( | ||
'xpack.apm.serviceMap.licensePromptButtonText', | ||
{ | ||
defaultMessage: 'Start 30-day Platinum trial' | ||
} | ||
)} | ||
</EuiButton> | ||
]} | ||
body={ | ||
<p> | ||
{i18n.translate('xpack.apm.serviceMap.licensePromptBody', { | ||
defaultMessage: | ||
"In order to access Service Maps, you must be subscribed to an Elastic Platinum license. With it, you'll have the ability to visualize your entire application stack along with your APM data." | ||
})} | ||
</p> | ||
} | ||
title={ | ||
<h2> | ||
{i18n.translate('xpack.apm.serviceMap.licensePromptTitle', { | ||
defaultMessage: 'Service maps is available in Platinum.' | ||
})} | ||
</h2> | ||
} | ||
/> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} |
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
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,19 @@ | ||
/* | ||
* 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 url from 'url'; | ||
import { useApmPluginContext } from './useApmPluginContext'; | ||
|
||
export function useKibanaUrl( | ||
/** The path to the plugin */ path: string, | ||
/** The hash path */ hash: string | ||
) { | ||
const { core } = useApmPluginContext(); | ||
return url.format({ | ||
pathname: core.http.basePath.prepend(path), | ||
hash | ||
}); | ||
} |
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,12 @@ | ||
/* | ||
* 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 { useContext } from 'react'; | ||
import { LicenseContext } from '../context/LicenseContext'; | ||
|
||
export function useLicense() { | ||
return useContext(LicenseContext); | ||
} |
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 was deleted.
Oops, something went wrong.