Skip to content

Commit

Permalink
[APM][ECO] Update "Collect new service logs" url (elastic#189361)
Browse files Browse the repository at this point in the history
## Summary

closes elastic/observability-dev#3778
closes elastic/observability-dev#3780

### Checklist

- [x] Update `/app/observabilityOnboarding/?category=logs` to `
/app/observabilityOnboarding/customLogs/?category=logs`
- [x] `Collect new service logs`  should open on the same tab
- [x]  Associate logs link should open in new tab 



https://github.com/user-attachments/assets/acddce50-e925-4ac9-8ebc-012fafb72878
  • Loading branch information
kpatticha authored Jul 30, 2024
1 parent 1bf4fcd commit 834332b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

import { dashboardsLight } from '@kbn/shared-svg';
import useEffectOnce from 'react-use/lib/useEffectOnce';
import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context';
import { useKibana } from '../../../../../context/kibana_context/use_kibana';
import { useLocalStorage } from '../../../../../hooks/use_local_storage';
import { ApmPluginStartDeps, ApmServices } from '../../../../../plugin';
Expand All @@ -33,9 +31,7 @@ import {
} from '../../../../shared/add_data_buttons/buttons';

export function NoEntitiesEmptyState() {
const { core } = useApmPluginContext();
const { services } = useKibana<ApmPluginStartDeps & ApmServices>();
const { basePath } = core.http;
const [userHasDismissedCallout, setUserHasDismissedCallout] = useLocalStorage(
'apm.uiNewExperienceCallout',
false
Expand Down Expand Up @@ -104,7 +100,6 @@ export function NoEntitiesEmptyState() {
}}
/>
<CollectServiceLogs
basePath={basePath}
onClick={() => {
reportButtonClick('collect_new_service_logs');
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export function AddDataContextMenu() {
name: collectServiceLogs.name,
href: basePath.prepend(collectServiceLogs.link),
'data-test-subj': 'apmAddDataCollectServiceLogs',
target: '_blank',
onClick: () => {
reportButtonClick('collect_new_service_logs');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import React from 'react';
import { EuiButton } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { IBasePath } from '@kbn/core/public';
import { useKibana } from '../../../context/kibana_context/use_kibana';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';

Expand All @@ -29,7 +28,7 @@ export const collectServiceLogs = {
name: i18n.translate('xpack.apm.collect.service.logs.button', {
defaultMessage: 'Collect new service logs',
}),
link: '/app/observabilityOnboarding/?category=logs',
link: '/app/observabilityOnboarding/customLogs/?category=logs',
};

export function AddApmData({
Expand Down Expand Up @@ -68,15 +67,15 @@ export function AssociateServiceLogs({ onClick }: { onClick?: () => void }) {
);
}

export function CollectServiceLogs({
basePath,
onClick,
}: {
basePath: IBasePath;
onClick?: () => void;
}) {
export function CollectServiceLogs({ onClick }: { onClick?: () => void }) {
const { core } = useApmPluginContext();
const { basePath } = core.http;
const {
application: { navigateToUrl },
} = useKibana().services;

function handleClick() {
window.open(basePath.prepend(collectServiceLogs.link), '_blank');
navigateToUrl(basePath.prepend(collectServiceLogs.link));
onClick?.();
}
return (
Expand Down

0 comments on commit 834332b

Please sign in to comment.