Skip to content

Commit

Permalink
Merge branch 'master' into ilm/cloud-callout-for-warm-and-cold-tier
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 15, 2020
2 parents 7981a7f + 1bcbac7 commit 76985c2
Show file tree
Hide file tree
Showing 128 changed files with 1,775 additions and 973 deletions.
16 changes: 8 additions & 8 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
# used for the 'team' designator within Kibana Stats

# App
/x-pack/plugins/dashboard_enhanced/ @elastic/kibana-app
/x-pack/plugins/discover_enhanced/ @elastic/kibana-app
/x-pack/plugins/lens/ @elastic/kibana-app
/x-pack/plugins/graph/ @elastic/kibana-app
/src/plugins/advanced_settings/ @elastic/kibana-app
/src/plugins/charts/ @elastic/kibana-app
/src/plugins/dashboard/ @elastic/kibana-app
/src/plugins/discover/ @elastic/kibana-app
/src/plugins/input_control_vis/ @elastic/kibana-app
/src/plugins/management/ @elastic/kibana-app
/src/plugins/kibana_legacy/ @elastic/kibana-app
/src/plugins/timelion/ @elastic/kibana-app
/src/plugins/vis_default_editor/ @elastic/kibana-app
/src/plugins/vis_type_markdown/ @elastic/kibana-app
/src/plugins/vis_type_metric/ @elastic/kibana-app
/src/plugins/vis_type_table/ @elastic/kibana-app
/src/plugins/vis_type_tagcloud/ @elastic/kibana-app
Expand All @@ -35,19 +31,15 @@
#CC# /src/legacy/core_plugins/kibana/common/utils @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/migrations @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/input_control_vis @elastic/kibana-app
#CC# /src/legacy/core_plugins/timelion @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_tagcloud @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vega @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
#CC# /src/legacy/server/url_shortening/ @elastic/kibana-app
#CC# /src/legacy/ui/public/state_management @elastic/kibana-app
#CC# /src/plugins/index_pattern_management/public @elastic/kibana-app
#CC# /x-pack/legacy/plugins/dashboard_mode/ @elastic/kibana-app
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-app

# App Architecture
/examples/bfetch_explorer/ @elastic/kibana-app-arch
Expand Down Expand Up @@ -127,10 +119,18 @@
#CC# /x-pack/plugins/beats_management/ @elastic/beats

# Canvas
/src/plugins/dashboard/ @elastic/kibana-app
/src/plugins/input_control_vis/ @elastic/kibana-app
/src/plugins/vis_type_markdown/ @elastic/kibana-app
/x-pack/plugins/canvas/ @elastic/kibana-canvas
/x-pack/plugins/dashboard_enhanced/ @elastic/kibana-app
/x-pack/test/functional/apps/canvas/ @elastic/kibana-canvas
#CC# /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/input_control_vis @elastic/kibana-app
#CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-canvas
#CC# /x-pack/legacy/plugins/canvas/ @elastic/kibana-canvas
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-app
#CC# /x-pack/legacy/plugins/dashboard_mode/ @elastic/kibana-app

# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon
Expand Down
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/security_solution_bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Security Solution Bug Report
about: Things break. Help us identify those things so we can fix them!
title: '[Security Solution]'
---

**Describe the bug:**

**Kibana/Elasticsearch Stack version:**

**Server OS version:**

**Browser and Browser OS versions:**

**Elastic Endpoint version:**

**Original install method (e.g. download page, yum, from source, etc.):**

**Functional Area (e.g. Endpoint management, timelines, resolver, etc.):**

**Steps to reproduce:**

1.
2.
3.

**Current behavior:**

**Expected behavior:**

**Screenshots (if relevant):**

**Errors in browser console (if relevant):**

**Provide logs and/or server output (if relevant):**

**Any additional context (logs, chat logs, magical formulas, etc.):**
2 changes: 1 addition & 1 deletion docs/fleet/fleet.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[[fleet]]
= {fleet}

experimental[]
beta[]

{fleet} in {kib} enables you to add and manage integrations for popular
services and platforms, as well as manage {elastic-agent} installations in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,33 @@ function generator({
#
set -euo pipefail
docker pull ${baseOSImage}
retry_docker_pull() {
image=$1
attempt=0
max_retries=5
while true
do
attempt=$((attempt+1))
if [ $attempt -gt $max_retries ]
then
echo "Docker pull retries exceeded, aborting."
exit 1
fi
if docker pull "$image"
then
echo "Docker pull successful."
break
else
echo "Docker pull unsuccessful, attempt '$attempt'."
fi
done
}
retry_docker_pull ${baseOSImage}
echo "Building: kibana${imageFlavor}${ubiImageFlavor}-docker"; \\
docker build -t ${imageTag}${imageFlavor}${ubiImageFlavor}:${version} -f Dockerfile . || exit 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ beforeEach(async () => {
});

test('Add to library is compatible when embeddable on dashboard has value type input', async () => {
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
embeddable.updateInput(await embeddable.getInputAsValueType());
expect(await action.isCompatible({ embeddable })).toBe(true);
});

test('Add to library is not compatible when embeddable input is by reference', async () => {
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
embeddable.updateInput(await embeddable.getInputAsRefType());
expect(await action.isCompatible({ embeddable })).toBe(false);
});

test('Add to library is not compatible when view mode is set to view', async () => {
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
embeddable.updateInput(await embeddable.getInputAsRefType());
embeddable.updateInput({ viewMode: ViewMode.VIEW });
expect(await action.isCompatible({ embeddable })).toBe(false);
Expand All @@ -120,15 +120,15 @@ test('Add to library is not compatible when embeddable is not in a dashboard con
mockedByReferenceInput: { savedObjectId: 'test', id: orphanContactCard.id },
mockedByValueInput: { firstName: 'Kibanana', id: orphanContactCard.id },
});
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
expect(await action.isCompatible({ embeddable: orphanContactCard })).toBe(false);
});

test('Add to library replaces embeddableId but retains panel count', async () => {
const dashboard = embeddable.getRoot() as IContainer;
const originalPanelCount = Object.keys(dashboard.getInput().panels).length;
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
await action.execute({ embeddable });
expect(Object.keys(container.getInput().panels).length).toEqual(originalPanelCount);

Expand All @@ -154,7 +154,7 @@ test('Add to library returns reference type input', async () => {
});
const dashboard = embeddable.getRoot() as IContainer;
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
const action = new AddToLibraryAction();
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
await action.execute({ embeddable });
const newPanelId = Object.keys(container.getInput().panels).find(
(key) => !originalPanelKeySet.has(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EmbeddableInput,
isReferenceOrValueEmbeddable,
} from '../../../../embeddable/public';
import { NotificationsStart } from '../../../../../core/public';
import { DashboardPanelState, DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '..';

export const ACTION_ADD_TO_LIBRARY = 'addToFromLibrary';
Expand All @@ -40,7 +41,7 @@ export class AddToLibraryAction implements ActionByType<typeof ACTION_ADD_TO_LIB
public readonly id = ACTION_ADD_TO_LIBRARY;
public order = 15;

constructor() {}
constructor(private deps: { toasts: NotificationsStart['toasts'] }) {}

public getDisplayName({ embeddable }: AddToLibraryActionContext) {
if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) {
Expand Down Expand Up @@ -89,5 +90,14 @@ export class AddToLibraryAction implements ActionByType<typeof ACTION_ADD_TO_LIB
explicitInput: { ...newInput, id: uuid.v4() },
};
dashboard.replacePanel(panelToReplace, newPanel);

const title = i18n.translate('dashboard.panel.addToLibrary.successMessage', {
defaultMessage: `Panel '{panelTitle}' was added to the visualize library`,
values: { panelTitle: embeddable.getTitle() },
});
this.deps.toasts.addSuccess({
title,
'data-test-subj': 'unlinkPanelSuccess',
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '../../embeddable_plugin_test_samples';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'kibana/public';
import { LibraryNotificationAction } from '.';
import { LibraryNotificationAction, UnlinkFromLibraryAction } from '.';
import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
import { ViewMode } from '../../../../embeddable/public';

Expand All @@ -42,9 +42,16 @@ const start = doStart();
let container: DashboardContainer;
let embeddable: ContactCardEmbeddable & ReferenceOrValueEmbeddable;
let coreStart: CoreStart;
let unlinkAction: UnlinkFromLibraryAction;

beforeEach(async () => {
coreStart = coreMock.createStart();

unlinkAction = ({
getDisplayName: () => 'unlink from dat library',
execute: jest.fn(),
} as unknown) as UnlinkFromLibraryAction;

const containerOptions = {
ExitFullScreenButton: () => null,
SavedObjectFinder: () => null,
Expand Down Expand Up @@ -81,19 +88,19 @@ beforeEach(async () => {
});

test('Notification is shown when embeddable on dashboard has reference type input', async () => {
const action = new LibraryNotificationAction();
const action = new LibraryNotificationAction(unlinkAction);
embeddable.updateInput(await embeddable.getInputAsRefType());
expect(await action.isCompatible({ embeddable })).toBe(true);
});

test('Notification is not shown when embeddable input is by value', async () => {
const action = new LibraryNotificationAction();
const action = new LibraryNotificationAction(unlinkAction);
embeddable.updateInput(await embeddable.getInputAsValueType());
expect(await action.isCompatible({ embeddable })).toBe(false);
});

test('Notification is not shown when view mode is set to view', async () => {
const action = new LibraryNotificationAction();
const action = new LibraryNotificationAction(unlinkAction);
embeddable.updateInput(await embeddable.getInputAsRefType());
embeddable.updateInput({ viewMode: ViewMode.VIEW });
expect(await action.isCompatible({ embeddable })).toBe(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
* under the License.
*/

import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiBadge } from '@elastic/eui';
import React from 'react';
import { IEmbeddable, ViewMode, isReferenceOrValueEmbeddable } from '../../embeddable_plugin';
import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
import { reactToUiComponent } from '../../../../kibana_react/public';
import { UnlinkFromLibraryAction } from '.';
import { LibraryNotificationPopover } from './library_notification_popover';

export const ACTION_LIBRARY_NOTIFICATION = 'ACTION_LIBRARY_NOTIFICATION';

Expand All @@ -35,23 +36,32 @@ export class LibraryNotificationAction implements ActionByType<typeof ACTION_LIB
public readonly type = ACTION_LIBRARY_NOTIFICATION;
public readonly order = 1;

constructor(private unlinkAction: UnlinkFromLibraryAction) {}

private displayName = i18n.translate('dashboard.panel.LibraryNotification', {
defaultMessage: 'Library',
defaultMessage: 'Visualize Library',
});

private icon = 'folderCheck';

public readonly MenuItem = reactToUiComponent(() => (
<EuiBadge
data-test-subj={`embeddablePanelNotification-${this.id}`}
iconType={this.icon}
key={this.id}
style={{ marginTop: '2px', marginRight: '4px' }}
color="hollow"
>
{this.displayName}
</EuiBadge>
));
private LibraryNotification: React.FC<{ context: LibraryNotificationActionContext }> = ({
context,
}: {
context: LibraryNotificationActionContext;
}) => {
const { embeddable } = context;
return (
<LibraryNotificationPopover
unlinkAction={this.unlinkAction}
displayName={this.displayName}
context={context}
icon={this.getIconType({ embeddable })}
id={this.id}
/>
);
};

public readonly MenuItem = reactToUiComponent(this.LibraryNotification);

public getDisplayName({ embeddable }: LibraryNotificationActionContext) {
if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) {
Expand All @@ -67,16 +77,6 @@ export class LibraryNotificationAction implements ActionByType<typeof ACTION_LIB
return this.icon;
}

public getDisplayNameTooltip = ({ embeddable }: LibraryNotificationActionContext) => {
if (!embeddable.getRoot() || !embeddable.getRoot().isContainer) {
throw new IncompatibleActionError();
}
return i18n.translate('dashboard.panel.libraryNotification.toolTip', {
defaultMessage:
'This panel is linked to a Library item. Editing the panel might affect other dashboards.',
});
};

public isCompatible = async ({ embeddable }: LibraryNotificationActionContext) => {
return (
embeddable.getRoot().isContainer &&
Expand Down
Loading

0 comments on commit 76985c2

Please sign in to comment.