-
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.
[Metrics UI] Add basic interaction and shell for node details overlay (…
…#82013) * Add basic interaction and shell for node details overlay * Fix typecheck * Remove context menu tests because context menu doesn't exist * Remove outdated tests * Remove unused variable * Show the old overlay by default * Fix typecheck * Fix typo Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts
- Loading branch information
Showing
9 changed files
with
237 additions
and
97 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/overlay.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,93 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiTabbedContent } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { EuiPanel } from '@elastic/eui'; | ||
import React, { CSSProperties, useMemo } from 'react'; | ||
import { EuiText } from '@elastic/eui'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui'; | ||
import { euiStyled } from '../../../../../../../observability/public'; | ||
import { InfraWaffleMapNode, InfraWaffleMapOptions } from '../../../../../lib/lib'; | ||
import { InventoryItemType } from '../../../../../../common/inventory_models/types'; | ||
import { MetricsTab } from './tabs/metrics'; | ||
import { LogsTab } from './tabs/logs'; | ||
import { ProcessesTab } from './tabs/processes'; | ||
import { PropertiesTab } from './tabs/properties'; | ||
|
||
interface Props { | ||
isOpen: boolean; | ||
onClose(): void; | ||
options: InfraWaffleMapOptions; | ||
currentTime: number; | ||
node: InfraWaffleMapNode; | ||
nodeType: InventoryItemType; | ||
} | ||
export const NodeContextPopover = ({ | ||
isOpen, | ||
node, | ||
nodeType, | ||
currentTime, | ||
options, | ||
onClose, | ||
}: Props) => { | ||
const tabConfigs = [MetricsTab, LogsTab, ProcessesTab, PropertiesTab]; | ||
|
||
const tabs = useMemo(() => { | ||
return tabConfigs.map((m) => { | ||
const TabContent = m.content; | ||
return { | ||
...m, | ||
content: ( | ||
<TabContent node={node} nodeType={nodeType} currentTime={currentTime} options={options} /> | ||
), | ||
}; | ||
}); | ||
}, [tabConfigs, node, nodeType, currentTime, options]); | ||
|
||
if (!isOpen) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiPanel hasShadow={true} paddingSize={'none'} style={panelStyle}> | ||
<OverlayHeader> | ||
<EuiFlexGroup alignItems={'center'}> | ||
<EuiFlexItem grow={true}> | ||
<EuiText> | ||
<h4>{node.name}</h4> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty onClick={onClose} iconType={'cross'}> | ||
<FormattedMessage id="xpack.infra.infra.nodeDetails.close" defaultMessage="Close" /> | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</OverlayHeader> | ||
<EuiTabbedContent tabs={tabs} /> | ||
</EuiPanel> | ||
); | ||
}; | ||
|
||
const OverlayHeader = euiStyled.div` | ||
border-color: ${(props) => props.theme.eui.euiBorderColor}; | ||
border-bottom-width: ${(props) => props.theme.eui.euiBorderWidthThick}; | ||
padding: ${(props) => props.theme.eui.euiSizeS}; | ||
padding-bottom: 0; | ||
overflow: hidden; | ||
`; | ||
|
||
const panelStyle: CSSProperties = { | ||
position: 'absolute', | ||
right: 10, | ||
top: -100, | ||
width: '50%', | ||
maxWidth: 600, | ||
zIndex: 2, | ||
height: '50vh', | ||
overflow: 'hidden', | ||
}; |
21 changes: 21 additions & 0 deletions
21
...k/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/logs.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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { TabContent, TabProps } from './shared'; | ||
|
||
const TabComponent = (props: TabProps) => { | ||
return <TabContent>Logs Placeholder</TabContent>; | ||
}; | ||
|
||
export const LogsTab = { | ||
id: 'logs', | ||
name: i18n.translate('xpack.infra.nodeDetails.tabs.logs', { | ||
defaultMessage: 'Logs', | ||
}), | ||
content: TabComponent, | ||
}; |
21 changes: 21 additions & 0 deletions
21
...lugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/metrics.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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { TabContent, TabProps } from './shared'; | ||
|
||
const TabComponent = (props: TabProps) => { | ||
return <TabContent>Metrics Placeholder</TabContent>; | ||
}; | ||
|
||
export const MetricsTab = { | ||
id: 'metrics', | ||
name: i18n.translate('xpack.infra.nodeDetails.tabs.metrics', { | ||
defaultMessage: 'Metrics', | ||
}), | ||
content: TabComponent, | ||
}; |
21 changes: 21 additions & 0 deletions
21
...gins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes.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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { TabContent, TabProps } from './shared'; | ||
|
||
const TabComponent = (props: TabProps) => { | ||
return <TabContent>Processes Placeholder</TabContent>; | ||
}; | ||
|
||
export const ProcessesTab = { | ||
id: 'processes', | ||
name: i18n.translate('xpack.infra.nodeDetails.tabs.processes', { | ||
defaultMessage: 'Processes', | ||
}), | ||
content: TabComponent, | ||
}; |
21 changes: 21 additions & 0 deletions
21
...ins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/properties.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,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { TabContent, TabProps } from './shared'; | ||
|
||
const TabComponent = (props: TabProps) => { | ||
return <TabContent>Properties Placeholder</TabContent>; | ||
}; | ||
|
||
export const PropertiesTab = { | ||
id: 'properties', | ||
name: i18n.translate('xpack.infra.nodeDetails.tabs.properties', { | ||
defaultMessage: 'Properties', | ||
}), | ||
content: TabComponent, | ||
}; |
20 changes: 20 additions & 0 deletions
20
...plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/shared.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,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { InventoryItemType } from '../../../../../../../common/inventory_models/types'; | ||
import { InfraWaffleMapOptions, InfraWaffleMapNode } from '../../../../../../lib/lib'; | ||
import { euiStyled } from '../../../../../../../../observability/public'; | ||
|
||
export interface TabProps { | ||
options: InfraWaffleMapOptions; | ||
currentTime: number; | ||
node: InfraWaffleMapNode; | ||
nodeType: InventoryItemType; | ||
} | ||
|
||
export const TabContent = euiStyled.div` | ||
padding: ${(props) => props.theme.eui.paddingSizes.l}; | ||
`; |
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
Oops, something went wrong.