-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Fix rendering of formatted value #52991
Fix rendering of formatted value #52991
Conversation
src/legacy/core_plugins/vis_type_table/public/paginated_table/rows.js
Outdated
Show resolved
Hide resolved
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
merge conflict between base and head |
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.
Tested and excited to confirm that it works! However, I do think we need to rearrange some of these items. I tend to agree with @alexwizp that the modifications to htmlConvert
make it less intuitive, and I actually think the problem lies in a different place...
From what I can tell, the problem is not that we need to set the url params on the field formatter class and then override them later, it's that in the pipeline_helpers/utilities
we are expecting the format.convert()
on line 171 to accept 4 arguments like they do in index_patterns/format_hit
.
If you add a debugger to the html content type here and compare the same results in Discover and Visualize/Dashboards, you will see what I'm talking about. Discover doesn't use the pipeline_helpers/utilities
, and instead the formatter getConverterFor
is called directly from the index patterns via format_hit
, and all 4 args are preserved. But pipeline_helpers/utilities
uses convert
directly, and then the parsedUrl
that is provided does not actually get passed all the way through.
So while the proposed changes here do technically fix the problem, they are really just a workaround. I see two possible ways to approach this:
- We can change
pipeline_helpers/utilities
to usegetConverterFor
instead ofconvert
(one-line change; I tested this locally and it works. - We fix the FieldFormat
convert
method so that it accepts more args and applies them correctly (i.e. matching theHtmlContextTypeConvert
type).
Option 2 feels like the "right" answer to me since it would fix the problem for anybody using convert
... But this also makes it a bit more risky and would require careful testing. I'm also open to Option 1, though if we went that route it would be good to document this as a follow-up task to investigate later. Curious to hear your thoughts on this.
Lastly, we should definitely add a functional test for this specific case. Really all this needs to do is adjust one of the fields in the index pattern to be url-based (perhaps IP field since that's what was originally presented in the parent issue for this), then navigate to both discover and visualize and verify that the relevant html element is in fact a link. The reason I think a functional test is crucial is because this is a very specific feature that I know does not get tested manually very often, and could easily regress in the future. The field formatter pipeline utilities are also in need of more unit tests in general, but I think a functional test will suffice for this particular issue.
src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts
Outdated
Show resolved
Hide resolved
src/legacy/core_plugins/vis_type_tagcloud/public/components/tag_cloud_visualization.js
Show resolved
Hide resolved
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.
see comments above
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.
Approved by mistake
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
Resolved in #53265 |
Summary
To #35235
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers