kibana/docs/management
Julia Rechkunova 625e89e144
[Discover][DocViewer] Limit the height of long field values by default (#183736)
- Closes https://github.com/elastic/kibana/issues/181568

## Summary

This PR adds a default height limit for values in DocViewer. If the
value is too long, we visually truncate it and add "View more" button
which allows to expand to view the entire value. This way all fields in
the flyout are easily accessible (less scrolling required) even if they
contain long values. ~The height can be configured via the existing
`truncate:maxHeight` Advanced Setting.~ If user expands a value, closes
the flyout and opens it again, the value will be shown as expanded again
for that field.

![Aug-02-2024
10-24-58](https://github.com/user-attachments/assets/d3a898ce-dc92-4f5e-bc63-f1761a100e0d)


Related: https://github.com/elastic/kibana/pull/164236

## Testing

Some cases to check while testing:
- varios value formats
- legacy table vs data grid
- doc viewer flyout vs Single Document page

Sample long value:
<details>

<pre>
POST test_this/_doc/
{
  "message": """javax.servlet.ServletException: Something bad happened
at
com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:60)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at
com.example.myproject.ExceptionHandlerFilter.doFilter(ExceptionHandlerFilter.java:28)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at
com.example.myproject.OutputBufferFilter.doFilter(OutputBufferFilter.java:33)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.example.myproject.MyProjectServletException
    at com.example.myproject.MyServlet.doPost(MyServlet.java:169)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at
com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:30)
    ... 27 more
Caused by: org.hibernate.exception.ConstraintViolationException: could
not insert: [com.example.myproject.MyEntity]
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at
org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:64)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2329)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2822)
at
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
    at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:705)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:693)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:689)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344)
    at $Proxy19.save(Unknown Source)
at com.example.myproject.MyEntityService.save(MyEntityService.java:59)
<-- relevant call (see notes below)
    at com.example.myproject.MyServlet.doPost(MyServlet.java:164)
    ... 32 more
Caused by: java.sql.SQLException: Violation of unique constraint
MY_ENTITY_UK_1: duplicate value(s) for column(s) MY_COLUMN in statement
[...]
    at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at
org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
    ... 54 more"""
}
</pre>
</details>

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
2024-08-10 04:06:10 -05:00
..
cases [DOCS][Cases] Custom fields general availability (#188598) 2024-07-19 02:10:24 +10:00
connectors TheHive Case Connector (#180138) 2024-07-30 11:36:21 +03:00
field-formatters Fix typos in docs & dev_docs (#113746) 2021-10-07 14:30:32 -04:00
images [Data views] Add composite runtime field docs with screenshots (#141013) 2022-09-23 13:19:50 +09:30
index-patterns/images [DOCS] Adds drag & drop to Discover (#157340) 2023-05-16 15:35:47 -07:00
ingest-pipelines/images [DOCS] Migrate ingest pipeline docs to ES reference (#94625) 2021-03-17 17:09:34 -04:00
maintenance-windows [DOCS] Clarify that all rules support alert summaries (#177755) 2024-03-12 21:20:14 +00:00
rollups [DOCS] Deprecate rollups (#169670) 2023-10-25 16:51:49 -04:00
saved-objects API docs: Add deprecation warning to all deprecated Saved Object APIs (#150267) 2023-02-07 09:28:13 -07:00
watcher-ui ES cluster privileges for watcher removed in documentation (#159278) 2023-06-20 14:39:04 -04:00
action-types.asciidoc TheHive Case Connector (#180138) 2024-07-30 11:36:21 +03:00
advanced-options.asciidoc [Discover][DocViewer] Limit the height of long field values by default (#183736) 2024-08-10 04:06:10 -05:00
manage-data-views.asciidoc [DOCS] Adds note that default formatters use the meta.unit field (#176857) 2024-02-19 14:51:30 +00:00
managing-licenses.asciidoc [DOCS] Remove obsolete license expiration info (#131474) 2022-05-20 13:34:04 -07:00
managing-saved-objects.asciidoc [DOCS] Updates saved objects & other docs (#139328) 2022-09-21 16:11:41 -07:00
managing-tags.asciidoc [DOCS] Updates saved objects & other docs (#139328) 2022-09-21 16:11:41 -07:00
numeral.asciidoc [DOCS] Renames index pattern in management and monitoring (#117939) 2021-11-10 10:20:23 -08:00
upgrade-assistant.asciidoc [DOCS] Fix typo in Upgrade Assistant docs (#167031) 2023-09-25 10:19:27 -04:00