-
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
[Papercut][Dashboard][Data Discovery] Add description to saved object finder table if applicable #198816
Merged
Merged
[Papercut][Dashboard][Data Discovery] Add description to saved object finder table if applicable #198816
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a11fef7
initial commit
rshen91 37152f0
Merge remote-tracking branch 'upstream/main' into view-desc-add-panel
rshen91 a390889
add description to table
rshen91 d2fd6bc
Merge remote-tracking branch 'upstream/main' into view-desc-add-panel
rshen91 15ed3c5
style changes
rshen91 bd976dd
Merge remote-tracking branch 'upstream/main' into view-desc-add-panel
rshen91 d789013
Merge branch 'main' into view-desc-add-panel
rshen91 24f26d0
same column
rshen91 8118eef
Merge remote-tracking branch 'upstream/main' into view-desc-add-panel
rshen91 b5c722a
update ftrs
rshen91 9d1d3a9
Merge remote-tracking branch 'upstream/main' into view-desc-add-panel
rshen91 94f660f
code review
rshen91 8d04671
update test
rshen91 9533a35
add unit test
rshen91 6b6fe38
style fix
rshen91 006686e
Merge branch 'main' into view-desc-add-panel
rshen91 ba3f1b1
Merge branch 'main' into view-desc-add-panel
davismcphee eb0c924
Merge branch 'main' into view-desc-add-panel
rshen91 a75d20b
Merge branch 'main' into view-desc-add-panel
jughosta 357ecbe
Update src/plugins/saved_objects_finder/public/finder/saved_object_fi…
jughosta 7c7e052
Merge branch 'main' into view-desc-add-panel
jughosta 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
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 |
---|---|---|
|
@@ -140,7 +140,7 @@ export class SavedObjectFinderUi extends React.Component< | |
const savedObjects = response.hits | ||
.map((savedObject) => { | ||
const { | ||
attributes: { name, title }, | ||
attributes: { name, title, description }, | ||
} = savedObject; | ||
const titleToUse = typeof title === 'string' ? title : ''; | ||
const nameToUse = name ? name : titleToUse; | ||
|
@@ -150,6 +150,7 @@ export class SavedObjectFinderUi extends React.Component< | |
title: titleToUse, | ||
name: nameToUse, | ||
simple: savedObject, | ||
description, | ||
}; | ||
}) | ||
.filter((savedObject) => { | ||
|
@@ -307,13 +308,23 @@ export class SavedObjectFinderUi extends React.Component< | |
); | ||
|
||
const tooltipText = this.props.getTooltipText?.(item); | ||
|
||
const description = !!item.simple.attributes.description && ( | ||
<EuiText size="xs" color="subdued"> | ||
{item.simple.attributes.description} | ||
</EuiText> | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome good catch 6b6fe38 for changes |
||
return tooltipText ? ( | ||
<EuiToolTip position="left" content={tooltipText}> | ||
{link} | ||
</EuiToolTip> | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip position="left" content={tooltipText}> | ||
{link} | ||
</EuiToolTip> | ||
{description} | ||
</EuiFlexItem> | ||
) : ( | ||
link | ||
<EuiFlexItem grow={false}> | ||
{link} | ||
{description} | ||
</EuiFlexItem> | ||
); | ||
}, | ||
}, | ||
|
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
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.
In this test you are testing implementation details which is not ideal. Changing the implementation (underlying component, props to those component) will break this test.
Concretely you assume that the
EuiInMemoryTable
is present and that it takesitems
prop.Now I know that you basically copied what other tests are doing 😊 but let's take this opportunity to improve the test.
In https://github.com/elastic/kibana/blob/main/packages/kbn-test-jest-helpers/src/testbed/testbed.ts I wrote a helper function to parse an EUI table and read its content for testing purpose. Let's copy it over in this file.
So on L37 (below the imports), add the helper func
Now this test can become
See how we don't test the underlying implementation. We test that the table renders the correct text.