Skip to content

Commit

Permalink
Merge branch 'master' into canvas-fix-old-style-storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 10, 2020
2 parents cac6b05 + bb7e152 commit 687d98d
Show file tree
Hide file tree
Showing 215 changed files with 4,466 additions and 1,601 deletions.
36 changes: 31 additions & 5 deletions docs/canvas/canvas-elements.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ When you add elements to your workpad, you can:
[[add-canvas-element]]
=== Add elements to your workpad

Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. By default, every element you add to a workpad uses demo data until you change the data source. The demo data includes a small sample data set that you can use to experiment with your element.
Choose the elements to display on your workpad, then familiarize yourself with the element using the preconfigured demo data. By default, most elements use demo data until you change the data source. The demo data includes a small sample data set that you can use to experiment with your element.

To add a Canvas element:

. Click *Add element*.

Expand All @@ -31,13 +33,26 @@ image::images/canvas-element-select.gif[Canvas elements]

. Play around with the default settings and see what the element can do.

TIP: Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right, then selecting *Delete*.
To add a map:

. Click *Embed object*.

. Select the map you want to add to the workpad.
+
[role="screenshot"]
image::images/canvas-map-embed.gif[]

NOTE: Demo data is only supported on Canvas elements. Maps do not support demo data.

Want to use a different element? You can delete the element by selecting it, clicking the *Element options* icon in the top right, then selecting *Delete*.

[float]
[[connect-element-data]]
=== Connect the element to your data
=== Connect the Canvas element to your data

When you have finished using the demo data, connect the element to a data source.
When you have finished using the demo data, connect the Canvas element to a data source.

NOTE: Maps do not support data sources. To change the map data, refer to <<maps, Elastic Maps>>.

. Make sure that the element is selected, then select *Data*.

Expand Down Expand Up @@ -142,7 +157,7 @@ text.align: center;
[[configure-auto-refresh-interval]]
==== Change the data auto-refresh interval

Increase or decrease how often your data refreshes on your workpad.
Increase or decrease how often your Canvas element data refreshes on your workpad.

. In the top left corner, click the *Control settings* icon.

Expand All @@ -153,6 +168,17 @@ image::images/canvas-refresh-interval.png[Element data refresh interval]

TIP: To manually refresh the data, click the *Refresh data* icon.

[float]
[[canvas-time-range]]
==== Customize map time ranges

Configure the maps on your workpad for a specific time range.

From the panel menu, select *Customize time range* to expose a time filter dedicated to the map.

[role="screenshot"]
image::images/canvas_map-time-filter.gif[]

[float]
[[organize-element]]
=== Organize the elements on your workpad
Expand Down
10 changes: 3 additions & 7 deletions docs/developer/plugin/development-plugin-resources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

Here are some resources that are helpful for getting started with plugin development.

[float]
==== Our IRC channel
Many Kibana developers hang out on `irc.freenode.net` in the `#kibana` channel. We *want* to help you with plugin development. Even more than that, we *want your help* in understanding your plugin goals, so we can build a great plugin system for you! If you've never used IRC, welcome to the fun. You can get started with the http://webchat.freenode.net/?channels=kibana[Freenode Web Client].

[float]
==== Some light reading
Our {repo}blob/master/CONTRIBUTING.md[contributing guide] can help you get a development environment going.
Expand Down Expand Up @@ -50,7 +46,7 @@ You're welcome to use these components, but be aware that they are rapidly evolv

[float]
==== TypeScript Support
Plugin code can be written in http://www.typescriptlang.org/[TypeScript] if desired.
Plugin code can be written in http://www.typescriptlang.org/[TypeScript] if desired.
To enable TypeScript support, create a `tsconfig.json` file at the root of your plugin that looks something like this:

["source","js"]
Expand All @@ -67,6 +63,6 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
}
-----------

TypeScript code is automatically converted into JavaScript during development,
but not in the distributable version of Kibana. If you use the
TypeScript code is automatically converted into JavaScript during development,
but not in the distributable version of Kibana. If you use the
{repo}blob/{branch}/packages/kbn-plugin-helpers[@kbn/plugin-helpers] to build your plugin, then your `.ts` and `.tsx` files will be permanently transpiled before your plugin is archived. If you have your own build process, make sure to run the TypeScript compiler on your source files and ship the compilation output so that your plugin will work with the distributable version of Kibana.
Binary file added docs/images/canvas-map-embed.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/canvas_map-time-filter.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@ might increase the search time. This setting is off by default. Users must opt-i
[horizontal]
`siem:defaultAnomalyScore`:: The threshold above which Machine Learning job anomalies are displayed in the SIEM app.
`siem:defaultIndex`:: A comma-delimited list of Elasticsearch indices from which the SIEM app collects events.
`siem:enableNewsFeed`:: Enables the News feed
`siem:newsFeedUrl`:: News feed content will be retrieved from this URL
`siem:enableNewsFeed`:: Enables the security news feed on the SIEM *Overview*
page.
`siem:newsFeedUrl`:: The URL from which the security news feed content is
retrieved.
`siem:refreshIntervalDefaults`:: The default refresh interval for the SIEM time filter, in milliseconds.
`siem:timeDefaults`:: The default period of time in the SIEM time filter.

Expand Down
3 changes: 2 additions & 1 deletion docs/siem/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ https://www.elastic.co/products/beats/packetbeat[{packetbeat}]
send security events and other data to Elasticsearch.

The default index patterns for SIEM events are `auditbeat-*`, `winlogbeat-*`,
`filebeat-*`, `endgame-*`, and `packetbeat-*``. You can change the default index patterns in
`filebeat-*`, `packetbeat-*`, `endgame-*`, and `apm-*-transaction*`. You can
change the default index patterns in
*Kibana > Management > Advanced Settings > siem:defaultIndex*.

[float]
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/core_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class CoreSystem {
const injectedMetadata = await this.injectedMetadata.start();
const uiSettings = await this.uiSettings.start();
const docLinks = await this.docLinks.start({ injectedMetadata });
const http = await this.http.start({ injectedMetadata, fatalErrors: this.fatalErrorsSetup! });
const http = await this.http.start();
const savedObjects = await this.savedObjects.start({ http });
const i18n = await this.i18n.start();
const fatalErrors = await this.fatalErrors.start();
Expand Down
29 changes: 28 additions & 1 deletion src/core/public/http/http_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,40 @@ import { fatalErrorsServiceMock } from '../fatal_errors/fatal_errors_service.moc
import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock';
import { HttpService } from './http_service';

describe('interceptors', () => {
afterEach(() => fetchMock.restore());

it('shares interceptors across setup and start', async () => {
fetchMock.get('*', {});
const injectedMetadata = injectedMetadataServiceMock.createSetupContract();
const fatalErrors = fatalErrorsServiceMock.createSetupContract();
const httpService = new HttpService();

const setup = httpService.setup({ fatalErrors, injectedMetadata });
const setupInterceptor = jest.fn();
setup.intercept({ request: setupInterceptor });

const start = httpService.start();
const startInterceptor = jest.fn();
start.intercept({ request: startInterceptor });

await setup.get('/blah');
expect(setupInterceptor).toHaveBeenCalledTimes(1);
expect(startInterceptor).toHaveBeenCalledTimes(1);

await start.get('/other-blah');
expect(setupInterceptor).toHaveBeenCalledTimes(2);
expect(startInterceptor).toHaveBeenCalledTimes(2);
});
});

describe('#stop()', () => {
it('calls loadingCount.stop()', () => {
const injectedMetadata = injectedMetadataServiceMock.createSetupContract();
const fatalErrors = fatalErrorsServiceMock.createSetupContract();
const httpService = new HttpService();
httpService.setup({ fatalErrors, injectedMetadata });
httpService.start({ fatalErrors, injectedMetadata });
httpService.start();
httpService.stop();
expect(loadingServiceMock.stop).toHaveBeenCalled();
});
Expand Down
13 changes: 10 additions & 3 deletions src/core/public/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ interface HttpDeps {
export class HttpService implements CoreService<HttpSetup, HttpStart> {
private readonly anonymousPaths = new AnonymousPathsService();
private readonly loadingCount = new LoadingCountService();
private service?: HttpSetup;

public setup({ injectedMetadata, fatalErrors }: HttpDeps): HttpSetup {
const kibanaVersion = injectedMetadata.getKibanaVersion();
const basePath = new BasePath(injectedMetadata.getBasePath());
const fetchService = new Fetch({ basePath, kibanaVersion });
const loadingCount = this.loadingCount.setup({ fatalErrors });

return {
this.service = {
basePath,
anonymousPaths: this.anonymousPaths.setup({ basePath }),
intercept: fetchService.intercept.bind(fetchService),
Expand All @@ -56,10 +57,16 @@ export class HttpService implements CoreService<HttpSetup, HttpStart> {
put: fetchService.put.bind(fetchService),
...loadingCount,
};

return this.service;
}

public start(deps: HttpDeps) {
return this.setup(deps);
public start() {
if (!this.service) {
throw new Error(`HttpService#setup() must be called first!`);
}

return this.service;
}

public stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import { I18nStart, SavedObjectsStart, IUiSettingsClient, CoreStart } from 'src/core/public';
import { createGetterSetter } from '../../../../plugins/kibana_utils/public';
import { DataPublicPluginStart, FieldFormatsStart } from '../../../../plugins/data/public';
import { DataPublicPluginStart } from '../../../../plugins/data/public';

export const [getUISettings, setUISettings] = createGetterSetter<IUiSettingsClient>('UISettings');

export const [getFieldFormats, setFieldFormats] = createGetterSetter<FieldFormatsStart>(
'FieldFormats'
);
export const [getFieldFormats, setFieldFormats] = createGetterSetter<
DataPublicPluginStart['fieldFormats']
>('FieldFormats');

export const [getSavedObjectsClient, setSavedObjectsClient] = createGetterSetter<SavedObjectsStart>(
'SavedObjectsClient'
Expand Down
8 changes: 8 additions & 0 deletions src/legacy/server/logging/log_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ import LogFormatJson from './log_format_json';
import LogFormatString from './log_format_string';
import { LogInterceptor } from './log_interceptor';

// NOTE: legacy logger creates a new stream for each new access
// In https://github.com/elastic/kibana/pull/55937 we reach the max listeners
// default limit of 10 for process.stdout which starts a long warning/error
// thrown every time we start the server.
// In order to keep using the legacy logger until we remove it I'm just adding
// a new hard limit here.
process.stdout.setMaxListeners(15);

export function getLoggerStream({ events, config }) {
const squeeze = new Squeeze(events);
const format = config.json ? new LogFormatJson(config) : new LogFormatString(config);
Expand Down
11 changes: 4 additions & 7 deletions src/plugins/data/public/autocomplete/autocomplete_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,23 @@
*/

import { CoreSetup } from 'src/core/public';
import { QuerySuggestionsGetFn } from './providers/query_suggestion_provider';
import { QuerySuggestionGetFn } from './providers/query_suggestion_provider';
import {
setupValueSuggestionProvider,
ValueSuggestionsGetFn,
} from './providers/value_suggestion_provider';

export class AutocompleteService {
private readonly querySuggestionProviders: Map<string, QuerySuggestionsGetFn> = new Map();
private readonly querySuggestionProviders: Map<string, QuerySuggestionGetFn> = new Map();
private getValueSuggestions?: ValueSuggestionsGetFn;

private addQuerySuggestionProvider = (
language: string,
provider: QuerySuggestionsGetFn
): void => {
private addQuerySuggestionProvider = (language: string, provider: QuerySuggestionGetFn): void => {
if (language && provider) {
this.querySuggestionProviders.set(language, provider);
}
};

private getQuerySuggestions: QuerySuggestionsGetFn = args => {
private getQuerySuggestions: QuerySuggestionGetFn = args => {
const { language } = args;
const provider = this.querySuggestionProviders.get(language);

Expand Down
13 changes: 10 additions & 3 deletions src/plugins/data/public/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
import * as autocomplete from './static';
export { AutocompleteService, AutocompleteSetup, AutocompleteStart } from './autocomplete_service';

export { autocomplete };
export {
QuerySuggestion,
QuerySuggestionTypes,
QuerySuggestionGetFn,
QuerySuggestionGetFnArgs,
QuerySuggestionBasic,
QuerySuggestionField,
} from './providers/query_suggestion_provider';

export { AutocompleteService, AutocompleteSetup, AutocompleteStart } from './autocomplete_service';
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@

import { IFieldType, IIndexPattern } from '../../../common/index_patterns';

export enum QuerySuggestionsTypes {
export enum QuerySuggestionTypes {
Field = 'field',
Value = 'value',
Operator = 'operator',
Conjunction = 'conjunction',
RecentSearch = 'recentSearch',
}

export type QuerySuggestionsGetFn = (
args: QuerySuggestionsGetFnArgs
export type QuerySuggestionGetFn = (
args: QuerySuggestionGetFnArgs
) => Promise<QuerySuggestion[]> | undefined;

/** @public **/
export interface QuerySuggestionsGetFnArgs {
export interface QuerySuggestionGetFnArgs {
language: string;
indexPatterns: IIndexPattern[];
query: string;
Expand All @@ -43,8 +43,8 @@ export interface QuerySuggestionsGetFnArgs {
}

/** @public **/
export interface BasicQuerySuggestion {
type: QuerySuggestionsTypes;
export interface QuerySuggestionBasic {
type: QuerySuggestionTypes;
description?: string | JSX.Element;
end: number;
start: number;
Expand All @@ -53,10 +53,10 @@ export interface BasicQuerySuggestion {
}

/** @public **/
export interface FieldQuerySuggestion extends BasicQuerySuggestion {
type: QuerySuggestionsTypes.Field;
export interface QuerySuggestionField extends QuerySuggestionBasic {
type: QuerySuggestionTypes.Field;
field: IFieldType;
}

/** @public **/
export type QuerySuggestion = BasicQuerySuggestion | FieldQuerySuggestion;
export type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField;
27 changes: 0 additions & 27 deletions src/plugins/data/public/autocomplete/static.ts

This file was deleted.

12 changes: 11 additions & 1 deletion src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ export {
FieldFormatConfig,
FieldFormatId,
} from '../common';
export { autocomplete } from './autocomplete';

export {
QuerySuggestion,
QuerySuggestionTypes,
QuerySuggestionGetFn,
QuerySuggestionGetFnArgs,
QuerySuggestionBasic,
QuerySuggestionField,
} from './autocomplete';

export * from './field_formats';
export * from './index_patterns';
export * from './search';
export * from './query';
Expand Down
Loading

0 comments on commit 687d98d

Please sign in to comment.