diff --git a/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap b/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap
index 3e439f263a613..e85ba5522bdf1 100644
--- a/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap
+++ b/x-pack/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap
@@ -6,21 +6,21 @@ exports[`Logs should render a link to filter by cluster uuid 1`] = `
size="m"
title="Want to see more log entries?"
>
-
+
Logs
,
}
}
/>
-
+
`;
@@ -30,21 +30,21 @@ exports[`Logs should render a link to filter by cluster uuid and index uuid 1`]
size="m"
title="Want to see more log entries?"
>
-
+
Logs
,
}
}
/>
-
+
`;
@@ -54,21 +54,21 @@ exports[`Logs should render a link to filter by cluster uuid and node uuid 1`] =
size="m"
title="Want to see more log entries?"
>
-
+
Logs
,
}
}
/>
-
+
`;
@@ -285,21 +285,21 @@ exports[`Logs should render normally 1`] = `
size="m"
title="Want to see more log entries?"
>
-
+
Logs
,
}
}
/>
-
+
`;
diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.js b/x-pack/plugins/monitoring/public/components/logs/logs.js
index 680e82f6b6e16..3678c4ae9e27f 100644
--- a/x-pack/plugins/monitoring/public/components/logs/logs.js
+++ b/x-pack/plugins/monitoring/public/components/logs/logs.js
@@ -6,6 +6,7 @@
*/
import React, { PureComponent } from 'react';
+import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
import { upperFirst } from 'lodash';
import { Legacy } from '../../legacy_shims';
import { EuiBasicTable, EuiTitle, EuiSpacer, EuiText, EuiCallOut, EuiLink } from '@elastic/eui';
@@ -110,8 +111,6 @@ const clusterColumns = [
];
function getLogsUiLink(clusterUuid, nodeId, indexUuid) {
- const base = `${Legacy.shims.getBasePath()}/app/logs/link-to/${INFRA_SOURCE_ID}/logs`;
-
const params = [];
if (clusterUuid) {
params.push(`elasticsearch.cluster.uuid:${clusterUuid}`);
@@ -123,11 +122,12 @@ function getLogsUiLink(clusterUuid, nodeId, indexUuid) {
params.push(`elasticsearch.index.name:${indexUuid}`);
}
- if (params.length === 0) {
- return base;
- }
+ const base = Legacy.shims.infra.locators.logsLocator.getRedirectUrl({
+ logView: { logViewId: INFRA_SOURCE_ID, type: 'log-view-reference' },
+ ...(params.length ? { filter: params.join(' and ') } : {}),
+ });
- return `${base}?filter=${params.join(' and ')}`;
+ return base;
}
export class Logs extends PureComponent {
@@ -158,7 +158,7 @@ export class Logs extends PureComponent {
}
renderCallout() {
- const uiCapabilities = Legacy.shims.capabilities;
+ const { capabilities: uiCapabilities, infra, kibanaServices } = Legacy.shims;
const show = uiCapabilities.logs && uiCapabilities.logs.show;
const {
logs: { enabled },
@@ -170,7 +170,7 @@ export class Logs extends PureComponent {
return null;
}
- return (
+ return infra ? (
-
+
-
+
- );
+ ) : null;
}
render() {
diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.test.js b/x-pack/plugins/monitoring/public/components/logs/logs.test.js
index 089bd5c72f865..23292ff742fcd 100644
--- a/x-pack/plugins/monitoring/public/components/logs/logs.test.js
+++ b/x-pack/plugins/monitoring/public/components/logs/logs.test.js
@@ -14,6 +14,13 @@ jest.mock('../../legacy_shims', () => ({
shims: {
getBasePath: () => '',
capabilities: { logs: { show: true } },
+ infra: {
+ locators: {
+ logsLocator: {
+ getRedirectUrl: () => '',
+ },
+ },
+ },
},
},
}));
diff --git a/x-pack/plugins/monitoring/public/legacy_shims.ts b/x-pack/plugins/monitoring/public/legacy_shims.ts
index b2b5cafedfb69..32322a2b4f7ac 100644
--- a/x-pack/plugins/monitoring/public/legacy_shims.ts
+++ b/x-pack/plugins/monitoring/public/legacy_shims.ts
@@ -22,6 +22,7 @@ import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-
import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application/type_registry';
import { ActionTypeModel, RuleTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
+import type { InfraClientStartExports } from '@kbn/infra-plugin/public';
import {
MonitoringStartPluginDependencies,
LegacyMonitoringStartPluginDependencies,
@@ -73,6 +74,7 @@ export interface IShims {
usageCollection: UsageCollectionSetup;
kibanaServices: CoreStart & { usageCollection: UsageCollectionSetup };
appMountParameters: AppMountParameters;
+ infra?: InfraClientStartExports;
}
export class Legacy {
@@ -85,6 +87,7 @@ export class Legacy {
triggersActionsUi,
usageCollection,
appMountParameters,
+ infra,
}: LegacyMonitoringStartPluginDependencies) {
this._shims = {
toastNotifications: core.notifications.toasts,
@@ -143,6 +146,7 @@ export class Legacy {
usageCollection,
},
appMountParameters,
+ infra,
};
}
diff --git a/x-pack/plugins/monitoring/public/plugin.ts b/x-pack/plugins/monitoring/public/plugin.ts
index a6b9f6549d390..c6cfbdc48094c 100644
--- a/x-pack/plugins/monitoring/public/plugin.ts
+++ b/x-pack/plugins/monitoring/public/plugin.ts
@@ -108,6 +108,7 @@ export class MonitoringPlugin
usageCollection: plugins.usageCollection,
appMountParameters: params,
dataViews: pluginsStart.dataViews,
+ infra: pluginsStart.infra,
};
Legacy.init({
@@ -122,6 +123,7 @@ export class MonitoringPlugin
usageCollection: deps.usageCollection,
appMountParameters: deps.appMountParameters,
dataViews: deps.dataViews,
+ infra: deps.infra,
});
const config = Object.fromEntries(externalConfig);
diff --git a/x-pack/plugins/monitoring/public/types.ts b/x-pack/plugins/monitoring/public/types.ts
index 6eaf446b59ed8..5e6590968d232 100644
--- a/x-pack/plugins/monitoring/public/types.ts
+++ b/x-pack/plugins/monitoring/public/types.ts
@@ -15,6 +15,7 @@ export type { MLJobs } from '../server/lib/elasticsearch/get_ml_jobs';
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import { DashboardStart } from '@kbn/dashboard-plugin/public';
import { FleetStart } from '@kbn/fleet-plugin/public';
+import type { InfraClientStartExports } from '@kbn/infra-plugin/public';
export interface MonitoringStartPluginDependencies {
navigation: NavigationStart;
@@ -24,6 +25,7 @@ export interface MonitoringStartPluginDependencies {
dataViews: DataViewsPublicPluginStart;
dashboard?: DashboardStart;
fleet?: FleetStart;
+ infra?: InfraClientStartExports;
}
interface LegacyStartDependencies {
diff --git a/x-pack/plugins/monitoring/tsconfig.json b/x-pack/plugins/monitoring/tsconfig.json
index b0c0be5ff7510..5ebd037e04648 100644
--- a/x-pack/plugins/monitoring/tsconfig.json
+++ b/x-pack/plugins/monitoring/tsconfig.json
@@ -40,6 +40,7 @@
"@kbn/fleet-plugin",
"@kbn/shared-ux-router",
"@kbn/observability-shared-plugin",
+ "@kbn/shared-ux-link-redirect-app",
],
"exclude": [
"target/**/*",