Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/7.x' into backport/7.x/pr-64251
Browse files Browse the repository at this point in the history
  • Loading branch information
rylnd committed Apr 28, 2020
2 parents dbfd2cc + 319af47 commit 6cc1182
Show file tree
Hide file tree
Showing 135 changed files with 3,387 additions and 820 deletions.
7 changes: 7 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ This setting does not have an effect when loading a saved search.
Highlighting slows requests when
working on big documents.

[float]
[[kibana-ml-settings]]
==== Machine learning

[horizontal]
`ml:fileDataVisualizerMaxFileSize`:: Sets the file size limit when importing
data in the {data-viz}. The default value is `100MB`. The highest supported
value for this setting is `1GB`.


[float]
Expand Down
6 changes: 0 additions & 6 deletions docs/settings/ml-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,4 @@ instance. If `xpack.ml.enabled` is set to `true` in `elasticsearch.yml`, however
you can still use the {ml} APIs. To disable {ml} entirely, see the
{ref}/ml-settings.html[{es} {ml} settings].

[[data-visualizer-settings]]
==== {data-viz} settings

`xpack.ml.file_data_visualizer.max_file_size`::
Sets the file size limit when importing data in the {data-viz}. The default
value is `100MB`. The highest supported value for this setting is `1GB`.

2 changes: 1 addition & 1 deletion docs/user/ml/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ image::user/ml/images/ml-data-visualizer-sample.jpg[{data-viz} for sample flight
experimental[] You can also upload a CSV, NDJSON, or log file. The *{data-viz}*
identifies the file format and field mappings. You can then optionally import
that data into an {es} index. To change the default file size limit, see
<<data-visualizer-settings>>.
<<kibana-ml-settings>>.

You need the following permissions to use the {data-viz} with file upload:

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"data/optimize",
"built_assets",
".eslintcache",
".node_binaries"
".node_binaries",
"src/plugins/*/target"
]
}
},
Expand Down Expand Up @@ -437,7 +438,7 @@
"gulp-babel": "^8.0.0",
"gulp-sourcemaps": "2.6.5",
"has-ansi": "^3.0.0",
"iedriver": "^3.14.1",
"iedriver": "^3.14.2",
"intl-messageformat-parser": "^1.4.0",
"is-path-inside": "^2.1.0",
"istanbul-instrumenter-loader": "3.0.1",
Expand Down
7 changes: 5 additions & 2 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57107,7 +57107,7 @@ async function getChangesForProjects(projects, kbn, log) {
log.verbose('getting changed files');
const {
stdout
} = await execa__WEBPACK_IMPORTED_MODULE_3___default()('git', ['ls-files', '-dmt', '--', ...Array.from(projects.values()).filter(p => kbn.isPartOfRepo(p)).map(p => p.path)], {
} = await execa__WEBPACK_IMPORTED_MODULE_3___default()('git', ['ls-files', '-dmto', '--exclude-standard', '--', ...Array.from(projects.values()).filter(p => kbn.isPartOfRepo(p)).map(p => p.path)], {
cwd: kbn.getAbsolute()
});
const output = stdout.trim();
Expand All @@ -57134,10 +57134,13 @@ async function getChangesForProjects(projects, kbn, log) {
unassignedChanges.set(path, 'deleted');
break;

case '?':
unassignedChanges.set(path, 'untracked');
break;

case 'H':
case 'S':
case 'K':
case '?':
default:
log.warning(`unexpected modification status "${tag}" for ${path}, please report this!`);
unassignedChanges.set(path, 'invalid');
Expand Down
10 changes: 7 additions & 3 deletions packages/kbn-pm/src/utils/project_checksums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { Kibana } from '../utils/kibana';

export type ChecksumMap = Map<string, string | undefined>;
/** map of [repo relative path to changed file, type of change] */
type Changes = Map<string, 'modified' | 'deleted' | 'invalid'>;
type Changes = Map<string, 'modified' | 'deleted' | 'invalid' | 'untracked'>;

const statAsync = promisify(Fs.stat);
const projectBySpecificitySorter = (a: Project, b: Project) => b.path.length - a.path.length;
Expand All @@ -45,7 +45,8 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Too
'git',
[
'ls-files',
'-dmt',
'-dmto',
'--exclude-standard',
'--',
...Array.from(projects.values())
.filter(p => kbn.isPartOfRepo(p))
Expand Down Expand Up @@ -78,10 +79,13 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Too
unassignedChanges.set(path, 'deleted');
break;

case '?':
unassignedChanges.set(path, 'untracked');
break;

case 'H':
case 'S':
case 'K':
case '?':
default:
log.warning(`unexpected modification status "${tag}" for ${path}, please report this!`);
unassignedChanges.set(path, 'invalid');
Expand Down
6 changes: 4 additions & 2 deletions src/core/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { of } from 'rxjs';
import { duration } from 'moment';
import { PluginInitializerContext, CoreSetup, CoreStart } from '.';
import { PluginInitializerContext, CoreSetup, CoreStart, StartServicesAccessor } from '.';
import { CspConfig } from './csp';
import { loggingServiceMock } from './logging/logging_service.mock';
import { elasticsearchServiceMock } from './elasticsearch/elasticsearch_service.mock';
Expand Down Expand Up @@ -100,7 +100,9 @@ function pluginInitializerContextMock<T>(config: T = {} as T) {
return mock;
}

type CoreSetupMockType = MockedKeys<CoreSetup> & jest.Mocked<Pick<CoreSetup, 'getStartServices'>>;
type CoreSetupMockType = MockedKeys<CoreSetup> & {
getStartServices: jest.MockedFunction<StartServicesAccessor<any, any>>;
};

function createCoreSetupMock({
pluginStartDeps = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ kibana_vars=(
xpack.security.session.idleTimeout
xpack.security.session.lifespan
xpack.security.loginAssistanceMessage
xpack.security.loginHelp
xpack.security.public.protocol
xpack.security.public.hostname
xpack.security.public.port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class DashboardGridUi extends React.Component<DashboardGridProps, State> {
getEmbeddableFactory={this.props.kibana.services.embeddable.getEmbeddableFactory}
getAllEmbeddableFactories={this.props.kibana.services.embeddable.getEmbeddableFactories}
overlays={this.props.kibana.services.overlays}
application={this.props.kibana.services.application}
notifications={this.props.kibana.services.notifications}
inspector={this.props.kibana.services.inspector}
SavedObjectFinder={this.props.kibana.services.SavedObjectFinder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ test('DashboardContainer in edit mode shows edit mode actions', async () => {
getAllEmbeddableFactories={(() => []) as any}
getEmbeddableFactory={(() => null) as any}
notifications={{} as any}
application={{} as any}
overlays={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EditableEmbeddable extends Embeddable {
}

test('is compatible when edit url is available, in edit mode and editable', async () => {
const action = new EditPanelAction(getFactory);
const action = new EditPanelAction(getFactory, {} as any);
expect(
await action.isCompatible({
embeddable: new EditableEmbeddable({ id: '123', viewMode: ViewMode.EDIT }, true),
Expand All @@ -50,7 +50,7 @@ test('is compatible when edit url is available, in edit mode and editable', asyn
});

test('getHref returns the edit urls', async () => {
const action = new EditPanelAction(getFactory);
const action = new EditPanelAction(getFactory, {} as any);
expect(action.getHref).toBeDefined();

if (action.getHref) {
Expand All @@ -64,7 +64,7 @@ test('getHref returns the edit urls', async () => {
});

test('is not compatible when edit url is not available', async () => {
const action = new EditPanelAction(getFactory);
const action = new EditPanelAction(getFactory, {} as any);
const embeddable = new ContactCardEmbeddable(
{
id: '123',
Expand All @@ -83,7 +83,7 @@ test('is not compatible when edit url is not available', async () => {
});

test('is not visible when edit url is available but in view mode', async () => {
const action = new EditPanelAction(getFactory);
const action = new EditPanelAction(getFactory, {} as any);
expect(
await action.isCompatible({
embeddable: new EditableEmbeddable(
Expand All @@ -98,7 +98,7 @@ test('is not visible when edit url is available but in view mode', async () => {
});

test('is not compatible when edit url is available, in edit mode, but not editable', async () => {
const action = new EditPanelAction(getFactory);
const action = new EditPanelAction(getFactory, {} as any);
expect(
await action.isCompatible({
embeddable: new EditableEmbeddable(
Expand Down
29 changes: 25 additions & 4 deletions src/plugins/embeddable/public/lib/actions/edit_panel_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { i18n } from '@kbn/i18n';
import { ApplicationStart } from 'kibana/public';
import { Action } from 'src/plugins/ui_actions/public';
import { ViewMode } from '../types';
import { EmbeddableFactoryNotFoundError } from '../errors';
Expand All @@ -35,7 +36,10 @@ export class EditPanelAction implements Action<ActionContext> {
public readonly id = ACTION_EDIT_PANEL;
public order = 15;

constructor(private readonly getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory']) {}
constructor(
private readonly getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory'],
private readonly application: ApplicationStart
) {}

public getDisplayName({ embeddable }: ActionContext) {
const factory = this.getEmbeddableFactory(embeddable.type);
Expand All @@ -56,18 +60,35 @@ export class EditPanelAction implements Action<ActionContext> {

public async isCompatible({ embeddable }: ActionContext) {
const canEditEmbeddable = Boolean(
embeddable && embeddable.getOutput().editable && embeddable.getOutput().editUrl
embeddable &&
embeddable.getOutput().editable &&
(embeddable.getOutput().editUrl ||
(embeddable.getOutput().editApp && embeddable.getOutput().editPath))
);
const inDashboardEditMode = embeddable.getInput().viewMode === ViewMode.EDIT;
return Boolean(canEditEmbeddable && inDashboardEditMode);
}

public async execute(context: ActionContext) {
const appTarget = this.getAppTarget(context);

if (appTarget) {
await this.application.navigateToApp(appTarget.app, { path: appTarget.path });
return;
}

const href = await this.getHref(context);
if (href) {
// TODO: when apps start using browser router instead of hash router this has to be fixed
// https://github.com/elastic/kibana/issues/58217
window.location.href = href;
return;
}
}

public getAppTarget({ embeddable }: ActionContext): { app: string; path: string } | undefined {
const app = embeddable ? embeddable.getOutput().editApp : undefined;
const path = embeddable ? embeddable.getOutput().editPath : undefined;
if (app && path) {
return { app, path };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ test('EmbeddableChildPanel renders an embeddable when it is done loading', async
getAllEmbeddableFactories={start.getEmbeddableFactories}
getEmbeddableFactory={getEmbeddableFactory}
notifications={{} as any}
application={{} as any}
overlays={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
Expand Down Expand Up @@ -105,6 +106,7 @@ test(`EmbeddableChildPanel renders an error message if the factory doesn't exist
getEmbeddableFactory={(() => undefined) as any}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface EmbeddableChildPanelProps {
getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
application: CoreStart['application'];
inspector: InspectorStartContract;
SavedObjectFinder: React.ComponentType<any>;
}
Expand Down Expand Up @@ -101,6 +102,7 @@ export class EmbeddableChildPanel extends React.Component<EmbeddableChildPanelPr
getEmbeddableFactory={this.props.getEmbeddableFactory}
getAllEmbeddableFactories={this.props.getAllEmbeddableFactories}
overlays={this.props.overlays}
application={this.props.application}
notifications={this.props.notifications}
inspector={this.props.inspector}
SavedObjectFinder={this.props.SavedObjectFinder}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export interface EmbeddableInput {

export interface EmbeddableOutput {
editUrl?: string;
editApp?: string;
editPath?: string;
defaultTitle?: string;
title?: string;
editable?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ test('HelloWorldContainer in view mode hides edit mode actions', async () => {
getAllEmbeddableFactories={start.getEmbeddableFactories}
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
application={{} as any}
overlays={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
Expand Down Expand Up @@ -198,6 +199,7 @@ const renderInEditModeAndOpenContextMenu = async (
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
/>
Expand Down Expand Up @@ -296,6 +298,7 @@ test('HelloWorldContainer in edit mode shows edit mode actions', async () => {
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
/>
Expand Down Expand Up @@ -358,6 +361,7 @@ test('Updates when hidePanelTitles is toggled', async () => {
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
/>
Expand Down Expand Up @@ -410,6 +414,7 @@ test('Check when hide header option is false', async () => {
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
hideHeader={false}
Expand Down Expand Up @@ -447,6 +452,7 @@ test('Check when hide header option is true', async () => {
getEmbeddableFactory={start.getEmbeddableFactory}
notifications={{} as any}
overlays={{} as any}
application={{} as any}
inspector={inspector}
SavedObjectFinder={() => null}
hideHeader={true}
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface Props {
getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
application: CoreStart['application'];
inspector: InspectorStartContract;
SavedObjectFinder: React.ComponentType<any>;
hideHeader?: boolean;
Expand Down Expand Up @@ -243,7 +244,7 @@ export class EmbeddablePanel extends React.Component<Props, State> {
),
new InspectPanelAction(this.props.inspector),
new RemovePanelAction(),
new EditPanelAction(this.props.getEmbeddableFactory),
new EditPanelAction(this.props.getEmbeddableFactory, this.props.application),
];

const sorted = actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface HelloWorldContainerOptions {
getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory'];
getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: CoreStart['overlays'];
application: CoreStart['application'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
SavedObjectFinder: React.ComponentType<any>;
Expand Down Expand Up @@ -81,6 +82,7 @@ export class HelloWorldContainer extends Container<InheritedInput, HelloWorldCon
getAllEmbeddableFactories={this.options.getAllEmbeddableFactories}
getEmbeddableFactory={this.options.getEmbeddableFactory}
overlays={this.options.overlays}
application={this.options.application}
notifications={this.options.notifications}
inspector={this.options.inspector}
SavedObjectFinder={this.options.SavedObjectFinder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface Props {
getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory'];
getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories'];
overlays: CoreStart['overlays'];
application: CoreStart['application'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
SavedObjectFinder: React.ComponentType<any>;
Expand Down Expand Up @@ -112,6 +113,7 @@ export class HelloWorldContainerComponent extends Component<Props, State> {
getAllEmbeddableFactories={this.props.getAllEmbeddableFactories}
overlays={this.props.overlays}
notifications={this.props.notifications}
application={this.props.application}
inspector={this.props.inspector}
SavedObjectFinder={this.props.SavedObjectFinder}
/>
Expand Down
Loading

0 comments on commit 6cc1182

Please sign in to comment.