Skip to content

Commit

Permalink
[7.x] [APM] Only fetch custom links for users with a valid license (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Nov 21, 2020
1 parent c952cf9 commit 4b49eeb
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 567 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
roots: [`${rootDir}/common`, `${rootDir}/public`, `${rootDir}/server`],
collectCoverage: true,
collectCoverageFrom: [
...(jestConfig.collectCoverageFrom ?? []),
...(jestConfig.collectCoverageFrom || []),
'**/*.{js,mjs,jsx,ts,tsx}',
'!**/*.stories.{js,mjs,ts,tsx}',
'!**/dev_docs/**',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {
getSelectOptions,
replaceTemplateVariables,
} from '../CustomLinkFlyout/helper';
} from '../CreateEditCustomLinkFlyout/helper';
import { Transaction } from '../../../../../../../typings/es_schemas/ui/transaction';

describe('Custom link helper', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface Props {

const filtersEmptyState: Filter[] = [{ key: '', value: '' }];

export function CustomLinkFlyout({
export function CreateEditCustomLinkFlyout({
onClose,
onSave,
onDelete,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { LinkPreview } from '../CustomLinkFlyout/LinkPreview';
import { LinkPreview } from '../CreateEditCustomLinkFlyout/LinkPreview';
import {
render,
getNodeText,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../../utils/testHelpers';
import * as saveCustomLink from './CustomLinkFlyout/saveCustomLink';
import * as saveCustomLink from './CreateEditCustomLinkFlyout/saveCustomLink';
import { MockApmPluginContextWrapper } from '../../../../../context/ApmPluginContext/MockApmPluginContext';

const data = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
EuiFlexItem,
EuiPanel,
EuiSpacer,
EuiTitle,
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand All @@ -20,10 +21,9 @@ import { FETCH_STATUS, useFetcher } from '../../../../../hooks/useFetcher';
import { useLicense } from '../../../../../hooks/useLicense';
import { LicensePrompt } from '../../../../shared/LicensePrompt';
import { CreateCustomLinkButton } from './CreateCustomLinkButton';
import { CustomLinkFlyout } from './CustomLinkFlyout';
import { CreateEditCustomLinkFlyout } from './CreateEditCustomLinkFlyout';
import { CustomLinkTable } from './CustomLinkTable';
import { EmptyPrompt } from './EmptyPrompt';
import { Title } from './Title';

export function CustomLinkOverview() {
const license = useLicense();
Expand All @@ -35,9 +35,14 @@ export function CustomLinkOverview() {
>();

const { data: customLinks = [], status, refetch } = useFetcher(
(callApmApi) =>
callApmApi({ endpoint: 'GET /api/apm/settings/custom_links' }),
[]
async (callApmApi) => {
if (hasValidLicense) {
return callApmApi({
endpoint: 'GET /api/apm/settings/custom_links',
});
}
},
[hasValidLicense]
);

useEffect(() => {
Expand All @@ -61,7 +66,7 @@ export function CustomLinkOverview() {
return (
<>
{isFlyoutOpen && (
<CustomLinkFlyout
<CreateEditCustomLinkFlyout
onClose={onCloseFlyout}
defaults={customLinkSelected}
customLinkId={customLinkSelected?.id}
Expand All @@ -78,7 +83,28 @@ export function CustomLinkOverview() {
<EuiPanel>
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<Title />
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle>
<EuiFlexGroup
alignItems="center"
gutterSize="s"
responsive={false}
>
<EuiFlexItem grow={false}>
<h2>
{i18n.translate(
'xpack.apm.settings.customizeUI.customLink',
{
defaultMessage: 'Custom Links',
}
)}
</h2>
</EuiFlexItem>
</EuiFlexGroup>
</EuiTitle>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{hasValidLicense && !showEmptyPrompt && (
<EuiFlexItem>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4b49eeb

Please sign in to comment.