mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[Inspector] Migrate scss to emotion (#216195)
## Summary Part of https://github.com/elastic/kibana/issues/207852 for inspector. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
0e63fce8aa
commit
a7142c0d7b
11 changed files with 62 additions and 73 deletions
|
@ -85,7 +85,7 @@ pageLoadAssetSize:
|
||||||
infra: 184320
|
infra: 184320
|
||||||
ingestPipelines: 58003
|
ingestPipelines: 58003
|
||||||
inputControlVis: 172675
|
inputControlVis: 172675
|
||||||
inspector: 148711
|
inspector: 17600
|
||||||
interactiveSetup: 80000
|
interactiveSetup: 80000
|
||||||
inventory: 27430
|
inventory: 27430
|
||||||
investigate: 17970
|
investigate: 17970
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
@import 'views/index';
|
|
|
@ -7,10 +7,6 @@
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: https://github.com/elastic/kibana/issues/109900
|
|
||||||
|
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import { PluginInitializerContext } from '@kbn/core/public';
|
import { PluginInitializerContext } from '@kbn/core/public';
|
||||||
import { InspectorPublicPlugin } from './plugin';
|
import { InspectorPublicPlugin } from './plugin';
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Array [
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div
|
<div
|
||||||
class="euiFlyoutBody insInspectorPanel__flyoutBody emotion-euiFlyoutBody"
|
class="euiFlyoutBody emotion-EuiFlyoutBody"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="euiFlyoutBody__overflow emotion-euiFlyoutBody__overflow-noBanner"
|
class="euiFlyoutBody__overflow emotion-euiFlyoutBody__overflow-noBanner"
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
.insInspectorPanel__flyoutBody {
|
|
||||||
.euiFlyoutBody__overflowContent {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
>div {
|
|
||||||
flex-grow: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.insRequestCodeViewer {
|
|
||||||
flex-grow: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import './inspector_panel.scss';
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import React, { Component, Suspense } from 'react';
|
import React, { Component, Suspense } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
@ -28,6 +27,7 @@ import {
|
||||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||||
import { SharePluginStart } from '@kbn/share-plugin/public';
|
import { SharePluginStart } from '@kbn/share-plugin/public';
|
||||||
import type { SettingsStart } from '@kbn/core-ui-settings-browser';
|
import type { SettingsStart } from '@kbn/core-ui-settings-browser';
|
||||||
|
import { css } from '@emotion/react';
|
||||||
import { InspectorViewDescription } from '../types';
|
import { InspectorViewDescription } from '../types';
|
||||||
import { Adapters } from '../../common';
|
import { Adapters } from '../../common';
|
||||||
import { InspectorViewChooser } from './inspector_view_chooser';
|
import { InspectorViewChooser } from './inspector_view_chooser';
|
||||||
|
@ -143,7 +143,24 @@ export class InspectorPanel extends Component<InspectorPanelProps, InspectorPane
|
||||||
</EuiFlexItem>
|
</EuiFlexItem>
|
||||||
</EuiFlexGroup>
|
</EuiFlexGroup>
|
||||||
</EuiFlyoutHeader>
|
</EuiFlyoutHeader>
|
||||||
<EuiFlyoutBody className="insInspectorPanel__flyoutBody">
|
<EuiFlyoutBody
|
||||||
|
css={css({
|
||||||
|
'.euiFlyoutBody__overflowContent': {
|
||||||
|
height: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
flexWrap: 'nowrap',
|
||||||
|
flexDirection: 'column',
|
||||||
|
|
||||||
|
'> div': {
|
||||||
|
flexGrow: 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'.insRequestCodeViewer': {
|
||||||
|
flexGrow: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
>
|
||||||
{this.renderSelectedPanel()}
|
{this.renderSelectedPanel()}
|
||||||
</EuiFlyoutBody>
|
</EuiFlyoutBody>
|
||||||
</KibanaContextProvider>
|
</KibanaContextProvider>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
@import './requests/index';
|
|
|
@ -1 +0,0 @@
|
||||||
@import './requests';
|
|
|
@ -1,18 +0,0 @@
|
||||||
.insRequestDetailsStats__icon {
|
|
||||||
margin-left: $euiSizeXS;
|
|
||||||
}
|
|
||||||
|
|
||||||
.insRequestSelector__singleRequest {
|
|
||||||
height: $euiButtonHeightSmall;
|
|
||||||
padding: 0 $euiSizeS;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.insRequestSelector__menuSpinner {
|
|
||||||
margin-left: $euiSizeS;
|
|
||||||
}
|
|
||||||
|
|
||||||
.insRequestCodeViewer .react-monaco-editor-container {
|
|
||||||
flex-grow: 1; // Ensure the editor takes the full height of its flex container on Safari.
|
|
||||||
}
|
|
|
@ -16,6 +16,7 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { XJsonLang } from '@kbn/monaco';
|
import { XJsonLang } from '@kbn/monaco';
|
||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
import { CodeEditor } from '@kbn/code-editor';
|
import { CodeEditor } from '@kbn/code-editor';
|
||||||
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
interface RequestCodeViewerProps {
|
interface RequestCodeViewerProps {
|
||||||
value: string;
|
value: string;
|
||||||
|
@ -37,6 +38,11 @@ export const RequestCodeViewer = ({ value, actions }: RequestCodeViewerProps) =>
|
||||||
wrap={false}
|
wrap={false}
|
||||||
responsive={false}
|
responsive={false}
|
||||||
className="insRequestCodeViewer"
|
className="insRequestCodeViewer"
|
||||||
|
css={css({
|
||||||
|
'.react-monaco-editor-container': {
|
||||||
|
flexGrow: 1, // Ensure the editor takes the full height of its flex container on Safari.
|
||||||
|
},
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<EuiSpacer size="s" />
|
<EuiSpacer size="s" />
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import { css } from '@emotion/react';
|
||||||
import {
|
import {
|
||||||
EuiIcon,
|
EuiIcon,
|
||||||
EuiIconTip,
|
EuiIconTip,
|
||||||
|
@ -15,27 +16,25 @@ import {
|
||||||
EuiTableBody,
|
EuiTableBody,
|
||||||
EuiTableRow,
|
EuiTableRow,
|
||||||
EuiTableRowCell,
|
EuiTableRowCell,
|
||||||
|
useEuiTheme,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Request, RequestStatistic } from '../../../../../common/adapters/request/types';
|
|
||||||
import { DetailViewProps } from './types';
|
import { DetailViewProps } from './types';
|
||||||
|
import { Request, RequestStatistic } from '../../../../../common/adapters/request/types';
|
||||||
|
|
||||||
// TODO: Replace by property once available
|
// TODO: Replace by property once available
|
||||||
interface RequestDetailsStatRow extends RequestStatistic {
|
interface RequestDetailsStatRow extends RequestStatistic {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RequestDetailsStats extends Component<DetailViewProps> {
|
const StatRow = ({ stat }: { stat: RequestDetailsStatRow }) => {
|
||||||
static shouldShow = (request: Request) =>
|
const { euiTheme } = useEuiTheme();
|
||||||
Boolean(request.stats && Object.keys(request.stats).length);
|
return (
|
||||||
|
<EuiTableRow>
|
||||||
renderStatRow = (stat: RequestDetailsStatRow) => {
|
|
||||||
return [
|
|
||||||
<EuiTableRow key={stat.id}>
|
|
||||||
<EuiTableRowCell>
|
<EuiTableRowCell>
|
||||||
{stat.label}
|
{stat.label}
|
||||||
|
|
||||||
<span className="insRequestDetailsStats__icon">
|
<span css={css({ marginLeft: euiTheme.size.xs })}>
|
||||||
{stat.description ? (
|
{stat.description ? (
|
||||||
<EuiIconTip
|
<EuiIconTip
|
||||||
aria-label={i18n.translate('inspector.requests.descriptionRowIconAriaLabel', {
|
aria-label={i18n.translate('inspector.requests.descriptionRowIconAriaLabel', {
|
||||||
|
@ -51,9 +50,13 @@ export class RequestDetailsStats extends Component<DetailViewProps> {
|
||||||
</span>
|
</span>
|
||||||
</EuiTableRowCell>
|
</EuiTableRowCell>
|
||||||
<EuiTableRowCell>{stat.value}</EuiTableRowCell>
|
<EuiTableRowCell>{stat.value}</EuiTableRowCell>
|
||||||
</EuiTableRow>,
|
</EuiTableRow>
|
||||||
];
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export class RequestDetailsStats extends Component<DetailViewProps> {
|
||||||
|
static shouldShow = (request: Request) =>
|
||||||
|
Boolean(request.stats && Object.keys(request.stats).length);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { stats } = this.props.request;
|
const { stats } = this.props.request;
|
||||||
|
@ -68,7 +71,11 @@ export class RequestDetailsStats extends Component<DetailViewProps> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EuiTable responsiveBreakpoint={false}>
|
<EuiTable responsiveBreakpoint={false}>
|
||||||
<EuiTableBody>{sortedStats.map(this.renderStatRow)}</EuiTableBody>
|
<EuiTableBody>
|
||||||
|
{sortedStats.map((stat) => (
|
||||||
|
<StatRow stat={stat} key={stat.id} />
|
||||||
|
))}
|
||||||
|
</EuiTableBody>
|
||||||
</EuiTable>
|
</EuiTable>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue