Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Replace node details flyout with asset details flyout in the inventory page #166965

Conversation

jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Sep 21, 2023

Closes #161754
Closes #166807

To make the testing and review easier I merged the old components cleanup PR into this one

Summary

This PR replaces the old node details view with the asset details flyout

Old

image

New

image

Testing

  1. Go to inventory

  2. Click on a host in the waffle map

  3. Click on any host
    - These changes are related only if a Host is selected- in the case of a pod the view shouldn't be changed:
    image

  4. Check the new flyout functionality

inventory_asset_details.mov

Note: the selected host should have a border like in the previous version (this I fixed in the last commit) so it should be added if there is a selected node:
image

@jennypavlova jennypavlova self-assigned this Sep 21, 2023
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

return source ? (
<AssetDetails
asset={{ id: assetName, name: assetName }}
assetType="host"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be replaced when more asset types are supported

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we already make it accept assetType as prop?


after(async () => {
await retry.try(async () => {
await pageObjects.infraHome.closeFlyout();
Copy link
Member Author

@jennypavlova jennypavlova Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not in the main block because after the next test when the user is back from the APM page (next test) he won't see the flyout because the inventory state is reset and the host is not available

@@ -118,6 +126,92 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await pageObjects.infraHome.getWaffleMap();
// await pageObjects.infraHome.getWaffleMapTooltips(); see https://github.com/elastic/kibana/issues/137903
});

describe('Asset Details flyout', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that we have tests on the host view here I tried to mostly cover the differences

@jennypavlova jennypavlova marked this pull request as ready for review September 22, 2023 15:00
@jennypavlova jennypavlova requested a review from a team as a code owner September 22, 2023 15:00
@jennypavlova jennypavlova added Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Sep 22, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@jennypavlova
Copy link
Member Author

@elasticmachine merge upstream

kibanamachine and others added 3 commits September 25, 2023 09:10
…with-asset-details-flyout-in-the-inventory-page
…with-asset-details-flyout-in-the-inventory-page
…with-asset-details-flyout-in-the-inventory-page
@jennypavlova jennypavlova changed the title [Infra UI]Replace node details flyout with asset details flyout in the inventory page [Infra UI] Replace node details flyout with asset details flyout in the inventory page Sep 25, 2023
@jennypavlova jennypavlova marked this pull request as draft September 25, 2023 17:54
@jennypavlova jennypavlova force-pushed the 161754-infra-ui-replace-node-details-flyout-with-asset-details-flyout-in-the-inventory-page branch from d7f6f32 to c1364b9 Compare September 27, 2023 11:20
@jennypavlova jennypavlova force-pushed the 161754-infra-ui-replace-node-details-flyout-with-asset-details-flyout-in-the-inventory-page branch from c1364b9 to a9308ab Compare September 27, 2023 11:20
@@ -112,15 +112,14 @@ export const NodeSquare = ({
color: string;
nodeName: string;
value: string;
isOverlayOpen: boolean;
nodeBorder?: CSSProperties;
Copy link
Contributor

@crespocarlos crespocarlos Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSSProperties makes this prop accept any style attributes, not only border. So nothing prevents it from receiving { padding-top: "10px" }, for instance.

Would this work?

export const NodeSquare = ({
  ...
  showBorder = false
}: {
  ...,
  showBorder?: boolean
}) => {
   const style: CSSProperties | undefined = showBorder ? { border: 'solid 4px #000' } : undefined
   ...
   <SquareOuter color={color} style={style}>

then to use it:

const nodeSquare = (
    <NodeSquare
      squareSize={squareSize}
      color={color}
      nodeName={node.name}
      value={value}
      showBorder={detailsItemId === node.name || isPopoverOpen}
    />
  );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks :) I changed it as suggested

},
alertRule: {
onCreateRuleClick: () => setIsAlertFlyoutVisible(true),
inventoryRuleLabel: i18n.translate('xpack.infra.infra.nodeDetails.createAlertLink', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both open the alert flyout for the Inventory Threshold rule, this one at the top might not be needed anymore.

I understand that this is what we have in the old flyout, but I think it will be enough if we just have the create rule button in the Alerts section.

@roshan-elastic @jennypavlova , wdyt?

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥 ! Thanks for considering the suggestions.

We just need to decide what to do with the Create inventory rule button at the top of the flyout.

`;
const styles = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for replacing the euiStyled

@@ -0,0 +1,165 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! If in the future we find a better way, we can refactor it.

Comment on lines +124 to +125
onKeyPress={togglePopover}
onFocus={showToolTip}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an accessibility eslint error: onMouseOver must be accompanied by onFocus for accessibility.eslint jsx-a11y/mouse-events-have-key-events

@crespocarlos
Copy link
Contributor

@elasticmachine merge upstream

@jennypavlova jennypavlova force-pushed the 161754-infra-ui-replace-node-details-flyout-with-asset-details-flyout-in-the-inventory-page branch from b2be471 to 07e47c2 Compare September 28, 2023 13:33
…-replace-node-details-flyout-with-asset-details-flyout-in-the-inventory-page
@jennypavlova
Copy link
Member Author

jennypavlova commented Sep 28, 2023

Hey @crespocarlos,

We just need to decide what to do with the Create inventory rule button at the top of the flyout.

I removed it as discussed. One thing we need to do is allow the current create rule component to accept additional options where we can pass the metric we want to use (so for example set "Memory Usage" instead of "CPU Usage" in the rule in case it is selected from the dropdown on inventory) but I will add a new enchantment issue to do that in a separate PR as it also includes changes to the details view.

PS. Issue added #167524

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #16 / serverless examples UI Partial Results Example "before all" hook for "should trace mouse events"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 1437 1422 -15

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 2.0MB 1.9MB -30.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
infra 104.9KB 105.2KB +342.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
infra 50 49 -1

Total ESLint disabled count

id before after diff
infra 59 58 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jennypavlova

@jennypavlova jennypavlova merged commit 549195c into elastic:main Sep 28, 2023
jennypavlova added a commit that referenced this pull request Oct 6, 2023
Closes #168156 
## Summary

This PR fixes process charts error: 

![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)

I assume that after the merge of the refactoring PR, those files were
recreated by another PR or most likely when `main` was merged to [the
refactoring PR](#166965) with them
as resolved conflicts. Deleting the files again fixed the issue.

## Testing
I found the issue on serverless but it probably can be reproduced on
on-prem as well
On Serverless: 
- Start a local es instance: `yarn es serverless --kill --clean
--license trial --ssl`
- Enable infra in the `serverless.oblt.dev.yml` file:
   - `xpack.infra.enabled: true`
- Start a local kibana instance: `yarn serverless-oblt --ssl` and see if
the side nav contains the Infrastructure item
- Navigate to https://0.0.0.0:5601/ftw/app/hosts and open Asset details
flyout or page
- Click on the process tab and expand one of the processes
- The charts (CPU and Memory) should be visible
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 6, 2023
Closes elastic#168156
## Summary

This PR fixes process charts error:

![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)

I assume that after the merge of the refactoring PR, those files were
recreated by another PR or most likely when `main` was merged to [the
refactoring PR](elastic#166965) with them
as resolved conflicts. Deleting the files again fixed the issue.

## Testing
I found the issue on serverless but it probably can be reproduced on
on-prem as well
On Serverless:
- Start a local es instance: `yarn es serverless --kill --clean
--license trial --ssl`
- Enable infra in the `serverless.oblt.dev.yml` file:
   - `xpack.infra.enabled: true`
- Start a local kibana instance: `yarn serverless-oblt --ssl` and see if
the side nav contains the Infrastructure item
- Navigate to https://0.0.0.0:5601/ftw/app/hosts and open Asset details
flyout or page
- Click on the process tab and expand one of the processes
- The charts (CPU and Memory) should be visible

(cherry picked from commit 000b70c)
kibanamachine added a commit that referenced this pull request Oct 6, 2023
…8210)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Infra UI] Fix process charts after refactoring
(#168159)](#168159)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-06T12:01:19Z","message":"[Infra
UI] Fix process charts after refactoring (#168159)\n\nCloses #168156
\r\n## Summary\r\n\r\nThis PR fixes process charts error:
\r\n\r\n![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)\r\n\r\nI
assume that after the merge of the refactoring PR, those files
were\r\nrecreated by another PR or most likely when `main` was merged to
[the\r\nrefactoring PR](#166965)
with them\r\nas resolved conflicts. Deleting the files again fixed the
issue.\r\n\r\n## Testing\r\nI found the issue on serverless but it
probably can be reproduced on\r\non-prem as well\r\nOn Serverless: \r\n-
Start a local es instance: `yarn es serverless --kill
--clean\r\n--license trial --ssl`\r\n- Enable infra in the
`serverless.oblt.dev.yml` file:\r\n - `xpack.infra.enabled: true`\r\n-
Start a local kibana instance: `yarn serverless-oblt --ssl` and see
if\r\nthe side nav contains the Infrastructure item\r\n- Navigate to
https://0.0.0.0:5601/ftw/app/hosts and open Asset details\r\nflyout or
page\r\n- Click on the process tab and expand one of the processes\r\n-
The charts (CPU and Memory) should be
visible","sha":"000b70c000ec1c8ce9d2ccda6faf60247116a263","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Infra
Monitoring
UI","release_note:skip","backport:prev-minor","v8.12.0"],"number":168159,"url":"https://github.com/elastic/kibana/pull/168159","mergeCommit":{"message":"[Infra
UI] Fix process charts after refactoring (#168159)\n\nCloses #168156
\r\n## Summary\r\n\r\nThis PR fixes process charts error:
\r\n\r\n![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)\r\n\r\nI
assume that after the merge of the refactoring PR, those files
were\r\nrecreated by another PR or most likely when `main` was merged to
[the\r\nrefactoring PR](#166965)
with them\r\nas resolved conflicts. Deleting the files again fixed the
issue.\r\n\r\n## Testing\r\nI found the issue on serverless but it
probably can be reproduced on\r\non-prem as well\r\nOn Serverless: \r\n-
Start a local es instance: `yarn es serverless --kill
--clean\r\n--license trial --ssl`\r\n- Enable infra in the
`serverless.oblt.dev.yml` file:\r\n - `xpack.infra.enabled: true`\r\n-
Start a local kibana instance: `yarn serverless-oblt --ssl` and see
if\r\nthe side nav contains the Infrastructure item\r\n- Navigate to
https://0.0.0.0:5601/ftw/app/hosts and open Asset details\r\nflyout or
page\r\n- Click on the process tab and expand one of the processes\r\n-
The charts (CPU and Memory) should be
visible","sha":"000b70c000ec1c8ce9d2ccda6faf60247116a263"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168159","number":168159,"mergeCommit":{"message":"[Infra
UI] Fix process charts after refactoring (#168159)\n\nCloses #168156
\r\n## Summary\r\n\r\nThis PR fixes process charts error:
\r\n\r\n![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)\r\n\r\nI
assume that after the merge of the refactoring PR, those files
were\r\nrecreated by another PR or most likely when `main` was merged to
[the\r\nrefactoring PR](#166965)
with them\r\nas resolved conflicts. Deleting the files again fixed the
issue.\r\n\r\n## Testing\r\nI found the issue on serverless but it
probably can be reproduced on\r\non-prem as well\r\nOn Serverless: \r\n-
Start a local es instance: `yarn es serverless --kill
--clean\r\n--license trial --ssl`\r\n- Enable infra in the
`serverless.oblt.dev.yml` file:\r\n - `xpack.infra.enabled: true`\r\n-
Start a local kibana instance: `yarn serverless-oblt --ssl` and see
if\r\nthe side nav contains the Infrastructure item\r\n- Navigate to
https://0.0.0.0:5601/ftw/app/hosts and open Asset details\r\nflyout or
page\r\n- Click on the process tab and expand one of the processes\r\n-
The charts (CPU and Memory) should be
visible","sha":"000b70c000ec1c8ce9d2ccda6faf60247116a263"}}]}]
BACKPORT-->

Co-authored-by: jennypavlova <[email protected]>
dej611 pushed a commit to dej611/kibana that referenced this pull request Oct 17, 2023
Closes elastic#168156 
## Summary

This PR fixes process charts error: 

![image](https://github.com/elastic/kibana/assets/14139027/4d907c77-07a3-40da-96fd-2340bce2efc8)

I assume that after the merge of the refactoring PR, those files were
recreated by another PR or most likely when `main` was merged to [the
refactoring PR](elastic#166965) with them
as resolved conflicts. Deleting the files again fixed the issue.

## Testing
I found the issue on serverless but it probably can be reproduced on
on-prem as well
On Serverless: 
- Start a local es instance: `yarn es serverless --kill --clean
--license trial --ssl`
- Enable infra in the `serverless.oblt.dev.yml` file:
   - `xpack.infra.enabled: true`
- Start a local kibana instance: `yarn serverless-oblt --ssl` and see if
the side nav contains the Infrastructure item
- Navigate to https://0.0.0.0:5601/ftw/app/hosts and open Asset details
flyout or page
- Click on the process tab and expand one of the processes
- The charts (CPU and Memory) should be visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.11.0
Projects
None yet
7 participants