-
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.
[Graph] Remove angular from inspect panel (#106368)
* [Discover] remove angular from inspect panel * [Graph] remove ui-ace module import * [Graph] remove uiace angular injected module * [Graph] remove redundant interface * [Graph] remove ui-ace from package.json Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
cf1761c
commit 2bb1309
Showing
7 changed files
with
140 additions
and
59 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
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
109 changes: 109 additions & 0 deletions
109
x-pack/plugins/graph/public/components/inspect_panel/inspect_panel.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,109 @@ | ||
/* | ||
* 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 React, { useMemo, useState } from 'react'; | ||
import { EuiTab, EuiTabs, EuiText } from '@elastic/eui'; | ||
import { monaco, XJsonLang } from '@kbn/monaco'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { IUiSettingsClient } from 'kibana/public'; | ||
import { IndexPattern } from '../../../../../../src/plugins/data/public'; | ||
import { | ||
CodeEditor, | ||
KibanaContextProvider, | ||
} from '../../../../../../src/plugins/kibana_react/public'; | ||
|
||
interface InspectPanelProps { | ||
showInspect?: boolean; | ||
indexPattern?: IndexPattern; | ||
uiSettings: IUiSettingsClient; | ||
lastRequest?: string; | ||
lastResponse?: string; | ||
} | ||
|
||
const CODE_EDITOR_OPTIONS: monaco.editor.IStandaloneEditorConstructionOptions = { | ||
automaticLayout: true, | ||
fontSize: 12, | ||
lineNumbers: 'on', | ||
minimap: { | ||
enabled: false, | ||
}, | ||
overviewRulerBorder: false, | ||
readOnly: true, | ||
scrollbar: { | ||
alwaysConsumeMouseWheel: false, | ||
}, | ||
scrollBeyondLastLine: false, | ||
wordWrap: 'on', | ||
wrappingIndent: 'indent', | ||
}; | ||
|
||
const dummyCallback = () => {}; | ||
|
||
export const InspectPanel = ({ | ||
showInspect, | ||
lastRequest, | ||
lastResponse, | ||
indexPattern, | ||
uiSettings, | ||
}: InspectPanelProps) => { | ||
const [selectedTabId, setSelectedTabId] = useState('request'); | ||
|
||
const onRequestClick = () => setSelectedTabId('request'); | ||
const onResponseClick = () => setSelectedTabId('response'); | ||
|
||
const services = useMemo(() => ({ uiSettings }), [uiSettings]); | ||
|
||
const editorContent = useMemo(() => (selectedTabId === 'request' ? lastRequest : lastResponse), [ | ||
selectedTabId, | ||
lastRequest, | ||
lastResponse, | ||
]); | ||
|
||
if (showInspect) { | ||
return ( | ||
<KibanaContextProvider services={services}> | ||
<div className="gphGraph__menus"> | ||
<div> | ||
<div className="kuiLocalDropdownTitle"> | ||
<FormattedMessage id="xpack.graph.inspect.title" defaultMessage="Inspect" /> | ||
</div> | ||
|
||
<div className="list-group-item"> | ||
<EuiText size="xs" className="help-block"> | ||
<span>http://host:port/{indexPattern?.id}/_graph/explore</span> | ||
</EuiText> | ||
<EuiTabs> | ||
<EuiTab onClick={onRequestClick} isSelected={'request' === selectedTabId}> | ||
<FormattedMessage | ||
id="xpack.graph.inspect.requestTabTitle" | ||
defaultMessage="Request" | ||
/> | ||
</EuiTab> | ||
<EuiTab onClick={onResponseClick} isSelected={'response' === selectedTabId}> | ||
<FormattedMessage | ||
id="xpack.graph.inspect.responseTabTitle" | ||
defaultMessage="Response" | ||
/> | ||
</EuiTab> | ||
</EuiTabs> | ||
<CodeEditor | ||
languageId={XJsonLang.ID} | ||
height={240} | ||
value={editorContent || ''} | ||
onChange={dummyCallback} | ||
editorDidMount={dummyCallback} | ||
options={CODE_EDITOR_OPTIONS} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</KibanaContextProvider> | ||
); | ||
} | ||
|
||
return null; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1617,11 +1617,6 @@ | |
history "^4.9.0" | ||
qs "^6.7.0" | ||
|
||
"@elastic/[email protected]": | ||
version "0.2.3" | ||
resolved "https://registry.yarnpkg.com/@elastic/ui-ace/-/ui-ace-0.2.3.tgz#5281aed47a79b7216c55542b0675e435692f20cd" | ||
integrity sha512-Nti5s2dplBPhSKRwJxG9JXTMOev4jVOWcnTJD1TOkJr1MUBYKVZcNcJtIVMSvahWGmP0B/UfO9q9lyRqdivkvQ== | ||
|
||
"@emotion/babel-plugin-jsx-pragmatic@^0.1.5": | ||
version "0.1.5" | ||
resolved "https://registry.yarnpkg.com/@emotion/babel-plugin-jsx-pragmatic/-/babel-plugin-jsx-pragmatic-0.1.5.tgz#27debfe9c27c4d83574d509787ae553bf8a34d7e" | ||
|
@@ -6951,11 +6946,6 @@ angular-sortable-view@^0.0.17: | |
resolved "https://registry.yarnpkg.com/angular-sortable-view/-/angular-sortable-view-0.0.17.tgz#99e2679951a86b6ee6ff27b099022943c683fb4f" | ||
integrity sha512-2WkhM0Lt/wyMyrX/+7ve9ejSegBd7A4eRBNHEIJz8XMBIOjt+3oM1WpcAm+qNThkmNmmQaDeaYv0TQZw/WDMBw== | ||
|
||
[email protected]: | ||
version "0.2.3" | ||
resolved "https://registry.yarnpkg.com/angular-ui-ace/-/angular-ui-ace-0.2.3.tgz#3cb903428100621a367fc7f641440e97a42a26d0" | ||
integrity sha1-PLkDQoEAYho2f8f2QUQOl6QqJtA= | ||
|
||
angular@>=1.0.6, angular@^1.8.0: | ||
version "1.8.0" | ||
resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.0.tgz#b1ec179887869215cab6dfd0df2e42caa65b1b51" | ||
|