diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx
index 06459db154f4..381c44b1bf7b 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx
@@ -38,7 +38,7 @@ const ExtendConfirm = ({
defaultMessage: 'Extend search session expiration',
});
const confirm = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.extendButton', {
- defaultMessage: 'Extend',
+ defaultMessage: 'Extend expiration',
});
const extend = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.dontExtendButton', {
defaultMessage: 'Cancel',
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx
index edc5037f1dbe..1a2b2cfb4ece 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx
@@ -12,15 +12,24 @@ import { SearchSessionsMgmtAPI } from '../../lib/api';
import { UISession } from '../../types';
import { DeleteButton } from './delete_button';
import { ExtendButton } from './extend_button';
+import { InspectButton } from './inspect_button';
import { ACTION, OnActionComplete } from './types';
export const getAction = (
api: SearchSessionsMgmtAPI,
actionType: string,
- { id, name, expires }: UISession,
+ uiSession: UISession,
onActionComplete: OnActionComplete
): IClickActionDescriptor | null => {
+ const { id, name, expires } = uiSession;
switch (actionType) {
+ case ACTION.INSPECT:
+ return {
+ iconType: 'document',
+ textColor: 'default',
+ label: ,
+ };
+
case ACTION.DELETE:
return {
iconType: 'crossInACircleFilled',
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss
new file mode 100644
index 000000000000..a43bb65927ed
--- /dev/null
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss
@@ -0,0 +1,6 @@
+.searchSessionsFlyout .euiFlyoutBody__overflowContent {
+ height: 100%;
+ > div {
+ height: 100%;
+ }
+}
\ No newline at end of file
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx
new file mode 100644
index 000000000000..86dca64909b5
--- /dev/null
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx
@@ -0,0 +1,134 @@
+/*
+ * 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 {
+ EuiFlyout,
+ EuiFlyoutBody,
+ EuiFlyoutHeader,
+ EuiPortal,
+ EuiSpacer,
+ EuiText,
+ EuiTitle,
+} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+import React, { Component, Fragment } from 'react';
+import { UISession } from '../../types';
+import { TableText } from '..';
+import { CodeEditor } from '../../../../../../../../src/plugins/kibana_react/public';
+import './inspect_button.scss';
+
+interface Props {
+ searchSession: UISession;
+}
+
+interface State {
+ isFlyoutVisible: boolean;
+}
+
+export class InspectButton extends Component {
+ constructor(props: Props) {
+ super(props);
+
+ this.state = {
+ isFlyoutVisible: false,
+ };
+
+ this.closeFlyout = this.closeFlyout.bind(this);
+ this.showFlyout = this.showFlyout.bind(this);
+ }
+
+ public renderInfo() {
+ return (
+
+ {}}
+ options={{
+ readOnly: true,
+ lineNumbers: 'off',
+ fontSize: 12,
+ minimap: {
+ enabled: false,
+ },
+ scrollBeyondLastLine: false,
+ wordWrap: 'on',
+ wrappingIndent: 'indent',
+ automaticLayout: true,
+ }}
+ />
+
+ );
+ }
+
+ public render() {
+ let flyout;
+
+ if (this.state.isFlyoutVisible) {
+ flyout = (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {this.renderInfo()}
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+ {flyout}
+
+ );
+ }
+
+ private closeFlyout = () => {
+ this.setState({
+ isFlyoutVisible: false,
+ });
+ };
+
+ private showFlyout = () => {
+ this.setState({ isFlyoutVisible: true });
+ };
+}
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts
index 5f82f16adcbb..c94b6aa8495c 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts
@@ -8,6 +8,7 @@
export type OnActionComplete = () => void;
export enum ACTION {
+ INSPECT = 'inspect',
EXTEND = 'extend',
DELETE = 'delete',
}
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx
index 3d92f349fd2d..f1d4f2ab379a 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx
@@ -31,6 +31,8 @@ describe('Background Search Session management status labels', () => {
status: SearchSessionStatus.IN_PROGRESS,
created: '2020-12-02T00:19:32Z',
expires: '2020-12-07T00:19:32Z',
+ initialState: {},
+ restoreState: {},
};
});
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts
index 0fa13ac14522..10b2ac3ec1d4 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts
@@ -46,7 +46,13 @@ describe('Search Sessions Management API', () => {
saved_objects: [
{
id: 'hello-pizza-123',
- attributes: { name: 'Veggie', appId: 'pizza', status: 'complete' },
+ attributes: {
+ name: 'Veggie',
+ appId: 'pizza',
+ status: 'complete',
+ initialState: {},
+ restoreState: {},
+ },
},
],
} as SavedObjectsFindResponse;
@@ -61,6 +67,7 @@ describe('Search Sessions Management API', () => {
Array [
Object {
"actions": Array [
+ "inspect",
"extend",
"delete",
],
@@ -68,8 +75,10 @@ describe('Search Sessions Management API', () => {
"created": undefined,
"expires": undefined,
"id": "hello-pizza-123",
+ "initialState": Object {},
"name": "Veggie",
"reloadUrl": "hello-cool-undefined-url",
+ "restoreState": Object {},
"restoreUrl": "hello-cool-undefined-url",
"status": "complete",
},
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts
index 42e9384cce2d..39da58cb7691 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts
@@ -21,6 +21,7 @@ type UrlGeneratorsStart = SharePluginStart['urlGenerators'];
function getActions(status: SearchSessionStatus) {
const actions: ACTION[] = [];
+ actions.push(ACTION.INSPECT);
if (status === SearchSessionStatus.IN_PROGRESS || status === SearchSessionStatus.COMPLETE) {
actions.push(ACTION.EXTEND);
actions.push(ACTION.DELETE);
@@ -78,6 +79,8 @@ const mapToUISession = (urls: UrlGeneratorsStart, config: SessionsConfigSchema)
actions,
restoreUrl,
reloadUrl,
+ initialState,
+ restoreState,
};
};
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx
index 2aab35e34a2d..fc0a8849006d 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx
@@ -66,6 +66,8 @@ describe('Search Sessions Management table column factory', () => {
status: SearchSessionStatus.IN_PROGRESS,
created: '2020-12-02T00:19:32Z',
expires: '2020-12-07T00:19:32Z',
+ initialState: {},
+ restoreState: {},
};
});
diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts
index d9aea4ddae93..e7b48f319a8a 100644
--- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts
+++ b/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts
@@ -32,4 +32,6 @@ export interface UISession {
actions?: ACTION[];
reloadUrl: string;
restoreUrl: string;
+ initialState: Record;
+ restoreState: Record;
}