Skip to content

Commit

Permalink
[Behavorial Analytics] Link to Manage Datastream Page (#154857)
Browse files Browse the repository at this point in the history
Adds a link to navigate to the manage datastream. This allows the
customer to customise the ILM policy or view datastream settings.

<img width="316" alt="image"
src="https://user-images.githubusercontent.com/49480/231541459-3cb2e4d0-8f1e-41a8-8100-85f32ebffff6.png">

<img width="1507" alt="image"
src="https://user-images.githubusercontent.com/49480/231541545-67563edf-a40a-42e8-9bbd-cab0e07924b5.png">

---------

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
joemcelroy and kibanamachine authored Apr 12, 2023
1 parent 263af61 commit 515d270
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { act } from 'react-dom/test-utils';

import { EuiContextMenuItem, EuiSuperDatePicker } from '@elastic/eui';

import { AnalyticsCollection } from '../../../../../../common/types/analytics';

import { AnalyticsCollectionToolbar } from './analytics_collection_toolbar';

describe('AnalyticsCollectionToolbar', () => {
Expand All @@ -31,7 +33,10 @@ describe('AnalyticsCollectionToolbar', () => {
jest.clearAllMocks();

setMockValues({
analyticsCollection: {},
analyticsCollection: {
events_datastream: 'test-events',
name: 'test',
} as AnalyticsCollection,
dataViewId: 'data-view-test',
isLoading: false,
refreshInterval: { pause: false, value: 10000 },
Expand Down Expand Up @@ -90,4 +95,14 @@ describe('AnalyticsCollectionToolbar', () => {

expect(exploreInDiscoverItem.prop('href')).toBe("/app/discover#/?_a=(index:'data-view-test')");
});

it('should correct link to the manage datastream link', () => {
const exploreInDiscoverItem = wrapper.find(EuiContextMenuItem).at(1);

expect(exploreInDiscoverItem).toHaveLength(1);

expect(exploreInDiscoverItem.prop('href')).toBe(
'/app/management/data/index_management/data_streams/test-events'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export const AnalyticsCollectionToolbar: React.FC = () => {
const discoverUrl = application.getUrlForApp('discover', {
path: `#/?_a=(index:'${dataViewId}')`,
});
const manageDatastreamUrl = application.getUrlForApp('management', {
path: '/data/index_management/data_streams/' + analyticsCollection.events_datastream,
});
const handleTimeChange = ({ start: from, end: to }: OnTimeChangeProps) => {
setTimeRange({ from, to });
};
Expand Down Expand Up @@ -139,16 +142,10 @@ export const AnalyticsCollectionToolbar: React.FC = () => {
panelPaddingSize="none"
>
<EuiContextMenuPanel>
<EuiContextMenuItem icon="database" size="s">
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.aboutCollection"
defaultMessage="About this collection"
/>
</EuiContextMenuItem>

<EuiContextMenuItem
icon="link"
size="s"
data-telemetry-id={'entSearch-analytics-overview-toolbar-integrate-tracker-link'}
onClick={() =>
navigateToUrl(
generateEncodedPath(COLLECTION_INTEGRATE_PATH, {
Expand All @@ -164,7 +161,24 @@ export const AnalyticsCollectionToolbar: React.FC = () => {
</EuiContextMenuItem>

<RedirectAppLinks application={application}>
<EuiContextMenuItem icon="visArea" href={discoverUrl} size="s">
<EuiContextMenuItem
icon="database"
size="s"
href={manageDatastreamUrl}
data-telemetry-id={'entSearch-analytics-overview-toolbar-manage-datastream-link'}
>
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.manageEventsDatastream"
defaultMessage="Manage events datastream"
/>
</EuiContextMenuItem>

<EuiContextMenuItem
icon="visArea"
href={discoverUrl}
size="s"
data-telemetry-id={'entSearch-analytics-overview-toolbar-manage-discover-link'}
>
<FormattedMessage
id="xpack.enterpriseSearch.analytics.collectionsView.openInDiscover"
defaultMessage="Create dashboards in Discover"
Expand All @@ -179,6 +193,7 @@ export const AnalyticsCollectionToolbar: React.FC = () => {
fullWidth
isLoading={!isLoading}
disabled={!isLoading}
data-telemetry-id={'entSearch-analytics-overview-toolbar-delete-collection-button'}
size="s"
onClick={() => {
deleteAnalyticsCollection(analyticsCollection.name);
Expand Down

0 comments on commit 515d270

Please sign in to comment.