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

[APM] Only fetch custom links for users with a valid license #83836

Merged
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
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