Skip to content

Commit

Permalink
Add beta badge to chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
weltenwort committed Aug 31, 2023
1 parent 7fc1039 commit b97c53d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
7 changes: 6 additions & 1 deletion x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ export class Plugin implements InfraClientPluginClass {
label: 'Logs',
sortKey: 200,
entries: [
{ label: 'Explorer', app: 'observability-log-explorer', path: '/' },
{
label: 'Explorer',
app: 'observability-log-explorer',
path: '/',
isBetaFeature: true,
},
{ label: 'Stream', app: 'logs', path: '/stream' },
{ label: 'Anomalies', app: 'logs', path: '/anomalies' },
{ label: 'Categories', app: 'logs', path: '/log-categories' },
Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/observability_log_explorer/common/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ import { i18n } from '@kbn/i18n';
export const logExplorerAppTitle = i18n.translate('xpack.observabilityLogExplorer.appTitle', {
defaultMessage: 'Log Explorer',
});

export const betaBadgeTitle = i18n.translate('xpack.observabilityLogExplorer.betaBadgeTitle', {
defaultMessage: 'Beta',
});

export const betaBadgeDescription = i18n.translate(
'xpack.observabilityLogExplorer.betaBadgeDescription',
{
defaultMessage: 'This application is in beta and therefore subject to change.',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import { EuiBreadcrumb } from '@elastic/eui';
import type { ChromeStart } from '@kbn/core-chrome-browser';
import type { ServerlessPluginStart } from '@kbn/serverless/public';
import { useEffect } from 'react';
import { logExplorerAppTitle } from '../../common/translations';
import {
betaBadgeDescription,
betaBadgeTitle,
logExplorerAppTitle,
} from '../../common/translations';

export const useBreadcrumbs = (
breadcrumbs: EuiBreadcrumb[],
chromeService?: ChromeStart,
chromeService: ChromeStart,
serverlessService?: ServerlessPluginStart
) => {
useEffect(() => {
Expand All @@ -23,7 +27,7 @@ export const useBreadcrumbs = (

export function setBreadcrumbs(
breadcrumbs: EuiBreadcrumb[],
chromeService?: ChromeStart,
chromeService: ChromeStart,
serverlessService?: ServerlessPluginStart
) {
if (serverlessService) {
Expand All @@ -36,6 +40,10 @@ export function setBreadcrumbs(
...breadcrumbs,
]);
}
chromeService.setBadge({
text: betaBadgeTitle,
tooltip: betaBadgeDescription,
});
}

export const noBreadcrumbs: EuiBreadcrumb[] = [];

0 comments on commit b97c53d

Please sign in to comment.