Skip to content

Commit

Permalink
Merge branch '8.x' into backport/8.x/pr-203955
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme authored Jan 10, 2025
2 parents 5966617 + 8787073 commit 973f490
Show file tree
Hide file tree
Showing 119 changed files with 1,394 additions and 747 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ enabled:
- x-pack/test/functional/apps/lens/group4/config.ts
- x-pack/test/functional/apps/lens/group5/config.ts
- x-pack/test/functional/apps/lens/group6/config.ts
- x-pack/test/functional/apps/lens/group7/config.ts
- x-pack/test/functional/apps/lens/open_in_lens/tsvb/config.ts
- x-pack/test/functional/apps/lens/open_in_lens/agg_based/config.ts
- x-pack/test/functional/apps/lens/open_in_lens/dashboard/config.ts
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@
"icalendar": "0.7.1",
"immer": "^9.0.21",
"inquirer": "^7.3.3",
"io-ts": "^2.0.5",
"io-ts": "^2.2.22",
"ipaddr.js": "2.0.0",
"isbinaryfile": "4.0.2",
"joi": "^17.13.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import {
EuiPopover,
EuiPopoverTitle,
EuiSpacer,
EuiTitle,
EuiHorizontalRule,
EuiPopoverFooter,
withEuiTheme,
WithEuiThemeProps,
} from '@elastic/eui';

import type { InternalApplicationStart } from '@kbn/core-application-browser-internal';
Expand All @@ -33,6 +34,7 @@ import type {
import type { ChromeHelpMenuLink } from '@kbn/core-chrome-browser/src';
import type { DocLinksStart } from '@kbn/core-doc-links-browser';

import { css } from '@emotion/react';
import { HeaderExtension } from './header_extension';
import { isModifiedOrPrevented } from './nav_link';

Expand Down Expand Up @@ -68,7 +70,6 @@ const buildDefaultContentLinks = ({
defaultMessage: 'Open an issue in GitHub',
}),
href: docLinks.links.kibana.createGithubIssue,
iconType: 'logoGithub',
},
];

Expand All @@ -92,10 +93,10 @@ interface State {
defaultContentLinks: ChromeHelpMenuLink[];
}

export class HeaderHelpMenu extends Component<Props, State> {
class HelpMenu extends Component<Props & WithEuiThemeProps, State> {
private subscription?: Subscription;

constructor(props: Props) {
constructor(props: Props & WithEuiThemeProps) {
super(props);

this.state = {
Expand Down Expand Up @@ -136,12 +137,16 @@ export class HeaderHelpMenu extends Component<Props, State> {
}

public render() {
const { kibanaVersion } = this.props;
const { kibanaVersion, theme } = this.props;

const defaultContent = this.renderDefaultContent();
const globalCustomContent = this.renderGlobalCustomContent();
const customContent = this.renderCustomContent();

const euiThemePadding = css`
padding: ${theme.euiTheme.size.s};
`;

const button = (
<EuiHeaderSectionItemButton
aria-expanded={this.state.isOpen}
Expand Down Expand Up @@ -196,7 +201,7 @@ export class HeaderHelpMenu extends Component<Props, State> {
{defaultContent}
{customContent && (
<>
<EuiHorizontalRule margin="m" />
<EuiPopoverFooter css={euiThemePadding} />
{customContent}
</>
)}
Expand All @@ -210,40 +215,37 @@ export class HeaderHelpMenu extends Component<Props, State> {

return (
<Fragment>
{defaultContentLinks.map(
({ href, title, iconType, onClick: _onClick, dataTestSubj }, i) => {
const isLast = i === defaultContentLinks.length - 1;

if (href && _onClick) {
throw new Error(
'Only one of `href` and `onClick` should be provided for the help menu link.'
);
}

const hrefProps = href ? { href, target: '_blank' } : {};
const onClick = () => {
if (!_onClick) return;
_onClick();
this.closeMenu();
};

return (
<Fragment key={i}>
<EuiButtonEmpty
{...hrefProps}
onClick={onClick}
size="s"
flush="left"
iconType={iconType}
data-test-subj={dataTestSubj}
>
{title}
</EuiButtonEmpty>
{!isLast && <EuiSpacer size="xs" />}
</Fragment>
{defaultContentLinks.map(({ href, title, onClick: _onClick, dataTestSubj }, i) => {
const isLast = i === defaultContentLinks.length - 1;

if (href && _onClick) {
throw new Error(
'Only one of `href` and `onClick` should be provided for the help menu link.'
);
}
)}

const hrefProps = href ? { href, target: '_blank' } : {};
const onClick = () => {
if (!_onClick) return;
_onClick();
this.closeMenu();
};

return (
<Fragment key={i}>
<EuiButtonEmpty
{...hrefProps}
onClick={onClick}
size="s"
flush="left"
data-test-subj={dataTestSubj}
>
{title}
</EuiButtonEmpty>
{!isLast && <EuiSpacer size="xs" />}
</Fragment>
);
})}
</Fragment>
);
}
Expand Down Expand Up @@ -333,10 +335,9 @@ export class HeaderHelpMenu extends Component<Props, State> {

return (
<>
<EuiTitle size="xxs">
<EuiPopoverTitle>
<h3>{appName}</h3>
</EuiTitle>
<EuiSpacer size="s" />
</EuiPopoverTitle>
{customLinks}
{content && (
<>
Expand Down Expand Up @@ -402,3 +403,5 @@ const createCustomLink = (
</Fragment>
);
};

export const HeaderHelpMenu = withEuiTheme(HelpMenu);
1 change: 0 additions & 1 deletion src/core/packages/chrome/browser/src/nav_controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface ChromeNavControl {
export interface ChromeHelpMenuLink {
title: string;
href?: string;
iconType?: string;
onClick?: () => void;
dataTestSubj?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { isRetryableEsClientErrorMock } from './is_scripting_enabled.test.mocks';
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import * as estypes from '@elastic/elasticsearch/lib/api/types';
import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks';
import { isInlineScriptingEnabled } from './is_scripting_enabled';

Expand Down
Loading

0 comments on commit 973f490

Please sign in to comment.