Skip to content

Commit

Permalink
Merge branch 'master' into alerting/remove-edit-button-from-list
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Apr 28, 2020
2 parents 3517215 + dfb4c33 commit 128163b
Show file tree
Hide file tree
Showing 155 changed files with 2,350 additions and 1,330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface SavedObjectsCoreFieldMapping
| [enabled](./kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md) | <code>boolean</code> | |
| [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | <code>{</code><br/><code> [subfield: string]: {</code><br/><code> type: string;</code><br/><code> };</code><br/><code> }</code> | |
| [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | <code>boolean</code> | |
| [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) | <code>number &#124; boolean &#124; string</code> | |
| [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md) | <code>string</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md)

## SavedObjectsCoreFieldMapping.null\_value property

<b>Signature:</b>

```typescript
null_value?: number | boolean | string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('logLegacyThirdPartyPluginDeprecationWarning', () => {
expect(log.warn).toHaveBeenCalledTimes(1);
expect(log.warn.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"Some installed third party plugin(s) [plugin] are using the legacy plugin format and will no longer work in a future Kibana release. Please refer to https://www.elastic.co/guide/en/kibana/master/breaking-changes-8.0.html for a list of breaking changes and https://github.com/elastic/kibana/blob/master/src/core/MIGRATION.md for documentation on how to migrate legacy plugins.",
"Some installed third party plugin(s) [plugin] are using the legacy plugin format and will no longer work in a future Kibana release. Please refer to https://ela.st/kibana-breaking-changes-8-0 for a list of breaking changes and https://ela.st/kibana-platform-migration for documentation on how to migrate legacy plugins.",
]
`);
});
Expand All @@ -65,7 +65,7 @@ describe('logLegacyThirdPartyPluginDeprecationWarning', () => {
expect(log.warn).toHaveBeenCalledTimes(1);
expect(log.warn.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"Some installed third party plugin(s) [pluginA, pluginB, pluginC] are using the legacy plugin format and will no longer work in a future Kibana release. Please refer to https://www.elastic.co/guide/en/kibana/master/breaking-changes-8.0.html for a list of breaking changes and https://github.com/elastic/kibana/blob/master/src/core/MIGRATION.md for documentation on how to migrate legacy plugins.",
"Some installed third party plugin(s) [pluginA, pluginB, pluginC] are using the legacy plugin format and will no longer work in a future Kibana release. Please refer to https://ela.st/kibana-breaking-changes-8-0 for a list of breaking changes and https://ela.st/kibana-platform-migration for documentation on how to migrate legacy plugins.",
]
`);
});
Expand Down
7 changes: 4 additions & 3 deletions src/core/server/legacy/plugins/log_legacy_plugins_warning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import { LegacyPluginSpec } from '../types';

const internalPaths = ['/src/legacy/core_plugins', '/x-pack'];

const breakingChangesUrl =
'https://www.elastic.co/guide/en/kibana/master/breaking-changes-8.0.html';
const migrationGuideUrl = 'https://github.com/elastic/kibana/blob/master/src/core/MIGRATION.md';
// Use shortened URLs so destinations can be updated if/when documentation moves
// All platform team members have access to edit these
const breakingChangesUrl = 'https://ela.st/kibana-breaking-changes-8-0';
const migrationGuideUrl = 'https://ela.st/kibana-platform-migration';

export const logLegacyThirdPartyPluginDeprecationWarning = ({
specs,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface IndexMappingMeta {
*/
export interface SavedObjectsCoreFieldMapping {
type: string;
null_value?: number | boolean | string;
index?: boolean;
enabled?: boolean;
fields?: {
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,8 @@ export interface SavedObjectsCoreFieldMapping {
// (undocumented)
index?: boolean;
// (undocumented)
null_value?: number | boolean | string;
// (undocumented)
type: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ import {
setData,
setSavedObjects,
setNotifications,
setKibanaMapFactory,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../plugins/vis_type_vega/public/services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { setInjectedVarFunc } from '../../../../../../plugins/maps_legacy/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ServiceSettings } from '../../../../../../plugins/maps_legacy/public/map/service_settings';
import { getKibanaMapFactoryProvider } from '../../../../../../plugins/maps_legacy/public';

const THRESHOLD = 0.1;
const PIXEL_DIFF = 30;
Expand All @@ -77,6 +79,18 @@ describe('VegaVisualizations', () => {
let vegaVisualizationDependencies;
let vegaVisType;

const coreSetupMock = {
notifications: {
toasts: {},
},
uiSettings: {
get: () => {},
},
injectedMetadata: {
getInjectedVar: () => {},
},
};
setKibanaMapFactory(getKibanaMapFactoryProvider(coreSetupMock));
setInjectedVars({
emsTileLayerId: {},
enableExternalUrls: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_ty
import { setInjectedVarFunc } from '../../../../../plugins/maps_legacy/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ServiceSettings } from '../../../../../plugins/maps_legacy/public/map/service_settings';
import { getBaseMapsVis } from '../../../../../plugins/maps_legacy/public';

const THRESHOLD = 0.45;
const PIXEL_DIFF = 96;
Expand Down Expand Up @@ -101,7 +102,7 @@ describe('RegionMapsVisualizationTests', function() {

let getManifestStub;
beforeEach(
ngMock.inject((Private, $injector) => {
ngMock.inject(() => {
setInjectedVarFunc(injectedVar => {
switch (injectedVar) {
case 'mapConfig':
Expand All @@ -127,17 +128,28 @@ describe('RegionMapsVisualizationTests', function() {
}
});
const serviceSettings = new ServiceSettings();
const uiSettings = $injector.get('config');
const regionmapsConfig = {
includeElasticMapsService: true,
layers: [],
};
const coreSetupMock = {
notifications: {
toasts: {},
},
uiSettings: {
get: () => {},
},
injectedMetadata: {
getInjectedVar: () => {},
},
};
const BaseMapsVisualization = getBaseMapsVis(coreSetupMock, serviceSettings);

dependencies = {
serviceSettings,
$injector,
regionmapsConfig,
uiSettings,
uiSettings: coreSetupMock.uiSettings,
BaseMapsVisualization,
};

regionMapVisType = new BaseVisType(createRegionMapTypeDefinition(dependencies));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import {
SelectOption,
SwitchOption,
} from '../../../../../plugins/charts/public';
import { WmsOptions } from '../../../tile_map/public/components/wms_options';
import { RegionMapVisParams } from '../types';
import { RegionMapVisParams, WmsOptions } from '../../../../../plugins/maps_legacy/public';

const mapLayerForOption = ({ layerId, name }: VectorLayer) => ({
text: name,
Expand Down
5 changes: 0 additions & 5 deletions src/legacy/core_plugins/region_map/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { RegionMapPluginSetupDependencies } from './plugin';
import { LegacyDependenciesPlugin } from './shim';
import { plugin } from '.';

const plugins: Readonly<RegionMapPluginSetupDependencies> = {
expressions: npSetup.plugins.expressions,
visualizations: npSetup.plugins.visualizations,
mapsLegacy: npSetup.plugins.mapsLegacy,

// Temporary solution
// It will be removed when all dependent services are migrated to the new platform.
__LEGACY: new LegacyDependenciesPlugin(),
};

const pluginInstance = plugin({} as PluginInitializerContext);
Expand Down
19 changes: 9 additions & 10 deletions src/legacy/core_plugins/region_map/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ import {
} from '../../../../core/public';
import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
import { VisualizationsSetup } from '../../../../plugins/visualizations/public';

import { LegacyDependenciesPlugin, LegacyDependenciesPluginSetup } from './shim';

// @ts-ignore
import { createRegionMapFn } from './region_map_fn';
// @ts-ignore
import { createRegionMapTypeDefinition } from './region_map_type';
import { IServiceSettings, MapsLegacyPluginSetup } from '../../../../plugins/maps_legacy/public';
import {
getBaseMapsVis,
IServiceSettings,
MapsLegacyPluginSetup,
} from '../../../../plugins/maps_legacy/public';

/** @private */
interface RegionMapVisualizationDependencies extends LegacyDependenciesPluginSetup {
interface RegionMapVisualizationDependencies {
uiSettings: IUiSettingsClient;
regionmapsConfig: RegionMapsConfig;
serviceSettings: IServiceSettings;
notificationService: any;
BaseMapsVisualization: any;
}

/** @internal */
export interface RegionMapPluginSetupDependencies {
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
visualizations: VisualizationsSetup;
__LEGACY: LegacyDependenciesPlugin;
mapsLegacy: MapsLegacyPluginSetup;
}

Expand All @@ -66,14 +66,13 @@ export class RegionMapPlugin implements Plugin<Promise<void>, void> {

public async setup(
core: CoreSetup,
{ expressions, visualizations, mapsLegacy, __LEGACY }: RegionMapPluginSetupDependencies
{ expressions, visualizations, mapsLegacy }: RegionMapPluginSetupDependencies
) {
const visualizationDependencies: Readonly<RegionMapVisualizationDependencies> = {
uiSettings: core.uiSettings,
regionmapsConfig: core.injectedMetadata.getInjectedVar('regionmap') as RegionMapsConfig,
serviceSettings: mapsLegacy.serviceSettings,
notificationService: core.notifications.toasts,
...(await __LEGACY.setup()),
BaseMapsVisualization: getBaseMapsVis(core, mapsLegacy.serviceSettings),
};

expressions.registerFunction(createRegionMapFn);
Expand Down
4 changes: 1 addition & 3 deletions src/legacy/core_plugins/region_map/public/region_map_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import { createRegionMapVisualization } from './region_map_visualization';
import { RegionMapOptions } from './components/region_map_options';
import { truncatedColorSchemas } from '../../../../plugins/charts/public';
import { Schemas } from '../../../../plugins/vis_default_editor/public';

// TODO: reference to TILE_MAP plugin should be removed
import { ORIGIN } from '../../tile_map/common/origin';
import { ORIGIN } from '../../../../plugins/maps_legacy/public';

export function createRegionMapTypeDefinition(dependencies) {
const { uiSettings, regionmapsConfig, serviceSettings } = dependencies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,21 @@ import { i18n } from '@kbn/i18n';
import ChoroplethLayer from './choropleth_layer';
import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
import { toastNotifications } from 'ui/notify';

import { TileMapTooltipFormatter } from './tooltip_formatter';
import { truncatedColorMaps } from '../../../../plugins/charts/public';

// TODO: reference to TILE_MAP plugin should be removed
import { BaseMapsVisualizationProvider } from '../../tile_map/public/base_maps_visualization';
import { tooltipFormatter } from './tooltip_formatter';
import { mapTooltipProvider } from '../../../../plugins/maps_legacy/public';

export function createRegionMapVisualization({
serviceSettings,
$injector,
uiSettings,
notificationService,
BaseMapsVisualization,
}) {
const BaseMapsVisualization = new BaseMapsVisualizationProvider(
serviceSettings,
notificationService
);
const tooltipFormatter = new TileMapTooltipFormatter($injector);

return class RegionMapsVisualization extends BaseMapsVisualization {
constructor(container, vis) {
super(container, vis);
this._vis = this.vis;
this._choroplethLayer = null;
this._tooltipFormatter = mapTooltipProvider(container, tooltipFormatter);
}

async render(esResponse, visParams) {
Expand Down Expand Up @@ -89,7 +80,7 @@ export function createRegionMapVisualization({
this._choroplethLayer.setMetrics(results, metricFieldFormatter, valueColumn.name);
if (termColumn && valueColumn) {
this._choroplethLayer.setTooltipFormatter(
tooltipFormatter,
this._tooltipFormatter,
metricFieldFormatter,
termColumn.name,
valueColumn.name
Expand Down Expand Up @@ -123,7 +114,7 @@ export function createRegionMapVisualization({
this._choroplethLayer.setColorRamp(truncatedColorMaps[visParams.colorSchema].value);
this._choroplethLayer.setLineWeight(visParams.outlineWeight);
this._choroplethLayer.setTooltipFormatter(
tooltipFormatter,
this._tooltipFormatter,
metricFieldFormatter,
this._metricLabel
);
Expand Down
8 changes: 0 additions & 8 deletions src/legacy/core_plugins/region_map/public/tooltip.html

This file was deleted.

57 changes: 21 additions & 36 deletions src/legacy/core_plugins/region_map/public/tooltip_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,24 @@
* under the License.
*/

import $ from 'jquery';
import template from './tooltip.html';

export const TileMapTooltipFormatter = $injector => {
const $rootScope = $injector.get('$rootScope');
const $compile = $injector.get('$compile');

const $tooltipScope = $rootScope.$new();
const $el = $('<div>').html(template);

$compile($el)($tooltipScope);

return function tooltipFormatter(metric, fieldFormatter, fieldName, metricName) {
if (!metric) {
return '';
}

$tooltipScope.details = [];
if (fieldName && metric) {
$tooltipScope.details.push({
label: fieldName,
value: metric.term,
});
}

if (metric) {
$tooltipScope.details.push({
label: metricName,
value: fieldFormatter ? fieldFormatter.convert(metric.value, 'text') : metric.value,
});
}

$tooltipScope.$apply();
return $el.html();
};
};
export function tooltipFormatter(metric, fieldFormatter, fieldName, metricName) {
if (!metric) {
return '';
}

const details = [];
if (fieldName && metric) {
details.push({
label: fieldName,
value: metric.term,
});
}

if (metric) {
details.push({
label: metricName,
value: fieldFormatter ? fieldFormatter.convert(metric.value, 'text') : metric.value,
});
}
return details;
}
3 changes: 1 addition & 2 deletions src/legacy/core_plugins/region_map/public/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/

import { FileLayer, VectorLayer } from '../../../../plugins/maps_legacy/public';
// TODO: reference to TILE_MAP plugin should be removed
import { ORIGIN } from '../../../../legacy/core_plugins/tile_map/common/origin';
import { ORIGIN } from '../../../../plugins/maps_legacy/public';

export const mapToLayerWithId = (prefix: string, layer: FileLayer): VectorLayer => ({
...layer,
Expand Down
23 changes: 0 additions & 23 deletions src/legacy/core_plugins/tile_map/common/origin.ts

This file was deleted.

Loading

0 comments on commit 128163b

Please sign in to comment.