[APM][ECO] Update "Collect new service logs" url (#189361)

## Summary

closes https://github.com/elastic/observability-dev/issues/3778
closes https://github.com/elastic/observability-dev/issues/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
This commit is contained in:
Katerina 2024-07-30 12:43:46 +03:00 committed by GitHub
parent 1bf4fcd6d4
commit 834332bd07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 16 deletions

View file

@ -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';
@ -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
@ -104,7 +100,6 @@ export function NoEntitiesEmptyState() {
}}
/>
<CollectServiceLogs
basePath={basePath}
onClick={() => {
reportButtonClick('collect_new_service_logs');
}}

View file

@ -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');
},

View file

@ -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';
@ -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({
@ -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 (