Skip to content

Commit

Permalink
Merge branch 'master' into fix/uptime-alerting-rbac
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Aug 13, 2021
2 parents 519f8f9 + d78d66d commit 2452514
Show file tree
Hide file tree
Showing 64 changed files with 1,285 additions and 544 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'keyword',
_meta: { description: 'Default value of the setting was changed.' },
},
'securitySolution:defaultThreatIndex': {
type: 'keyword',
_meta: { description: 'Default value of the setting was changed.' },
},
'securitySolution:newsFeedUrl': {
type: 'keyword',
_meta: { description: 'Default value of the setting was changed.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface UsageStats {
*/
'timelion:quandl.key': string;
'securitySolution:defaultIndex': string;
'securitySolution:defaultThreatIndex': string;
'securitySolution:newsFeedUrl': string;
'xpackReporting:customPdfLogo': string;
'notifications:banner': string;
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7168,6 +7168,12 @@
"description": "Default value of the setting was changed."
}
},
"securitySolution:defaultThreatIndex": {
"type": "keyword",
"_meta": {
"description": "Default value of the setting was changed."
}
},
"securitySolution:newsFeedUrl": {
"type": "keyword",
"_meta": {
Expand Down Expand Up @@ -9330,4 +9336,4 @@
}
}
}
}
}
10 changes: 7 additions & 3 deletions x-pack/plugins/canvas/public/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
export * from './legacy';

import { PluginServices } from '../../../../../src/plugins/presentation_util/public';

import { CanvasCustomElementService } from './custom_element';
import { CanvasEmbeddablesService } from './embeddables';
import { CanvasExpressionsService } from './expressions';
import { CanvasCustomElementService } from './custom_element';
import { CanvasLabsService } from './labs';
import { CanvasNavLinkService } from './nav_link';
import { CanvasNotifyService } from './notify';
import { CanvasPlatformService } from './platform';
Expand All @@ -21,6 +23,7 @@ export interface CanvasPluginServices {
customElement: CanvasCustomElementService;
embeddables: CanvasEmbeddablesService;
expressions: CanvasExpressionsService;
labs: CanvasLabsService;
navLink: CanvasNavLinkService;
notify: CanvasNotifyService;
platform: CanvasPlatformService;
Expand All @@ -30,12 +33,13 @@ export interface CanvasPluginServices {

export const pluginServices = new PluginServices<CanvasPluginServices>();

export const useEmbeddablesService = () =>
(() => pluginServices.getHooks().embeddables.useService())();
export const useCustomElementService = () =>
(() => pluginServices.getHooks().customElement.useService())();
export const useEmbeddablesService = () =>
(() => pluginServices.getHooks().embeddables.useService())();
export const useExpressionsService = () =>
(() => pluginServices.getHooks().expressions.useService())();
export const useLabsService = () => (() => pluginServices.getHooks().labs.useService())();
export const useNavLinkService = () => (() => pluginServices.getHooks().navLink.useService())();
export const useNotifyService = () => (() => pluginServices.getHooks().notify.useService())();
export const usePlatformService = () => (() => pluginServices.getHooks().platform.useService())();
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/canvas/public/services/kibana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { CanvasStartDeps } from '../../plugin';
import { customElementServiceFactory } from './custom_element';
import { embeddablesServiceFactory } from './embeddables';
import { expressionsServiceFactory } from './expressions';
import { labsServiceFactory } from './labs';
import { navLinkServiceFactory } from './nav_link';
import { notifyServiceFactory } from './notify';
import { platformServiceFactory } from './platform';
Expand All @@ -26,6 +27,7 @@ import { workpadServiceFactory } from './workpad';
export { customElementServiceFactory } from './custom_element';
export { embeddablesServiceFactory } from './embeddables';
export { expressionsServiceFactory } from './expressions';
export { labsServiceFactory } from './labs';
export { notifyServiceFactory } from './notify';
export { platformServiceFactory } from './platform';
export { reportingServiceFactory } from './reporting';
Expand All @@ -38,6 +40,7 @@ export const pluginServiceProviders: PluginServiceProviders<
customElement: new PluginServiceProvider(customElementServiceFactory),
embeddables: new PluginServiceProvider(embeddablesServiceFactory),
expressions: new PluginServiceProvider(expressionsServiceFactory),
labs: new PluginServiceProvider(labsServiceFactory),
navLink: new PluginServiceProvider(navLinkServiceFactory),
notify: new PluginServiceProvider(notifyServiceFactory),
platform: new PluginServiceProvider(platformServiceFactory),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
*/

import {
KibanaPluginServiceFactory,
projectIDs,
PresentationLabsService,
} from '../../../../../../src/plugins/presentation_util/public';

import { CanvasServiceFactory } from '.';
import { UI_SETTINGS } from '../../../common';
export interface CanvasLabsService extends PresentationLabsService {
projectIDs: typeof projectIDs;
isLabsEnabled: () => boolean;
}
import { CanvasStartDeps } from '../../plugin';
import { CanvasLabsService } from '../labs';

export type CanvasLabsServiceFactory = KibanaPluginServiceFactory<
CanvasLabsService,
CanvasStartDeps
>;

export const labsServiceFactory: CanvasServiceFactory<CanvasLabsService> = async (
_coreSetup,
coreStart,
_setupPlugins,
startPlugins
) => ({
export const labsServiceFactory: CanvasLabsServiceFactory = ({ startPlugins, coreStart }) => ({
projectIDs,
isLabsEnabled: () => coreStart.uiSettings.get(UI_SETTINGS.ENABLE_LABS_UI),
...startPlugins.presentationUtil.labsService,
Expand Down
16 changes: 16 additions & 0 deletions x-pack/plugins/canvas/public/services/labs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import {
projectIDs,
PresentationLabsService,
} from '../../../../../src/plugins/presentation_util/public';

export interface CanvasLabsService extends PresentationLabsService {
projectIDs: typeof projectIDs;
isLabsEnabled: () => boolean;
}
2 changes: 0 additions & 2 deletions x-pack/plugins/canvas/public/services/legacy/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const defaultContextValue = {
export const ServicesContext = createContext<CanvasServices>(defaultContextValue as CanvasServices);

export const useServices = () => useContext(ServicesContext);
export const useLabsService = () => useServices().labs;
export const withServices = <Props extends WithServicesProps>(type: ComponentType<Props>) => {
const EnhancedType: FC<Props> = (props) =>
createElement(type, { ...props, services: useServices() });
Expand All @@ -40,7 +39,6 @@ export const LegacyServicesProvider: FC<{
const specifiedProviders: CanvasServiceProviders = { ...services, ...providers };
const value = {
search: specifiedProviders.search.getService(),
labs: specifiedProviders.labs.getService(),
};
return <ServicesContext.Provider value={value}>{children}</ServicesContext.Provider>;
};
3 changes: 0 additions & 3 deletions x-pack/plugins/canvas/public/services/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { BehaviorSubject } from 'rxjs';
import { CoreSetup, CoreStart, AppUpdater } from '../../../../../../src/core/public';
import { CanvasSetupDeps, CanvasStartDeps } from '../../plugin';
import { searchServiceFactory } from './search';
import { labsServiceFactory } from './labs';

export { SearchService } from './search';
export { ExpressionsService } from '../../../../../../src/plugins/expressions/common';
Expand Down Expand Up @@ -68,14 +67,12 @@ export type ServiceFromProvider<P> = P extends CanvasServiceProvider<infer T> ?

export const services = {
search: new CanvasServiceProvider(searchServiceFactory),
labs: new CanvasServiceProvider(labsServiceFactory),
};

export type CanvasServiceProviders = typeof services;

export interface CanvasServices {
search: ServiceFromProvider<typeof services.search>;
labs: ServiceFromProvider<typeof services.labs>;
}

export const startLegacyServices = async (
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/canvas/public/services/legacy/stubs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
*/

import { CanvasServices, services } from '../';
import { labsService } from './labs';
import { searchService } from './search';

export const stubs: CanvasServices = {
search: searchService,
labs: labsService,
};

export const startServices = async (providedServices: Partial<CanvasServices> = {}) => {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/canvas/public/services/stubs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { CanvasPluginServices } from '..';
import { customElementServiceFactory } from './custom_element';
import { embeddablesServiceFactory } from './embeddables';
import { expressionsServiceFactory } from './expressions';
import { labsServiceFactory } from './labs';
import { navLinkServiceFactory } from './nav_link';
import { notifyServiceFactory } from './notify';
import { platformServiceFactory } from './platform';
Expand All @@ -25,6 +26,7 @@ import { workpadServiceFactory } from './workpad';

export { customElementServiceFactory } from './custom_element';
export { expressionsServiceFactory } from './expressions';
export { labsServiceFactory } from './labs';
export { navLinkServiceFactory } from './nav_link';
export { notifyServiceFactory } from './notify';
export { platformServiceFactory } from './platform';
Expand All @@ -35,6 +37,7 @@ export const pluginServiceProviders: PluginServiceProviders<CanvasPluginServices
customElement: new PluginServiceProvider(customElementServiceFactory),
embeddables: new PluginServiceProvider(embeddablesServiceFactory),
expressions: new PluginServiceProvider(expressionsServiceFactory),
labs: new PluginServiceProvider(labsServiceFactory),
navLink: new PluginServiceProvider(navLinkServiceFactory),
notify: new PluginServiceProvider(notifyServiceFactory),
platform: new PluginServiceProvider(platformServiceFactory),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
* 2.0.
*/

import { projectIDs } from '../../../../../../../src/plugins/presentation_util/public';
import {
PluginServiceFactory,
projectIDs,
} from '../../../../../../src/plugins/presentation_util/public';
import { CanvasLabsService } from '../labs';

type CanvasLabsServiceFactory = PluginServiceFactory<CanvasLabsService>;

const noop = (..._args: any[]): any => {};

export const labsService: CanvasLabsService = {
export const labsServiceFactory: CanvasLabsServiceFactory = () => ({
getProject: noop,
getProjects: noop,
getProjectIDs: () => projectIDs,
Expand All @@ -19,4 +24,4 @@ export const labsService: CanvasLabsService = {
projectIDs,
reset: noop,
setProjectStatus: noop,
};
});
26 changes: 26 additions & 0 deletions x-pack/plugins/maps/public/actions/layer_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,32 @@ export function toggleLayerVisible(layerId: string) {
};
}

export function showThisLayerOnly(layerId: string) {
return (
dispatch: ThunkDispatch<MapStoreState, void, AnyAction>,
getState: () => MapStoreState
) => {
getLayerList(getState()).forEach((layer: ILayer, index: number) => {
if (layer.isBasemap(index)) {
return;
}

// show target layer
if (layer.getId() === layerId) {
if (!layer.isVisible()) {
dispatch(setLayerVisibility(layerId, true));
}
return;
}

// hide all other layers
if (layer.isVisible()) {
dispatch(setLayerVisibility(layer.getId(), false));
}
});
};
}

export function setSelectedLayer(layerId: string | null) {
return async (
dispatch: ThunkDispatch<MapStoreState, void, AnyAction>,
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/maps/public/classes/layers/layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export interface ILayer {
getDescriptor(): LayerDescriptor;
getGeoFieldNames(): string[];
getStyleMetaDescriptorFromLocalFeatures(): Promise<StyleMetaDescriptor | null>;
isBasemap(order: number): boolean;
}

export type CustomIconAndTooltipContent = {
Expand Down Expand Up @@ -527,4 +528,8 @@ export class AbstractLayer implements ILayer {
async getStyleMetaDescriptorFromLocalFeatures(): Promise<StyleMetaDescriptor | null> {
return null;
}

isBasemap(): boolean {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ export class TileLayer extends AbstractLayer {
getLayerTypeIconName() {
return 'grid';
}

isBasemap(order) {
return order === 0;
}
}
Loading

0 comments on commit 2452514

Please sign in to comment.