-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Add overview tab with the first section to asset details view #160924
Merged
jennypavlova
merged 29 commits into
elastic:main
from
jennypavlova:160376-infra-ui-add-overview-tab-with-the-first-section-to-asset-details-view
Jul 7, 2023
Merged
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
8db7d8e
Add metadata summary
jennypavlova e574b9e
Add overview tab
jennypavlova efa3ad7
KPI tiles changes
jennypavlova 9d9146f
Add show all button in overview metadata section
jennypavlova a18a5f7
Set overview to be the default tab
jennypavlova 96257f8
Change show all button position and icon
jennypavlova 5b13157
Add 'infra' to translations
jennypavlova 1b88fd0
Update existing flyout test
jennypavlova f25fd0c
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova 6ecad31
Update type and add overview tab test
jennypavlova db79644
Small fixes
jennypavlova 1600220
Add storybook and pass dataview and daterange as overrides
jennypavlova c38d4cb
Cleanup imports
jennypavlova 2f4538f
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova afefdbc
Small CR changes
jennypavlova 8c91109
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova ee3c1c2
Extract tile dependencies in common folder
jennypavlova 2ce0f8f
Use React.memo in KPIGrid
jennypavlova 1c34e52
Import fixes
jennypavlova 4a12e3e
Add onTabsStateChange to useTabSwitcher
jennypavlova f686a28
Merge branch 'main' of github.com:elastic/kibana into 160376-infra-ui…
jennypavlova 5e93f2e
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova d21dd63
CR changes
jennypavlova 7735c1c
Show charts if metadata fetch fails
jennypavlova 5d7eb2c
Merge branch 'main' of github.com:elastic/kibana into 160376-infra-ui…
jennypavlova e772b91
Move kpi grid config and tooltip translation to common folder
jennypavlova 2f367b2
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova d24988e
Use correct translations and type in shared kpi config
jennypavlova 0c0b9d5
Merge branch 'main' into 160376-infra-ui-add-overview-tab-with-the-fi…
jennypavlova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
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
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/infra/public/components/asset_details/components/expandable_content.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,58 @@ | ||
/* | ||
* 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 { EuiFlexGroup, EuiFlexItem, EuiLink } from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import useToggle from 'react-use/lib/useToggle'; | ||
|
||
interface ExpandableContentProps { | ||
values: string | string[] | undefined; | ||
} | ||
export const ExpandableContent = (props: ExpandableContentProps) => { | ||
const { values } = props; | ||
const [isExpanded, toggle] = useToggle(false); | ||
|
||
const list = Array.isArray(values) ? values : [values]; | ||
const [first, ...others] = list; | ||
const hasOthers = others.length > 0; | ||
const shouldShowMore = hasOthers && !isExpanded; | ||
|
||
return ( | ||
<EuiFlexGroup gutterSize="xs" responsive={false} alignItems="baseline" wrap direction="column"> | ||
<div> | ||
{first} | ||
{shouldShowMore && ( | ||
<> | ||
{' ... '} | ||
<EuiLink data-test-subj="infraExpandableContentCountMoreLink" onClick={toggle}> | ||
<FormattedMessage | ||
id="xpack.infra.nodeDetails.tabs.metadata.seeMore" | ||
defaultMessage="+{count} more" | ||
values={{ | ||
count: others.length, | ||
}} | ||
/> | ||
</EuiLink> | ||
</> | ||
)} | ||
</div> | ||
{isExpanded && others.map((item, index) => <EuiFlexItem key={index}>{item}</EuiFlexItem>)} | ||
{hasOthers && isExpanded && ( | ||
<EuiFlexItem> | ||
<EuiLink data-test-subj="infraExpandableContentShowLessLink" onClick={toggle}> | ||
{i18n.translate('xpack.infra.nodeDetails.tabs.metadata.seeLess', { | ||
defaultMessage: 'Show less', | ||
})} | ||
</EuiLink> | ||
</EuiFlexItem> | ||
)} | ||
</EuiFlexGroup> | ||
); | ||
}; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a good way to add the types here as I wanted to add this just to mock the data view in order to load the overview tab