mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* [Global Nav] Moved Overview page/link to the accordion/Solution title * Using Cloud logo for deployment link and fixing isActive state * Change Deployment section to dark background * Completely remove locking ability * Change buttonElement if overview page exists * Snaps from button/div * PR Feedback: - Puts `Overview` links back for Observability and Security - Increases hit area and scopes underline of anchor tag within the accordion header - Uses `id`’s to find Overview pages instead of `title` text Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
This commit is contained in:
parent
7939e2b1e4
commit
850dcc7212
19 changed files with 147 additions and 150 deletions
|
@ -425,7 +425,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
}
|
||||
>
|
||||
<EuiCollapsibleNavGroup
|
||||
background="light"
|
||||
background="dark"
|
||||
className="eui-yScroll"
|
||||
style={
|
||||
Object {
|
||||
|
@ -434,7 +434,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
}
|
||||
>
|
||||
<div
|
||||
className="euiCollapsibleNavGroup euiCollapsibleNavGroup--light eui-yScroll"
|
||||
className="euiCollapsibleNavGroup euiCollapsibleNavGroup--dark eui-yScroll"
|
||||
id="generated-id"
|
||||
style={
|
||||
Object {
|
||||
|
@ -446,7 +446,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
className="euiCollapsibleNavGroup__children"
|
||||
>
|
||||
<EuiListGroup
|
||||
color="text"
|
||||
color="ghost"
|
||||
gutterSize="none"
|
||||
listItems={
|
||||
Array [
|
||||
|
@ -454,6 +454,9 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
"data-test-subj": "collapsibleNavCustomNavLink",
|
||||
"href": "Custom link",
|
||||
"icon": undefined,
|
||||
"iconProps": Object {
|
||||
"color": "ghost",
|
||||
},
|
||||
"iconType": undefined,
|
||||
"isActive": false,
|
||||
"isDisabled": undefined,
|
||||
|
@ -474,9 +477,14 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
}
|
||||
>
|
||||
<EuiListGroupItem
|
||||
color="text"
|
||||
color="ghost"
|
||||
data-test-subj="collapsibleNavCustomNavLink"
|
||||
href="Custom link"
|
||||
iconProps={
|
||||
Object {
|
||||
"color": "ghost",
|
||||
}
|
||||
}
|
||||
isActive={false}
|
||||
key="title-0"
|
||||
label="Custom link"
|
||||
|
@ -486,7 +494,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
wrapText={false}
|
||||
>
|
||||
<li
|
||||
className="euiListGroupItem euiListGroupItem--small euiListGroupItem--text euiListGroupItem-isClickable"
|
||||
className="euiListGroupItem euiListGroupItem--small euiListGroupItem--ghost euiListGroupItem-isClickable"
|
||||
>
|
||||
<a
|
||||
className="euiListGroupItem__button"
|
||||
|
@ -910,6 +918,8 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
className="euiFlexItem eui-yScroll"
|
||||
>
|
||||
<EuiCollapsibleNavGroup
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonElement="button"
|
||||
data-test-subj="collapsibleNavGroup-kibana"
|
||||
iconSize="m"
|
||||
iconType="logoKibana"
|
||||
|
@ -926,7 +936,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
"color": "text",
|
||||
}
|
||||
}
|
||||
buttonClassName="euiCollapsibleNavGroup__heading"
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonContent={
|
||||
<EuiFlexGroup
|
||||
alignItems="center"
|
||||
|
@ -977,7 +987,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
<button
|
||||
aria-controls="generated-id"
|
||||
aria-expanded={true}
|
||||
className="euiAccordion__button euiCollapsibleNavGroup__heading"
|
||||
className="euiAccordion__button kbnCollapsibleNav__solutionGroupButton"
|
||||
id="generated-id"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
|
@ -1231,6 +1241,8 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
</EuiAccordion>
|
||||
</EuiCollapsibleNavGroup>
|
||||
<EuiCollapsibleNavGroup
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonElement="button"
|
||||
data-test-subj="collapsibleNavGroup-observability"
|
||||
iconSize="m"
|
||||
iconType="logoObservability"
|
||||
|
@ -1247,7 +1259,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
"color": "text",
|
||||
}
|
||||
}
|
||||
buttonClassName="euiCollapsibleNavGroup__heading"
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonContent={
|
||||
<EuiFlexGroup
|
||||
alignItems="center"
|
||||
|
@ -1298,7 +1310,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
<button
|
||||
aria-controls="generated-id"
|
||||
aria-expanded={true}
|
||||
className="euiAccordion__button euiCollapsibleNavGroup__heading"
|
||||
className="euiAccordion__button kbnCollapsibleNav__solutionGroupButton"
|
||||
id="generated-id"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
|
@ -1513,6 +1525,8 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
</EuiAccordion>
|
||||
</EuiCollapsibleNavGroup>
|
||||
<EuiCollapsibleNavGroup
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonElement="button"
|
||||
data-test-subj="collapsibleNavGroup-securitySolution"
|
||||
iconSize="m"
|
||||
iconType="logoSecurity"
|
||||
|
@ -1529,7 +1543,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
"color": "text",
|
||||
}
|
||||
}
|
||||
buttonClassName="euiCollapsibleNavGroup__heading"
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonContent={
|
||||
<EuiFlexGroup
|
||||
alignItems="center"
|
||||
|
@ -1580,7 +1594,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
<button
|
||||
aria-controls="generated-id"
|
||||
aria-expanded={true}
|
||||
className="euiAccordion__button euiCollapsibleNavGroup__heading"
|
||||
className="euiAccordion__button kbnCollapsibleNav__solutionGroupButton"
|
||||
id="generated-id"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
|
@ -1756,6 +1770,8 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
</EuiAccordion>
|
||||
</EuiCollapsibleNavGroup>
|
||||
<EuiCollapsibleNavGroup
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonElement="button"
|
||||
data-test-subj="collapsibleNavGroup-management"
|
||||
iconSize="m"
|
||||
iconType="managementApp"
|
||||
|
@ -1772,7 +1788,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
"color": "text",
|
||||
}
|
||||
}
|
||||
buttonClassName="euiCollapsibleNavGroup__heading"
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
buttonContent={
|
||||
<EuiFlexGroup
|
||||
alignItems="center"
|
||||
|
@ -1823,7 +1839,7 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
<button
|
||||
aria-controls="generated-id"
|
||||
aria-expanded={true}
|
||||
className="euiAccordion__button euiCollapsibleNavGroup__heading"
|
||||
className="euiAccordion__button kbnCollapsibleNav__solutionGroupButton"
|
||||
id="generated-id"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
|
@ -2049,9 +2065,6 @@ exports[`CollapsibleNav renders links grouped by category 1`] = `
|
|||
</div>
|
||||
</div>
|
||||
</EuiCollapsibleNavGroup>
|
||||
<EuiShowFor
|
||||
sizes="none"
|
||||
/>
|
||||
</div>
|
||||
</EuiFlexItem>
|
||||
</nav>
|
||||
|
|
|
@ -1272,45 +1272,7 @@ exports[`Header renders 1`] = `
|
|||
"closed": false,
|
||||
"hasError": false,
|
||||
"isStopped": false,
|
||||
"observers": Array [
|
||||
Subscriber {
|
||||
"_parentOrParents": null,
|
||||
"_subscriptions": Array [
|
||||
SubjectSubscription {
|
||||
"_parentOrParents": [Circular],
|
||||
"_subscriptions": null,
|
||||
"closed": false,
|
||||
"subject": [Circular],
|
||||
"subscriber": [Circular],
|
||||
},
|
||||
],
|
||||
"closed": false,
|
||||
"destination": SafeSubscriber {
|
||||
"_complete": undefined,
|
||||
"_context": [Circular],
|
||||
"_error": undefined,
|
||||
"_next": [Function],
|
||||
"_parentOrParents": null,
|
||||
"_parentSubscriber": [Circular],
|
||||
"_subscriptions": null,
|
||||
"closed": false,
|
||||
"destination": Object {
|
||||
"closed": true,
|
||||
"complete": [Function],
|
||||
"error": [Function],
|
||||
"next": [Function],
|
||||
},
|
||||
"isStopped": false,
|
||||
"syncErrorThrowable": false,
|
||||
"syncErrorThrown": false,
|
||||
"syncErrorValue": null,
|
||||
},
|
||||
"isStopped": false,
|
||||
"syncErrorThrowable": true,
|
||||
"syncErrorThrown": false,
|
||||
"syncErrorValue": null,
|
||||
},
|
||||
],
|
||||
"observers": Array [],
|
||||
"thrownError": null,
|
||||
}
|
||||
}
|
||||
|
@ -4338,7 +4300,6 @@ exports[`Header renders 1`] = `
|
|||
}
|
||||
homeHref="/"
|
||||
id="generated-id"
|
||||
isLocked={true}
|
||||
isNavOpen={false}
|
||||
navLinks$={
|
||||
BehaviorSubject {
|
||||
|
|
|
@ -3,3 +3,24 @@
|
|||
max-height: $euiSize * 10;
|
||||
margin-right: -$euiSizeS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Increase the hit area of the link (anchor)
|
||||
* 2. Only show the text underline when hovering on the text/anchor portion
|
||||
*/
|
||||
|
||||
.kbnCollapsibleNav__solutionGroupButton {
|
||||
display: block; /* 1 */
|
||||
|
||||
&:hover {
|
||||
text-decoration: none; /* 2 */
|
||||
}
|
||||
}
|
||||
|
||||
.kbnCollapsibleNav__solutionGroupLink {
|
||||
display: block; /* 1 */
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline; /* 2 */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,12 @@ import {
|
|||
EuiHorizontalRule,
|
||||
EuiListGroup,
|
||||
EuiListGroupItem,
|
||||
EuiShowFor,
|
||||
EuiCollapsibleNavProps,
|
||||
EuiButton,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { groupBy, sortBy } from 'lodash';
|
||||
import React, { Fragment, useMemo, useRef } from 'react';
|
||||
import React, { Fragment, useMemo } from 'react';
|
||||
import useObservable from 'react-use/lib/useObservable';
|
||||
import * as Rx from 'rxjs';
|
||||
import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem } from '../..';
|
||||
|
@ -33,6 +32,7 @@ import {
|
|||
createRecentNavLink,
|
||||
isModifiedOrPrevented,
|
||||
createEuiButtonItem,
|
||||
createOverviewLink,
|
||||
} from './nav_link';
|
||||
function getAllCategories(allCategorizedLinks: Record<string, ChromeNavLink[]>) {
|
||||
const allCategories = {} as Record<string, AppCategory | undefined>;
|
||||
|
@ -72,7 +72,6 @@ interface Props {
|
|||
appId$: InternalApplicationStart['currentAppId$'];
|
||||
basePath: HttpStart['basePath'];
|
||||
id: string;
|
||||
isLocked: boolean;
|
||||
isNavOpen: boolean;
|
||||
homeHref: string;
|
||||
navLinks$: Rx.Observable<ChromeNavLink[]>;
|
||||
|
@ -86,10 +85,17 @@ interface Props {
|
|||
button: EuiCollapsibleNavProps['button'];
|
||||
}
|
||||
|
||||
const overviewIDsToHide = ['kibanaOverview', 'enterpriseSearch'];
|
||||
const overviewIDs = [
|
||||
...overviewIDsToHide,
|
||||
'observability-overview',
|
||||
'securitySolutionUI:overview',
|
||||
'management',
|
||||
];
|
||||
|
||||
export function CollapsibleNav({
|
||||
basePath,
|
||||
id,
|
||||
isLocked,
|
||||
isNavOpen,
|
||||
homeHref,
|
||||
storage = window.localStorage,
|
||||
|
@ -104,23 +110,29 @@ export function CollapsibleNav({
|
|||
const allowedLinks = useMemo(
|
||||
() =>
|
||||
allLinks.filter(
|
||||
// Filterting out hidden links and the integrations one in favor of a specific Add Data button at the bottom
|
||||
(link) => !link.hidden && link.id !== 'integrations'
|
||||
(link) =>
|
||||
// Filterting out hidden links,
|
||||
!link.hidden &&
|
||||
// integrations link in favor of a specific Add Data button at the bottom,
|
||||
link.id !== 'integrations' &&
|
||||
// and non-data overview pages
|
||||
!overviewIDsToHide.includes(link.id)
|
||||
),
|
||||
[allLinks]
|
||||
);
|
||||
// Find just the integrations link
|
||||
const integrationsLink = useMemo(
|
||||
() =>
|
||||
allLinks.find(
|
||||
// Find just the integrations link
|
||||
(link) => link.id === 'integrations'
|
||||
),
|
||||
() => allLinks.find((link) => link.id === 'integrations'),
|
||||
[allLinks]
|
||||
);
|
||||
// Find all the overview (landing page) links
|
||||
const overviewLinks = useMemo(
|
||||
() => allLinks.filter((link) => overviewIDs.includes(link.id)),
|
||||
[allLinks]
|
||||
);
|
||||
const recentlyAccessed = useObservable(observables.recentlyAccessed$, []);
|
||||
const customNavLink = useObservable(observables.customNavLink$, undefined);
|
||||
const appId = useObservable(observables.appId$, '');
|
||||
const lockRef = useRef<HTMLButtonElement>(null);
|
||||
const groupedNavLinks = groupBy(allowedLinks, (link) => link?.category?.id);
|
||||
const { undefined: unknowns = [], ...allCategorizedLinks } = groupedNavLinks;
|
||||
const categoryDictionary = getAllCategories(allCategorizedLinks);
|
||||
|
@ -153,7 +165,7 @@ export function CollapsibleNav({
|
|||
<Fragment>
|
||||
<EuiFlexItem grow={false} style={{ flexShrink: 0 }}>
|
||||
<EuiCollapsibleNavGroup
|
||||
background="light"
|
||||
background="dark"
|
||||
className="eui-yScroll"
|
||||
style={{ maxHeight: '40vh' }}
|
||||
>
|
||||
|
@ -166,12 +178,13 @@ export function CollapsibleNav({
|
|||
dataTestSubj: 'collapsibleNavCustomNavLink',
|
||||
onClick: closeNav,
|
||||
externalLink: true,
|
||||
iconProps: { color: 'ghost' },
|
||||
}),
|
||||
]}
|
||||
maxWidth="none"
|
||||
color="text"
|
||||
gutterSize="none"
|
||||
size="s"
|
||||
color="ghost"
|
||||
/>
|
||||
</EuiCollapsibleNavGroup>
|
||||
</EuiFlexItem>
|
||||
|
@ -270,13 +283,31 @@ export function CollapsibleNav({
|
|||
{/* Kibana, Observability, Security, and Management sections */}
|
||||
{orderedCategories.map((categoryName) => {
|
||||
const category = categoryDictionary[categoryName]!;
|
||||
const overviewLink = overviewLinks.find((link) => link.category === category);
|
||||
|
||||
return (
|
||||
<EuiCollapsibleNavGroup
|
||||
key={category.id}
|
||||
iconType={category.euiIconType}
|
||||
iconSize="m"
|
||||
title={category.label}
|
||||
buttonElement={overviewLink ? 'div' : 'button'}
|
||||
buttonClassName="kbnCollapsibleNav__solutionGroupButton"
|
||||
title={
|
||||
overviewLink ? (
|
||||
<a
|
||||
className="eui-textInheritColor kbnCollapsibleNav__solutionGroupLink"
|
||||
{...createOverviewLink({
|
||||
link: overviewLink,
|
||||
navigateToUrl,
|
||||
onClick: closeNav,
|
||||
})}
|
||||
>
|
||||
{category.label}
|
||||
</a>
|
||||
) : (
|
||||
category.label
|
||||
)
|
||||
}
|
||||
isCollapsible={true}
|
||||
initialIsOpen={getIsCategoryOpen(category.id, storage)}
|
||||
onToggle={(isCategoryOpen) => setIsCategoryOpen(category.id, isCategoryOpen, storage)}
|
||||
|
@ -305,45 +336,6 @@ export function CollapsibleNav({
|
|||
</EuiListGroup>
|
||||
</EuiCollapsibleNavGroup>
|
||||
))}
|
||||
|
||||
{/* Docking button only for larger screens that can support it*/}
|
||||
<EuiShowFor sizes={'none'}>
|
||||
<EuiCollapsibleNavGroup>
|
||||
<EuiListGroup flush>
|
||||
<EuiListGroupItem
|
||||
data-test-subj="collapsible-nav-lock"
|
||||
buttonRef={lockRef}
|
||||
size="xs"
|
||||
color="subdued"
|
||||
label={
|
||||
isLocked
|
||||
? i18n.translate('core.ui.primaryNavSection.undockLabel', {
|
||||
defaultMessage: 'Undock navigation',
|
||||
})
|
||||
: i18n.translate('core.ui.primaryNavSection.dockLabel', {
|
||||
defaultMessage: 'Dock navigation',
|
||||
})
|
||||
}
|
||||
aria-label={
|
||||
isLocked
|
||||
? i18n.translate('core.ui.primaryNavSection.undockAriaLabel', {
|
||||
defaultMessage: 'Undock primary navigation',
|
||||
})
|
||||
: i18n.translate('core.ui.primaryNavSection.dockAriaLabel', {
|
||||
defaultMessage: 'Dock primary navigation',
|
||||
})
|
||||
}
|
||||
onClick={() => {
|
||||
onIsLockedUpdate(!isLocked);
|
||||
if (lockRef.current) {
|
||||
lockRef.current.focus();
|
||||
}
|
||||
}}
|
||||
iconType={isLocked ? 'lock' : 'lockOpen'}
|
||||
/>
|
||||
</EuiListGroup>
|
||||
</EuiCollapsibleNavGroup>
|
||||
</EuiShowFor>
|
||||
</EuiFlexItem>
|
||||
{integrationsLink && (
|
||||
<EuiFlexItem grow={false}>
|
||||
|
@ -355,7 +347,6 @@ export function CollapsibleNav({
|
|||
link: integrationsLink,
|
||||
navigateToUrl,
|
||||
onClick: closeNav,
|
||||
dataTestSubj: `collapsibleNavAppButton-${integrationsLink.id}`,
|
||||
})}
|
||||
fill
|
||||
fullWidth
|
||||
|
|
|
@ -84,7 +84,6 @@ export function Header({
|
|||
...observables
|
||||
}: HeaderProps) {
|
||||
const isVisible = useObservable(observables.isVisible$, false);
|
||||
const isLocked = useObservable(observables.isLocked$, false);
|
||||
const [isNavOpen, setIsNavOpen] = useState(false);
|
||||
const [navId] = useState(htmlIdGenerator()());
|
||||
const breadcrumbsAppendExtension = useObservable(breadcrumbsAppendExtension$);
|
||||
|
@ -160,7 +159,6 @@ export function Header({
|
|||
<CollapsibleNav
|
||||
appId$={application.currentAppId$}
|
||||
id={navId}
|
||||
isLocked={isLocked}
|
||||
navLinks$={observables.navLinks$}
|
||||
recentlyAccessed$={observables.recentlyAccessed$}
|
||||
isNavOpen={isNavOpen}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
import { EuiIcon, EuiListGroupItemProps } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem, CoreStart } from '../../..';
|
||||
|
@ -21,10 +21,11 @@ interface Props {
|
|||
link: ChromeNavLink;
|
||||
appId?: string;
|
||||
basePath?: HttpStart['basePath'];
|
||||
dataTestSubj: string;
|
||||
dataTestSubj?: string;
|
||||
onClick?: Function;
|
||||
navigateToUrl: CoreStart['application']['navigateToUrl'];
|
||||
externalLink?: boolean;
|
||||
iconProps?: EuiListGroupItemProps['iconProps'];
|
||||
}
|
||||
|
||||
// TODO #64541
|
||||
|
@ -39,7 +40,8 @@ export function createEuiListItem({
|
|||
navigateToUrl,
|
||||
dataTestSubj,
|
||||
externalLink = false,
|
||||
}: Props) {
|
||||
iconProps,
|
||||
}: Props): EuiListGroupItemProps {
|
||||
const { href, id, title, disabled, euiIconType, icon, tooltip, url } = link;
|
||||
|
||||
return {
|
||||
|
@ -60,11 +62,12 @@ export function createEuiListItem({
|
|||
navigateToUrl(url);
|
||||
}
|
||||
},
|
||||
isActive: appId === id,
|
||||
isActive: !externalLink && appId === id,
|
||||
isDisabled: disabled,
|
||||
'data-test-subj': dataTestSubj,
|
||||
...(basePath && {
|
||||
iconType: euiIconType,
|
||||
iconProps,
|
||||
icon:
|
||||
!euiIconType && icon ? <EuiIcon type={basePath.prepend(`/${icon}`)} size="m" /> : undefined,
|
||||
}),
|
||||
|
@ -77,7 +80,7 @@ export function createEuiButtonItem({
|
|||
navigateToUrl,
|
||||
dataTestSubj,
|
||||
}: Omit<Props, 'appId' | 'basePath'>) {
|
||||
const { href, disabled, url } = link;
|
||||
const { href, disabled, url, id } = link;
|
||||
|
||||
return {
|
||||
href,
|
||||
|
@ -90,7 +93,30 @@ export function createEuiButtonItem({
|
|||
navigateToUrl(url);
|
||||
},
|
||||
isDisabled: disabled,
|
||||
'data-test-subj': dataTestSubj,
|
||||
dataTestSubj: `collapsibleNavAppButton-${id}`,
|
||||
};
|
||||
}
|
||||
|
||||
export function createOverviewLink({
|
||||
link,
|
||||
onClick = () => {},
|
||||
navigateToUrl,
|
||||
}: Omit<Props, 'appId' | 'basePath'>) {
|
||||
const { href, url } = link;
|
||||
|
||||
return {
|
||||
href,
|
||||
/* Use href and onClick to support "open in new tab" and SPA navigation in the same link */
|
||||
onClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
|
||||
// Prevent the accordions from opening or closing when clicking just the link
|
||||
event.stopPropagation();
|
||||
if (!isModifiedOrPrevented(event)) {
|
||||
onClick();
|
||||
}
|
||||
event.preventDefault();
|
||||
navigateToUrl(url);
|
||||
},
|
||||
'data-test-subj': `collapsibleNavAppLink-overview`,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ describe('Cloud Plugin', () => {
|
|||
expect(coreStart.chrome.setCustomNavLink.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"euiIconType": "arrowLeft",
|
||||
"euiIconType": "logoCloud",
|
||||
"href": "https://cloud.elastic.co/abc123",
|
||||
"title": "Manage this deployment",
|
||||
},
|
||||
|
@ -370,7 +370,7 @@ describe('Cloud Plugin', () => {
|
|||
expect(coreStart.chrome.setCustomNavLink.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"euiIconType": "arrowLeft",
|
||||
"euiIconType": "logoCloud",
|
||||
"href": "https://cloud.elastic.co/abc123",
|
||||
"title": "Manage this deployment",
|
||||
},
|
||||
|
|
|
@ -131,7 +131,7 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
title: i18n.translate('xpack.cloud.deploymentLinkLabel', {
|
||||
defaultMessage: 'Manage this deployment',
|
||||
}),
|
||||
euiIconType: 'arrowLeft',
|
||||
euiIconType: 'logoCloud',
|
||||
href: getFullCloudUrl(baseUrl, deploymentUrl),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1359,11 +1359,7 @@
|
|||
"core.ui.primaryNav.pinnedLinksAriaLabel": "ピン留めされたリンク",
|
||||
"core.ui.primaryNav.screenReaderLabel": "プライマリ",
|
||||
"core.ui.primaryNav.toggleNavAriaLabel": "プライマリナビゲーションを切り替える",
|
||||
"core.ui.primaryNavSection.dockAriaLabel": "プライマリナビゲーションリンクを固定する",
|
||||
"core.ui.primaryNavSection.dockLabel": "ナビゲーションを固定する",
|
||||
"core.ui.primaryNavSection.screenReaderLabel": "プライマリナビゲーションリンク、{category}",
|
||||
"core.ui.primaryNavSection.undockAriaLabel": "プライマリナビゲーションリンクの固定を解除する",
|
||||
"core.ui.primaryNavSection.undockLabel": "ナビゲーションの固定を解除する",
|
||||
"core.ui.publicBaseUrlWarning.configMissingDescription": "{configKey}が見つかりません。本番環境を実行するときに構成してください。一部の機能が正常に動作しない場合があります。",
|
||||
"core.ui.publicBaseUrlWarning.configMissingTitle": "構成がありません",
|
||||
"core.ui.publicBaseUrlWarning.muteWarningButtonLabel": "ミュート警告",
|
||||
|
|
|
@ -1375,11 +1375,7 @@
|
|||
"core.ui.primaryNav.pinnedLinksAriaLabel": "置顶链接",
|
||||
"core.ui.primaryNav.screenReaderLabel": "主分片",
|
||||
"core.ui.primaryNav.toggleNavAriaLabel": "切换主导航",
|
||||
"core.ui.primaryNavSection.dockAriaLabel": "停靠主导航",
|
||||
"core.ui.primaryNavSection.dockLabel": "停靠导航",
|
||||
"core.ui.primaryNavSection.screenReaderLabel": "主导航链接, {category}",
|
||||
"core.ui.primaryNavSection.undockAriaLabel": "取消停靠主导航",
|
||||
"core.ui.primaryNavSection.undockLabel": "取消停靠导航",
|
||||
"core.ui.publicBaseUrlWarning.configMissingDescription": "{configKey} 缺失,在生产环境中运行时应配置。某些功能可能运行不正常。",
|
||||
"core.ui.publicBaseUrlWarning.configMissingTitle": "配置缺失",
|
||||
"core.ui.publicBaseUrlWarning.muteWarningButtonLabel": "静音警告",
|
||||
|
|
|
@ -177,7 +177,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('does not show Management navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Discover']);
|
||||
expect(navLinks).to.eql(['Discover']);
|
||||
});
|
||||
|
||||
it(`does not allow navigation to advanced settings; shows "not found" error`, async () => {
|
||||
|
|
|
@ -67,7 +67,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows canvas navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Canvas']);
|
||||
expect(navLinks).to.eql(['Canvas']);
|
||||
});
|
||||
|
||||
it(`landing page shows "Create new workpad" button`, async () => {
|
||||
|
@ -142,7 +142,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows canvas navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Canvas']);
|
||||
expect(navLinks).to.eql(['Canvas']);
|
||||
});
|
||||
|
||||
it(`landing page shows disabled "Create new workpad" button`, async () => {
|
||||
|
|
|
@ -89,11 +89,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('only shows the dashboard navlink', async () => {
|
||||
const navLinks = await appsMenu.readLinks();
|
||||
expect(navLinks.map((link) => link.text)).to.eql([
|
||||
'Overview',
|
||||
'Dashboard',
|
||||
'Stack Management',
|
||||
]);
|
||||
expect(navLinks.map((link) => link.text)).to.eql(['Dashboard', 'Stack Management']);
|
||||
});
|
||||
|
||||
it(`landing page shows "Create new Dashboard" button`, async () => {
|
||||
|
@ -296,7 +292,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows dashboard navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Dashboard']);
|
||||
expect(navLinks).to.eql(['Dashboard']);
|
||||
});
|
||||
|
||||
it(`landing page doesn't show "Create new Dashboard" button`, async () => {
|
||||
|
@ -427,7 +423,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows dashboard navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Dashboard']);
|
||||
expect(navLinks).to.eql(['Dashboard']);
|
||||
});
|
||||
|
||||
it(`landing page doesn't show "Create new Dashboard" button`, async () => {
|
||||
|
|
|
@ -91,7 +91,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
it('shows discover navlink', async () => {
|
||||
const navLinks = await appsMenu.readLinks();
|
||||
expect(navLinks.map((link) => link.text)).to.eql([
|
||||
'Overview',
|
||||
'Discover',
|
||||
'Stack Management', // because `global_discover_all_role` enables search sessions and reporting
|
||||
]);
|
||||
|
@ -201,7 +200,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows discover navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Discover']);
|
||||
expect(navLinks).to.eql(['Discover']);
|
||||
});
|
||||
|
||||
it(`doesn't show save button`, async () => {
|
||||
|
@ -293,7 +292,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows discover navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Discover']);
|
||||
expect(navLinks).to.eql(['Discover']);
|
||||
});
|
||||
|
||||
it(`doesn't show save button`, async () => {
|
||||
|
|
|
@ -67,7 +67,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows graph navlink', async () => {
|
||||
const navLinks = await appsMenu.readLinks();
|
||||
expect(navLinks.map((link) => link.text)).to.eql(['Overview', 'Graph']);
|
||||
expect(navLinks.map((link) => link.text)).to.eql(['Graph']);
|
||||
});
|
||||
|
||||
it('landing page shows "Create new graph" button', async () => {
|
||||
|
@ -130,7 +130,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows graph navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Graph']);
|
||||
expect(navLinks).to.eql(['Graph']);
|
||||
});
|
||||
|
||||
it('does not show a "Create new Workspace" button', async () => {
|
||||
|
|
|
@ -179,7 +179,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('does not show Management navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Discover']);
|
||||
expect(navLinks).to.eql(['Discover']);
|
||||
});
|
||||
|
||||
it(`doesn't show Index Patterns in management side-nav`, async () => {
|
||||
|
|
|
@ -36,7 +36,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('should not show the Stack Management nav link', async () => {
|
||||
const links = await appsMenu.readLinks();
|
||||
expect(links.map((link) => link.text)).to.eql(['Overview', 'Dashboard']);
|
||||
expect(links.map((link) => link.text)).to.eql(['Dashboard']);
|
||||
});
|
||||
|
||||
it('should render the "application not found" view when navigating to management directly', async () => {
|
||||
|
|
|
@ -165,7 +165,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows Maps navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Maps']);
|
||||
expect(navLinks).to.eql(['Maps']);
|
||||
});
|
||||
|
||||
it(`does not show create new button`, async () => {
|
||||
|
|
|
@ -214,7 +214,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows visualize navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Visualize Library']);
|
||||
expect(navLinks).to.eql(['Visualize Library']);
|
||||
});
|
||||
|
||||
it(`landing page shows "Create new Visualization" button`, async () => {
|
||||
|
@ -329,7 +329,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
|
||||
it('shows visualize navlink', async () => {
|
||||
const navLinks = (await appsMenu.readLinks()).map((link) => link.text);
|
||||
expect(navLinks).to.eql(['Overview', 'Visualize Library']);
|
||||
expect(navLinks).to.eql(['Visualize Library']);
|
||||
});
|
||||
|
||||
it(`landing page shows "Create new Visualization" button`, async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue