Skip to content

Commit d0bc4d1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into np/fix-uuid-on-optimize
2 parents 7bc0225 + 6c6bc1f commit d0bc4d1

File tree

622 files changed

+9156
-8531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

622 files changed

+9156
-8531
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,7 @@
195195
/x-pack/test/detection_engine_api_integration @elastic/siem
196196
/x-pack/test/api_integration/apis/siem @elastic/siem
197197
/x-pack/plugins/case @elastic/siem
198+
199+
# Security Intelligence And Analytics
200+
/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics
201+
/x-pack/plugins/siem/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics

docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export interface SavedObjectsServiceSetup
1616

1717
When plugins access the Saved Objects client, a new client is created using the factory provided to `setClientFactory` and wrapped by all wrappers registered through `addClientWrapper`<!-- -->.
1818

19+
All the setup APIs will throw if called after the service has started, and therefor cannot be used from legacy plugin code. Legacy plugins should use the legacy savedObject service until migrated.
20+
1921
## Example 1
2022

2123

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsTypeMappingDefinition](./kibana-plugin-server.savedobjectstypemappingdefinition.md) &gt; [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md)
4+
5+
## SavedObjectsTypeMappingDefinition.dynamic property
6+
7+
The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
dynamic?: false | 'strict';
13+
```

docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ const typeDefinition: SavedObjectsTypeMappingDefinition = {
4141

4242
| Property | Type | Description |
4343
| --- | --- | --- |
44-
| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | <code>SavedObjectsMappingProperties</code> | |
44+
| [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) | <code>false &#124; 'strict'</code> | The dynamic property of the mapping. either <code>false</code> or 'strict'. Defaults to strict |
45+
| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | <code>SavedObjectsMappingProperties</code> | The underlying properties of the type mapping |
4546

docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.properties.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## SavedObjectsTypeMappingDefinition.properties property
66

7+
The underlying properties of the type mapping
8+
79
<b>Signature:</b>
810

911
```typescript

examples/ui_action_examples/public/hello_world_action.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ import { toMountPoint } from '../../../src/plugins/kibana_react/public';
2424

2525
export const HELLO_WORLD_ACTION_TYPE = 'HELLO_WORLD_ACTION_TYPE';
2626

27-
export const createHelloWorldAction = (openModal: OverlayStart['openModal']) =>
28-
createAction<{}>({
27+
interface StartServices {
28+
openModal: OverlayStart['openModal'];
29+
}
30+
31+
export const createHelloWorldAction = (getStartServices: () => Promise<StartServices>) =>
32+
createAction({
2933
type: HELLO_WORLD_ACTION_TYPE,
3034
getDisplayName: () => 'Hello World!',
3135
execute: async () => {
36+
const { openModal } = await getStartServices();
3237
const overlay = openModal(
3338
toMountPoint(
3439
<EuiModalBody>

examples/ui_action_examples/public/plugin.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,34 @@
1717
* under the License.
1818
*/
1919

20-
import { Plugin, CoreSetup, CoreStart } from '../../../src/core/public';
21-
import { UiActionsSetup, UiActionsStart } from '../../../src/plugins/ui_actions/public';
22-
import { createHelloWorldAction, HELLO_WORLD_ACTION_TYPE } from './hello_world_action';
23-
import { helloWorldTrigger } from './hello_world_trigger';
20+
import { Plugin, CoreSetup } from '../../../src/core/public';
21+
import { UiActionsSetup } from '../../../src/plugins/ui_actions/public';
22+
import { createHelloWorldAction } from './hello_world_action';
23+
import { helloWorldTrigger, HELLO_WORLD_TRIGGER_ID } from './hello_world_trigger';
2424

2525
interface UiActionExamplesSetupDependencies {
2626
uiActions: UiActionsSetup;
2727
}
2828

29-
interface UiActionExamplesStartDependencies {
30-
uiActions: UiActionsStart;
29+
declare module '../../../src/plugins/ui_actions/public' {
30+
export interface TriggerContextMapping {
31+
[HELLO_WORLD_TRIGGER_ID]: undefined;
32+
}
3133
}
3234

3335
export class UiActionExamplesPlugin
34-
implements
35-
Plugin<void, void, UiActionExamplesSetupDependencies, UiActionExamplesStartDependencies> {
36+
implements Plugin<void, void, UiActionExamplesSetupDependencies> {
3637
public setup(core: CoreSetup, { uiActions }: UiActionExamplesSetupDependencies) {
3738
uiActions.registerTrigger(helloWorldTrigger);
38-
uiActions.attachAction(helloWorldTrigger.id, HELLO_WORLD_ACTION_TYPE);
39-
}
4039

41-
public start(coreStart: CoreStart, deps: UiActionExamplesStartDependencies) {
42-
deps.uiActions.registerAction(createHelloWorldAction(coreStart.overlays.openModal));
40+
const helloWorldAction = createHelloWorldAction(async () => ({
41+
openModal: (await core.getStartServices())[0].overlays.openModal,
42+
}));
43+
44+
uiActions.registerAction(helloWorldAction);
45+
uiActions.attachAction(helloWorldTrigger.id, helloWorldAction.id);
4346
}
4447

48+
public start() {}
4549
public stop() {}
4650
}

examples/ui_actions_explorer/public/actions/actions.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@ export const EDIT_USER_ACTION = 'EDIT_USER_ACTION';
3434
export const PHONE_USER_ACTION = 'PHONE_USER_ACTION';
3535
export const SHOWCASE_PLUGGABILITY_ACTION = 'SHOWCASE_PLUGGABILITY_ACTION';
3636

37-
export const showcasePluggability = createAction<{}>({
37+
export const showcasePluggability = createAction({
3838
type: SHOWCASE_PLUGGABILITY_ACTION,
3939
getDisplayName: () => 'This is pluggable! Any plugin can inject their actions here.',
40-
execute: async ({}) => alert("Isn't that cool?!"),
40+
execute: async () => alert("Isn't that cool?!"),
4141
});
4242

43-
export const makePhoneCallAction = createAction<{ phone: string }>({
43+
export type PhoneContext = string;
44+
45+
export const makePhoneCallAction = createAction<PhoneContext>({
4446
type: CALL_PHONE_NUMBER_ACTION,
4547
getDisplayName: () => 'Call phone number',
46-
execute: async ({ phone }) => alert(`Pretend calling ${phone}...`),
48+
execute: async phone => alert(`Pretend calling ${phone}...`),
4749
});
4850

4951
export const lookUpWeatherAction = createAction<{ country: string }>({
@@ -55,11 +57,13 @@ export const lookUpWeatherAction = createAction<{ country: string }>({
5557
},
5658
});
5759

58-
export const viewInMapsAction = createAction<{ country: string }>({
60+
export type CountryContext = string;
61+
62+
export const viewInMapsAction = createAction<CountryContext>({
5963
type: VIEW_IN_MAPS_ACTION,
6064
getIconType: () => 'popout',
6165
getDisplayName: () => 'View in maps',
62-
execute: async ({ country }) => {
66+
execute: async country => {
6367
window.open(`https://www.google.com/maps/place/${country}`, '_blank');
6468
},
6569
});
@@ -110,11 +114,13 @@ export const createEditUserAction = (getOpenModal: () => Promise<OverlayStart['o
110114
},
111115
});
112116

117+
export interface UserContext {
118+
user: User;
119+
update: (user: User) => void;
120+
}
121+
113122
export const createPhoneUserAction = (getUiActionsApi: () => Promise<UiActionsStart>) =>
114-
createAction<{
115-
user: User;
116-
update: (user: User) => void;
117-
}>({
123+
createAction<UserContext>({
118124
type: PHONE_USER_ACTION,
119125
getDisplayName: () => 'Call phone number',
120126
isCompatible: async ({ user }) => user.phone !== undefined,
@@ -126,6 +132,8 @@ export const createPhoneUserAction = (getUiActionsApi: () => Promise<UiActionsSt
126132
// to the phone number trigger.
127133
// TODO: we need to figure out the best way to handle these nested actions however, since
128134
// we don't want multiple context menu's to pop up.
129-
(await getUiActionsApi()).executeTriggerActions(PHONE_TRIGGER, { phone: user.phone });
135+
if (user.phone !== undefined) {
136+
(await getUiActionsApi()).executeTriggerActions(PHONE_TRIGGER, user.phone);
137+
}
130138
},
131139
});

examples/ui_actions_explorer/public/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const ActionsExplorer = ({ uiActionsApi, openModal }: Props) => {
6060
</EuiText>
6161
<EuiButton
6262
data-test-subj="emitHelloWorldTrigger"
63-
onClick={() => uiActionsApi.executeTriggerActions(HELLO_WORLD_TRIGGER_ID, {})}
63+
onClick={() => uiActionsApi.executeTriggerActions(HELLO_WORLD_TRIGGER_ID, undefined)}
6464
>
6565
Say hello world!
6666
</EuiButton>

examples/ui_actions_explorer/public/plugin.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import {
3535
makePhoneCallAction,
3636
showcasePluggability,
3737
SHOWCASE_PLUGGABILITY_ACTION,
38+
UserContext,
39+
CountryContext,
40+
PhoneContext,
3841
} from './actions/actions';
3942

4043
interface StartDeps {
@@ -45,6 +48,14 @@ interface SetupDeps {
4548
uiActions: UiActionsSetup;
4649
}
4750

51+
declare module '../../../src/plugins/ui_actions/public' {
52+
export interface TriggerContextMapping {
53+
[USER_TRIGGER]: UserContext;
54+
[COUNTRY_TRIGGER]: CountryContext;
55+
[PHONE_TRIGGER]: PhoneContext;
56+
}
57+
}
58+
4859
export class UiActionsExplorerPlugin implements Plugin<void, void, {}, StartDeps> {
4960
public setup(core: CoreSetup<{ uiActions: UiActionsStart }>, deps: SetupDeps) {
5061
deps.uiActions.registerTrigger({

0 commit comments

Comments
 (0)