Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-66164
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 13, 2020
2 parents d5710fb + ef94e02 commit 86dc34c
Show file tree
Hide file tree
Showing 539 changed files with 4,985 additions and 3,451 deletions.
1 change: 1 addition & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ files:
- 'x-pack/plugins/cross_cluster_replication/**/*.s+(a|c)ss'
- 'x-pack/legacy/plugins/maps/**/*.s+(a|c)ss'
- 'x-pack/plugins/maps/**/*.s+(a|c)ss'
- 'x-pack/plugins/spaces/**/*.s+(a|c)ss'
ignore:
- 'x-pack/plugins/canvas/shareable_runtime/**/*.s+(a|c)ss'
rules:
Expand Down
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,34 @@ extract them to a `JSON` file or integrate translations back to Kibana. To know
We cannot support accepting contributions to the translations from any source other than the translators we have engaged to do the work.
We are still to develop a proper process to accept any contributed translations. We certainly appreciate that people care enough about the localization effort to want to help improve the quality. We aim to build out a more comprehensive localization process for the future and will notify you once contributions can be supported, but for the time being, we are not able to incorporate suggestions.

### Syling with SASS

When writing a new component, create a sibling SASS file of the same name and import directly into the JS/TS component file. Doing so ensures the styles are never separated or lost on import and allows for better modularization (smaller individual plugin asset footprint).

Any JavaScript (or TypeScript) file that imports SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass) & Kibana invisibles (SASS variables, mixins, functions) from the [`styling_constants.scss` file](https://github.com/elastic/kibana/blob/master/src/legacy/ui/public/styles/_styling_constants.scss). However, any Legacy (file path includes `/legacy`) files will not.

**Example:**

```tsx
// component.tsx

import './component.scss';

export const Component = () => {
return (
<div className="plgComponent" />
);
}
```

```scss
// component.scss

.plgComponent { ... }
```

Do not use the underscore `_` SASS file naming pattern when importing directly into a javascript file.

### Testing and Building

To ensure that your changes will not break other functionality, please run the test suite and build process before submitting your Pull Request.
Expand Down
8 changes: 4 additions & 4 deletions docs/api/features.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The API returns the following:
"id": "discover",
"name": "Discover",
"icon": "discoverApp",
"navLinkId": "kibana:discover",
"navLinkId": "discover",
"app": [
"kibana"
],
Expand Down Expand Up @@ -74,7 +74,7 @@ The API returns the following:
"id": "visualize",
"name": "Visualize",
"icon": "visualizeApp",
"navLinkId": "kibana:visualize",
"navLinkId": "visualize",
"app": [
"kibana"
],
Expand Down Expand Up @@ -121,7 +121,7 @@ The API returns the following:
"id": "dashboard",
"name": "Dashboard",
"icon": "dashboardApp",
"navLinkId": "kibana:dashboard",
"navLinkId": "dashboards",
"app": [
"kibana"
],
Expand Down Expand Up @@ -173,7 +173,7 @@ The API returns the following:
"id": "dev_tools",
"name": "Dev Tools",
"icon": "devToolsApp",
"navLinkId": "kibana:dev_tools",
"navLinkId": "dev_tools",
"app": [
"kibana"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ init(server) {
defaultMessage: 'Dev Tools',
}),
icon: 'devToolsApp',
navLinkId: 'kibana:dev_tools',
navLinkId: 'dev_tools',
app: ['kibana'],
catalogue: ['console', 'searchprofiler', 'grokdebugger'],
privileges: {
Expand Down Expand Up @@ -216,7 +216,7 @@ init(server) {
}),
order: 100,
icon: 'discoverApp',
navLinkId: 'kibana:discover',
navLinkId: 'discover',
app: ['kibana'],
catalogue: ['discover'],
privileges: {
Expand Down
2 changes: 0 additions & 2 deletions docs/release-notes/highlights-7.7.0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

Explore the new features in Kibana 7.7.

coming::[7.7.0]

//NOTE: The notable-highlights tagged regions are re-used in the
//Installation and Upgrade Guide

Expand Down
1 change: 1 addition & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,4 @@ include::{docdir}/settings/reporting-settings.asciidoc[]
include::secure-settings.asciidoc[]
include::{docdir}/settings/security-settings.asciidoc[]
include::{docdir}/settings/spaces-settings.asciidoc[]
include::{docdir}/settings/telemetry-settings.asciidoc[]
2 changes: 1 addition & 1 deletion docs/user/dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ to view an embedded dashboard.
* Generate a PNG report

TIP: To create a link to a dashboard by title, use: +
`${domain}/${basepath?}/app/kibana#/dashboards?title=${yourdashboardtitle}`
`${domain}/${basepath?}/app/dashboards#/list?title=${yourdashboardtitle}`

TIP: When sharing a link to a dashboard snapshot, use the *Short URL*. Snapshot
URLs are long and can be problematic for Internet Explorer and other
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-plugin-helpers/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,4 @@ program
}))
);

program.command('postinstall').action(createCommanderAction('postinstall'));

program.parse(process.argv);
2 changes: 0 additions & 2 deletions packages/kbn-plugin-helpers/lib/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ const startTask = require('../tasks/start');
const testAllTask = require('../tasks/test/all');
const testKarmaTask = require('../tasks/test/karma');
const testMochaTask = require('../tasks/test/mocha');
const postinstallTask = require('../tasks/postinstall');

module.exports = {
build: buildTask,
start: startTask,
testAll: testAllTask,
testKarma: testKarmaTask,
testMocha: testMochaTask,
postinstall: postinstallTask,
};
4 changes: 2 additions & 2 deletions src/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Core is a set of systems (frontend, backend etc.) that Kibana and its plugins ar

## Plugin development
Core Plugin API Documentation:
- [Core Public API](/docs/development/core/public/kibana-plugin-public.md)
- [Core Server API](/docs/development/core/server/kibana-plugin-server.md)
- [Core Public API](/docs/development/core/public/kibana-plugin-core-public.md)
- [Core Server API](/docs/development/core/server/kibana-plugin-core-server.md)
- [Migration guide for porting existing plugins](./MIGRATION.md)

## Integration with the "legacy" Kibana
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class ChromeService {
forceAppSwitcherNavigation$={navLinks.getForceAppSwitcherNavigation$()}
helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))}
helpSupportUrl$={helpSupportUrl$.pipe(takeUntil(this.stop$))}
homeHref={http.basePath.prepend('/app/kibana#/home')}
homeHref={http.basePath.prepend('/app/home')}
isVisible$={this.isVisible$}
kibanaVersion={injectedMetadata.getKibanaVersion()}
legacyMode={injectedMetadata.getLegacyMode()}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/core/public/chrome/ui/header/collapsible_nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function mockProps() {
storage: new StubBrowserStorage(),
onIsOpenUpdate: () => {},
onIsLockedUpdate: () => {},
navigateToApp: () => {},
};
}

Expand Down
16 changes: 15 additions & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ interface Props {
storage?: Storage;
onIsLockedUpdate: OnIsLockedUpdate;
onIsOpenUpdate: (isOpen?: boolean) => void;
navigateToApp: (appId: string) => void;
}

export function CollapsibleNav({
Expand All @@ -89,6 +90,7 @@ export function CollapsibleNav({
onIsOpenUpdate,
homeHref,
id,
navigateToApp,
storage = window.localStorage,
}: Props) {
const lockRef = useRef<HTMLButtonElement>(null);
Expand Down Expand Up @@ -124,7 +126,19 @@ export function CollapsibleNav({
label: 'Home',
iconType: 'home',
href: homeHref,
onClick: () => onIsOpenUpdate(false),
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
onIsOpenUpdate(false);
if (
event.isDefaultPrevented() ||
event.altKey ||
event.metaKey ||
event.ctrlKey
) {
return;
}
event.preventDefault();
navigateToApp('home');
},
},
]}
maxWidth="none"
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export class Header extends Component<HeaderProps, State> {
href={this.props.homeHref}
forceNavigation={this.state.forceNavigation}
navLinks={navLinks}
navigateToApp={this.props.application.navigateToApp}
/>
</EuiHeaderSectionItem>

Expand Down Expand Up @@ -287,6 +288,7 @@ export class Header extends Component<HeaderProps, State> {
this.toggleCollapsibleNavRef.current.focus();
}
}}
navigateToApp={this.props.application.navigateToApp}
/>
) : (
// TODO #64541
Expand Down
49 changes: 25 additions & 24 deletions src/core/public/chrome/ui/header/header_logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void {
function onClick(
event: React.MouseEvent<HTMLAnchorElement>,
forceNavigation: boolean,
navLinks: NavLink[]
navLinks: NavLink[],
navigateToApp: (appId: string) => void
) {
const anchor = findClosestAnchor((event as any).nativeEvent.target);
if (!anchor) {
Expand All @@ -54,47 +55,47 @@ function onClick(
return;
}

if (
!forceNavigation ||
event.isDefaultPrevented() ||
event.altKey ||
event.metaKey ||
event.ctrlKey
) {
if (event.isDefaultPrevented() || event.altKey || event.metaKey || event.ctrlKey) {
return;
}

const toParsed = Url.parse(anchor.href);
const fromParsed = Url.parse(document.location.href);
const sameProto = toParsed.protocol === fromParsed.protocol;
const sameHost = toParsed.host === fromParsed.host;
const samePath = toParsed.path === fromParsed.path;
if (forceNavigation) {
const toParsed = Url.parse(anchor.href);
const fromParsed = Url.parse(document.location.href);
const sameProto = toParsed.protocol === fromParsed.protocol;
const sameHost = toParsed.host === fromParsed.host;
const samePath = toParsed.path === fromParsed.path;

if (sameProto && sameHost && samePath) {
if (toParsed.hash) {
document.location.reload();
}
if (sameProto && sameHost && samePath) {
if (toParsed.hash) {
document.location.reload();
}

// event.preventDefault() keeps the browser from seeing the new url as an update
// and even setting window.location does not mimic that behavior, so instead
// we use stopPropagation() to prevent angular from seeing the click and
// starting a digest cycle/attempting to handle it in the router.
event.stopPropagation();
// event.preventDefault() keeps the browser from seeing the new url as an update
// and even setting window.location does not mimic that behavior, so instead
// we use stopPropagation() to prevent angular from seeing the click and
// starting a digest cycle/attempting to handle it in the router.
event.stopPropagation();
}
} else {
navigateToApp('home');
event.preventDefault();
}
}

interface Props {
href: string;
navLinks: NavLink[];
forceNavigation: boolean;
navigateToApp: (appId: string) => void;
}

export function HeaderLogo({ href, forceNavigation, navLinks }: Props) {
export function HeaderLogo({ href, forceNavigation, navLinks, navigateToApp }: Props) {
return (
<EuiHeaderLogo
data-test-subj="logo"
iconType="logoElastic"
onClick={e => onClick(e, forceNavigation, navLinks)}
onClick={e => onClick(e, forceNavigation, navLinks, navigateToApp)}
href={href}
aria-label={i18n.translate('core.ui.chrome.headerGlobalNav.goHomePageIconAriaLabel', {
defaultMessage: 'Go to home page',
Expand Down
11 changes: 11 additions & 0 deletions src/core/server/core_app/core_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ export class CoreApp {
router.get({ path: '/core', validate: false }, async (context, req, res) =>
res.ok({ body: { version: '0.0.1' } })
);

coreSetup.savedObjects.registerType({
name: 'server',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
uuid: { type: 'keyword' },
},
},
});
}
private registerStaticDirs(coreSetup: InternalCoreSetup) {
coreSetup.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('default route provider', () => {

expect(status).toEqual(302);
expect(header).toMatchObject({
location: '/hello/app/kibana',
location: '/hello/app/home',
});
});

Expand All @@ -71,7 +71,7 @@ describe('default route provider', () => {
const { status, header } = await kbnTestServer.request.get(root, '/');
expect(status).toEqual(302);
expect(header).toMatchObject({
location: '/hello/app/kibana',
location: '/hello/app/home',
});
});

Expand Down
Loading

0 comments on commit 86dc34c

Please sign in to comment.