-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#90943) * added an info flyout to session management * better filter serialization * Fix jest tests * jest * display the originalState as a json object * code review * Text improvements Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
fe77025
commit 09e80b0
Showing
10 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.searchSessionsFlyout .euiFlyoutBody__overflowContent { | ||
height: 100%; | ||
> div { | ||
height: 100%; | ||
} | ||
} |
134 changes: 134 additions & 0 deletions
134
...k/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
|
||
this.state = { | ||
isFlyoutVisible: false, | ||
}; | ||
|
||
this.closeFlyout = this.closeFlyout.bind(this); | ||
this.showFlyout = this.showFlyout.bind(this); | ||
} | ||
|
||
public renderInfo() { | ||
return ( | ||
<Fragment> | ||
<CodeEditor | ||
languageId="json" | ||
value={JSON.stringify(this.props.searchSession.initialState, null, 2)} | ||
onChange={() => {}} | ||
options={{ | ||
readOnly: true, | ||
lineNumbers: 'off', | ||
fontSize: 12, | ||
minimap: { | ||
enabled: false, | ||
}, | ||
scrollBeyondLastLine: false, | ||
wordWrap: 'on', | ||
wrappingIndent: 'indent', | ||
automaticLayout: true, | ||
}} | ||
/> | ||
</Fragment> | ||
); | ||
} | ||
|
||
public render() { | ||
let flyout; | ||
|
||
if (this.state.isFlyoutVisible) { | ||
flyout = ( | ||
<EuiPortal> | ||
<EuiFlyout | ||
ownFocus | ||
onClose={this.closeFlyout} | ||
size="s" | ||
aria-labelledby="flyoutTitle" | ||
data-test-subj="searchSessionsFlyout" | ||
className="searchSessionsFlyout" | ||
> | ||
<EuiFlyoutHeader hasBorder> | ||
<EuiTitle size="m"> | ||
<h2 id="flyoutTitle"> | ||
<FormattedMessage | ||
id="xpack.data.sessions.management.flyoutTitle" | ||
defaultMessage="Inspect search session" | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
<EuiText> | ||
<EuiText size="xs"> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.data.sessions.management.flyoutText" | ||
defaultMessage="Configuration for this search session" | ||
/> | ||
</p> | ||
</EuiText> | ||
<EuiSpacer /> | ||
{this.renderInfo()} | ||
</EuiText> | ||
</EuiFlyoutBody> | ||
</EuiFlyout> | ||
</EuiPortal> | ||
); | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<TableText onClick={this.showFlyout}> | ||
<FormattedMessage | ||
id="xpack.data.mgmt.searchSessions.flyoutTitle" | ||
aria-label="Inspect" | ||
defaultMessage="Inspect" | ||
/> | ||
</TableText> | ||
{flyout} | ||
</Fragment> | ||
); | ||
} | ||
|
||
private closeFlyout = () => { | ||
this.setState({ | ||
isFlyoutVisible: false, | ||
}); | ||
}; | ||
|
||
private showFlyout = () => { | ||
this.setState({ isFlyoutVisible: true }); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters