Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into manage-spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Jul 6, 2021
2 parents 5c3f3de + 87971e7 commit 53ed64a
Show file tree
Hide file tree
Showing 223 changed files with 15,358 additions and 1,493 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core
/src/plugins/security_oss/ @elastic/kibana-security
/src/plugins/spaces_oss/ @elastic/kibana-security
/src/plugins/user_setup/ @elastic/kibana-security
/test/security_functional/ @elastic/kibana-security
/x-pack/plugins/spaces/ @elastic/kibana-security
/x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ In general this plugin provides:
|The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features. At the same time, it provides necessary the APIs for other services (i.e.: telemetry, monitoring, ...) to consume that usage data.
|{kib-repo}blob/{branch}/src/plugins/user_setup/README.md[userSetup]
|The plugin provides UI and APIs for the interactive setup mode.
|{kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor]
|The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc.
It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export interface EmbeddableEditorState
| --- | --- | --- |
| [embeddableId](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.embeddableid.md) | <code>string</code> | |
| [originatingApp](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.originatingapp.md) | <code>string</code> | |
| [searchSessionId](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.searchsessionid.md) | <code>string</code> | Pass current search session id when navigating to an editor, Editors could use it continue previous search session |
| [valueInput](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.valueinput.md) | <code>EmbeddableInput</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [EmbeddableEditorState](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.md) &gt; [searchSessionId](./kibana-plugin-plugins-embeddable-public.embeddableeditorstate.searchsessionid.md)

## EmbeddableEditorState.searchSessionId property

Pass current search session id when navigating to an editor, Editors could use it continue previous search session

<b>Signature:</b>

```typescript
searchSessionId?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export interface EmbeddablePackageState
| --- | --- | --- |
| [embeddableId](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.embeddableid.md) | <code>string</code> | |
| [input](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.input.md) | <code>Optional&lt;EmbeddableInput, 'id'&gt; &#124; Optional&lt;SavedObjectEmbeddableInput, 'id'&gt;</code> | |
| [searchSessionId](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.searchsessionid.md) | <code>string</code> | Pass current search session id when navigating to an editor, Editors could use it continue previous search session |
| [type](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.type.md) | <code>string</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) &gt; [EmbeddablePackageState](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.md) &gt; [searchSessionId](./kibana-plugin-plugins-embeddable-public.embeddablepackagestate.searchsessionid.md)

## EmbeddablePackageState.searchSessionId property

Pass current search session id when navigating to an editor, Editors could use it continue previous search session

<b>Signature:</b>

```typescript
searchSessionId?: string;
```
3 changes: 3 additions & 0 deletions docs/getting-started/quick-start-guide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ If you are you ready to add your own data, refer to <<connect-to-elasticsearch,A
If you want to ingest your data, refer to {fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].

If you want to secure access to your data, refer to our guide on <<tutorial-secure-access-to-kibana, securing {kib}>>

If you want to try out {ml-features} with the sample data sets, refer to
{ml-docs}/ml-getting-started.html[Getting started with {ml}].
4 changes: 4 additions & 0 deletions docs/user/security/authentication/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ image::user/security/images/kibana-login.png["Login Selector UI"]

For more information, refer to <<authentication-security-settings, authentication security settings>>.

TIP: If you have multiple authentication providers configured, you can use the `auth_provider_hint` URL query parameter to create a deep
link to any provider and bypass the Login Selector UI. Using the `kibana.yml` above as an example, you can add `?auth_provider_hint=basic1`
to the login page URL, which will take you directly to the basic login page.

[[basic-authentication]]
==== Basic authentication

Expand Down
21 changes: 20 additions & 1 deletion examples/locator_explorer/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EuiFieldText } from '@elastic/eui';
import { EuiPageHeader } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { AppMountParameters } from '../../../src/core/public';
import { SharePluginSetup } from '../../../src/plugins/share/public';
import { formatSearchParams, SharePluginSetup } from '../../../src/plugins/share/public';
import {
HelloLocatorV1Params,
HelloLocatorV2Params,
Expand All @@ -34,6 +34,7 @@ interface MigratedLink {
linkText: string;
link: string;
version: string;
params: HelloLocatorV1Params | HelloLocatorV2Params;
}

const ActionsExplorer = ({ share }: Props) => {
Expand Down Expand Up @@ -93,6 +94,7 @@ const ActionsExplorer = ({ share }: Props) => {
linkText: savedLink.linkText,
link,
version: savedLink.version,
params: savedLink.params,
} as MigratedLink;
})
);
Expand Down Expand Up @@ -157,7 +159,24 @@ const ActionsExplorer = ({ share }: Props) => {
target="_blank"
>
{link.linkText}
</EuiLink>{' '}
(
<EuiLink
color={link.version !== '0.0.2' ? 'danger' : 'primary'}
data-test-subj="linkToHelloPage"
href={
'/app/r?' +
formatSearchParams({
id: 'HELLO_LOCATOR',
version: link.version,
params: link.params,
}).toString()
}
target="_blank"
>
through redirect app
</EuiLink>
)
<br />
</React.Fragment>
))
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ pageLoadAssetSize:
visTypePie: 35583
expressionRevealImage: 25675
cases: 144442
userSetup: 18532
2 changes: 1 addition & 1 deletion src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class DocLinksService {
customUrls: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-url.html`,
dataFrameAnalytics: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics.html`,
featureImportance: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-roc`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-finding-outliers.html#ml-dfanalytics-roc`,
regressionEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-regression-evaluation`,
classificationAucRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-class-aucroc`,
},
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/dashboard/public/application/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function DashboardApp({
embeddable,
onAppLeave,
uiSettings,
data,
} = useKibana<DashboardAppServices>().services;

const kbnUrlStateStorage = useMemo(
Expand Down Expand Up @@ -98,6 +99,13 @@ export function DashboardApp({
]);
}, [chrome, dashboardState.title, dashboardState.viewMode, redirectTo, savedDashboardId]);

// clear search session when leaving dashboard route
useEffect(() => {
return () => {
data.search.session.clear();
};
}, [data.search.session]);

return (
<>
{isCompleteDashboardAppState(dashboardAppState) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export async function mountApp({
}
render(app, element);
return () => {
dataStart.search.session.clear();
unlistenParentHistory();
unmountComponentAtNode(element);
appUnMounted();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export const buildDashboardContainer = async ({
getLatestDashboardState,
canStoreSearchSession: dashboardCapabilities.storeSearchSession,
});

if (incomingEmbeddable?.searchSessionId) {
session.continue(incomingEmbeddable?.searchSessionId);
}

const searchSessionIdFromURL = getSearchSessionIdFromURL(history);
if (searchSessionIdFromURL) {
session.restore(searchSessionIdFromURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ export const DashboardListing = ({
};
}, [title, savedObjectsClient, redirectTo, data.query, kbnUrlStateStorage]);

// clear dangling session because they are not required here
useEffect(() => {
data.search.session.clear();
}, [data.search.session]);

const hideWriteControls = dashboardCapabilities.hideWriteControls;
const listingLimit = savedObjects.settings.getListingLimit();
const defaultFilter = title ? `"${title}"` : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,11 @@ export function DashboardTopNav({
path,
state: {
originatingApp: DashboardConstants.DASHBOARDS_ID,
searchSessionId: data.search.session.getSessionId(),
},
});
},
[trackUiMetric, stateTransferService]
[stateTransferService, data.search.session, trackUiMetric]
);

const clearAddPanel = useCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2783,7 +2783,7 @@ export interface WaitUntilNextSessionCompletesOptions {
// src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/search/session/session_service.ts:56:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/search/session/session_service.ts:62:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/public/search/session/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ export function getSessionServiceMock(): jest.Mocked<ISessionService> {
isSessionStorageReady: jest.fn(() => true),
getSearchSessionIndicatorUiConfig: jest.fn(() => ({ isDisabled: () => ({ disabled: false }) })),
hasAccess: jest.fn(() => true),
continue: jest.fn(),
};
}
70 changes: 68 additions & 2 deletions src/plugins/data/public/search/session/session_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ describe('Session service', () => {
expect(nowProvider.reset).toHaveBeenCalled();
});

it("Can clear other apps' session", async () => {
it("Can't clear other apps' session", async () => {
sessionService.start();
expect(sessionService.getSessionId()).not.toBeUndefined();
currentAppId$.next('change');
sessionService.clear();
expect(sessionService.getSessionId()).toBeUndefined();
expect(sessionService.getSessionId()).not.toBeUndefined();
});

it("Can start a new session in case there is other apps' stale session", async () => {
Expand Down Expand Up @@ -161,6 +161,72 @@ describe('Session service', () => {
});
});

it('Can continue previous session from another app', async () => {
sessionService.start();
const sessionId = sessionService.getSessionId();

sessionService.clear();
currentAppId$.next('change');
sessionService.continue(sessionId!);

expect(sessionService.getSessionId()).toBe(sessionId);
});

it('Calling clear() more than once still allows previous session from another app to continue', async () => {
sessionService.start();
const sessionId = sessionService.getSessionId();

sessionService.clear();
sessionService.clear();

currentAppId$.next('change');
sessionService.continue(sessionId!);

expect(sessionService.getSessionId()).toBe(sessionId);
});

it('Continue drops storage configuration', () => {
sessionService.start();
const sessionId = sessionService.getSessionId();

sessionService.enableStorage({
getName: async () => 'Name',
getUrlGeneratorData: async () => ({
urlGeneratorId: 'id',
initialState: {},
restoreState: {},
}),
});

expect(sessionService.isSessionStorageReady()).toBe(true);

sessionService.clear();

sessionService.continue(sessionId!);

expect(sessionService.isSessionStorageReady()).toBe(false);
});

// it might be that search requests finish after the session is cleared and before it was continued,
// to avoid "infinite loading" state after we continue the session we have to drop pending searches
it('Continue drops client side loading state', async () => {
const sessionId = sessionService.start();

sessionService.trackSearch({ abort: () => {} });
expect(state$.getValue()).toBe(SearchSessionState.Loading);

sessionService.clear(); // even allow to call clear multiple times

expect(state$.getValue()).toBe(SearchSessionState.None);

sessionService.continue(sessionId!);
expect(sessionService.getSessionId()).toBe(sessionId);

// the original search was never `untracked`,
// but we still consider this a completed session until new search fire
expect(state$.getValue()).toBe(SearchSessionState.Completed);
});

test('getSearchOptions infers isRestore & isStored from state', async () => {
const sessionId = sessionService.start();
const someOtherId = 'some-other-id';
Expand Down
Loading

0 comments on commit 53ed64a

Please sign in to comment.